const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CcSeRxRa.js","assets/sha3--8JbGYfk.js","assets/utils-CqP-FaiV.js","assets/clsx.m-DHulAg21.js","assets/index-DC7AP6br.js","assets/events-DQ172AOg.js","assets/index-B8lqC164.js","assets/index-Bgc9HhbY.js","assets/index-D3tye22W.js","assets/index.es-BxZNpZ4D.js"])))=>i.map(i=>d[i]);
var QXe=Object.defineProperty;var Yfe=t=>{throw TypeError(t)};var ZXe=(t,e,n)=>e in t?QXe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $n=(t,e,n)=>ZXe(t,typeof e!="symbol"?e+"":e,n),hH=(t,e,n)=>e.has(t)||Yfe("Cannot "+n);var He=(t,e,n)=>(hH(t,e,"read from private field"),n?n.call(t):e.get(t)),Rn=(t,e,n)=>e.has(t)?Yfe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ut=(t,e,n,r)=>(hH(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Cr=(t,e,n)=>(hH(t,e,"access private method"),n);var gb=(t,e,n,r)=>({set _(s){Ut(t,e,s,n)},get _(){return He(t,e,r)}});function g8e(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(r,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Ru=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ii(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function I6n(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var pH={exports:{}},B8={},mH={exports:{}},Vi={};/**
* @license React
* react.production.min.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.
*/var Xfe;function JXe(){if(Xfe)return Vi;Xfe=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function x(oe){return oe===null||typeof oe!="object"?null:(oe=f&&oe[f]||oe["@@iterator"],typeof oe=="function"?oe:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,v={};function C(oe,de,Ce){this.props=oe,this.context=de,this.refs=v,this.updater=Ce||g}C.prototype.isReactComponent={},C.prototype.setState=function(oe,de){if(typeof oe!="object"&&typeof oe!="function"&&oe!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,oe,de,"setState")},C.prototype.forceUpdate=function(oe){this.updater.enqueueForceUpdate(this,oe,"forceUpdate")};function N(){}N.prototype=C.prototype;function P(oe,de,Ce){this.props=oe,this.context=de,this.refs=v,this.updater=Ce||g}var T=P.prototype=new N;T.constructor=P,y(T,C.prototype),T.isPureReactComponent=!0;var M=Array.isArray,F=Object.prototype.hasOwnProperty,$={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function z(oe,de,Ce){var me,we={},xe=null,be=null;if(de!=null)for(me in de.ref!==void 0&&(be=de.ref),de.key!==void 0&&(xe=""+de.key),de)F.call(de,me)&&!L.hasOwnProperty(me)&&(we[me]=de[me]);var je=arguments.length-2;if(je===1)we.children=Ce;else if(1<je){for(var Ie=Array(je),Re=0;Re<je;Re++)Ie[Re]=arguments[Re+2];we.children=Ie}if(oe&&oe.defaultProps)for(me in je=oe.defaultProps,je)we[me]===void 0&&(we[me]=je[me]);return{$$typeof:t,type:oe,key:xe,ref:be,props:we,_owner:$.current}}function X(oe,de){return{$$typeof:t,type:oe.type,key:de,ref:oe.ref,props:oe.props,_owner:oe._owner}}function ne(oe){return typeof oe=="object"&&oe!==null&&oe.$$typeof===t}function J(oe){var de={"=":"=0",":":"=2"};return"$"+oe.replace(/[=:]/g,function(Ce){return de[Ce]})}var K=/\/+/g;function te(oe,de){return typeof oe=="object"&&oe!==null&&oe.key!=null?J(""+oe.key):de.toString(36)}function fe(oe,de,Ce,me,we){var xe=typeof oe;(xe==="undefined"||xe==="boolean")&&(oe=null);var be=!1;if(oe===null)be=!0;else switch(xe){case"string":case"number":be=!0;break;case"object":switch(oe.$$typeof){case t:case e:be=!0}}if(be)return be=oe,we=we(be),oe=me===""?"."+te(be,0):me,M(we)?(Ce="",oe!=null&&(Ce=oe.replace(K,"$&/")+"/"),fe(we,de,Ce,"",function(Re){return Re})):we!=null&&(ne(we)&&(we=X(we,Ce+(!we.key||be&&be.key===we.key?"":(""+we.key).replace(K,"$&/")+"/")+oe)),de.push(we)),1;if(be=0,me=me===""?".":me+":",M(oe))for(var je=0;je<oe.length;je++){xe=oe[je];var Ie=me+te(xe,je);be+=fe(xe,de,Ce,Ie,we)}else if(Ie=x(oe),typeof Ie=="function")for(oe=Ie.call(oe),je=0;!(xe=oe.next()).done;)xe=xe.value,Ie=me+te(xe,je++),be+=fe(xe,de,Ce,Ie,we);else if(xe==="object")throw de=String(oe),Error("Objects are not valid as a React child (found: "+(de==="[object Object]"?"object with keys {"+Object.keys(oe).join(", ")+"}":de)+"). If you meant to render a collection of children, use an array instead.");return be}function q(oe,de,Ce){if(oe==null)return oe;var me=[],we=0;return fe(oe,me,"","",function(xe){return de.call(Ce,xe,we++)}),me}function se(oe){if(oe._status===-1){var de=oe._result;de=de(),de.then(function(Ce){(oe._status===0||oe._status===-1)&&(oe._status=1,oe._result=Ce)},function(Ce){(oe._status===0||oe._status===-1)&&(oe._status=2,oe._result=Ce)}),oe._status===-1&&(oe._status=0,oe._result=de)}if(oe._status===1)return oe._result.default;throw oe._result}var ae={current:null},W={transition:null},V={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:W,ReactCurrentOwner:$};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Vi.Children={map:q,forEach:function(oe,de,Ce){q(oe,function(){de.apply(this,arguments)},Ce)},count:function(oe){var de=0;return q(oe,function(){de++}),de},toArray:function(oe){return q(oe,function(de){return de})||[]},only:function(oe){if(!ne(oe))throw Error("React.Children.only expected to receive a single React element child.");return oe}},Vi.Component=C,Vi.Fragment=n,Vi.Profiler=s,Vi.PureComponent=P,Vi.StrictMode=r,Vi.Suspense=c,Vi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V,Vi.act=ee,Vi.cloneElement=function(oe,de,Ce){if(oe==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+oe+".");var me=y({},oe.props),we=oe.key,xe=oe.ref,be=oe._owner;if(de!=null){if(de.ref!==void 0&&(xe=de.ref,be=$.current),de.key!==void 0&&(we=""+de.key),oe.type&&oe.type.defaultProps)var je=oe.type.defaultProps;for(Ie in de)F.call(de,Ie)&&!L.hasOwnProperty(Ie)&&(me[Ie]=de[Ie]===void 0&&je!==void 0?je[Ie]:de[Ie])}var Ie=arguments.length-2;if(Ie===1)me.children=Ce;else if(1<Ie){je=Array(Ie);for(var Re=0;Re<Ie;Re++)je[Re]=arguments[Re+2];me.children=je}return{$$typeof:t,type:oe.type,key:we,ref:xe,props:me,_owner:be}},Vi.createContext=function(oe){return oe={$$typeof:o,_currentValue:oe,_currentValue2:oe,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},oe.Provider={$$typeof:a,_context:oe},oe.Consumer=oe},Vi.createElement=z,Vi.createFactory=function(oe){var de=z.bind(null,oe);return de.type=oe,de},Vi.createRef=function(){return{current:null}},Vi.forwardRef=function(oe){return{$$typeof:l,render:oe}},Vi.isValidElement=ne,Vi.lazy=function(oe){return{$$typeof:d,_payload:{_status:-1,_result:oe},_init:se}},Vi.memo=function(oe,de){return{$$typeof:u,type:oe,compare:de===void 0?null:de}},Vi.startTransition=function(oe){var de=W.transition;W.transition={};try{oe()}finally{W.transition=de}},Vi.unstable_act=ee,Vi.useCallback=function(oe,de){return ae.current.useCallback(oe,de)},Vi.useContext=function(oe){return ae.current.useContext(oe)},Vi.useDebugValue=function(){},Vi.useDeferredValue=function(oe){return ae.current.useDeferredValue(oe)},Vi.useEffect=function(oe,de){return ae.current.useEffect(oe,de)},Vi.useId=function(){return ae.current.useId()},Vi.useImperativeHandle=function(oe,de,Ce){return ae.current.useImperativeHandle(oe,de,Ce)},Vi.useInsertionEffect=function(oe,de){return ae.current.useInsertionEffect(oe,de)},Vi.useLayoutEffect=function(oe,de){return ae.current.useLayoutEffect(oe,de)},Vi.useMemo=function(oe,de){return ae.current.useMemo(oe,de)},Vi.useReducer=function(oe,de,Ce){return ae.current.useReducer(oe,de,Ce)},Vi.useRef=function(oe){return ae.current.useRef(oe)},Vi.useState=function(oe){return ae.current.useState(oe)},Vi.useSyncExternalStore=function(oe,de,Ce){return ae.current.useSyncExternalStore(oe,de,Ce)},Vi.useTransition=function(){return ae.current.useTransition()},Vi.version="18.3.1",Vi}var Qfe;function xx(){return Qfe||(Qfe=1,mH.exports=JXe()),mH.exports}/**
* @license React
* react-jsx-runtime.production.min.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.
*/var Zfe;function eQe(){if(Zfe)return B8;Zfe=1;var t=xx(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,u){var d,f={},x=null,g=null;u!==void 0&&(x=""+u),c.key!==void 0&&(x=""+c.key),c.ref!==void 0&&(g=c.ref);for(d in c)r.call(c,d)&&!a.hasOwnProperty(d)&&(f[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)f[d]===void 0&&(f[d]=c[d]);return{$$typeof:e,type:l,key:x,ref:g,props:f,_owner:s.current}}return B8.Fragment=n,B8.jsx=o,B8.jsxs=o,B8}var Jfe;function tQe(){return Jfe||(Jfe=1,pH.exports=eQe()),pH.exports}var i=tQe(),lI={},xH={exports:{}},zd={},gH={exports:{}},bH={};/**
* @license React
* scheduler.production.min.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.
*/var ehe;function nQe(){return ehe||(ehe=1,function(t){function e(W,V){var ee=W.length;W.push(V);e:for(;0<ee;){var oe=ee-1>>>1,de=W[oe];if(0<s(de,V))W[oe]=V,W[ee]=de,ee=oe;else break e}}function n(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var V=W[0],ee=W.pop();if(ee!==V){W[0]=ee;e:for(var oe=0,de=W.length,Ce=de>>>1;oe<Ce;){var me=2*(oe+1)-1,we=W[me],xe=me+1,be=W[xe];if(0>s(we,ee))xe<de&&0>s(be,we)?(W[oe]=be,W[xe]=ee,oe=xe):(W[oe]=we,W[me]=ee,oe=me);else if(xe<de&&0>s(be,ee))W[oe]=be,W[xe]=ee,oe=xe;else break e}}return V}function s(W,V){var ee=W.sortIndex-V.sortIndex;return ee!==0?ee:W.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,x=3,g=!1,y=!1,v=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(W){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=W)r(u),V.sortIndex=V.expirationTime,e(c,V);else break;V=n(u)}}function M(W){if(v=!1,T(W),!y)if(n(c)!==null)y=!0,se(F);else{var V=n(u);V!==null&&ae(M,V.startTime-W)}}function F(W,V){y=!1,v&&(v=!1,N(z),z=-1),g=!0;var ee=x;try{for(T(V),f=n(c);f!==null&&(!(f.expirationTime>V)||W&&!J());){var oe=f.callback;if(typeof oe=="function"){f.callback=null,x=f.priorityLevel;var de=oe(f.expirationTime<=V);V=t.unstable_now(),typeof de=="function"?f.callback=de:f===n(c)&&r(c),T(V)}else r(c);f=n(c)}if(f!==null)var Ce=!0;else{var me=n(u);me!==null&&ae(M,me.startTime-V),Ce=!1}return Ce}finally{f=null,x=ee,g=!1}}var $=!1,L=null,z=-1,X=5,ne=-1;function J(){return!(t.unstable_now()-ne<X)}function K(){if(L!==null){var W=t.unstable_now();ne=W;var V=!0;try{V=L(!0,W)}finally{V?te():($=!1,L=null)}}else $=!1}var te;if(typeof P=="function")te=function(){P(K)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,q=fe.port2;fe.port1.onmessage=K,te=function(){q.postMessage(null)}}else te=function(){C(K,0)};function se(W){L=W,$||($=!0,te())}function ae(W,V){z=C(function(){W(t.unstable_now())},V)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(W){W.callback=null},t.unstable_continueExecution=function(){y||g||(y=!0,se(F))},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(W){switch(x){case 1:case 2:case 3:var V=3;break;default:V=x}var ee=x;x=V;try{return W()}finally{x=ee}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(W,V){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ee=x;x=W;try{return V()}finally{x=ee}},t.unstable_scheduleCallback=function(W,V,ee){var oe=t.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?oe+ee:oe):ee=oe,W){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=ee+de,W={id:d++,callback:V,priorityLevel:W,startTime:ee,expirationTime:de,sortIndex:-1},ee>oe?(W.sortIndex=ee,e(u,W),n(c)===null&&W===n(u)&&(v?(N(z),z=-1):v=!0,ae(M,ee-oe))):(W.sortIndex=de,e(c,W),y||g||(y=!0,se(F))),W},t.unstable_shouldYield=J,t.unstable_wrapCallback=function(W){var V=x;return function(){var ee=x;x=V;try{return W.apply(this,arguments)}finally{x=ee}}}}(bH)),bH}var the;function rQe(){return the||(the=1,gH.exports=nQe()),gH.exports}/**
* @license React
* react-dom.production.min.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.
*/var nhe;function sQe(){if(nhe)return zd;nhe=1;var t=xx(),e=rQe();function n(A){for(var R="https://reactjs.org/docs/error-decoder.html?invariant="+A,Z=1;Z<arguments.length;Z++)R+="&args[]="+encodeURIComponent(arguments[Z]);return"Minified React error #"+A+"; visit "+R+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,s={};function a(A,R){o(A,R),o(A+"Capture",R)}function o(A,R){for(s[A]=R,A=0;A<R.length;A++)r.add(R[A])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function x(A){return c.call(f,A)?!0:c.call(d,A)?!1:u.test(A)?f[A]=!0:(d[A]=!0,!1)}function g(A,R,Z,pe){if(Z!==null&&Z.type===0)return!1;switch(typeof R){case"function":case"symbol":return!0;case"boolean":return pe?!1:Z!==null?!Z.acceptsBooleans:(A=A.toLowerCase().slice(0,5),A!=="data-"&&A!=="aria-");default:return!1}}function y(A,R,Z,pe){if(R===null||typeof R>"u"||g(A,R,Z,pe))return!0;if(pe)return!1;if(Z!==null)switch(Z.type){case 3:return!R;case 4:return R===!1;case 5:return isNaN(R);case 6:return isNaN(R)||1>R}return!1}function v(A,R,Z,pe,Pe,Ve,Nt){this.acceptsBooleans=R===2||R===3||R===4,this.attributeName=pe,this.attributeNamespace=Pe,this.mustUseProperty=Z,this.propertyName=A,this.type=R,this.sanitizeURL=Ve,this.removeEmptyString=Nt}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(A){C[A]=new v(A,0,!1,A,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(A){var R=A[0];C[R]=new v(R,1,!1,A[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(A){C[A]=new v(A,2,!1,A.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(A){C[A]=new v(A,2,!1,A,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(A){C[A]=new v(A,3,!1,A.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(A){C[A]=new v(A,3,!0,A,null,!1,!1)}),["capture","download"].forEach(function(A){C[A]=new v(A,4,!1,A,null,!1,!1)}),["cols","rows","size","span"].forEach(function(A){C[A]=new v(A,6,!1,A,null,!1,!1)}),["rowSpan","start"].forEach(function(A){C[A]=new v(A,5,!1,A.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function P(A){return A[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(A){var R=A.replace(N,P);C[R]=new v(R,1,!1,A,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(A){var R=A.replace(N,P);C[R]=new v(R,1,!1,A,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(A){var R=A.replace(N,P);C[R]=new v(R,1,!1,A,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(A){C[A]=new v(A,1,!1,A.toLowerCase(),null,!1,!1)}),C.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(A){C[A]=new v(A,1,!1,A.toLowerCase(),null,!0,!0)});function T(A,R,Z,pe){var Pe=C.hasOwnProperty(R)?C[R]:null;(Pe!==null?Pe.type!==0:pe||!(2<R.length)||R[0]!=="o"&&R[0]!=="O"||R[1]!=="n"&&R[1]!=="N")&&(y(R,Z,Pe,pe)&&(Z=null),pe||Pe===null?x(R)&&(Z===null?A.removeAttribute(R):A.setAttribute(R,""+Z)):Pe.mustUseProperty?A[Pe.propertyName]=Z===null?Pe.type===3?!1:"":Z:(R=Pe.attributeName,pe=Pe.attributeNamespace,Z===null?A.removeAttribute(R):(Pe=Pe.type,Z=Pe===3||Pe===4&&Z===!0?"":""+Z,pe?A.setAttributeNS(pe,R,Z):A.setAttribute(R,Z))))}var M=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,F=Symbol.for("react.element"),$=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),ne=Symbol.for("react.provider"),J=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),fe=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),ae=Symbol.for("react.offscreen"),W=Symbol.iterator;function V(A){return A===null||typeof A!="object"?null:(A=W&&A[W]||A["@@iterator"],typeof A=="function"?A:null)}var ee=Object.assign,oe;function de(A){if(oe===void 0)try{throw Error()}catch(Z){var R=Z.stack.trim().match(/\n( *(at )?)/);oe=R&&R[1]||""}return`
`+oe+A}var Ce=!1;function me(A,R){if(!A||Ce)return"";Ce=!0;var Z=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(R)if(R=function(){throw Error()},Object.defineProperty(R.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(R,[])}catch(cr){var pe=cr}Reflect.construct(A,[],R)}else{try{R.call()}catch(cr){pe=cr}A.call(R.prototype)}else{try{throw Error()}catch(cr){pe=cr}A()}}catch(cr){if(cr&&pe&&typeof cr.stack=="string"){for(var Pe=cr.stack.split(`
`),Ve=pe.stack.split(`
`),Nt=Pe.length-1,pn=Ve.length-1;1<=Nt&&0<=pn&&Pe[Nt]!==Ve[pn];)pn--;for(;1<=Nt&&0<=pn;Nt--,pn--)if(Pe[Nt]!==Ve[pn]){if(Nt!==1||pn!==1)do if(Nt--,pn--,0>pn||Pe[Nt]!==Ve[pn]){var _n=`
`+Pe[Nt].replace(" at new "," at ");return A.displayName&&_n.includes("<anonymous>")&&(_n=_n.replace("<anonymous>",A.displayName)),_n}while(1<=Nt&&0<=pn);break}}}finally{Ce=!1,Error.prepareStackTrace=Z}return(A=A?A.displayName||A.name:"")?de(A):""}function we(A){switch(A.tag){case 5:return de(A.type);case 16:return de("Lazy");case 13:return de("Suspense");case 19:return de("SuspenseList");case 0:case 2:case 15:return A=me(A.type,!1),A;case 11:return A=me(A.type.render,!1),A;case 1:return A=me(A.type,!0),A;default:return""}}function xe(A){if(A==null)return null;if(typeof A=="function")return A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case L:return"Fragment";case $:return"Portal";case X:return"Profiler";case z:return"StrictMode";case te:return"Suspense";case fe:return"SuspenseList"}if(typeof A=="object")switch(A.$$typeof){case J:return(A.displayName||"Context")+".Consumer";case ne:return(A._context.displayName||"Context")+".Provider";case K:var R=A.render;return A=A.displayName,A||(A=R.displayName||R.name||"",A=A!==""?"ForwardRef("+A+")":"ForwardRef"),A;case q:return R=A.displayName||null,R!==null?R:xe(A.type)||"Memo";case se:R=A._payload,A=A._init;try{return xe(A(R))}catch{}}return null}function be(A){var R=A.type;switch(A.tag){case 24:return"Cache";case 9:return(R.displayName||"Context")+".Consumer";case 10:return(R._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return A=R.render,A=A.displayName||A.name||"",R.displayName||(A!==""?"ForwardRef("+A+")":"ForwardRef");case 7:return"Fragment";case 5:return R;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xe(R);case 8:return R===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R}return null}function je(A){switch(typeof A){case"boolean":case"number":case"string":case"undefined":return A;case"object":return A;default:return""}}function Ie(A){var R=A.type;return(A=A.nodeName)&&A.toLowerCase()==="input"&&(R==="checkbox"||R==="radio")}function Re(A){var R=Ie(A)?"checked":"value",Z=Object.getOwnPropertyDescriptor(A.constructor.prototype,R),pe=""+A[R];if(!A.hasOwnProperty(R)&&typeof Z<"u"&&typeof Z.get=="function"&&typeof Z.set=="function"){var Pe=Z.get,Ve=Z.set;return Object.defineProperty(A,R,{configurable:!0,get:function(){return Pe.call(this)},set:function(Nt){pe=""+Nt,Ve.call(this,Nt)}}),Object.defineProperty(A,R,{enumerable:Z.enumerable}),{getValue:function(){return pe},setValue:function(Nt){pe=""+Nt},stopTracking:function(){A._valueTracker=null,delete A[R]}}}}function Qe(A){A._valueTracker||(A._valueTracker=Re(A))}function Ke(A){if(!A)return!1;var R=A._valueTracker;if(!R)return!0;var Z=R.getValue(),pe="";return A&&(pe=Ie(A)?A.checked?"true":"false":A.value),A=pe,A!==Z?(R.setValue(A),!0):!1}function dt(A){if(A=A||(typeof document<"u"?document:void 0),typeof A>"u")return null;try{return A.activeElement||A.body}catch{return A.body}}function tt(A,R){var Z=R.checked;return ee({},R,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:Z??A._wrapperState.initialChecked})}function nt(A,R){var Z=R.defaultValue==null?"":R.defaultValue,pe=R.checked!=null?R.checked:R.defaultChecked;Z=je(R.value!=null?R.value:Z),A._wrapperState={initialChecked:pe,initialValue:Z,controlled:R.type==="checkbox"||R.type==="radio"?R.checked!=null:R.value!=null}}function Le(A,R){R=R.checked,R!=null&&T(A,"checked",R,!1)}function Be(A,R){Le(A,R);var Z=je(R.value),pe=R.type;if(Z!=null)pe==="number"?(Z===0&&A.value===""||A.value!=Z)&&(A.value=""+Z):A.value!==""+Z&&(A.value=""+Z);else if(pe==="submit"||pe==="reset"){A.removeAttribute("value");return}R.hasOwnProperty("value")?pt(A,R.type,Z):R.hasOwnProperty("defaultValue")&&pt(A,R.type,je(R.defaultValue)),R.checked==null&&R.defaultChecked!=null&&(A.defaultChecked=!!R.defaultChecked)}function ht(A,R,Z){if(R.hasOwnProperty("value")||R.hasOwnProperty("defaultValue")){var pe=R.type;if(!(pe!=="submit"&&pe!=="reset"||R.value!==void 0&&R.value!==null))return;R=""+A._wrapperState.initialValue,Z||R===A.value||(A.value=R),A.defaultValue=R}Z=A.name,Z!==""&&(A.name=""),A.defaultChecked=!!A._wrapperState.initialChecked,Z!==""&&(A.name=Z)}function pt(A,R,Z){(R!=="number"||dt(A.ownerDocument)!==A)&&(Z==null?A.defaultValue=""+A._wrapperState.initialValue:A.defaultValue!==""+Z&&(A.defaultValue=""+Z))}var Gt=Array.isArray;function wt(A,R,Z,pe){if(A=A.options,R){R={};for(var Pe=0;Pe<Z.length;Pe++)R["$"+Z[Pe]]=!0;for(Z=0;Z<A.length;Z++)Pe=R.hasOwnProperty("$"+A[Z].value),A[Z].selected!==Pe&&(A[Z].selected=Pe),Pe&&pe&&(A[Z].defaultSelected=!0)}else{for(Z=""+je(Z),R=null,Pe=0;Pe<A.length;Pe++){if(A[Pe].value===Z){A[Pe].selected=!0,pe&&(A[Pe].defaultSelected=!0);return}R!==null||A[Pe].disabled||(R=A[Pe])}R!==null&&(R.selected=!0)}}function nn(A,R){if(R.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},R,{value:void 0,defaultValue:void 0,children:""+A._wrapperState.initialValue})}function cn(A,R){var Z=R.value;if(Z==null){if(Z=R.children,R=R.defaultValue,Z!=null){if(R!=null)throw Error(n(92));if(Gt(Z)){if(1<Z.length)throw Error(n(93));Z=Z[0]}R=Z}R==null&&(R=""),Z=R}A._wrapperState={initialValue:je(Z)}}function Un(A,R){var Z=je(R.value),pe=je(R.defaultValue);Z!=null&&(Z=""+Z,Z!==A.value&&(A.value=Z),R.defaultValue==null&&A.defaultValue!==Z&&(A.defaultValue=Z)),pe!=null&&(A.defaultValue=""+pe)}function Xt(A){var R=A.textContent;R===A._wrapperState.initialValue&&R!==""&&R!==null&&(A.value=R)}function an(A){switch(A){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Jt(A,R){return A==null||A==="http://www.w3.org/1999/xhtml"?an(R):A==="http://www.w3.org/2000/svg"&&R==="foreignObject"?"http://www.w3.org/1999/xhtml":A}var Ye,Je=function(A){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(R,Z,pe,Pe){MSApp.execUnsafeLocalFunction(function(){return A(R,Z,pe,Pe)})}:A}(function(A,R){if(A.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in A)A.innerHTML=R;else{for(Ye=Ye||document.createElement("div"),Ye.innerHTML="<svg>"+R.valueOf().toString()+"</svg>",R=Ye.firstChild;A.firstChild;)A.removeChild(A.firstChild);for(;R.firstChild;)A.appendChild(R.firstChild)}});function It(A,R){if(R){var Z=A.firstChild;if(Z&&Z===A.lastChild&&Z.nodeType===3){Z.nodeValue=R;return}}A.textContent=R}var hn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yt=["Webkit","ms","Moz","O"];Object.keys(hn).forEach(function(A){Yt.forEach(function(R){R=R+A.charAt(0).toUpperCase()+A.substring(1),hn[R]=hn[A]})});function Rt(A,R,Z){return R==null||typeof R=="boolean"||R===""?"":Z||typeof R!="number"||R===0||hn.hasOwnProperty(A)&&hn[A]?(""+R).trim():R+"px"}function ot(A,R){A=A.style;for(var Z in R)if(R.hasOwnProperty(Z)){var pe=Z.indexOf("--")===0,Pe=Rt(Z,R[Z],pe);Z==="float"&&(Z="cssFloat"),pe?A.setProperty(Z,Pe):A[Z]=Pe}}var De=ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function At(A,R){if(R){if(De[A]&&(R.children!=null||R.dangerouslySetInnerHTML!=null))throw Error(n(137,A));if(R.dangerouslySetInnerHTML!=null){if(R.children!=null)throw Error(n(60));if(typeof R.dangerouslySetInnerHTML!="object"||!("__html"in R.dangerouslySetInnerHTML))throw Error(n(61))}if(R.style!=null&&typeof R.style!="object")throw Error(n(62))}}function ze(A,R){if(A.indexOf("-")===-1)return typeof R.is=="string";switch(A){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rt=null;function mt(A){return A=A.target||A.srcElement||window,A.correspondingUseElement&&(A=A.correspondingUseElement),A.nodeType===3?A.parentNode:A}var Lt=null,kt=null,dn=null;function rn(A){if(A=gc(A)){if(typeof Lt!="function")throw Error(n(280));var R=A.stateNode;R&&(R=i6(R),Lt(A.stateNode,A.type,R))}}function gn(A){kt?dn?dn.push(A):dn=[A]:kt=A}function An(){if(kt){var A=kt,R=dn;if(dn=kt=null,rn(A),R)for(A=0;A<R.length;A++)rn(R[A])}}function kn(A,R){return A(R)}function yn(){}var Vn=!1;function Kn(A,R,Z){if(Vn)return A(R,Z);Vn=!0;try{return kn(A,R,Z)}finally{Vn=!1,(kt!==null||dn!==null)&&(yn(),An())}}function Dn(A,R){var Z=A.stateNode;if(Z===null)return null;var pe=i6(Z);if(pe===null)return null;Z=pe[R];e:switch(R){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(pe=!pe.disabled)||(A=A.type,pe=!(A==="button"||A==="input"||A==="select"||A==="textarea")),A=!pe;break e;default:A=!1}if(A)return null;if(Z&&typeof Z!="function")throw Error(n(231,R,typeof Z));return Z}var Xn=!1;if(l)try{var Nn={};Object.defineProperty(Nn,"passive",{get:function(){Xn=!0}}),window.addEventListener("test",Nn,Nn),window.removeEventListener("test",Nn,Nn)}catch{Xn=!1}function on(A,R,Z,pe,Pe,Ve,Nt,pn,_n){var cr=Array.prototype.slice.call(arguments,3);try{R.apply(Z,cr)}catch(zr){this.onError(zr)}}var Oe=!1,Zt=null,sn=!1,jt=null,Qn={onError:function(A){Oe=!0,Zt=A}};function bn(A,R,Z,pe,Pe,Ve,Nt,pn,_n){Oe=!1,Zt=null,on.apply(Qn,arguments)}function Dt(A,R,Z,pe,Pe,Ve,Nt,pn,_n){if(bn.apply(this,arguments),Oe){if(Oe){var cr=Zt;Oe=!1,Zt=null}else throw Error(n(198));sn||(sn=!0,jt=cr)}}function en(A){var R=A,Z=A;if(A.alternate)for(;R.return;)R=R.return;else{A=R;do R=A,R.flags&4098&&(Z=R.return),A=R.return;while(A)}return R.tag===3?Z:null}function Pn(A){if(A.tag===13){var R=A.memoizedState;if(R===null&&(A=A.alternate,A!==null&&(R=A.memoizedState)),R!==null)return R.dehydrated}return null}function tr(A){if(en(A)!==A)throw Error(n(188))}function ar(A){var R=A.alternate;if(!R){if(R=en(A),R===null)throw Error(n(188));return R!==A?null:A}for(var Z=A,pe=R;;){var Pe=Z.return;if(Pe===null)break;var Ve=Pe.alternate;if(Ve===null){if(pe=Pe.return,pe!==null){Z=pe;continue}break}if(Pe.child===Ve.child){for(Ve=Pe.child;Ve;){if(Ve===Z)return tr(Pe),A;if(Ve===pe)return tr(Pe),R;Ve=Ve.sibling}throw Error(n(188))}if(Z.return!==pe.return)Z=Pe,pe=Ve;else{for(var Nt=!1,pn=Pe.child;pn;){if(pn===Z){Nt=!0,Z=Pe,pe=Ve;break}if(pn===pe){Nt=!0,pe=Pe,Z=Ve;break}pn=pn.sibling}if(!Nt){for(pn=Ve.child;pn;){if(pn===Z){Nt=!0,Z=Ve,pe=Pe;break}if(pn===pe){Nt=!0,pe=Ve,Z=Pe;break}pn=pn.sibling}if(!Nt)throw Error(n(189))}}if(Z.alternate!==pe)throw Error(n(190))}if(Z.tag!==3)throw Error(n(188));return Z.stateNode.current===Z?A:R}function hr(A){return A=ar(A),A!==null?qt(A):null}function qt(A){if(A.tag===5||A.tag===6)return A;for(A=A.child;A!==null;){var R=qt(A);if(R!==null)return R;A=A.sibling}return null}var zn=e.unstable_scheduleCallback,Zn=e.unstable_cancelCallback,Ft=e.unstable_shouldYield,En=e.unstable_requestPaint,Ee=e.unstable_now,h=e.unstable_getCurrentPriorityLevel,p=e.unstable_ImmediatePriority,S=e.unstable_UserBlockingPriority,_=e.unstable_NormalPriority,k=e.unstable_LowPriority,I=e.unstable_IdlePriority,B=null,G=null;function re(A){if(G&&typeof G.onCommitFiberRoot=="function")try{G.onCommitFiberRoot(B,A,void 0,(A.current.flags&128)===128)}catch{}}var ce=Math.clz32?Math.clz32:Ae,ue=Math.log,ge=Math.LN2;function Ae(A){return A>>>=0,A===0?32:31-(ue(A)/ge|0)|0}var ke=64,Me=4194304;function qe(A){switch(A&-A){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return A&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return A&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return A}}function Fe(A,R){var Z=A.pendingLanes;if(Z===0)return 0;var pe=0,Pe=A.suspendedLanes,Ve=A.pingedLanes,Nt=Z&268435455;if(Nt!==0){var pn=Nt&~Pe;pn!==0?pe=qe(pn):(Ve&=Nt,Ve!==0&&(pe=qe(Ve)))}else Nt=Z&~Pe,Nt!==0?pe=qe(Nt):Ve!==0&&(pe=qe(Ve));if(pe===0)return 0;if(R!==0&&R!==pe&&!(R&Pe)&&(Pe=pe&-pe,Ve=R&-R,Pe>=Ve||Pe===16&&(Ve&4194240)!==0))return R;if(pe&4&&(pe|=Z&16),R=A.entangledLanes,R!==0)for(A=A.entanglements,R&=pe;0<R;)Z=31-ce(R),Pe=1<<Z,pe|=A[Z],R&=~Pe;return pe}function at(A,R){switch(A){case 1:case 2:case 4:return R+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return R+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ie(A,R){for(var Z=A.suspendedLanes,pe=A.pingedLanes,Pe=A.expirationTimes,Ve=A.pendingLanes;0<Ve;){var Nt=31-ce(Ve),pn=1<<Nt,_n=Pe[Nt];_n===-1?(!(pn&Z)||pn&pe)&&(Pe[Nt]=at(pn,R)):_n<=R&&(A.expiredLanes|=pn),Ve&=~pn}}function Se(A){return A=A.pendingLanes&-1073741825,A!==0?A:A&1073741824?1073741824:0}function $e(){var A=ke;return ke<<=1,!(ke&4194240)&&(ke=64),A}function Ue(A){for(var R=[],Z=0;31>Z;Z++)R.push(A);return R}function _e(A,R,Z){A.pendingLanes|=R,R!==536870912&&(A.suspendedLanes=0,A.pingedLanes=0),A=A.eventTimes,R=31-ce(R),A[R]=Z}function st(A,R){var Z=A.pendingLanes&~R;A.pendingLanes=R,A.suspendedLanes=0,A.pingedLanes=0,A.expiredLanes&=R,A.mutableReadLanes&=R,A.entangledLanes&=R,R=A.entanglements;var pe=A.eventTimes;for(A=A.expirationTimes;0<Z;){var Pe=31-ce(Z),Ve=1<<Pe;R[Pe]=0,pe[Pe]=-1,A[Pe]=-1,Z&=~Ve}}function ut(A,R){var Z=A.entangledLanes|=R;for(A=A.entanglements;Z;){var pe=31-ce(Z),Pe=1<<pe;Pe&R|A[pe]&R&&(A[pe]|=R),Z&=~Pe}}var yt=0;function Mt(A){return A&=-A,1<A?4<A?A&268435455?16:536870912:4:1}var Kt,un,Xe,Pt,Wt,ct=!1,Ge=[],Tt=null,fn=null,Yn=null,Fn=new Map,Gn=new Map,Sr=[],ur="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function kr(A,R){switch(A){case"focusin":case"focusout":Tt=null;break;case"dragenter":case"dragleave":fn=null;break;case"mouseover":case"mouseout":Yn=null;break;case"pointerover":case"pointerout":Fn.delete(R.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(R.pointerId)}}function Bn(A,R,Z,pe,Pe,Ve){return A===null||A.nativeEvent!==Ve?(A={blockedOn:R,domEventName:Z,eventSystemFlags:pe,nativeEvent:Ve,targetContainers:[Pe]},R!==null&&(R=gc(R),R!==null&&un(R)),A):(A.eventSystemFlags|=pe,R=A.targetContainers,Pe!==null&&R.indexOf(Pe)===-1&&R.push(Pe),A)}function Sn(A,R,Z,pe,Pe){switch(R){case"focusin":return Tt=Bn(Tt,A,R,Z,pe,Pe),!0;case"dragenter":return fn=Bn(fn,A,R,Z,pe,Pe),!0;case"mouseover":return Yn=Bn(Yn,A,R,Z,pe,Pe),!0;case"pointerover":var Ve=Pe.pointerId;return Fn.set(Ve,Bn(Fn.get(Ve)||null,A,R,Z,pe,Pe)),!0;case"gotpointercapture":return Ve=Pe.pointerId,Gn.set(Ve,Bn(Gn.get(Ve)||null,A,R,Z,pe,Pe)),!0}return!1}function Mn(A){var R=dh(A.target);if(R!==null){var Z=en(R);if(Z!==null){if(R=Z.tag,R===13){if(R=Pn(Z),R!==null){A.blockedOn=R,Wt(A.priority,function(){Xe(Z)});return}}else if(R===3&&Z.stateNode.current.memoizedState.isDehydrated){A.blockedOn=Z.tag===3?Z.stateNode.containerInfo:null;return}}}A.blockedOn=null}function rr(A){if(A.blockedOn!==null)return!1;for(var R=A.targetContainers;0<R.length;){var Z=wr(A.domEventName,A.eventSystemFlags,R[0],A.nativeEvent);if(Z===null){Z=A.nativeEvent;var pe=new Z.constructor(Z.type,Z);rt=pe,Z.target.dispatchEvent(pe),rt=null}else return R=gc(Z),R!==null&&un(R),A.blockedOn=Z,!1;R.shift()}return!0}function ls(A,R,Z){rr(A)&&Z.delete(R)}function cs(){ct=!1,Tt!==null&&rr(Tt)&&(Tt=null),fn!==null&&rr(fn)&&(fn=null),Yn!==null&&rr(Yn)&&(Yn=null),Fn.forEach(ls),Gn.forEach(ls)}function et(A,R){A.blockedOn===R&&(A.blockedOn=null,ct||(ct=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cs)))}function gt(A){function R(Pe){return et(Pe,A)}if(0<Ge.length){et(Ge[0],A);for(var Z=1;Z<Ge.length;Z++){var pe=Ge[Z];pe.blockedOn===A&&(pe.blockedOn=null)}}for(Tt!==null&&et(Tt,A),fn!==null&&et(fn,A),Yn!==null&&et(Yn,A),Fn.forEach(R),Gn.forEach(R),Z=0;Z<Sr.length;Z++)pe=Sr[Z],pe.blockedOn===A&&(pe.blockedOn=null);for(;0<Sr.length&&(Z=Sr[0],Z.blockedOn===null);)Mn(Z),Z.blockedOn===null&&Sr.shift()}var Tn=M.ReactCurrentBatchConfig,sr=!0;function Tr(A,R,Z,pe){var Pe=yt,Ve=Tn.transition;Tn.transition=null;try{yt=1,$r(A,R,Z,pe)}finally{yt=Pe,Tn.transition=Ve}}function Lr(A,R,Z,pe){var Pe=yt,Ve=Tn.transition;Tn.transition=null;try{yt=4,$r(A,R,Z,pe)}finally{yt=Pe,Tn.transition=Ve}}function $r(A,R,Z,pe){if(sr){var Pe=wr(A,R,Z,pe);if(Pe===null)zj(A,R,pe,lr,Z),kr(A,pe);else if(Sn(Pe,A,R,Z,pe))pe.stopPropagation();else if(kr(A,pe),R&4&&-1<ur.indexOf(A)){for(;Pe!==null;){var Ve=gc(Pe);if(Ve!==null&&Kt(Ve),Ve=wr(A,R,Z,pe),Ve===null&&zj(A,R,pe,lr,Z),Ve===Pe)break;Pe=Ve}Pe!==null&&pe.stopPropagation()}else zj(A,R,pe,null,Z)}}var lr=null;function wr(A,R,Z,pe){if(lr=null,A=mt(pe),A=dh(A),A!==null)if(R=en(A),R===null)A=null;else if(Z=R.tag,Z===13){if(A=Pn(R),A!==null)return A;A=null}else if(Z===3){if(R.stateNode.current.memoizedState.isDehydrated)return R.tag===3?R.stateNode.containerInfo:null;A=null}else R!==A&&(A=null);return lr=A,null}function ss(A){switch(A){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(h()){case p:return 1;case S:return 4;case _:case k:return 16;case I:return 536870912;default:return 16}default:return 16}}var mr=null,es=null,Ys=null;function _s(){if(Ys)return Ys;var A,R=es,Z=R.length,pe,Pe="value"in mr?mr.value:mr.textContent,Ve=Pe.length;for(A=0;A<Z&&R[A]===Pe[A];A++);var Nt=Z-A;for(pe=1;pe<=Nt&&R[Z-pe]===Pe[Ve-pe];pe++);return Ys=Pe.slice(A,1<pe?1-pe:void 0)}function br(A){var R=A.keyCode;return"charCode"in A?(A=A.charCode,A===0&&R===13&&(A=13)):A=R,A===10&&(A=13),32<=A||A===13?A:0}function zt(){return!0}function he(){return!1}function it(A){function R(Z,pe,Pe,Ve,Nt){this._reactName=Z,this._targetInst=Pe,this.type=pe,this.nativeEvent=Ve,this.target=Nt,this.currentTarget=null;for(var pn in A)A.hasOwnProperty(pn)&&(Z=A[pn],this[pn]=Z?Z(Ve):Ve[pn]);return this.isDefaultPrevented=(Ve.defaultPrevented!=null?Ve.defaultPrevented:Ve.returnValue===!1)?zt:he,this.isPropagationStopped=he,this}return ee(R.prototype,{preventDefault:function(){this.defaultPrevented=!0;var Z=this.nativeEvent;Z&&(Z.preventDefault?Z.preventDefault():typeof Z.returnValue!="unknown"&&(Z.returnValue=!1),this.isDefaultPrevented=zt)},stopPropagation:function(){var Z=this.nativeEvent;Z&&(Z.stopPropagation?Z.stopPropagation():typeof Z.cancelBubble!="unknown"&&(Z.cancelBubble=!0),this.isPropagationStopped=zt)},persist:function(){},isPersistent:zt}),R}var Ct={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(A){return A.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vt=it(Ct),ln=ee({},Ct,{view:0,detail:0}),xn=it(ln),dr,Er,pr,fr=ee({},ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Or,button:0,buttons:0,relatedTarget:function(A){return A.relatedTarget===void 0?A.fromElement===A.srcElement?A.toElement:A.fromElement:A.relatedTarget},movementX:function(A){return"movementX"in A?A.movementX:(A!==pr&&(pr&&A.type==="mousemove"?(dr=A.screenX-pr.screenX,Er=A.screenY-pr.screenY):Er=dr=0,pr=A),dr)},movementY:function(A){return"movementY"in A?A.movementY:Er}}),Yr=it(fr),is=ee({},fr,{dataTransfer:0}),Ir=it(is),yr=ee({},ln,{relatedTarget:0}),Jn=it(yr),gs=ee({},Ct,{animationName:0,elapsedTime:0,pseudoElement:0}),Zs=it(gs),oi=ee({},Ct,{clipboardData:function(A){return"clipboardData"in A?A.clipboardData:window.clipboardData}}),Fr=it(oi),wn=ee({},Ct,{data:0}),On=it(wn),lt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Bt={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},nr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wn(A){var R=this.nativeEvent;return R.getModifierState?R.getModifierState(A):(A=nr[A])?!!R[A]:!1}function Or(){return Wn}var Pr=ee({},ln,{key:function(A){if(A.key){var R=lt[A.key]||A.key;if(R!=="Unidentified")return R}return A.type==="keypress"?(A=br(A),A===13?"Enter":String.fromCharCode(A)):A.type==="keydown"||A.type==="keyup"?Bt[A.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Or,charCode:function(A){return A.type==="keypress"?br(A):0},keyCode:function(A){return A.type==="keydown"||A.type==="keyup"?A.keyCode:0},which:function(A){return A.type==="keypress"?br(A):A.type==="keydown"||A.type==="keyup"?A.keyCode:0}}),ts=it(Pr),Ls=ee({},fr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Et=it(Ls),or=ee({},ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Or}),Hn=it(or),Vr=ee({},Ct,{propertyName:0,elapsedTime:0,pseudoElement:0}),us=it(Vr),as=ee({},fr,{deltaX:function(A){return"deltaX"in A?A.deltaX:"wheelDeltaX"in A?-A.wheelDeltaX:0},deltaY:function(A){return"deltaY"in A?A.deltaY:"wheelDeltaY"in A?-A.wheelDeltaY:"wheelDelta"in A?-A.wheelDelta:0},deltaZ:0,deltaMode:0}),xs=it(as),bs=[9,13,27,32],zi=l&&"CompositionEvent"in window,Us=null;l&&"documentMode"in document&&(Us=document.documentMode);var ys=l&&"TextEvent"in window&&!Us,Ss=l&&(!zi||Us&&8<Us&&11>=Us),pc=" ",ks=!1;function ka(A,R){switch(A){case"keyup":return bs.indexOf(R.keyCode)!==-1;case"keydown":return R.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wu(A){return A=A.detail,typeof A=="object"&&"data"in A?A.data:null}var va=!1;function Yo(A,R){switch(A){case"compositionend":return Wu(R);case"keypress":return R.which!==32?null:(ks=!0,pc);case"textInput":return A=R.data,A===pc&&ks?null:A;default:return null}}function qu(A,R){if(va)return A==="compositionend"||!zi&&ka(A,R)?(A=_s(),Ys=es=mr=null,va=!1,A):null;switch(A){case"paste":return null;case"keypress":if(!(R.ctrlKey||R.altKey||R.metaKey)||R.ctrlKey&&R.altKey){if(R.char&&1<R.char.length)return R.char;if(R.which)return String.fromCharCode(R.which)}return null;case"compositionend":return Ss&&R.locale!=="ko"?null:R.data;default:return null}}var Yl={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yi(A){var R=A&&A.nodeName&&A.nodeName.toLowerCase();return R==="input"?!!Yl[A.type]:R==="textarea"}function Ed(A,R,Z,pe){gn(pe),R=t6(R,"onChange"),0<R.length&&(Z=new vt("onChange","change",null,Z,pe),A.push({event:Z,listeners:R}))}var ft=null,w=null;function E(A){mP(A,0)}function O(A){var R=Ni(A);if(Ke(R))return A}function U(A,R){if(A==="change")return R}var H=!1;if(l){var Q;if(l){var le="oninput"in document;if(!le){var ve=document.createElement("div");ve.setAttribute("oninput","return;"),le=typeof ve.oninput=="function"}Q=le}else Q=!1;H=Q&&(!document.documentMode||9<document.documentMode)}function Te(){ft&&(ft.detachEvent("onpropertychange",Ze),w=ft=null)}function Ze(A){if(A.propertyName==="value"&&O(w)){var R=[];Ed(R,w,A,mt(A)),Kn(E,R)}}function xt(A,R,Z){A==="focusin"?(Te(),ft=R,w=Z,ft.attachEvent("onpropertychange",Ze)):A==="focusout"&&Te()}function _t(A){if(A==="selectionchange"||A==="keyup"||A==="keydown")return O(w)}function Qt(A,R){if(A==="click")return O(R)}function St(A,R){if(A==="input"||A==="change")return O(R)}function $t(A,R){return A===R&&(A!==0||1/A===1/R)||A!==A&&R!==R}var Ht=typeof Object.is=="function"?Object.is:$t;function jn(A,R){if(Ht(A,R))return!0;if(typeof A!="object"||A===null||typeof R!="object"||R===null)return!1;var Z=Object.keys(A),pe=Object.keys(R);if(Z.length!==pe.length)return!1;for(pe=0;pe<Z.length;pe++){var Pe=Z[pe];if(!c.call(R,Pe)||!Ht(A[Pe],R[Pe]))return!1}return!0}function xr(A){for(;A&&A.firstChild;)A=A.firstChild;return A}function Nr(A,R){var Z=xr(A);A=0;for(var pe;Z;){if(Z.nodeType===3){if(pe=A+Z.textContent.length,A<=R&&pe>=R)return{node:Z,offset:R-A};A=pe}e:{for(;Z;){if(Z.nextSibling){Z=Z.nextSibling;break e}Z=Z.parentNode}Z=void 0}Z=xr(Z)}}function jr(A,R){return A&&R?A===R?!0:A&&A.nodeType===3?!1:R&&R.nodeType===3?jr(A,R.parentNode):"contains"in A?A.contains(R):A.compareDocumentPosition?!!(A.compareDocumentPosition(R)&16):!1:!1}function Ns(){for(var A=window,R=dt();R instanceof A.HTMLIFrameElement;){try{var Z=typeof R.contentWindow.location.href=="string"}catch{Z=!1}if(Z)A=R.contentWindow;else break;R=dt(A.document)}return R}function Js(A){var R=A&&A.nodeName&&A.nodeName.toLowerCase();return R&&(R==="input"&&(A.type==="text"||A.type==="search"||A.type==="tel"||A.type==="url"||A.type==="password")||R==="textarea"||A.contentEditable==="true")}function mc(A){var R=Ns(),Z=A.focusedElem,pe=A.selectionRange;if(R!==Z&&Z&&Z.ownerDocument&&jr(Z.ownerDocument.documentElement,Z)){if(pe!==null&&Js(Z)){if(R=pe.start,A=pe.end,A===void 0&&(A=R),"selectionStart"in Z)Z.selectionStart=R,Z.selectionEnd=Math.min(A,Z.value.length);else if(A=(R=Z.ownerDocument||document)&&R.defaultView||window,A.getSelection){A=A.getSelection();var Pe=Z.textContent.length,Ve=Math.min(pe.start,Pe);pe=pe.end===void 0?Ve:Math.min(pe.end,Pe),!A.extend&&Ve>pe&&(Pe=pe,pe=Ve,Ve=Pe),Pe=Nr(Z,Ve);var Nt=Nr(Z,pe);Pe&&Nt&&(A.rangeCount!==1||A.anchorNode!==Pe.node||A.anchorOffset!==Pe.offset||A.focusNode!==Nt.node||A.focusOffset!==Nt.offset)&&(R=R.createRange(),R.setStart(Pe.node,Pe.offset),A.removeAllRanges(),Ve>pe?(A.addRange(R),A.extend(Nt.node,Nt.offset)):(R.setEnd(Nt.node,Nt.offset),A.addRange(R)))}}for(R=[],A=Z;A=A.parentNode;)A.nodeType===1&&R.push({element:A,left:A.scrollLeft,top:A.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Z<R.length;Z++)A=R[Z],A.element.scrollLeft=A.left,A.element.scrollTop=A.top}}var no=l&&"documentMode"in document&&11>=document.documentMode,ro=null,ha=null,Ta=null,Xo=!1;function _d(A,R,Z){var pe=Z.window===Z?Z.document:Z.nodeType===9?Z:Z.ownerDocument;Xo||ro==null||ro!==dt(pe)||(pe=ro,"selectionStart"in pe&&Js(pe)?pe={start:pe.selectionStart,end:pe.selectionEnd}:(pe=(pe.ownerDocument&&pe.ownerDocument.defaultView||window).getSelection(),pe={anchorNode:pe.anchorNode,anchorOffset:pe.anchorOffset,focusNode:pe.focusNode,focusOffset:pe.focusOffset}),Ta&&jn(Ta,pe)||(Ta=pe,pe=t6(ha,"onSelect"),0<pe.length&&(R=new vt("onSelect","select",null,R,Z),A.push({event:R,listeners:pe}),R.target=ro)))}function Oi(A,R){var Z={};return Z[A.toLowerCase()]=R.toLowerCase(),Z["Webkit"+A]="webkit"+R,Z["Moz"+A]="moz"+R,Z}var Lm={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionend:Oi("Transition","TransitionEnd")},W1={},z2={};l&&(z2=document.createElement("div").style,"AnimationEvent"in window||(delete Lm.animationend.animation,delete Lm.animationiteration.animation,delete Lm.animationstart.animation),"TransitionEvent"in window||delete Lm.transitionend.transition);function X5(A){if(W1[A])return W1[A];if(!Lm[A])return A;var R=Lm[A],Z;for(Z in R)if(R.hasOwnProperty(Z)&&Z in z2)return W1[A]=R[Z];return A}var fP=X5("animationend"),hP=X5("animationiteration"),H2=X5("animationstart"),Np=X5("transitionend"),V2=new Map,$j="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sf(A,R){V2.set(A,R),a(R,[A])}for(var Q5=0;Q5<$j.length;Q5++){var Z5=$j[Q5],J5=Z5.toLowerCase(),pP=Z5[0].toUpperCase()+Z5.slice(1);Sf(J5,"on"+pP)}Sf(fP,"onAnimationEnd"),Sf(hP,"onAnimationIteration"),Sf(H2,"onAnimationStart"),Sf("dblclick","onDoubleClick"),Sf("focusin","onFocus"),Sf("focusout","onBlur"),Sf(Np,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ap="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Sx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ap));function W2(A,R,Z){var pe=A.type||"unknown-event";A.currentTarget=Z,Dt(pe,R,void 0,A),A.currentTarget=null}function mP(A,R){R=(R&4)!==0;for(var Z=0;Z<A.length;Z++){var pe=A[Z],Pe=pe.event;pe=pe.listeners;e:{var Ve=void 0;if(R)for(var Nt=pe.length-1;0<=Nt;Nt--){var pn=pe[Nt],_n=pn.instance,cr=pn.currentTarget;if(pn=pn.listener,_n!==Ve&&Pe.isPropagationStopped())break e;W2(Pe,pn,cr),Ve=_n}else for(Nt=0;Nt<pe.length;Nt++){if(pn=pe[Nt],_n=pn.instance,cr=pn.currentTarget,pn=pn.listener,_n!==Ve&&Pe.isPropagationStopped())break e;W2(Pe,pn,cr),Ve=_n}}}if(sn)throw A=jt,sn=!1,jt=null,A}function Ga(A,R){var Z=R[s6];Z===void 0&&(Z=R[s6]=new Set);var pe=A+"__bubble";Z.has(pe)||(e6(R,A,2,!1),Z.add(pe))}function Uj(A,R,Z){var pe=0;R&&(pe|=4),e6(Z,A,pe,R)}var Nx="_reactListening"+Math.random().toString(36).slice(2);function Dm(A){if(!A[Nx]){A[Nx]=!0,r.forEach(function(Z){Z!=="selectionchange"&&(Sx.has(Z)||Uj(Z,!1,A),Uj(Z,!0,A))});var R=A.nodeType===9?A:A.ownerDocument;R===null||R[Nx]||(R[Nx]=!0,Uj("selectionchange",!1,R))}}function e6(A,R,Z,pe){switch(ss(R)){case 1:var Pe=Tr;break;case 4:Pe=Lr;break;default:Pe=$r}Z=Pe.bind(null,R,Z,A),Pe=void 0,!Xn||R!=="touchstart"&&R!=="touchmove"&&R!=="wheel"||(Pe=!0),pe?Pe!==void 0?A.addEventListener(R,Z,{capture:!0,passive:Pe}):A.addEventListener(R,Z,!0):Pe!==void 0?A.addEventListener(R,Z,{passive:Pe}):A.addEventListener(R,Z,!1)}function zj(A,R,Z,pe,Pe){var Ve=pe;if(!(R&1)&&!(R&2)&&pe!==null)e:for(;;){if(pe===null)return;var Nt=pe.tag;if(Nt===3||Nt===4){var pn=pe.stateNode.containerInfo;if(pn===Pe||pn.nodeType===8&&pn.parentNode===Pe)break;if(Nt===4)for(Nt=pe.return;Nt!==null;){var _n=Nt.tag;if((_n===3||_n===4)&&(_n=Nt.stateNode.containerInfo,_n===Pe||_n.nodeType===8&&_n.parentNode===Pe))return;Nt=Nt.return}for(;pn!==null;){if(Nt=dh(pn),Nt===null)return;if(_n=Nt.tag,_n===5||_n===6){pe=Ve=Nt;continue e}pn=pn.parentNode}}pe=pe.return}Kn(function(){var cr=Ve,zr=mt(Z),Wr=[];e:{var Ur=V2.get(A);if(Ur!==void 0){var hs=vt,As=A;switch(A){case"keypress":if(br(Z)===0)break e;case"keydown":case"keyup":hs=ts;break;case"focusin":As="focus",hs=Jn;break;case"focusout":As="blur",hs=Jn;break;case"beforeblur":case"afterblur":hs=Jn;break;case"click":if(Z.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":hs=Yr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":hs=Ir;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":hs=Hn;break;case fP:case hP:case H2:hs=Zs;break;case Np:hs=us;break;case"scroll":hs=xn;break;case"wheel":hs=xs;break;case"copy":case"cut":case"paste":hs=Fr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":hs=Et}var Is=(R&4)!==0,To=!Is&&A==="scroll",er=Is?Ur!==null?Ur+"Capture":null:Ur;Is=[];for(var Ln=cr,ir;Ln!==null;){ir=Ln;var Xr=ir.stateNode;if(ir.tag===5&&Xr!==null&&(ir=Xr,er!==null&&(Xr=Dn(Ln,er),Xr!=null&&Is.push(q1(Ln,Xr,ir)))),To)break;Ln=Ln.return}0<Is.length&&(Ur=new hs(Ur,As,null,Z,zr),Wr.push({event:Ur,listeners:Is}))}}if(!(R&7)){e:{if(Ur=A==="mouseover"||A==="pointerover",hs=A==="mouseout"||A==="pointerout",Ur&&Z!==rt&&(As=Z.relatedTarget||Z.fromElement)&&(dh(As)||As[Gu]))break e;if((hs||Ur)&&(Ur=zr.window===zr?zr:(Ur=zr.ownerDocument)?Ur.defaultView||Ur.parentWindow:window,hs?(As=Z.relatedTarget||Z.toElement,hs=cr,As=As?dh(As):null,As!==null&&(To=en(As),As!==To||As.tag!==5&&As.tag!==6)&&(As=null)):(hs=null,As=cr),hs!==As)){if(Is=Yr,Xr="onMouseLeave",er="onMouseEnter",Ln="mouse",(A==="pointerout"||A==="pointerover")&&(Is=Et,Xr="onPointerLeave",er="onPointerEnter",Ln="pointer"),To=hs==null?Ur:Ni(hs),ir=As==null?Ur:Ni(As),Ur=new Is(Xr,Ln+"leave",hs,Z,zr),Ur.target=To,Ur.relatedTarget=ir,Xr=null,dh(zr)===cr&&(Is=new Is(er,Ln+"enter",As,Z,zr),Is.target=ir,Is.relatedTarget=To,Xr=Is),To=Xr,hs&&As)t:{for(Is=hs,er=As,Ln=0,ir=Is;ir;ir=G1(ir))Ln++;for(ir=0,Xr=er;Xr;Xr=G1(Xr))ir++;for(;0<Ln-ir;)Is=G1(Is),Ln--;for(;0<ir-Ln;)er=G1(er),ir--;for(;Ln--;){if(Is===er||er!==null&&Is===er.alternate)break t;Is=G1(Is),er=G1(er)}Is=null}else Is=null;hs!==null&&Qo(Wr,Ur,hs,Is,!1),As!==null&&To!==null&&Qo(Wr,To,As,Is,!0)}}e:{if(Ur=cr?Ni(cr):window,hs=Ur.nodeName&&Ur.nodeName.toLowerCase(),hs==="select"||hs==="input"&&Ur.type==="file")var Fs=U;else if(yi(Ur))if(H)Fs=St;else{Fs=_t;var Vs=xt}else(hs=Ur.nodeName)&&hs.toLowerCase()==="input"&&(Ur.type==="checkbox"||Ur.type==="radio")&&(Fs=Qt);if(Fs&&(Fs=Fs(A,cr))){Ed(Wr,Fs,Z,zr);break e}Vs&&Vs(A,Ur,cr),A==="focusout"&&(Vs=Ur._wrapperState)&&Vs.controlled&&Ur.type==="number"&&pt(Ur,"number",Ur.value)}switch(Vs=cr?Ni(cr):window,A){case"focusin":(yi(Vs)||Vs.contentEditable==="true")&&(ro=Vs,ha=cr,Ta=null);break;case"focusout":Ta=ha=ro=null;break;case"mousedown":Xo=!0;break;case"contextmenu":case"mouseup":case"dragend":Xo=!1,_d(Wr,Z,zr);break;case"selectionchange":if(no)break;case"keydown":case"keyup":_d(Wr,Z,zr)}var Ws;if(zi)e:{switch(A){case"compositionstart":var Qs="onCompositionStart";break e;case"compositionend":Qs="onCompositionEnd";break e;case"compositionupdate":Qs="onCompositionUpdate";break e}Qs=void 0}else va?ka(A,Z)&&(Qs="onCompositionEnd"):A==="keydown"&&Z.keyCode===229&&(Qs="onCompositionStart");Qs&&(Ss&&Z.locale!=="ko"&&(va||Qs!=="onCompositionStart"?Qs==="onCompositionEnd"&&va&&(Ws=_s()):(mr=zr,es="value"in mr?mr.value:mr.textContent,va=!0)),Vs=t6(cr,Qs),0<Vs.length&&(Qs=new On(Qs,A,null,Z,zr),Wr.push({event:Qs,listeners:Vs}),Ws?Qs.data=Ws:(Ws=Wu(Z),Ws!==null&&(Qs.data=Ws)))),(Ws=ys?Yo(A,Z):qu(A,Z))&&(cr=t6(cr,"onBeforeInput"),0<cr.length&&(zr=new On("onBeforeInput","beforeinput",null,Z,zr),Wr.push({event:zr,listeners:cr}),zr.data=Ws))}mP(Wr,R)})}function q1(A,R,Z){return{instance:A,listener:R,currentTarget:Z}}function t6(A,R){for(var Z=R+"Capture",pe=[];A!==null;){var Pe=A,Ve=Pe.stateNode;Pe.tag===5&&Ve!==null&&(Pe=Ve,Ve=Dn(A,Z),Ve!=null&&pe.unshift(q1(A,Ve,Pe)),Ve=Dn(A,R),Ve!=null&&pe.push(q1(A,Ve,Pe))),A=A.return}return pe}function G1(A){if(A===null)return null;do A=A.return;while(A&&A.tag!==5);return A||null}function Qo(A,R,Z,pe,Pe){for(var Ve=R._reactName,Nt=[];Z!==null&&Z!==pe;){var pn=Z,_n=pn.alternate,cr=pn.stateNode;if(_n!==null&&_n===pe)break;pn.tag===5&&cr!==null&&(pn=cr,Pe?(_n=Dn(Z,Ve),_n!=null&&Nt.unshift(q1(Z,_n,pn))):Pe||(_n=Dn(Z,Ve),_n!=null&&Nt.push(q1(Z,_n,pn)))),Z=Z.return}Nt.length!==0&&A.push({event:R,listeners:Nt})}var xc=/\r\n?/g,Rz=/\u0000|\uFFFD/g;function xP(A){return(typeof A=="string"?A:""+A).replace(xc,`
`).replace(Rz,"")}function q2(A,R,Z){if(R=xP(R),xP(A)!==R&&Z)throw Error(n(425))}function n6(){}var G2=null,Ax=null;function K2(A,R){return A==="textarea"||A==="noscript"||typeof R.children=="string"||typeof R.children=="number"||typeof R.dangerouslySetInnerHTML=="object"&&R.dangerouslySetInnerHTML!==null&&R.dangerouslySetInnerHTML.__html!=null}var Bm=typeof setTimeout=="function"?setTimeout:void 0,Y2=typeof clearTimeout=="function"?clearTimeout:void 0,K1=typeof Promise=="function"?Promise:void 0,r6=typeof queueMicrotask=="function"?queueMicrotask:typeof K1<"u"?function(A){return K1.resolve(null).then(A).catch(Y1)}:Bm;function Y1(A){setTimeout(function(){throw A})}function Hj(A,R){var Z=R,pe=0;do{var Pe=Z.nextSibling;if(A.removeChild(Z),Pe&&Pe.nodeType===8)if(Z=Pe.data,Z==="/$"){if(pe===0){A.removeChild(Pe),gt(R);return}pe--}else Z!=="$"&&Z!=="$?"&&Z!=="$!"||pe++;Z=Pe}while(Z);gt(R)}function $m(A){for(;A!=null;A=A.nextSibling){var R=A.nodeType;if(R===1||R===3)break;if(R===8){if(R=A.data,R==="$"||R==="$!"||R==="$?")break;if(R==="/$")return null}}return A}function gP(A){A=A.previousSibling;for(var R=0;A;){if(A.nodeType===8){var Z=A.data;if(Z==="$"||Z==="$!"||Z==="$?"){if(R===0)return A;R--}else Z==="/$"&&R++}A=A.previousSibling}return null}var X1=Math.random().toString(36).slice(2),uh="__reactFiber$"+X1,Um="__reactProps$"+X1,Gu="__reactContainer$"+X1,s6="__reactEvents$"+X1,Ot="__reactListeners$"+X1,Q1="__reactHandles$"+X1;function dh(A){var R=A[uh];if(R)return R;for(var Z=A.parentNode;Z;){if(R=Z[Gu]||Z[uh]){if(Z=R.alternate,R.child!==null||Z!==null&&Z.child!==null)for(A=gP(A);A!==null;){if(Z=A[uh])return Z;A=gP(A)}return R}A=Z,Z=A.parentNode}return null}function gc(A){return A=A[uh]||A[Gu],!A||A.tag!==5&&A.tag!==6&&A.tag!==13&&A.tag!==3?null:A}function Ni(A){if(A.tag===5||A.tag===6)return A.stateNode;throw Error(n(33))}function i6(A){return A[Um]||null}var Vj=[],Z1=-1;function hu(A){return{current:A}}function Ka(A){0>Z1||(A.current=Vj[Z1],Vj[Z1]=null,Z1--)}function za(A,R){Z1++,Vj[Z1]=A.current,A.current=R}var zm={},bc=hu(zm),pu=hu(!1),zc=zm;function J1(A,R){var Z=A.type.contextTypes;if(!Z)return zm;var pe=A.stateNode;if(pe&&pe.__reactInternalMemoizedUnmaskedChildContext===R)return pe.__reactInternalMemoizedMaskedChildContext;var Pe={},Ve;for(Ve in Z)Pe[Ve]=R[Ve];return pe&&(A=A.stateNode,A.__reactInternalMemoizedUnmaskedChildContext=R,A.__reactInternalMemoizedMaskedChildContext=Pe),Pe}function mu(A){return A=A.childContextTypes,A!=null}function a6(){Ka(pu),Ka(bc)}function bP(A,R,Z){if(bc.current!==zm)throw Error(n(168));za(bc,R),za(pu,Z)}function yP(A,R,Z){var pe=A.stateNode;if(R=R.childContextTypes,typeof pe.getChildContext!="function")return Z;pe=pe.getChildContext();for(var Pe in pe)if(!(Pe in R))throw Error(n(108,be(A)||"Unknown",Pe));return ee({},Z,pe)}function kd(A){return A=(A=A.stateNode)&&A.__reactInternalMemoizedMergedChildContext||zm,zc=bc.current,za(bc,A),za(pu,pu.current),!0}function vP(A,R,Z){var pe=A.stateNode;if(!pe)throw Error(n(169));Z?(A=yP(A,R,zc),pe.__reactInternalMemoizedMergedChildContext=A,Ka(pu),Ka(bc),za(bc,A)):Ka(pu),za(pu,Z)}var jp=null,o6=!1,Wj=!1;function wP(A){jp===null?jp=[A]:jp.push(A)}function jx(A){o6=!0,wP(A)}function Hm(){if(!Wj&&jp!==null){Wj=!0;var A=0,R=yt;try{var Z=jp;for(yt=1;A<Z.length;A++){var pe=Z[A];do pe=pe(!0);while(pe!==null)}jp=null,o6=!1}catch(Pe){throw jp!==null&&(jp=jp.slice(A+1)),zn(p,Hm),Pe}finally{yt=R,Wj=!1}}return null}var eb=[],yc=0,l6=null,c6=0,Td=[],Pd=0,Ex=null,fh=1,hh="";function _x(A,R){eb[yc++]=c6,eb[yc++]=l6,l6=A,c6=R}function CP(A,R,Z){Td[Pd++]=fh,Td[Pd++]=hh,Td[Pd++]=Ex,Ex=A;var pe=fh;A=hh;var Pe=32-ce(pe)-1;pe&=~(1<<Pe),Z+=1;var Ve=32-ce(R)+Pe;if(30<Ve){var Nt=Pe-Pe%5;Ve=(pe&(1<<Nt)-1).toString(32),pe>>=Nt,Pe-=Nt,fh=1<<32-ce(R)+Pe|Z<<Pe|pe,hh=Ve+A}else fh=1<<Ve|Z<<Pe|pe,hh=A}function X2(A){A.return!==null&&(_x(A,1),CP(A,1,0))}function kx(A){for(;A===l6;)l6=eb[--yc],eb[yc]=null,c6=eb[--yc],eb[yc]=null;for(;A===Ex;)Ex=Td[--Pd],Td[Pd]=null,hh=Td[--Pd],Td[Pd]=null,fh=Td[--Pd],Td[Pd]=null}var vc=null,Ku=null,Ya=!1,Nf=null;function ph(A,R){var Z=Dd(5,null,null,0);Z.elementType="DELETED",Z.stateNode=R,Z.return=A,R=A.deletions,R===null?(A.deletions=[Z],A.flags|=16):R.push(Z)}function u6(A,R){switch(A.tag){case 5:var Z=A.type;return R=R.nodeType!==1||Z.toLowerCase()!==R.nodeName.toLowerCase()?null:R,R!==null?(A.stateNode=R,vc=A,Ku=$m(R.firstChild),!0):!1;case 6:return R=A.pendingProps===""||R.nodeType!==3?null:R,R!==null?(A.stateNode=R,vc=A,Ku=null,!0):!1;case 13:return R=R.nodeType!==8?null:R,R!==null?(Z=Ex!==null?{id:fh,overflow:hh}:null,A.memoizedState={dehydrated:R,treeContext:Z,retryLane:1073741824},Z=Dd(18,null,null,0),Z.stateNode=R,Z.return=A,A.child=Z,vc=A,Ku=null,!0):!1;default:return!1}}function Ep(A){return(A.mode&1)!==0&&(A.flags&128)===0}function xu(A){if(Ya){var R=Ku;if(R){var Z=R;if(!u6(A,R)){if(Ep(A))throw Error(n(418));R=$m(Z.nextSibling);var pe=vc;R&&u6(A,R)?ph(pe,Z):(A.flags=A.flags&-4097|2,Ya=!1,vc=A)}}else{if(Ep(A))throw Error(n(418));A.flags=A.flags&-4097|2,Ya=!1,vc=A}}}function SP(A){for(A=A.return;A!==null&&A.tag!==5&&A.tag!==3&&A.tag!==13;)A=A.return;vc=A}function Q2(A){if(A!==vc)return!1;if(!Ya)return SP(A),Ya=!0,!1;var R;if((R=A.tag!==3)&&!(R=A.tag!==5)&&(R=A.type,R=R!=="head"&&R!=="body"&&!K2(A.type,A.memoizedProps)),R&&(R=Ku)){if(Ep(A))throw qj(),Error(n(418));for(;R;)ph(A,R),R=$m(R.nextSibling)}if(SP(A),A.tag===13){if(A=A.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(n(317));e:{for(A=A.nextSibling,R=0;A;){if(A.nodeType===8){var Z=A.data;if(Z==="/$"){if(R===0){Ku=$m(A.nextSibling);break e}R--}else Z!=="$"&&Z!=="$!"&&Z!=="$?"||R++}A=A.nextSibling}Ku=null}}else Ku=vc?$m(A.stateNode.nextSibling):null;return!0}function qj(){for(var A=Ku;A;)A=$m(A.nextSibling)}function mh(){Ku=vc=null,Ya=!1}function xh(A){Nf===null?Nf=[A]:Nf.push(A)}var NP=M.ReactCurrentBatchConfig;function Z2(A,R,Z){if(A=Z.ref,A!==null&&typeof A!="function"&&typeof A!="object"){if(Z._owner){if(Z=Z._owner,Z){if(Z.tag!==1)throw Error(n(309));var pe=Z.stateNode}if(!pe)throw Error(n(147,A));var Pe=pe,Ve=""+A;return R!==null&&R.ref!==null&&typeof R.ref=="function"&&R.ref._stringRef===Ve?R.ref:(R=function(Nt){var pn=Pe.refs;Nt===null?delete pn[Ve]:pn[Ve]=Nt},R._stringRef=Ve,R)}if(typeof A!="string")throw Error(n(284));if(!Z._owner)throw Error(n(290,A))}return A}function Tx(A,R){throw A=Object.prototype.toString.call(R),Error(n(31,A==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":A))}function AP(A){var R=A._init;return R(A._payload)}function Gj(A){function R(er,Ln){if(A){var ir=er.deletions;ir===null?(er.deletions=[Ln],er.flags|=16):ir.push(Ln)}}function Z(er,Ln){if(!A)return null;for(;Ln!==null;)R(er,Ln),Ln=Ln.sibling;return null}function pe(er,Ln){for(er=new Map;Ln!==null;)Ln.key!==null?er.set(Ln.key,Ln):er.set(Ln.index,Ln),Ln=Ln.sibling;return er}function Pe(er,Ln){return er=Pf(er,Ln),er.index=0,er.sibling=null,er}function Ve(er,Ln,ir){return er.index=ir,A?(ir=er.alternate,ir!==null?(ir=ir.index,ir<Ln?(er.flags|=2,Ln):ir):(er.flags|=2,Ln)):(er.flags|=1048576,Ln)}function Nt(er){return A&&er.alternate===null&&(er.flags|=2),er}function pn(er,Ln,ir,Xr){return Ln===null||Ln.tag!==6?(Ln=F8(ir,er.mode,Xr),Ln.return=er,Ln):(Ln=Pe(Ln,ir),Ln.return=er,Ln)}function _n(er,Ln,ir,Xr){var Fs=ir.type;return Fs===L?zr(er,Ln,ir.props.children,Xr,ir.key):Ln!==null&&(Ln.elementType===Fs||typeof Fs=="object"&&Fs!==null&&Fs.$$typeof===se&&AP(Fs)===Ln.type)?(Xr=Pe(Ln,ir.props),Xr.ref=Z2(er,Ln,ir),Xr.return=er,Xr):(Xr=W6(ir.type,ir.key,ir.props,null,er.mode,Xr),Xr.ref=Z2(er,Ln,ir),Xr.return=er,Xr)}function cr(er,Ln,ir,Xr){return Ln===null||Ln.tag!==4||Ln.stateNode.containerInfo!==ir.containerInfo||Ln.stateNode.implementation!==ir.implementation?(Ln=O8(ir,er.mode,Xr),Ln.return=er,Ln):(Ln=Pe(Ln,ir.children||[]),Ln.return=er,Ln)}function zr(er,Ln,ir,Xr,Fs){return Ln===null||Ln.tag!==7?(Ln=Ux(ir,er.mode,Xr,Fs),Ln.return=er,Ln):(Ln=Pe(Ln,ir),Ln.return=er,Ln)}function Wr(er,Ln,ir){if(typeof Ln=="string"&&Ln!==""||typeof Ln=="number")return Ln=F8(""+Ln,er.mode,ir),Ln.return=er,Ln;if(typeof Ln=="object"&&Ln!==null){switch(Ln.$$typeof){case F:return ir=W6(Ln.type,Ln.key,Ln.props,null,er.mode,ir),ir.ref=Z2(er,null,Ln),ir.return=er,ir;case $:return Ln=O8(Ln,er.mode,ir),Ln.return=er,Ln;case se:var Xr=Ln._init;return Wr(er,Xr(Ln._payload),ir)}if(Gt(Ln)||V(Ln))return Ln=Ux(Ln,er.mode,ir,null),Ln.return=er,Ln;Tx(er,Ln)}return null}function Ur(er,Ln,ir,Xr){var Fs=Ln!==null?Ln.key:null;if(typeof ir=="string"&&ir!==""||typeof ir=="number")return Fs!==null?null:pn(er,Ln,""+ir,Xr);if(typeof ir=="object"&&ir!==null){switch(ir.$$typeof){case F:return ir.key===Fs?_n(er,Ln,ir,Xr):null;case $:return ir.key===Fs?cr(er,Ln,ir,Xr):null;case se:return Fs=ir._init,Ur(er,Ln,Fs(ir._payload),Xr)}if(Gt(ir)||V(ir))return Fs!==null?null:zr(er,Ln,ir,Xr,null);Tx(er,ir)}return null}function hs(er,Ln,ir,Xr,Fs){if(typeof Xr=="string"&&Xr!==""||typeof Xr=="number")return er=er.get(ir)||null,pn(Ln,er,""+Xr,Fs);if(typeof Xr=="object"&&Xr!==null){switch(Xr.$$typeof){case F:return er=er.get(Xr.key===null?ir:Xr.key)||null,_n(Ln,er,Xr,Fs);case $:return er=er.get(Xr.key===null?ir:Xr.key)||null,cr(Ln,er,Xr,Fs);case se:var Vs=Xr._init;return hs(er,Ln,ir,Vs(Xr._payload),Fs)}if(Gt(Xr)||V(Xr))return er=er.get(ir)||null,zr(Ln,er,Xr,Fs,null);Tx(Ln,Xr)}return null}function As(er,Ln,ir,Xr){for(var Fs=null,Vs=null,Ws=Ln,Qs=Ln=0,ml=null;Ws!==null&&Qs<ir.length;Qs++){Ws.index>Qs?(ml=Ws,Ws=null):ml=Ws.sibling;var ca=Ur(er,Ws,ir[Qs],Xr);if(ca===null){Ws===null&&(Ws=ml);break}A&&Ws&&ca.alternate===null&&R(er,Ws),Ln=Ve(ca,Ln,Qs),Vs===null?Fs=ca:Vs.sibling=ca,Vs=ca,Ws=ml}if(Qs===ir.length)return Z(er,Ws),Ya&&_x(er,Qs),Fs;if(Ws===null){for(;Qs<ir.length;Qs++)Ws=Wr(er,ir[Qs],Xr),Ws!==null&&(Ln=Ve(Ws,Ln,Qs),Vs===null?Fs=Ws:Vs.sibling=Ws,Vs=Ws);return Ya&&_x(er,Qs),Fs}for(Ws=pe(er,Ws);Qs<ir.length;Qs++)ml=hs(Ws,er,Qs,ir[Qs],Xr),ml!==null&&(A&&ml.alternate!==null&&Ws.delete(ml.key===null?Qs:ml.key),Ln=Ve(ml,Ln,Qs),Vs===null?Fs=ml:Vs.sibling=ml,Vs=ml);return A&&Ws.forEach(function(t0){return R(er,t0)}),Ya&&_x(er,Qs),Fs}function Is(er,Ln,ir,Xr){var Fs=V(ir);if(typeof Fs!="function")throw Error(n(150));if(ir=Fs.call(ir),ir==null)throw Error(n(151));for(var Vs=Fs=null,Ws=Ln,Qs=Ln=0,ml=null,ca=ir.next();Ws!==null&&!ca.done;Qs++,ca=ir.next()){Ws.index>Qs?(ml=Ws,Ws=null):ml=Ws.sibling;var t0=Ur(er,Ws,ca.value,Xr);if(t0===null){Ws===null&&(Ws=ml);break}A&&Ws&&t0.alternate===null&&R(er,Ws),Ln=Ve(t0,Ln,Qs),Vs===null?Fs=t0:Vs.sibling=t0,Vs=t0,Ws=ml}if(ca.done)return Z(er,Ws),Ya&&_x(er,Qs),Fs;if(Ws===null){for(;!ca.done;Qs++,ca=ir.next())ca=Wr(er,ca.value,Xr),ca!==null&&(Ln=Ve(ca,Ln,Qs),Vs===null?Fs=ca:Vs.sibling=ca,Vs=ca);return Ya&&_x(er,Qs),Fs}for(Ws=pe(er,Ws);!ca.done;Qs++,ca=ir.next())ca=hs(Ws,er,Qs,ca.value,Xr),ca!==null&&(A&&ca.alternate!==null&&Ws.delete(ca.key===null?Qs:ca.key),Ln=Ve(ca,Ln,Qs),Vs===null?Fs=ca:Vs.sibling=ca,Vs=ca);return A&&Ws.forEach(function(tH){return R(er,tH)}),Ya&&_x(er,Qs),Fs}function To(er,Ln,ir,Xr){if(typeof ir=="object"&&ir!==null&&ir.type===L&&ir.key===null&&(ir=ir.props.children),typeof ir=="object"&&ir!==null){switch(ir.$$typeof){case F:e:{for(var Fs=ir.key,Vs=Ln;Vs!==null;){if(Vs.key===Fs){if(Fs=ir.type,Fs===L){if(Vs.tag===7){Z(er,Vs.sibling),Ln=Pe(Vs,ir.props.children),Ln.return=er,er=Ln;break e}}else if(Vs.elementType===Fs||typeof Fs=="object"&&Fs!==null&&Fs.$$typeof===se&&AP(Fs)===Vs.type){Z(er,Vs.sibling),Ln=Pe(Vs,ir.props),Ln.ref=Z2(er,Vs,ir),Ln.return=er,er=Ln;break e}Z(er,Vs);break}else R(er,Vs);Vs=Vs.sibling}ir.type===L?(Ln=Ux(ir.props.children,er.mode,Xr,ir.key),Ln.return=er,er=Ln):(Xr=W6(ir.type,ir.key,ir.props,null,er.mode,Xr),Xr.ref=Z2(er,Ln,ir),Xr.return=er,er=Xr)}return Nt(er);case $:e:{for(Vs=ir.key;Ln!==null;){if(Ln.key===Vs)if(Ln.tag===4&&Ln.stateNode.containerInfo===ir.containerInfo&&Ln.stateNode.implementation===ir.implementation){Z(er,Ln.sibling),Ln=Pe(Ln,ir.children||[]),Ln.return=er,er=Ln;break e}else{Z(er,Ln);break}else R(er,Ln);Ln=Ln.sibling}Ln=O8(ir,er.mode,Xr),Ln.return=er,er=Ln}return Nt(er);case se:return Vs=ir._init,To(er,Ln,Vs(ir._payload),Xr)}if(Gt(ir))return As(er,Ln,ir,Xr);if(V(ir))return Is(er,Ln,ir,Xr);Tx(er,ir)}return typeof ir=="string"&&ir!==""||typeof ir=="number"?(ir=""+ir,Ln!==null&&Ln.tag===6?(Z(er,Ln.sibling),Ln=Pe(Ln,ir),Ln.return=er,er=Ln):(Z(er,Ln),Ln=F8(ir,er.mode,Xr),Ln.return=er,er=Ln),Nt(er)):Z(er,Ln)}return To}var ko=Gj(!0),d6=Gj(!1),J2=hu(null),Yu=null,Vm=null,tb=null;function _p(){tb=Vm=Yu=null}function f6(A){var R=J2.current;Ka(J2),A._currentValue=R}function Xl(A,R,Z){for(;A!==null;){var pe=A.alternate;if((A.childLanes&R)!==R?(A.childLanes|=R,pe!==null&&(pe.childLanes|=R)):pe!==null&&(pe.childLanes&R)!==R&&(pe.childLanes|=R),A===Z)break;A=A.return}}function Wm(A,R){Yu=A,tb=Vm=null,A=A.dependencies,A!==null&&A.firstContext!==null&&(A.lanes&R&&(Vc=!0),A.firstContext=null)}function Id(A){var R=A._currentValue;if(tb!==A)if(A={context:A,memoizedValue:R,next:null},Vm===null){if(Yu===null)throw Error(n(308));Vm=A,Yu.dependencies={lanes:0,firstContext:A}}else Vm=Vm.next=A;return R}var Px=null;function Kj(A){Px===null?Px=[A]:Px.push(A)}function h6(A,R,Z,pe){var Pe=R.interleaved;return Pe===null?(Z.next=Z,Kj(R)):(Z.next=Pe.next,Pe.next=Z),R.interleaved=Z,kp(A,pe)}function kp(A,R){A.lanes|=R;var Z=A.alternate;for(Z!==null&&(Z.lanes|=R),Z=A,A=A.return;A!==null;)A.childLanes|=R,Z=A.alternate,Z!==null&&(Z.childLanes|=R),Z=A,A=A.return;return Z.tag===3?Z.stateNode:null}var Fd=!1;function p6(A){A.updateQueue={baseState:A.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jP(A,R){A=A.updateQueue,R.updateQueue===A&&(R.updateQueue={baseState:A.baseState,firstBaseUpdate:A.firstBaseUpdate,lastBaseUpdate:A.lastBaseUpdate,shared:A.shared,effects:A.effects})}function Tp(A,R){return{eventTime:A,lane:R,tag:0,payload:null,callback:null,next:null}}function Od(A,R,Z){var pe=A.updateQueue;if(pe===null)return null;if(pe=pe.shared,Qi&2){var Pe=pe.pending;return Pe===null?R.next=R:(R.next=Pe.next,Pe.next=R),pe.pending=R,kp(A,Z)}return Pe=pe.interleaved,Pe===null?(R.next=R,Kj(pe)):(R.next=Pe.next,Pe.next=R),pe.interleaved=R,kp(A,Z)}function m6(A,R,Z){if(R=R.updateQueue,R!==null&&(R=R.shared,(Z&4194240)!==0)){var pe=R.lanes;pe&=A.pendingLanes,Z|=pe,R.lanes=Z,ut(A,Z)}}function EP(A,R){var Z=A.updateQueue,pe=A.alternate;if(pe!==null&&(pe=pe.updateQueue,Z===pe)){var Pe=null,Ve=null;if(Z=Z.firstBaseUpdate,Z!==null){do{var Nt={eventTime:Z.eventTime,lane:Z.lane,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null};Ve===null?Pe=Ve=Nt:Ve=Ve.next=Nt,Z=Z.next}while(Z!==null);Ve===null?Pe=Ve=R:Ve=Ve.next=R}else Pe=Ve=R;Z={baseState:pe.baseState,firstBaseUpdate:Pe,lastBaseUpdate:Ve,shared:pe.shared,effects:pe.effects},A.updateQueue=Z;return}A=Z.lastBaseUpdate,A===null?Z.firstBaseUpdate=R:A.next=R,Z.lastBaseUpdate=R}function nb(A,R,Z,pe){var Pe=A.updateQueue;Fd=!1;var Ve=Pe.firstBaseUpdate,Nt=Pe.lastBaseUpdate,pn=Pe.shared.pending;if(pn!==null){Pe.shared.pending=null;var _n=pn,cr=_n.next;_n.next=null,Nt===null?Ve=cr:Nt.next=cr,Nt=_n;var zr=A.alternate;zr!==null&&(zr=zr.updateQueue,pn=zr.lastBaseUpdate,pn!==Nt&&(pn===null?zr.firstBaseUpdate=cr:pn.next=cr,zr.lastBaseUpdate=_n))}if(Ve!==null){var Wr=Pe.baseState;Nt=0,zr=cr=_n=null,pn=Ve;do{var Ur=pn.lane,hs=pn.eventTime;if((pe&Ur)===Ur){zr!==null&&(zr=zr.next={eventTime:hs,lane:0,tag:pn.tag,payload:pn.payload,callback:pn.callback,next:null});e:{var As=A,Is=pn;switch(Ur=R,hs=Z,Is.tag){case 1:if(As=Is.payload,typeof As=="function"){Wr=As.call(hs,Wr,Ur);break e}Wr=As;break e;case 3:As.flags=As.flags&-65537|128;case 0:if(As=Is.payload,Ur=typeof As=="function"?As.call(hs,Wr,Ur):As,Ur==null)break e;Wr=ee({},Wr,Ur);break e;case 2:Fd=!0}}pn.callback!==null&&pn.lane!==0&&(A.flags|=64,Ur=Pe.effects,Ur===null?Pe.effects=[pn]:Ur.push(pn))}else hs={eventTime:hs,lane:Ur,tag:pn.tag,payload:pn.payload,callback:pn.callback,next:null},zr===null?(cr=zr=hs,_n=Wr):zr=zr.next=hs,Nt|=Ur;if(pn=pn.next,pn===null){if(pn=Pe.shared.pending,pn===null)break;Ur=pn,pn=Ur.next,Ur.next=null,Pe.lastBaseUpdate=Ur,Pe.shared.pending=null}}while(!0);if(zr===null&&(_n=Wr),Pe.baseState=_n,Pe.firstBaseUpdate=cr,Pe.lastBaseUpdate=zr,R=Pe.shared.interleaved,R!==null){Pe=R;do Nt|=Pe.lane,Pe=Pe.next;while(Pe!==R)}else Ve===null&&(Pe.shared.lanes=0);Xm|=Nt,A.lanes=Nt,A.memoizedState=Wr}}function Yj(A,R,Z){if(A=R.effects,R.effects=null,A!==null)for(R=0;R<A.length;R++){var pe=A[R],Pe=pe.callback;if(Pe!==null){if(pe.callback=null,pe=Z,typeof Pe!="function")throw Error(n(191,Pe));Pe.call(pe)}}}var ev={},gh=hu(ev),tv=hu(ev),rb=hu(ev);function Pp(A){if(A===ev)throw Error(n(174));return A}function Xj(A,R){switch(za(rb,R),za(tv,A),za(gh,ev),A=R.nodeType,A){case 9:case 11:R=(R=R.documentElement)?R.namespaceURI:Jt(null,"");break;default:A=A===8?R.parentNode:R,R=A.namespaceURI||null,A=A.tagName,R=Jt(R,A)}Ka(gh),za(gh,R)}function qm(){Ka(gh),Ka(tv),Ka(rb)}function Qj(A){Pp(rb.current);var R=Pp(gh.current),Z=Jt(R,A.type);R!==Z&&(za(tv,A),za(gh,Z))}function x6(A){tv.current===A&&(Ka(gh),Ka(tv))}var so=hu(0);function Ix(A){for(var R=A;R!==null;){if(R.tag===13){var Z=R.memoizedState;if(Z!==null&&(Z=Z.dehydrated,Z===null||Z.data==="$?"||Z.data==="$!"))return R}else if(R.tag===19&&R.memoizedProps.revealOrder!==void 0){if(R.flags&128)return R}else if(R.child!==null){R.child.return=R,R=R.child;continue}if(R===A)break;for(;R.sibling===null;){if(R.return===null||R.return===A)return null;R=R.return}R.sibling.return=R.return,R=R.sibling}return null}var Zj=[];function g6(){for(var A=0;A<Zj.length;A++)Zj[A]._workInProgressVersionPrimary=null;Zj.length=0}var nv=M.ReactCurrentDispatcher,Jj=M.ReactCurrentBatchConfig,Gm=0,go=null,Uo=null,hl=null,sb=!1,rv=!1,Fx=0,Mi=0;function wc(){throw Error(n(321))}function e8(A,R){if(R===null)return!1;for(var Z=0;Z<R.length&&Z<A.length;Z++)if(!Ht(A[Z],R[Z]))return!1;return!0}function Ox(A,R,Z,pe,Pe,Ve){if(Gm=Ve,go=R,R.memoizedState=null,R.updateQueue=null,R.lanes=0,nv.current=A===null||A.memoizedState===null?Dz:N6,A=Z(pe,Pe),rv){Ve=0;do{if(rv=!1,Fx=0,25<=Ve)throw Error(n(301));Ve+=1,hl=Uo=null,R.updateQueue=null,nv.current=lb,A=Z(pe,Pe)}while(rv)}if(nv.current=S6,R=Uo!==null&&Uo.next!==null,Gm=0,hl=Uo=go=null,sb=!1,R)throw Error(n(300));return A}function b6(){var A=Fx!==0;return Fx=0,A}function bh(){var A={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hl===null?go.memoizedState=hl=A:hl=hl.next=A,hl}function Md(){if(Uo===null){var A=go.alternate;A=A!==null?A.memoizedState:null}else A=Uo.next;var R=hl===null?go.memoizedState:hl.next;if(R!==null)hl=R,Uo=A;else{if(A===null)throw Error(n(310));Uo=A,A={memoizedState:Uo.memoizedState,baseState:Uo.baseState,baseQueue:Uo.baseQueue,queue:Uo.queue,next:null},hl===null?go.memoizedState=hl=A:hl=hl.next=A}return hl}function Cc(A,R){return typeof R=="function"?R(A):R}function t8(A){var R=Md(),Z=R.queue;if(Z===null)throw Error(n(311));Z.lastRenderedReducer=A;var pe=Uo,Pe=pe.baseQueue,Ve=Z.pending;if(Ve!==null){if(Pe!==null){var Nt=Pe.next;Pe.next=Ve.next,Ve.next=Nt}pe.baseQueue=Pe=Ve,Z.pending=null}if(Pe!==null){Ve=Pe.next,pe=pe.baseState;var pn=Nt=null,_n=null,cr=Ve;do{var zr=cr.lane;if((Gm&zr)===zr)_n!==null&&(_n=_n.next={lane:0,action:cr.action,hasEagerState:cr.hasEagerState,eagerState:cr.eagerState,next:null}),pe=cr.hasEagerState?cr.eagerState:A(pe,cr.action);else{var Wr={lane:zr,action:cr.action,hasEagerState:cr.hasEagerState,eagerState:cr.eagerState,next:null};_n===null?(pn=_n=Wr,Nt=pe):_n=_n.next=Wr,go.lanes|=zr,Xm|=zr}cr=cr.next}while(cr!==null&&cr!==Ve);_n===null?Nt=pe:_n.next=pn,Ht(pe,R.memoizedState)||(Vc=!0),R.memoizedState=pe,R.baseState=Nt,R.baseQueue=_n,Z.lastRenderedState=pe}if(A=Z.interleaved,A!==null){Pe=A;do Ve=Pe.lane,go.lanes|=Ve,Xm|=Ve,Pe=Pe.next;while(Pe!==A)}else Pe===null&&(Z.lanes=0);return[R.memoizedState,Z.dispatch]}function ib(A){var R=Md(),Z=R.queue;if(Z===null)throw Error(n(311));Z.lastRenderedReducer=A;var pe=Z.dispatch,Pe=Z.pending,Ve=R.memoizedState;if(Pe!==null){Z.pending=null;var Nt=Pe=Pe.next;do Ve=A(Ve,Nt.action),Nt=Nt.next;while(Nt!==Pe);Ht(Ve,R.memoizedState)||(Vc=!0),R.memoizedState=Ve,R.baseQueue===null&&(R.baseState=Ve),Z.lastRenderedState=Ve}return[Ve,pe]}function y6(){}function n8(A,R){var Z=go,pe=Md(),Pe=R(),Ve=!Ht(pe.memoizedState,Pe);if(Ve&&(pe.memoizedState=Pe,Vc=!0),pe=pe.queue,yh(Ip.bind(null,Z,pe,A),[A]),pe.getSnapshot!==R||Ve||hl!==null&&hl.memoizedState.tag&1){if(Z.flags|=2048,ab(9,gu.bind(null,Z,pe,Pe,R),void 0,null),Fl===null)throw Error(n(349));Gm&30||r8(Z,R,Pe)}return Pe}function r8(A,R,Z){A.flags|=16384,A={getSnapshot:R,value:Z},R=go.updateQueue,R===null?(R={lastEffect:null,stores:null},go.updateQueue=R,R.stores=[A]):(Z=R.stores,Z===null?R.stores=[A]:Z.push(A))}function gu(A,R,Z,pe){R.value=Z,R.getSnapshot=pe,v6(R)&&s8(A)}function Ip(A,R,Z){return Z(function(){v6(R)&&s8(A)})}function v6(A){var R=A.getSnapshot;A=A.value;try{var Z=R();return!Ht(A,Z)}catch{return!0}}function s8(A){var R=kp(A,1);R!==null&&Tf(R,A,1,-1)}function sv(A){var R=bh();return typeof A=="function"&&(A=A()),R.memoizedState=R.baseState=A,A={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cc,lastRenderedState:A},R.queue=A,A=A.dispatch=FP.bind(null,go,A),[R.memoizedState,A]}function ab(A,R,Z,pe){return A={tag:A,create:R,destroy:Z,deps:pe,next:null},R=go.updateQueue,R===null?(R={lastEffect:null,stores:null},go.updateQueue=R,R.lastEffect=A.next=A):(Z=R.lastEffect,Z===null?R.lastEffect=A.next=A:(pe=Z.next,Z.next=A,A.next=pe,R.lastEffect=A)),A}function w6(){return Md().memoizedState}function iv(A,R,Z,pe){var Pe=bh();go.flags|=A,Pe.memoizedState=ab(1|R,Z,void 0,pe===void 0?null:pe)}function ob(A,R,Z,pe){var Pe=Md();pe=pe===void 0?null:pe;var Ve=void 0;if(Uo!==null){var Nt=Uo.memoizedState;if(Ve=Nt.destroy,pe!==null&&e8(pe,Nt.deps)){Pe.memoizedState=ab(R,Z,Ve,pe);return}}go.flags|=A,Pe.memoizedState=ab(1|R,Z,Ve,pe)}function C6(A,R){return iv(8390656,8,A,R)}function yh(A,R){return ob(2048,8,A,R)}function _P(A,R){return ob(4,2,A,R)}function Fp(A,R){return ob(4,4,A,R)}function i8(A,R){if(typeof R=="function")return A=A(),R(A),function(){R(null)};if(R!=null)return A=A(),R.current=A,function(){R.current=null}}function a8(A,R,Z){return Z=Z!=null?Z.concat([A]):null,ob(4,4,i8.bind(null,R,A),Z)}function av(){}function kP(A,R){var Z=Md();R=R===void 0?null:R;var pe=Z.memoizedState;return pe!==null&&R!==null&&e8(R,pe[1])?pe[0]:(Z.memoizedState=[A,R],A)}function TP(A,R){var Z=Md();R=R===void 0?null:R;var pe=Z.memoizedState;return pe!==null&&R!==null&&e8(R,pe[1])?pe[0]:(A=A(),Z.memoizedState=[A,R],A)}function PP(A,R,Z){return Gm&21?(Ht(Z,R)||(Z=$e(),go.lanes|=Z,Xm|=Z,A.baseState=!0),R):(A.baseState&&(A.baseState=!1,Vc=!0),A.memoizedState=Z)}function IP(A,R){var Z=yt;yt=Z!==0&&4>Z?Z:4,A(!0);var pe=Jj.transition;Jj.transition={};try{A(!1),R()}finally{yt=Z,Jj.transition=pe}}function o8(){return Md().memoizedState}function Lz(A,R,Z){var pe=Jm(A);if(Z={lane:pe,action:Z,hasEagerState:!1,eagerState:null,next:null},l8(A))Hc(R,Z);else if(Z=h6(A,R,Z,pe),Z!==null){var Pe=Gc();Tf(Z,A,pe,Pe),Af(Z,R,pe)}}function FP(A,R,Z){var pe=Jm(A),Pe={lane:pe,action:Z,hasEagerState:!1,eagerState:null,next:null};if(l8(A))Hc(R,Pe);else{var Ve=A.alternate;if(A.lanes===0&&(Ve===null||Ve.lanes===0)&&(Ve=R.lastRenderedReducer,Ve!==null))try{var Nt=R.lastRenderedState,pn=Ve(Nt,Z);if(Pe.hasEagerState=!0,Pe.eagerState=pn,Ht(pn,Nt)){var _n=R.interleaved;_n===null?(Pe.next=Pe,Kj(R)):(Pe.next=_n.next,_n.next=Pe),R.interleaved=Pe;return}}catch{}finally{}Z=h6(A,R,Pe,pe),Z!==null&&(Pe=Gc(),Tf(Z,A,pe,Pe),Af(Z,R,pe))}}function l8(A){var R=A.alternate;return A===go||R!==null&&R===go}function Hc(A,R){rv=sb=!0;var Z=A.pending;Z===null?R.next=R:(R.next=Z.next,Z.next=R),A.pending=R}function Af(A,R,Z){if(Z&4194240){var pe=R.lanes;pe&=A.pendingLanes,Z|=pe,R.lanes=Z,ut(A,Z)}}var S6={readContext:Id,useCallback:wc,useContext:wc,useEffect:wc,useImperativeHandle:wc,useInsertionEffect:wc,useLayoutEffect:wc,useMemo:wc,useReducer:wc,useRef:wc,useState:wc,useDebugValue:wc,useDeferredValue:wc,useTransition:wc,useMutableSource:wc,useSyncExternalStore:wc,useId:wc,unstable_isNewReconciler:!1},Dz={readContext:Id,useCallback:function(A,R){return bh().memoizedState=[A,R===void 0?null:R],A},useContext:Id,useEffect:C6,useImperativeHandle:function(A,R,Z){return Z=Z!=null?Z.concat([A]):null,iv(4194308,4,i8.bind(null,R,A),Z)},useLayoutEffect:function(A,R){return iv(4194308,4,A,R)},useInsertionEffect:function(A,R){return iv(4,2,A,R)},useMemo:function(A,R){var Z=bh();return R=R===void 0?null:R,A=A(),Z.memoizedState=[A,R],A},useReducer:function(A,R,Z){var pe=bh();return R=Z!==void 0?Z(R):R,pe.memoizedState=pe.baseState=R,A={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:A,lastRenderedState:R},pe.queue=A,A=A.dispatch=Lz.bind(null,go,A),[pe.memoizedState,A]},useRef:function(A){var R=bh();return A={current:A},R.memoizedState=A},useState:sv,useDebugValue:av,useDeferredValue:function(A){return bh().memoizedState=A},useTransition:function(){var A=sv(!1),R=A[0];return A=IP.bind(null,A[1]),bh().memoizedState=A,[R,A]},useMutableSource:function(){},useSyncExternalStore:function(A,R,Z){var pe=go,Pe=bh();if(Ya){if(Z===void 0)throw Error(n(407));Z=Z()}else{if(Z=R(),Fl===null)throw Error(n(349));Gm&30||r8(pe,R,Z)}Pe.memoizedState=Z;var Ve={value:Z,getSnapshot:R};return Pe.queue=Ve,C6(Ip.bind(null,pe,Ve,A),[A]),pe.flags|=2048,ab(9,gu.bind(null,pe,Ve,Z,R),void 0,null),Z},useId:function(){var A=bh(),R=Fl.identifierPrefix;if(Ya){var Z=hh,pe=fh;Z=(pe&~(1<<32-ce(pe)-1)).toString(32)+Z,R=":"+R+"R"+Z,Z=Fx++,0<Z&&(R+="H"+Z.toString(32)),R+=":"}else Z=Mi++,R=":"+R+"r"+Z.toString(32)+":";return A.memoizedState=R},unstable_isNewReconciler:!1},N6={readContext:Id,useCallback:kP,useContext:Id,useEffect:yh,useImperativeHandle:a8,useInsertionEffect:_P,useLayoutEffect:Fp,useMemo:TP,useReducer:t8,useRef:w6,useState:function(){return t8(Cc)},useDebugValue:av,useDeferredValue:function(A){var R=Md();return PP(R,Uo.memoizedState,A)},useTransition:function(){var A=t8(Cc)[0],R=Md().memoizedState;return[A,R]},useMutableSource:y6,useSyncExternalStore:n8,useId:o8,unstable_isNewReconciler:!1},lb={readContext:Id,useCallback:kP,useContext:Id,useEffect:yh,useImperativeHandle:a8,useInsertionEffect:_P,useLayoutEffect:Fp,useMemo:TP,useReducer:ib,useRef:w6,useState:function(){return ib(Cc)},useDebugValue:av,useDeferredValue:function(A){var R=Md();return Uo===null?R.memoizedState=A:PP(R,Uo.memoizedState,A)},useTransition:function(){var A=ib(Cc)[0],R=Md().memoizedState;return[A,R]},useMutableSource:y6,useSyncExternalStore:n8,useId:o8,unstable_isNewReconciler:!1};function Rd(A,R){if(A&&A.defaultProps){R=ee({},R),A=A.defaultProps;for(var Z in A)R[Z]===void 0&&(R[Z]=A[Z]);return R}return R}function A6(A,R,Z,pe){R=A.memoizedState,Z=Z(pe,R),Z=Z==null?R:ee({},R,Z),A.memoizedState=Z,A.lanes===0&&(A.updateQueue.baseState=Z)}var j6={isMounted:function(A){return(A=A._reactInternals)?en(A)===A:!1},enqueueSetState:function(A,R,Z){A=A._reactInternals;var pe=Gc(),Pe=Jm(A),Ve=Tp(pe,Pe);Ve.payload=R,Z!=null&&(Ve.callback=Z),R=Od(A,Ve,Pe),R!==null&&(Tf(R,A,Pe,pe),m6(R,A,Pe))},enqueueReplaceState:function(A,R,Z){A=A._reactInternals;var pe=Gc(),Pe=Jm(A),Ve=Tp(pe,Pe);Ve.tag=1,Ve.payload=R,Z!=null&&(Ve.callback=Z),R=Od(A,Ve,Pe),R!==null&&(Tf(R,A,Pe,pe),m6(R,A,Pe))},enqueueForceUpdate:function(A,R){A=A._reactInternals;var Z=Gc(),pe=Jm(A),Pe=Tp(Z,pe);Pe.tag=2,R!=null&&(Pe.callback=R),R=Od(A,Pe,pe),R!==null&&(Tf(R,A,pe,Z),m6(R,A,pe))}};function c8(A,R,Z,pe,Pe,Ve,Nt){return A=A.stateNode,typeof A.shouldComponentUpdate=="function"?A.shouldComponentUpdate(pe,Ve,Nt):R.prototype&&R.prototype.isPureReactComponent?!jn(Z,pe)||!jn(Pe,Ve):!0}function Mx(A,R,Z){var pe=!1,Pe=zm,Ve=R.contextType;return typeof Ve=="object"&&Ve!==null?Ve=Id(Ve):(Pe=mu(R)?zc:bc.current,pe=R.contextTypes,Ve=(pe=pe!=null)?J1(A,Pe):zm),R=new R(Z,Ve),A.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,R.updater=j6,A.stateNode=R,R._reactInternals=A,pe&&(A=A.stateNode,A.__reactInternalMemoizedUnmaskedChildContext=Pe,A.__reactInternalMemoizedMaskedChildContext=Ve),R}function cb(A,R,Z,pe){A=R.state,typeof R.componentWillReceiveProps=="function"&&R.componentWillReceiveProps(Z,pe),typeof R.UNSAFE_componentWillReceiveProps=="function"&&R.UNSAFE_componentWillReceiveProps(Z,pe),R.state!==A&&j6.enqueueReplaceState(R,R.state,null)}function u8(A,R,Z,pe){var Pe=A.stateNode;Pe.props=Z,Pe.state=A.memoizedState,Pe.refs={},p6(A);var Ve=R.contextType;typeof Ve=="object"&&Ve!==null?Pe.context=Id(Ve):(Ve=mu(R)?zc:bc.current,Pe.context=J1(A,Ve)),Pe.state=A.memoizedState,Ve=R.getDerivedStateFromProps,typeof Ve=="function"&&(A6(A,R,Ve,Z),Pe.state=A.memoizedState),typeof R.getDerivedStateFromProps=="function"||typeof Pe.getSnapshotBeforeUpdate=="function"||typeof Pe.UNSAFE_componentWillMount!="function"&&typeof Pe.componentWillMount!="function"||(R=Pe.state,typeof Pe.componentWillMount=="function"&&Pe.componentWillMount(),typeof Pe.UNSAFE_componentWillMount=="function"&&Pe.UNSAFE_componentWillMount(),R!==Pe.state&&j6.enqueueReplaceState(Pe,Pe.state,null),nb(A,Z,Pe,pe),Pe.state=A.memoizedState),typeof Pe.componentDidMount=="function"&&(A.flags|=4194308)}function Rx(A,R){try{var Z="",pe=R;do Z+=we(pe),pe=pe.return;while(pe);var Pe=Z}catch(Ve){Pe=`
Error generating stack: `+Ve.message+`
`+Ve.stack}return{value:A,source:R,stack:Pe,digest:null}}function E6(A,R,Z){return{value:A,source:null,stack:Z??null,digest:R??null}}function ub(A,R){try{console.error(R.value)}catch(Z){setTimeout(function(){throw Z})}}var OP=typeof WeakMap=="function"?WeakMap:Map;function ov(A,R,Z){Z=Tp(-1,Z),Z.tag=3,Z.payload={element:null};var pe=R.value;return Z.callback=function(){D6||(D6=!0,j8=pe),ub(A,R)},Z}function _6(A,R,Z){Z=Tp(-1,Z),Z.tag=3;var pe=A.type.getDerivedStateFromError;if(typeof pe=="function"){var Pe=R.value;Z.payload=function(){return pe(Pe)},Z.callback=function(){ub(A,R)}}var Ve=A.stateNode;return Ve!==null&&typeof Ve.componentDidCatch=="function"&&(Z.callback=function(){ub(A,R),typeof pe!="function"&&(Qm===null?Qm=new Set([this]):Qm.add(this));var Nt=R.stack;this.componentDidCatch(R.value,{componentStack:Nt!==null?Nt:""})}),Z}function lv(A,R,Z){var pe=A.pingCache;if(pe===null){pe=A.pingCache=new OP;var Pe=new Set;pe.set(R,Pe)}else Pe=pe.get(R),Pe===void 0&&(Pe=new Set,pe.set(R,Pe));Pe.has(Z)||(Pe.add(Z),A=qz.bind(null,A,R,Z),R.then(A,A))}function MP(A){do{var R;if((R=A.tag===13)&&(R=A.memoizedState,R=R!==null?R.dehydrated!==null:!0),R)return A;A=A.return}while(A!==null);return null}function d8(A,R,Z,pe,Pe){return A.mode&1?(A.flags|=65536,A.lanes=Pe,A):(A===R?A.flags|=65536:(A.flags|=128,Z.flags|=131072,Z.flags&=-52805,Z.tag===1&&(Z.alternate===null?Z.tag=17:(R=Tp(-1,1),R.tag=2,Od(Z,R,1))),Z.lanes|=1),A)}var k6=M.ReactCurrentOwner,Vc=!1;function Ql(A,R,Z,pe){R.child=A===null?d6(R,null,Z,pe):ko(R,A.child,Z,pe)}function RP(A,R,Z,pe,Pe){Z=Z.render;var Ve=R.ref;return Wm(R,Pe),pe=Ox(A,R,Z,pe,Ve,Pe),Z=b6(),A!==null&&!Vc?(R.updateQueue=A.updateQueue,R.flags&=-2053,A.lanes&=~Pe,jf(A,R,Pe)):(Ya&&Z&&X2(R),R.flags|=1,Ql(A,R,pe,Pe),R.child)}function f8(A,R,Z,pe,Pe){if(A===null){var Ve=Z.type;return typeof Ve=="function"&&!V6(Ve)&&Ve.defaultProps===void 0&&Z.compare===null&&Z.defaultProps===void 0?(R.tag=15,R.type=Ve,vh(A,R,Ve,pe,Pe)):(A=W6(Z.type,null,pe,R,R.mode,Pe),A.ref=R.ref,A.return=R,R.child=A)}if(Ve=A.child,!(A.lanes&Pe)){var Nt=Ve.memoizedProps;if(Z=Z.compare,Z=Z!==null?Z:jn,Z(Nt,pe)&&A.ref===R.ref)return jf(A,R,Pe)}return R.flags|=1,A=Pf(Ve,pe),A.ref=R.ref,A.return=R,R.child=A}function vh(A,R,Z,pe,Pe){if(A!==null){var Ve=A.memoizedProps;if(jn(Ve,pe)&&A.ref===R.ref)if(Vc=!1,R.pendingProps=pe=Ve,(A.lanes&Pe)!==0)A.flags&131072&&(Vc=!0);else return R.lanes=A.lanes,jf(A,R,Pe)}return m8(A,R,Z,pe,Pe)}function h8(A,R,Z){var pe=R.pendingProps,Pe=pe.children,Ve=A!==null?A.memoizedState:null;if(pe.mode==="hidden")if(!(R.mode&1))R.memoizedState={baseLanes:0,cachePool:null,transitions:null},za(pb,Qu),Qu|=Z;else{if(!(Z&1073741824))return A=Ve!==null?Ve.baseLanes|Z:Z,R.lanes=R.childLanes=1073741824,R.memoizedState={baseLanes:A,cachePool:null,transitions:null},R.updateQueue=null,za(pb,Qu),Qu|=A,null;R.memoizedState={baseLanes:0,cachePool:null,transitions:null},pe=Ve!==null?Ve.baseLanes:Z,za(pb,Qu),Qu|=pe}else Ve!==null?(pe=Ve.baseLanes|Z,R.memoizedState=null):pe=Z,za(pb,Qu),Qu|=pe;return Ql(A,R,Pe,Z),R.child}function p8(A,R){var Z=R.ref;(A===null&&Z!==null||A!==null&&A.ref!==Z)&&(R.flags|=512,R.flags|=2097152)}function m8(A,R,Z,pe,Pe){var Ve=mu(Z)?zc:bc.current;return Ve=J1(R,Ve),Wm(R,Pe),Z=Ox(A,R,Z,pe,Ve,Pe),pe=b6(),A!==null&&!Vc?(R.updateQueue=A.updateQueue,R.flags&=-2053,A.lanes&=~Pe,jf(A,R,Pe)):(Ya&&pe&&X2(R),R.flags|=1,Ql(A,R,Z,Pe),R.child)}function x8(A,R,Z,pe,Pe){if(mu(Z)){var Ve=!0;kd(R)}else Ve=!1;if(Wm(R,Pe),R.stateNode===null)P6(A,R),Mx(R,Z,pe),u8(R,Z,pe,Pe),pe=!0;else if(A===null){var Nt=R.stateNode,pn=R.memoizedProps;Nt.props=pn;var _n=Nt.context,cr=Z.contextType;typeof cr=="object"&&cr!==null?cr=Id(cr):(cr=mu(Z)?zc:bc.current,cr=J1(R,cr));var zr=Z.getDerivedStateFromProps,Wr=typeof zr=="function"||typeof Nt.getSnapshotBeforeUpdate=="function";Wr||typeof Nt.UNSAFE_componentWillReceiveProps!="function"&&typeof Nt.componentWillReceiveProps!="function"||(pn!==pe||_n!==cr)&&cb(R,Nt,pe,cr),Fd=!1;var Ur=R.memoizedState;Nt.state=Ur,nb(R,pe,Nt,Pe),_n=R.memoizedState,pn!==pe||Ur!==_n||pu.current||Fd?(typeof zr=="function"&&(A6(R,Z,zr,pe),_n=R.memoizedState),(pn=Fd||c8(R,Z,pn,pe,Ur,_n,cr))?(Wr||typeof Nt.UNSAFE_componentWillMount!="function"&&typeof Nt.componentWillMount!="function"||(typeof Nt.componentWillMount=="function"&&Nt.componentWillMount(),typeof Nt.UNSAFE_componentWillMount=="function"&&Nt.UNSAFE_componentWillMount()),typeof Nt.componentDidMount=="function"&&(R.flags|=4194308)):(typeof Nt.componentDidMount=="function"&&(R.flags|=4194308),R.memoizedProps=pe,R.memoizedState=_n),Nt.props=pe,Nt.state=_n,Nt.context=cr,pe=pn):(typeof Nt.componentDidMount=="function"&&(R.flags|=4194308),pe=!1)}else{Nt=R.stateNode,jP(A,R),pn=R.memoizedProps,cr=R.type===R.elementType?pn:Rd(R.type,pn),Nt.props=cr,Wr=R.pendingProps,Ur=Nt.context,_n=Z.contextType,typeof _n=="object"&&_n!==null?_n=Id(_n):(_n=mu(Z)?zc:bc.current,_n=J1(R,_n));var hs=Z.getDerivedStateFromProps;(zr=typeof hs=="function"||typeof Nt.getSnapshotBeforeUpdate=="function")||typeof Nt.UNSAFE_componentWillReceiveProps!="function"&&typeof Nt.componentWillReceiveProps!="function"||(pn!==Wr||Ur!==_n)&&cb(R,Nt,pe,_n),Fd=!1,Ur=R.memoizedState,Nt.state=Ur,nb(R,pe,Nt,Pe);var As=R.memoizedState;pn!==Wr||Ur!==As||pu.current||Fd?(typeof hs=="function"&&(A6(R,Z,hs,pe),As=R.memoizedState),(cr=Fd||c8(R,Z,cr,pe,Ur,As,_n)||!1)?(zr||typeof Nt.UNSAFE_componentWillUpdate!="function"&&typeof Nt.componentWillUpdate!="function"||(typeof Nt.componentWillUpdate=="function"&&Nt.componentWillUpdate(pe,As,_n),typeof Nt.UNSAFE_componentWillUpdate=="function"&&Nt.UNSAFE_componentWillUpdate(pe,As,_n)),typeof Nt.componentDidUpdate=="function"&&(R.flags|=4),typeof Nt.getSnapshotBeforeUpdate=="function"&&(R.flags|=1024)):(typeof Nt.componentDidUpdate!="function"||pn===A.memoizedProps&&Ur===A.memoizedState||(R.flags|=4),typeof Nt.getSnapshotBeforeUpdate!="function"||pn===A.memoizedProps&&Ur===A.memoizedState||(R.flags|=1024),R.memoizedProps=pe,R.memoizedState=As),Nt.props=pe,Nt.state=As,Nt.context=_n,pe=cr):(typeof Nt.componentDidUpdate!="function"||pn===A.memoizedProps&&Ur===A.memoizedState||(R.flags|=4),typeof Nt.getSnapshotBeforeUpdate!="function"||pn===A.memoizedProps&&Ur===A.memoizedState||(R.flags|=1024),pe=!1)}return g8(A,R,Z,pe,Ve,Pe)}function g8(A,R,Z,pe,Pe,Ve){p8(A,R);var Nt=(R.flags&128)!==0;if(!pe&&!Nt)return Pe&&vP(R,Z,!1),jf(A,R,Ve);pe=R.stateNode,k6.current=R;var pn=Nt&&typeof Z.getDerivedStateFromError!="function"?null:pe.render();return R.flags|=1,A!==null&&Nt?(R.child=ko(R,A.child,null,Ve),R.child=ko(R,null,pn,Ve)):Ql(A,R,pn,Ve),R.memoizedState=pe.state,Pe&&vP(R,Z,!0),R.child}function LP(A){var R=A.stateNode;R.pendingContext?bP(A,R.pendingContext,R.pendingContext!==R.context):R.context&&bP(A,R.context,!1),Xj(A,R.containerInfo)}function wh(A,R,Z,pe,Pe){return mh(),xh(Pe),R.flags|=256,Ql(A,R,Z,pe),R.child}var cv={dehydrated:null,treeContext:null,retryLane:0};function uv(A){return{baseLanes:A,cachePool:null,transitions:null}}function T6(A,R,Z){var pe=R.pendingProps,Pe=so.current,Ve=!1,Nt=(R.flags&128)!==0,pn;if((pn=Nt)||(pn=A!==null&&A.memoizedState===null?!1:(Pe&2)!==0),pn?(Ve=!0,R.flags&=-129):(A===null||A.memoizedState!==null)&&(Pe|=1),za(so,Pe&1),A===null)return xu(R),A=R.memoizedState,A!==null&&(A=A.dehydrated,A!==null)?(R.mode&1?A.data==="$!"?R.lanes=8:R.lanes=1073741824:R.lanes=1,null):(Nt=pe.children,A=pe.fallback,Ve?(pe=R.mode,Ve=R.child,Nt={mode:"hidden",children:Nt},!(pe&1)&&Ve!==null?(Ve.childLanes=0,Ve.pendingProps=Nt):Ve=q6(Nt,pe,0,null),A=Ux(A,pe,Z,null),Ve.return=R,A.return=R,Ve.sibling=A,R.child=Ve,R.child.memoizedState=uv(Z),R.memoizedState=cv,A):db(R,Nt));if(Pe=A.memoizedState,Pe!==null&&(pn=Pe.dehydrated,pn!==null))return Gs(A,R,Nt,pe,pn,Pe,Z);if(Ve){Ve=pe.fallback,Nt=R.mode,Pe=A.child,pn=Pe.sibling;var _n={mode:"hidden",children:pe.children};return!(Nt&1)&&R.child!==Pe?(pe=R.child,pe.childLanes=0,pe.pendingProps=_n,R.deletions=null):(pe=Pf(Pe,_n),pe.subtreeFlags=Pe.subtreeFlags&14680064),pn!==null?Ve=Pf(pn,Ve):(Ve=Ux(Ve,Nt,Z,null),Ve.flags|=2),Ve.return=R,pe.return=R,pe.sibling=Ve,R.child=pe,pe=Ve,Ve=R.child,Nt=A.child.memoizedState,Nt=Nt===null?uv(Z):{baseLanes:Nt.baseLanes|Z,cachePool:null,transitions:Nt.transitions},Ve.memoizedState=Nt,Ve.childLanes=A.childLanes&~Z,R.memoizedState=cv,pe}return Ve=A.child,A=Ve.sibling,pe=Pf(Ve,{mode:"visible",children:pe.children}),!(R.mode&1)&&(pe.lanes=Z),pe.return=R,pe.sibling=null,A!==null&&(Z=R.deletions,Z===null?(R.deletions=[A],R.flags|=16):Z.push(A)),R.child=pe,R.memoizedState=null,pe}function db(A,R){return R=q6({mode:"visible",children:R},A.mode,0,null),R.return=A,A.child=R}function Op(A,R,Z,pe){return pe!==null&&xh(pe),ko(R,A.child,null,Z),A=db(R,R.pendingProps.children),A.flags|=2,R.memoizedState=null,A}function Gs(A,R,Z,pe,Pe,Ve,Nt){if(Z)return R.flags&256?(R.flags&=-257,pe=E6(Error(n(422))),Op(A,R,Nt,pe)):R.memoizedState!==null?(R.child=A.child,R.flags|=128,null):(Ve=pe.fallback,Pe=R.mode,pe=q6({mode:"visible",children:pe.children},Pe,0,null),Ve=Ux(Ve,Pe,Nt,null),Ve.flags|=2,pe.return=R,Ve.return=R,pe.sibling=Ve,R.child=pe,R.mode&1&&ko(R,A.child,null,Nt),R.child.memoizedState=uv(Nt),R.memoizedState=cv,Ve);if(!(R.mode&1))return Op(A,R,Nt,null);if(Pe.data==="$!"){if(pe=Pe.nextSibling&&Pe.nextSibling.dataset,pe)var pn=pe.dgst;return pe=pn,Ve=Error(n(419)),pe=E6(Ve,pe,void 0),Op(A,R,Nt,pe)}if(pn=(Nt&A.childLanes)!==0,Vc||pn){if(pe=Fl,pe!==null){switch(Nt&-Nt){case 4:Pe=2;break;case 16:Pe=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:Pe=32;break;case 536870912:Pe=268435456;break;default:Pe=0}Pe=Pe&(pe.suspendedLanes|Nt)?0:Pe,Pe!==0&&Pe!==Ve.retryLane&&(Ve.retryLane=Pe,kp(A,Pe),Tf(pe,A,Pe,-1))}return I8(),pe=E6(Error(n(421))),Op(A,R,Nt,pe)}return Pe.data==="$?"?(R.flags|=128,R.child=A.child,R=Gz.bind(null,A),Pe._reactRetry=R,null):(A=Ve.treeContext,Ku=$m(Pe.nextSibling),vc=R,Ya=!0,Nf=null,A!==null&&(Td[Pd++]=fh,Td[Pd++]=hh,Td[Pd++]=Ex,fh=A.id,hh=A.overflow,Ex=R),R=db(R,pe.children),R.flags|=4096,R)}function dv(A,R,Z){A.lanes|=R;var pe=A.alternate;pe!==null&&(pe.lanes|=R),Xl(A.return,R,Z)}function fv(A,R,Z,pe,Pe){var Ve=A.memoizedState;Ve===null?A.memoizedState={isBackwards:R,rendering:null,renderingStartTime:0,last:pe,tail:Z,tailMode:Pe}:(Ve.isBackwards=R,Ve.rendering=null,Ve.renderingStartTime=0,Ve.last=pe,Ve.tail=Z,Ve.tailMode=Pe)}function Km(A,R,Z){var pe=R.pendingProps,Pe=pe.revealOrder,Ve=pe.tail;if(Ql(A,R,pe.children,Z),pe=so.current,pe&2)pe=pe&1|2,R.flags|=128;else{if(A!==null&&A.flags&128)e:for(A=R.child;A!==null;){if(A.tag===13)A.memoizedState!==null&&dv(A,Z,R);else if(A.tag===19)dv(A,Z,R);else if(A.child!==null){A.child.return=A,A=A.child;continue}if(A===R)break e;for(;A.sibling===null;){if(A.return===null||A.return===R)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}pe&=1}if(za(so,pe),!(R.mode&1))R.memoizedState=null;else switch(Pe){case"forwards":for(Z=R.child,Pe=null;Z!==null;)A=Z.alternate,A!==null&&Ix(A)===null&&(Pe=Z),Z=Z.sibling;Z=Pe,Z===null?(Pe=R.child,R.child=null):(Pe=Z.sibling,Z.sibling=null),fv(R,!1,Pe,Z,Ve);break;case"backwards":for(Z=null,Pe=R.child,R.child=null;Pe!==null;){if(A=Pe.alternate,A!==null&&Ix(A)===null){R.child=Pe;break}A=Pe.sibling,Pe.sibling=Z,Z=Pe,Pe=A}fv(R,!0,Z,null,Ve);break;case"together":fv(R,!1,null,null,void 0);break;default:R.memoizedState=null}return R.child}function P6(A,R){!(R.mode&1)&&A!==null&&(A.alternate=null,R.alternate=null,R.flags|=2)}function jf(A,R,Z){if(A!==null&&(R.dependencies=A.dependencies),Xm|=R.lanes,!(Z&R.childLanes))return null;if(A!==null&&R.child!==A.child)throw Error(n(153));if(R.child!==null){for(A=R.child,Z=Pf(A,A.pendingProps),R.child=Z,Z.return=R;A.sibling!==null;)A=A.sibling,Z=Z.sibling=Pf(A,A.pendingProps),Z.return=R;Z.sibling=null}return R.child}function DP(A,R,Z){switch(R.tag){case 3:LP(R),mh();break;case 5:Qj(R);break;case 1:mu(R.type)&&kd(R);break;case 4:Xj(R,R.stateNode.containerInfo);break;case 10:var pe=R.type._context,Pe=R.memoizedProps.value;za(J2,pe._currentValue),pe._currentValue=Pe;break;case 13:if(pe=R.memoizedState,pe!==null)return pe.dehydrated!==null?(za(so,so.current&1),R.flags|=128,null):Z&R.child.childLanes?T6(A,R,Z):(za(so,so.current&1),A=jf(A,R,Z),A!==null?A.sibling:null);za(so,so.current&1);break;case 19:if(pe=(Z&R.childLanes)!==0,A.flags&128){if(pe)return Km(A,R,Z);R.flags|=128}if(Pe=R.memoizedState,Pe!==null&&(Pe.rendering=null,Pe.tail=null,Pe.lastEffect=null),za(so,so.current),pe)break;return null;case 22:case 23:return R.lanes=0,h8(A,R,Z)}return jf(A,R,Z)}var Zl,b8,BP,y8;Zl=function(A,R){for(var Z=R.child;Z!==null;){if(Z.tag===5||Z.tag===6)A.appendChild(Z.stateNode);else if(Z.tag!==4&&Z.child!==null){Z.child.return=Z,Z=Z.child;continue}if(Z===R)break;for(;Z.sibling===null;){if(Z.return===null||Z.return===R)return;Z=Z.return}Z.sibling.return=Z.return,Z=Z.sibling}},b8=function(){},BP=function(A,R,Z,pe){var Pe=A.memoizedProps;if(Pe!==pe){A=R.stateNode,Pp(gh.current);var Ve=null;switch(Z){case"input":Pe=tt(A,Pe),pe=tt(A,pe),Ve=[];break;case"select":Pe=ee({},Pe,{value:void 0}),pe=ee({},pe,{value:void 0}),Ve=[];break;case"textarea":Pe=nn(A,Pe),pe=nn(A,pe),Ve=[];break;default:typeof Pe.onClick!="function"&&typeof pe.onClick=="function"&&(A.onclick=n6)}At(Z,pe);var Nt;Z=null;for(cr in Pe)if(!pe.hasOwnProperty(cr)&&Pe.hasOwnProperty(cr)&&Pe[cr]!=null)if(cr==="style"){var pn=Pe[cr];for(Nt in pn)pn.hasOwnProperty(Nt)&&(Z||(Z={}),Z[Nt]="")}else cr!=="dangerouslySetInnerHTML"&&cr!=="children"&&cr!=="suppressContentEditableWarning"&&cr!=="suppressHydrationWarning"&&cr!=="autoFocus"&&(s.hasOwnProperty(cr)?Ve||(Ve=[]):(Ve=Ve||[]).push(cr,null));for(cr in pe){var _n=pe[cr];if(pn=Pe!=null?Pe[cr]:void 0,pe.hasOwnProperty(cr)&&_n!==pn&&(_n!=null||pn!=null))if(cr==="style")if(pn){for(Nt in pn)!pn.hasOwnProperty(Nt)||_n&&_n.hasOwnProperty(Nt)||(Z||(Z={}),Z[Nt]="");for(Nt in _n)_n.hasOwnProperty(Nt)&&pn[Nt]!==_n[Nt]&&(Z||(Z={}),Z[Nt]=_n[Nt])}else Z||(Ve||(Ve=[]),Ve.push(cr,Z)),Z=_n;else cr==="dangerouslySetInnerHTML"?(_n=_n?_n.__html:void 0,pn=pn?pn.__html:void 0,_n!=null&&pn!==_n&&(Ve=Ve||[]).push(cr,_n)):cr==="children"?typeof _n!="string"&&typeof _n!="number"||(Ve=Ve||[]).push(cr,""+_n):cr!=="suppressContentEditableWarning"&&cr!=="suppressHydrationWarning"&&(s.hasOwnProperty(cr)?(_n!=null&&cr==="onScroll"&&Ga("scroll",A),Ve||pn===_n||(Ve=[])):(Ve=Ve||[]).push(cr,_n))}Z&&(Ve=Ve||[]).push("style",Z);var cr=Ve;(R.updateQueue=cr)&&(R.flags|=4)}},y8=function(A,R,Z,pe){Z!==pe&&(R.flags|=4)};function hv(A,R){if(!Ya)switch(A.tailMode){case"hidden":R=A.tail;for(var Z=null;R!==null;)R.alternate!==null&&(Z=R),R=R.sibling;Z===null?A.tail=null:Z.sibling=null;break;case"collapsed":Z=A.tail;for(var pe=null;Z!==null;)Z.alternate!==null&&(pe=Z),Z=Z.sibling;pe===null?R||A.tail===null?A.tail=null:A.tail.sibling=null:pe.sibling=null}}function Jl(A){var R=A.alternate!==null&&A.alternate.child===A.child,Z=0,pe=0;if(R)for(var Pe=A.child;Pe!==null;)Z|=Pe.lanes|Pe.childLanes,pe|=Pe.subtreeFlags&14680064,pe|=Pe.flags&14680064,Pe.return=A,Pe=Pe.sibling;else for(Pe=A.child;Pe!==null;)Z|=Pe.lanes|Pe.childLanes,pe|=Pe.subtreeFlags,pe|=Pe.flags,Pe.return=A,Pe=Pe.sibling;return A.subtreeFlags|=pe,A.childLanes=Z,R}function Bz(A,R,Z){var pe=R.pendingProps;switch(kx(R),R.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jl(R),null;case 1:return mu(R.type)&&a6(),Jl(R),null;case 3:return pe=R.stateNode,qm(),Ka(pu),Ka(bc),g6(),pe.pendingContext&&(pe.context=pe.pendingContext,pe.pendingContext=null),(A===null||A.child===null)&&(Q2(R)?R.flags|=4:A===null||A.memoizedState.isDehydrated&&!(R.flags&256)||(R.flags|=1024,Nf!==null&&(k8(Nf),Nf=null))),b8(A,R),Jl(R),null;case 5:x6(R);var Pe=Pp(rb.current);if(Z=R.type,A!==null&&R.stateNode!=null)BP(A,R,Z,pe,Pe),A.ref!==R.ref&&(R.flags|=512,R.flags|=2097152);else{if(!pe){if(R.stateNode===null)throw Error(n(166));return Jl(R),null}if(A=Pp(gh.current),Q2(R)){pe=R.stateNode,Z=R.type;var Ve=R.memoizedProps;switch(pe[uh]=R,pe[Um]=Ve,A=(R.mode&1)!==0,Z){case"dialog":Ga("cancel",pe),Ga("close",pe);break;case"iframe":case"object":case"embed":Ga("load",pe);break;case"video":case"audio":for(Pe=0;Pe<Ap.length;Pe++)Ga(Ap[Pe],pe);break;case"source":Ga("error",pe);break;case"img":case"image":case"link":Ga("error",pe),Ga("load",pe);break;case"details":Ga("toggle",pe);break;case"input":nt(pe,Ve),Ga("invalid",pe);break;case"select":pe._wrapperState={wasMultiple:!!Ve.multiple},Ga("invalid",pe);break;case"textarea":cn(pe,Ve),Ga("invalid",pe)}At(Z,Ve),Pe=null;for(var Nt in Ve)if(Ve.hasOwnProperty(Nt)){var pn=Ve[Nt];Nt==="children"?typeof pn=="string"?pe.textContent!==pn&&(Ve.suppressHydrationWarning!==!0&&q2(pe.textContent,pn,A),Pe=["children",pn]):typeof pn=="number"&&pe.textContent!==""+pn&&(Ve.suppressHydrationWarning!==!0&&q2(pe.textContent,pn,A),Pe=["children",""+pn]):s.hasOwnProperty(Nt)&&pn!=null&&Nt==="onScroll"&&Ga("scroll",pe)}switch(Z){case"input":Qe(pe),ht(pe,Ve,!0);break;case"textarea":Qe(pe),Xt(pe);break;case"select":case"option":break;default:typeof Ve.onClick=="function"&&(pe.onclick=n6)}pe=Pe,R.updateQueue=pe,pe!==null&&(R.flags|=4)}else{Nt=Pe.nodeType===9?Pe:Pe.ownerDocument,A==="http://www.w3.org/1999/xhtml"&&(A=an(Z)),A==="http://www.w3.org/1999/xhtml"?Z==="script"?(A=Nt.createElement("div"),A.innerHTML="<script><\/script>",A=A.removeChild(A.firstChild)):typeof pe.is=="string"?A=Nt.createElement(Z,{is:pe.is}):(A=Nt.createElement(Z),Z==="select"&&(Nt=A,pe.multiple?Nt.multiple=!0:pe.size&&(Nt.size=pe.size))):A=Nt.createElementNS(A,Z),A[uh]=R,A[Um]=pe,Zl(A,R,!1,!1),R.stateNode=A;e:{switch(Nt=ze(Z,pe),Z){case"dialog":Ga("cancel",A),Ga("close",A),Pe=pe;break;case"iframe":case"object":case"embed":Ga("load",A),Pe=pe;break;case"video":case"audio":for(Pe=0;Pe<Ap.length;Pe++)Ga(Ap[Pe],A);Pe=pe;break;case"source":Ga("error",A),Pe=pe;break;case"img":case"image":case"link":Ga("error",A),Ga("load",A),Pe=pe;break;case"details":Ga("toggle",A),Pe=pe;break;case"input":nt(A,pe),Pe=tt(A,pe),Ga("invalid",A);break;case"option":Pe=pe;break;case"select":A._wrapperState={wasMultiple:!!pe.multiple},Pe=ee({},pe,{value:void 0}),Ga("invalid",A);break;case"textarea":cn(A,pe),Pe=nn(A,pe),Ga("invalid",A);break;default:Pe=pe}At(Z,Pe),pn=Pe;for(Ve in pn)if(pn.hasOwnProperty(Ve)){var _n=pn[Ve];Ve==="style"?ot(A,_n):Ve==="dangerouslySetInnerHTML"?(_n=_n?_n.__html:void 0,_n!=null&&Je(A,_n)):Ve==="children"?typeof _n=="string"?(Z!=="textarea"||_n!=="")&&It(A,_n):typeof _n=="number"&&It(A,""+_n):Ve!=="suppressContentEditableWarning"&&Ve!=="suppressHydrationWarning"&&Ve!=="autoFocus"&&(s.hasOwnProperty(Ve)?_n!=null&&Ve==="onScroll"&&Ga("scroll",A):_n!=null&&T(A,Ve,_n,Nt))}switch(Z){case"input":Qe(A),ht(A,pe,!1);break;case"textarea":Qe(A),Xt(A);break;case"option":pe.value!=null&&A.setAttribute("value",""+je(pe.value));break;case"select":A.multiple=!!pe.multiple,Ve=pe.value,Ve!=null?wt(A,!!pe.multiple,Ve,!1):pe.defaultValue!=null&&wt(A,!!pe.multiple,pe.defaultValue,!0);break;default:typeof Pe.onClick=="function"&&(A.onclick=n6)}switch(Z){case"button":case"input":case"select":case"textarea":pe=!!pe.autoFocus;break e;case"img":pe=!0;break e;default:pe=!1}}pe&&(R.flags|=4)}R.ref!==null&&(R.flags|=512,R.flags|=2097152)}return Jl(R),null;case 6:if(A&&R.stateNode!=null)y8(A,R,A.memoizedProps,pe);else{if(typeof pe!="string"&&R.stateNode===null)throw Error(n(166));if(Z=Pp(rb.current),Pp(gh.current),Q2(R)){if(pe=R.stateNode,Z=R.memoizedProps,pe[uh]=R,(Ve=pe.nodeValue!==Z)&&(A=vc,A!==null))switch(A.tag){case 3:q2(pe.nodeValue,Z,(A.mode&1)!==0);break;case 5:A.memoizedProps.suppressHydrationWarning!==!0&&q2(pe.nodeValue,Z,(A.mode&1)!==0)}Ve&&(R.flags|=4)}else pe=(Z.nodeType===9?Z:Z.ownerDocument).createTextNode(pe),pe[uh]=R,R.stateNode=pe}return Jl(R),null;case 13:if(Ka(so),pe=R.memoizedState,A===null||A.memoizedState!==null&&A.memoizedState.dehydrated!==null){if(Ya&&Ku!==null&&R.mode&1&&!(R.flags&128))qj(),mh(),R.flags|=98560,Ve=!1;else if(Ve=Q2(R),pe!==null&&pe.dehydrated!==null){if(A===null){if(!Ve)throw Error(n(318));if(Ve=R.memoizedState,Ve=Ve!==null?Ve.dehydrated:null,!Ve)throw Error(n(317));Ve[uh]=R}else mh(),!(R.flags&128)&&(R.memoizedState=null),R.flags|=4;Jl(R),Ve=!1}else Nf!==null&&(k8(Nf),Nf=null),Ve=!0;if(!Ve)return R.flags&65536?R:null}return R.flags&128?(R.lanes=Z,R):(pe=pe!==null,pe!==(A!==null&&A.memoizedState!==null)&&pe&&(R.child.flags|=8192,R.mode&1&&(A===null||so.current&1?pl===0&&(pl=3):I8())),R.updateQueue!==null&&(R.flags|=4),Jl(R),null);case 4:return qm(),b8(A,R),A===null&&Dm(R.stateNode.containerInfo),Jl(R),null;case 10:return f6(R.type._context),Jl(R),null;case 17:return mu(R.type)&&a6(),Jl(R),null;case 19:if(Ka(so),Ve=R.memoizedState,Ve===null)return Jl(R),null;if(pe=(R.flags&128)!==0,Nt=Ve.rendering,Nt===null)if(pe)hv(Ve,!1);else{if(pl!==0||A!==null&&A.flags&128)for(A=R.child;A!==null;){if(Nt=Ix(A),Nt!==null){for(R.flags|=128,hv(Ve,!1),pe=Nt.updateQueue,pe!==null&&(R.updateQueue=pe,R.flags|=4),R.subtreeFlags=0,pe=Z,Z=R.child;Z!==null;)Ve=Z,A=pe,Ve.flags&=14680066,Nt=Ve.alternate,Nt===null?(Ve.childLanes=0,Ve.lanes=A,Ve.child=null,Ve.subtreeFlags=0,Ve.memoizedProps=null,Ve.memoizedState=null,Ve.updateQueue=null,Ve.dependencies=null,Ve.stateNode=null):(Ve.childLanes=Nt.childLanes,Ve.lanes=Nt.lanes,Ve.child=Nt.child,Ve.subtreeFlags=0,Ve.deletions=null,Ve.memoizedProps=Nt.memoizedProps,Ve.memoizedState=Nt.memoizedState,Ve.updateQueue=Nt.updateQueue,Ve.type=Nt.type,A=Nt.dependencies,Ve.dependencies=A===null?null:{lanes:A.lanes,firstContext:A.firstContext}),Z=Z.sibling;return za(so,so.current&1|2),R.child}A=A.sibling}Ve.tail!==null&&Ee()>Lx&&(R.flags|=128,pe=!0,hv(Ve,!1),R.lanes=4194304)}else{if(!pe)if(A=Ix(Nt),A!==null){if(R.flags|=128,pe=!0,Z=A.updateQueue,Z!==null&&(R.updateQueue=Z,R.flags|=4),hv(Ve,!0),Ve.tail===null&&Ve.tailMode==="hidden"&&!Nt.alternate&&!Ya)return Jl(R),null}else 2*Ee()-Ve.renderingStartTime>Lx&&Z!==1073741824&&(R.flags|=128,pe=!0,hv(Ve,!1),R.lanes=4194304);Ve.isBackwards?(Nt.sibling=R.child,R.child=Nt):(Z=Ve.last,Z!==null?Z.sibling=Nt:R.child=Nt,Ve.last=Nt)}return Ve.tail!==null?(R=Ve.tail,Ve.rendering=R,Ve.tail=R.sibling,Ve.renderingStartTime=Ee(),R.sibling=null,Z=so.current,za(so,pe?Z&1|2:Z&1),R):(Jl(R),null);case 22:case 23:return P8(),pe=R.memoizedState!==null,A!==null&&A.memoizedState!==null!==pe&&(R.flags|=8192),pe&&R.mode&1?Qu&1073741824&&(Jl(R),R.subtreeFlags&6&&(R.flags|=8192)):Jl(R),null;case 24:return null;case 25:return null}throw Error(n(156,R.tag))}function $z(A,R){switch(kx(R),R.tag){case 1:return mu(R.type)&&a6(),A=R.flags,A&65536?(R.flags=A&-65537|128,R):null;case 3:return qm(),Ka(pu),Ka(bc),g6(),A=R.flags,A&65536&&!(A&128)?(R.flags=A&-65537|128,R):null;case 5:return x6(R),null;case 13:if(Ka(so),A=R.memoizedState,A!==null&&A.dehydrated!==null){if(R.alternate===null)throw Error(n(340));mh()}return A=R.flags,A&65536?(R.flags=A&-65537|128,R):null;case 19:return Ka(so),null;case 4:return qm(),null;case 10:return f6(R.type._context),null;case 22:case 23:return P8(),null;case 24:return null;default:return null}}var I6=!1,io=!1,Wc=typeof WeakSet=="function"?WeakSet:Set,vs=null;function fb(A,R){var Z=A.ref;if(Z!==null)if(typeof Z=="function")try{Z(null)}catch(pe){bo(A,R,pe)}else Z.current=null}function pv(A,R,Z){try{Z()}catch(pe){bo(A,R,pe)}}var $P=!1;function Uz(A,R){if(G2=sr,A=Ns(),Js(A)){if("selectionStart"in A)var Z={start:A.selectionStart,end:A.selectionEnd};else e:{Z=(Z=A.ownerDocument)&&Z.defaultView||window;var pe=Z.getSelection&&Z.getSelection();if(pe&&pe.rangeCount!==0){Z=pe.anchorNode;var Pe=pe.anchorOffset,Ve=pe.focusNode;pe=pe.focusOffset;try{Z.nodeType,Ve.nodeType}catch{Z=null;break e}var Nt=0,pn=-1,_n=-1,cr=0,zr=0,Wr=A,Ur=null;t:for(;;){for(var hs;Wr!==Z||Pe!==0&&Wr.nodeType!==3||(pn=Nt+Pe),Wr!==Ve||pe!==0&&Wr.nodeType!==3||(_n=Nt+pe),Wr.nodeType===3&&(Nt+=Wr.nodeValue.length),(hs=Wr.firstChild)!==null;)Ur=Wr,Wr=hs;for(;;){if(Wr===A)break t;if(Ur===Z&&++cr===Pe&&(pn=Nt),Ur===Ve&&++zr===pe&&(_n=Nt),(hs=Wr.nextSibling)!==null)break;Wr=Ur,Ur=Wr.parentNode}Wr=hs}Z=pn===-1||_n===-1?null:{start:pn,end:_n}}else Z=null}Z=Z||{start:0,end:0}}else Z=null;for(Ax={focusedElem:A,selectionRange:Z},sr=!1,vs=R;vs!==null;)if(R=vs,A=R.child,(R.subtreeFlags&1028)!==0&&A!==null)A.return=R,vs=A;else for(;vs!==null;){R=vs;try{var As=R.alternate;if(R.flags&1024)switch(R.tag){case 0:case 11:case 15:break;case 1:if(As!==null){var Is=As.memoizedProps,To=As.memoizedState,er=R.stateNode,Ln=er.getSnapshotBeforeUpdate(R.elementType===R.type?Is:Rd(R.type,Is),To);er.__reactInternalSnapshotBeforeUpdate=Ln}break;case 3:var ir=R.stateNode.containerInfo;ir.nodeType===1?ir.textContent="":ir.nodeType===9&&ir.documentElement&&ir.removeChild(ir.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Xr){bo(R,R.return,Xr)}if(A=R.sibling,A!==null){A.return=R.return,vs=A;break}vs=R.return}return As=$P,$P=!1,As}function Mp(A,R,Z){var pe=R.updateQueue;if(pe=pe!==null?pe.lastEffect:null,pe!==null){var Pe=pe=pe.next;do{if((Pe.tag&A)===A){var Ve=Pe.destroy;Pe.destroy=void 0,Ve!==void 0&&pv(R,Z,Ve)}Pe=Pe.next}while(Pe!==pe)}}function mv(A,R){if(R=R.updateQueue,R=R!==null?R.lastEffect:null,R!==null){var Z=R=R.next;do{if((Z.tag&A)===A){var pe=Z.create;Z.destroy=pe()}Z=Z.next}while(Z!==R)}}function F6(A){var R=A.ref;if(R!==null){var Z=A.stateNode;switch(A.tag){case 5:A=Z;break;default:A=Z}typeof R=="function"?R(A):R.current=A}}function UP(A){var R=A.alternate;R!==null&&(A.alternate=null,UP(R)),A.child=null,A.deletions=null,A.sibling=null,A.tag===5&&(R=A.stateNode,R!==null&&(delete R[uh],delete R[Um],delete R[s6],delete R[Ot],delete R[Q1])),A.stateNode=null,A.return=null,A.dependencies=null,A.memoizedProps=null,A.memoizedState=null,A.pendingProps=null,A.stateNode=null,A.updateQueue=null}function zP(A){return A.tag===5||A.tag===3||A.tag===4}function HP(A){e:for(;;){for(;A.sibling===null;){if(A.return===null||zP(A.return))return null;A=A.return}for(A.sibling.return=A.return,A=A.sibling;A.tag!==5&&A.tag!==6&&A.tag!==18;){if(A.flags&2||A.child===null||A.tag===4)continue e;A.child.return=A,A=A.child}if(!(A.flags&2))return A.stateNode}}function v8(A,R,Z){var pe=A.tag;if(pe===5||pe===6)A=A.stateNode,R?Z.nodeType===8?Z.parentNode.insertBefore(A,R):Z.insertBefore(A,R):(Z.nodeType===8?(R=Z.parentNode,R.insertBefore(A,Z)):(R=Z,R.appendChild(A)),Z=Z._reactRootContainer,Z!=null||R.onclick!==null||(R.onclick=n6));else if(pe!==4&&(A=A.child,A!==null))for(v8(A,R,Z),A=A.sibling;A!==null;)v8(A,R,Z),A=A.sibling}function O6(A,R,Z){var pe=A.tag;if(pe===5||pe===6)A=A.stateNode,R?Z.insertBefore(A,R):Z.appendChild(A);else if(pe!==4&&(A=A.child,A!==null))for(O6(A,R,Z),A=A.sibling;A!==null;)O6(A,R,Z),A=A.sibling}var Il=null,Ef=!1;function Ch(A,R,Z){for(Z=Z.child;Z!==null;)w8(A,R,Z),Z=Z.sibling}function w8(A,R,Z){if(G&&typeof G.onCommitFiberUnmount=="function")try{G.onCommitFiberUnmount(B,Z)}catch{}switch(Z.tag){case 5:io||fb(Z,R);case 6:var pe=Il,Pe=Ef;Il=null,Ch(A,R,Z),Il=pe,Ef=Pe,Il!==null&&(Ef?(A=Il,Z=Z.stateNode,A.nodeType===8?A.parentNode.removeChild(Z):A.removeChild(Z)):Il.removeChild(Z.stateNode));break;case 18:Il!==null&&(Ef?(A=Il,Z=Z.stateNode,A.nodeType===8?Hj(A.parentNode,Z):A.nodeType===1&&Hj(A,Z),gt(A)):Hj(Il,Z.stateNode));break;case 4:pe=Il,Pe=Ef,Il=Z.stateNode.containerInfo,Ef=!0,Ch(A,R,Z),Il=pe,Ef=Pe;break;case 0:case 11:case 14:case 15:if(!io&&(pe=Z.updateQueue,pe!==null&&(pe=pe.lastEffect,pe!==null))){Pe=pe=pe.next;do{var Ve=Pe,Nt=Ve.destroy;Ve=Ve.tag,Nt!==void 0&&(Ve&2||Ve&4)&&pv(Z,R,Nt),Pe=Pe.next}while(Pe!==pe)}Ch(A,R,Z);break;case 1:if(!io&&(fb(Z,R),pe=Z.stateNode,typeof pe.componentWillUnmount=="function"))try{pe.props=Z.memoizedProps,pe.state=Z.memoizedState,pe.componentWillUnmount()}catch(pn){bo(Z,R,pn)}Ch(A,R,Z);break;case 21:Ch(A,R,Z);break;case 22:Z.mode&1?(io=(pe=io)||Z.memoizedState!==null,Ch(A,R,Z),io=pe):Ch(A,R,Z);break;default:Ch(A,R,Z)}}function hb(A){var R=A.updateQueue;if(R!==null){A.updateQueue=null;var Z=A.stateNode;Z===null&&(Z=A.stateNode=new Wc),R.forEach(function(pe){var Pe=Kz.bind(null,A,pe);Z.has(pe)||(Z.add(pe),pe.then(Pe,Pe))})}}function Xu(A,R){var Z=R.deletions;if(Z!==null)for(var pe=0;pe<Z.length;pe++){var Pe=Z[pe];try{var Ve=A,Nt=R,pn=Nt;e:for(;pn!==null;){switch(pn.tag){case 5:Il=pn.stateNode,Ef=!1;break e;case 3:Il=pn.stateNode.containerInfo,Ef=!0;break e;case 4:Il=pn.stateNode.containerInfo,Ef=!0;break e}pn=pn.return}if(Il===null)throw Error(n(160));w8(Ve,Nt,Pe),Il=null,Ef=!1;var _n=Pe.alternate;_n!==null&&(_n.return=null),Pe.return=null}catch(cr){bo(Pe,R,cr)}}if(R.subtreeFlags&12854)for(R=R.child;R!==null;)C8(R,A),R=R.sibling}function C8(A,R){var Z=A.alternate,pe=A.flags;switch(A.tag){case 0:case 11:case 14:case 15:if(Xu(R,A),_f(A),pe&4){try{Mp(3,A,A.return),mv(3,A)}catch(Is){bo(A,A.return,Is)}try{Mp(5,A,A.return)}catch(Is){bo(A,A.return,Is)}}break;case 1:Xu(R,A),_f(A),pe&512&&Z!==null&&fb(Z,Z.return);break;case 5:if(Xu(R,A),_f(A),pe&512&&Z!==null&&fb(Z,Z.return),A.flags&32){var Pe=A.stateNode;try{It(Pe,"")}catch(Is){bo(A,A.return,Is)}}if(pe&4&&(Pe=A.stateNode,Pe!=null)){var Ve=A.memoizedProps,Nt=Z!==null?Z.memoizedProps:Ve,pn=A.type,_n=A.updateQueue;if(A.updateQueue=null,_n!==null)try{pn==="input"&&Ve.type==="radio"&&Ve.name!=null&&Le(Pe,Ve),ze(pn,Nt);var cr=ze(pn,Ve);for(Nt=0;Nt<_n.length;Nt+=2){var zr=_n[Nt],Wr=_n[Nt+1];zr==="style"?ot(Pe,Wr):zr==="dangerouslySetInnerHTML"?Je(Pe,Wr):zr==="children"?It(Pe,Wr):T(Pe,zr,Wr,cr)}switch(pn){case"input":Be(Pe,Ve);break;case"textarea":Un(Pe,Ve);break;case"select":var Ur=Pe._wrapperState.wasMultiple;Pe._wrapperState.wasMultiple=!!Ve.multiple;var hs=Ve.value;hs!=null?wt(Pe,!!Ve.multiple,hs,!1):Ur!==!!Ve.multiple&&(Ve.defaultValue!=null?wt(Pe,!!Ve.multiple,Ve.defaultValue,!0):wt(Pe,!!Ve.multiple,Ve.multiple?[]:"",!1))}Pe[Um]=Ve}catch(Is){bo(A,A.return,Is)}}break;case 6:if(Xu(R,A),_f(A),pe&4){if(A.stateNode===null)throw Error(n(162));Pe=A.stateNode,Ve=A.memoizedProps;try{Pe.nodeValue=Ve}catch(Is){bo(A,A.return,Is)}}break;case 3:if(Xu(R,A),_f(A),pe&4&&Z!==null&&Z.memoizedState.isDehydrated)try{gt(R.containerInfo)}catch(Is){bo(A,A.return,Is)}break;case 4:Xu(R,A),_f(A);break;case 13:Xu(R,A),_f(A),Pe=A.child,Pe.flags&8192&&(Ve=Pe.memoizedState!==null,Pe.stateNode.isHidden=Ve,!Ve||Pe.alternate!==null&&Pe.alternate.memoizedState!==null||(A8=Ee())),pe&4&&hb(A);break;case 22:if(zr=Z!==null&&Z.memoizedState!==null,A.mode&1?(io=(cr=io)||zr,Xu(R,A),io=cr):Xu(R,A),_f(A),pe&8192){if(cr=A.memoizedState!==null,(A.stateNode.isHidden=cr)&&!zr&&A.mode&1)for(vs=A,zr=A.child;zr!==null;){for(Wr=vs=zr;vs!==null;){switch(Ur=vs,hs=Ur.child,Ur.tag){case 0:case 11:case 14:case 15:Mp(4,Ur,Ur.return);break;case 1:fb(Ur,Ur.return);var As=Ur.stateNode;if(typeof As.componentWillUnmount=="function"){pe=Ur,Z=Ur.return;try{R=pe,As.props=R.memoizedProps,As.state=R.memoizedState,As.componentWillUnmount()}catch(Is){bo(pe,Z,Is)}}break;case 5:fb(Ur,Ur.return);break;case 22:if(Ur.memoizedState!==null){Ym(Wr);continue}}hs!==null?(hs.return=Ur,vs=hs):Ym(Wr)}zr=zr.sibling}e:for(zr=null,Wr=A;;){if(Wr.tag===5){if(zr===null){zr=Wr;try{Pe=Wr.stateNode,cr?(Ve=Pe.style,typeof Ve.setProperty=="function"?Ve.setProperty("display","none","important"):Ve.display="none"):(pn=Wr.stateNode,_n=Wr.memoizedProps.style,Nt=_n!=null&&_n.hasOwnProperty("display")?_n.display:null,pn.style.display=Rt("display",Nt))}catch(Is){bo(A,A.return,Is)}}}else if(Wr.tag===6){if(zr===null)try{Wr.stateNode.nodeValue=cr?"":Wr.memoizedProps}catch(Is){bo(A,A.return,Is)}}else if((Wr.tag!==22&&Wr.tag!==23||Wr.memoizedState===null||Wr===A)&&Wr.child!==null){Wr.child.return=Wr,Wr=Wr.child;continue}if(Wr===A)break e;for(;Wr.sibling===null;){if(Wr.return===null||Wr.return===A)break e;zr===Wr&&(zr=null),Wr=Wr.return}zr===Wr&&(zr=null),Wr.sibling.return=Wr.return,Wr=Wr.sibling}}break;case 19:Xu(R,A),_f(A),pe&4&&hb(A);break;case 21:break;default:Xu(R,A),_f(A)}}function _f(A){var R=A.flags;if(R&2){try{e:{for(var Z=A.return;Z!==null;){if(zP(Z)){var pe=Z;break e}Z=Z.return}throw Error(n(160))}switch(pe.tag){case 5:var Pe=pe.stateNode;pe.flags&32&&(It(Pe,""),pe.flags&=-33);var Ve=HP(A);O6(A,Ve,Pe);break;case 3:case 4:var Nt=pe.stateNode.containerInfo,pn=HP(A);v8(A,pn,Nt);break;default:throw Error(n(161))}}catch(_n){bo(A,A.return,_n)}A.flags&=-3}R&4096&&(A.flags&=-4097)}function M6(A,R,Z){vs=A,S8(A)}function S8(A,R,Z){for(var pe=(A.mode&1)!==0;vs!==null;){var Pe=vs,Ve=Pe.child;if(Pe.tag===22&&pe){var Nt=Pe.memoizedState!==null||I6;if(!Nt){var pn=Pe.alternate,_n=pn!==null&&pn.memoizedState!==null||io;pn=I6;var cr=io;if(I6=Nt,(io=_n)&&!cr)for(vs=Pe;vs!==null;)Nt=vs,_n=Nt.child,Nt.tag===22&&Nt.memoizedState!==null?VP(Pe):_n!==null?(_n.return=Nt,vs=_n):VP(Pe);for(;Ve!==null;)vs=Ve,S8(Ve),Ve=Ve.sibling;vs=Pe,I6=pn,io=cr}kf(A)}else Pe.subtreeFlags&8772&&Ve!==null?(Ve.return=Pe,vs=Ve):kf(A)}}function kf(A){for(;vs!==null;){var R=vs;if(R.flags&8772){var Z=R.alternate;try{if(R.flags&8772)switch(R.tag){case 0:case 11:case 15:io||mv(5,R);break;case 1:var pe=R.stateNode;if(R.flags&4&&!io)if(Z===null)pe.componentDidMount();else{var Pe=R.elementType===R.type?Z.memoizedProps:Rd(R.type,Z.memoizedProps);pe.componentDidUpdate(Pe,Z.memoizedState,pe.__reactInternalSnapshotBeforeUpdate)}var Ve=R.updateQueue;Ve!==null&&Yj(R,Ve,pe);break;case 3:var Nt=R.updateQueue;if(Nt!==null){if(Z=null,R.child!==null)switch(R.child.tag){case 5:Z=R.child.stateNode;break;case 1:Z=R.child.stateNode}Yj(R,Nt,Z)}break;case 5:var pn=R.stateNode;if(Z===null&&R.flags&4){Z=pn;var _n=R.memoizedProps;switch(R.type){case"button":case"input":case"select":case"textarea":_n.autoFocus&&Z.focus();break;case"img":_n.src&&(Z.src=_n.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(R.memoizedState===null){var cr=R.alternate;if(cr!==null){var zr=cr.memoizedState;if(zr!==null){var Wr=zr.dehydrated;Wr!==null&>(Wr)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}io||R.flags&512&&F6(R)}catch(Ur){bo(R,R.return,Ur)}}if(R===A){vs=null;break}if(Z=R.sibling,Z!==null){Z.return=R.return,vs=Z;break}vs=R.return}}function Ym(A){for(;vs!==null;){var R=vs;if(R===A){vs=null;break}var Z=R.sibling;if(Z!==null){Z.return=R.return,vs=Z;break}vs=R.return}}function VP(A){for(;vs!==null;){var R=vs;try{switch(R.tag){case 0:case 11:case 15:var Z=R.return;try{mv(4,R)}catch(_n){bo(R,Z,_n)}break;case 1:var pe=R.stateNode;if(typeof pe.componentDidMount=="function"){var Pe=R.return;try{pe.componentDidMount()}catch(_n){bo(R,Pe,_n)}}var Ve=R.return;try{F6(R)}catch(_n){bo(R,Ve,_n)}break;case 5:var Nt=R.return;try{F6(R)}catch(_n){bo(R,Nt,_n)}}}catch(_n){bo(R,R.return,_n)}if(R===A){vs=null;break}var pn=R.sibling;if(pn!==null){pn.return=R.return,vs=pn;break}vs=R.return}}var WP=Math.ceil,R6=M.ReactCurrentDispatcher,N8=M.ReactCurrentOwner,Ld=M.ReactCurrentBatchConfig,Qi=0,Fl=null,Zo=null,ec=0,Qu=0,pb=hu(0),pl=0,xv=null,Xm=0,gv=0,L6=0,bv=null,bu=null,A8=0,Lx=1/0,Rp=null,D6=!1,j8=null,Qm=null,B6=!1,Zm=null,qc=0,yv=0,E8=null,$6=-1,vv=0;function Gc(){return Qi&6?Ee():$6!==-1?$6:$6=Ee()}function Jm(A){return A.mode&1?Qi&2&&ec!==0?ec&-ec:NP.transition!==null?(vv===0&&(vv=$e()),vv):(A=yt,A!==0||(A=window.event,A=A===void 0?16:ss(A.type)),A):1}function Tf(A,R,Z,pe){if(50<yv)throw yv=0,E8=null,Error(n(185));_e(A,Z,pe),(!(Qi&2)||A!==Fl)&&(A===Fl&&(!(Qi&2)&&(gv|=Z),pl===4&&e0(A,ec)),yu(A,pe),Z===1&&Qi===0&&!(R.mode&1)&&(Lx=Ee()+500,o6&&Hm()))}function yu(A,R){var Z=A.callbackNode;ie(A,R);var pe=Fe(A,A===Fl?ec:0);if(pe===0)Z!==null&&Zn(Z),A.callbackNode=null,A.callbackPriority=0;else if(R=pe&-pe,A.callbackPriority!==R){if(Z!=null&&Zn(Z),R===1)A.tag===0?jx(qP.bind(null,A)):wP(qP.bind(null,A)),r6(function(){!(Qi&6)&&Hm()}),Z=null;else{switch(Mt(pe)){case 1:Z=p;break;case 4:Z=S;break;case 16:Z=_;break;case 536870912:Z=I;break;default:Z=_}Z=JP(Z,U6.bind(null,A))}A.callbackPriority=R,A.callbackNode=Z}}function U6(A,R){if($6=-1,vv=0,Qi&6)throw Error(n(327));var Z=A.callbackNode;if(mb()&&A.callbackNode!==Z)return null;var pe=Fe(A,A===Fl?ec:0);if(pe===0)return null;if(pe&30||pe&A.expiredLanes||R)R=z6(A,pe);else{R=pe;var Pe=Qi;Qi|=2;var Ve=KP();(Fl!==A||ec!==R)&&(Rp=null,Lx=Ee()+500,Bx(A,R));do try{Vz();break}catch(pn){GP(A,pn)}while(!0);_p(),R6.current=Ve,Qi=Pe,Zo!==null?R=0:(Fl=null,ec=0,R=pl)}if(R!==0){if(R===2&&(Pe=Se(A),Pe!==0&&(pe=Pe,R=_8(A,Pe))),R===1)throw Z=xv,Bx(A,0),e0(A,pe),yu(A,Ee()),Z;if(R===6)e0(A,pe);else{if(Pe=A.current.alternate,!(pe&30)&&!zz(Pe)&&(R=z6(A,pe),R===2&&(Ve=Se(A),Ve!==0&&(pe=Ve,R=_8(A,Ve))),R===1))throw Z=xv,Bx(A,0),e0(A,pe),yu(A,Ee()),Z;switch(A.finishedWork=Pe,A.finishedLanes=pe,R){case 0:case 1:throw Error(n(345));case 2:$x(A,bu,Rp);break;case 3:if(e0(A,pe),(pe&130023424)===pe&&(R=A8+500-Ee(),10<R)){if(Fe(A,0)!==0)break;if(Pe=A.suspendedLanes,(Pe&pe)!==pe){Gc(),A.pingedLanes|=A.suspendedLanes&Pe;break}A.timeoutHandle=Bm($x.bind(null,A,bu,Rp),R);break}$x(A,bu,Rp);break;case 4:if(e0(A,pe),(pe&4194240)===pe)break;for(R=A.eventTimes,Pe=-1;0<pe;){var Nt=31-ce(pe);Ve=1<<Nt,Nt=R[Nt],Nt>Pe&&(Pe=Nt),pe&=~Ve}if(pe=Pe,pe=Ee()-pe,pe=(120>pe?120:480>pe?480:1080>pe?1080:1920>pe?1920:3e3>pe?3e3:4320>pe?4320:1960*WP(pe/1960))-pe,10<pe){A.timeoutHandle=Bm($x.bind(null,A,bu,Rp),pe);break}$x(A,bu,Rp);break;case 5:$x(A,bu,Rp);break;default:throw Error(n(329))}}}return yu(A,Ee()),A.callbackNode===Z?U6.bind(null,A):null}function _8(A,R){var Z=bv;return A.current.memoizedState.isDehydrated&&(Bx(A,R).flags|=256),A=z6(A,R),A!==2&&(R=bu,bu=Z,R!==null&&k8(R)),A}function k8(A){bu===null?bu=A:bu.push.apply(bu,A)}function zz(A){for(var R=A;;){if(R.flags&16384){var Z=R.updateQueue;if(Z!==null&&(Z=Z.stores,Z!==null))for(var pe=0;pe<Z.length;pe++){var Pe=Z[pe],Ve=Pe.getSnapshot;Pe=Pe.value;try{if(!Ht(Ve(),Pe))return!1}catch{return!1}}}if(Z=R.child,R.subtreeFlags&16384&&Z!==null)Z.return=R,R=Z;else{if(R===A)break;for(;R.sibling===null;){if(R.return===null||R.return===A)return!0;R=R.return}R.sibling.return=R.return,R=R.sibling}}return!0}function e0(A,R){for(R&=~L6,R&=~gv,A.suspendedLanes|=R,A.pingedLanes&=~R,A=A.expirationTimes;0<R;){var Z=31-ce(R),pe=1<<Z;A[Z]=-1,R&=~pe}}function qP(A){if(Qi&6)throw Error(n(327));mb();var R=Fe(A,0);if(!(R&1))return yu(A,Ee()),null;var Z=z6(A,R);if(A.tag!==0&&Z===2){var pe=Se(A);pe!==0&&(R=pe,Z=_8(A,pe))}if(Z===1)throw Z=xv,Bx(A,0),e0(A,R),yu(A,Ee()),Z;if(Z===6)throw Error(n(345));return A.finishedWork=A.current.alternate,A.finishedLanes=R,$x(A,bu,Rp),yu(A,Ee()),null}function T8(A,R){var Z=Qi;Qi|=1;try{return A(R)}finally{Qi=Z,Qi===0&&(Lx=Ee()+500,o6&&Hm())}}function Dx(A){Zm!==null&&Zm.tag===0&&!(Qi&6)&&mb();var R=Qi;Qi|=1;var Z=Ld.transition,pe=yt;try{if(Ld.transition=null,yt=1,A)return A()}finally{yt=pe,Ld.transition=Z,Qi=R,!(Qi&6)&&Hm()}}function P8(){Qu=pb.current,Ka(pb)}function Bx(A,R){A.finishedWork=null,A.finishedLanes=0;var Z=A.timeoutHandle;if(Z!==-1&&(A.timeoutHandle=-1,Y2(Z)),Zo!==null)for(Z=Zo.return;Z!==null;){var pe=Z;switch(kx(pe),pe.tag){case 1:pe=pe.type.childContextTypes,pe!=null&&a6();break;case 3:qm(),Ka(pu),Ka(bc),g6();break;case 5:x6(pe);break;case 4:qm();break;case 13:Ka(so);break;case 19:Ka(so);break;case 10:f6(pe.type._context);break;case 22:case 23:P8()}Z=Z.return}if(Fl=A,Zo=A=Pf(A.current,null),ec=Qu=R,pl=0,xv=null,L6=gv=Xm=0,bu=bv=null,Px!==null){for(R=0;R<Px.length;R++)if(Z=Px[R],pe=Z.interleaved,pe!==null){Z.interleaved=null;var Pe=pe.next,Ve=Z.pending;if(Ve!==null){var Nt=Ve.next;Ve.next=Pe,pe.next=Nt}Z.pending=pe}Px=null}return A}function GP(A,R){do{var Z=Zo;try{if(_p(),nv.current=S6,sb){for(var pe=go.memoizedState;pe!==null;){var Pe=pe.queue;Pe!==null&&(Pe.pending=null),pe=pe.next}sb=!1}if(Gm=0,hl=Uo=go=null,rv=!1,Fx=0,N8.current=null,Z===null||Z.return===null){pl=1,xv=R,Zo=null;break}e:{var Ve=A,Nt=Z.return,pn=Z,_n=R;if(R=ec,pn.flags|=32768,_n!==null&&typeof _n=="object"&&typeof _n.then=="function"){var cr=_n,zr=pn,Wr=zr.tag;if(!(zr.mode&1)&&(Wr===0||Wr===11||Wr===15)){var Ur=zr.alternate;Ur?(zr.updateQueue=Ur.updateQueue,zr.memoizedState=Ur.memoizedState,zr.lanes=Ur.lanes):(zr.updateQueue=null,zr.memoizedState=null)}var hs=MP(Nt);if(hs!==null){hs.flags&=-257,d8(hs,Nt,pn,Ve,R),hs.mode&1&&lv(Ve,cr,R),R=hs,_n=cr;var As=R.updateQueue;if(As===null){var Is=new Set;Is.add(_n),R.updateQueue=Is}else As.add(_n);break e}else{if(!(R&1)){lv(Ve,cr,R),I8();break e}_n=Error(n(426))}}else if(Ya&&pn.mode&1){var To=MP(Nt);if(To!==null){!(To.flags&65536)&&(To.flags|=256),d8(To,Nt,pn,Ve,R),xh(Rx(_n,pn));break e}}Ve=_n=Rx(_n,pn),pl!==4&&(pl=2),bv===null?bv=[Ve]:bv.push(Ve),Ve=Nt;do{switch(Ve.tag){case 3:Ve.flags|=65536,R&=-R,Ve.lanes|=R;var er=ov(Ve,_n,R);EP(Ve,er);break e;case 1:pn=_n;var Ln=Ve.type,ir=Ve.stateNode;if(!(Ve.flags&128)&&(typeof Ln.getDerivedStateFromError=="function"||ir!==null&&typeof ir.componentDidCatch=="function"&&(Qm===null||!Qm.has(ir)))){Ve.flags|=65536,R&=-R,Ve.lanes|=R;var Xr=_6(Ve,pn,R);EP(Ve,Xr);break e}}Ve=Ve.return}while(Ve!==null)}XP(Z)}catch(Fs){R=Fs,Zo===Z&&Z!==null&&(Zo=Z=Z.return);continue}break}while(!0)}function KP(){var A=R6.current;return R6.current=S6,A===null?S6:A}function I8(){(pl===0||pl===3||pl===2)&&(pl=4),Fl===null||!(Xm&268435455)&&!(gv&268435455)||e0(Fl,ec)}function z6(A,R){var Z=Qi;Qi|=2;var pe=KP();(Fl!==A||ec!==R)&&(Rp=null,Bx(A,R));do try{Hz();break}catch(Pe){GP(A,Pe)}while(!0);if(_p(),Qi=Z,R6.current=pe,Zo!==null)throw Error(n(261));return Fl=null,ec=0,pl}function Hz(){for(;Zo!==null;)YP(Zo)}function Vz(){for(;Zo!==null&&!Ft();)YP(Zo)}function YP(A){var R=ZP(A.alternate,A,Qu);A.memoizedProps=A.pendingProps,R===null?XP(A):Zo=R,N8.current=null}function XP(A){var R=A;do{var Z=R.alternate;if(A=R.return,R.flags&32768){if(Z=$z(Z,R),Z!==null){Z.flags&=32767,Zo=Z;return}if(A!==null)A.flags|=32768,A.subtreeFlags=0,A.deletions=null;else{pl=6,Zo=null;return}}else if(Z=Bz(Z,R,Qu),Z!==null){Zo=Z;return}if(R=R.sibling,R!==null){Zo=R;return}Zo=R=A}while(R!==null);pl===0&&(pl=5)}function $x(A,R,Z){var pe=yt,Pe=Ld.transition;try{Ld.transition=null,yt=1,Wz(A,R,Z,pe)}finally{Ld.transition=Pe,yt=pe}return null}function Wz(A,R,Z,pe){do mb();while(Zm!==null);if(Qi&6)throw Error(n(327));Z=A.finishedWork;var Pe=A.finishedLanes;if(Z===null)return null;if(A.finishedWork=null,A.finishedLanes=0,Z===A.current)throw Error(n(177));A.callbackNode=null,A.callbackPriority=0;var Ve=Z.lanes|Z.childLanes;if(st(A,Ve),A===Fl&&(Zo=Fl=null,ec=0),!(Z.subtreeFlags&2064)&&!(Z.flags&2064)||B6||(B6=!0,JP(_,function(){return mb(),null})),Ve=(Z.flags&15990)!==0,Z.subtreeFlags&15990||Ve){Ve=Ld.transition,Ld.transition=null;var Nt=yt;yt=1;var pn=Qi;Qi|=4,N8.current=null,Uz(A,Z),C8(Z,A),mc(Ax),sr=!!G2,Ax=G2=null,A.current=Z,M6(Z),En(),Qi=pn,yt=Nt,Ld.transition=Ve}else A.current=Z;if(B6&&(B6=!1,Zm=A,qc=Pe),Ve=A.pendingLanes,Ve===0&&(Qm=null),re(Z.stateNode),yu(A,Ee()),R!==null)for(pe=A.onRecoverableError,Z=0;Z<R.length;Z++)Pe=R[Z],pe(Pe.value,{componentStack:Pe.stack,digest:Pe.digest});if(D6)throw D6=!1,A=j8,j8=null,A;return qc&1&&A.tag!==0&&mb(),Ve=A.pendingLanes,Ve&1?A===E8?yv++:(yv=0,E8=A):yv=0,Hm(),null}function mb(){if(Zm!==null){var A=Mt(qc),R=Ld.transition,Z=yt;try{if(Ld.transition=null,yt=16>A?16:A,Zm===null)var pe=!1;else{if(A=Zm,Zm=null,qc=0,Qi&6)throw Error(n(331));var Pe=Qi;for(Qi|=4,vs=A.current;vs!==null;){var Ve=vs,Nt=Ve.child;if(vs.flags&16){var pn=Ve.deletions;if(pn!==null){for(var _n=0;_n<pn.length;_n++){var cr=pn[_n];for(vs=cr;vs!==null;){var zr=vs;switch(zr.tag){case 0:case 11:case 15:Mp(8,zr,Ve)}var Wr=zr.child;if(Wr!==null)Wr.return=zr,vs=Wr;else for(;vs!==null;){zr=vs;var Ur=zr.sibling,hs=zr.return;if(UP(zr),zr===cr){vs=null;break}if(Ur!==null){Ur.return=hs,vs=Ur;break}vs=hs}}}var As=Ve.alternate;if(As!==null){var Is=As.child;if(Is!==null){As.child=null;do{var To=Is.sibling;Is.sibling=null,Is=To}while(Is!==null)}}vs=Ve}}if(Ve.subtreeFlags&2064&&Nt!==null)Nt.return=Ve,vs=Nt;else e:for(;vs!==null;){if(Ve=vs,Ve.flags&2048)switch(Ve.tag){case 0:case 11:case 15:Mp(9,Ve,Ve.return)}var er=Ve.sibling;if(er!==null){er.return=Ve.return,vs=er;break e}vs=Ve.return}}var Ln=A.current;for(vs=Ln;vs!==null;){Nt=vs;var ir=Nt.child;if(Nt.subtreeFlags&2064&&ir!==null)ir.return=Nt,vs=ir;else e:for(Nt=Ln;vs!==null;){if(pn=vs,pn.flags&2048)try{switch(pn.tag){case 0:case 11:case 15:mv(9,pn)}}catch(Fs){bo(pn,pn.return,Fs)}if(pn===Nt){vs=null;break e}var Xr=pn.sibling;if(Xr!==null){Xr.return=pn.return,vs=Xr;break e}vs=pn.return}}if(Qi=Pe,Hm(),G&&typeof G.onPostCommitFiberRoot=="function")try{G.onPostCommitFiberRoot(B,A)}catch{}pe=!0}return pe}finally{yt=Z,Ld.transition=R}}return!1}function H6(A,R,Z){R=Rx(Z,R),R=ov(A,R,1),A=Od(A,R,1),R=Gc(),A!==null&&(_e(A,1,R),yu(A,R))}function bo(A,R,Z){if(A.tag===3)H6(A,A,Z);else for(;R!==null;){if(R.tag===3){H6(R,A,Z);break}else if(R.tag===1){var pe=R.stateNode;if(typeof R.type.getDerivedStateFromError=="function"||typeof pe.componentDidCatch=="function"&&(Qm===null||!Qm.has(pe))){A=Rx(Z,A),A=_6(R,A,1),R=Od(R,A,1),A=Gc(),R!==null&&(_e(R,1,A),yu(R,A));break}}R=R.return}}function qz(A,R,Z){var pe=A.pingCache;pe!==null&&pe.delete(R),R=Gc(),A.pingedLanes|=A.suspendedLanes&Z,Fl===A&&(ec&Z)===Z&&(pl===4||pl===3&&(ec&130023424)===ec&&500>Ee()-A8?Bx(A,0):L6|=Z),yu(A,R)}function QP(A,R){R===0&&(A.mode&1?(R=Me,Me<<=1,!(Me&130023424)&&(Me=4194304)):R=1);var Z=Gc();A=kp(A,R),A!==null&&(_e(A,R,Z),yu(A,Z))}function Gz(A){var R=A.memoizedState,Z=0;R!==null&&(Z=R.retryLane),QP(A,Z)}function Kz(A,R){var Z=0;switch(A.tag){case 13:var pe=A.stateNode,Pe=A.memoizedState;Pe!==null&&(Z=Pe.retryLane);break;case 19:pe=A.stateNode;break;default:throw Error(n(314))}pe!==null&&pe.delete(R),QP(A,Z)}var ZP;ZP=function(A,R,Z){if(A!==null)if(A.memoizedProps!==R.pendingProps||pu.current)Vc=!0;else{if(!(A.lanes&Z)&&!(R.flags&128))return Vc=!1,DP(A,R,Z);Vc=!!(A.flags&131072)}else Vc=!1,Ya&&R.flags&1048576&&CP(R,c6,R.index);switch(R.lanes=0,R.tag){case 2:var pe=R.type;P6(A,R),A=R.pendingProps;var Pe=J1(R,bc.current);Wm(R,Z),Pe=Ox(null,R,pe,A,Pe,Z);var Ve=b6();return R.flags|=1,typeof Pe=="object"&&Pe!==null&&typeof Pe.render=="function"&&Pe.$$typeof===void 0?(R.tag=1,R.memoizedState=null,R.updateQueue=null,mu(pe)?(Ve=!0,kd(R)):Ve=!1,R.memoizedState=Pe.state!==null&&Pe.state!==void 0?Pe.state:null,p6(R),Pe.updater=j6,R.stateNode=Pe,Pe._reactInternals=R,u8(R,pe,A,Z),R=g8(null,R,pe,!0,Ve,Z)):(R.tag=0,Ya&&Ve&&X2(R),Ql(null,R,Pe,Z),R=R.child),R;case 16:pe=R.elementType;e:{switch(P6(A,R),A=R.pendingProps,Pe=pe._init,pe=Pe(pe._payload),R.type=pe,Pe=R.tag=Xz(pe),A=Rd(pe,A),Pe){case 0:R=m8(null,R,pe,A,Z);break e;case 1:R=x8(null,R,pe,A,Z);break e;case 11:R=RP(null,R,pe,A,Z);break e;case 14:R=f8(null,R,pe,Rd(pe.type,A),Z);break e}throw Error(n(306,pe,""))}return R;case 0:return pe=R.type,Pe=R.pendingProps,Pe=R.elementType===pe?Pe:Rd(pe,Pe),m8(A,R,pe,Pe,Z);case 1:return pe=R.type,Pe=R.pendingProps,Pe=R.elementType===pe?Pe:Rd(pe,Pe),x8(A,R,pe,Pe,Z);case 3:e:{if(LP(R),A===null)throw Error(n(387));pe=R.pendingProps,Ve=R.memoizedState,Pe=Ve.element,jP(A,R),nb(R,pe,null,Z);var Nt=R.memoizedState;if(pe=Nt.element,Ve.isDehydrated)if(Ve={element:pe,isDehydrated:!1,cache:Nt.cache,pendingSuspenseBoundaries:Nt.pendingSuspenseBoundaries,transitions:Nt.transitions},R.updateQueue.baseState=Ve,R.memoizedState=Ve,R.flags&256){Pe=Rx(Error(n(423)),R),R=wh(A,R,pe,Z,Pe);break e}else if(pe!==Pe){Pe=Rx(Error(n(424)),R),R=wh(A,R,pe,Z,Pe);break e}else for(Ku=$m(R.stateNode.containerInfo.firstChild),vc=R,Ya=!0,Nf=null,Z=d6(R,null,pe,Z),R.child=Z;Z;)Z.flags=Z.flags&-3|4096,Z=Z.sibling;else{if(mh(),pe===Pe){R=jf(A,R,Z);break e}Ql(A,R,pe,Z)}R=R.child}return R;case 5:return Qj(R),A===null&&xu(R),pe=R.type,Pe=R.pendingProps,Ve=A!==null?A.memoizedProps:null,Nt=Pe.children,K2(pe,Pe)?Nt=null:Ve!==null&&K2(pe,Ve)&&(R.flags|=32),p8(A,R),Ql(A,R,Nt,Z),R.child;case 6:return A===null&&xu(R),null;case 13:return T6(A,R,Z);case 4:return Xj(R,R.stateNode.containerInfo),pe=R.pendingProps,A===null?R.child=ko(R,null,pe,Z):Ql(A,R,pe,Z),R.child;case 11:return pe=R.type,Pe=R.pendingProps,Pe=R.elementType===pe?Pe:Rd(pe,Pe),RP(A,R,pe,Pe,Z);case 7:return Ql(A,R,R.pendingProps,Z),R.child;case 8:return Ql(A,R,R.pendingProps.children,Z),R.child;case 12:return Ql(A,R,R.pendingProps.children,Z),R.child;case 10:e:{if(pe=R.type._context,Pe=R.pendingProps,Ve=R.memoizedProps,Nt=Pe.value,za(J2,pe._currentValue),pe._currentValue=Nt,Ve!==null)if(Ht(Ve.value,Nt)){if(Ve.children===Pe.children&&!pu.current){R=jf(A,R,Z);break e}}else for(Ve=R.child,Ve!==null&&(Ve.return=R);Ve!==null;){var pn=Ve.dependencies;if(pn!==null){Nt=Ve.child;for(var _n=pn.firstContext;_n!==null;){if(_n.context===pe){if(Ve.tag===1){_n=Tp(-1,Z&-Z),_n.tag=2;var cr=Ve.updateQueue;if(cr!==null){cr=cr.shared;var zr=cr.pending;zr===null?_n.next=_n:(_n.next=zr.next,zr.next=_n),cr.pending=_n}}Ve.lanes|=Z,_n=Ve.alternate,_n!==null&&(_n.lanes|=Z),Xl(Ve.return,Z,R),pn.lanes|=Z;break}_n=_n.next}}else if(Ve.tag===10)Nt=Ve.type===R.type?null:Ve.child;else if(Ve.tag===18){if(Nt=Ve.return,Nt===null)throw Error(n(341));Nt.lanes|=Z,pn=Nt.alternate,pn!==null&&(pn.lanes|=Z),Xl(Nt,Z,R),Nt=Ve.sibling}else Nt=Ve.child;if(Nt!==null)Nt.return=Ve;else for(Nt=Ve;Nt!==null;){if(Nt===R){Nt=null;break}if(Ve=Nt.sibling,Ve!==null){Ve.return=Nt.return,Nt=Ve;break}Nt=Nt.return}Ve=Nt}Ql(A,R,Pe.children,Z),R=R.child}return R;case 9:return Pe=R.type,pe=R.pendingProps.children,Wm(R,Z),Pe=Id(Pe),pe=pe(Pe),R.flags|=1,Ql(A,R,pe,Z),R.child;case 14:return pe=R.type,Pe=Rd(pe,R.pendingProps),Pe=Rd(pe.type,Pe),f8(A,R,pe,Pe,Z);case 15:return vh(A,R,R.type,R.pendingProps,Z);case 17:return pe=R.type,Pe=R.pendingProps,Pe=R.elementType===pe?Pe:Rd(pe,Pe),P6(A,R),R.tag=1,mu(pe)?(A=!0,kd(R)):A=!1,Wm(R,Z),Mx(R,pe,Pe),u8(R,pe,Pe,Z),g8(null,R,pe,!0,A,Z);case 19:return Km(A,R,Z);case 22:return h8(A,R,Z)}throw Error(n(156,R.tag))};function JP(A,R){return zn(A,R)}function Yz(A,R,Z,pe){this.tag=A,this.key=Z,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=R,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=pe,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dd(A,R,Z,pe){return new Yz(A,R,Z,pe)}function V6(A){return A=A.prototype,!(!A||!A.isReactComponent)}function Xz(A){if(typeof A=="function")return V6(A)?1:0;if(A!=null){if(A=A.$$typeof,A===K)return 11;if(A===q)return 14}return 2}function Pf(A,R){var Z=A.alternate;return Z===null?(Z=Dd(A.tag,R,A.key,A.mode),Z.elementType=A.elementType,Z.type=A.type,Z.stateNode=A.stateNode,Z.alternate=A,A.alternate=Z):(Z.pendingProps=R,Z.type=A.type,Z.flags=0,Z.subtreeFlags=0,Z.deletions=null),Z.flags=A.flags&14680064,Z.childLanes=A.childLanes,Z.lanes=A.lanes,Z.child=A.child,Z.memoizedProps=A.memoizedProps,Z.memoizedState=A.memoizedState,Z.updateQueue=A.updateQueue,R=A.dependencies,Z.dependencies=R===null?null:{lanes:R.lanes,firstContext:R.firstContext},Z.sibling=A.sibling,Z.index=A.index,Z.ref=A.ref,Z}function W6(A,R,Z,pe,Pe,Ve){var Nt=2;if(pe=A,typeof A=="function")V6(A)&&(Nt=1);else if(typeof A=="string")Nt=5;else e:switch(A){case L:return Ux(Z.children,Pe,Ve,R);case z:Nt=8,Pe|=8;break;case X:return A=Dd(12,Z,R,Pe|2),A.elementType=X,A.lanes=Ve,A;case te:return A=Dd(13,Z,R,Pe),A.elementType=te,A.lanes=Ve,A;case fe:return A=Dd(19,Z,R,Pe),A.elementType=fe,A.lanes=Ve,A;case ae:return q6(Z,Pe,Ve,R);default:if(typeof A=="object"&&A!==null)switch(A.$$typeof){case ne:Nt=10;break e;case J:Nt=9;break e;case K:Nt=11;break e;case q:Nt=14;break e;case se:Nt=16,pe=null;break e}throw Error(n(130,A==null?A:typeof A,""))}return R=Dd(Nt,Z,R,Pe),R.elementType=A,R.type=pe,R.lanes=Ve,R}function Ux(A,R,Z,pe){return A=Dd(7,A,pe,R),A.lanes=Z,A}function q6(A,R,Z,pe){return A=Dd(22,A,pe,R),A.elementType=ae,A.lanes=Z,A.stateNode={isHidden:!1},A}function F8(A,R,Z){return A=Dd(6,A,null,R),A.lanes=Z,A}function O8(A,R,Z){return R=Dd(4,A.children!==null?A.children:[],A.key,R),R.lanes=Z,R.stateNode={containerInfo:A.containerInfo,pendingChildren:null,implementation:A.implementation},R}function Qz(A,R,Z,pe,Pe){this.tag=R,this.containerInfo=A,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ue(0),this.expirationTimes=Ue(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.identifierPrefix=pe,this.onRecoverableError=Pe,this.mutableSourceEagerHydrationData=null}function M8(A,R,Z,pe,Pe,Ve,Nt,pn,_n){return A=new Qz(A,R,Z,pn,_n),R===1?(R=1,Ve===!0&&(R|=8)):R=0,Ve=Dd(3,null,null,R),A.current=Ve,Ve.stateNode=A,Ve.memoizedState={element:pe,isDehydrated:Z,cache:null,transitions:null,pendingSuspenseBoundaries:null},p6(Ve),A}function Zz(A,R,Z){var pe=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:pe==null?null:""+pe,children:A,containerInfo:R,implementation:Z}}function eI(A){if(!A)return zm;A=A._reactInternals;e:{if(en(A)!==A||A.tag!==1)throw Error(n(170));var R=A;do{switch(R.tag){case 3:R=R.stateNode.context;break e;case 1:if(mu(R.type)){R=R.stateNode.__reactInternalMemoizedMergedChildContext;break e}}R=R.return}while(R!==null);throw Error(n(171))}if(A.tag===1){var Z=A.type;if(mu(Z))return yP(A,Z,R)}return R}function tI(A,R,Z,pe,Pe,Ve,Nt,pn,_n){return A=M8(Z,pe,!0,A,Pe,Ve,Nt,pn,_n),A.context=eI(null),Z=A.current,pe=Gc(),Pe=Jm(Z),Ve=Tp(pe,Pe),Ve.callback=R??null,Od(Z,Ve,Pe),A.current.lanes=Pe,_e(A,Pe,pe),yu(A,pe),A}function G6(A,R,Z,pe){var Pe=R.current,Ve=Gc(),Nt=Jm(Pe);return Z=eI(Z),R.context===null?R.context=Z:R.pendingContext=Z,R=Tp(Ve,Nt),R.payload={element:A},pe=pe===void 0?null:pe,pe!==null&&(R.callback=pe),A=Od(Pe,R,Nt),A!==null&&(Tf(A,Pe,Nt,Ve),m6(A,Pe,Nt)),Nt}function K6(A){if(A=A.current,!A.child)return null;switch(A.child.tag){case 5:return A.child.stateNode;default:return A.child.stateNode}}function nI(A,R){if(A=A.memoizedState,A!==null&&A.dehydrated!==null){var Z=A.retryLane;A.retryLane=Z!==0&&Z<R?Z:R}}function R8(A,R){nI(A,R),(A=A.alternate)&&nI(A,R)}var rI=typeof reportError=="function"?reportError:function(A){console.error(A)};function L8(A){this._internalRoot=A}wv.prototype.render=L8.prototype.render=function(A){var R=this._internalRoot;if(R===null)throw Error(n(409));G6(A,R,null,null)},wv.prototype.unmount=L8.prototype.unmount=function(){var A=this._internalRoot;if(A!==null){this._internalRoot=null;var R=A.containerInfo;Dx(function(){G6(null,A,null,null)}),R[Gu]=null}};function wv(A){this._internalRoot=A}wv.prototype.unstable_scheduleHydration=function(A){if(A){var R=Pt();A={blockedOn:null,target:A,priority:R};for(var Z=0;Z<Sr.length&&R!==0&&R<Sr[Z].priority;Z++);Sr.splice(Z,0,A),Z===0&&Mn(A)}};function Y6(A){return!(!A||A.nodeType!==1&&A.nodeType!==9&&A.nodeType!==11)}function X6(A){return!(!A||A.nodeType!==1&&A.nodeType!==9&&A.nodeType!==11&&(A.nodeType!==8||A.nodeValue!==" react-mount-point-unstable "))}function sI(){}function Jz(A,R,Z,pe,Pe){if(Pe){if(typeof pe=="function"){var Ve=pe;pe=function(){var cr=K6(Nt);Ve.call(cr)}}var Nt=tI(R,pe,A,0,null,!1,!1,"",sI);return A._reactRootContainer=Nt,A[Gu]=Nt.current,Dm(A.nodeType===8?A.parentNode:A),Dx(),Nt}for(;Pe=A.lastChild;)A.removeChild(Pe);if(typeof pe=="function"){var pn=pe;pe=function(){var cr=K6(_n);pn.call(cr)}}var _n=M8(A,0,!1,null,null,!1,!1,"",sI);return A._reactRootContainer=_n,A[Gu]=_n.current,Dm(A.nodeType===8?A.parentNode:A),Dx(function(){G6(R,_n,Z,pe)}),_n}function Q6(A,R,Z,pe,Pe){var Ve=Z._reactRootContainer;if(Ve){var Nt=Ve;if(typeof Pe=="function"){var pn=Pe;Pe=function(){var _n=K6(Nt);pn.call(_n)}}G6(R,Nt,A,Pe)}else Nt=Jz(Z,R,A,Pe,pe);return K6(Nt)}Kt=function(A){switch(A.tag){case 3:var R=A.stateNode;if(R.current.memoizedState.isDehydrated){var Z=qe(R.pendingLanes);Z!==0&&(ut(R,Z|1),yu(R,Ee()),!(Qi&6)&&(Lx=Ee()+500,Hm()))}break;case 13:Dx(function(){var pe=kp(A,1);if(pe!==null){var Pe=Gc();Tf(pe,A,1,Pe)}}),R8(A,1)}},un=function(A){if(A.tag===13){var R=kp(A,134217728);if(R!==null){var Z=Gc();Tf(R,A,134217728,Z)}R8(A,134217728)}},Xe=function(A){if(A.tag===13){var R=Jm(A),Z=kp(A,R);if(Z!==null){var pe=Gc();Tf(Z,A,R,pe)}R8(A,R)}},Pt=function(){return yt},Wt=function(A,R){var Z=yt;try{return yt=A,R()}finally{yt=Z}},Lt=function(A,R,Z){switch(R){case"input":if(Be(A,Z),R=Z.name,Z.type==="radio"&&R!=null){for(Z=A;Z.parentNode;)Z=Z.parentNode;for(Z=Z.querySelectorAll("input[name="+JSON.stringify(""+R)+'][type="radio"]'),R=0;R<Z.length;R++){var pe=Z[R];if(pe!==A&&pe.form===A.form){var Pe=i6(pe);if(!Pe)throw Error(n(90));Ke(pe),Be(pe,Pe)}}}break;case"textarea":Un(A,Z);break;case"select":R=Z.value,R!=null&&wt(A,!!Z.multiple,R,!1)}},kn=T8,yn=Dx;var Z6={usingClientEntryPoint:!1,Events:[gc,Ni,i6,gn,An,T8]},Cv={findFiberByHostInstance:dh,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},eH={bundleType:Cv.bundleType,version:Cv.version,rendererPackageName:Cv.rendererPackageName,rendererConfig:Cv.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:M.ReactCurrentDispatcher,findHostInstanceByFiber:function(A){return A=hr(A),A===null?null:A.stateNode},findFiberByHostInstance:Cv.findFiberByHostInstance,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var J6=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!J6.isDisabled&&J6.supportsFiber)try{B=J6.inject(eH),G=J6}catch{}}return zd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z6,zd.createPortal=function(A,R){var Z=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Y6(R))throw Error(n(200));return Zz(A,R,null,Z)},zd.createRoot=function(A,R){if(!Y6(A))throw Error(n(299));var Z=!1,pe="",Pe=rI;return R!=null&&(R.unstable_strictMode===!0&&(Z=!0),R.identifierPrefix!==void 0&&(pe=R.identifierPrefix),R.onRecoverableError!==void 0&&(Pe=R.onRecoverableError)),R=M8(A,1,!1,null,null,Z,!1,pe,Pe),A[Gu]=R.current,Dm(A.nodeType===8?A.parentNode:A),new L8(R)},zd.findDOMNode=function(A){if(A==null)return null;if(A.nodeType===1)return A;var R=A._reactInternals;if(R===void 0)throw typeof A.render=="function"?Error(n(188)):(A=Object.keys(A).join(","),Error(n(268,A)));return A=hr(R),A=A===null?null:A.stateNode,A},zd.flushSync=function(A){return Dx(A)},zd.hydrate=function(A,R,Z){if(!X6(R))throw Error(n(200));return Q6(null,A,R,!0,Z)},zd.hydrateRoot=function(A,R,Z){if(!Y6(A))throw Error(n(405));var pe=Z!=null&&Z.hydratedSources||null,Pe=!1,Ve="",Nt=rI;if(Z!=null&&(Z.unstable_strictMode===!0&&(Pe=!0),Z.identifierPrefix!==void 0&&(Ve=Z.identifierPrefix),Z.onRecoverableError!==void 0&&(Nt=Z.onRecoverableError)),R=tI(R,null,A,1,Z??null,Pe,!1,Ve,Nt),A[Gu]=R.current,Dm(A),pe)for(A=0;A<pe.length;A++)Z=pe[A],Pe=Z._getVersion,Pe=Pe(Z._source),R.mutableSourceEagerHydrationData==null?R.mutableSourceEagerHydrationData=[Z,Pe]:R.mutableSourceEagerHydrationData.push(Z,Pe);return new wv(R)},zd.render=function(A,R,Z){if(!X6(R))throw Error(n(200));return Q6(null,A,R,!1,Z)},zd.unmountComponentAtNode=function(A){if(!X6(A))throw Error(n(40));return A._reactRootContainer?(Dx(function(){Q6(null,null,A,!1,function(){A._reactRootContainer=null,A[Gu]=null})}),!0):!1},zd.unstable_batchedUpdates=T8,zd.unstable_renderSubtreeIntoContainer=function(A,R,Z,pe){if(!X6(Z))throw Error(n(200));if(A==null||A._reactInternals===void 0)throw Error(n(38));return Q6(A,R,Z,!1,pe)},zd.version="18.3.1-next-f1338f8080-20240426",zd}var rhe;function b8e(){if(rhe)return xH.exports;rhe=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),xH.exports=sQe(),xH.exports}var she;function iQe(){if(she)return lI;she=1;var t=b8e();return lI.createRoot=t.createRoot,lI.hydrateRoot=t.hydrateRoot,lI}var y8e=iQe(),m=xx();const Ne=Ii(m),Wy=g8e({__proto__:null,default:Ne},[m]);var Aa=b8e();const Kse=Ii(Aa);/**
* @remix-run/router v1.19.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function tE(){return tE=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tE.apply(this,arguments)}var Sy;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Sy||(Sy={}));const ihe="popstate";function aQe(t){t===void 0&&(t={});function e(r,s){let{pathname:a,search:o,hash:l}=r.location;return kZ("",{pathname:a,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:TM(s)}return lQe(e,n,null,t)}function Ko(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function v8e(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function oQe(){return Math.random().toString(36).substr(2,8)}function ahe(t,e){return{usr:t.state,key:t.key,idx:e}}function kZ(t,e,n,r){return n===void 0&&(n=null),tE({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?EA(e):e,{state:n,key:e&&e.key||r||oQe()})}function TM(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function EA(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function lQe(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,l=Sy.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(tE({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Sy.Pop;let C=d(),N=C==null?null:C-u;u=C,c&&c({action:l,location:v.location,delta:N})}function x(C,N){l=Sy.Push;let P=kZ(v.location,C,N);u=d()+1;let T=ahe(P,u),M=v.createHref(P);try{o.pushState(T,"",M)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;s.location.assign(M)}a&&c&&c({action:l,location:v.location,delta:1})}function g(C,N){l=Sy.Replace;let P=kZ(v.location,C,N);u=d();let T=ahe(P,u),M=v.createHref(P);o.replaceState(T,"",M),a&&c&&c({action:l,location:v.location,delta:0})}function y(C){let N=s.location.origin!=="null"?s.location.origin:s.location.href,P=typeof C=="string"?C:TM(C);return P=P.replace(/ $/,"%20"),Ko(N,"No window.location.(origin|href) available to create URL for href: "+P),new URL(P,N)}let v={get action(){return l},get location(){return t(s,o)},listen(C){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(ihe,f),c=C,()=>{s.removeEventListener(ihe,f),c=null}},createHref(C){return e(s,C)},createURL:y,encodeLocation(C){let N=y(C);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:x,replace:g,go(C){return o.go(C)}};return v}var ohe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(ohe||(ohe={}));function cQe(t,e,n){return n===void 0&&(n="/"),uQe(t,e,n)}function uQe(t,e,n,r){let s=typeof e=="string"?EA(e):e,a=qS(s.pathname||"/",n);if(a==null)return null;let o=w8e(t);dQe(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=CQe(a);l=vQe(o[c],u)}return l}function w8e(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Ko(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Oy([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(Ko(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),w8e(a.children,e,d,u)),!(a.path==null&&!a.index)&&e.push({path:u,score:bQe(u,a.index),routesMeta:d})};return t.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of C8e(a.path))s(a,o,c)}),e}function C8e(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=C8e(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),s&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function dQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:yQe(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const fQe=/^:[\w-]+$/,hQe=3,pQe=2,mQe=1,xQe=10,gQe=-2,lhe=t=>t==="*";function bQe(t,e){let n=t.split("/"),r=n.length;return n.some(lhe)&&(r+=gQe),e&&(r+=pQe),n.filter(s=>!lhe(s)).reduce((s,a)=>s+(fQe.test(a)?hQe:a===""?mQe:xQe),r)}function yQe(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function vQe(t,e,n){let{routesMeta:r}=t,s={},a="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,d=a==="/"?e:e.slice(a.length)||"/",f=TZ({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),x=c.route;if(!f)return null;Object.assign(s,f.params),o.push({params:s,pathname:Oy([a,f.pathname]),pathnameBase:jQe(Oy([a,f.pathnameBase])),route:x}),f.pathnameBase!=="/"&&(a=Oy([a,f.pathnameBase]))}return o}function TZ(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=wQe(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let a=s[0],o=a.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:x,isOptional:g}=d;if(x==="*"){let v=l[f]||"";o=a.slice(0,a.length-v.length).replace(/(.)\/+$/,"$1")}const y=l[f];return g&&!y?u[x]=void 0:u[x]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:t}}function wQe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),v8e(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function CQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return v8e(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function qS(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function SQe(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?EA(t):t;return{pathname:n?n.startsWith("/")?n:NQe(n,e):e,search:EQe(r),hash:_Qe(s)}}function NQe(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function yH(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function AQe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Yse(t,e){let n=AQe(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Xse(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=EA(t):(s=tE({},t),Ko(!s.pathname||!s.pathname.includes("?"),yH("?","pathname","search",s)),Ko(!s.pathname||!s.pathname.includes("#"),yH("#","pathname","hash",s)),Ko(!s.search||!s.search.includes("#"),yH("#","search","hash",s)));let a=t===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=n;else{let f=e.length-1;if(!r&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),f-=1;s.pathname=x.join("/")}l=f>=0?e[f]:"/"}let c=SQe(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Oy=t=>t.join("/").replace(/\/\/+/g,"/"),jQe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),EQe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,_Qe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function kQe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const S8e=["post","put","patch","delete"];new Set(S8e);const TQe=["get",...S8e];new Set(TQe);/**
* React Router v6.26.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function nE(){return nE=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},nE.apply(this,arguments)}const gB=m.createContext(null),N8e=m.createContext(null),P1=m.createContext(null),bB=m.createContext(null),gx=m.createContext({outlet:null,matches:[],isDataRoute:!1}),A8e=m.createContext(null);function PQe(t,e){let{relative:n}=e===void 0?{}:e;_A()||Ko(!1);let{basename:r,navigator:s}=m.useContext(P1),{hash:a,pathname:o,search:l}=yB(t,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:Oy([r,o])),s.createHref({pathname:c,search:l,hash:a})}function _A(){return m.useContext(bB)!=null}function Kl(){return _A()||Ko(!1),m.useContext(bB).location}function j8e(t){m.useContext(P1).static||m.useLayoutEffect(t)}function jo(){let{isDataRoute:t}=m.useContext(gx);return t?qQe():IQe()}function IQe(){_A()||Ko(!1);let t=m.useContext(gB),{basename:e,future:n,navigator:r}=m.useContext(P1),{matches:s}=m.useContext(gx),{pathname:a}=Kl(),o=JSON.stringify(Yse(s,n.v7_relativeSplatPath)),l=m.useRef(!1);return j8e(()=>{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=Xse(u,JSON.parse(o),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Oy([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,o,a,t])}const FQe=m.createContext(null);function OQe(t){let e=m.useContext(gx).outlet;return e&&m.createElement(FQe.Provider,{value:t},e)}function g2(){let{matches:t}=m.useContext(gx),e=t[t.length-1];return e?e.params:{}}function yB(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=m.useContext(P1),{matches:s}=m.useContext(gx),{pathname:a}=Kl(),o=JSON.stringify(Yse(s,r.v7_relativeSplatPath));return m.useMemo(()=>Xse(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function MQe(t,e){return RQe(t,e)}function RQe(t,e,n,r){_A()||Ko(!1);let{navigator:s}=m.useContext(P1),{matches:a}=m.useContext(gx),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Kl(),d;if(e){var f;let C=typeof e=="string"?EA(e):e;c==="/"||(f=C.pathname)!=null&&f.startsWith(c)||Ko(!1),d=C}else d=u;let x=d.pathname||"/",g=x;if(c!=="/"){let C=c.replace(/^\//,"").split("/");g="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let y=cQe(t,{pathname:g}),v=UQe(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:Oy([c,s.encodeLocation?s.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:Oy([c,s.encodeLocation?s.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),a,n,r);return e&&v?m.createElement(bB.Provider,{value:{location:nE({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Sy.Pop}},v):v}function LQe(){let t=WQe(),e=kQe(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},e),n?m.createElement("pre",{style:s},n):null,null)}const DQe=m.createElement(LQe,null);class BQe extends m.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?m.createElement(gx.Provider,{value:this.props.routeContext},m.createElement(A8e.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $Qe(t){let{routeContext:e,match:n,children:r}=t,s=m.useContext(gB);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(gx.Provider,{value:e},r)}function UQe(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Ko(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:x,errors:g}=n,y=f.route.loader&&x[f.route.id]===void 0&&(!g||g[f.route.id]===void 0);if(f.route.lazy||y){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,x)=>{let g,y=!1,v=null,C=null;n&&(g=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||DQe,c&&(u<0&&x===0?(y=!0,C=null):u===x&&(y=!0,C=f.route.hydrateFallbackElement||null)));let N=e.concat(o.slice(0,x+1)),P=()=>{let T;return g?T=v:y?T=C:f.route.Component?T=m.createElement(f.route.Component,null):f.route.element?T=f.route.element:T=d,m.createElement($Qe,{match:f,routeContext:{outlet:d,matches:N,isDataRoute:n!=null},children:T})};return n&&(f.route.ErrorBoundary||f.route.errorElement||x===0)?m.createElement(BQe,{location:n.location,revalidation:n.revalidation,component:v,error:g,children:P(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):P()},null)}var E8e=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(E8e||{}),PM=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(PM||{});function zQe(t){let e=m.useContext(gB);return e||Ko(!1),e}function HQe(t){let e=m.useContext(N8e);return e||Ko(!1),e}function VQe(t){let e=m.useContext(gx);return e||Ko(!1),e}function _8e(t){let e=VQe(),n=e.matches[e.matches.length-1];return n.route.id||Ko(!1),n.route.id}function WQe(){var t;let e=m.useContext(A8e),n=HQe(PM.UseRouteError),r=_8e(PM.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function qQe(){let{router:t}=zQe(E8e.UseNavigateStable),e=_8e(PM.UseNavigateStable),n=m.useRef(!1);return j8e(()=>{n.current=!0}),m.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,nE({fromRouteId:e},a)))},[t,e])}function che(t){let{to:e,replace:n,state:r,relative:s}=t;_A()||Ko(!1);let{future:a,static:o}=m.useContext(P1),{matches:l}=m.useContext(gx),{pathname:c}=Kl(),u=jo(),d=Xse(e,Yse(l,a.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function GQe(t){return OQe(t.context)}function pa(t){Ko(!1)}function KQe(t){let{basename:e="/",children:n=null,location:r,navigationType:s=Sy.Pop,navigator:a,static:o=!1,future:l}=t;_A()&&Ko(!1);let c=e.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:a,static:o,future:nE({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=EA(r));let{pathname:d="/",search:f="",hash:x="",state:g=null,key:y="default"}=r,v=m.useMemo(()=>{let C=qS(d,c);return C==null?null:{location:{pathname:C,search:f,hash:x,state:g,key:y},navigationType:s}},[c,d,f,x,g,y,s]);return v==null?null:m.createElement(P1.Provider,{value:u},m.createElement(bB.Provider,{children:n,value:v}))}function YQe(t){let{children:e,location:n}=t;return MQe(PZ(e),n)}new Promise(()=>{});function PZ(t,e){e===void 0&&(e=[]);let n=[];return m.Children.forEach(t,(r,s)=>{if(!m.isValidElement(r))return;let a=[...e,s];if(r.type===m.Fragment){n.push.apply(n,PZ(r.props.children,a));return}r.type!==pa&&Ko(!1),!r.props.index||!r.props.children||Ko(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=PZ(r.props.children,a)),n.push(o)}),n}/**
* React Router DOM v6.26.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function IM(){return IM=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},IM.apply(this,arguments)}function k8e(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,a;for(a=0;a<r.length;a++)s=r[a],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function XQe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function QQe(t,e){return t.button===0&&(!e||e==="_self")&&!XQe(t)}function IZ(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function ZQe(t,e){let n=IZ(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const JQe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],eZe=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],tZe="6";try{window.__reactRouterVersion=tZe}catch{}const nZe=m.createContext({isTransitioning:!1}),rZe="startTransition",uhe=Wy[rZe];function sZe(t){let{basename:e,children:n,future:r,window:s}=t,a=m.useRef();a.current==null&&(a.current=aQe({window:s,v5Compat:!0}));let o=a.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=m.useCallback(f=>{u&&uhe?uhe(()=>c(f)):c(f)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.createElement(KQe,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const iZe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aZe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ho=m.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:f}=e,x=k8e(e,JQe),{basename:g}=m.useContext(P1),y,v=!1;if(typeof u=="string"&&aZe.test(u)&&(y=u,iZe))try{let T=new URL(window.location.href),M=u.startsWith("//")?new URL(T.protocol+u):new URL(u),F=qS(M.pathname,g);M.origin===T.origin&&F!=null?u=F+M.search+M.hash:v=!0}catch{}let C=PQe(u,{relative:s}),N=lZe(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,unstable_viewTransition:f});function P(T){r&&r(T),T.defaultPrevented||N(T)}return m.createElement("a",IM({},x,{href:y||C,onClick:v||a?r:P,ref:n,target:c}))}),dhe=m.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:s=!1,className:a="",end:o=!1,style:l,to:c,unstable_viewTransition:u,children:d}=e,f=k8e(e,eZe),x=yB(c,{relative:f.relative}),g=Kl(),y=m.useContext(N8e),{navigator:v,basename:C}=m.useContext(P1),N=y!=null&&cZe(x)&&u===!0,P=v.encodeLocation?v.encodeLocation(x).pathname:x.pathname,T=g.pathname,M=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;s||(T=T.toLowerCase(),M=M?M.toLowerCase():null,P=P.toLowerCase()),M&&C&&(M=qS(M,C)||M);const F=P!=="/"&&P.endsWith("/")?P.length-1:P.length;let $=T===P||!o&&T.startsWith(P)&&T.charAt(F)==="/",L=M!=null&&(M===P||!o&&M.startsWith(P)&&M.charAt(P.length)==="/"),z={isActive:$,isPending:L,isTransitioning:N},X=$?r:void 0,ne;typeof a=="function"?ne=a(z):ne=[a,$?"active":null,L?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let J=typeof l=="function"?l(z):l;return m.createElement(Ho,IM({},f,{"aria-current":X,className:ne,ref:n,style:J,to:c,unstable_viewTransition:u}),typeof d=="function"?d(z):d)});var FZ;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(FZ||(FZ={}));var fhe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(fhe||(fhe={}));function oZe(t){let e=m.useContext(gB);return e||Ko(!1),e}function lZe(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,unstable_viewTransition:l}=e===void 0?{}:e,c=jo(),u=Kl(),d=yB(t,{relative:o});return m.useCallback(f=>{if(QQe(f,n)){f.preventDefault();let x=r!==void 0?r:TM(u)===TM(d);c(t,{replace:x,state:s,preventScrollReset:a,relative:o,unstable_viewTransition:l})}},[u,c,d,r,s,n,t,a,o,l])}function T8e(t){let e=m.useRef(IZ(t)),n=m.useRef(!1),r=Kl(),s=m.useMemo(()=>ZQe(r.search,n.current?null:e.current),[r.search]),a=jo(),o=m.useCallback((l,c)=>{const u=IZ(typeof l=="function"?l(s):l);n.current=!0,a("?"+u,c)},[a,s]);return[s,o]}function cZe(t,e){e===void 0&&(e={});let n=m.useContext(nZe);n==null&&Ko(!1);let{basename:r}=oZe(FZ.useViewTransitionState),s=yB(t,{relative:e.relative});if(!n.isTransitioning)return!1;let a=qS(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=qS(n.nextLocation.pathname,r)||n.nextLocation.pathname;return TZ(s.pathname,o)!=null||TZ(s.pathname,a)!=null}let uZe={data:""},dZe=t=>typeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||uZe,fZe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,hZe=/\/\*[^]*?\*\/| +/g,hhe=/\n+/g,Wb=(t,e)=>{let n="",r="",s="";for(let a in t){let o=t[a];a[0]=="@"?a[1]=="i"?n=a+" "+o+";":r+=a[1]=="f"?Wb(o,a):a+"{"+Wb(o,a[1]=="k"?"":e)+"}":typeof o=="object"?r+=Wb(o,e?e.replace(/([^,])+/g,l=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,l):l?l+" "+c:c)):a):o!=null&&(a=/^--/.test(a)?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Wb.p?Wb.p(a,o):a+":"+o+";")}return n+(e&&s?e+"{"+s+"}":s)+r},Wx={},P8e=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+P8e(t[n]);return e}return t},pZe=(t,e,n,r,s)=>{let a=P8e(t),o=Wx[a]||(Wx[a]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Wx[o]){let c=a!==t?t:(u=>{let d,f,x=[{}];for(;d=fZe.exec(u.replace(hZe,""));)d[4]?x.shift():d[3]?(f=d[3].replace(hhe," ").trim(),x.unshift(x[0][f]=x[0][f]||{})):x[0][d[1]]=d[2].replace(hhe," ").trim();return x[0]})(t);Wx[o]=Wb(s?{["@keyframes "+o]:c}:c,n?"":"."+o)}let l=n&&Wx.g?Wx.g:null;return n&&(Wx.g=Wx[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(Wx[o],e,r,l),o},mZe=(t,e,n)=>t.reduce((r,s,a)=>{let o=e[a];if(o&&o.call){let l=o(n),c=l&&l.props&&l.props.className||/^go/.test(l)&&l;o=c?"."+c:l&&typeof l=="object"?l.props?"":Wb(l,""):l===!1?"":l}return r+s+(o??"")},"");function vB(t){let e=this||{},n=t.call?t(e.p):t;return pZe(n.unshift?n.raw?mZe(n,[].slice.call(arguments,1),e.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(e.p):s),{}):n,dZe(e.target),e.g,e.o,e.k)}let I8e,OZ,MZ;vB.bind({g:1});let f1=vB.bind({k:1});function xZe(t,e,n,r){Wb.p=e,I8e=t,OZ=n,MZ=r}function b2(t,e){let n=this||{};return function(){let r=arguments;function s(a,o){let l=Object.assign({},a),c=l.className||s.className;n.p=Object.assign({theme:OZ&&OZ()},l),n.o=/ *go\d+/.test(c),l.className=vB.apply(n,r)+(c?" "+c:"");let u=t;return t[0]&&(u=l.as||t,delete l.as),MZ&&u[0]&&MZ(l),I8e(u,l)}return s}}var gZe=t=>typeof t=="function",FM=(t,e)=>gZe(t)?t(e):t,bZe=(()=>{let t=0;return()=>(++t).toString()})(),F8e=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),yZe=20,yO=new Map,vZe=1e3,phe=t=>{if(yO.has(t))return;let e=setTimeout(()=>{yO.delete(t),w5({type:4,toastId:t})},vZe);yO.set(t,e)},wZe=t=>{let e=yO.get(t);e&&clearTimeout(e)},RZ=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,yZe)};case 1:return e.toast.id&&wZe(e.toast.id),{...t,toasts:t.toasts.map(a=>a.id===e.toast.id?{...a,...e.toast}:a)};case 2:let{toast:n}=e;return t.toasts.find(a=>a.id===n.id)?RZ(t,{type:1,toast:n}):RZ(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?phe(r):t.toasts.forEach(a=>{phe(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===r||r===void 0?{...a,visible:!1}:a)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let s=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+s}))}}},vO=[],wO={toasts:[],pausedAt:void 0},w5=t=>{wO=RZ(wO,t),vO.forEach(e=>{e(wO)})},CZe={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},SZe=(t={})=>{let[e,n]=m.useState(wO);m.useEffect(()=>(vO.push(n),()=>{let s=vO.indexOf(n);s>-1&&vO.splice(s,1)}),[e]);let r=e.toasts.map(s=>{var a,o;return{...t,...t[s.type],...s,duration:s.duration||((a=t[s.type])==null?void 0:a.duration)||(t==null?void 0:t.duration)||CZe[s.type],style:{...t.style,...(o=t[s.type])==null?void 0:o.style,...s.style}}});return{...e,toasts:r}},NZe=(t,e="blank",n)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:(n==null?void 0:n.id)||bZe()}),Zk=t=>(e,n)=>{let r=NZe(e,t,n);return w5({type:2,toast:r}),r.id},Yf=(t,e)=>Zk("blank")(t,e);Yf.error=Zk("error");Yf.success=Zk("success");Yf.loading=Zk("loading");Yf.custom=Zk("custom");Yf.dismiss=t=>{w5({type:3,toastId:t})};Yf.remove=t=>w5({type:4,toastId:t});Yf.promise=(t,e,n)=>{let r=Yf.loading(e.loading,{...n,...n==null?void 0:n.loading});return t.then(s=>(Yf.success(FM(e.success,s),{id:r,...n,...n==null?void 0:n.success}),s)).catch(s=>{Yf.error(FM(e.error,s),{id:r,...n,...n==null?void 0:n.error})}),t};var AZe=(t,e)=>{w5({type:1,toast:{id:t,height:e}})},jZe=()=>{w5({type:5,time:Date.now()})},EZe=t=>{let{toasts:e,pausedAt:n}=SZe(t);m.useEffect(()=>{if(n)return;let a=Date.now(),o=e.map(l=>{if(l.duration===1/0)return;let c=(l.duration||0)+l.pauseDuration-(a-l.createdAt);if(c<0){l.visible&&Yf.dismiss(l.id);return}return setTimeout(()=>Yf.dismiss(l.id),c)});return()=>{o.forEach(l=>l&&clearTimeout(l))}},[e,n]);let r=m.useCallback(()=>{n&&w5({type:6,time:Date.now()})},[n]),s=m.useCallback((a,o)=>{let{reverseOrder:l=!1,gutter:c=8,defaultPosition:u}=o||{},d=e.filter(g=>(g.position||u)===(a.position||u)&&g.height),f=d.findIndex(g=>g.id===a.id),x=d.filter((g,y)=>y<f&&g.visible).length;return d.filter(g=>g.visible).slice(...l?[x+1]:[0,x]).reduce((g,y)=>g+(y.height||0)+c,0)},[e]);return{toasts:e,handlers:{updateHeight:AZe,startPause:jZe,endPause:r,calculateOffset:s}}},_Ze=f1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,kZe=f1`
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}`,TZe=f1`
from {
transform: scale(0) rotate(90deg);
opacity: 0;
}
to {
transform: scale(1) rotate(90deg);
opacity: 1;
}`,PZe=b2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#ff4b4b"};
position: relative;
transform: rotate(45deg);
animation: ${_Ze} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after,
&:before {
content: '';
animation: ${kZe} 0.15s ease-out forwards;
animation-delay: 150ms;
position: absolute;
border-radius: 3px;
opacity: 0;
background: ${t=>t.secondary||"#fff"};
bottom: 9px;
left: 4px;
height: 2px;
width: 12px;
}
&:before {
animation: ${TZe} 0.15s ease-out forwards;
animation-delay: 180ms;
transform: rotate(90deg);
}
`,IZe=f1`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`,O8e=b2("div")`
width: 12px;
height: 12px;
box-sizing: border-box;
border: 2px solid;
border-radius: 100%;
border-color: ${t=>t.secondary||"#e0e0e0"};
border-right-color: ${t=>t.primary||"#616161"};
animation: ${IZe} 1s linear infinite;
`,FZe=f1`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,OZe=f1`
0% {
height: 0;
width: 0;
opacity: 0;
}
40% {
height: 0;
width: 6px;
opacity: 1;
}
100% {
opacity: 1;
height: 10px;
}`,MZe=b2("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${t=>t.primary||"#61d345"};
position: relative;
transform: rotate(45deg);
animation: ${FZe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after {
content: '';
box-sizing: border-box;
animation: ${OZe} 0.2s ease-out forwards;
opacity: 0;
animation-delay: 200ms;
position: absolute;
border-right: 2px solid;
border-bottom: 2px solid;
border-color: ${t=>t.secondary||"#fff"};
bottom: 6px;
left: 6px;
height: 10px;
width: 6px;
}
`,RZe=b2("div")`
position: absolute;
`,LZe=b2("div")`
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-width: 20px;
min-height: 20px;
`,DZe=f1`
from {
transform: scale(0.6);
opacity: 0.4;
}
to {
transform: scale(1);
opacity: 1;
}`,BZe=b2("div")`
position: relative;
transform: scale(0.6);
opacity: 0.4;
min-width: 20px;
animation: ${DZe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
`,$Ze=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?m.createElement(BZe,null,e):e:n==="blank"?null:m.createElement(LZe,null,m.createElement(O8e,{...r}),n!=="loading"&&m.createElement(RZe,null,n==="error"?m.createElement(PZe,{...r}):m.createElement(MZe,{...r})))},UZe=t=>`
0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`,zZe=t=>`
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;}
`,HZe="0%{opacity:0;} 100%{opacity:1;}",VZe="0%{opacity:1;} 100%{opacity:0;}",WZe=b2("div")`
display: flex;
align-items: center;
background: #fff;
color: #363636;
line-height: 1.3;
will-change: transform;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
max-width: 350px;
pointer-events: auto;
padding: 8px 10px;
border-radius: 8px;
`,qZe=b2("div")`
display: flex;
justify-content: center;
margin: 4px 10px;
color: inherit;
flex: 1 1 auto;
white-space: pre-line;
`,GZe=(t,e)=>{let n=t.includes("top")?1:-1,[r,s]=F8e()?[HZe,VZe]:[UZe(n),zZe(n)];return{animation:e?`${f1(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${f1(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},KZe=m.memo(({toast:t,position:e,style:n,children:r})=>{let s=t.height?GZe(t.position||e||"top-center",t.visible):{opacity:0},a=m.createElement($Ze,{toast:t}),o=m.createElement(qZe,{...t.ariaProps},FM(t.message,t));return m.createElement(WZe,{className:t.className,style:{...s,...n,...t.style}},typeof r=="function"?r({icon:a,message:o}):m.createElement(m.Fragment,null,a,o))});xZe(m.createElement);var YZe=({id:t,className:e,style:n,onHeightUpdate:r,children:s})=>{let a=m.useCallback(o=>{if(o){let l=()=>{let c=o.getBoundingClientRect().height;r(t,c)};l(),new MutationObserver(l).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[t,r]);return m.createElement("div",{ref:a,className:e,style:n},s)},XZe=(t,e)=>{let n=t.includes("top"),r=n?{top:0}:{bottom:0},s=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:F8e()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...s}},QZe=vB`
z-index: 9999;
> * {
pointer-events: auto;
}
`,cI=16,ZZe=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:s,containerStyle:a,containerClassName:o})=>{let{toasts:l,handlers:c}=EZe(n);return m.createElement("div",{style:{position:"fixed",zIndex:9999,top:cI,left:cI,right:cI,bottom:cI,pointerEvents:"none",...a},className:o,onMouseEnter:c.startPause,onMouseLeave:c.endPause},l.map(u=>{let d=u.position||e,f=c.calculateOffset(u,{reverseOrder:t,gutter:r,defaultPosition:e}),x=XZe(d,f);return m.createElement(YZe,{id:u.id,key:u.id,onHeightUpdate:c.updateHeight,className:u.visible?QZe:"",style:x},u.type==="custom"?FM(u.message,u):s?s(u):m.createElement(KZe,{toast:u,position:d}))}))},tn=Yf;const M8e=typeof document<"u"?Ne.useLayoutEffect:()=>{};function JZe(t){const e=m.useRef(null);return M8e(()=>{e.current=t},[t]),m.useCallback((...n)=>{const r=e.current;return r==null?void 0:r(...n)},[])}const Jk=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},aw=t=>t&&"window"in t&&t.window===t?t:Jk(t).defaultView||window;function eJe(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(n=>t.test(n.brand)))||t.test(window.navigator.userAgent)}function tJe(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function R8e(t){let e=null;return()=>(e==null&&(e=t()),e)}const nJe=R8e(function(){return tJe(/^Mac/i)}),rJe=R8e(function(){return eJe(/Android/i)});function sJe(t){return t.mozInputSource===0&&t.isTrusted?!0:rJe()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}class iJe{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(e,n){this.nativeEvent=n,this.target=n.target,this.currentTarget=n.currentTarget,this.relatedTarget=n.relatedTarget,this.bubbles=n.bubbles,this.cancelable=n.cancelable,this.defaultPrevented=n.defaultPrevented,this.eventPhase=n.eventPhase,this.isTrusted=n.isTrusted,this.timeStamp=n.timeStamp,this.type=e}}function L8e(t){let e=m.useRef({isFocused:!1,observer:null});M8e(()=>{const r=e.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=JZe(r=>{t==null||t(r)});return m.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){e.current.isFocused=!0;let s=r.target,a=o=>{e.current.isFocused=!1,s.disabled&&n(new iJe("blur",o)),e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};s.addEventListener("focusout",a,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&s.disabled){var o;(o=e.current.observer)===null||o===void 0||o.disconnect();let l=s===document.activeElement?null:document.activeElement;s.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),s.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),e.current.observer.observe(s,{attributes:!0,attributeFilter:["disabled"]})}},[n])}function aJe(t){let{isDisabled:e,onFocus:n,onBlur:r,onFocusChange:s}=t;const a=m.useCallback(c=>{if(c.target===c.currentTarget)return r&&r(c),s&&s(!1),!0},[r,s]),o=L8e(a),l=m.useCallback(c=>{const u=Jk(c.target);c.target===c.currentTarget&&u.activeElement===c.target&&(n&&n(c),s&&s(!0),o(c))},[s,n,o]);return{focusProps:{onFocus:!e&&(n||s||r)?l:void 0,onBlur:!e&&(r||s)?a:void 0}}}let eT=null,LZ=new Set,p9=new Map,P3=!1,DZ=!1;const oJe={Tab:!0,Escape:!0};function Qse(t,e){for(let n of LZ)n(t,e)}function lJe(t){return!(t.metaKey||!nJe()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function OM(t){P3=!0,lJe(t)&&(eT="keyboard",Qse("keyboard",t))}function ep(t){eT="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(P3=!0,Qse("pointer",t))}function D8e(t){sJe(t)&&(P3=!0,eT="virtual")}function B8e(t){t.target===window||t.target===document||(!P3&&!DZ&&(eT="virtual",Qse("virtual",t)),P3=!1,DZ=!1)}function $8e(){P3=!1,DZ=!0}function BZ(t){if(typeof window>"u"||p9.get(aw(t)))return;const e=aw(t),n=Jk(t);let r=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){P3=!0,r.apply(this,arguments)},n.addEventListener("keydown",OM,!0),n.addEventListener("keyup",OM,!0),n.addEventListener("click",D8e,!0),e.addEventListener("focus",B8e,!0),e.addEventListener("blur",$8e,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ep,!0),n.addEventListener("pointermove",ep,!0),n.addEventListener("pointerup",ep,!0)):(n.addEventListener("mousedown",ep,!0),n.addEventListener("mousemove",ep,!0),n.addEventListener("mouseup",ep,!0)),e.addEventListener("beforeunload",()=>{U8e(t)},{once:!0}),p9.set(e,{focus:r})}const U8e=(t,e)=>{const n=aw(t),r=Jk(t);e&&r.removeEventListener("DOMContentLoaded",e),p9.has(n)&&(n.HTMLElement.prototype.focus=p9.get(n).focus,r.removeEventListener("keydown",OM,!0),r.removeEventListener("keyup",OM,!0),r.removeEventListener("click",D8e,!0),n.removeEventListener("focus",B8e,!0),n.removeEventListener("blur",$8e,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ep,!0),r.removeEventListener("pointermove",ep,!0),r.removeEventListener("pointerup",ep,!0)):(r.removeEventListener("mousedown",ep,!0),r.removeEventListener("mousemove",ep,!0),r.removeEventListener("mouseup",ep,!0)),p9.delete(n))};function cJe(t){const e=Jk(t);let n;return e.readyState!=="loading"?BZ(t):(n=()=>{BZ(t)},e.addEventListener("DOMContentLoaded",n)),()=>U8e(t,n)}typeof document<"u"&&cJe();function z8e(){return eT!=="pointer"}const uJe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function dJe(t,e,n){var r;const s=typeof window<"u"?aw(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?aw(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<"u"?aw(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?aw(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return t=t||(n==null?void 0:n.target)instanceof s&&!uJe.has(n==null||(r=n.target)===null||r===void 0?void 0:r.type)||(n==null?void 0:n.target)instanceof a||(n==null?void 0:n.target)instanceof o&&(n==null?void 0:n.target.isContentEditable),!(t&&e==="keyboard"&&n instanceof l&&!oJe[n.key])}function fJe(t,e,n){BZ(),m.useEffect(()=>{let r=(s,a)=>{dJe(!!(n!=null&&n.isTextInput),s,a)&&t(z8e())};return LZ.add(r),()=>{LZ.delete(r)}},e)}function hJe(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:s}=t,a=m.useRef({isFocusWithin:!1}),o=m.useCallback(u=>{a.current.isFocusWithin&&!u.currentTarget.contains(u.relatedTarget)&&(a.current.isFocusWithin=!1,n&&n(u),s&&s(!1))},[n,s,a]),l=L8e(o),c=m.useCallback(u=>{!a.current.isFocusWithin&&document.activeElement===u.target&&(r&&r(u),s&&s(!0),a.current.isFocusWithin=!0,l(u))},[r,s,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:o}}}let MM=!1,vH=0;function $Z(){MM=!0,setTimeout(()=>{MM=!1},50)}function mhe(t){t.pointerType==="touch"&&$Z()}function pJe(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",mhe):document.addEventListener("touchend",$Z),vH++,()=>{vH--,!(vH>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",mhe):document.removeEventListener("touchend",$Z))}}function Zse(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:s}=t,[a,o]=m.useState(!1),l=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(pJe,[]);let{hoverProps:c,triggerHoverEnd:u}=m.useMemo(()=>{let d=(g,y)=>{if(l.pointerType=y,s||y==="touch"||l.isHovered||!g.currentTarget.contains(g.target))return;l.isHovered=!0;let v=g.currentTarget;l.target=v,e&&e({type:"hoverstart",target:v,pointerType:y}),n&&n(!0),o(!0)},f=(g,y)=>{if(l.pointerType="",l.target=null,y==="touch"||!l.isHovered)return;l.isHovered=!1;let v=g.currentTarget;r&&r({type:"hoverend",target:v,pointerType:y}),n&&n(!1),o(!1)},x={};return typeof PointerEvent<"u"?(x.onPointerEnter=g=>{MM&&g.pointerType==="mouse"||d(g,g.pointerType)},x.onPointerLeave=g=>{!s&&g.currentTarget.contains(g.target)&&f(g,g.pointerType)}):(x.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},x.onMouseEnter=g=>{!l.ignoreEmulatedMouseEvents&&!MM&&d(g,"mouse"),l.ignoreEmulatedMouseEvents=!1},x.onMouseLeave=g=>{!s&&g.currentTarget.contains(g.target)&&f(g,"mouse")}),{hoverProps:x,triggerHoverEnd:f}},[e,n,r,s,l]);return m.useEffect(()=>{s&&u({currentTarget:l.target},l.pointerType)},[s]),{hoverProps:c,isHovered:a}}function Jse(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,s=m.useRef({isFocused:!1,isFocusVisible:e||z8e()}),[a,o]=m.useState(!1),[l,c]=m.useState(()=>s.current.isFocused&&s.current.isFocusVisible),u=m.useCallback(()=>c(s.current.isFocused&&s.current.isFocusVisible),[]),d=m.useCallback(g=>{s.current.isFocused=g,o(g),u()},[u]);fJe(g=>{s.current.isFocusVisible=g,u()},[],{isTextInput:n});let{focusProps:f}=aJe({isDisabled:r,onFocusChange:d}),{focusWithinProps:x}=hJe({isDisabled:!r,onFocusWithinChange:d});return{isFocused:a,isFocusVisible:l,focusProps:r?x:f}}var mJe=Object.defineProperty,xJe=(t,e,n)=>e in t?mJe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wH=(t,e,n)=>(xJe(t,typeof e!="symbol"?e+"":e,n),n);let gJe=class{constructor(){wH(this,"current",this.detect()),wH(this,"handoffState","pending"),wH(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},o3=new gJe;function y2(t){return o3.isServer?null:t instanceof Node?t.ownerDocument:t!=null&&t.hasOwnProperty("current")&&t.current instanceof Node?t.current.ownerDocument:document}function wB(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function bx(){let t=[],e={addEventListener(n,r,s,a){return n.addEventListener(r,s,a),e.add(()=>n.removeEventListener(r,s,a))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return wB(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,s){let a=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:s}),this.add(()=>{Object.assign(n.style,{[r]:a})})},group(n){let r=bx();return n(r),this.add(()=>r.dispose())},add(n){return t.includes(n)||t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let s of t.splice(r,1))s()}},dispose(){for(let n of t.splice(0))n()}};return e}function v2(){let[t]=m.useState(bx);return m.useEffect(()=>()=>t.dispose(),[t]),t}let eo=(t,e)=>{o3.isServer?m.useEffect(t,e):m.useLayoutEffect(t,e)};function C5(t){let e=m.useRef(t);return eo(()=>{e.current=t},[t]),e}let Hs=function(t){let e=C5(t);return Ne.useCallback((...n)=>e.current(...n),[e])};function bJe(t){let e=t.width/2,n=t.height/2;return{top:t.clientY-n,right:t.clientX+e,bottom:t.clientY+n,left:t.clientX-e}}function yJe(t,e){return!(!t||!e||t.right<e.left||t.left>e.right||t.bottom<e.top||t.top>e.bottom)}function eie({disabled:t=!1}={}){let e=m.useRef(null),[n,r]=m.useState(!1),s=v2(),a=Hs(()=>{e.current=null,r(!1),s.dispose()}),o=Hs(l=>{if(s.dispose(),e.current===null){e.current=l.currentTarget,r(!0);{let c=y2(l.currentTarget);s.addEventListener(c,"pointerup",a,!1),s.addEventListener(c,"pointermove",u=>{if(e.current){let d=bJe(u);r(yJe(d,e.current.getBoundingClientRect()))}},!1),s.addEventListener(c,"pointercancel",a,!1)}}});return{pressed:n,pressProps:t?{}:{onPointerDown:o,onPointerUp:a,onClick:a}}}let vJe=m.createContext(void 0);function tie(){return m.useContext(vJe)}function UZ(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function rh(t,e,...n){if(t in e){let s=e[t];return typeof s=="function"?s(...n):s}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(s=>`"${s}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,rh),r}var qy=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(qy||{}),Ny=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(Ny||{});function _o(){let t=CJe();return m.useCallback(e=>wJe({mergeRefs:t,...e}),[t])}function wJe({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:s,visible:a=!0,name:o,mergeRefs:l}){l=l??SJe;let c=H8e(e,t);if(a)return uI(c,n,r,o,l);let u=s??0;if(u&2){let{static:d=!1,...f}=c;if(d)return uI(f,n,r,o,l)}if(u&1){let{unmount:d=!0,...f}=c;return rh(d?0:1,{0(){return null},1(){return uI({...f,hidden:!0,style:{display:"none"}},n,r,o,l)}})}return uI(c,n,r,o,l)}function uI(t,e={},n,r,s){let{as:a=n,children:o,refName:l="ref",...c}=CH(t,["unmount","static"]),u=t.ref!==void 0?{[l]:t.ref}:{},d=typeof o=="function"?o(e):o;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(e)),c["aria-labelledby"]&&c["aria-labelledby"]===c.id&&(c["aria-labelledby"]=void 0);let f={};if(e){let x=!1,g=[];for(let[y,v]of Object.entries(e))typeof v=="boolean"&&(x=!0),v===!0&&g.push(y.replace(/([A-Z])/g,C=>`-${C.toLowerCase()}`));if(x){f["data-headlessui-state"]=g.join(" ");for(let y of g)f[`data-${y}`]=""}}if(a===m.Fragment&&(Object.keys(Hb(c)).length>0||Object.keys(Hb(f)).length>0))if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(Hb(c)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Hb(c)).concat(Object.keys(Hb(f))).map(x=>` - ${x}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(x=>` - ${x}`).join(`
`)].join(`
`))}else{let x=d.props,g=x==null?void 0:x.className,y=typeof g=="function"?(...N)=>UZ(g(...N),c.className):UZ(g,c.className),v=y?{className:y}:{},C=H8e(d.props,Hb(CH(c,["ref"])));for(let N in f)N in C&&delete f[N];return m.cloneElement(d,Object.assign({},C,f,u,{ref:s(NJe(d),u.ref)},v))}return m.createElement(a,Object.assign({},CH(c,["ref"]),a!==m.Fragment&&u,a!==m.Fragment&&f),d)}function CJe(){let t=m.useRef([]),e=m.useCallback(n=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return t.current=n,e}}function SJe(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function H8e(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let s in r)s.startsWith("on")&&typeof r[s]=="function"?(n[s]!=null||(n[s]=[]),n[s].push(r[s])):e[s]=r[s];if(e.disabled||e["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[s=>{var a;return(a=s==null?void 0:s.preventDefault)==null?void 0:a.call(s)}]);for(let r in n)Object.assign(e,{[r](s,...a){let o=n[r];for(let l of o){if((s instanceof Event||(s==null?void 0:s.nativeEvent)instanceof Event)&&s.defaultPrevented)return;l(s,...a)}}});return e}function rE(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let s in r)s.startsWith("on")&&typeof r[s]=="function"?(n[s]!=null||(n[s]=[]),n[s].push(r[s])):e[s]=r[s];for(let r in n)Object.assign(e,{[r](...s){let a=n[r];for(let o of a)o==null||o(...s)}});return e}function mo(t){var e;return Object.assign(m.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Hb(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function CH(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}function NJe(t){return Ne.version.split(".")[0]>="19"?t.props.ref:t.ref}function AJe(t,e,n){let[r,s]=m.useState(n),a=t!==void 0,o=m.useRef(a),l=m.useRef(!1),c=m.useRef(!1);return a&&!o.current&&!l.current?(l.current=!0,o.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!a&&o.current&&!c.current&&(c.current=!0,o.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[a?t:r,Hs(u=>(a||s(u),e==null?void 0:e(u)))]}function jJe(t){let[e]=m.useState(t);return e}function V8e(t={},e=null,n=[]){for(let[r,s]of Object.entries(t))q8e(n,W8e(e,r),s);return n}function W8e(t,e){return t?t+"["+e+"]":e}function q8e(t,e,n){if(Array.isArray(n))for(let[r,s]of n.entries())q8e(t,W8e(e,r.toString()),s);else n instanceof Date?t.push([e,n.toISOString()]):typeof n=="boolean"?t.push([e,n?"1":"0"]):typeof n=="string"?t.push([e,n]):typeof n=="number"?t.push([e,`${n}`]):n==null?t.push([e,""]):V8e(n,e,t)}function EJe(t){var e,n;let r=(e=t==null?void 0:t.form)!=null?e:t.closest("form");if(r){for(let s of r.elements)if(s!==t&&(s.tagName==="INPUT"&&s.type==="submit"||s.tagName==="BUTTON"&&s.type==="submit"||s.nodeName==="INPUT"&&s.type==="image")){s.click();return}(n=r.requestSubmit)==null||n.call(r)}}let _Je="span";var GS=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(GS||{});function kJe(t,e){var n;let{features:r=1,...s}=t,a={ref:e,"aria-hidden":(r&2)===2?!0:(n=s["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return _o()({ourProps:a,theirProps:s,slot:{},defaultTag:_Je,name:"Hidden"})}let sE=mo(kJe),TJe=m.createContext(null);function PJe({children:t}){let e=m.useContext(TJe);if(!e)return Ne.createElement(Ne.Fragment,null,t);let{target:n}=e;return n?Aa.createPortal(Ne.createElement(Ne.Fragment,null,t),n):null}function IJe({data:t,form:e,disabled:n,onReset:r,overrides:s}){let[a,o]=m.useState(null),l=v2();return m.useEffect(()=>{if(r&&a)return l.addEventListener(a,"reset",r)},[a,e,r]),Ne.createElement(PJe,null,Ne.createElement(FJe,{setForm:o,formId:e}),V8e(t).map(([c,u])=>Ne.createElement(sE,{features:GS.Hidden,...Hb({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:e,disabled:n,name:c,value:u,...s})})))}function FJe({setForm:t,formId:e}){return m.useEffect(()=>{if(e){let n=document.getElementById(e);n&&t(n)}},[t,e]),e?null:Ne.createElement(sE,{features:GS.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&t(r)}})}let OJe=m.createContext(void 0);function G8e(){return m.useContext(OJe)}function nie(t){let e=t.parentElement,n=null;for(;e&&!(e instanceof HTMLFieldSetElement);)e instanceof HTMLLegendElement&&(n=e),e=e.parentElement;let r=(e==null?void 0:e.getAttribute("disabled"))==="";return r&&MJe(n)?!1:r}function MJe(t){if(!t)return!1;let e=t.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}let K8e=Symbol();function Y8e(t,e=!0){return Object.assign(t,{[K8e]:e})}function dc(...t){let e=m.useRef(t);m.useEffect(()=>{e.current=t},[t]);let n=Hs(r=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(r):s.current=r)});return t.every(r=>r==null||(r==null?void 0:r[K8e]))?void 0:n}let CB=m.createContext(null);CB.displayName="DescriptionContext";function X8e(){let t=m.useContext(CB);if(t===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,X8e),e}return t}function RJe(){var t,e;return(e=(t=m.useContext(CB))==null?void 0:t.value)!=null?e:void 0}function rie(){let[t,e]=m.useState([]);return[t.length>0?t.join(" "):void 0,m.useMemo(()=>function(n){let r=Hs(a=>(e(o=>[...o,a]),()=>e(o=>{let l=o.slice(),c=l.indexOf(a);return c!==-1&&l.splice(c,1),l}))),s=m.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props,value:n.value}),[r,n.slot,n.name,n.props,n.value]);return Ne.createElement(CB.Provider,{value:s},n.children)},[e])]}let LJe="p";function DJe(t,e){let n=m.useId(),r=tie(),{id:s=`headlessui-description-${n}`,...a}=t,o=X8e(),l=dc(e);eo(()=>o.register(s),[s,o.register]);let c=r||!1,u=m.useMemo(()=>({...o.slot,disabled:c}),[o.slot,c]),d={ref:l,...o.props,id:s};return _o()({ourProps:d,theirProps:a,slot:u,defaultTag:LJe,name:o.name||"Description"})}let BJe=mo(DJe),Q8e=Object.assign(BJe,{});var wo=(t=>(t.Space=" ",t.Enter="Enter",t.Escape="Escape",t.Backspace="Backspace",t.Delete="Delete",t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Home="Home",t.End="End",t.PageUp="PageUp",t.PageDown="PageDown",t.Tab="Tab",t))(wo||{});let SB=m.createContext(null);SB.displayName="LabelContext";function sie(){let t=m.useContext(SB);if(t===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,sie),e}return t}function Z8e(t){var e,n,r;let s=(n=(e=m.useContext(SB))==null?void 0:e.value)!=null?n:void 0;return((r=void 0)!=null?r:0)>0?[s,...t].filter(Boolean).join(" "):s}function iie({inherit:t=!1}={}){let e=Z8e(),[n,r]=m.useState([]),s=t?[e,...n].filter(Boolean):n;return[s.length>0?s.join(" "):void 0,m.useMemo(()=>function(a){let o=Hs(c=>(r(u=>[...u,c]),()=>r(u=>{let d=u.slice(),f=d.indexOf(c);return f!==-1&&d.splice(f,1),d}))),l=m.useMemo(()=>({register:o,slot:a.slot,name:a.name,props:a.props,value:a.value}),[o,a.slot,a.name,a.props,a.value]);return Ne.createElement(SB.Provider,{value:l},a.children)},[r])]}let $Je="label";function UJe(t,e){var n;let r=m.useId(),s=sie(),a=G8e(),o=tie(),{id:l=`headlessui-label-${r}`,htmlFor:c=a??((n=s.props)==null?void 0:n.htmlFor),passive:u=!1,...d}=t,f=dc(e);eo(()=>s.register(l),[l,s.register]);let x=Hs(C=>{let N=C.currentTarget;if(N instanceof HTMLLabelElement&&C.preventDefault(),s.props&&"onClick"in s.props&&typeof s.props.onClick=="function"&&s.props.onClick(C),N instanceof HTMLLabelElement){let P=document.getElementById(N.htmlFor);if(P){let T=P.getAttribute("disabled");if(T==="true"||T==="")return;let M=P.getAttribute("aria-disabled");if(M==="true"||M==="")return;(P instanceof HTMLInputElement&&(P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),g=o||!1,y=m.useMemo(()=>({...s.slot,disabled:g}),[s.slot,g]),v={ref:f,...s.props,id:l,htmlFor:c,onClick:x};return u&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in d&&delete d.onClick),_o()({ourProps:v,theirProps:d,slot:y,defaultTag:c?$Je:"div",name:s.name||"Label"})}let zJe=mo(UJe),HJe=Object.assign(zJe,{}),VJe=m.createContext(()=>{});function J8e({value:t,children:e}){return Ne.createElement(VJe.Provider,{value:t},e)}function WJe(t){if(t===null)return{width:0,height:0};let{width:e,height:n}=t.getBoundingClientRect();return{width:e,height:n}}function qJe(t,e=!1){let[n,r]=m.useReducer(()=>({}),{}),s=m.useMemo(()=>WJe(t),[t,n]);return eo(()=>{if(!t)return;let a=new ResizeObserver(r);return a.observe(t),()=>{a.disconnect()}},[t]),e?{width:`${s.width}px`,height:`${s.height}px`}:s}let GJe=class extends Map{constructor(e){super(),this.factory=e}get(e){let n=super.get(e);return n===void 0&&(n=this.factory(e),this.set(e,n)),n}};function e7e(t,e){let n=t(),r=new Set;return{getSnapshot(){return n},subscribe(s){return r.add(s),()=>r.delete(s)},dispatch(s,...a){let o=e[s].call(n,...a);o&&(n=o,r.forEach(l=>l()))}}}function t7e(t){return m.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}let KJe=new GJe(()=>e7e(()=>[],{ADD(t){return this.includes(t)?this:[...this,t]},REMOVE(t){let e=this.indexOf(t);if(e===-1)return this;let n=this.slice();return n.splice(e,1),n}}));function kA(t,e){let n=KJe.get(e),r=m.useId(),s=t7e(n);if(eo(()=>{if(t)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,t]),!t)return!1;let a=s.indexOf(r),o=s.length;return a===-1&&(a=o,o+=1),a===o-1}let zZ=new Map,m9=new Map;function xhe(t){var e;let n=(e=m9.get(t))!=null?e:0;return m9.set(t,n+1),n!==0?()=>ghe(t):(zZ.set(t,{"aria-hidden":t.getAttribute("aria-hidden"),inert:t.inert}),t.setAttribute("aria-hidden","true"),t.inert=!0,()=>ghe(t))}function ghe(t){var e;let n=(e=m9.get(t))!=null?e:1;if(n===1?m9.delete(t):m9.set(t,n-1),n!==1)return;let r=zZ.get(t);r&&(r["aria-hidden"]===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",r["aria-hidden"]),t.inert=r.inert,zZ.delete(t))}function n7e(t,{allowed:e,disallowed:n}={}){let r=kA(t,"inert-others");eo(()=>{var s,a;if(!r)return;let o=bx();for(let c of(s=n==null?void 0:n())!=null?s:[])c&&o.add(xhe(c));let l=(a=e==null?void 0:e())!=null?a:[];for(let c of l){if(!c)continue;let u=y2(c);if(!u)continue;let d=c.parentElement;for(;d&&d!==u.body;){for(let f of d.children)l.some(x=>f.contains(x))||o.add(xhe(f));d=d.parentElement}}return o.dispose},[r,e,n])}function r7e(t,e,n){let r=C5(s=>{let a=s.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&n()});m.useEffect(()=>{if(!t)return;let s=e===null?null:e instanceof HTMLElement?e:e.current;if(!s)return;let a=bx();if(typeof ResizeObserver<"u"){let o=new ResizeObserver(()=>r.current(s));o.observe(s),a.add(()=>o.disconnect())}if(typeof IntersectionObserver<"u"){let o=new IntersectionObserver(()=>r.current(s));o.observe(s),a.add(()=>o.disconnect())}return()=>a.dispose()},[e,r,t])}let RM=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(t=>`${t}:not([tabindex='-1'])`).join(","),YJe=["[data-autofocus]"].map(t=>`${t}:not([tabindex='-1'])`).join(",");var um=(t=>(t[t.First=1]="First",t[t.Previous=2]="Previous",t[t.Next=4]="Next",t[t.Last=8]="Last",t[t.WrapAround=16]="WrapAround",t[t.NoScroll=32]="NoScroll",t[t.AutoFocus=64]="AutoFocus",t))(um||{}),HZ=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(HZ||{}),XJe=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(XJe||{});function s7e(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(RM)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function QJe(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(YJe)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var aie=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(aie||{});function oie(t,e=0){var n;return t===((n=y2(t))==null?void 0:n.body)?!1:rh(e,{0(){return t.matches(RM)},1(){let r=t;for(;r!==null;){if(r.matches(RM))return!0;r=r.parentElement}return!1}})}function i7e(t){let e=y2(t);bx().nextFrame(()=>{e&&!oie(e.activeElement,0)&&V0(t)})}var ZJe=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(ZJe||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",t=>{t.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:t.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function V0(t){t==null||t.focus({preventScroll:!0})}let JJe=["textarea","input"].join(",");function eet(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,JJe))!=null?n:!1}function a7e(t,e=n=>n){return t.slice().sort((n,r)=>{let s=e(n),a=e(r);if(s===null||a===null)return 0;let o=s.compareDocumentPosition(a);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function tet(t,e){return g4(s7e(),e,{relativeTo:t})}function g4(t,e,{sorted:n=!0,relativeTo:r=null,skipElements:s=[]}={}){let a=Array.isArray(t)?t.length>0?t[0].ownerDocument:document:t.ownerDocument,o=Array.isArray(t)?n?a7e(t):t:e&64?QJe(t):s7e(t);s.length>0&&o.length>1&&(o=o.filter(g=>!s.some(y=>y!=null&&"current"in y?(y==null?void 0:y.current)===g:y===g))),r=r??a.activeElement;let l=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,o.indexOf(r))-1;if(e&4)return Math.max(0,o.indexOf(r))+1;if(e&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=e&32?{preventScroll:!0}:{},d=0,f=o.length,x;do{if(d>=f||d+f<=0)return 0;let g=c+d;if(e&16)g=(g+f)%f;else{if(g<0)return 3;if(g>=f)return 1}x=o[g],x==null||x.focus(u),d+=l}while(x!==a.activeElement);return e&6&&eet(x)&&x.select(),2}function o7e(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function net(){return/Android/gi.test(window.navigator.userAgent)}function ret(){return o7e()||net()}function $8(t,e,n,r){let s=C5(n);m.useEffect(()=>{if(!t)return;function a(o){s.current(o)}return document.addEventListener(e,a,r),()=>document.removeEventListener(e,a,r)},[t,e,r])}function l7e(t,e,n,r){let s=C5(n);m.useEffect(()=>{if(!t)return;function a(o){s.current(o)}return window.addEventListener(e,a,r),()=>window.removeEventListener(e,a,r)},[t,e,r])}const bhe=30;function c7e(t,e,n){let r=kA(t,"outside-click"),s=C5(n),a=m.useCallback(function(c,u){if(c.defaultPrevented)return;let d=u(c);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=function x(g){return typeof g=="function"?x(g()):Array.isArray(g)||g instanceof Set?g:[g]}(e);for(let x of f)if(x!==null&&(x.contains(d)||c.composed&&c.composedPath().includes(x)))return;return!oie(d,aie.Loose)&&d.tabIndex!==-1&&c.preventDefault(),s.current(c,d)},[s,e]),o=m.useRef(null);$8(r,"pointerdown",c=>{var u,d;o.current=((d=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:d[0])||c.target},!0),$8(r,"mousedown",c=>{var u,d;o.current=((d=(u=c.composedPath)==null?void 0:u.call(c))==null?void 0:d[0])||c.target},!0),$8(r,"click",c=>{ret()||o.current&&(a(c,()=>o.current),o.current=null)},!0);let l=m.useRef({x:0,y:0});$8(r,"touchstart",c=>{l.current.x=c.touches[0].clientX,l.current.y=c.touches[0].clientY},!0),$8(r,"touchend",c=>{let u={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(u.x-l.current.x)>=bhe||Math.abs(u.y-l.current.y)>=bhe))return a(c,()=>c.target instanceof HTMLElement?c.target:null)},!0),l7e(r,"blur",c=>a(c,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function TA(...t){return m.useMemo(()=>y2(...t),[...t])}function u7e(t,e,n,r){let s=C5(n);m.useEffect(()=>{t=t??window;function a(o){s.current(o)}return t.addEventListener(e,a,r),()=>t.removeEventListener(e,a,r)},[t,e,r])}function lie(t,e){return m.useMemo(()=>{var n;if(t.type)return t.type;let r=(n=t.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(e==null?void 0:e.tagName)==="BUTTON"&&!e.hasAttribute("type"))return"button"},[t.type,t.as,e])}function set(){let t;return{before({doc:e}){var n;let r=e.documentElement,s=(n=e.defaultView)!=null?n:window;t=Math.max(0,s.innerWidth-r.clientWidth)},after({doc:e,d:n}){let r=e.documentElement,s=Math.max(0,r.clientWidth-r.offsetWidth),a=Math.max(0,t-s);n.style(r,"paddingRight",`${a}px`)}}}function iet(){return o7e()?{before({doc:t,d:e,meta:n}){function r(s){return n.containers.flatMap(a=>a()).some(a=>a.contains(s))}e.microTask(()=>{var s;if(window.getComputedStyle(t.documentElement).scrollBehavior!=="auto"){let l=bx();l.style(t.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>l.dispose()))}let a=(s=window.scrollY)!=null?s:window.pageYOffset,o=null;e.addEventListener(t,"click",l=>{if(l.target instanceof HTMLElement)try{let c=l.target.closest("a");if(!c)return;let{hash:u}=new URL(c.href),d=t.querySelector(u);d&&!r(d)&&(o=d)}catch{}},!0),e.addEventListener(t,"touchstart",l=>{if(l.target instanceof HTMLElement)if(r(l.target)){let c=l.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;e.style(c,"overscrollBehavior","contain")}else e.style(l.target,"touchAction","none")}),e.addEventListener(t,"touchmove",l=>{if(l.target instanceof HTMLElement){if(l.target.tagName==="INPUT")return;if(r(l.target)){let c=l.target;for(;c.parentElement&&c.dataset.headlessuiPortal!==""&&!(c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth);)c=c.parentElement;c.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),e.add(()=>{var l;let c=(l=window.scrollY)!=null?l:window.pageYOffset;a!==c&&window.scrollTo(0,a),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})})}}:{}}function aet(){return{before({doc:t,d:e}){e.style(t.documentElement,"overflow","hidden")}}}function oet(t){let e={};for(let n of t)Object.assign(e,n(e));return e}let ow=e7e(()=>new Map,{PUSH(t,e){var n;let r=(n=this.get(t))!=null?n:{doc:t,count:0,d:bx(),meta:new Set};return r.count++,r.meta.add(e),this.set(t,r),this},POP(t,e){let n=this.get(t);return n&&(n.count--,n.meta.delete(e)),this},SCROLL_PREVENT({doc:t,d:e,meta:n}){let r={doc:t,d:e,meta:oet(n)},s=[iet(),set(),aet()];s.forEach(({before:a})=>a==null?void 0:a(r)),s.forEach(({after:a})=>a==null?void 0:a(r))},SCROLL_ALLOW({d:t}){t.dispose()},TEARDOWN({doc:t}){this.delete(t)}});ow.subscribe(()=>{let t=ow.getSnapshot(),e=new Map;for(let[n]of t)e.set(n,n.documentElement.style.overflow);for(let n of t.values()){let r=e.get(n.doc)==="hidden",s=n.count!==0;(s&&!r||!s&&r)&&ow.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ow.dispatch("TEARDOWN",n)}});function cet(t,e,n=()=>({containers:[]})){let r=t7e(ow),s=e?r.get(e):void 0,a=s?s.count>0:!1;return eo(()=>{if(!(!e||!t))return ow.dispatch("PUSH",e,n),()=>ow.dispatch("POP",e,n)},[t,e]),a}function d7e(t,e,n=()=>[document.body]){let r=kA(t,"scroll-lock");cet(r,e,s=>{var a;return{containers:[...(a=s.containers)!=null?a:[],n]}})}function yhe(t){return[t.screenX,t.screenY]}function uet(){let t=m.useRef([-1,-1]);return{wasMoved(e){let n=yhe(e);return t.current[0]===n[0]&&t.current[1]===n[1]?!1:(t.current=n,!0)},update(e){t.current=yhe(e)}}}function det(t=0){let[e,n]=m.useState(t),r=m.useCallback(c=>n(c),[e]),s=m.useCallback(c=>n(u=>u|c),[e]),a=m.useCallback(c=>(e&c)===c,[e]),o=m.useCallback(c=>n(u=>u&~c),[n]),l=m.useCallback(c=>n(u=>u^c),[n]);return{flags:e,setFlag:r,addFlag:s,hasFlag:a,removeFlag:o,toggleFlag:l}}var fet={},vhe,whe;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((vhe=process==null?void 0:fet)==null?void 0:vhe.NODE_ENV)==="test"&&typeof((whe=Element==null?void 0:Element.prototype)==null?void 0:whe.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
`)),[]});var het=(t=>(t[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t))(het||{});function cie(t){let e={};for(let n in t)t[n]===!0&&(e[`data-${n}`]="");return e}function uie(t,e,n,r){let[s,a]=m.useState(n),{hasFlag:o,addFlag:l,removeFlag:c}=det(t&&s?3:0),u=m.useRef(!1),d=m.useRef(!1),f=v2();return eo(()=>{var x;if(t){if(n&&a(!0),!e){n&&l(3);return}return(x=r==null?void 0:r.start)==null||x.call(r,n),pet(e,{inFlight:u,prepare(){d.current?d.current=!1:d.current=u.current,u.current=!0,!d.current&&(n?(l(3),c(4)):(l(4),c(2)))},run(){d.current?n?(c(3),l(4)):(c(4),l(3)):n?c(1):l(1)},done(){var g;d.current&&typeof e.getAnimations=="function"&&e.getAnimations().length>0||(u.current=!1,c(7),n||a(!1),(g=r==null?void 0:r.end)==null||g.call(r,n))}})}},[t,n,e,f]),t?[s,{closed:o(1),enter:o(2),leave:o(4),transition:o(2)||o(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function pet(t,{prepare:e,run:n,done:r,inFlight:s}){let a=bx();return xet(t,{prepare:e,inFlight:s}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(met(t,r))})}),a.dispose}function met(t,e){var n,r;let s=bx();if(!t)return s.dispose;let a=!1;s.add(()=>{a=!0});let o=(r=(n=t.getAnimations)==null?void 0:n.call(t).filter(l=>l instanceof CSSTransition))!=null?r:[];return o.length===0?(e(),s.dispose):(Promise.allSettled(o.map(l=>l.finished)).then(()=>{a||e()}),s.dispose)}function xet(t,{inFlight:e,prepare:n}){if(e!=null&&e.current){n();return}let r=t.style.transition;t.style.transition="none",n(),t.offsetHeight,t.style.transition=r}function get(t,{container:e,accept:n,walk:r}){let s=m.useRef(n),a=m.useRef(r);m.useEffect(()=>{s.current=n,a.current=r},[n,r]),eo(()=>{if(!e||!t)return;let o=y2(e);if(!o)return;let l=s.current,c=a.current,u=Object.assign(f=>l(f),{acceptNode:l}),d=o.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)c(d.currentNode)},[e,t,s,a])}function die(t,e){let n=m.useRef([]),r=Hs(t);m.useEffect(()=>{let s=[...n.current];for(let[a,o]of e.entries())if(n.current[a]!==o){let l=r(e,s);return n.current=e,l}},[r,...e])}function NB(){return typeof window<"u"}function PA(t){return f7e(t)?(t.nodeName||"").toLowerCase():"#document"}function Qf(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function yx(t){var e;return(e=(f7e(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function f7e(t){return NB()?t instanceof Node||t instanceof Qf(t).Node:!1}function ud(t){return NB()?t instanceof Element||t instanceof Qf(t).Element:!1}function nx(t){return NB()?t instanceof HTMLElement||t instanceof Qf(t).HTMLElement:!1}function Che(t){return!NB()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qf(t).ShadowRoot}function tT(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Nm(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function bet(t){return["table","td","th"].includes(PA(t))}function AB(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function fie(t){const e=hie(),n=ud(t)?Nm(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function yet(t){let e=Gy(t);for(;nx(e)&&!KS(e);){if(fie(e))return e;if(AB(e))return null;e=Gy(e)}return null}function hie(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function KS(t){return["html","body","#document"].includes(PA(t))}function Nm(t){return Qf(t).getComputedStyle(t)}function jB(t){return ud(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Gy(t){if(PA(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Che(t)&&t.host||yx(t);return Che(e)?e.host:e}function h7e(t){const e=Gy(t);return KS(e)?t.ownerDocument?t.ownerDocument.body:t.body:nx(e)&&tT(e)?e:h7e(e)}function iE(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=h7e(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Qf(s);if(a){const l=VZ(o);return e.concat(o,o.visualViewport||[],tT(s)?s:[],l&&n?iE(l):[])}return e.concat(s,iE(s,[],n))}function VZ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function vet(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}const wet=["top","right","bottom","left"],Ky=Math.min,Tu=Math.max,aE=Math.round,dI=Math.floor,Yy=t=>({x:t,y:t}),Cet={left:"right",right:"left",bottom:"top",top:"bottom"},Net={start:"end",end:"start"};function WZ(t,e,n){return Tu(t,Ky(e,n))}function rx(t,e){return typeof t=="function"?t(e):t}function h1(t){return t.split("-")[0]}function IA(t){return t.split("-")[1]}function pie(t){return t==="x"?"y":"x"}function mie(t){return t==="y"?"height":"width"}function Xy(t){return["top","bottom"].includes(h1(t))?"y":"x"}function xie(t){return pie(Xy(t))}function Aet(t,e,n){n===void 0&&(n=!1);const r=IA(t),s=xie(t),a=mie(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=LM(o)),[o,LM(o)]}function jet(t){const e=LM(t);return[qZ(t),e,qZ(e)]}function qZ(t){return t.replace(/start|end/g,e=>Net[e])}function Eet(t,e,n){const r=["left","right"],s=["right","left"],a=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:r:e?r:s;case"left":case"right":return e?a:o;default:return[]}}function _et(t,e,n,r){const s=IA(t);let a=Eet(h1(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(qZ)))),a}function LM(t){return t.replace(/left|right|bottom|top/g,e=>Cet[e])}function ket(t){return{top:0,right:0,bottom:0,left:0,...t}}function p7e(t){return typeof t!="number"?ket(t):{top:t,right:t,bottom:t,left:t}}function oE(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function She(t,e,n){let{reference:r,floating:s}=t;const a=Xy(e),o=xie(e),l=mie(o),c=h1(e),u=a==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,x=r[l]/2-s[l]/2;let g;switch(c){case"top":g={x:d,y:r.y-s.height};break;case"bottom":g={x:d,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-s.width,y:f};break;default:g={x:r.x,y:r.y}}switch(IA(e)){case"start":g[o]-=x*(n&&u?-1:1);break;case"end":g[o]+=x*(n&&u?-1:1);break}return g}const Tet=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,l=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:f}=She(u,r,c),x=r,g={},y=0;for(let v=0;v<l.length;v++){const{name:C,fn:N}=l[v],{x:P,y:T,data:M,reset:F}=await N({x:d,y:f,initialPlacement:r,placement:x,strategy:s,middlewareData:g,rects:u,platform:o,elements:{reference:t,floating:e}});d=P??d,f=T??f,g={...g,[C]:{...g[C],...M}},F&&y<=50&&(y++,typeof F=="object"&&(F.placement&&(x=F.placement),F.rects&&(u=F.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):F.rects),{x:d,y:f}=She(u,x,c)),v=-1)}return{x:d,y:f,placement:x,strategy:s,middlewareData:g}};async function YS(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:l,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:x=!1,padding:g=0}=rx(e,t),y=p7e(g),C=l[x?f==="floating"?"reference":"floating":f],N=oE(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(C)))==null||n?C:C.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),P=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),M=await(a.isElement==null?void 0:a.isElement(T))?await(a.getScale==null?void 0:a.getScale(T))||{x:1,y:1}:{x:1,y:1},F=oE(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:P,offsetParent:T,strategy:c}):P);return{top:(N.top-F.top+y.top)/M.y,bottom:(F.bottom-N.bottom+y.bottom)/M.y,left:(N.left-F.left+y.left)/M.x,right:(F.right-N.right+y.right)/M.x}}const Pet=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=e,{element:u,padding:d=0}=rx(t,e)||{};if(u==null)return{};const f=p7e(d),x={x:n,y:r},g=xie(s),y=mie(g),v=await o.getDimensions(u),C=g==="y",N=C?"top":"left",P=C?"bottom":"right",T=C?"clientHeight":"clientWidth",M=a.reference[y]+a.reference[g]-x[g]-a.floating[y],F=x[g]-a.reference[g],$=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let L=$?$[T]:0;(!L||!await(o.isElement==null?void 0:o.isElement($)))&&(L=l.floating[T]||a.floating[y]);const z=M/2-F/2,X=L/2-v[y]/2-1,ne=Ky(f[N],X),J=Ky(f[P],X),K=ne,te=L-v[y]-J,fe=L/2-v[y]/2+z,q=WZ(K,fe,te),se=!c.arrow&&IA(s)!=null&&fe!==q&&a.reference[y]/2-(fe<K?ne:J)-v[y]/2<0,ae=se?fe<K?fe-K:fe-te:0;return{[g]:x[g]+ae,data:{[g]:q,centerOffset:fe-q-ae,...se&&{alignmentOffset:ae}},reset:se}}}),Iet=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:x,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...C}=rx(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const N=h1(s),P=Xy(l),T=h1(l)===l,M=await(c.isRTL==null?void 0:c.isRTL(u.floating)),F=x||(T||!v?[LM(l)]:jet(l)),$=y!=="none";!x&&$&&F.push(..._et(l,v,y,M));const L=[l,...F],z=await YS(e,C),X=[];let ne=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&X.push(z[N]),f){const fe=Aet(s,o,M);X.push(z[fe[0]],z[fe[1]])}if(ne=[...ne,{placement:s,overflows:X}],!X.every(fe=>fe<=0)){var J,K;const fe=(((J=a.flip)==null?void 0:J.index)||0)+1,q=L[fe];if(q)return{data:{index:fe,overflows:ne},reset:{placement:q}};let se=(K=ne.filter(ae=>ae.overflows[0]<=0).sort((ae,W)=>ae.overflows[1]-W.overflows[1])[0])==null?void 0:K.placement;if(!se)switch(g){case"bestFit":{var te;const ae=(te=ne.filter(W=>{if($){const V=Xy(W.placement);return V===P||V==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(V=>V>0).reduce((V,ee)=>V+ee,0)]).sort((W,V)=>W[1]-V[1])[0])==null?void 0:te[0];ae&&(se=ae);break}case"initialPlacement":se=l;break}if(s!==se)return{reset:{placement:se}}}return{}}}};function Nhe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ahe(t){return wet.some(e=>t[e]>=0)}const Fet=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...s}=rx(t,e);switch(r){case"referenceHidden":{const a=await YS(e,{...s,elementContext:"reference"}),o=Nhe(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Ahe(o)}}}case"escaped":{const a=await YS(e,{...s,altBoundary:!0}),o=Nhe(a,n.floating);return{data:{escapedOffsets:o,escaped:Ahe(o)}}}default:return{}}}}};async function Oet(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=h1(n),l=IA(n),c=Xy(n)==="y",u=["left","top"].includes(o)?-1:1,d=a&&c?-1:1,f=rx(e,t);let{mainAxis:x,crossAxis:g,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(g=l==="end"?y*-1:y),c?{x:g*d,y:x*u}:{x:x*u,y:g*d}}const Met=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:o,middlewareData:l}=e,c=await Oet(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:o}}}}},Ret=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:C=>{let{x:N,y:P}=C;return{x:N,y:P}}},...c}=rx(t,e),u={x:n,y:r},d=await YS(e,c),f=Xy(h1(s)),x=pie(f);let g=u[x],y=u[f];if(a){const C=x==="y"?"top":"left",N=x==="y"?"bottom":"right",P=g+d[C],T=g-d[N];g=WZ(P,g,T)}if(o){const C=f==="y"?"top":"left",N=f==="y"?"bottom":"right",P=y+d[C],T=y-d[N];y=WZ(P,y,T)}const v=l.fn({...e,[x]:g,[f]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[x]:a,[f]:o}}}}}},Let=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=rx(t,e),d={x:n,y:r},f=Xy(s),x=pie(f);let g=d[x],y=d[f];const v=rx(l,e),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const T=x==="y"?"height":"width",M=a.reference[x]-a.floating[T]+C.mainAxis,F=a.reference[x]+a.reference[T]-C.mainAxis;g<M?g=M:g>F&&(g=F)}if(u){var N,P;const T=x==="y"?"width":"height",M=["top","left"].includes(h1(s)),F=a.reference[f]-a.floating[T]+(M&&((N=o.offset)==null?void 0:N[f])||0)+(M?0:C.crossAxis),$=a.reference[f]+a.reference[T]+(M?0:((P=o.offset)==null?void 0:P[f])||0)-(M?C.crossAxis:0);y<F?y=F:y>$&&(y=$)}return{[x]:g,[f]:y}}}},Det=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:l}=e,{apply:c=()=>{},...u}=rx(t,e),d=await YS(e,u),f=h1(s),x=IA(s),g=Xy(s)==="y",{width:y,height:v}=a.floating;let C,N;f==="top"||f==="bottom"?(C=f,N=x===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(N=f,C=x==="end"?"top":"bottom");const P=v-d.top-d.bottom,T=y-d.left-d.right,M=Ky(v-d[C],P),F=Ky(y-d[N],T),$=!e.middlewareData.shift;let L=M,z=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=T),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=P),$&&!x){const ne=Tu(d.left,0),J=Tu(d.right,0),K=Tu(d.top,0),te=Tu(d.bottom,0);g?z=y-2*(ne!==0||J!==0?ne+J:Tu(d.left,d.right)):L=v-2*(K!==0||te!==0?K+te:Tu(d.top,d.bottom))}await c({...e,availableWidth:z,availableHeight:L});const X=await o.getDimensions(l.floating);return y!==X.width||v!==X.height?{reset:{rects:!0}}:{}}}};function m7e(t){const e=Nm(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=nx(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=aE(n)!==a||aE(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function gie(t){return ud(t)?t:t.contextElement}function b4(t){const e=gie(t);if(!nx(e))return Yy(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=m7e(e);let o=(a?aE(n.width):n.width)/r,l=(a?aE(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Bet=Yy(0);function x7e(t){const e=Qf(t);return!hie()||!e.visualViewport?Bet:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $et(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Qf(t)?!1:e}function I3(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=gie(t);let o=Yy(1);e&&(r?ud(r)&&(o=b4(r)):o=b4(t));const l=$et(a,n,r)?x7e(a):Yy(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(a){const x=Qf(a),g=r&&ud(r)?Qf(r):r;let y=x,v=VZ(y);for(;v&&r&&g!==y;){const C=b4(v),N=v.getBoundingClientRect(),P=Nm(v),T=N.left+(v.clientLeft+parseFloat(P.paddingLeft))*C.x,M=N.top+(v.clientTop+parseFloat(P.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=T,u+=M,y=Qf(v),v=VZ(y)}}return oE({width:d,height:f,x:c,y:u})}function Uet(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=yx(r),l=e?AB(e.floating):!1;if(r===o||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Yy(1);const d=Yy(0),f=nx(r);if((f||!f&&!a)&&((PA(r)!=="body"||tT(o))&&(c=jB(r)),nx(r))){const x=I3(r);u=b4(r),d.x=x.x+r.clientLeft,d.y=x.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function zet(t){return Array.from(t.getClientRects())}function GZ(t,e){const n=jB(t).scrollLeft;return e?e.left+n:I3(yx(t)).left+n}function Het(t){const e=yx(t),n=jB(t),r=t.ownerDocument.body,s=Tu(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Tu(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+GZ(t);const l=-n.scrollTop;return Nm(r).direction==="rtl"&&(o+=Tu(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:l}}function Vet(t,e){const n=Qf(t),r=yx(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;const u=hie();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}function Wet(t,e){const n=I3(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=nx(t)?b4(t):Yy(1),o=t.clientWidth*a.x,l=t.clientHeight*a.y,c=s*a.x,u=r*a.y;return{width:o,height:l,x:c,y:u}}function jhe(t,e,n){let r;if(e==="viewport")r=Vet(t,n);else if(e==="document")r=Het(yx(t));else if(ud(e))r=Wet(e,n);else{const s=x7e(t);r={...e,x:e.x-s.x,y:e.y-s.y}}return oE(r)}function g7e(t,e){const n=Gy(t);return n===e||!ud(n)||KS(n)?!1:Nm(n).position==="fixed"||g7e(n,e)}function qet(t,e){const n=e.get(t);if(n)return n;let r=iE(t,[],!1).filter(l=>ud(l)&&PA(l)!=="body"),s=null;const a=Nm(t).position==="fixed";let o=a?Gy(t):t;for(;ud(o)&&!KS(o);){const l=Nm(o),c=fie(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||tT(o)&&!c&&g7e(t,o))?r=r.filter(d=>d!==o):s=l,o=Gy(o)}return e.set(t,r),r}function Get(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?AB(e)?[]:qet(e,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=jhe(e,d,s);return u.top=Tu(f.top,u.top),u.right=Ky(f.right,u.right),u.bottom=Ky(f.bottom,u.bottom),u.left=Tu(f.left,u.left),u},jhe(e,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ket(t){const{width:e,height:n}=m7e(t);return{width:e,height:n}}function Yet(t,e,n){const r=nx(e),s=yx(e),a=n==="fixed",o=I3(t,!0,a,e);let l={scrollLeft:0,scrollTop:0};const c=Yy(0);if(r||!r&&!a)if((PA(e)!=="body"||tT(s))&&(l=jB(e)),r){const g=I3(e,!0,a,e);c.x=g.x+e.clientLeft,c.y=g.y+e.clientTop}else s&&(c.x=GZ(s));let u=0,d=0;if(s&&!r&&!a){const g=s.getBoundingClientRect();d=g.top+l.scrollTop,u=g.left+l.scrollLeft-GZ(s,g)}const f=o.left+l.scrollLeft-c.x-u,x=o.top+l.scrollTop-c.y-d;return{x:f,y:x,width:o.width,height:o.height}}function SH(t){return Nm(t).position==="static"}function Ehe(t,e){if(!nx(t)||Nm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return yx(t)===n&&(n=n.ownerDocument.body),n}function b7e(t,e){const n=Qf(t);if(AB(t))return n;if(!nx(t)){let s=Gy(t);for(;s&&!KS(s);){if(ud(s)&&!SH(s))return s;s=Gy(s)}return n}let r=Ehe(t,e);for(;r&&bet(r)&&SH(r);)r=Ehe(r,e);return r&&KS(r)&&SH(r)&&!fie(r)?n:r||yet(t)||n}const Xet=async function(t){const e=this.getOffsetParent||b7e,n=this.getDimensions,r=await n(t.floating);return{reference:Yet(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qet(t){return Nm(t).direction==="rtl"}const Zet={convertOffsetParentRelativeRectToViewportRelativeRect:Uet,getDocumentElement:yx,getClippingRect:Get,getOffsetParent:b7e,getElementRects:Xet,getClientRects:zet,getDimensions:Ket,getScale:b4,isElement:ud,isRTL:Qet};function Jet(t,e){let n=null,r;const s=yx(t);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const{left:u,top:d,width:f,height:x}=t.getBoundingClientRect();if(l||e(),!f||!x)return;const g=dI(d),y=dI(s.clientWidth-(u+f)),v=dI(s.clientHeight-(d+x)),C=dI(u),P={rootMargin:-g+"px "+-y+"px "+-v+"px "+-C+"px",threshold:Tu(0,Ky(1,c))||1};let T=!0;function M(F){const $=F[0].intersectionRatio;if($!==c){if(!T)return o();$?o(!1,$):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T=!1}try{n=new IntersectionObserver(M,{...P,root:s.ownerDocument})}catch{n=new IntersectionObserver(M,P)}n.observe(t)}return o(!0),a}function y7e(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=gie(t),d=s||a?[...u?iE(u):[],...iE(e)]:[];d.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),a&&N.addEventListener("resize",n)});const f=u&&l?Jet(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(N=>{let[P]=N;P&&P.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var T;(T=g)==null||T.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?I3(t):null;c&&C();function C(){const N=I3(t);v&&(N.x!==v.x||N.y!==v.y||N.width!==v.width||N.height!==v.height)&&n(),v=N,y=requestAnimationFrame(C)}return n(),()=>{var N;d.forEach(P=>{s&&P.removeEventListener("scroll",n),a&&P.removeEventListener("resize",n)}),f==null||f(),(N=g)==null||N.disconnect(),g=null,c&&cancelAnimationFrame(y)}}const NH=YS,v7e=Met,w7e=Ret,C7e=Iet,S7e=Det,ett=Fet,_he=Pet,ttt=Let,N7e=(t,e,n)=>{const r=new Map,s={platform:Zet,...n},a={...s.platform,_c:r};return Tet(t,e,{...s,platform:a})};var CO=typeof document<"u"?m.useLayoutEffect:m.useEffect;function DM(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!DM(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!DM(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function A7e(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function khe(t,e){const n=A7e(t);return Math.round(e*n)/n}function AH(t){const e=m.useRef(t);return CO(()=>{e.current=t}),e}function ntt(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,f]=m.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,g]=m.useState(r);DM(x,r)||g(r);const[y,v]=m.useState(null),[C,N]=m.useState(null),P=m.useCallback(W=>{W!==$.current&&($.current=W,v(W))},[]),T=m.useCallback(W=>{W!==L.current&&(L.current=W,N(W))},[]),M=a||y,F=o||C,$=m.useRef(null),L=m.useRef(null),z=m.useRef(d),X=c!=null,ne=AH(c),J=AH(s),K=AH(u),te=m.useCallback(()=>{if(!$.current||!L.current)return;const W={placement:e,strategy:n,middleware:x};J.current&&(W.platform=J.current),N7e($.current,L.current,W).then(V=>{const ee={...V,isPositioned:K.current!==!1};fe.current&&!DM(z.current,ee)&&(z.current=ee,Aa.flushSync(()=>{f(ee)}))})},[x,e,n,J,K]);CO(()=>{u===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[u]);const fe=m.useRef(!1);CO(()=>(fe.current=!0,()=>{fe.current=!1}),[]),CO(()=>{if(M&&($.current=M),F&&(L.current=F),M&&F){if(ne.current)return ne.current(M,F,te);te()}},[M,F,te,ne,X]);const q=m.useMemo(()=>({reference:$,floating:L,setReference:P,setFloating:T}),[P,T]),se=m.useMemo(()=>({reference:M,floating:F}),[M,F]),ae=m.useMemo(()=>{const W={position:n,left:0,top:0};if(!se.floating)return W;const V=khe(se.floating,d.x),ee=khe(se.floating,d.y);return l?{...W,transform:"translate("+V+"px, "+ee+"px)",...A7e(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:ee}},[n,l,se.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:te,refs:q,elements:se,floatingStyles:ae}),[d,te,q,se,ae])}const j7e=(t,e)=>({...v7e(t),options:[t,e]}),rtt=(t,e)=>({...w7e(t),options:[t,e]}),stt=(t,e)=>({...C7e(t),options:[t,e]}),itt=(t,e)=>({...S7e(t),options:[t,e]}),E7e={...Wy},att=E7e.useInsertionEffect,ott=att||(t=>t());function _7e(t){const e=m.useRef(()=>{});return ott(()=>{e.current=t}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}var KZ=typeof document<"u"?m.useLayoutEffect:m.useEffect;let The=!1,ltt=0;const Phe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ltt++;function ctt(){const[t,e]=m.useState(()=>The?Phe():void 0);return KZ(()=>{t==null&&e(Phe())},[]),m.useEffect(()=>{The=!0},[]),t}const utt=E7e.useId,dtt=utt||ctt;function ftt(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(s=>s(n))},on(e,n){t.set(e,[...t.get(e)||[],n])},off(e,n){var r;t.set(e,((r=t.get(e))==null?void 0:r.filter(s=>s!==n))||[])}}}const htt=m.createContext(null),ptt=m.createContext(null),mtt=()=>{var t;return((t=m.useContext(htt))==null?void 0:t.id)||null},xtt=()=>m.useContext(ptt),gtt="data-floating-ui-focusable";function btt(t){const{open:e=!1,onOpenChange:n,elements:r}=t,s=dtt(),a=m.useRef({}),[o]=m.useState(()=>ftt()),l=mtt()!=null,[c,u]=m.useState(r.reference),d=_7e((g,y,v)=>{a.current.openEvent=g?y:void 0,o.emit("openchange",{open:g,event:y,reason:v,nested:l}),n==null||n(g,y,v)}),f=m.useMemo(()=>({setPositionReference:u}),[]),x=m.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return m.useMemo(()=>({dataRef:a,open:e,onOpenChange:d,elements:x,events:o,floatingId:s,refs:f}),[e,d,x,o,s,f])}function ytt(t){t===void 0&&(t={});const{nodeId:e}=t,n=btt({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,s=r.elements,[a,o]=m.useState(null),[l,c]=m.useState(null),d=(s==null?void 0:s.reference)||a,f=m.useRef(null),x=xtt();KZ(()=>{d&&(f.current=d)},[d]);const g=ntt({...t,elements:{...s,...l&&{reference:l}}}),y=m.useCallback(T=>{const M=ud(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;c(M),g.refs.setReference(M)},[g.refs]),v=m.useCallback(T=>{(ud(T)||T===null)&&(f.current=T,o(T)),(ud(g.refs.reference.current)||g.refs.reference.current===null||T!==null&&!ud(T))&&g.refs.setReference(T)},[g.refs]),C=m.useMemo(()=>({...g.refs,setReference:v,setPositionReference:y,domReference:f}),[g.refs,v,y]),N=m.useMemo(()=>({...g.elements,domReference:d}),[g.elements,d]),P=m.useMemo(()=>({...g,...r,refs:C,elements:N,nodeId:e}),[g,C,N,e,r]);return KZ(()=>{r.dataRef.current.floatingContext=P;const T=x==null?void 0:x.nodesRef.current.find(M=>M.id===e);T&&(T.context=P)}),m.useMemo(()=>({...g,context:P,refs:C,elements:N}),[g,C,N,P])}const Ihe="active",Fhe="selected";function jH(t,e,n){const r=new Map,s=n==="item";let a=t;if(s&&t){const{[Ihe]:o,[Fhe]:l,...c}=t;a=c}return{...n==="floating"&&{tabIndex:-1,[gtt]:""},...a,...e.map(o=>{const l=o?o[n]:null;return typeof l=="function"?t?l(t):null:l}).concat(t).reduce((o,l)=>(l&&Object.entries(l).forEach(c=>{let[u,d]=c;if(!(s&&[Ihe,Fhe].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof d=="function"){var f;(f=r.get(u))==null||f.push(d),o[u]=function(){for(var x,g=arguments.length,y=new Array(g),v=0;v<g;v++)y[v]=arguments[v];return(x=r.get(u))==null?void 0:x.map(C=>C(...y)).find(C=>C!==void 0)}}}else o[u]=d}),o),{})}}function vtt(t){t===void 0&&(t=[]);const e=t.map(l=>l==null?void 0:l.reference),n=t.map(l=>l==null?void 0:l.floating),r=t.map(l=>l==null?void 0:l.item),s=m.useCallback(l=>jH(l,t,"reference"),e),a=m.useCallback(l=>jH(l,t,"floating"),n),o=m.useCallback(l=>jH(l,t,"item"),r);return m.useMemo(()=>({getReferenceProps:s,getFloatingProps:a,getItemProps:o}),[s,a,o])}function Ohe(t,e){return{...t,rects:{...t.rects,floating:{...t.rects.floating,height:e}}}}const wtt=t=>({name:"inner",options:t,async fn(e){const{listRef:n,overflowRef:r,onFallbackChange:s,offset:a=0,index:o=0,minItemsVisible:l=4,referenceOverflowThreshold:c=0,scrollRef:u,...d}=rx(t,e),{rects:f,elements:{floating:x}}=e,g=n.current[o],y=(u==null?void 0:u.current)||x,v=x.clientTop||y.clientTop,C=x.clientTop!==0,N=y.clientTop!==0,P=x===y;if(!g)return{};const T={...e,...await j7e(-g.offsetTop-x.clientTop-f.reference.height/2-g.offsetHeight/2-a).fn(e)},M=await NH(Ohe(T,y.scrollHeight+v+x.clientTop),d),F=await NH(T,{...d,elementContext:"reference"}),$=Tu(0,M.top),L=T.y+$,z=y.scrollHeight>y.clientHeight,ne=(z?J=>J:aE)(Tu(0,y.scrollHeight+(C&&P||N?v*2:0)-$-Tu(0,M.bottom)));if(y.style.maxHeight=ne+"px",y.scrollTop=$,s){const J=z&&y.offsetHeight<g.offsetHeight*l-1||F.top>=-c||F.bottom>=-c;Aa.flushSync(()=>s(J))}return r&&(r.current=await NH(Ohe({...T,y:L},y.offsetHeight+v+x.clientTop),d)),{y:L}}});function Ctt(t,e){const{open:n,elements:r}=t,{enabled:s=!0,overflowRef:a,scrollRef:o,onChange:l}=e,c=_7e(l),u=m.useRef(!1),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!s)return;function g(v){if(v.ctrlKey||!y||a.current==null)return;const C=v.deltaY,N=a.current.top>=-.5,P=a.current.bottom>=-.5,T=y.scrollHeight-y.clientHeight,M=C<0?-1:1,F=C<0?"max":"min";y.scrollHeight<=y.clientHeight||(!N&&C>0||!P&&C<0?(v.preventDefault(),Aa.flushSync(()=>{c($=>$+Math[F](C,T*M))})):/firefox/i.test(vet())&&(y.scrollTop+=C))}const y=(o==null?void 0:o.current)||r.floating;if(n&&y)return y.addEventListener("wheel",g),requestAnimationFrame(()=>{d.current=y.scrollTop,a.current!=null&&(f.current={...a.current})}),()=>{d.current=null,f.current=null,y.removeEventListener("wheel",g)}},[s,n,r.floating,a,o,c]);const x=m.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const g=(o==null?void 0:o.current)||r.floating;if(!(!a.current||!g||!u.current)){if(d.current!==null){const y=g.scrollTop-d.current;(a.current.bottom<-.5&&y<-1||a.current.top<-.5&&y>1)&&Aa.flushSync(()=>c(v=>v+y))}requestAnimationFrame(()=>{d.current=g.scrollTop})}}}),[r.floating,c,a,o]);return m.useMemo(()=>s?{floating:x}:{},[s,x])}let FA=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});FA.displayName="FloatingContext";let bie=m.createContext(null);bie.displayName="PlacementContext";function Stt(t){return m.useMemo(()=>t?typeof t=="string"?{to:t}:t:null,[t])}function Ntt(){return m.useContext(FA).setReference}function Att(){return m.useContext(FA).getReferenceProps}function jtt(){let{getFloatingProps:t,slot:e}=m.useContext(FA);return m.useCallback((...n)=>Object.assign({},t(...n),{"data-anchor":e.anchor}),[t,e])}function Ett(t=null){t===!1&&(t=null),typeof t=="string"&&(t={to:t});let e=m.useContext(bie),n=m.useMemo(()=>t,[JSON.stringify(t,(s,a)=>{var o;return(o=a==null?void 0:a.outerHTML)!=null?o:a})]);eo(()=>{e==null||e(n??null)},[e,n]);let r=m.useContext(FA);return m.useMemo(()=>[r.setFloating,t?r.styles:{}],[r.setFloating,t,r.styles])}let Mhe=4;function _tt({children:t,enabled:e=!0}){let[n,r]=m.useState(null),[s,a]=m.useState(0),o=m.useRef(null),[l,c]=m.useState(null);ktt(l);let u=e&&n!==null&&l!==null,{to:d="bottom",gap:f=0,offset:x=0,padding:g=0,inner:y}=Ttt(n,l),[v,C="center"]=d.split(" ");eo(()=>{u&&a(0)},[u]);let{refs:N,floatingStyles:P,context:T}=ytt({open:u,placement:v==="selection"?C==="center"?"bottom":`bottom-${C}`:C==="center"?`${v}`:`${v}-${C}`,strategy:"absolute",transform:!1,middleware:[j7e({mainAxis:v==="selection"?0:f,crossAxis:x}),rtt({padding:g}),v!=="selection"&&stt({padding:g}),v==="selection"&&y?wtt({...y,padding:g,overflowRef:o,offset:s,minItemsVisible:Mhe,referenceOverflowThreshold:g,onFallbackChange(J){var K,te;if(!J)return;let fe=T.elements.floating;if(!fe)return;let q=parseFloat(getComputedStyle(fe).scrollPaddingBottom)||0,se=Math.min(Mhe,fe.childElementCount),ae=0,W=0;for(let V of(te=(K=T.elements.floating)==null?void 0:K.childNodes)!=null?te:[])if(V instanceof HTMLElement){let ee=V.offsetTop,oe=ee+V.clientHeight+q,de=fe.scrollTop,Ce=de+fe.clientHeight;if(ee>=de&&oe<=Ce)se--;else{W=Math.max(0,Math.min(oe,Ce)-Math.max(ee,de)),ae=V.clientHeight;break}}se>=1&&a(V=>{let ee=ae*se-W+q;return V>=ee?V:ee})}}):null,itt({padding:g,apply({availableWidth:J,availableHeight:K,elements:te}){Object.assign(te.floating.style,{overflow:"auto",maxWidth:`${J}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${K}px)`})}})].filter(Boolean),whileElementsMounted:y7e}),[M=v,F=C]=T.placement.split("-");v==="selection"&&(M="selection");let $=m.useMemo(()=>({anchor:[M,F].filter(Boolean).join(" ")}),[M,F]),L=Ctt(T,{overflowRef:o,onChange:a}),{getReferenceProps:z,getFloatingProps:X}=vtt([L]),ne=Hs(J=>{c(J),N.setFloating(J)});return m.createElement(bie.Provider,{value:r},m.createElement(FA.Provider,{value:{setFloating:ne,setReference:N.setReference,styles:P,getReferenceProps:z,getFloatingProps:X,slot:$}},t))}function ktt(t){eo(()=>{if(!t)return;let e=new MutationObserver(()=>{let n=window.getComputedStyle(t).maxHeight,r=parseFloat(n);if(isNaN(r))return;let s=parseInt(n);isNaN(s)||r!==s&&(t.style.maxHeight=`${Math.ceil(r)}px`)});return e.observe(t,{attributes:!0,attributeFilter:["style"]}),()=>{e.disconnect()}},[t])}function Ttt(t,e){var n,r,s;let a=EH((n=t==null?void 0:t.gap)!=null?n:"var(--anchor-gap, 0)",e),o=EH((r=t==null?void 0:t.offset)!=null?r:"var(--anchor-offset, 0)",e),l=EH((s=t==null?void 0:t.padding)!=null?s:"var(--anchor-padding, 0)",e);return{...t,gap:a,offset:o,padding:l}}function EH(t,e,n=void 0){let r=v2(),s=Hs((c,u)=>{if(c==null)return[n,null];if(typeof c=="number")return[c,null];if(typeof c=="string"){if(!u)return[n,null];let d=Rhe(c,u);return[d,f=>{let x=k7e(c);{let g=x.map(y=>window.getComputedStyle(u).getPropertyValue(y));r.requestAnimationFrame(function y(){r.nextFrame(y);let v=!1;for(let[N,P]of x.entries()){let T=window.getComputedStyle(u).getPropertyValue(P);if(g[N]!==T){g[N]=T,v=!0;break}}if(!v)return;let C=Rhe(c,u);d!==C&&(f(C),d=C)})}return r.dispose}]}return[n,null]}),a=m.useMemo(()=>s(t,e)[0],[t,e]),[o=a,l]=m.useState();return eo(()=>{let[c,u]=s(t,e);if(l(c),!!u)return u(l)},[t,e]),o}function k7e(t){let e=/var\((.*)\)/.exec(t);if(e){let n=e[1].indexOf(",");if(n===-1)return[e[1]];let r=e[1].slice(0,n).trim(),s=e[1].slice(n+1).trim();return s?[r,...k7e(s)]:[r]}return[]}function Rhe(t,e){let n=document.createElement("div");e.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",t,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return e.removeChild(n),r}let EB=m.createContext(null);EB.displayName="OpenClosedContext";var ic=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(ic||{});function OA(){return m.useContext(EB)}function yie({value:t,children:e}){return Ne.createElement(EB.Provider,{value:t},e)}function T7e({children:t}){return Ne.createElement(EB.Provider,{value:null},t)}function Ptt(t){function e(){document.readyState!=="loading"&&(t(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let qb=[];Ptt(()=>{function t(e){if(!(e.target instanceof HTMLElement)||e.target===document.body||qb[0]===e.target)return;let n=e.target;n=n.closest(RM),qb.unshift(n??e.target),qb=qb.filter(r=>r!=null&&r.isConnected),qb.splice(10)}window.addEventListener("click",t,{capture:!0}),window.addEventListener("mousedown",t,{capture:!0}),window.addEventListener("focus",t,{capture:!0}),document.body.addEventListener("click",t,{capture:!0}),document.body.addEventListener("mousedown",t,{capture:!0}),document.body.addEventListener("focus",t,{capture:!0})});function Itt(t){throw new Error("Unexpected object: "+t)}var Ou=(t=>(t[t.First=0]="First",t[t.Previous=1]="Previous",t[t.Next=2]="Next",t[t.Last=3]="Last",t[t.Specific=4]="Specific",t[t.Nothing=5]="Nothing",t))(Ou||{});function _H(t,e){let n=e.resolveItems();if(n.length<=0)return null;let r=e.resolveActiveIndex(),s=r??-1;switch(t.focus){case 0:{for(let a=0;a<n.length;++a)if(!e.resolveDisabled(n[a],a,n))return a;return r}case 1:{s===-1&&(s=n.length);for(let a=s-1;a>=0;--a)if(!e.resolveDisabled(n[a],a,n))return a;return r}case 2:{for(let a=s+1;a<n.length;++a)if(!e.resolveDisabled(n[a],a,n))return a;return r}case 3:{for(let a=n.length-1;a>=0;--a)if(!e.resolveDisabled(n[a],a,n))return a;return r}case 4:{for(let a=0;a<n.length;++a)if(e.resolveId(n[a],a,n)===t.id)return a;return r}case 5:return null;default:Itt(t)}}function P7e(t){let e=Hs(t),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,wB(()=>{n.current&&e()})}),[e])}function Ftt(){let t=typeof document>"u";return"useSyncExternalStore"in Wy?(e=>e.useSyncExternalStore)(Wy)(()=>()=>{},()=>!1,()=>!t):!1}function nT(){let t=Ftt(),[e,n]=m.useState(o3.isHandoffComplete);return e&&o3.isHandoffComplete===!1&&n(!1),m.useEffect(()=>{e!==!0&&n(!0)},[e]),m.useEffect(()=>o3.handoff(),[]),t?!1:e}let I7e=m.createContext(!1);function Ott(){return m.useContext(I7e)}function Lhe(t){return Ne.createElement(I7e.Provider,{value:t.force},t.children)}function Mtt(t){let e=Ott(),n=m.useContext(O7e),r=TA(t),[s,a]=m.useState(()=>{var o;if(!e&&n!==null)return(o=n.current)!=null?o:null;if(o3.isServer)return null;let l=r==null?void 0:r.getElementById("headlessui-portal-root");if(l)return l;if(r===null)return null;let c=r.createElement("div");return c.setAttribute("id","headlessui-portal-root"),r.body.appendChild(c)});return m.useEffect(()=>{s!==null&&(r!=null&&r.body.contains(s)||r==null||r.body.appendChild(s))},[s,r]),m.useEffect(()=>{e||n!==null&&a(n.current)},[n,a,e]),s}let F7e=m.Fragment,Rtt=mo(function(t,e){let n=t,r=m.useRef(null),s=dc(Y8e(f=>{r.current=f}),e),a=TA(r),o=Mtt(r),[l]=m.useState(()=>{var f;return o3.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),c=m.useContext(YZ),u=nT();eo(()=>{!o||!l||o.contains(l)||(l.setAttribute("data-headlessui-portal",""),o.appendChild(l))},[o,l]),eo(()=>{if(l&&c)return c.register(l)},[c,l]),P7e(()=>{var f;!o||!l||(l instanceof Node&&o.contains(l)&&o.removeChild(l),o.childNodes.length<=0&&((f=o.parentElement)==null||f.removeChild(o)))});let d=_o();return u?!o||!l?null:Aa.createPortal(d({ourProps:{ref:s},theirProps:n,slot:{},defaultTag:F7e,name:"Portal"}),l):null});function Ltt(t,e){let n=dc(e),{enabled:r=!0,...s}=t,a=_o();return r?Ne.createElement(Rtt,{...s,ref:n}):a({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:F7e,name:"Portal"})}let Dtt=m.Fragment,O7e=m.createContext(null);function Btt(t,e){let{target:n,...r}=t,s={ref:dc(e)},a=_o();return Ne.createElement(O7e.Provider,{value:n},a({ourProps:s,theirProps:r,defaultTag:Dtt,name:"Popover.Group"}))}let YZ=m.createContext(null);function $tt(){let t=m.useContext(YZ),e=m.useRef([]),n=Hs(a=>(e.current.push(a),t&&t.register(a),()=>r(a))),r=Hs(a=>{let o=e.current.indexOf(a);o!==-1&&e.current.splice(o,1),t&&t.unregister(a)}),s=m.useMemo(()=>({register:n,unregister:r,portals:e}),[n,r,e]);return[e,m.useMemo(()=>function({children:a}){return Ne.createElement(YZ.Provider,{value:s},a)},[s])]}let Utt=mo(Ltt),M7e=mo(Btt),R7e=Object.assign(Utt,{Group:M7e});function ztt(t,e=typeof document<"u"?document.defaultView:null,n){let r=kA(t,"escape");u7e(e,"keydown",s=>{r&&(s.defaultPrevented||s.key===wo.Escape&&n(s))})}function Htt(){var t;let[e]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,r]=m.useState((t=e==null?void 0:e.matches)!=null?t:!1);return eo(()=>{if(!e)return;function s(a){r(a.matches)}return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[e]),n}function Vtt({defaultContainers:t=[],portals:e,mainTreeNode:n}={}){let r=TA(n),s=Hs(()=>{var a,o;let l=[];for(let c of t)c!==null&&(c instanceof HTMLElement?l.push(c):"current"in c&&c.current instanceof HTMLElement&&l.push(c.current));if(e!=null&&e.current)for(let c of e.current)l.push(c);for(let c of(a=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?a:[])c!==document.body&&c!==document.head&&c instanceof HTMLElement&&c.id!=="headlessui-portal-root"&&(n&&(c.contains(n)||c.contains((o=n==null?void 0:n.getRootNode())==null?void 0:o.host))||l.some(u=>c.contains(u))||l.push(c));return l});return{resolveContainers:s,contains:Hs(a=>s().some(o=>o.contains(a)))}}let L7e=m.createContext(null);function Dhe({children:t,node:e}){let[n,r]=m.useState(null),s=D7e(e??n);return Ne.createElement(L7e.Provider,{value:s},t,s===null&&Ne.createElement(sE,{features:GS.Hidden,ref:a=>{var o,l;if(a){for(let c of(l=(o=y2(a))==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&c instanceof HTMLElement&&c!=null&&c.contains(a)){r(c);break}}}}))}function D7e(t=null){var e;return(e=m.useContext(L7e))!=null?e:t}function vie(){let t=m.useRef(!1);return eo(()=>(t.current=!0,()=>{t.current=!1}),[]),t}var D7=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(D7||{});function Wtt(){let t=m.useRef(0);return l7e(!0,"keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}function B7e(t){if(!t)return new Set;if(typeof t=="function")return new Set(t());let e=new Set;for(let n of t.current)n.current instanceof HTMLElement&&e.add(n.current);return e}let qtt="div";var Zv=(t=>(t[t.None=0]="None",t[t.InitialFocus=1]="InitialFocus",t[t.TabLock=2]="TabLock",t[t.FocusLock=4]="FocusLock",t[t.RestoreFocus=8]="RestoreFocus",t[t.AutoFocus=16]="AutoFocus",t))(Zv||{});function Gtt(t,e){let n=m.useRef(null),r=dc(n,e),{initialFocus:s,initialFocusFallback:a,containers:o,features:l=15,...c}=t;nT()||(l=0);let u=TA(n);Qtt(l,{ownerDocument:u});let d=Ztt(l,{ownerDocument:u,container:n,initialFocus:s,initialFocusFallback:a});Jtt(l,{ownerDocument:u,container:n,containers:o,previousActiveElement:d});let f=Wtt(),x=Hs(P=>{let T=n.current;T&&(M=>M())(()=>{rh(f.current,{[D7.Forwards]:()=>{g4(T,um.First,{skipElements:[P.relatedTarget,a]})},[D7.Backwards]:()=>{g4(T,um.Last,{skipElements:[P.relatedTarget,a]})}})})}),g=kA(!!(l&2),"focus-trap#tab-lock"),y=v2(),v=m.useRef(!1),C={ref:r,onKeyDown(P){P.key=="Tab"&&(v.current=!0,y.requestAnimationFrame(()=>{v.current=!1}))},onBlur(P){if(!(l&4))return;let T=B7e(o);n.current instanceof HTMLElement&&T.add(n.current);let M=P.relatedTarget;M instanceof HTMLElement&&M.dataset.headlessuiFocusGuard!=="true"&&($7e(T,M)||(v.current?g4(n.current,rh(f.current,{[D7.Forwards]:()=>um.Next,[D7.Backwards]:()=>um.Previous})|um.WrapAround,{relativeTo:P.target}):P.target instanceof HTMLElement&&V0(P.target)))}},N=_o();return Ne.createElement(Ne.Fragment,null,g&&Ne.createElement(sE,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:GS.Focusable}),N({ourProps:C,theirProps:c,defaultTag:qtt,name:"FocusTrap"}),g&&Ne.createElement(sE,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:GS.Focusable}))}let Ktt=mo(Gtt),Ytt=Object.assign(Ktt,{features:Zv});function Xtt(t=!0){let e=m.useRef(qb.slice());return die(([n],[r])=>{r===!0&&n===!1&&wB(()=>{e.current.splice(0)}),r===!1&&n===!0&&(e.current=qb.slice())},[t,qb,e]),Hs(()=>{var n;return(n=e.current.find(r=>r!=null&&r.isConnected))!=null?n:null})}function Qtt(t,{ownerDocument:e}){let n=!!(t&8),r=Xtt(n);die(()=>{n||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&V0(r())},[n]),P7e(()=>{n&&V0(r())})}function Ztt(t,{ownerDocument:e,container:n,initialFocus:r,initialFocusFallback:s}){let a=m.useRef(null),o=kA(!!(t&1),"focus-trap#initial-focus"),l=vie();return die(()=>{if(t===0)return;if(!o){s!=null&&s.current&&V0(s.current);return}let c=n.current;c&&wB(()=>{if(!l.current)return;let u=e==null?void 0:e.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===u){a.current=u;return}}else if(c.contains(u)){a.current=u;return}if(r!=null&&r.current)V0(r.current);else{if(t&16){if(g4(c,um.First|um.AutoFocus)!==HZ.Error)return}else if(g4(c,um.First)!==HZ.Error)return;if(s!=null&&s.current&&(V0(s.current),(e==null?void 0:e.activeElement)===s.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=e==null?void 0:e.activeElement})},[s,o,t]),a}function Jtt(t,{ownerDocument:e,container:n,containers:r,previousActiveElement:s}){let a=vie(),o=!!(t&4);u7e(e==null?void 0:e.defaultView,"focus",l=>{if(!o||!a.current)return;let c=B7e(r);n.current instanceof HTMLElement&&c.add(n.current);let u=s.current;if(!u)return;let d=l.target;d&&d instanceof HTMLElement?$7e(c,d)?(s.current=d,V0(d)):(l.preventDefault(),l.stopPropagation(),V0(u)):V0(s.current)},!0)}function $7e(t,e){for(let n of t)if(n.contains(e))return!0;return!1}function U7e(t){var e;return!!(t.enter||t.enterFrom||t.enterTo||t.leave||t.leaveFrom||t.leaveTo)||((e=t.as)!=null?e:H7e)!==m.Fragment||Ne.Children.count(t.children)===1}let _B=m.createContext(null);_B.displayName="TransitionContext";var ent=(t=>(t.Visible="visible",t.Hidden="hidden",t))(ent||{});function tnt(){let t=m.useContext(_B);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function nnt(){let t=m.useContext(kB);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let kB=m.createContext(null);kB.displayName="NestingContext";function TB(t){return"children"in t?TB(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function z7e(t,e){let n=C5(t),r=m.useRef([]),s=vie(),a=v2(),o=Hs((g,y=Ny.Hidden)=>{let v=r.current.findIndex(({el:C})=>C===g);v!==-1&&(rh(y,{[Ny.Unmount](){r.current.splice(v,1)},[Ny.Hidden](){r.current[v].state="hidden"}}),a.microTask(()=>{var C;!TB(r)&&s.current&&((C=n.current)==null||C.call(n))}))}),l=Hs(g=>{let y=r.current.find(({el:v})=>v===g);return y?y.state!=="visible"&&(y.state="visible"):r.current.push({el:g,state:"visible"}),()=>o(g,Ny.Unmount)}),c=m.useRef([]),u=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[]}),f=Hs((g,y,v)=>{c.current.splice(0),e&&(e.chains.current[y]=e.chains.current[y].filter(([C])=>C!==g)),e==null||e.chains.current[y].push([g,new Promise(C=>{c.current.push(C)})]),e==null||e.chains.current[y].push([g,new Promise(C=>{Promise.all(d.current[y].map(([N,P])=>P)).then(()=>C())})]),y==="enter"?u.current=u.current.then(()=>e==null?void 0:e.wait.current).then(()=>v(y)):v(y)}),x=Hs((g,y,v)=>{Promise.all(d.current[y].splice(0).map(([C,N])=>N)).then(()=>{var C;(C=c.current.shift())==null||C()}).then(()=>v(y))});return m.useMemo(()=>({children:r,register:l,unregister:o,onStart:f,onStop:x,wait:u,chains:d}),[l,o,r,f,x,d,u])}let H7e=m.Fragment,V7e=qy.RenderStrategy;function rnt(t,e){var n,r;let{transition:s=!0,beforeEnter:a,afterEnter:o,beforeLeave:l,afterLeave:c,enter:u,enterFrom:d,enterTo:f,entered:x,leave:g,leaveFrom:y,leaveTo:v,...C}=t,[N,P]=m.useState(null),T=m.useRef(null),M=U7e(t),F=dc(...M?[T,e,P]:e===null?[]:[e]),$=(n=C.unmount)==null||n?Ny.Unmount:Ny.Hidden,{show:L,appear:z,initial:X}=tnt(),[ne,J]=m.useState(L?"visible":"hidden"),K=nnt(),{register:te,unregister:fe}=K;eo(()=>te(T),[te,T]),eo(()=>{if($===Ny.Hidden&&T.current){if(L&&ne!=="visible"){J("visible");return}return rh(ne,{hidden:()=>fe(T),visible:()=>te(T)})}},[ne,T,te,fe,L,$]);let q=nT();eo(()=>{if(M&&q&&ne==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,ne,q,M]);let se=X&&!z,ae=z&&L&&X,W=m.useRef(!1),V=z7e(()=>{W.current||(J("hidden"),fe(T))},K),ee=Hs(be=>{W.current=!0;let je=be?"enter":"leave";V.onStart(T,je,Ie=>{Ie==="enter"?a==null||a():Ie==="leave"&&(l==null||l())})}),oe=Hs(be=>{let je=be?"enter":"leave";W.current=!1,V.onStop(T,je,Ie=>{Ie==="enter"?o==null||o():Ie==="leave"&&(c==null||c())}),je==="leave"&&!TB(V)&&(J("hidden"),fe(T))});m.useEffect(()=>{M&&s||(ee(L),oe(L))},[L,M,s]);let de=!(!s||!M||!q||se),[,Ce]=uie(de,N,L,{start:ee,end:oe}),me=Hb({ref:F,className:((r=UZ(C.className,ae&&u,ae&&d,Ce.enter&&u,Ce.enter&&Ce.closed&&d,Ce.enter&&!Ce.closed&&f,Ce.leave&&g,Ce.leave&&!Ce.closed&&y,Ce.leave&&Ce.closed&&v,!Ce.transition&&L&&x))==null?void 0:r.trim())||void 0,...cie(Ce)}),we=0;ne==="visible"&&(we|=ic.Open),ne==="hidden"&&(we|=ic.Closed),Ce.enter&&(we|=ic.Opening),Ce.leave&&(we|=ic.Closing);let xe=_o();return Ne.createElement(kB.Provider,{value:V},Ne.createElement(yie,{value:we},xe({ourProps:me,theirProps:C,defaultTag:H7e,features:V7e,visible:ne==="visible",name:"Transition.Child"})))}function snt(t,e){let{show:n,appear:r=!1,unmount:s=!0,...a}=t,o=m.useRef(null),l=U7e(t),c=dc(...l?[o,e]:e===null?[]:[e]);nT();let u=OA();if(n===void 0&&u!==null&&(n=(u&ic.Open)===ic.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=m.useState(n?"visible":"hidden"),x=z7e(()=>{n||f("hidden")}),[g,y]=m.useState(!0),v=m.useRef([n]);eo(()=>{g!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),y(!1))},[v,n]);let C=m.useMemo(()=>({show:n,appear:r,initial:g}),[n,r,g]);eo(()=>{n?f("visible"):!TB(x)&&o.current!==null&&f("hidden")},[n,x]);let N={unmount:s},P=Hs(()=>{var F;g&&y(!1),(F=t.beforeEnter)==null||F.call(t)}),T=Hs(()=>{var F;g&&y(!1),(F=t.beforeLeave)==null||F.call(t)}),M=_o();return Ne.createElement(kB.Provider,{value:x},Ne.createElement(_B.Provider,{value:C},M({ourProps:{...N,as:m.Fragment,children:Ne.createElement(W7e,{ref:c,...N,...a,beforeEnter:P,beforeLeave:T})},theirProps:{},defaultTag:m.Fragment,features:V7e,visible:d==="visible",name:"Transition"})))}function int(t,e){let n=m.useContext(_B)!==null,r=OA()!==null;return Ne.createElement(Ne.Fragment,null,!n&&r?Ne.createElement(XZ,{ref:e,...t}):Ne.createElement(W7e,{ref:e,...t}))}let XZ=mo(snt),W7e=mo(rnt),wie=mo(int),q7e=Object.assign(XZ,{Child:wie,Root:XZ});var ant=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(ant||{}),ont=(t=>(t[t.SetTitleId=0]="SetTitleId",t))(ont||{});let lnt={0(t,e){return t.titleId===e.id?t:{...t,titleId:e.id}}},Cie=m.createContext(null);Cie.displayName="DialogContext";function PB(t){let e=m.useContext(Cie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,PB),n}return e}function cnt(t,e){return rh(e.type,lnt,t,e)}let Bhe=mo(function(t,e){let n=m.useId(),{id:r=`headlessui-dialog-${n}`,open:s,onClose:a,initialFocus:o,role:l="dialog",autoFocus:c=!0,__demoMode:u=!1,unmount:d=!1,...f}=t,x=m.useRef(!1);l=function(){return l==="dialog"||l==="alertdialog"?l:(x.current||(x.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let g=OA();s===void 0&&g!==null&&(s=(g&ic.Open)===ic.Open);let y=m.useRef(null),v=dc(y,e),C=TA(y),N=s?0:1,[P,T]=m.useReducer(cnt,{titleId:null,descriptionId:null,panelRef:m.createRef()}),M=Hs(()=>a(!1)),F=Hs(oe=>T({type:0,id:oe})),$=nT()?N===0:!1,[L,z]=$tt(),X={get current(){var oe;return(oe=P.panelRef.current)!=null?oe:y.current}},ne=D7e(),{resolveContainers:J}=Vtt({mainTreeNode:ne,portals:L,defaultContainers:[X]}),K=g!==null?(g&ic.Closing)===ic.Closing:!1;n7e(u||K?!1:$,{allowed:Hs(()=>{var oe,de;return[(de=(oe=y.current)==null?void 0:oe.closest("[data-headlessui-portal]"))!=null?de:null]}),disallowed:Hs(()=>{var oe;return[(oe=ne==null?void 0:ne.closest("body > *:not(#headlessui-portal-root)"))!=null?oe:null]})}),c7e($,J,oe=>{oe.preventDefault(),M()}),ztt($,C==null?void 0:C.defaultView,oe=>{oe.preventDefault(),oe.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),M()}),d7e(u||K?!1:$,C,J),r7e($,y,M);let[te,fe]=rie(),q=m.useMemo(()=>[{dialogState:N,close:M,setTitleId:F,unmount:d},P],[N,P,M,F,d]),se=m.useMemo(()=>({open:N===0}),[N]),ae={ref:v,id:r,role:l,tabIndex:-1,"aria-modal":u?void 0:N===0?!0:void 0,"aria-labelledby":P.titleId,"aria-describedby":te,unmount:d},W=!Htt(),V=Zv.None;$&&!u&&(V|=Zv.RestoreFocus,V|=Zv.TabLock,c&&(V|=Zv.AutoFocus),W&&(V|=Zv.InitialFocus));let ee=_o();return Ne.createElement(T7e,null,Ne.createElement(Lhe,{force:!0},Ne.createElement(R7e,null,Ne.createElement(Cie.Provider,{value:q},Ne.createElement(M7e,{target:y},Ne.createElement(Lhe,{force:!1},Ne.createElement(fe,{slot:se},Ne.createElement(z,null,Ne.createElement(Ytt,{initialFocus:o,initialFocusFallback:y,containers:J,features:V},Ne.createElement(J8e,{value:M},ee({ourProps:ae,theirProps:f,slot:se,defaultTag:unt,features:dnt,visible:N===0,name:"Dialog"})))))))))))}),unt="div",dnt=qy.RenderStrategy|qy.Static;function fnt(t,e){let{transition:n=!1,open:r,...s}=t,a=OA(),o=t.hasOwnProperty("open")||a!==null,l=t.hasOwnProperty("onClose");if(!o&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof t.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${t.open}`);if(typeof t.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${t.onClose}`);return(r!==void 0||n)&&!s.static?Ne.createElement(Dhe,null,Ne.createElement(q7e,{show:r,transition:n,unmount:s.unmount},Ne.createElement(Bhe,{ref:e,...s}))):Ne.createElement(Dhe,null,Ne.createElement(Bhe,{ref:e,open:r,...s}))}let hnt="div";function pnt(t,e){let n=m.useId(),{id:r=`headlessui-dialog-panel-${n}`,transition:s=!1,...a}=t,[{dialogState:o,unmount:l},c]=PB("Dialog.Panel"),u=dc(e,c.panelRef),d=m.useMemo(()=>({open:o===0}),[o]),f=Hs(C=>{C.stopPropagation()}),x={ref:u,id:r,onClick:f},g=s?wie:m.Fragment,y=s?{unmount:l}:{},v=_o();return Ne.createElement(g,{...y},v({ourProps:x,theirProps:a,slot:d,defaultTag:hnt,name:"Dialog.Panel"}))}let mnt="div";function xnt(t,e){let{transition:n=!1,...r}=t,[{dialogState:s,unmount:a}]=PB("Dialog.Backdrop"),o=m.useMemo(()=>({open:s===0}),[s]),l={ref:e,"aria-hidden":!0},c=n?wie:m.Fragment,u=n?{unmount:a}:{},d=_o();return Ne.createElement(c,{...u},d({ourProps:l,theirProps:r,slot:o,defaultTag:mnt,name:"Dialog.Backdrop"}))}let gnt="h2";function bnt(t,e){let n=m.useId(),{id:r=`headlessui-dialog-title-${n}`,...s}=t,[{dialogState:a,setTitleId:o}]=PB("Dialog.Title"),l=dc(e);m.useEffect(()=>(o(r),()=>o(null)),[r,o]);let c=m.useMemo(()=>({open:a===0}),[a]),u={ref:l,id:r};return _o()({ourProps:u,theirProps:s,slot:c,defaultTag:gnt,name:"Dialog.Title"})}let ynt=mo(fnt),ya=mo(pnt),Ea=mo(xnt),vnt=mo(bnt),_a=Object.assign(ynt,{Panel:ya,Title:vnt,Description:Q8e});var $he;let wnt=($he=Ne.startTransition)!=null?$he:function(t){t()};var Cnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Cnt||{}),Snt=(t=>(t[t.ToggleDisclosure=0]="ToggleDisclosure",t[t.CloseDisclosure=1]="CloseDisclosure",t[t.SetButtonId=2]="SetButtonId",t[t.SetPanelId=3]="SetPanelId",t[t.SetButtonElement=4]="SetButtonElement",t[t.SetPanelElement=5]="SetPanelElement",t))(Snt||{});let Nnt={0:t=>({...t,disclosureState:rh(t.disclosureState,{0:1,1:0})}),1:t=>t.disclosureState===1?t:{...t,disclosureState:1},2(t,e){return t.buttonId===e.buttonId?t:{...t,buttonId:e.buttonId}},3(t,e){return t.panelId===e.panelId?t:{...t,panelId:e.panelId}},4(t,e){return t.buttonElement===e.element?t:{...t,buttonElement:e.element}},5(t,e){return t.panelElement===e.element?t:{...t,panelElement:e.element}}},Sie=m.createContext(null);Sie.displayName="DisclosureContext";function Nie(t){let e=m.useContext(Sie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nie),n}return e}let Aie=m.createContext(null);Aie.displayName="DisclosureAPIContext";function G7e(t){let e=m.useContext(Aie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,G7e),n}return e}let jie=m.createContext(null);jie.displayName="DisclosurePanelContext";function Ant(){return m.useContext(jie)}function jnt(t,e){return rh(e.type,Nnt,t,e)}let Ent=m.Fragment;function _nt(t,e){let{defaultOpen:n=!1,...r}=t,s=m.useRef(null),a=dc(e,Y8e(v=>{s.current=v},t.as===void 0||t.as===m.Fragment)),o=m.useReducer(jnt,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=o,d=Hs(v=>{u({type:1});let C=y2(s);if(!C||!c)return;let N=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:C.getElementById(c):C.getElementById(c);N==null||N.focus()}),f=m.useMemo(()=>({close:d}),[d]),x=m.useMemo(()=>({open:l===0,close:d}),[l,d]),g={ref:a},y=_o();return Ne.createElement(Sie.Provider,{value:o},Ne.createElement(Aie.Provider,{value:f},Ne.createElement(J8e,{value:d},Ne.createElement(yie,{value:rh(l,{0:ic.Open,1:ic.Closed})},y({ourProps:g,theirProps:r,slot:x,defaultTag:Ent,name:"Disclosure"})))))}let knt="button";function Tnt(t,e){let n=m.useId(),{id:r=`headlessui-disclosure-button-${n}`,disabled:s=!1,autoFocus:a=!1,...o}=t,[l,c]=Nie("Disclosure.Button"),u=Ant(),d=u===null?!1:u===l.panelId,f=m.useRef(null),x=dc(f,e,Hs(X=>{if(!d)return c({type:4,element:X})}));m.useEffect(()=>{if(!d)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,d]);let g=Hs(X=>{var ne;if(d){if(l.disclosureState===1)return;switch(X.key){case wo.Space:case wo.Enter:X.preventDefault(),X.stopPropagation(),c({type:0}),(ne=l.buttonElement)==null||ne.focus();break}}else switch(X.key){case wo.Space:case wo.Enter:X.preventDefault(),X.stopPropagation(),c({type:0});break}}),y=Hs(X=>{switch(X.key){case wo.Space:X.preventDefault();break}}),v=Hs(X=>{var ne;nie(X.currentTarget)||s||(d?(c({type:0}),(ne=l.buttonElement)==null||ne.focus()):c({type:0}))}),{isFocusVisible:C,focusProps:N}=Jse({autoFocus:a}),{isHovered:P,hoverProps:T}=Zse({isDisabled:s}),{pressed:M,pressProps:F}=eie({disabled:s}),$=m.useMemo(()=>({open:l.disclosureState===0,hover:P,active:M,disabled:s,focus:C,autofocus:a}),[l,P,M,C,s,a]),L=lie(t,l.buttonElement),z=rE(d?{ref:x,type:L,disabled:s||void 0,autoFocus:a,onKeyDown:g,onClick:v}:{ref:x,id:r,type:L,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:s||void 0,autoFocus:a,onKeyDown:g,onKeyUp:y,onClick:v},N,T,F);return _o()({ourProps:z,theirProps:o,slot:$,defaultTag:knt,name:"Disclosure.Button"})}let Pnt="div",Int=qy.RenderStrategy|qy.Static;function Fnt(t,e){let n=m.useId(),{id:r=`headlessui-disclosure-panel-${n}`,transition:s=!1,...a}=t,[o,l]=Nie("Disclosure.Panel"),{close:c}=G7e("Disclosure.Panel"),[u,d]=m.useState(null),f=dc(e,Hs(P=>{wnt(()=>l({type:5,element:P}))}),d);m.useEffect(()=>(l({type:3,panelId:r}),()=>{l({type:3,panelId:null})}),[r,l]);let x=OA(),[g,y]=uie(s,u,x!==null?(x&ic.Open)===ic.Open:o.disclosureState===0),v=m.useMemo(()=>({open:o.disclosureState===0,close:c}),[o.disclosureState,c]),C={ref:f,id:r,...cie(y)},N=_o();return Ne.createElement(T7e,null,Ne.createElement(jie.Provider,{value:o.panelId},N({ourProps:C,theirProps:a,slot:v,defaultTag:Pnt,features:Int,visible:g,name:"Disclosure.Panel"})))}let Ont=mo(_nt),Eie=mo(Tnt),_ie=mo(Fnt),K7e=Object.assign(Ont,{Button:Eie,Panel:_ie});function Mnt(t,e){let n=m.useRef({left:0,top:0});if(eo(()=>{if(!e)return;let s=e.getBoundingClientRect();s&&(n.current=s)},[t,e]),e==null||!t||e===document.activeElement)return!1;let r=e.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Uhe=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function zhe(t){var e,n;let r=(e=t.innerText)!=null?e:"",s=t.cloneNode(!0);if(!(s instanceof HTMLElement))return r;let a=!1;for(let l of s.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),a=!0;let o=a?(n=s.innerText)!=null?n:"":r;return Uhe.test(o)&&(o=o.replace(Uhe,"")),o}function Rnt(t){let e=t.getAttribute("aria-label");if(typeof e=="string")return e.trim();let n=t.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(s=>{let a=document.getElementById(s);if(a){let o=a.getAttribute("aria-label");return typeof o=="string"?o.trim():zhe(a).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return zhe(t).trim()}function Lnt(t){let e=m.useRef(""),n=m.useRef("");return Hs(()=>{let r=t.current;if(!r)return"";let s=r.innerText;if(e.current===s)return n.current;let a=Rnt(r).trim().toLowerCase();return e.current=s,n.current=a,a})}var Dnt=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(Dnt||{}),Bnt=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(Bnt||{}),$nt=(t=>(t[t.OpenMenu=0]="OpenMenu",t[t.CloseMenu=1]="CloseMenu",t[t.GoToItem=2]="GoToItem",t[t.Search=3]="Search",t[t.ClearSearch=4]="ClearSearch",t[t.RegisterItem=5]="RegisterItem",t[t.UnregisterItem=6]="UnregisterItem",t[t.SetButtonElement=7]="SetButtonElement",t[t.SetItemsElement=8]="SetItemsElement",t))($nt||{});function kH(t,e=n=>n){let n=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,r=a7e(e(t.items.slice()),a=>a.dataRef.current.domRef.current),s=n?r.indexOf(n):null;return s===-1&&(s=null),{items:r,activeItemIndex:s}}let Unt={1(t){return t.menuState===1?t:{...t,activeItemIndex:null,menuState:1}},0(t){return t.menuState===0?t:{...t,__demoMode:!1,menuState:0}},2:(t,e)=>{var n,r,s,a,o;if(t.menuState===1)return t;let l={...t,searchQuery:"",activationTrigger:(n=e.trigger)!=null?n:1,__demoMode:!1};if(e.focus===Ou.Nothing)return{...l,activeItemIndex:null};if(e.focus===Ou.Specific)return{...l,activeItemIndex:t.items.findIndex(d=>d.id===e.id)};if(e.focus===Ou.Previous){let d=t.activeItemIndex;if(d!==null){let f=t.items[d].dataRef.current.domRef,x=_H(e,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:g=>g.id,resolveDisabled:g=>g.dataRef.current.disabled});if(x!==null){let g=t.items[x].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===g.current||((s=g.current)==null?void 0:s.previousElementSibling)===null)return{...l,activeItemIndex:x}}}}else if(e.focus===Ou.Next){let d=t.activeItemIndex;if(d!==null){let f=t.items[d].dataRef.current.domRef,x=_H(e,{resolveItems:()=>t.items,resolveActiveIndex:()=>t.activeItemIndex,resolveId:g=>g.id,resolveDisabled:g=>g.dataRef.current.disabled});if(x!==null){let g=t.items[x].dataRef.current.domRef;if(((a=f.current)==null?void 0:a.nextElementSibling)===g.current||((o=g.current)==null?void 0:o.nextElementSibling)===null)return{...l,activeItemIndex:x}}}}let c=kH(t),u=_H(e,{resolveItems:()=>c.items,resolveActiveIndex:()=>c.activeItemIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...l,...c,activeItemIndex:u}},3:(t,e)=>{let n=t.searchQuery!==""?0:1,r=t.searchQuery+e.value.toLowerCase(),s=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+n).concat(t.items.slice(0,t.activeItemIndex+n)):t.items).find(o=>{var l;return((l=o.dataRef.current.textValue)==null?void 0:l.startsWith(r))&&!o.dataRef.current.disabled}),a=s?t.items.indexOf(s):-1;return a===-1||a===t.activeItemIndex?{...t,searchQuery:r}:{...t,searchQuery:r,activeItemIndex:a,activationTrigger:1}},4(t){return t.searchQuery===""?t:{...t,searchQuery:"",searchActiveItemIndex:null}},5:(t,e)=>{let n=kH(t,r=>[...r,{id:e.id,dataRef:e.dataRef}]);return{...t,...n}},6:(t,e)=>{let n=kH(t,r=>{let s=r.findIndex(a=>a.id===e.id);return s!==-1&&r.splice(s,1),r});return{...t,...n,activationTrigger:1}},7:(t,e)=>t.buttonElement===e.element?t:{...t,buttonElement:e.element},8:(t,e)=>t.itemsElement===e.element?t:{...t,itemsElement:e.element}},kie=m.createContext(null);kie.displayName="MenuContext";function IB(t){let e=m.useContext(kie);if(e===null){let n=new Error(`<${t} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,IB),n}return e}function znt(t,e){return rh(e.type,Unt,t,e)}let Hnt=m.Fragment;function Vnt(t,e){let{__demoMode:n=!1,...r}=t,s=m.useReducer(znt,{__demoMode:n,menuState:n?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:a,itemsElement:o,buttonElement:l},c]=s,u=dc(e);c7e(a===0,[l,o],(y,v)=>{c({type:1}),oie(v,aie.Loose)||(y.preventDefault(),l==null||l.focus())});let d=Hs(()=>{c({type:1})}),f=m.useMemo(()=>({open:a===0,close:d}),[a,d]),x={ref:u},g=_o();return Ne.createElement(_tt,null,Ne.createElement(kie.Provider,{value:s},Ne.createElement(yie,{value:rh(a,{0:ic.Open,1:ic.Closed})},g({ourProps:x,theirProps:r,slot:f,defaultTag:Hnt,name:"Menu"}))))}let Wnt="button";function qnt(t,e){var n;let r=m.useId(),{id:s=`headlessui-menu-button-${r}`,disabled:a=!1,autoFocus:o=!1,...l}=t,[c,u]=IB("Menu.Button"),d=Att(),f=dc(e,Ntt(),Hs(L=>u({type:7,element:L}))),x=Hs(L=>{switch(L.key){case wo.Space:case wo.Enter:case wo.ArrowDown:L.preventDefault(),L.stopPropagation(),Aa.flushSync(()=>u({type:0})),u({type:2,focus:Ou.First});break;case wo.ArrowUp:L.preventDefault(),L.stopPropagation(),Aa.flushSync(()=>u({type:0})),u({type:2,focus:Ou.Last});break}}),g=Hs(L=>{switch(L.key){case wo.Space:L.preventDefault();break}}),y=Hs(L=>{var z;if(nie(L.currentTarget))return L.preventDefault();a||(c.menuState===0?(Aa.flushSync(()=>u({type:1})),(z=c.buttonElement)==null||z.focus({preventScroll:!0})):(L.preventDefault(),u({type:0})))}),{isFocusVisible:v,focusProps:C}=Jse({autoFocus:o}),{isHovered:N,hoverProps:P}=Zse({isDisabled:a}),{pressed:T,pressProps:M}=eie({disabled:a}),F=m.useMemo(()=>({open:c.menuState===0,active:T||c.menuState===0,disabled:a,hover:N,focus:v,autofocus:o}),[c,N,v,T,a,o]),$=rE(d(),{ref:f,id:s,type:lie(t,c.buttonElement),"aria-haspopup":"menu","aria-controls":(n=c.itemsElement)==null?void 0:n.id,"aria-expanded":c.menuState===0,disabled:a||void 0,autoFocus:o,onKeyDown:x,onKeyUp:g,onClick:y},C,P,M);return _o()({ourProps:$,theirProps:l,slot:F,defaultTag:Wnt,name:"Menu.Button"})}let Gnt="div",Knt=qy.RenderStrategy|qy.Static;function Ynt(t,e){var n,r;let s=m.useId(),{id:a=`headlessui-menu-items-${s}`,anchor:o,portal:l=!1,modal:c=!0,transition:u=!1,...d}=t,f=Stt(o),[x,g]=IB("Menu.Items"),[y,v]=Ett(f),C=jtt(),[N,P]=m.useState(null),T=dc(e,f?y:null,Hs(W=>g({type:8,element:W})),P),M=TA(x.itemsElement);f&&(l=!0);let F=OA(),[$,L]=uie(u,N,F!==null?(F&ic.Open)===ic.Open:x.menuState===0);r7e($,x.buttonElement,()=>{g({type:1})});let z=x.__demoMode?!1:c&&x.menuState===0;d7e(z,M);let X=x.__demoMode?!1:c&&x.menuState===0;n7e(X,{allowed:m.useCallback(()=>[x.buttonElement,x.itemsElement],[x.buttonElement,x.itemsElement])});let ne=x.menuState!==0,J=Mnt(ne,x.buttonElement)?!1:$;m.useEffect(()=>{let W=x.itemsElement;W&&x.menuState===0&&W!==(M==null?void 0:M.activeElement)&&W.focus({preventScroll:!0})},[x.menuState,x.itemsElement,M]),get(x.menuState===0,{container:x.itemsElement,accept(W){return W.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:W.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(W){W.setAttribute("role","none")}});let K=v2(),te=Hs(W=>{var V,ee,oe;switch(K.dispose(),W.key){case wo.Space:if(x.searchQuery!=="")return W.preventDefault(),W.stopPropagation(),g({type:3,value:W.key});case wo.Enter:if(W.preventDefault(),W.stopPropagation(),g({type:1}),x.activeItemIndex!==null){let{dataRef:de}=x.items[x.activeItemIndex];(ee=(V=de.current)==null?void 0:V.domRef.current)==null||ee.click()}i7e(x.buttonElement);break;case wo.ArrowDown:return W.preventDefault(),W.stopPropagation(),g({type:2,focus:Ou.Next});case wo.ArrowUp:return W.preventDefault(),W.stopPropagation(),g({type:2,focus:Ou.Previous});case wo.Home:case wo.PageUp:return W.preventDefault(),W.stopPropagation(),g({type:2,focus:Ou.First});case wo.End:case wo.PageDown:return W.preventDefault(),W.stopPropagation(),g({type:2,focus:Ou.Last});case wo.Escape:W.preventDefault(),W.stopPropagation(),Aa.flushSync(()=>g({type:1})),(oe=x.buttonElement)==null||oe.focus({preventScroll:!0});break;case wo.Tab:W.preventDefault(),W.stopPropagation(),Aa.flushSync(()=>g({type:1})),tet(x.buttonElement,W.shiftKey?um.Previous:um.Next);break;default:W.key.length===1&&(g({type:3,value:W.key}),K.setTimeout(()=>g({type:4}),350));break}}),fe=Hs(W=>{switch(W.key){case wo.Space:W.preventDefault();break}}),q=m.useMemo(()=>({open:x.menuState===0}),[x.menuState]),se=rE(f?C():{},{"aria-activedescendant":x.activeItemIndex===null||(n=x.items[x.activeItemIndex])==null?void 0:n.id,"aria-labelledby":(r=x.buttonElement)==null?void 0:r.id,id:a,onKeyDown:te,onKeyUp:fe,role:"menu",tabIndex:x.menuState===0?0:void 0,ref:T,style:{...d.style,...v,"--button-width":qJe(x.buttonElement,!0).width},...cie(L)}),ae=_o();return Ne.createElement(R7e,{enabled:l?t.static||$:!1},ae({ourProps:se,theirProps:d,slot:q,defaultTag:Gnt,features:Knt,visible:J,name:"Menu.Items"}))}let Xnt=m.Fragment;function Qnt(t,e){let n=m.useId(),{id:r=`headlessui-menu-item-${n}`,disabled:s=!1,...a}=t,[o,l]=IB("Menu.Item"),c=o.activeItemIndex!==null?o.items[o.activeItemIndex].id===r:!1,u=m.useRef(null),d=dc(e,u);eo(()=>{if(!o.__demoMode&&o.menuState===0&&c&&o.activationTrigger!==0)return bx().requestAnimationFrame(()=>{var J,K;(K=(J=u.current)==null?void 0:J.scrollIntoView)==null||K.call(J,{block:"nearest"})})},[o.__demoMode,u,c,o.menuState,o.activationTrigger,o.activeItemIndex]);let f=Lnt(u),x=m.useRef({disabled:s,domRef:u,get textValue(){return f()}});eo(()=>{x.current.disabled=s},[x,s]),eo(()=>(l({type:5,id:r,dataRef:x}),()=>l({type:6,id:r})),[x,r]);let g=Hs(()=>{l({type:1})}),y=Hs(J=>{if(s)return J.preventDefault();l({type:1}),i7e(o.buttonElement)}),v=Hs(()=>{if(s)return l({type:2,focus:Ou.Nothing});l({type:2,focus:Ou.Specific,id:r})}),C=uet(),N=Hs(J=>{C.update(J),!s&&(c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),P=Hs(J=>{C.wasMoved(J)&&(s||c||l({type:2,focus:Ou.Specific,id:r,trigger:0}))}),T=Hs(J=>{C.wasMoved(J)&&(s||c&&l({type:2,focus:Ou.Nothing}))}),[M,F]=iie(),[$,L]=rie(),z=m.useMemo(()=>({active:c,focus:c,disabled:s,close:g}),[c,s,g]),X={id:r,ref:d,role:"menuitem",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-labelledby":M,"aria-describedby":$,disabled:void 0,onClick:y,onFocus:v,onPointerEnter:N,onMouseEnter:N,onPointerMove:P,onMouseMove:P,onPointerLeave:T,onMouseLeave:T},ne=_o();return Ne.createElement(F,null,Ne.createElement(L,null,ne({ourProps:X,theirProps:a,slot:z,defaultTag:Xnt,name:"Menu.Item"})))}let Znt="div";function Jnt(t,e){let[n,r]=iie(),s=t,a={ref:e,"aria-labelledby":n,role:"group"},o=_o();return Ne.createElement(r,null,o({ourProps:a,theirProps:s,slot:{},defaultTag:Znt,name:"Menu.Section"}))}let ert="header";function trt(t,e){let n=m.useId(),{id:r=`headlessui-menu-heading-${n}`,...s}=t,a=sie();eo(()=>a.register(r),[r,a.register]);let o={id:r,ref:e,role:"presentation",...a.props};return _o()({ourProps:o,theirProps:s,slot:{},defaultTag:ert,name:"Menu.Heading"})}let nrt="div";function rrt(t,e){let n=t,r={ref:e,role:"separator"};return _o()({ourProps:r,theirProps:n,slot:{},defaultTag:nrt,name:"Menu.Separator"})}let srt=mo(Vnt),FB=mo(qnt),OB=mo(Ynt),YC=mo(Qnt),irt=mo(Jnt),art=mo(trt),ort=mo(rrt),MB=Object.assign(srt,{Button:FB,Items:OB,Item:YC,Section:irt,Heading:art,Separator:ort}),Tie=m.createContext(null);Tie.displayName="GroupContext";let lrt=m.Fragment;function crt(t){var e;let[n,r]=m.useState(null),[s,a]=iie(),[o,l]=rie(),c=m.useMemo(()=>({switch:n,setSwitch:r}),[n,r]),u={},d=t,f=_o();return Ne.createElement(l,{name:"Switch.Description",value:o},Ne.createElement(a,{name:"Switch.Label",value:s,props:{htmlFor:(e=c.switch)==null?void 0:e.id,onClick(x){n&&(x.currentTarget instanceof HTMLLabelElement&&x.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},Ne.createElement(Tie.Provider,{value:c},f({ourProps:u,theirProps:d,slot:{},defaultTag:lrt,name:"Switch.Group"}))))}let urt="button";function drt(t,e){var n;let r=m.useId(),s=G8e(),a=tie(),{id:o=s||`headlessui-switch-${r}`,disabled:l=a||!1,checked:c,defaultChecked:u,onChange:d,name:f,value:x,form:g,autoFocus:y=!1,...v}=t,C=m.useContext(Tie),[N,P]=m.useState(null),T=m.useRef(null),M=dc(T,e,C===null?null:C.setSwitch,P),F=jJe(u),[$,L]=AJe(c,d,F??!1),z=v2(),[X,ne]=m.useState(!1),J=Hs(()=>{ne(!0),L==null||L(!$),z.nextFrame(()=>{ne(!1)})}),K=Hs(be=>{if(nie(be.currentTarget))return be.preventDefault();be.preventDefault(),J()}),te=Hs(be=>{be.key===wo.Space?(be.preventDefault(),J()):be.key===wo.Enter&&EJe(be.currentTarget)}),fe=Hs(be=>be.preventDefault()),q=Z8e(),se=RJe(),{isFocusVisible:ae,focusProps:W}=Jse({autoFocus:y}),{isHovered:V,hoverProps:ee}=Zse({isDisabled:l}),{pressed:oe,pressProps:de}=eie({disabled:l}),Ce=m.useMemo(()=>({checked:$,disabled:l,hover:V,focus:ae,active:oe,autofocus:y,changing:X}),[$,V,ae,oe,l,X,y]),me=rE({id:o,ref:M,role:"switch",type:lie(t,N),tabIndex:t.tabIndex===-1?0:(n=t.tabIndex)!=null?n:0,"aria-checked":$,"aria-labelledby":q,"aria-describedby":se,disabled:l||void 0,autoFocus:y,onClick:K,onKeyUp:te,onKeyPress:fe},W,ee,de),we=m.useCallback(()=>{if(F!==void 0)return L==null?void 0:L(F)},[L,F]),xe=_o();return Ne.createElement(Ne.Fragment,null,f!=null&&Ne.createElement(IJe,{disabled:l,data:{[f]:x||"on"},overrides:{type:"checkbox",checked:$},form:g,onReset:we}),xe({ourProps:me,theirProps:v,slot:Ce,defaultTag:urt,name:"Switch"}))}let frt=mo(drt),hrt=crt,prt=HJe,mrt=Q8e,Io=Object.assign(frt,{Group:hrt,Label:prt,Description:mrt});function xrt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 0 1 .75.75v10.638l3.96-4.158a.75.75 0 1 1 1.08 1.04l-5.25 5.5a.75.75 0 0 1-1.08 0l-5.25-5.5a.75.75 0 1 1 1.08-1.04l3.96 4.158V3.75A.75.75 0 0 1 10 3Z",clipRule:"evenodd"}))}const Ul=m.forwardRef(xrt);function grt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",clipRule:"evenodd"}))}const XS=m.forwardRef(grt);function brt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",clipRule:"evenodd"}),m.createElement("path",{fillRule:"evenodd",d:"M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",clipRule:"evenodd"}))}const yrt=m.forwardRef(brt);function vrt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M10 17a.75.75 0 0 1-.75-.75V5.612L5.29 9.77a.75.75 0 0 1-1.08-1.04l5.25-5.5a.75.75 0 0 1 1.08 0l5.25 5.5a.75.75 0 1 1-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0 1 10 17Z",clipRule:"evenodd"}))}const Pie=m.forwardRef(vrt);function wrt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))}const Crt=m.forwardRef(wrt);function Srt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const Y7e=m.forwardRef(Srt);function Nrt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const lE=m.forwardRef(Nrt);function Art({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"}))}const Iie=m.forwardRef(Art);function jrt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M10 1c3.866 0 7 1.79 7 4s-3.134 4-7 4-7-1.79-7-4 3.134-4 7-4Zm5.694 8.13c.464-.264.91-.583 1.306-.952V10c0 2.21-3.134 4-7 4s-7-1.79-7-4V8.178c.396.37.842.688 1.306.953C5.838 10.006 7.854 10.5 10 10.5s4.162-.494 5.694-1.37ZM3 13.179V15c0 2.21 3.134 4 7 4s7-1.79 7-4v-1.822c-.396.37-.842.688-1.306.953-1.532.875-3.548 1.369-5.694 1.369s-4.162-.494-5.694-1.37A7.009 7.009 0 0 1 3 13.179Z",clipRule:"evenodd"}))}const S5=m.forwardRef(jrt);function Ert({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 0 0-1.06 1.06l14.5 14.5a.75.75 0 1 0 1.06-1.06l-1.745-1.745a10.029 10.029 0 0 0 3.3-4.38 1.651 1.651 0 0 0 0-1.185A10.004 10.004 0 0 0 9.999 3a9.956 9.956 0 0 0-4.744 1.194L3.28 2.22ZM7.752 6.69l1.092 1.092a2.5 2.5 0 0 1 3.374 3.373l1.091 1.092a4 4 0 0 0-5.557-5.557Z",clipRule:"evenodd"}),m.createElement("path",{d:"m10.748 13.93 2.523 2.523a9.987 9.987 0 0 1-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 0 1 0-1.186A10.007 10.007 0 0 1 2.839 6.02L6.07 9.252a4 4 0 0 0 4.678 4.678Z"}))}const _rt=m.forwardRef(Ert);function krt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"}),m.createElement("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 0 1 0-1.186A10.004 10.004 0 0 1 10 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0 1 10 17c-4.257 0-7.893-2.66-9.336-6.41ZM14 10a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z",clipRule:"evenodd"}))}const Trt=m.forwardRef(krt);function Prt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M4 10a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H4.75A.75.75 0 0 1 4 10Z",clipRule:"evenodd"}))}const X7e=m.forwardRef(Prt);function Irt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{d:"M13 4.5a2.5 2.5 0 1 1 .702 1.737L6.97 9.604a2.518 2.518 0 0 1 0 .792l6.733 3.367a2.5 2.5 0 1 1-.671 1.341l-6.733-3.367a2.5 2.5 0 1 1 0-3.475l6.733-3.366A2.52 2.52 0 0 1 13 4.5Z"}))}const Frt=m.forwardRef(Irt);function Ort({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const Q7e=m.forwardRef(Ort),Z7e=m.createContext({});function Mrt(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const Fie=typeof window<"u",Rrt=Fie?m.useLayoutEffect:m.useEffect,Oie=m.createContext(null);function rT(t,e){t.indexOf(e)===-1&&t.push(e)}function sT(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Lc=(t,e,n)=>n>e?e:n<t?t:n;let QS=()=>{};const Dc={},RB=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function LB(t){return typeof t=="object"&&t!==null}const DB=t=>/^0[^.\s]+$/u.test(t);function MA(t){let e;return()=>(e===void 0&&(e=t()),e)}const dl=t=>t,Lrt=(t,e)=>n=>e(t(n)),vx=(...t)=>t.reduce(Lrt),sx=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class RA{constructor(){this.subscriptions=[]}add(e){return rT(this.subscriptions,e),()=>sT(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let a=0;a<s;a++){const o=this.subscriptions[a];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Wl=t=>t*1e3,ll=t=>t/1e3;function BB(t,e){return e?t*(1e3/e):0}const J7e=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Drt=1e-7,Brt=12;function $rt(t,e,n,r,s){let a,o,l=0;do o=e+(n-e)/2,a=J7e(o,r,s)-t,a>0?n=o:e=o;while(Math.abs(a)>Drt&&++l<Brt);return o}function iT(t,e,n,r){if(t===e&&n===r)return dl;const s=a=>$rt(a,0,1,t,n);return a=>a===0||a===1?a:J7e(s(a),e,r)}const e9e=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,t9e=t=>e=>1-t(1-e),n9e=iT(.33,1.53,.69,.99),Mie=t9e(n9e),Rie=e9e(Mie),Lie=t=>(t*=2)<1?.5*Mie(t):.5*(2-Math.pow(2,-10*(t-1))),Die=t=>1-Math.sin(Math.acos(t)),Bie=t9e(Die),$ie=e9e(Die),Urt=iT(.42,0,1,1),zrt=iT(0,0,.58,1),Uie=iT(.42,0,.58,1),r9e=t=>Array.isArray(t)&&typeof t[0]!="number",zie=t=>Array.isArray(t)&&typeof t[0]=="number",Hhe={linear:dl,easeIn:Urt,easeInOut:Uie,easeOut:zrt,circIn:Die,circInOut:$ie,circOut:Bie,backIn:Mie,backInOut:Rie,backOut:n9e,anticipate:Lie},Hrt=t=>typeof t=="string",BM=t=>{if(zie(t)){QS(t.length===4);const[e,n,r,s]=t;return iT(e,n,r,s)}else if(Hrt(t))return QS(Hhe[t]!==void 0),Hhe[t];return t},fI=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Vrt(t,e){let n=new Set,r=new Set,s=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),t()),d(l)}const u={schedule:(d,f=!1,x=!1)=>{const y=x&&s?n:r;return f&&o.add(d),y.has(d)||y.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(l=d,s){a=!0;return}s=!0,[n,r]=[r,n],n.forEach(c),n.clear(),s=!1,a&&(a=!1,u.process(d))}};return u}const Wrt=40;function s9e(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=fI.reduce((T,M)=>(T[M]=Vrt(a),T),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const T=Dc.useManualTiming?s.timestamp:performance.now();n=!1,Dc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(T-s.timestamp,Wrt),1)),s.timestamp=T,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),x.process(s),g.process(s),y.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(v))},C=()=>{n=!0,r=!0,s.isProcessing||t(v)};return{schedule:fI.reduce((T,M)=>{const F=o[M];return T[M]=($,L=!1,z=!1)=>(n||C(),F.schedule($,L,z)),T},{}),cancel:T=>{for(let M=0;M<fI.length;M++)o[fI[M]].cancel(T)},state:s,steps:o}}const{schedule:Lo,cancel:Qy,state:Zc,steps:TH}=s9e(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0);let SO;function qrt(){SO=void 0}const rf={now:()=>(SO===void 0&&rf.set(Zc.isProcessing||Dc.useManualTiming?Zc.timestamp:performance.now()),SO),set:t=>{SO=t,queueMicrotask(qrt)}},i9e=t=>e=>typeof e=="string"&&e.startsWith(t),Hie=i9e("--"),Grt=i9e("var(--"),Vie=t=>Grt(t)?Krt.test(t.split("/*")[0].trim()):!1,Krt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,LA={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},cE={...LA,transform:t=>Lc(0,1,t)},hI={...LA,default:1},x9=t=>Math.round(t*1e5)/1e5,Wie=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Yrt(t){return t==null}const Xrt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qie=(t,e)=>n=>!!(typeof n=="string"&&Xrt.test(n)&&n.startsWith(t)||e&&!Yrt(n)&&Object.prototype.hasOwnProperty.call(n,e)),a9e=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(Wie);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Qrt=t=>Lc(0,255,t),PH={...LA,transform:t=>Math.round(Qrt(t))},lw={test:qie("rgb","red"),parse:a9e("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+PH.transform(t)+", "+PH.transform(e)+", "+PH.transform(n)+", "+x9(cE.transform(r))+")"};function Zrt(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const QZ={test:qie("#"),parse:Zrt,transform:lw.transform},aT=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Rb=aT("deg"),W0=aT("%"),ci=aT("px"),Jrt=aT("vh"),est=aT("vw"),Vhe={...W0,parse:t=>W0.parse(t)/100,transform:t=>W0.transform(t*100)},XC={test:qie("hsl","hue"),parse:a9e("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+W0.transform(x9(e))+", "+W0.transform(x9(n))+", "+x9(cE.transform(r))+")"},Bl={test:t=>lw.test(t)||QZ.test(t)||XC.test(t),parse:t=>lw.test(t)?lw.parse(t):XC.test(t)?XC.parse(t):QZ.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?lw.transform(t):XC.transform(t),getAnimatableNone:t=>{const e=Bl.parse(t);return e.alpha=0,Bl.transform(e)}},tst=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function nst(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Wie))==null?void 0:e.length)||0)+(((n=t.match(tst))==null?void 0:n.length)||0)>0}const o9e="number",l9e="color",rst="var",sst="var(",Whe="${}",ist=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function uE(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(ist,c=>(Bl.test(c)?(r.color.push(a),s.push(l9e),n.push(Bl.parse(c))):c.startsWith(sst)?(r.var.push(a),s.push(rst),n.push(c)):(r.number.push(a),s.push(o9e),n.push(parseFloat(c))),++a,Whe)).split(Whe);return{values:n,split:l,indexes:r,types:s}}function c9e(t){return uE(t).values}function u9e(t){const{split:e,types:n}=uE(t),r=e.length;return s=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],s[o]!==void 0){const l=n[o];l===o9e?a+=x9(s[o]):l===l9e?a+=Bl.transform(s[o]):a+=s[o]}return a}}const ast=t=>typeof t=="number"?0:Bl.test(t)?Bl.getAnimatableNone(t):t;function ost(t){const e=c9e(t);return u9e(t)(e.map(ast))}const Zy={test:nst,parse:c9e,createTransformer:u9e,getAnimatableNone:ost};function IH(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function lst({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,a=0,o=0;if(!e)s=a=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=IH(c,l,t+1/3),a=IH(c,l,t),o=IH(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function $M(t,e){return n=>n>0?e:t}const qo=(t,e,n)=>t+(e-t)*n,FH=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},cst=[QZ,lw,XC],ust=t=>cst.find(e=>e.test(t));function qhe(t){const e=ust(t);if(!e)return!1;let n=e.parse(t);return e===XC&&(n=lst(n)),n}const Ghe=(t,e)=>{const n=qhe(t),r=qhe(e);if(!n||!r)return $M(t,e);const s={...n};return a=>(s.red=FH(n.red,r.red,a),s.green=FH(n.green,r.green,a),s.blue=FH(n.blue,r.blue,a),s.alpha=qo(n.alpha,r.alpha,a),lw.transform(s))},ZZ=new Set(["none","hidden"]);function dst(t,e){return ZZ.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function fst(t,e){return n=>qo(t,e,n)}function Gie(t){return typeof t=="number"?fst:typeof t=="string"?Vie(t)?$M:Bl.test(t)?Ghe:mst:Array.isArray(t)?d9e:typeof t=="object"?Bl.test(t)?Ghe:hst:$M}function d9e(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>Gie(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function hst(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=Gie(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function pst(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],o=t.indexes[a][r[a]],l=t.values[o]??0;n[s]=l,r[a]++}return n}const mst=(t,e)=>{const n=Zy.createTransformer(e),r=uE(t),s=uE(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?ZZ.has(t)&&!s.values.length||ZZ.has(e)&&!r.values.length?dst(t,e):vx(d9e(pst(r,s),s.values),n):$M(t,e)};function f9e(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?qo(t,e,n):Gie(t)(t,e)}const xst=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Lo.update(e,n),stop:()=>Qy(e),now:()=>Zc.isProcessing?Zc.timestamp:rf.now()}},h9e=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let a=0;a<s;a++)r+=Math.round(t(a/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},UM=2e4;function Kie(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<UM;)e+=n,r=t.next(e);return e>=UM?1/0:e}function gst(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Kie(r),UM);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:ll(s)}}const bst=5;function p9e(t,e,n){const r=Math.max(e-bst,0);return BB(n-t(r),e-r)}const sl={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Khe=.001;function yst({duration:t=sl.duration,bounce:e=sl.bounce,velocity:n=sl.velocity,mass:r=sl.mass}){let s,a,o=1-e;o=Lc(sl.minDamping,sl.maxDamping,o),t=Lc(sl.minDuration,sl.maxDuration,ll(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=JZ(u,o),y=Math.exp(-f);return Khe-x/g*y},a=u=>{const f=u*o*t,x=f*n+n,g=Math.pow(o,2)*Math.pow(u,2)*t,y=Math.exp(-f),v=JZ(Math.pow(u,2),o);return(-s(u)+Khe>0?-1:1)*((x-g)*y)/v}):(s=u=>{const d=Math.exp(-u*t),f=(u-n)*t+1;return-.001+d*f},a=u=>{const d=Math.exp(-u*t),f=(n-u)*(t*t);return d*f});const l=5/t,c=wst(s,a,l);if(t=Wl(t),isNaN(c))return{stiffness:sl.stiffness,damping:sl.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const vst=12;function wst(t,e,n){let r=n;for(let s=1;s<vst;s++)r=r-t(r)/e(r);return r}function JZ(t,e){return t*Math.sqrt(1-e*e)}const Cst=["duration","bounce"],Sst=["stiffness","damping","mass"];function Yhe(t,e){return e.some(n=>t[n]!==void 0)}function Nst(t){let e={velocity:sl.velocity,stiffness:sl.stiffness,damping:sl.damping,mass:sl.mass,isResolvedFromDuration:!1,...t};if(!Yhe(t,Sst)&&Yhe(t,Cst))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,a=2*Lc(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:sl.mass,stiffness:s,damping:a}}else{const n=yst(t);e={...e,...n,mass:sl.mass},e.isResolvedFromDuration=!0}return e}function zM(t=sl.visualDuration,e=sl.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:f,velocity:x,isResolvedFromDuration:g}=Nst({...n,velocity:-ll(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,N=ll(Math.sqrt(c/d)),P=Math.abs(C)<5;r||(r=P?sl.restSpeed.granular:sl.restSpeed.default),s||(s=P?sl.restDelta.granular:sl.restDelta.default);let T;if(v<1){const F=JZ(N,v);T=$=>{const L=Math.exp(-v*N*$);return o-L*((y+v*N*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)T=F=>o-Math.exp(-N*F)*(C+(y+N*C)*F);else{const F=N*Math.sqrt(v*v-1);T=$=>{const L=Math.exp(-v*N*$),z=Math.min(F*$,300);return o-L*((y+v*N*C)*Math.sinh(z)+F*C*Math.cosh(z))/F}}const M={calculatedDuration:g&&f||null,next:F=>{const $=T(F);if(g)l.done=F>=f;else{let L=F===0?y:0;v<1&&(L=F===0?Wl(y):p9e(T,F,$));const z=Math.abs(L)<=r,X=Math.abs(o-$)<=s;l.done=z&&X}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(Kie(M),UM),$=h9e(L=>M.next(F*L).value,F,30);return F+"ms "+$},toTransition:()=>{}};return M}zM.applyToOptions=t=>{const e=gst(t,100,zM);return t.ease=e.ease,t.duration=Wl(e.duration),t.type="keyframes",t};function eJ({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=t[0],x={done:!1,value:f},g=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let v=n*e;const C=f+v,N=o===void 0?C:o(C);N!==C&&(v=N-f);const P=z=>-v*Math.exp(-z/r),T=z=>N+P(z),M=z=>{const X=P(z),ne=T(z);x.done=Math.abs(X)<=u,x.value=x.done?N:ne};let F,$;const L=z=>{g(x.value)&&(F=z,$=zM({keyframes:[x.value,y(x.value)],velocity:p9e(T,z,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return L(0),{calculatedDuration:null,next:z=>{let X=!1;return!$&&F===void 0&&(X=!0,M(z),L(z)),F!==void 0&&z>=F?$.next(z-F):(!X&&M(z),x)}}}function Ast(t,e,n){const r=[],s=n||Dc.mix||f9e,a=t.length-1;for(let o=0;o<a;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||dl:e;l=vx(c,l)}r.push(l)}return r}function jst(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(QS(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=Ast(e,r,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let f=0;if(c>1)for(;f<t.length-2&&!(d<t[f+1]);f++);const x=sx(t[f],t[f+1],d);return l[f](x)};return n?d=>u(Lc(t[0],t[a-1],d)):u}function Est(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=sx(0,e,r);t.push(qo(n,1,s))}}function _st(t){const e=[0];return Est(e,t.length-1),e}function kst(t,e){return t.map(n=>n*e)}function Tst(t,e){return t.map(()=>e||Uie).splice(0,t.length-1)}function g9({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=r9e(r)?r.map(BM):BM(r),a={done:!1,value:e[0]},o=kst(n&&n.length===e.length?n:_st(e),t),l=jst(o,e,{ease:Array.isArray(s)?s:Tst(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const Pst=t=>t!==null;function Yie(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(Pst),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const Ist={decay:eJ,inertia:eJ,tween:g9,keyframes:g9,spring:zM};function m9e(t){typeof t.type=="string"&&(t.type=Ist[t.type])}let Xie=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}};const Fst=t=>t/100;let Qie=class extends Xie{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==rf.now()&&this.tick(rf.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;m9e(e);const{type:n=g9,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||g9;c!==g9&&typeof l[0]!="number"&&(this.mixKeyframes=vx(Fst,f9e(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=Kie(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:x,repeatDelay:g,type:y,onUpdate:v,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const N=this.currentTime-u*(this.playbackSpeed>=0?1:-1),P=this.playbackSpeed>=0?N<0:N>s;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,M=r;if(f){const z=Math.min(this.currentTime,s)/l;let X=Math.floor(z),ne=z%1;!ne&&z>=1&&(ne=1),ne===1&&X--,X=Math.min(X,f+1),!!(X%2)&&(x==="reverse"?(ne=1-ne,g&&(ne-=g/l)):x==="mirror"&&(M=o)),T=Lc(0,1,ne)*l}const F=P?{done:!1,value:d[0]}:M.next(T);a&&(F.value=a(F.value));let{done:$}=F;!P&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return L&&y!==eJ&&(F.value=Yie(d,this.options,C,this.speed)),v&&v(F.value),L&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return ll(this.calculatedDuration)}get time(){return ll(this.currentTime)}set time(e){var n;e=Wl(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(rf.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ll(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=xst,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(a=(s=this.options).onPlay)==null||a.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(rf.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}};function Ost(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const cw=t=>t*180/Math.PI,tJ=t=>{const e=cw(Math.atan2(t[1],t[0]));return nJ(e)},Mst={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:tJ,rotateZ:tJ,skewX:t=>cw(Math.atan(t[1])),skewY:t=>cw(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},nJ=t=>(t=t%360,t<0&&(t+=360),t),Xhe=tJ,Qhe=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Zhe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Rst={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Qhe,scaleY:Zhe,scale:t=>(Qhe(t)+Zhe(t))/2,rotateX:t=>nJ(cw(Math.atan2(t[6],t[5]))),rotateY:t=>nJ(cw(Math.atan2(-t[2],t[0]))),rotateZ:Xhe,rotate:Xhe,skewX:t=>cw(Math.atan(t[4])),skewY:t=>cw(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function rJ(t){return t.includes("scale")?1:0}function sJ(t,e){if(!t||t==="none")return rJ(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Rst,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Mst,s=l}if(!s)return rJ(e);const a=r[e],o=s[1].split(",").map(Dst);return typeof a=="function"?a(o):o[a]}const Lst=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return sJ(n,e)};function Dst(t){return parseFloat(t.trim())}const DA=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],BA=new Set(DA),Jhe=t=>t===LA||t===ci,Bst=new Set(["x","y","z"]),$st=DA.filter(t=>!Bst.has(t));function Ust(t){const e=[];return $st.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const l3={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>sJ(e,"x"),y:(t,{transform:e})=>sJ(e,"y")};l3.translateX=l3.x;l3.translateY=l3.y;const c3=new Set;let iJ=!1,aJ=!1,oJ=!1;function x9e(){if(aJ){const t=Array.from(c3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=Ust(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([a,o])=>{var l;(l=r.getValue(a))==null||l.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}aJ=!1,iJ=!1,c3.forEach(t=>t.complete(oJ)),c3.clear()}function g9e(){c3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(aJ=!0)})}function zst(){oJ=!0,g9e(),x9e(),oJ=!1}let Zie=class{constructor(e,n,r,s,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(c3.add(this),iJ||(iJ=!0,Lo.read(g9e),Lo.resolveKeyframes(x9e))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const a=s==null?void 0:s.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const l=r.readValue(n,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&a===void 0&&s.set(e[0])}Ost(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),c3.delete(this)}cancel(){this.state==="scheduled"&&(c3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}};const Hst=t=>t.startsWith("--");function Vst(t,e,n){Hst(e)?t.style.setProperty(e,n):t.style[e]=n}const Wst=MA(()=>window.ScrollTimeline!==void 0),qst={};function Gst(t,e){const n=MA(t);return()=>qst[e]??n()}const b9e=Gst(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),B7=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,epe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:B7([0,.65,.55,1]),circOut:B7([.55,0,1,.45]),backIn:B7([.31,.01,.66,-.59]),backOut:B7([.33,1.53,.69,.99])};function y9e(t,e){if(t)return typeof t=="function"?b9e()?h9e(t,e):"ease-out":zie(t)?B7(t):Array.isArray(t)?t.map(n=>y9e(n,e)||epe.easeOut):epe[t]}function Kst(t,e,n,{delay:r=0,duration:s=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:n};c&&(d.offset=c);const f=y9e(l,s);Array.isArray(f)&&(d.easing=f);const x={delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return u&&(x.pseudoElement=u),t.animate(d,x)}function v9e(t){return typeof t=="function"&&"applyToOptions"in t}function Yst({type:t,...e}){return v9e(t)&&b9e()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}let Xst=class extends Xie{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,QS(typeof e.type!="string");const u=Yst(e);this.animation=Kst(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=Yie(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):Vst(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return ll(Number(e))}get time(){return ll(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Wl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&Wst()?(this.animation.timeline=e,dl):n(this)}};const w9e={anticipate:Lie,backInOut:Rie,circInOut:$ie};function Qst(t){return t in w9e}function Zst(t){typeof t.ease=="string"&&Qst(t.ease)&&(t.ease=w9e[t.ease])}const tpe=10;let Jst=class extends Xst{constructor(e){Zst(e),m9e(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:a,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const l=new Qie({...o,autoplay:!1}),c=Wl(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-tpe).value,l.sample(c).value,tpe),l.stop()}};const npe=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Zy.test(t)||t==="0")&&!t.startsWith("url("));function eit(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function tit(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],o=npe(s,e),l=npe(a,e);return!o||!l?!1:eit(t)||(n==="spring"||v9e(n))&&r}function lJ(t){t.duration=0,t.type}const nit=new Set(["opacity","clipPath","filter","transform"]),rit=MA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function sit(t){var d;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:a,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return rit()&&n&&nit.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const iit=40;let ait=class extends Xie{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var y;super(),this.stop=()=>{var v,C;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=rf.now();const x={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:a,repeatType:o,name:c,motionValue:u,element:d,...f},g=(d==null?void 0:d.KeyframeResolver)||Zie;this.keyframeResolver=new g(l,(v,C,N)=>this.onKeyframesResolved(v,C,x,!N),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=rf.now(),tit(e,a,o,l)||((Dc.instantAnimations||!c)&&(d==null||d(Yie(e,r,n))),e[0]=e[e.length-1],lJ(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>iit?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&sit(x)?new Jst({...x,element:x.motionValue.owner.current}):new Qie(x);g.finished.then(()=>this.notifyFinished()).catch(dl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),zst()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}};const oit=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lit(t){const e=oit.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function C9e(t,e,n=1){const[r,s]=lit(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return RB(o)?parseFloat(o):o}return Vie(s)?C9e(s,e,n+1):s}function Jie(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const S9e=new Set(["width","height","top","left","right","bottom",...DA]),cit={test:t=>t==="auto",parse:t=>t},N9e=t=>e=>e.test(t),A9e=[LA,ci,W0,Rb,est,Jrt,cit],rpe=t=>A9e.find(N9e(t));function uit(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||DB(t):!0}const dit=new Set(["brightness","contrast","saturate","opacity"]);function fit(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Wie)||[];if(!r)return t;const s=n.replace(r,"");let a=dit.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const hit=/\b([a-z-]*)\(.*?\)/gu,cJ={...Zy,getAnimatableNone:t=>{const e=t.match(hit);return e?e.map(fit).join(" "):t}},spe={...LA,transform:Math.round},pit={rotate:Rb,rotateX:Rb,rotateY:Rb,rotateZ:Rb,scale:hI,scaleX:hI,scaleY:hI,scaleZ:hI,skew:Rb,skewX:Rb,skewY:Rb,distance:ci,translateX:ci,translateY:ci,translateZ:ci,x:ci,y:ci,z:ci,perspective:ci,transformPerspective:ci,opacity:cE,originX:Vhe,originY:Vhe,originZ:ci},eae={borderWidth:ci,borderTopWidth:ci,borderRightWidth:ci,borderBottomWidth:ci,borderLeftWidth:ci,borderRadius:ci,radius:ci,borderTopLeftRadius:ci,borderTopRightRadius:ci,borderBottomRightRadius:ci,borderBottomLeftRadius:ci,width:ci,maxWidth:ci,height:ci,maxHeight:ci,top:ci,right:ci,bottom:ci,left:ci,padding:ci,paddingTop:ci,paddingRight:ci,paddingBottom:ci,paddingLeft:ci,margin:ci,marginTop:ci,marginRight:ci,marginBottom:ci,marginLeft:ci,backgroundPositionX:ci,backgroundPositionY:ci,...pit,zIndex:spe,fillOpacity:cE,strokeOpacity:cE,numOctaves:spe},mit={...eae,color:Bl,backgroundColor:Bl,outlineColor:Bl,fill:Bl,stroke:Bl,borderColor:Bl,borderTopColor:Bl,borderRightColor:Bl,borderBottomColor:Bl,borderLeftColor:Bl,filter:cJ,WebkitFilter:cJ},j9e=t=>mit[t];function E9e(t,e){let n=j9e(t);return n!==cJ&&(n=Zy),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const xit=new Set(["auto","none","0"]);function git(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!xit.has(a)&&uE(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=E9e(n,s)}let bit=class extends Zie{constructor(e,n,r,s,a){super(e,n,r,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),Vie(u))){const d=C9e(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!S9e.has(r)||e.length!==2)return;const[s,a]=e,o=rpe(s),l=rpe(a);if(o!==l)if(Jhe(o)&&Jhe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else l3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||uit(e[s]))&&r.push(s);r.length&&git(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l3[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=l3[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}};function yit(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const _9e=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function vit(t){return LB(t)&&"offsetHeight"in t}const ipe=30,wit=t=>!isNaN(parseFloat(t));let Cit=class{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const s=rf.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=rf.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=wit(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new RA);const r=this.events[e].add(n);return e==="change"?()=>{r(),Lo.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=rf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>ipe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ipe);return BB(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ZS(t,e){return new Cit(t,e)}const{schedule:tae,cancel:H6n}=s9e(queueMicrotask,!1),Hp={x:!1,y:!1};function k9e(){return Hp.x||Hp.y}function Sit(t){return t==="x"||t==="y"?Hp[t]?null:(Hp[t]=!0,()=>{Hp[t]=!1}):Hp.x||Hp.y?null:(Hp.x=Hp.y=!0,()=>{Hp.x=Hp.y=!1})}function T9e(t,e){const n=yit(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function ape(t){return!(t.pointerType==="touch"||k9e())}function Nit(t,e,n={}){const[r,s,a]=T9e(t,n),o=l=>{if(!ape(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{ape(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const P9e=(t,e)=>e?t===e?!0:P9e(t,e.parentElement):!1,nae=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Ait=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function jit(t){return Ait.has(t.tagName)||t.tabIndex!==-1}const NO=new WeakSet;function ope(t){return e=>{e.key==="Enter"&&t(e)}}function OH(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Eit=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=ope(()=>{if(NO.has(n))return;OH(n,"down");const s=ope(()=>{OH(n,"up")}),a=()=>OH(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function lpe(t){return nae(t)&&!k9e()}function _it(t,e,n={}){const[r,s,a]=T9e(t,n),o=l=>{const c=l.currentTarget;if(!lpe(l))return;NO.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),NO.has(c)&&NO.delete(c),lpe(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||P9e(c,g.target))},x=g=>{d(g,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",x,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),vit(l)&&(l.addEventListener("focus",u=>Eit(u,s)),!jit(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function I9e(t){return LB(t)&&"ownerSVGElement"in t}function kit(t){return I9e(t)&&t.tagName==="svg"}const Lu=t=>!!(t&&t.getVelocity),Tit=[...A9e,Bl,Zy],Pit=t=>Tit.find(N9e(t)),F9e=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Iit(t=!0){const e=m.useContext(Oie);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,a=m.useId();m.useEffect(()=>{if(t)return s(a)},[t]);const o=m.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,o]:[!0]}const O9e=m.createContext({strict:!1}),cpe={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},JS={};for(const t in cpe)JS[t]={isEnabled:e=>cpe[t].some(n=>!!e[n])};function Fit(t){for(const e in t)JS[e]={...JS[e],...t[e]}}const Oit=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function HM(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Oit.has(t)}let M9e=t=>!HM(t);function Mit(t){typeof t=="function"&&(M9e=e=>e.startsWith("on")?!HM(e):t(e))}try{Mit(require("@emotion/is-prop-valid").default)}catch{}function Rit(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(M9e(s)||n===!0&&HM(s)||!e&&!HM(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const $B=m.createContext({});function UB(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function dE(t){return typeof t=="string"||Array.isArray(t)}const rae=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sae=["initial",...rae];function zB(t){return UB(t.animate)||sae.some(e=>dE(t[e]))}function R9e(t){return!!(zB(t)||t.variants)}function Lit(t,e){if(zB(t)){const{initial:n,animate:r}=t;return{initial:n===!1||dE(n)?n:void 0,animate:dE(r)?r:void 0}}return t.inherit!==!1?e:{}}function Dit(t){const{initial:e,animate:n}=Lit(t,m.useContext($B));return m.useMemo(()=>({initial:e,animate:n}),[upe(e),upe(n)])}function upe(t){return Array.isArray(t)?t.join(" "):t}const fE={};function Bit(t){for(const e in t)fE[e]=t[e],Hie(e)&&(fE[e].isCSSVariable=!0)}function L9e(t,{layout:e,layoutId:n}){return BA.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!fE[t]||t==="opacity")}const $it={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Uit=DA.length;function zit(t,e,n){let r="",s=!0;for(let a=0;a<Uit;a++){const o=DA[a],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=_9e(l,eae[o]);if(!c){s=!1;const d=$it[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function iae(t,e,n){const{style:r,vars:s,transformOrigin:a}=t;let o=!1,l=!1;for(const c in e){const u=e[c];if(BA.has(c)){o=!0;continue}else if(Hie(c)){s[c]=u;continue}else{const d=_9e(u,eae[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=zit(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=a;r.transformOrigin=`${c} ${u} ${d}`}}const aae=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function D9e(t,e,n){for(const r in e)!Lu(e[r])&&!L9e(r,n)&&(t[r]=e[r])}function Hit({transformTemplate:t},e){return m.useMemo(()=>{const n=aae();return iae(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Vit(t,e){const n=t.style||{},r={};return D9e(r,n,t),Object.assign(r,Hit(t,e)),r}function Wit(t,e){const n={},r=Vit(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const qit={offset:"stroke-dashoffset",array:"stroke-dasharray"},Git={offset:"strokeDashoffset",array:"strokeDasharray"};function Kit(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?qit:Git;t[a.offset]=ci.transform(-r);const o=ci.transform(e),l=ci.transform(n);t[a.array]=`${o} ${l}`}function B9e(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(iae(t,l,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:x}=t;f.transform&&(x.transform=f.transform,delete f.transform),(x.transform||f.transformOrigin)&&(x.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),x.transform&&(x.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),s!==void 0&&Kit(f,s,a,o,!1)}const $9e=()=>({...aae(),attrs:{}}),U9e=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Yit(t,e,n,r){const s=m.useMemo(()=>{const a=$9e();return B9e(a,e,U9e(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};D9e(a,t.style,t),s.style={...a,...s.style}}return s}const Xit=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function oae(t){return typeof t!="string"||t.includes("-")?!1:!!(Xit.indexOf(t)>-1||/[A-Z]/u.test(t))}function Qit(t,e,n,{latestValues:r},s,a=!1){const l=(oae(t)?Yit:Wit)(e,r,s,t),c=Rit(e,typeof t=="string",a),u=t!==m.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=m.useMemo(()=>Lu(d)?d.get():d,[d]);return m.createElement(t,{...u,children:f})}function dpe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function lae(t,e,n,r){if(typeof e=="function"){const[s,a]=dpe(r);e=e(n!==void 0?n:t.custom,s,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,a]=dpe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function AO(t){return Lu(t)?t.get():t}function Zit({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:Jit(n,r,s,t),renderState:e()}}function Jit(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=AO(a[x]);let{initial:o,animate:l}=t;const c=zB(t),u=R9e(t);e&&u&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!UB(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=lae(t,x[g]);if(y){const{transitionEnd:v,transition:C,...N}=y;for(const P in N){let T=N[P];if(Array.isArray(T)){const M=d?T.length-1:0;T=T[M]}T!==null&&(s[P]=T)}for(const P in v)s[P]=v[P]}}}return s}const z9e=t=>(e,n)=>{const r=m.useContext($B),s=m.useContext(Oie),a=()=>Zit(t,e,r,s);return n?a():Mrt(a)};function cae(t,e,n){var a;const{style:r}=t,s={};for(const o in r)(Lu(r[o])||e.style&&Lu(e.style[o])||L9e(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const eat=z9e({scrapeMotionValuesFromProps:cae,createRenderState:aae});function H9e(t,e,n){const r=cae(t,e,n);for(const s in t)if(Lu(t[s])||Lu(e[s])){const a=DA.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const tat=z9e({scrapeMotionValuesFromProps:H9e,createRenderState:$9e}),nat=Symbol.for("motionComponentSymbol");function QC(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function rat(t,e,n){return m.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):QC(n)&&(n.current=r))},[e])}const uae=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),sat="framerAppearId",V9e="data-"+uae(sat),W9e=m.createContext({});function iat(t,e,n,r,s){var v,C;const{visualElement:a}=m.useContext($B),o=m.useContext(O9e),l=m.useContext(Oie),c=m.useContext(F9e).reducedMotion,u=m.useRef(null);r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,f=m.useContext(W9e);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&aat(u.current,n,s,f);const x=m.useRef(!1);m.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[V9e],y=m.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return Rrt(()=>{d&&(x.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),y.current&&d.animationState&&d.animationState.animateChanges())}),m.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var N;(N=window.MotionHandoffMarkAsComplete)==null||N.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function aat(t,e,n,r){const{layoutId:s,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:q9e(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&QC(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function q9e(t){if(t)return t.options.allowProjection!==!1?t.projection:q9e(t.parent)}function MH(t,{forwardMotionProps:e=!1}={},n,r){n&&Fit(n);const s=oae(t)?tat:eat;function a(l,c){let u;const d={...m.useContext(F9e),...l,layoutId:oat(l)},{isStatic:f}=d,x=Dit(l),g=s(l,f);if(!f&&Fie){lat();const y=cat(d);u=y.MeasureLayout,x.visualElement=iat(t,g,d,r,y.ProjectionNode)}return i.jsxs($B.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,Qit(t,l,rat(g,x.visualElement,c),g,f,e)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=m.forwardRef(a);return o[nat]=t,o}function oat({layoutId:t}){const e=m.useContext(Z7e).id;return e&&t!==void 0?e+"-"+t:t}function lat(t,e){m.useContext(O9e).strict}function cat(t){const{drag:e,layout:n}=JS;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function uat(t,e){if(typeof Proxy>"u")return MH;const n=new Map,r=(a,o)=>MH(a,o,t,e),s=(a,o)=>r(a,o);return new Proxy(s,{get:(a,o)=>o==="create"?r:(n.has(o)||n.set(o,MH(o,void 0,t,e)),n.get(o))})}function G9e({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function dat({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function fat(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function RH(t){return t===void 0||t===1}function uJ({scale:t,scaleX:e,scaleY:n}){return!RH(t)||!RH(e)||!RH(n)}function Uv(t){return uJ(t)||K9e(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function K9e(t){return fpe(t.x)||fpe(t.y)}function fpe(t){return t&&t!=="0%"}function VM(t,e,n){const r=t-n,s=e*r;return n+s}function hpe(t,e,n,r,s){return s!==void 0&&(t=VM(t,s,r)),VM(t,n,r)+e}function dJ(t,e=0,n=1,r,s){t.min=hpe(t.min,e,n,r,s),t.max=hpe(t.max,e,n,r,s)}function Y9e(t,{x:e,y:n}){dJ(t.x,e.translate,e.scale,e.originPoint),dJ(t.y,n.translate,n.scale,n.originPoint)}const ppe=.999999999999,mpe=1.0000000000001;function hat(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let a,o;for(let l=0;l<s;l++){a=n[l],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&JC(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Y9e(t,o)),r&&Uv(a.latestValues)&&JC(t,a.latestValues))}e.x<mpe&&e.x>ppe&&(e.x=1),e.y<mpe&&e.y>ppe&&(e.y=1)}function ZC(t,e){t.min=t.min+e,t.max=t.max+e}function xpe(t,e,n,r,s=.5){const a=qo(t.min,t.max,s);dJ(t,e,n,a,r)}function JC(t,e){xpe(t.x,e.x,e.scaleX,e.scale,e.originX),xpe(t.y,e.y,e.scaleY,e.scale,e.originY)}function X9e(t,e){return G9e(fat(t.getBoundingClientRect(),e))}function pat(t,e,n){const r=X9e(t,n),{scroll:s}=e;return s&&(ZC(r.x,s.offset.x),ZC(r.y,s.offset.y)),r}const gpe=()=>({translate:0,scale:1,origin:0,originPoint:0}),e4=()=>({x:gpe(),y:gpe()}),bpe=()=>({min:0,max:0}),bl=()=>({x:bpe(),y:bpe()}),fJ={current:null},Q9e={current:!1};function mat(){if(Q9e.current=!0,!!Fie)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>fJ.current=t.matches;t.addEventListener("change",e),e()}else fJ.current=!1}const xat=new WeakMap;function gat(t,e,n){for(const r in e){const s=e[r],a=n[r];if(Lu(s))t.addValue(r,s);else if(Lu(a))t.addValue(r,ZS(s,{owner:t}));else if(a!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,ZS(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const ype=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let bat=class{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Zie,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=rf.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Lo.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=zB(n),this.isVariantNode=R9e(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const x in f){const g=f[x];c[x]!==void 0&&Lu(g)&&g.set(c[x])}}mount(e){var n;this.current=e,xat.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),Q9e.current||mat(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:fJ.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),Qy(this.notifyUpdate),Qy(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=BA.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Lo.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in JS){const n=JS[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):bl()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<ype.length;r++){const s=ype[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,o=e[a];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=gat(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=ZS(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(RB(r)||DB(r))?r=parseFloat(r):!Pit(r)&&Zy.test(n)&&(r=E9e(e,n)),this.setBaseTarget(e,Lu(r)?r.get():r)),Lu(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var a;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=lae(this.props,n,(a=this.presenceContext)==null?void 0:a.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Lu(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new RA),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){tae.render(this.render)}},Z9e=class extends bat{constructor(){super(...arguments),this.KeyframeResolver=bit}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Lu(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}};function J9e(t,{style:e,vars:n},r,s){const a=t.style;let o;for(o in e)a[o]=e[o];s==null||s.applyProjectionStyles(a,r);for(o in n)a.setProperty(o,n[o])}function yat(t){return window.getComputedStyle(t)}let vat=class extends Z9e{constructor(){super(...arguments),this.type="html",this.renderInstance=J9e}readValueFromInstance(e,n){var r;if(BA.has(n))return(r=this.projection)!=null&&r.isProjecting?rJ(n):Lst(e,n);{const s=yat(e),a=(Hie(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return X9e(e,n)}build(e,n,r){iae(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return cae(e,n,r)}};const eEe=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function wat(t,e,n,r){J9e(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(eEe.has(s)?s:uae(s),e.attrs[s])}let Cat=class extends Z9e{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=bl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(BA.has(n)){const r=j9e(n);return r&&r.default||0}return n=eEe.has(n)?n:uae(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return H9e(e,n,r)}build(e,n,r){B9e(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){wat(e,n,r,s)}mount(e){this.isSVGTag=U9e(e.tagName),super.mount(e)}};const Sat=(t,e)=>oae(t)?new Cat(e):new vat(e,{allowProjection:t!==m.Fragment});function y4(t,e,n){const r=t.getProps();return lae(r,e,n!==void 0?n:r.custom,t)}const hJ=t=>Array.isArray(t);function Nat(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ZS(n))}function Aat(t){return hJ(t)?t[t.length-1]||0:t}function jat(t,e){const n=y4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=Aat(a[o]);Nat(t,o,l)}}function Eat(t){return!!(Lu(t)&&t.add)}function pJ(t,e){const n=t.getValue("willChange");if(Eat(n))return n.add(e);if(!n&&Dc.WillChange){const r=new Dc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function tEe(t){return t.props[V9e]}const _at=t=>t!==null;function kat(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(_at),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const Tat={type:"spring",stiffness:500,damping:25,restSpeed:10},Pat=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Iat={type:"keyframes",duration:.8},Fat={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Oat=(t,{keyframes:e})=>e.length>2?Iat:BA.has(t)?t.startsWith("scale")?Pat(e[1]):Tat:Fat;function Mat({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:a,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const dae=(t,e,n,r={},s,a)=>o=>{const l=Jie(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Wl(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:x=>{e.set(x),l.onUpdate&&l.onUpdate(x)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:a?void 0:s};Mat(l)||Object.assign(d,Oat(t,d)),d.duration&&(d.duration=Wl(d.duration)),d.repeatDelay&&(d.repeatDelay=Wl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(lJ(d),d.delay===0&&(f=!0)),(Dc.instantAnimations||Dc.skipAnimations)&&(f=!0,lJ(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=kat(d.keyframes,l);if(x!==void 0){Lo.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new Qie(d):new ait(d)};function Rat({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function nEe(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:a=t.getDefaultTransition(),transitionEnd:o,...l}=e;r&&(a=r);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const f=t.getValue(d,t.latestValues[d]??null),x=l[d];if(x===void 0||u&&Rat(u,d))continue;const g={delay:n,...Jie(a||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(x)&&x===y&&!g.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const N=tEe(t);if(N){const P=window.MotionHandoffAnimation(N,d,Lo);P!==null&&(g.startTime=P,v=!0)}}pJ(t,d),f.start(dae(d,f,x,t.shouldReduceMotion&&S9e.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{Lo.update(()=>{o&&jat(t,o)})}),c}function rEe(t,e,n,r=0,s=1){const a=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,l=(o-1)*r;return typeof n=="function"?n(a,o):s===1?a*r:l-a*r}function mJ(t,e,n={}){var c;const r=y4(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(nEe(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return Lat(t,e,u,d,f,x,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function Lat(t,e,n=0,r=0,s=0,a=1,o){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(mJ(c,e,{...o,delay:n+(typeof r=="function"?0:r)+rEe(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function Dat(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>mJ(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=mJ(t,e,n);else{const s=typeof e=="function"?y4(t,e,n.custom):e;r=Promise.all(nEe(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function sEe(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Bat=sae.length;function iEe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?iEe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Bat;n++){const r=sae[n],s=t.props[r];(dE(s)||s===!1)&&(e[r]=s)}return e}const $at=[...rae].reverse(),Uat=rae.length;function zat(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Dat(t,n,r)))}function Hat(t){let e=zat(t),n=vpe(),r=!0;const s=c=>(u,d)=>{var x;const f=y4(t,d,c==="exit"?(x=t.presenceContext)==null?void 0:x.custom:void 0);if(f){const{transition:g,transitionEnd:y,...v}=f;u={...u,...v,...y}}return u};function a(c){e=c(t)}function o(c){const{props:u}=t,d=iEe(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<Uat;C++){const N=$at[C],P=n[N],T=u[N]!==void 0?u[N]:d[N],M=dE(T),F=N===c?P.isActive:null;F===!1&&(y=C);let $=T===d[N]&&T!==u[N]&&M;if($&&r&&t.manuallyAnimateOnMount&&($=!1),P.protectedKeys={...g},!P.isActive&&F===null||!T&&!P.prevProp||UB(T)||typeof T=="boolean")continue;const L=Vat(P.prevProp,T);let z=L||N===c&&P.isActive&&!$&&M||C>y&&M,X=!1;const ne=Array.isArray(T)?T:[T];let J=ne.reduce(s(N),{});F===!1&&(J={});const{prevResolvedValues:K={}}=P,te={...K,...J},fe=ae=>{z=!0,x.has(ae)&&(X=!0,x.delete(ae)),P.needsAnimating[ae]=!0;const W=t.getValue(ae);W&&(W.liveStyle=!1)};for(const ae in te){const W=J[ae],V=K[ae];if(g.hasOwnProperty(ae))continue;let ee=!1;hJ(W)&&hJ(V)?ee=!sEe(W,V):ee=W!==V,ee?W!=null?fe(ae):x.add(ae):W!==void 0&&x.has(ae)?fe(ae):P.protectedKeys[ae]=!0}P.prevProp=T,P.prevResolvedValues=J,P.isActive&&(g={...g,...J}),r&&t.blockInitialAnimation&&(z=!1);const q=$&&L;z&&(!q||X)&&f.push(...ne.map(ae=>{const W={type:N};if(typeof ae=="string"&&r&&!q&&t.manuallyAnimateOnMount&&t.parent){const{parent:V}=t,ee=y4(V,ae);if(V.enteringChildren&&ee){const{delayChildren:oe}=ee.transition||{};W.delay=rEe(V.enteringChildren,t,oe)}}return{animation:ae,options:W}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const N=y4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);N&&N.transition&&(C.transition=N.transition)}x.forEach(N=>{const P=t.getBaseTarget(N),T=t.getValue(N);T&&(T.liveStyle=!0),C[N]=P??null}),f.push({animation:C})}let v=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(v=!1),r=!1,v?e(f):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=t.variantChildren)==null||f.forEach(x=>{var g;return(g=x.animationState)==null?void 0:g.setActive(c,u)}),n[c].isActive=u;const d=o(c);for(const x in n)n[x].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=vpe(),r=!0}}}function Vat(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!sEe(e,t):!1}function Nv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vpe(){return{animate:Nv(!0),whileInView:Nv(),whileHover:Nv(),whileTap:Nv(),whileDrag:Nv(),whileFocus:Nv(),exit:Nv()}}let w2=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},Wat=class extends w2{constructor(e){super(e),e.animationState||(e.animationState=Hat(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();UB(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}},qat=0,Gat=class extends w2{constructor(){super(...arguments),this.id=qat++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}};const Kat={animation:{Feature:Wat},exit:{Feature:Gat}};function hE(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function oT(t){return{point:{x:t.pageX,y:t.pageY}}}const Yat=t=>e=>nae(e)&&t(e,oT(e));function b9(t,e,n,r){return hE(t,e,Yat(n),r)}const aEe=1e-4,Xat=1-aEe,Qat=1+aEe,oEe=.01,Zat=0-oEe,Jat=0+oEe;function dd(t){return t.max-t.min}function eot(t,e,n){return Math.abs(t-e)<=n}function wpe(t,e,n,r=.5){t.origin=r,t.originPoint=qo(e.min,e.max,t.origin),t.scale=dd(n)/dd(e),t.translate=qo(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Xat&&t.scale<=Qat||isNaN(t.scale))&&(t.scale=1),(t.translate>=Zat&&t.translate<=Jat||isNaN(t.translate))&&(t.translate=0)}function y9(t,e,n,r){wpe(t.x,e.x,n.x,r?r.originX:void 0),wpe(t.y,e.y,n.y,r?r.originY:void 0)}function Cpe(t,e,n){t.min=n.min+e.min,t.max=t.min+dd(e)}function tot(t,e,n){Cpe(t.x,e.x,n.x),Cpe(t.y,e.y,n.y)}function Spe(t,e,n){t.min=e.min-n.min,t.max=t.min+dd(e)}function v9(t,e,n){Spe(t.x,e.x,n.x),Spe(t.y,e.y,n.y)}function Bh(t){return[t("x"),t("y")]}const lEe=({current:t})=>t?t.ownerDocument.defaultView:null,Npe=(t,e)=>Math.abs(t-e);function not(t,e){const n=Npe(t.x,e.x),r=Npe(t.y,e.y);return Math.sqrt(n**2+r**2)}let cEe=class{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=DH(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=not(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!y)return;const{point:v}=x,{timestamp:C}=Zc;this.history.push({...v,timestamp:C});const{onStart:N,onMove:P}=this.handlers;g||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),P&&P(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=LH(g,this.transformPagePoint),Lo.update(this.updatePoint,!0)},this.handlePointerUp=(x,g)=>{this.end();const{onEnd:y,onSessionEnd:v,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=DH(x.type==="pointercancel"?this.lastMoveEventInfo:LH(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,N),v&&v(x,N)},!nae(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=oT(e),c=LH(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Zc;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,DH(c,this.history)),this.removeListeners=vx(b9(this.contextWindow,"pointermove",this.handlePointerMove),b9(this.contextWindow,"pointerup",this.handlePointerUp),b9(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Qy(this.updatePoint)}};function LH(t,e){return e?{point:e(t.point)}:t}function Ape(t,e){return{x:t.x-e.x,y:t.y-e.y}}function DH({point:t},e){return{point:t,delta:Ape(t,uEe(e)),offset:Ape(t,rot(e)),velocity:sot(e,.1)}}function rot(t){return t[0]}function uEe(t){return t[t.length-1]}function sot(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=uEe(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Wl(e)));)n--;if(!r)return{x:0,y:0};const a=ll(s.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(s.x-r.x)/a,y:(s.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function iot(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?qo(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?qo(n,t,r.max):Math.min(t,n)),t}function jpe(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function aot(t,{top:e,left:n,bottom:r,right:s}){return{x:jpe(t.x,n,s),y:jpe(t.y,e,r)}}function Epe(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function oot(t,e){return{x:Epe(t.x,e.x),y:Epe(t.y,e.y)}}function lot(t,e){let n=.5;const r=dd(t),s=dd(e);return s>r?n=sx(e.min,e.max-r,t.min):r>s&&(n=sx(t.min,t.max-s,e.min)),Lc(0,1,n)}function cot(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const xJ=.35;function uot(t=xJ){return t===!1?t=0:t===!0&&(t=xJ),{x:_pe(t,"left","right"),y:_pe(t,"top","bottom")}}function _pe(t,e,n){return{min:kpe(t,e),max:kpe(t,n)}}function kpe(t,e){return typeof t=="number"?t:t[e]||0}const dot=new WeakMap;let fot=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=bl(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=f=>{const{dragSnapToOrigin:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(oT(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Sit(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bh(N=>{let P=this.getAxisMotionValue(N).get()||0;if(W0.test(P)){const{projection:T}=this.visualElement;if(T&&T.layout){const M=T.layout.layoutBox[N];M&&(P=dd(M)*(parseFloat(P)/100))}}this.originPoint[N]=P}),v&&Lo.postRender(()=>v(f,x)),pJ(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},l=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x;const{dragPropagation:g,dragDirectionLock:y,onDirectionLock:v,onDrag:C}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:N}=x;if(y&&this.currentDirection===null){this.currentDirection=hot(N),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),C&&C(f,x)},c=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x,this.stop(f,x),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>Bh(f=>{var x;return this.getAnimationState(f)==="paused"&&((x=this.getAxisMotionValue(f).animation)==null?void 0:x.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new cEe(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:lEe(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Lo.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!pI(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=iot(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){var a;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,s=this.constraints;e&&QC(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=aot(r.layoutBox,e):this.constraints=!1,this.elastic=uot(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bh(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=cot(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!QC(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=pat(r,s.root,this.visualElement.getTransformPagePoint());let o=oot(s.layout.layoutBox,a);if(n){const l=n(dat(o));this.hasMutatedConstraints=!!l,l&&(o=G9e(l))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Bh(d=>{if(!pI(d,n,this.currentDirection))return;let f=c[d]||{};o&&(f={min:0,max:0});const x=s?200:1e6,g=s?40:1e7,y={type:"inertia",velocity:r?e[d]:0,bounceStiffness:x,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...a,...f};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return pJ(this.visualElement,e),r.start(dae(e,r,0,n,this.visualElement,!1))}stopAnimation(){Bh(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bh(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Bh(n=>{const{drag:r}=this.getProps();if(!pI(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];a.set(e[n]-qo(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!QC(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Bh(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=lot({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Bh(o=>{if(!pI(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(qo(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;dot.set(this.visualElement,this);const e=this.visualElement.current,n=b9(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();QC(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,a=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Lo.read(r);const o=hE(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Bh(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:o=xJ,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}};function pI(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function hot(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}let pot=class extends w2{constructor(e){super(e),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new fot(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}unmount(){this.removeGroupControls(),this.removeListeners()}};const Tpe=t=>(e,n)=>{t&&Lo.postRender(()=>t(e,n))};let mot=class extends w2{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(e){this.session=new cEe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lEe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:Tpe(e),onStart:Tpe(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&Lo.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=b9(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};const jO={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ppe(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const U8={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ci.test(t))t=parseFloat(t);else return t;const n=Ppe(t,e.target.x),r=Ppe(t,e.target.y);return`${n}% ${r}%`}},xot={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Zy.parse(t);if(s.length>5)return r;const a=Zy.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=qo(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),a(s)}};let BH=!1,got=class extends m.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;Bit(bot),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),BH&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),jO.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,BH=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||Lo.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),tae.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;BH=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function dEe(t){const[e,n]=Iit(),r=m.useContext(Z7e);return i.jsx(got,{...t,layoutGroup:r,switchLayoutGroup:m.useContext(W9e),isPresent:e,safeToRemove:n})}const bot={borderRadius:{...U8,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:U8,borderTopRightRadius:U8,borderBottomLeftRadius:U8,borderBottomRightRadius:U8,boxShadow:xot};function yot(t,e,n){const r=Lu(t)?t:ZS(t);return r.start(dae("",r,e,n)),r.animation}const vot=(t,e)=>t.depth-e.depth;let wot=class{constructor(){this.children=[],this.isDirty=!1}add(e){rT(this.children,e),this.isDirty=!0}remove(e){sT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(vot),this.isDirty=!1,this.children.forEach(e)}};function Cot(t,e){const n=rf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(Qy(r),t(a-e))};return Lo.setup(r,!0),()=>Qy(r)}const fEe=["TopLeft","TopRight","BottomLeft","BottomRight"],Sot=fEe.length,Ipe=t=>typeof t=="string"?parseFloat(t):t,Fpe=t=>typeof t=="number"||ci.test(t);function Not(t,e,n,r,s,a){s?(t.opacity=qo(0,n.opacity??1,Aot(r)),t.opacityExit=qo(e.opacity??1,0,jot(r))):a&&(t.opacity=qo(e.opacity??1,n.opacity??1,r));for(let o=0;o<Sot;o++){const l=`border${fEe[o]}Radius`;let c=Ope(e,l),u=Ope(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||Fpe(c)===Fpe(u)?(t[l]=Math.max(qo(Ipe(c),Ipe(u),r),0),(W0.test(u)||W0.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=qo(e.rotate||0,n.rotate||0,r))}function Ope(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Aot=hEe(0,.5,Bie),jot=hEe(.5,.95,dl);function hEe(t,e,n){return r=>r<t?0:r>e?1:n(sx(t,e,r))}function Mpe(t,e){t.min=e.min,t.max=e.max}function Nh(t,e){Mpe(t.x,e.x),Mpe(t.y,e.y)}function Rpe(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Lpe(t,e,n,r,s){return t-=e,t=VM(t,1/n,r),s!==void 0&&(t=VM(t,1/s,r)),t}function Eot(t,e=0,n=1,r=.5,s,a=t,o=t){if(W0.test(e)&&(e=parseFloat(e),e=qo(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=qo(a.min,a.max,r);t===a&&(l-=e),t.min=Lpe(t.min,e,n,l,s),t.max=Lpe(t.max,e,n,l,s)}function Dpe(t,e,[n,r,s],a,o){Eot(t,e[n],e[r],e[s],e.scale,a,o)}const _ot=["x","scaleX","originX"],kot=["y","scaleY","originY"];function Bpe(t,e,n,r){Dpe(t.x,e,_ot,n?n.x:void 0,r?r.x:void 0),Dpe(t.y,e,kot,n?n.y:void 0,r?r.y:void 0)}function $pe(t){return t.translate===0&&t.scale===1}function pEe(t){return $pe(t.x)&&$pe(t.y)}function Upe(t,e){return t.min===e.min&&t.max===e.max}function Tot(t,e){return Upe(t.x,e.x)&&Upe(t.y,e.y)}function zpe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function mEe(t,e){return zpe(t.x,e.x)&&zpe(t.y,e.y)}function Hpe(t){return dd(t.x)/dd(t.y)}function Vpe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}let Pot=class{constructor(){this.members=[]}add(e){rT(this.members,e),e.scheduleRender()}remove(e){if(sT(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const a=this.members[s];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function Iot(t,e,n){let r="";const s=t.x.translate/e.x,a=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||a||o)&&(r=`translate3d(${s}px, ${a}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:x,skewX:g,skewY:y}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),x&&(r+=`rotateY(${x}deg) `),g&&(r+=`skewX(${g}deg) `),y&&(r+=`skewY(${y}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const $H=["","X","Y","Z"],Fot=1e3;let Oot=0;function UH(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function xEe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=tEe(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Lo,!(s||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&xEe(r)}function gEe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=Oot++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Lot),this.nodes.forEach(Uot),this.nodes.forEach(zot),this.nodes.forEach(Dot)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new wot)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new RA),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=I9e(o)&&!kit(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let d,f=0;const x=()=>this.root.updateBlockedByResize=!1;Lo.read(()=>{f=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,d&&d(),d=Cot(x,250),jO.hasAnimatedSinceResize&&(jO.hasAnimatedSinceResize=!1,this.nodes.forEach(Gpe)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:x,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||Got,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),N=!this.targetLayout||!mEe(this.targetLayout,g),P=!f&&x;if(this.options.layoutRoot||this.resumeFrom||P||f&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Jie(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(d,P)}else f||Gpe(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Qy(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Hot),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xEe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Wpe);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(qpe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach($ot),this.nodes.forEach(Mot),this.nodes.forEach(Rot)):this.nodes.forEach(qpe),this.clearAllSnapshots();const l=rf.now();Zc.delta=Lc(0,1e3/60,l-Zc.timestamp),Zc.timestamp=l,Zc.isProcessing=!0,TH.update.process(Zc),TH.preRender.process(Zc),TH.render.process(Zc),Zc.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tae.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Bot),this.sharedNodes.forEach(Vot)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Lo.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Lo.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!dd(this.snapshot.measuredBox.x)&&!dd(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=bl(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!pEe(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Uv(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),Kot(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return bl();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Yot))){const{scroll:d}=this.root;d&&(ZC(l.x,d.offset.x),ZC(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=bl();if(Nh(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:x}=d;d!==this.root&&f&&x.layoutScroll&&(f.wasRoot&&Nh(l,o),ZC(l.x,f.offset.x),ZC(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=bl();Nh(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&JC(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Uv(d.latestValues)&&JC(c,d.latestValues)}return Uv(this.latestValues)&&JC(c,this.latestValues),c}removeTransform(o){const l=bl();Nh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Uv(u.latestValues))continue;uJ(u.latestValues)&&u.updateSnapshot();const d=bl(),f=u.measurePageBox();Nh(d,f),Bpe(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Uv(this.latestValues)&&Bpe(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Zc.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var x;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!(!this.layout||!(d||f))){if(this.resolvedRelativeTargetAt=Zc.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=bl(),this.relativeTargetOrigin=bl(),v9(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Nh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=bl(),this.targetWithTransforms=bl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),tot(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Nh(this.target,this.layout.layoutBox),Y9e(this.target,this.targetDelta)):Nh(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=bl(),this.relativeTargetOrigin=bl(),v9(this.relativeTargetOrigin,this.target,g.target),Nh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||uJ(this.parent.latestValues)||K9e(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var y;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Zc.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Nh(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,x=this.treeScale.y;hat(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=bl());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Rpe(this.prevProjectionDelta.x,this.projectionDelta.x),Rpe(this.prevProjectionDelta.y,this.projectionDelta.y)),y9(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!Vpe(this.projectionDelta.x,this.prevProjectionDelta.x)||!Vpe(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=e4(),this.projectionDelta=e4(),this.projectionDeltaWithTransform=e4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=e4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const x=bl(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,v=g!==y,C=this.getStack(),N=!C||C.members.length<=1,P=!!(v&&!N&&this.options.crossfade===!0&&!this.path.some(qot));this.animationProgress=0;let T;this.mixTargetDelta=M=>{const F=M/1e3;Kpe(f.x,o.x,F),Kpe(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(v9(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Wot(this.relativeTarget,this.relativeTargetOrigin,x,F),T&&Tot(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=bl()),Nh(T,this.relativeTarget)),v&&(this.animationValues=d,Not(d,u,this.latestValues,F,P,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Qy(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Lo.update(()=>{jO.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ZS(0)),this.currentAnimation=yot(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Fot),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&bEe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||bl();const f=dd(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const x=dd(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+x}Nh(l,c),JC(l,d),y9(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Pot),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&UH("z",o,u,this.animationValues);for(let d=0;d<$H.length;d++)UH(`rotate${$H[d]}`,o,u,this.animationValues),UH(`skew${$H[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=AO(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=AO(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Uv(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=Iot(this.projectionDeltaWithTransform,this.treeScale,d);c&&(f=c(d,f)),o.transform=f;const{x,y:g}=this.projectionDelta;o.transformOrigin=`${x.origin*100}% ${g.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const y in fE){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:N}=fE[y],P=f==="none"?d[y]:v(d[y],u);if(C){const T=C.length;for(let M=0;M<T;M++)o[C[M]]=P}else N?this.options.visualElement.renderState.vars[y]=P:o[y]=P}this.options.layoutId&&(o.pointerEvents=u===this?AO(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(Wpe),this.root.sharedNodes.clear()}}}function Mot(t){t.updateLayout()}function Rot(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:a}=t.options,o=e.source!==t.layout.source;a==="size"?Bh(f=>{const x=o?e.measuredBox[f]:e.layoutBox[f],g=dd(x);x.min=r[f].min,x.max=x.min+g}):bEe(a,e.layoutBox,r)&&Bh(f=>{const x=o?e.measuredBox[f]:e.layoutBox[f],g=dd(r[f]);x.max=x.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+g)});const l=e4();y9(l,r,e.layoutBox);const c=e4();o?y9(c,t.applyTransform(s,!0),e.measuredBox):y9(c,r,e.layoutBox);const u=!pEe(l);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:x,layout:g}=f;if(x&&g){const y=bl();v9(y,e.layoutBox,x.layoutBox);const v=bl();v9(v,r,g.layoutBox),mEe(y,v)||(d=!0),f.options.layoutRoot&&(t.relativeTarget=v,t.relativeTargetOrigin=y,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Lot(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Dot(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Bot(t){t.clearSnapshot()}function Wpe(t){t.clearMeasurements()}function qpe(t){t.isLayoutDirty=!1}function $ot(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Gpe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Uot(t){t.resolveTargetDelta()}function zot(t){t.calcProjection()}function Hot(t){t.resetSkewAndRotation()}function Vot(t){t.removeLeadSnapshot()}function Kpe(t,e,n){t.translate=qo(e.translate,0,n),t.scale=qo(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ype(t,e,n,r){t.min=qo(e.min,n.min,r),t.max=qo(e.max,n.max,r)}function Wot(t,e,n,r){Ype(t.x,e.x,n.x,r),Ype(t.y,e.y,n.y,r)}function qot(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Got={duration:.45,ease:[.4,0,.1,1]},Xpe=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Qpe=Xpe("applewebkit/")&&!Xpe("chrome/")?Math.round:dl;function Zpe(t){t.min=Qpe(t.min),t.max=Qpe(t.max)}function Kot(t){Zpe(t.x),Zpe(t.y)}function bEe(t,e,n){return t==="position"||t==="preserve-aspect"&&!eot(Hpe(e),Hpe(n),.2)}function Yot(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Xot=gEe({attachResizeListener:(t,e)=>hE(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),zH={current:void 0},yEe=gEe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!zH.current){const t=new Xot({});t.mount(window),t.setOptions({layoutScroll:!0}),zH.current=t}return zH.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Qot={pan:{Feature:mot},drag:{Feature:pot,ProjectionNode:yEe,MeasureLayout:dEe}};function Jpe(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,a=r[s];a&&Lo.postRender(()=>a(e,oT(e)))}let Zot=class extends w2{mount(){const{current:e}=this.node;e&&(this.unmount=Nit(e,(n,r)=>(Jpe(this.node,r,"Start"),s=>Jpe(this.node,s,"End"))))}unmount(){}},Jot=class extends w2{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vx(hE(this.node.current,"focus",()=>this.onFocus()),hE(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function eme(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),a=r[s];a&&Lo.postRender(()=>a(e,oT(e)))}let elt=class extends w2{mount(){const{current:e}=this.node;e&&(this.unmount=_it(e,(n,r)=>(eme(this.node,r,"Start"),(s,{success:a})=>eme(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}};const gJ=new WeakMap,HH=new WeakMap,tlt=t=>{const e=gJ.get(t.target);e&&e(t)},nlt=t=>{t.forEach(tlt)};function rlt({root:t,...e}){const n=t||document;HH.has(n)||HH.set(n,{});const r=HH.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(nlt,{root:t,...e})),r[s]}function slt(t,e,n){const r=rlt(e);return gJ.set(t,n),r.observe(t),()=>{gJ.delete(t),r.unobserve(t)}}const ilt={some:0,all:1};let alt=class extends w2{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:a}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:ilt[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),x=u?d:f;x&&x(c)};return slt(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(olt(e,n))&&this.startObserver()}unmount(){}};function olt({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const llt={inView:{Feature:alt},tap:{Feature:elt},focus:{Feature:Jot},hover:{Feature:Zot}},clt={layout:{ProjectionNode:yEe,MeasureLayout:dEe}},ult={...Kat,...llt,...Qot,...clt},pm=uat(ult,Sat),tme={yellow:"bg-yellow-300",red:"bg-red-300",purple:"bg-purple-300",emerald:"bg-emerald-300",blue:"bg-sky-300",orange:"bg-orange-300"};function Lg({label:t="NEW",tone:e="yellow"}){const n=tme[e]??tme.yellow;return i.jsxs("span",{className:"relative inline-flex h-4 items-center rounded-full px-2 text-[9px] font-semibold uppercase tracking-[0.08em] text-black overflow-hidden select-none ml-1 mt-[1px]",children:[i.jsx("span",{className:`absolute inset-[1px] rounded-full ${n}`}),i.jsx(pm.span,{className:"absolute -inset-y-2 left-[-40%] h-[200%] w-[40%] rotate-[18deg] bg-gradient-to-r from-transparent via-white/70 to-transparent opacity-80",animate:{x:["0%","300%"]},transition:{duration:3.2,ease:"linear",repeat:1/0}}),i.jsx("span",{className:"relative z-10",children:t})]})}function dlt({label:t,items:e=[],activePaths:n=[],badgeLabel:r,badgeTone:s="yellow",align:a="left",border_color:o=""}){var f,x;const{pathname:l}=Kl(),c=(x=(f=n==null?void 0:n.filter(Boolean))==null?void 0:f.some)==null?void 0:x.call(f,g=>l.startsWith(g)),u=a==="right"?"right-0":"left-0",d=g=>{if(!g)return null;if(typeof g=="string")return i.jsx("img",{src:g,alt:"",className:"w-4 h-4 object-contain shrink-0",loading:"lazy"});if(Ne.isValidElement(g))return g;if(typeof g=="function"){const y=g;return i.jsx(y,{className:"w-4 h-4 shrink-0"})}return null};return i.jsxs(MB,{as:"div",className:"relative hidden sm:inline-block text-left",children:[i.jsxs(FB,{className:`${c?o==="blue"?"bg-[#1F2A44]":"bg-[#232323]":"bg-transparent"} ${o==="blue"?"border border-[#6bb8ff] rounded-full px-3 py-[4px] cursor-pointer mr-2 shadow-[0_0_6px_rgba(116,192,252,0.35)] hover:shadow-[0_0_10px_rgba(116,192,252,0.55)] hover:border-[#8ccaff] hover:bg-[#1b2836] transition-all duration-200":""} h-8 px-2 py-2 hover:bg-[#232323] rounded-[256px] inline-flex items-center focus:outline-none focus:ring-0`,children:[i.jsx("div",{className:"text-white text-[13px] font-semibold font-manrope leading-none",children:t}),r?i.jsx(Lg,{label:r,tone:s}):null,i.jsx(lE,{"aria-hidden":"true",className:"-mr-1 size-5 text-gray-400"})]}),i.jsx(OB,{transition:!0,className:`absolute ${u} z-50 mt-1 origin-top-right ring-1 ring-black/5 transition focus:outline-none data-[closed]:scale-95 data-[closed]:transform data-[closed]:opacity-0 data-[enter]:duration-100 data-[leave]:duration-75 data-[enter]:ease-out data-[leave]:ease-in w-max min-w-[220px] bg-[#1A1A1A] rounded-2xl shadow border border-[#242424]`,children:i.jsx("div",{className:"flex flex-col items-start gap-1.5 p-1.5",children:e.map((g,y)=>{if(g.flyout&&g.submenu)return i.jsxs(YC,{as:"div",className:"relative group w-full",children:[i.jsxs("div",{className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl flex justify-between items-center cursor-pointer",children:[i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:g.label}),i.jsx(lE,{className:"size-4 -rotate-90 text-gray-400"})]}),i.jsx("div",{className:"absolute top-0 left-full hidden group-hover:block z-50 px-2",children:i.jsx("div",{className:"min-w-[220px] bg-[#1A1A1A] rounded-2xl shadow border border-[#242424] p-1.5",children:g.submenu.map((C,N)=>C.to?i.jsx(dhe,{to:C.to,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl flex justify-between items-center",children:i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:C.label})},`sub-to-${N}`):i.jsxs("button",{onClick:C.onClick,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl flex justify-start items-center",children:[i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:C.label}),C.badge&&i.jsx(Lg,{tone:"emerald",label:C.badge})]},`sub-btn-${N}`))})})]},`flyout-${y}`);const v=()=>i.jsx("div",{className:"flex justify-between items-center gap-6 w-full",children:i.jsxs("div",{className:"text-white text-[13px] font-semibold font-manrope flex items-center gap-2",children:[d(g.icon),i.jsxs("span",{className:"flex items-center gap-2",children:[g.label,g.description?i.jsxs("span",{className:"text-[10.5px] text-[#ffffff] font-semibold",children:["(",g.description,")"]}):null]}),g.badge&&i.jsx(Lg,{tone:"emerald",label:g.badge})]})});return g.to?i.jsx(YC,{children:i.jsx(dhe,{to:g.to,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl block",children:i.jsx(v,{})})},`to-${g.to}-${y}`):g.href?i.jsx(YC,{children:i.jsx("a",{href:g.href,target:g.external?"_blank":void 0,rel:g.external?"noreferrer":void 0,className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl block",children:i.jsx(v,{})})},`href-${g.href}-${y}`):i.jsx(YC,{children:i.jsx("button",{className:"w-full p-2.5 hover:bg-[#111111] rounded-2xl",onClick:g.onClick,children:i.jsx(v,{})})},`btn-${y}`)})})})]})}const $A=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"121",height:"32",viewBox:"0 0 32 32",fill:"none",className:t,children:[i.jsx("path",{d:"M9.13309 30.4398L9.88315 26.9871C10.7197 23.1362 7.77521 19.4988 3.82118 19.4988H0.385363C1.4689 24.3374 4.75127 28.3496 9.13309 30.4398Z",fill:"currentColor"}),i.jsx("path",{d:"M10.64 31.0663C12.3326 31.6707 14.1567 32 16.0579 32C23.7199 32 30.1285 26.6527 31.7305 19.4988H21.249C16.5244 19.4988 12.4396 22.7824 11.44 27.3838L10.64 31.0663Z",fill:"currentColor"}),i.jsx("path",{d:"M32.0038 17.8987C32.0778 17.2756 32.1159 16.6415 32.1159 15.9985C32.1159 7.60402 25.629 0.719287 17.3779 0.0503251L15.1273 10.4105C14.2907 14.2614 17.2352 17.8987 21.1892 17.8987H32.0038Z",fill:"currentColor"}),i.jsx("path",{d:"M15.7459 0C7.02134 0.165717 0 7.26504 0 15.9985C0 16.6415 0.0380539 17.2756 0.112041 17.8987H3.76146C8.48603 17.8987 12.5709 14.6151 13.5705 10.0137L15.7459 0Z",fill:"currentColor"}),i.jsxs("defs",{children:[i.jsxs("linearGradient",{id:"paint0_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint1_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint2_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]}),i.jsxs("linearGradient",{id:"paint3_linear",x1:"18.9416",y1:"0",x2:"12.6408",y2:"32.0507",gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:"#F4D5B1"}),i.jsx("stop",{offset:"1",stopColor:"#FFD29F"})]})]})]}),M0=({className:t})=>i.jsxs("svg",{viewBox:"0 0 53 96",fill:"currentColor",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:`size-full ${t}`,children:[i.jsx("path",{d:"M23 76.3751L0 96V20.687L23 0V76.3751Z"}),i.jsx("path",{d:"M53 76.4219L30 96V66.6279L53 46V76.4219Z"})]}),flt="data:image/svg+xml,%3csvg%20width='21'%20height='20'%20viewBox='0%200%2021%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.6758%2020C16.1986%2020%2020.6758%2015.5228%2020.6758%2010C20.6758%204.47715%2016.1986%200%2010.6758%200C5.15293%200%200.675781%204.47715%200.675781%2010C0.675781%2015.5228%205.15293%2020%2010.6758%2020Z'%20fill='url(%23paint0_linear_26_4024)'/%3e%3cpath%20d='M15.667%205.86343C15.756%205.28809%2015.209%204.83396%2014.6975%205.05857L4.50863%209.532C4.14178%209.69307%204.16862%2010.2488%204.5491%2010.3699L6.65026%2011.0391C7.05133%2011.1668%207.48554%2011.1007%207.83576%2010.8588L12.573%207.58593C12.7159%207.48721%2012.8716%207.69036%2012.7495%207.81614L9.33954%2011.3319C9.00876%2011.6729%209.0744%2012.2509%209.47233%2012.5004L13.2902%2014.8945C13.7184%2015.163%2014.2693%2014.8933%2014.3493%2014.3758L15.667%205.86343Z'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_26_4024'%20x1='10.6758'%20y1='0'%20x2='10.6758'%20y2='20'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2337BBFE'/%3e%3cstop%20offset='1'%20stop-color='%23007DBB'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Yi="/assets/dextrabotIcon-B5aLRkPC.png",hlt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fillRule='evenodd'%20clipRule='evenodd'%20d='M9.72943%203.99268C10.8214%202.39501%2013.1782%202.39502%2014.2702%203.99268L14.7021%204.62463C17.4081%208.58385%2019.7331%2012.7905%2021.6458%2017.1881L21.736%2017.3956C22.4101%2018.9453%2021.3917%2020.705%2019.7122%2020.8927C14.5865%2021.4656%209.41304%2021.4656%204.28741%2020.8927C2.60787%2020.705%201.5895%2018.9453%202.26356%2017.3956L2.35377%2017.1881C4.2665%2012.7905%206.59147%208.58384%209.29751%204.62463L9.72943%203.99268ZM12.9998%209.00005C12.9998%209.55233%2012.5521%2010%2011.9998%2010C11.4475%2010%2010.9998%209.55233%2010.9998%209.00005C10.9998%208.44776%2011.4475%208.00005%2011.9998%208.00005C12.5521%208.00005%2012.9998%208.44776%2012.9998%209.00005ZM11.9998%2011.75C12.414%2011.75%2012.7498%2012.0858%2012.7498%2012.5V17.5C12.7498%2017.9143%2012.414%2018.25%2011.9998%2018.25C11.5856%2018.25%2011.2498%2017.9143%2011.2498%2017.5V12.5C11.2498%2012.0858%2011.5856%2011.75%2011.9998%2011.75Z'%20fill='%23FF3566'/%3e%3c/svg%3e",plt="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M29.2932%209.61329C28.9198%205.97329%2026.0265%203.07996%2022.3865%202.70663C22.1198%202.67996%2021.8532%202.66663%2021.5865%202.66663H10.4132C10.1465%202.66663%209.87984%202.67996%209.61317%202.70663C5.97317%203.07996%203.07984%205.97329%202.7065%209.61329C2.67984%209.87996%202.6665%2010.1466%202.6665%2010.4133V21.5866C2.6665%2021.8533%202.67984%2022.12%202.7065%2022.3866C3.07984%2026.0266%205.97317%2028.92%209.61317%2029.2933C9.87984%2029.32%2010.1465%2029.3333%2010.4132%2029.3333H18.6665C19.3998%2029.3333%2019.9998%2028.7333%2019.9998%2028V24.04C19.9998%2021.8133%2021.8132%2020%2024.0398%2020H27.9998C28.7332%2020%2029.3332%2019.4%2029.3332%2018.6666V10.4133C29.3332%2010.1466%2029.3198%209.87996%2029.2932%209.61329ZM10.3332%2018C10.3332%2018.5466%209.87984%2019%209.33317%2019C8.7865%2019%208.33317%2018.5466%208.33317%2018V14C8.33317%2013.4533%208.7865%2013%209.33317%2013C9.87984%2013%2010.3332%2013.4533%2010.3332%2014V18ZM16.9998%2018C16.9998%2018.5466%2016.5465%2019%2015.9998%2019C15.4532%2019%2014.9998%2018.5466%2014.9998%2018V14C14.9998%2013.4533%2015.4532%2013%2015.9998%2013C16.5465%2013%2016.9998%2013.4533%2016.9998%2014V18Z'%20fill='%23FFA756'/%3e%3cpath%20d='M27.9602%2021.3334H24.0402C22.3468%2021.3334%2021.3335%2022.3467%2021.3335%2024.04V27.96C21.3335%2029.6534%2022.3468%2030.6667%2024.0402%2030.6667H27.9602C29.6535%2030.6667%2030.6668%2029.6534%2030.6668%2027.96V24.04C30.6668%2022.3467%2029.6535%2021.3334%2027.9602%2021.3334ZM28.6268%2027.4134C28.9602%2027.7467%2028.9602%2028.2934%2028.6268%2028.6267C28.4535%2028.7867%2028.2268%2028.8667%2028.0135%2028.8667C27.8002%2028.8667%2027.5735%2028.7867%2027.4002%2028.6267L25.9868%2027.2134L24.6002%2028.6267C24.4268%2028.7867%2024.2135%2028.8667%2023.9735%2028.8667C23.7735%2028.8667%2023.5468%2028.7867%2023.3868%2028.6267C23.0535%2028.2934%2023.0535%2027.7467%2023.3868%2027.4134L24.8002%2026L23.3868%2024.6C23.0535%2024.2667%2023.0535%2023.72%2023.3868%2023.3867C23.7202%2023.0534%2024.2668%2023.0534%2024.6002%2023.3867L25.9868%2024.8L27.4002%2023.3867C27.7335%2023.0534%2028.2935%2023.0534%2028.6268%2023.3867C28.9602%2023.72%2028.9602%2024.2667%2028.6268%2024.6L27.2135%2026L28.6268%2027.4134Z'%20fill='%23FFA756'/%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0.5'%20y='0.5'%20width='39'%20height='39'%20rx='19.5'%20fill='%23232323'/%3e%3crect%20x='0.5'%20y='0.5'%20width='39'%20height='39'%20rx='19.5'%20stroke='%23ACACAC'%20style='mix-blend-mode:color-dodge'/%3e%3cpath%20d='M21.1515%2013.9091C21.1515%2012.3024%2022.454%2011%2024.0606%2011C25.6673%2011%2026.9697%2012.3024%2026.9697%2013.9091C26.9697%2015.5157%2025.6673%2016.8182%2024.0606%2016.8182C22.454%2016.8182%2021.1515%2015.5157%2021.1515%2013.9091Z'%20fill='%236C6C6C'/%3e%3cpath%20d='M17.5365%2017.017C17.2707%2016.5917%2016.8045%2016.3333%2016.303%2016.3333C15.8015%2016.3333%2015.3354%2016.5917%2015.0696%2017.017L10.2211%2024.7745C9.94085%2025.2229%209.92601%2025.7881%2010.1823%2026.2506C10.4387%2026.7131%2010.9258%2027%2011.4545%2027H26.9697C27.5206%2027%2028.0243%2026.6887%2028.2707%2026.1959C28.5171%2025.7032%2028.4639%2025.1135%2028.1333%2024.6727L25.2243%2020.7939C24.9496%2020.4277%2024.5184%2020.2121%2024.0606%2020.2121C23.6028%2020.2121%2023.1717%2020.4277%2022.897%2020.7939L21.2607%2022.9757L17.5365%2017.017Z'%20fill='%236C6C6C'/%3e%3c/svg%3e",Ua="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.6568%2017.6568L6.34314%206.34314'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20/%3e%3cpath%20d='M17.6569%206.34314L6.34315%2017.6568'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20/%3e%3c/svg%3e",Eo="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.33342%207.52484V9.97484C9.33342%2012.0165%208.51675%2012.8332%206.47508%2012.8332H4.02508C1.98341%2012.8332%201.16675%2012.0165%201.16675%209.97484V7.52484C1.16675%205.48317%201.98341%204.6665%204.02508%204.6665H6.47508C8.51675%204.6665%209.33342%205.48317%209.33342%207.52484Z'%20fill='%23989898'/%3e%3cpath%20d='M9.97511%201.1665H7.52511C5.89748%201.1665%205.05203%201.68923%204.77585%202.93218C4.65505%203.47584%205.1276%203.93734%205.68451%203.93734H6.47511C8.92511%203.93734%2010.0626%205.07484%2010.0626%207.52484V8.31543C10.0626%208.87235%2010.5241%209.34489%2011.0678%209.22409C12.3107%208.94791%2012.8334%208.10247%2012.8334%206.47484V4.02484C12.8334%201.98317%2012.0168%201.1665%209.97511%201.1665Z'%20fill='%23989898'/%3e%3c/svg%3e",mlt="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.53%2010.1625C13.215%2010.47%2013.035%2010.9125%2013.08%2011.385C13.1475%2012.195%2013.89%2012.7875%2014.7%2012.7875H16.125V13.68C16.125%2015.2325%2014.8575%2016.5%2013.305%2016.5H4.695C3.1425%2016.5%201.875%2015.2325%201.875%2013.68V8.63251C1.875%207.08001%203.1425%205.8125%204.695%205.8125H13.305C14.8575%205.8125%2016.125%207.08001%2016.125%208.63251V9.71251H14.61C14.19%209.71251%2013.8075%209.87749%2013.53%2010.1625Z'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M1.875%209.30748V5.88002C1.875%204.98752%202.4225%204.19248%203.255%203.87748L9.21%201.62748C10.14%201.27498%2011.1375%201.96501%2011.1375%202.96251V5.8125'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M16.9191%2010.4776V12.0227C16.9191%2012.4352%2016.5891%2012.7726%2016.1691%2012.7876H14.6991C13.8891%2012.7876%2013.1466%2012.1951%2013.0791%2011.3851C13.0341%2010.9126%2013.2141%2010.4701%2013.5291%2010.1626C13.8066%209.87763%2014.1891%209.71265%2014.6091%209.71265H16.1691C16.5891%209.72765%2016.9191%2010.0651%2016.9191%2010.4776Z'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.25%209H10.5'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",I1="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14%206.97075C14%2011.5992%2011.1675%2013.0844%209.67513%2011.762C8.44671%2010.6837%208.08122%208.40507%206.2335%208.17111C3.88832%207.87611%203.68528%2010.999%202.14214%2010.999C0.345178%2010.999%200%208.38472%200%207.04196C0%205.66867%200.385787%203.79694%201.91878%203.79694C3.70559%203.79694%203.80711%206.4723%206.04061%206.32988C8.26396%206.1773%208.30457%203.39004%209.74624%202.19986C11.0051%201.17244%2014%202.28124%2014%206.97075Z'%20fill='%2397FCE4'/%3e%3c/svg%3e",vEe="data:image/svg+xml,%3csvg%20width='14'%20height='9'%20viewBox='0%200%2014%209'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.33013%201.5C5.48483%20-0.500002%208.37158%20-0.5%209.52628%201.5L13.8564%209H0L4.33013%201.5Z'%20fill='%23404040'/%3e%3c/svg%3e",xlt="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='4'%20y='4'%20width='6'%20height='6'%20rx='3'%20fill='%23D35B5B'/%3e%3c/svg%3e",glt="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='4'%20y='4'%20width='6'%20height='6'%20rx='3'%20fill='%230BAA60'/%3e%3c/svg%3e",cc="/assets/noDataNewIcon-D33nv6-9.svg",UA="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.2967%202.63297L11.6167%205.27297C11.7967%205.64047%2012.2767%205.99297%2012.6817%206.06047L15.0742%206.45797C16.6042%206.71297%2016.9642%207.82297%2015.8617%208.91797L14.0017%2010.778C13.6867%2011.093%2013.5142%2011.7005%2013.6117%2012.1355L14.1442%2014.438C14.5642%2016.2605%2013.5967%2016.9655%2011.9842%2016.013L9.7417%2014.6855C9.3367%2014.4455%208.6692%2014.4455%208.2567%2014.6855L6.0142%2016.013C4.4092%2016.9655%203.4342%2016.253%203.8542%2014.438L4.3867%2012.1355C4.4842%2011.7005%204.3117%2011.093%203.9967%2010.778L2.1367%208.91797C1.0417%207.82297%201.3942%206.71297%202.9242%206.45797L5.3167%206.06047C5.7142%205.99297%206.1942%205.64047%206.3742%205.27297L7.6942%202.63297C8.4142%201.20047%209.5842%201.20047%2010.2967%202.63297Z'%20stroke='%239B9B9B'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",N5="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.2967%202.63297L11.6167%205.27297C11.7967%205.64047%2012.2767%205.99297%2012.6817%206.06047L15.0742%206.45797C16.6042%206.71297%2016.9642%207.82297%2015.8617%208.91797L14.0017%2010.778C13.6867%2011.093%2013.5142%2011.7005%2013.6117%2012.1355L14.1442%2014.438C14.5642%2016.2605%2013.5967%2016.9655%2011.9842%2016.013L9.7417%2014.6855C9.3367%2014.4455%208.6692%2014.4455%208.2567%2014.6855L6.0142%2016.013C4.4092%2016.9655%203.4342%2016.253%203.8542%2014.438L4.3867%2012.1355C4.4842%2011.7005%204.3117%2011.093%203.9967%2010.778L2.1367%208.91797C1.0417%207.82297%201.3942%206.71297%202.9242%206.45797L5.3167%206.06047C5.7142%205.99297%206.1942%205.64047%206.3742%205.27297L7.6942%202.63297C8.4142%201.20047%209.5842%201.20047%2010.2967%202.63297Z'%20fill='%23FFC01F'/%3e%3c/svg%3e",blt="/assets/referralBgIcon-C-Csekzm.svg",A5="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1635_11489)'%3e%3cpath%20d='M7.58763%209.47632C8.45415%209.97644%208.8874%2010.2265%209.36324%2010.2269C9.83905%2010.2273%2010.2727%209.97802%2011.1401%209.47942L16.6693%206.30109C16.9189%206.15761%2017.0728%205.89166%2017.0728%205.60374C17.0728%205.31582%2016.9189%205.04987%2016.6693%204.90639L11.1381%201.7269C10.2717%201.22883%209.83844%200.979795%209.3631%200.979981C8.88773%200.980166%208.45471%201.22954%207.58863%201.72828L2.83367%204.4665C2.79841%204.4868%202.7808%204.49696%202.76438%204.50657C1.14012%205.45741%200.136601%207.19333%200.123183%209.07539C0.123047%209.09441%200.123047%209.11474%200.123047%209.15542C0.123047%209.19601%200.123047%209.21634%200.123182%209.23534C0.136571%2011.1153%201.13785%2012.8496%202.75921%2013.8012C2.7756%2013.8108%202.79321%2013.8209%202.82838%2013.8413L5.80688%2015.561C7.54244%2016.563%208.41021%2017.064%209.36318%2017.0644C10.3161%2017.0647%2011.1843%2016.5642%2012.9205%2015.5633L16.0647%2013.7508C16.9341%2013.2496%2017.3688%2012.9991%2017.6074%2012.5859C17.8461%2012.1728%2017.8461%2011.6711%2017.8461%2010.6676V8.72907C17.8461%208.4507%2017.6954%208.19416%2017.4521%208.05869C17.2168%207.92762%2016.9299%207.92956%2016.6964%208.06381L10.2491%2011.7699C9.81659%2012.0185%209.60028%2012.1429%209.36296%2012.1429C9.12561%2012.143%208.90925%2012.0188%208.47653%2011.7704L4.11289%209.2656C3.89431%209.14013%203.78501%209.07738%203.69722%209.06605C3.49709%209.04022%203.30466%209.15234%203.22842%209.33918C3.195%209.42113%203.19566%209.54715%203.19702%209.79918C3.19802%209.98472%203.19851%2010.0775%203.21585%2010.1628C3.2547%2010.3539%203.35522%2010.527%203.50202%2010.6553C3.56757%2010.7127%203.6479%2010.7591%203.80863%2010.8518L8.47406%2013.5445C8.90792%2013.7949%209.12483%2013.9201%209.36302%2013.9202C9.60122%2013.9202%209.81822%2013.7952%2010.2522%2013.545L15.9706%2010.2487C16.1189%2010.1632%2016.193%2010.1205%2016.2486%2010.1526C16.3041%2010.1847%2016.3041%2010.2703%2016.3041%2010.4414V11.3206C16.3041%2011.5715%2016.3041%2011.6969%2016.2445%2011.8002C16.1848%2011.9035%2016.0761%2011.9661%2015.8588%2012.0914L11.1422%2014.8103C10.2738%2015.3108%209.83968%2015.5611%209.36313%2015.5608C8.88654%2015.5606%208.4526%2015.31%207.58475%2014.8086L3.17196%2012.2596C3.15794%2012.2514%203.15094%2012.2474%203.1444%2012.2436C2.21916%2011.7029%201.64824%2010.7138%201.64288%209.64217C1.64285%209.63461%201.64285%209.62652%201.64285%209.61032V8.8032C1.64285%208.21161%201.95792%207.6648%202.46974%207.36813C2.92201%207.10599%203.47987%207.10547%203.93261%207.36677L7.58763%209.47632Z'%20fill='%23F2F7F7'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_1635_11489'%3e%3crect%20width='18'%20height='18'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Am="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.75%208.24998L15.9%202.09998'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M16.5%205.1V1.5H12.9'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.25%201.5H6.75C3%201.5%201.5%203%201.5%206.75V11.25C1.5%2015%203%2016.5%206.75%2016.5H11.25C15%2016.5%2016.5%2015%2016.5%2011.25V9.75'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",WM="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.6668%208.60016V11.4002C10.6668%2013.7335%209.7335%2014.6668%207.40016%2014.6668H4.60016C2.26683%2014.6668%201.3335%2013.7335%201.3335%2011.4002V8.60016C1.3335%206.26683%202.26683%205.3335%204.60016%205.3335H7.40016C9.7335%205.3335%2010.6668%206.26683%2010.6668%208.60016Z'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M14.6668%204.60016V7.40016C14.6668%209.7335%2013.7335%2010.6668%2011.4002%2010.6668H10.6668V8.60016C10.6668%206.26683%209.7335%205.3335%207.40016%205.3335H5.3335V4.60016C5.3335%202.26683%206.26683%201.3335%208.60016%201.3335H11.4002C13.7335%201.3335%2014.6668%202.26683%2014.6668%204.60016Z'%20stroke='white'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ylt="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M35.0601%2015.54C34.9201%2015.52%2034.7801%2015.52%2034.6401%2015.54C31.5401%2015.44%2029.0801%2012.9%2029.0801%209.78C29.0801%206.6%2031.6601%204%2034.8601%204C38.0401%204%2040.6401%206.58%2040.6401%209.78C40.6201%2012.9%2038.1601%2015.44%2035.0601%2015.54Z'%20fill='white'/%3e%3cpath%20d='M41.58%2029.3998C39.34%2030.8998%2036.1999%2031.4598%2033.2999%2031.0798C34.0599%2029.4398%2034.4599%2027.6198%2034.4799%2025.6998C34.4799%2023.6998%2034.04%2021.7998%2033.2%2020.1398C36.16%2019.7398%2039.3%2020.2998%2041.56%2021.7998C44.72%2023.8798%2044.72%2027.2998%2041.58%2029.3998Z'%20fill='white'/%3e%3cpath%20d='M12.8801%2015.54C13.0201%2015.52%2013.1601%2015.52%2013.3001%2015.54C16.4001%2015.44%2018.8601%2012.9%2018.8601%209.78C18.8601%206.58%2016.2801%204%2013.0801%204C9.90007%204%207.32007%206.58%207.32007%209.78C7.32007%2012.9%209.78007%2015.44%2012.8801%2015.54Z'%20fill='white'/%3e%3cpath%20d='M13.1%2025.7002C13.1%2027.6402%2013.52%2029.4802%2014.28%2031.1402C11.46%2031.4402%208.51999%2030.8402%206.35999%2029.4202C3.19999%2027.3202%203.19999%2023.9002%206.35999%2021.8002C8.49999%2020.3602%2011.52%2019.7802%2014.36%2020.1002C13.54%2021.7802%2013.1%2023.6802%2013.1%2025.7002Z'%20fill='white'/%3e%3cpath%20d='M24.2401%2031.74C24.0801%2031.72%2023.9001%2031.72%2023.7201%2031.74C20.0401%2031.62%2017.1001%2028.6%2017.1001%2024.88C17.1201%2021.08%2020.1801%2018%2024.0001%2018C27.8001%2018%2030.8801%2021.08%2030.8801%2024.88C30.8601%2028.6%2027.9401%2031.62%2024.2401%2031.74Z'%20fill='white'/%3e%3cpath%20d='M17.7401%2035.8798C14.7201%2037.8998%2014.7201%2041.2198%2017.7401%2043.2198C21.1801%2045.5198%2026.8201%2045.5198%2030.2601%2043.2198C33.2801%2041.1998%2033.2801%2037.8798%2030.2601%2035.8798C26.8401%2033.5798%2021.2001%2033.5798%2017.7401%2035.8798Z'%20fill='white'/%3e%3c/svg%3e",vlt="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M24%204C12.98%204%204%2012.98%204%2024C4%2035.02%2012.98%2044%2024%2044C35.02%2044%2044%2035.02%2044%2024C44%2012.98%2035.02%204%2024%204ZM33.56%2019.4L22.22%2030.74C21.94%2031.02%2021.56%2031.18%2021.16%2031.18C20.76%2031.18%2020.38%2031.02%2020.1%2030.74L14.44%2025.08C13.86%2024.5%2013.86%2023.54%2014.44%2022.96C15.02%2022.38%2015.98%2022.38%2016.56%2022.96L21.16%2027.56L31.44%2017.28C32.02%2016.7%2032.98%2016.7%2033.56%2017.28C34.14%2017.86%2034.14%2018.8%2033.56%2019.4Z'%20fill='%231DE6A3'/%3e%3c/svg%3e",wlt="data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M48.107%2039.1333C46.987%2040.2266%2046.347%2041.8%2046.507%2043.48C46.747%2046.36%2049.387%2048.4666%2052.267%2048.4666H57.3337V51.64C57.3337%2057.16%2052.827%2061.6667%2047.307%2061.6667H16.6937C11.1737%2061.6667%206.66699%2057.16%206.66699%2051.64V33.6933C6.66699%2028.1733%2011.1737%2023.6667%2016.6937%2023.6667H47.307C52.827%2023.6667%2057.3337%2028.1733%2057.3337%2033.6933V37.5334H51.947C50.4537%2037.5334%2049.0937%2038.12%2048.107%2039.1333Z'%20stroke='white'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6.66699%2036.0933V23.9068C6.66699%2020.7334%208.61366%2017.9067%2011.5737%2016.7867L32.747%208.78666C36.0537%207.53333%2039.6003%209.98674%2039.6003%2013.5334V23.6667'%20stroke='white'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M60.1572%2040.2537V45.7472C60.1572%2047.2139%2058.9838%2048.4138%2057.4905%2048.4671H52.2638C49.3838%2048.4671%2046.7438%2046.3605%2046.5038%2043.4805C46.3438%2041.8005%2046.9838%2040.2271%2048.1038%2039.1338C49.0905%2038.1205%2050.4505%2037.5339%2051.9438%2037.5339H57.4905C58.9838%2037.5872%2060.1572%2038.7871%2060.1572%2040.2537Z'%20stroke='white'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M18.667%2035H37.3337'%20stroke='white'%20stroke-width='2.4'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Clt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%2021C5.50558%2021%202.95666%2020.5387%202.54353%2018.2033C2.13039%2015.8679%204.77383%2011.4774%205.58842%2010.0285C8.31257%205.18408%2010.1637%203%2012%203C13.8363%203%2015.6874%205.18408%2018.4116%2010.0285C19.2262%2011.4774%2021.8696%2015.8679%2021.4565%2018.2033C21.0444%2020.5387%2018.4944%2021%2012%2021Z'%20stroke='%23FF9900'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12%208.5V12.395'%20stroke='%23FF9900'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.9955%2015.8945H12.0045'%20stroke='%23FF9900'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",qM="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.75764%205.18999L14.1826%207.15499C15.4576%207.71749%2015.4576%208.64749%2014.1826%209.20999L9.75764%2011.175C9.25514%2011.4%208.43014%2011.4%207.92764%2011.175L3.50264%209.20999C2.22764%208.64749%202.22764%207.71749%203.50264%207.15499L7.92764%205.18999C8.43014%204.96499%209.25514%204.96499%209.75764%205.18999Z'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.25%2011.25C2.25%2011.88%202.7225%2012.6075%203.3%2012.8625L8.3925%2015.1275C8.7825%2015.3%209.225%2015.3%209.6075%2015.1275L14.7%2012.8625C15.2775%2012.6075%2015.75%2011.88%2015.75%2011.25'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.25%2015C2.25%2015.6975%202.6625%2016.3275%203.3%2016.6125L8.3925%2018.8775C8.7825%2019.05%209.225%2019.05%209.6075%2018.8775L14.7%2016.6125C15.3375%2016.3275%2015.75%2015.6975%2015.75%2015'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3ccircle%20cx='16'%20cy='5'%20r='4.5'%20fill='%2367FFBD'%20stroke='%23273F35'/%3e%3c/svg%3e",GM="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.75764%205.18999L14.1826%207.15499C15.4576%207.71749%2015.4576%208.64749%2014.1826%209.20999L9.75764%2011.175C9.25514%2011.4%208.43014%2011.4%207.92764%2011.175L3.50264%209.20999C2.22764%208.64749%202.22764%207.71749%203.50264%207.15499L7.92764%205.18999C8.43014%204.96499%209.25514%204.96499%209.75764%205.18999Z'%20stroke='%23FF797C'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.25%2011.25C2.25%2011.88%202.7225%2012.6075%203.3%2012.8625L8.3925%2015.1275C8.7825%2015.3%209.225%2015.3%209.6075%2015.1275L14.7%2012.8625C15.2775%2012.6075%2015.75%2011.88%2015.75%2011.25'%20stroke='%23FF797C'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.25%2015C2.25%2015.6975%202.6625%2016.3275%203.3%2016.6125L8.3925%2018.8775C8.7825%2019.05%209.225%2019.05%209.6075%2018.8775L14.7%2016.6125C15.3375%2016.3275%2015.75%2015.6975%2015.75%2015'%20stroke='%23FF797C'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3ccircle%20cx='16'%20cy='5'%20r='4.5'%20fill='%23FF797C'%20stroke='%233F2A2B'/%3e%3c/svg%3e",zA="/assets/sharePnlGreenIcon-CwGFUwvO.svg",HA="/assets/sharePnlRedIcon-NsgQBTQF.svg",VA="/assets/dextrabotShareIcon-DbUzC8hq.png",Slt="/assets/buttonHyperrIcon-BEIlirim.png",nme="/assets/mushroomRed-DlifwotO.svg",rme="/assets/mushroomBlue-DU8qWKKQ.svg",eu="data:image/svg+xml,%3csvg%20width='11'%20height='8'%20viewBox='0%200%2011%208'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1%203.83L3.83%206.66L9.5%201'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Nlt="data:image/svg+xml,%3csvg%20width='28'%20height='32'%20viewBox='0%200%2028%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_d_92_32471)'%3e%3cpath%20d='M18.4324%2015.0402H16.1149V9.64023C16.1149%208.38023%2015.4324%208.12523%2014.5999%209.07023L13.9999%209.75273L8.92239%2015.5277C8.22489%2016.3152%208.51739%2016.9602%209.56739%2016.9602H11.8849V22.3602C11.8849%2023.6202%2012.5674%2023.8752%2013.3999%2022.9302L13.9999%2022.2477L19.0774%2016.4727C19.7749%2015.6852%2019.4824%2015.0402%2018.4324%2015.0402Z'%20fill='%2367FFBD'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_d_92_32471'%20x='-3'%20y='-0.999756'%20width='34'%20height='34'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset/%3e%3cfeGaussianBlur%20stdDeviation='4'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.403922%200%200%200%200%201%200%200%200%200%200.741176%200%200%200%200.48%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_92_32471'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_92_32471'%20result='shape'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e",Alt="data:image/svg+xml,%3csvg%20width='35'%20height='30'%20viewBox='0%200%2035%2030'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20filter='url(%23filter0_d_92_32478)'%3e%3cpath%20d='M20.4658%209.05899L21.6995%2011.5265C21.8658%2011.8677%2022.312%2012.1915%2022.6883%2012.2615L24.9195%2012.629C26.3458%2012.8652%2026.6783%2013.8977%2025.6545%2014.9302L23.9133%2016.6715C23.6245%2016.9602%2023.4583%2017.529%2023.5545%2017.9402L24.0533%2020.0927C24.447%2021.7902%2023.537%2022.4552%2022.0408%2021.5627L19.9495%2020.3202C19.5733%2020.0927%2018.9433%2020.0927%2018.567%2020.3202L16.4758%2021.5627C14.9795%2022.4465%2014.0695%2021.7902%2014.4633%2020.0927L14.962%2017.9402C15.0408%2017.5202%2014.8745%2016.9515%2014.5858%2016.6627L12.8445%2014.9215C11.8208%2013.8977%2012.1533%2012.8652%2013.5795%2012.6202L15.8108%2012.2527C16.187%2012.1915%2016.6333%2011.859%2016.7995%2011.5177L18.0333%209.05024C18.707%207.72024%2019.792%207.72024%2020.4658%209.05899Z'%20fill='%23D65AFF'/%3e%3cpath%20d='M14%209.53149H8.75C8.39125%209.53149%208.09375%209.23399%208.09375%208.87524C8.09375%208.51649%208.39125%208.21899%208.75%208.21899H14C14.3587%208.21899%2014.6562%208.51649%2014.6562%208.87524C14.6562%209.23399%2014.3587%209.53149%2014%209.53149Z'%20fill='%23D65AFF'/%3e%3cpath%20d='M11.375%2021.7815H8.75C8.39125%2021.7815%208.09375%2021.484%208.09375%2021.1252C8.09375%2020.7665%208.39125%2020.469%208.75%2020.469H11.375C11.7338%2020.469%2012.0312%2020.7665%2012.0312%2021.1252C12.0312%2021.484%2011.7338%2021.7815%2011.375%2021.7815Z'%20fill='%23D65AFF'/%3e%3cpath%20d='M9.625%2015.6565H8.75C8.39125%2015.6565%208.09375%2015.359%208.09375%2015.0002C8.09375%2014.6415%208.39125%2014.344%208.75%2014.344H9.625C9.98375%2014.344%2010.2812%2014.6415%2010.2812%2015.0002C10.2812%2015.359%209.98375%2015.6565%209.625%2015.6565Z'%20fill='%23D65AFF'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_d_92_32478'%20x='-1'%20y='-3.49976'%20width='37'%20height='37'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset/%3e%3cfeGaussianBlur%20stdDeviation='4'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='out'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.839216%200%200%200%200%200.352941%200%200%200%200%201%200%200%200%200.48%200'/%3e%3cfeBlend%20mode='normal'%20in2='BackgroundImageFix'%20result='effect1_dropShadow_92_32478'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='effect1_dropShadow_92_32478'%20result='shape'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e",rc="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%206.75V10.5'%20stroke='%23FF797C'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.99958%2016.0575H4.45458C1.85208%2016.0575%200.764583%2014.1975%202.02458%2011.925L4.36458%207.70996L6.56958%203.74996C7.90458%201.34246%2010.0946%201.34246%2011.4296%203.74996L13.6346%207.71746L15.9746%2011.9325C17.2346%2014.205%2016.1396%2016.065%2013.5446%2016.065H8.99958V16.0575Z'%20stroke='%23FF797C'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8.99609%2012.75H9.00283'%20stroke='%23FF797C'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",fae="data:image/svg+xml,%3csvg%20width='86'%20height='86'%20viewBox='0%200%2086%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='43'%20cy='43'%20r='43'%20fill='%231DE6A3'%20fill-opacity='0.16'/%3e%3cpath%20d='M42.9987%2016.3335C28.3054%2016.3335%2016.332%2028.3068%2016.332%2043.0002C16.332%2057.6935%2028.3054%2069.6668%2042.9987%2069.6668C57.692%2069.6668%2069.6654%2057.6935%2069.6654%2043.0002C69.6654%2028.3068%2057.692%2016.3335%2042.9987%2016.3335ZM55.7454%2036.8668L40.6254%2051.9868C40.252%2052.3602%2039.7454%2052.5735%2039.212%2052.5735C38.6787%2052.5735%2038.172%2052.3602%2037.7987%2051.9868L30.252%2044.4402C29.4787%2043.6668%2029.4787%2042.3868%2030.252%2041.6135C31.0254%2040.8402%2032.3054%2040.8402%2033.0787%2041.6135L39.212%2047.7468L52.9187%2034.0402C53.692%2033.2668%2054.972%2033.2668%2055.7454%2034.0402C56.5187%2034.8135%2056.5187%2036.0668%2055.7454%2036.8668Z'%20fill='%231DE6A3'/%3e%3c/svg%3e",jlt="/assets/copyTradeBanner-Bzh6f0rX.svg",Elt="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2016.5C13.1421%2016.5%2016.5%2013.1421%2016.5%209C16.5%204.85786%2013.1421%201.5%209%201.5C4.85786%201.5%201.5%204.85786%201.5%209C1.5%2013.1421%204.85786%2016.5%209%2016.5Z'%20stroke='%23FFD979'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6.375%209H10.875'%20stroke='%23FFD979'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.375%2011.25L11.625%209L9.375%206.75'%20stroke='%23FFD979'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",sme="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2782_17351)'%3e%3cpath%20d='M5.05842%206.31754C5.6361%206.65096%205.92493%206.81767%206.24216%206.81794C6.55936%206.81822%206.84849%206.65201%207.42676%206.31961L11.1129%204.20073C11.2793%204.10508%2011.3819%203.92777%2011.3819%203.73583C11.3819%203.54388%2011.2793%203.36658%2011.1129%203.27093L7.42543%201.15127C6.84779%200.81922%206.55896%200.653197%206.24207%200.65332C5.92515%200.653444%205.63647%200.819692%205.05909%201.15219L1.88911%202.97767C1.86561%202.9912%201.85387%202.99797%201.84292%203.00438C0.76008%203.63828%200.0910671%204.79556%200.0821217%206.05026C0.0820312%206.06294%200.0820313%206.07649%200.0820313%206.10361C0.0820313%206.13068%200.0820312%206.14423%200.0821215%206.15689C0.0910473%207.41019%200.758568%208.56638%201.83948%209.20078C1.8504%209.20718%201.86214%209.21396%201.88559%209.22751L3.87125%2010.374C5.02829%2011.042%205.6068%2011.376%206.24212%2011.3762C6.87742%2011.3764%207.45617%2011.0428%208.61365%2010.3756L10.7098%209.16719C11.2894%208.83308%2011.5792%208.66604%2011.7383%208.39063C11.8974%208.11522%2011.8974%207.78073%2011.8974%207.11174V5.81938C11.8974%205.6338%2011.7969%205.46278%2011.6348%205.37246C11.4779%205.28508%2011.2866%205.28638%2011.1309%205.37588L6.83276%207.84658C6.54439%208.01235%206.40019%208.09524%206.24197%208.0953C6.08374%208.09533%205.9395%208.01253%205.65102%207.84695L2.74192%206.17707C2.59621%206.09342%202.52334%206.05159%202.46482%206.04404C2.33139%206.02681%202.20311%206.10156%202.15228%206.22612C2.13%206.28075%202.13044%206.36477%202.13135%206.53279C2.13201%206.65648%202.13234%206.71833%202.1439%206.77522C2.1698%206.90263%202.23682%207.01797%202.33468%207.10356C2.37838%207.14178%202.43194%207.1727%202.53909%207.23453L5.64938%209.02967C5.93861%209.1966%206.08322%209.28007%206.24201%209.28012C6.40082%209.28016%206.54548%209.19677%206.83479%209.03001L10.6471%206.83244C10.7459%206.77546%2010.7953%206.74698%2010.8324%206.76839C10.8694%206.78981%2010.8694%206.84684%2010.8694%206.96091V7.54708C10.8694%207.71434%2010.8694%207.79796%2010.8296%207.86682C10.7899%207.93566%2010.7174%207.97742%2010.5725%208.06096L7.42811%209.87351C6.84923%2010.2072%206.55979%2010.374%206.24208%2010.3739C5.92436%2010.3737%205.63507%2010.2067%205.0565%209.87242L2.11464%208.17304C2.1053%208.16763%202.10063%208.16494%202.09627%208.16239C1.47944%207.80194%201.09883%207.14254%201.09526%206.42811C1.09523%206.42307%201.09523%206.41768%201.09523%206.40688V5.8688C1.09523%205.47441%201.30528%205.10986%201.6465%204.91209C1.948%204.73733%202.31991%204.73698%202.62174%204.91118L5.05842%206.31754Z'%20fill='%23F2F7F7'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2782_17351'%3e%3crect%20width='12'%20height='12'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",hae="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.939%207.14668H9.87903V2.34668C9.87903%201.22668%209.27236%201.00001%208.53236%201.84001L7.99903%202.44668L3.4857%207.58001C2.8657%208.28001%203.1257%208.85335%204.05903%208.85335H6.11903V13.6533C6.11903%2014.7733%206.7257%2015%207.4657%2014.16L7.99903%2013.5533L12.5124%208.42001C13.1324%207.72001%2012.8724%207.14668%2011.939%207.14668Z'%20fill='%2367FFBD'/%3e%3c/svg%3e",_lt="/assets/introductionModalIcon-C3qCLVbZ.svg",klt="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20opacity='0.4'%20cx='24'%20cy='24'%20r='20'%20fill='%23868686'/%3e%3cpath%20d='M34%2020C34%2021.1046%2033.1046%2022%2032%2022C30.8954%2022%2030%2021.1046%2030%2020C30%2018.8954%2030.8954%2018%2032%2018C33.1046%2018%2034%2018.8954%2034%2020Z'%20fill='%23868686'/%3e%3cpath%20d='M18%2020C18%2021.1046%2017.1046%2022%2016%2022C14.8954%2022%2014%2021.1046%2014%2020C14%2018.8954%2014.8954%2018%2016%2018C17.1046%2018%2018%2018.8954%2018%2020Z'%20fill='%23868686'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M18.9891%2028.8723C18.3698%2028.329%2017.4271%2028.3868%2016.8789%2029.0035C16.3285%2029.6226%2016.3843%2030.5708%2017.0035%2031.1211L18%2030C17.0035%2031.1211%2017.003%2031.1207%2017.0035%2031.1211L17.0054%2031.1228L17.0075%2031.1247L17.0124%2031.1291L17.0249%2031.1399L17.06%2031.1698C17.088%2031.1934%2017.125%2031.224%2017.171%2031.2605C17.263%2031.3335%2017.391%2031.4308%2017.5536%2031.5439C17.8782%2031.7697%2018.3441%2032.0611%2018.9394%2032.3497C20.13%2032.927%2021.8535%2033.5%2024%2033.5C26.1465%2033.5%2027.87%2032.927%2029.0607%2032.3497C29.656%2032.0611%2030.1218%2031.7697%2030.4465%2031.5439C30.609%2031.4308%2030.737%2031.3335%2030.829%2031.2605C30.875%2031.224%2030.9121%2031.1934%2030.94%2031.1698L30.9752%2031.1399L30.9876%2031.1291L30.9925%2031.1247L30.9946%2031.1228C30.9951%2031.1224%2030.9966%2031.1211%2030%2030L30.9966%2031.1211C31.6157%2030.5708%2031.6715%2029.6226%2031.1211%2029.0035C30.573%2028.3868%2029.6302%2028.329%2029.0109%2028.8723L29.0092%2028.8739C29.0023%2028.8796%2028.9859%2028.8933%2028.963%2028.9114C28.9173%2028.9477%2028.8402%2029.0068%2028.7333%2029.0812C28.5189%2029.2303%2028.1878%2029.4389%2027.7519%2029.6503C26.88%2030.073%2025.6035%2030.5%2024%2030.5C22.3965%2030.5%2021.12%2030.073%2020.2482%2029.6503C19.8122%2029.4389%2019.4812%2029.2303%2019.2668%2029.0812C19.1598%2029.0068%2019.0827%2028.9477%2019.037%2028.9114C19.0142%2028.8933%2018.9992%2028.8809%2018.9924%2028.8751C18.9909%2028.8739%2018.9898%2028.8729%2018.9891%2028.8723C18.9891%2028.8723%2018.9891%2028.8723%2018.9891%2028.8723ZM29.0109%2028.8723L29.0092%2028.8739L29.0067%2028.876L29.0052%2028.8774C29.0074%2028.8754%2029.0087%2028.8743%2029.0109%2028.8723Z'%20fill='%23868686'/%3e%3c/svg%3e",Tlt="data:image/svg+xml,%3csvg%20width='10'%20height='10'%20viewBox='0%200%2010%2010'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5.41602%204.58334L8.83268%201.16667'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.16602%202.83333V0.833328H7.16602'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4.58398%200.833328H3.75065C1.66732%200.833328%200.833984%201.66666%200.833984%203.74999V6.24999C0.833984%208.33333%201.66732%209.16666%203.75065%209.16666H6.25065C8.33398%209.16666%209.16732%208.33333%209.16732%206.24999V5.41666'%20stroke='%2367FFBD'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Plt="/assets/dextrabot-copy-trade-hyperliquid-BgdeQSj5.png",Ilt="/assets/dextrabot-position-copy-Ph5ntD17.png",Flt="/assets/dextrabot-referral-rewards-CvRzGBKC.png",Olt="/assets/hyperliquid-discover-wallets-CgeXGTl5.svg",Mlt="/assets/dextrabot-telegram-alerts-CJHcZn29.png",Rlt="/assets/hyperliquid-wallet-analysis-DwEnicpm.png",Llt="/assets/dextrabot-discover-wallets-filters-BSnYa19g.svg",Dlt="/assets/hyperliquid-trading-metrics-Cwsy4rqz.svg",Blt="/assets/dextrabot-risk-parameters-DzTb7mB0.svg",$lt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.4297%205.92999L20.4997%2012L14.4297%2018.07'%20stroke='%2367FFBD'%20stroke-width='1.5'%20stroke-miterlimit='10'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M3.5%2012H20.33'%20stroke='%2367FFBD'%20stroke-width='1.5'%20stroke-miterlimit='10'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",VH="data:image/svg+xml,%3csvg%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='32'%20cy='32'%20r='32'%20fill='%233D3D3D'/%3e%3c/svg%3e",Ult="/assets/dextrabotNewLogoIcon-V6eDxoac.png",pae="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.1425%201.5H5.8575C3.1275%201.5%201.5%203.1275%201.5%205.8575V12.135C1.5%2014.8725%203.1275%2016.5%205.8575%2016.5H12.135C14.865%2016.5%2016.4925%2014.8725%2016.4925%2012.1425V5.8575C16.5%203.1275%2014.8725%201.5%2012.1425%201.5ZM12.9375%209.2475C12.9375%209.555%2012.6825%209.81%2012.375%209.81C12.0675%209.81%2011.8125%209.555%2011.8125%209.2475V6.9825L6.0225%2012.7725C5.91%2012.885%205.7675%2012.9375%205.625%2012.9375C5.4825%2012.9375%205.34%2012.885%205.2275%2012.7725C5.01%2012.555%205.01%2012.195%205.2275%2011.9775L11.0175%206.1875H8.7525C8.445%206.1875%208.19%205.9325%208.19%205.625C8.19%205.3175%208.445%205.0625%208.7525%205.0625H12.375C12.6825%205.0625%2012.9375%205.3175%2012.9375%205.625V9.2475Z'%20fill='white'%20fill-opacity='0.32'/%3e%3c/svg%3e",zlt="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%205.0625C16.1391%205.0625%2017.0625%204.13909%2017.0625%203C17.0625%201.86091%2016.1391%200.9375%2015%200.9375C13.8609%200.9375%2012.9375%201.86091%2012.9375%203C12.9375%204.13909%2013.8609%205.0625%2015%205.0625Z'%20fill='white'/%3e%3cpath%20d='M14.28%206.1125C13.1025%205.8575%2012.1425%204.8975%2011.8875%203.72C11.79%203.2625%2011.7825%202.82%2011.865%202.4C11.9625%201.935%2011.6175%201.5%2011.1375%201.5H5.25C3.18%201.5%201.5%203.18%201.5%205.25V10.4625C1.5%2012.5325%203.18%2014.2125%205.25%2014.2125H6.375C6.585%2014.2125%206.855%2014.3475%206.975%2014.5125L8.1%2016.005C8.595%2016.665%209.405%2016.665%209.9%2016.005L11.025%2014.5125C11.1675%2014.325%2011.385%2014.2125%2011.625%2014.2125H12.7575C14.8275%2014.2125%2016.5%2012.54%2016.5%2010.47V6.8625C16.5%206.39%2016.065%206.045%2015.6%206.135C15.18%206.21%2014.7375%206.21%2014.28%206.1125ZM6%209C5.58%209%205.25%208.6625%205.25%208.25C5.25%207.8375%205.58%207.5%206%207.5C6.4125%207.5%206.75%207.8375%206.75%208.25C6.75%208.6625%206.42%209%206%209ZM9%209C8.58%209%208.25%208.6625%208.25%208.25C8.25%207.8375%208.58%207.5%209%207.5C9.4125%207.5%209.75%207.8375%209.75%208.25C9.75%208.6625%209.42%209%209%209ZM12%209C11.58%209%2011.25%208.6625%2011.25%208.25C11.25%207.8375%2011.58%207.5%2012%207.5C12.4125%207.5%2012.75%207.8375%2012.75%208.25C12.75%208.6625%2012.42%209%2012%209Z'%20fill='white'/%3e%3c/svg%3e",Hlt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.0199%2020.5299C9.68987%2020.5299%207.35987%2020.1599%205.14987%2019.4199C4.30987%2019.1299%203.66987%2018.5399%203.38987%2017.7699C3.09987%2016.9999%203.19987%2016.1499%203.65987%2015.3899L4.80987%2013.4799C5.04987%2013.0799%205.26987%2012.2799%205.26987%2011.8099V8.91992C5.26987%205.19992%208.29987%202.16992%2012.0199%202.16992C15.7399%202.16992%2018.7699%205.19992%2018.7699%208.91992V11.8099C18.7699%2012.2699%2018.9899%2013.0799%2019.2299%2013.4899L20.3699%2015.3899C20.7999%2016.1099%2020.8799%2016.9799%2020.5899%2017.7699C20.2999%2018.5599%2019.6699%2019.1599%2018.8799%2019.4199C16.6799%2020.1599%2014.3499%2020.5299%2012.0199%2020.5299ZM12.0199%203.66992C9.12987%203.66992%206.76987%206.01992%206.76987%208.91992V11.8099C6.76987%2012.5399%206.46987%2013.6199%206.09987%2014.2499L4.94987%2016.1599C4.72987%2016.5299%204.66987%2016.9199%204.79987%2017.2499C4.91987%2017.5899%205.21987%2017.8499%205.62987%2017.9899C9.80987%2019.3899%2014.2399%2019.3899%2018.4199%2017.9899C18.7799%2017.8699%2019.0599%2017.5999%2019.1899%2017.2399C19.3199%2016.8799%2019.2899%2016.4899%2019.0899%2016.1599L17.9399%2014.2499C17.5599%2013.5999%2017.2699%2012.5299%2017.2699%2011.7999V8.91992C17.2699%206.01992%2014.9199%203.66992%2012.0199%203.66992Z'%20fill='white'/%3e%3cpath%20d='M13.8806%203.94018C13.8106%203.94018%2013.7406%203.93018%2013.6706%203.91018C13.3806%203.83018%2013.1006%203.77018%2012.8306%203.73018C11.9806%203.62018%2011.1606%203.68018%2010.3906%203.91018C10.1106%204.00018%209.8106%203.91018%209.6206%203.70018C9.4306%203.49018%209.3706%203.19018%209.4806%202.92018C9.8906%201.87018%2010.8906%201.18018%2012.0306%201.18018C13.1706%201.18018%2014.1706%201.86018%2014.5806%202.92018C14.6806%203.19018%2014.6306%203.49018%2014.4406%203.70018C14.2906%203.86018%2014.0806%203.94018%2013.8806%203.94018Z'%20fill='white'/%3e%3cpath%20d='M12.0195%2022.8101C11.0295%2022.8101%2010.0695%2022.4101%209.36953%2021.7101C8.66953%2021.0101%208.26953%2020.0501%208.26953%2019.0601H9.76953C9.76953%2019.6501%2010.0095%2020.2301%2010.4295%2020.6501C10.8495%2021.0701%2011.4295%2021.3101%2012.0195%2021.3101C13.2595%2021.3101%2014.2695%2020.3001%2014.2695%2019.0601H15.7695C15.7695%2021.1301%2014.0895%2022.8101%2012.0195%2022.8101Z'%20fill='white'/%3e%3c/svg%3e",Vlt="data:image/svg+xml,%3csvg%20width='14'%20height='13'%20viewBox='0%200%2014%2013'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_378_2345)'%3e%3cpath%20d='M10.9574%200H13.0931L8.40386%205.51661L13.8824%2013H9.58315L6.21708%208.4524L2.3635%2013H0.22779L5.19565%207.09963L-0.0507812%200H4.35529L7.39636%204.15424L10.9574%200ZM10.2099%2011.7048H11.3939L3.73315%201.24723H2.461L10.2099%2011.7048Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_378_2345'%3e%3crect%20width='13.9286'%20height='13'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Wlt="data:image/svg+xml,%3csvg%20width='10'%20height='12'%20viewBox='0%200%2010%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%2012L10%206.00005L0%200V12Z'%20fill='white'/%3e%3c/svg%3e",wEe="data:image/svg+xml,%3csvg%20width='10'%20height='12'%20viewBox='0%200%2010%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.67166%207.49665C9.67295%208.13961%209.54358%208.77482%209.29002%209.36475C9.0481%209.93526%208.6988%2010.4489%208.25377%2010.8887C7.81262%2011.3273%207.28996%2011.6753%206.71686%2011.9146C6.64441%2011.9444%206.57196%2011.9728%206.49952%2012C6.54609%2011.9599%206.59137%2011.9185%206.63407%2011.8758C6.86823%2011.6442%207.05193%2011.3738%207.18%2011.0737C7.31326%2010.7632%207.38182%2010.4282%207.38052%2010.0905C7.38052%209.73733%207.30808%209.39579%207.16448%209.07237C7.02476%208.75671%206.82036%208.47209%206.5655%208.23923L6.35463%208.04647C6.33134%208.02448%206.29383%208.02706%206.27183%208.05035C6.26665%208.05682%206.26278%208.06329%206.26019%208.06976L6.16704%208.34013C6.10883%208.50832%206.00015%208.68167%205.8475%208.85114C5.83844%208.86279%205.8268%208.86538%205.81775%208.86538C5.80998%208.86667%205.79834%208.86538%205.78669%208.85503C5.77764%208.84597%205.77246%208.83304%205.77246%208.8201C5.79963%208.38542%205.66897%207.89382%205.38435%207.35952C5.1489%206.91578%204.8216%206.57036%204.41279%206.32844L4.11395%206.1525C4.07514%206.12922%204.02468%206.16026%204.02727%206.20554L4.04279%206.55226C4.05315%206.789%204.02598%206.99987%203.96129%207.17323C3.88108%207.38668%203.76724%207.58462%203.62105%207.76315C3.52014%207.88605%203.405%207.9986%203.27822%208.09563C2.97291%208.32979%202.72452%208.63122%202.55246%208.97405C2.3804%209.32076%202.29114%209.7024%202.29114%2010.0905C2.29114%2010.4307%202.3584%2010.7619%202.49166%2011.0737C2.61973%2011.3738%202.80473%2011.6455%203.03759%2011.8745C3.08158%2011.9185%203.12686%2011.9599%203.17344%2011.9987C3.09969%2011.9728%203.02725%2011.9444%202.9548%2011.9133C2.37911%2011.6727%201.86292%2011.3273%201.41789%2010.8874C0.976737%2010.4514%200.624856%209.93397%200.381641%209.36345C0.128074%208.77223%200%208.1435%200%207.49536C0.00129499%206.76054%200.170768%206.03478%200.498069%205.37628C0.825378%204.72297%201.29628%204.15245%201.87586%203.70742C2.11648%203.52112%202.33512%203.30896%202.52788%203.07351C2.80602%202.73586%203.02207%202.35939%203.17344%201.95446C3.29763%201.62328%203.34938%201.22482%203.32867%200.774614L3.29892%200.114833C3.29504%200.0281497%203.38948%20-0.0287652%203.46322%200.015216L4.03116%200.348991C4.80866%200.806956%205.43092%201.46545%205.87855%202.30893C6.41931%203.32449%206.66641%204.25724%206.61595%205.08391C6.61466%205.10849%206.62371%205.13307%206.64312%205.14989C6.66382%205.1693%206.68711%205.17188%206.70263%205.17058C6.71815%205.1693%206.74014%205.16282%206.75955%205.14213C7.04934%204.82%207.25374%204.49139%207.365%204.17056L7.54353%203.65826C7.5487%203.64403%207.55518%203.63239%207.56552%203.62074C7.60562%203.57546%207.67549%203.57158%207.72206%203.61298L8.12182%203.9791C8.60566%204.42283%208.99376%204.96101%209.26026%205.56128C9.53323%206.17579%209.67166%206.82652%209.67166%207.49665Z'%20fill='white'/%3e%3c/svg%3e",qlt="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.5733%208.48671C13.3267%208.48671%2013.12%208.30005%2013.0933%208.05338C12.9333%206.58671%2012.1467%205.26671%2010.9333%204.42671C10.7133%204.27338%2010.66%203.97338%2010.8133%203.75338C10.9667%203.53338%2011.2667%203.48005%2011.4867%203.63338C12.9333%204.64005%2013.8667%206.21338%2014.06%207.95338C14.0867%208.22005%2013.8933%208.46005%2013.6267%208.48671C13.6067%208.48671%2013.5933%208.48671%2013.5733%208.48671Z'%20fill='white'/%3e%3cpath%20d='M2.49333%208.51989C2.48%208.51989%202.46%208.51989%202.44666%208.51989C2.18%208.49322%201.98666%208.25322%202.01333%207.98656C2.19333%206.24656%203.11333%204.67322%204.54666%203.65989C4.76%203.50656%205.06666%203.55989%205.22%203.77322C5.37333%203.99322%205.32%204.29322%205.10666%204.44656C3.90666%205.29989%203.12666%206.61989%202.98%208.07989C2.95333%208.33322%202.74%208.51989%202.49333%208.51989Z'%20fill='white'/%3e%3cpath%20d='M10.66%2014.0666C9.84%2014.4599%208.96%2014.6599%208.04%2014.6599C7.08%2014.6599%206.16666%2014.4466%205.31333%2014.0132C5.07333%2013.8999%204.98%2013.6066%205.1%2013.3666C5.21333%2013.1266%205.50667%2013.0332%205.74667%2013.1466C6.16667%2013.3599%206.61333%2013.5066%207.06667%2013.5932C7.68%2013.7132%208.30667%2013.7199%208.92%2013.6132C9.37333%2013.5332%209.82%2013.3932%2010.2333%2013.1932C10.48%2013.0799%2010.7733%2013.1732%2010.88%2013.4199C11%2013.6599%2010.9067%2013.9532%2010.66%2014.0666Z'%20fill='white'/%3e%3cpath%20d='M8.03333%201.34009C7%201.34009%206.15333%202.18009%206.15333%203.22009C6.15333%204.26009%206.99333%205.10009%208.03333%205.10009C9.07333%205.10009%209.91333%204.26009%209.91333%203.22009C9.91333%202.18009%209.07333%201.34009%208.03333%201.34009Z'%20fill='white'/%3e%3cpath%20d='M3.36666%209.24658C2.33333%209.24658%201.48666%2010.0866%201.48666%2011.1266C1.48666%2012.1666%202.32666%2013.0066%203.36666%2013.0066C4.40666%2013.0066%205.24666%2012.1666%205.24666%2011.1266C5.24666%2010.0866%204.4%209.24658%203.36666%209.24658Z'%20fill='white'/%3e%3cpath%20d='M12.6333%209.24658C11.6%209.24658%2010.7533%2010.0866%2010.7533%2011.1266C10.7533%2012.1666%2011.5933%2013.0066%2012.6333%2013.0066C13.6733%2013.0066%2014.5133%2012.1666%2014.5133%2011.1266C14.5133%2010.0866%2013.6733%209.24658%2012.6333%209.24658Z'%20fill='white'/%3e%3c/svg%3e",CEe="data:image/svg+xml,%3csvg%20width='18'%20height='14'%20viewBox='0%200%2018%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3194_16457)'%3e%3cpath%20d='M11.5339%200C11.358%200.32044%2011.2001%200.651933%2011.0565%200.990792C9.69238%200.78085%208.30315%200.78085%206.93547%200.990792C6.79547%200.651933%206.63392%200.32044%206.45804%200C5.1765%200.224685%203.92727%200.618785%202.74267%201.17495C0.394982%204.74402%20-0.240399%208.22099%200.075501%2011.6501C1.45036%2012.6924%202.99036%2013.488%204.63086%2013.9963C5.0006%2013.488%205.32727%2012.9466%205.60727%2012.3831C5.07599%2012.1805%204.56265%2011.9263%204.07087%2011.6317C4.20009%2011.5359%204.32573%2011.4365%204.44778%2011.3407C7.33034%2012.733%2010.6688%2012.733%2013.5549%2011.3407C13.677%2011.4438%2013.8026%2011.5433%2013.9318%2011.6317C13.4401%2011.93%2012.9267%2012.1805%2012.3919%2012.3867C12.6718%2012.9503%2012.9985%2013.4917%2013.3683%2014C15.0087%2013.4917%2016.5487%2012.6998%2017.9237%2011.6575C18.2969%207.67955%2017.2847%204.23204%2015.2492%201.17864C14.0683%200.622475%2012.819%200.22836%2011.5375%200.00736458L11.5339%200ZM6.00932%209.5396C5.12266%209.5396%204.38677%208.71455%204.38677%207.6943C4.38677%206.67405%205.09394%205.84531%206.00573%205.84531C6.91753%205.84531%207.64264%206.67772%207.62828%207.6943C7.61393%208.71087%206.91394%209.5396%206.00932%209.5396ZM11.9898%209.5396C11.0995%209.5396%2010.3708%208.71455%2010.3708%207.6943C10.3708%206.67405%2011.078%205.84531%2011.9898%205.84531C12.9016%205.84531%2013.6231%206.67772%2013.6088%207.6943C13.5944%208.71087%2012.8944%209.5396%2011.9898%209.5396Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3194_16457'%3e%3crect%20width='18'%20height='14'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Glt="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.1626%201.5H14.3679L9.54994%207.00667L15.2179%2014.5H10.7799L7.30394%209.95533L3.3266%2014.5H1.11994L6.27327%208.61L0.835938%201.5H5.3866L8.5286%205.654L12.1626%201.5ZM11.3886%2013.18H12.6106L4.7226%202.75067H3.41127L11.3886%2013.18Z'%20fill='white'/%3e%3c/svg%3e",Klt="data:image/svg+xml,%3csvg%20width='18'%20height='16'%20viewBox='0%200%2018%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M1.24334%206.83119C5.90766%204.79901%209.01794%203.45928%2010.5742%202.81199C15.0175%200.963838%2015.9408%200.642794%2016.5426%200.632193C16.675%200.629862%2016.9709%200.662664%2017.1626%200.818215C17.3245%200.949559%2017.369%201.12699%2017.3903%201.25151C17.4117%201.37604%2017.4382%201.65972%2017.4171%201.88138C17.1763%204.41136%2016.1344%2010.5509%2015.6044%2013.3846C15.3801%2014.5836%2014.9385%2014.9856%2014.5109%2015.0249C13.5818%2015.1104%2012.8762%2014.4109%2011.9763%2013.821C10.5681%2012.8979%209.77254%2012.3233%208.40563%2011.4225C6.82593%2010.3815%207.84998%209.80933%208.75025%208.87427C8.98585%208.62956%2013.0797%204.90589%2013.1589%204.56809C13.1689%204.52584%2013.1781%204.36837%2013.0845%204.28521C12.9909%204.20206%2012.8529%204.2305%2012.7532%204.25311C12.612%204.28517%2010.3624%205.77209%206.00433%208.71388C5.36578%209.15236%204.7874%209.366%204.2692%209.3548C3.69791%209.34246%202.599%209.03179%201.78206%208.76624C0.780062%208.44052%20-0.0163084%208.26832%200.0530376%207.71516C0.0891573%207.42704%200.485924%207.13238%201.24334%206.83119Z'%20fill='white'/%3e%3c/svg%3e",Ylt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M19.3697%204.89012L13.5097%202.28012C12.6497%201.90012%2011.3497%201.90012%2010.4897%202.28012L4.62969%204.89012C3.14969%205.55012%202.92969%206.45012%202.92969%206.93012C2.92969%207.41012%203.14969%208.31012%204.62969%208.97012L10.4897%2011.5801C10.9197%2011.7701%2011.4597%2011.8701%2011.9997%2011.8701C12.5397%2011.8701%2013.0797%2011.7701%2013.5097%2011.5801L19.3697%208.97012C20.8497%208.31012%2021.0697%207.41012%2021.0697%206.93012C21.0697%206.45012%2020.8597%205.55012%2019.3697%204.89012Z'%20fill='%23083C26'/%3e%3cpath%20d='M12.0003%2017.04C11.6203%2017.04%2011.2403%2016.96%2010.8903%2016.81L4.15031%2013.81C3.12031%2013.35%202.32031%2012.12%202.32031%2010.99C2.32031%2010.58%202.65031%2010.25%203.06031%2010.25C3.47031%2010.25%203.80031%2010.58%203.80031%2010.99C3.80031%2011.53%204.25031%2012.23%204.75031%2012.45L11.4903%2015.45C11.8103%2015.59%2012.1803%2015.59%2012.5003%2015.45L19.2403%2012.45C19.7403%2012.23%2020.1903%2011.54%2020.1903%2010.99C20.1903%2010.58%2020.5203%2010.25%2020.9303%2010.25C21.3403%2010.25%2021.6703%2010.58%2021.6703%2010.99C21.6703%2012.11%2020.8703%2013.35%2019.8403%2013.81L13.1003%2016.81C12.7603%2016.96%2012.3803%2017.04%2012.0003%2017.04Z'%20fill='%23083C26'/%3e%3cpath%20d='M12.0003%2022C11.6203%2022%2011.2403%2021.92%2010.8903%2021.77L4.15031%2018.77C3.04031%2018.28%202.32031%2017.17%202.32031%2015.95C2.32031%2015.54%202.65031%2015.21%203.06031%2015.21C3.47031%2015.21%203.80031%2015.54%203.80031%2015.95C3.80031%2016.58%204.17031%2017.15%204.75031%2017.41L11.4903%2020.41C11.8103%2020.55%2012.1803%2020.55%2012.5003%2020.41L19.2403%2017.41C19.8103%2017.16%2020.1903%2016.58%2020.1903%2015.95C20.1903%2015.54%2020.5203%2015.21%2020.9303%2015.21C21.3403%2015.21%2021.6703%2015.54%2021.6703%2015.95C21.6703%2017.17%2020.9503%2018.27%2019.8403%2018.77L13.1003%2021.77C12.7603%2021.92%2012.3803%2022%2012.0003%2022Z'%20fill='%23083C26'/%3e%3c/svg%3e",Xlt="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.299%202.85232L7.88065%201.32982C7.37898%201.10816%206.62065%201.10816%206.11898%201.32982L2.70065%202.85232C1.83732%203.23732%201.70898%203.76232%201.70898%204.04232C1.70898%204.32232%201.83732%204.84732%202.70065%205.23232L6.11898%206.75482C6.36982%206.86566%206.68482%206.92399%206.99982%206.92399C7.31482%206.92399%207.62982%206.86566%207.88065%206.75482L11.299%205.23232C12.1623%204.84732%2012.2907%204.32232%2012.2907%204.04232C12.2907%203.76232%2012.1682%203.23732%2011.299%202.85232Z'%20fill='%2367FFBD'/%3e%3cpath%20d='M7.00018%209.93984C6.77852%209.93984%206.55685%209.89317%206.35268%209.80567L2.42102%208.05567C1.82018%207.78734%201.35352%207.06984%201.35352%206.41067C1.35352%206.1715%201.54602%205.979%201.78518%205.979C2.02435%205.979%202.21685%206.1715%202.21685%206.41067C2.21685%206.72567%202.47935%207.134%202.77102%207.26234L6.70268%209.01234C6.88935%209.094%207.10518%209.094%207.29185%209.01234L11.2235%207.26234C11.5152%207.134%2011.7777%206.7315%2011.7777%206.41067C11.7777%206.1715%2011.9702%205.979%2012.2093%205.979C12.4485%205.979%2012.641%206.1715%2012.641%206.41067C12.641%207.064%2012.1743%207.78734%2011.5735%208.05567L7.64185%209.80567C7.44352%209.89317%207.22185%209.93984%207.00018%209.93984Z'%20fill='%2367FFBD'/%3e%3cpath%20d='M7.00018%2012.8334C6.77852%2012.8334%206.55685%2012.7867%206.35268%2012.6992L2.42102%2010.9492C1.77352%2010.6634%201.35352%2010.0159%201.35352%209.30423C1.35352%209.06506%201.54602%208.87256%201.78518%208.87256C2.02435%208.87256%202.21685%209.06506%202.21685%209.30423C2.21685%209.67173%202.43268%2010.0042%202.77102%2010.1559L6.70268%2011.9059C6.88935%2011.9876%207.10518%2011.9876%207.29185%2011.9059L11.2235%2010.1559C11.556%2010.0101%2011.7777%209.67173%2011.7777%209.30423C11.7777%209.06506%2011.9702%208.87256%2012.2093%208.87256C12.4485%208.87256%2012.641%209.06506%2012.641%209.30423C12.641%2010.0159%2012.221%2010.6576%2011.5735%2010.9492L7.64185%2012.6992C7.44352%2012.7867%207.22185%2012.8334%207.00018%2012.8334Z'%20fill='%2367FFBD'/%3e%3c/svg%3e",SEe="data:image/webp;base64,UklGRjQFAABXRUJQVlA4WAoAAAAQAAAATwAATwAAQUxQSH0BAAABkFZtb91IHwRBEJRAMAQzmDCoGTQMXAaBYAiG8EEQBM3s9uLY2svPiJgAXC1pr410d7featkEC0u60weyJlljO83H1zSd3MwvZtaZ5GY+IW/zZPqkzHNo84lPneDLfGrLV8ndp79fo90X7HqB0pekDlP6otRBSl+WOkTpC1NHdF+6y2d3X/z+Ufbl9w/U1jN97/QA21vZQ8zvMAbKq5sHWV4oozB5lj3M8oxx2JPkgW6/1UhOAOKRmgApFE9AjeUAGAshHqxs0aQSzf6IprZoWo+GFo7/92U0Fk5v0bRHNHWPpqRoNolGwFgIHLFUIMWSALFQBMAZSQWALZL0GywO4mmJIz8Ti4L6DCWKgpfCGIg3cwz5HbQITryttp7pe9jXy/j0WO3Ax9LX6hioXIk6Asp1qBirXIWK0co1qBivfYWuuPSY7xBcnG0u23G9njM1xZSZszBj2sIZrAgm1syrrAhmT48L7NywpKQHR/BIgoVlK7V1+41sdU+CqwEAVlA4IJADAABwEwCdASpQAFAAPoU2lUelIyIhNbWt+KAQiWgAwcQmjtEXOZ5HT3EdLOAefDpgG8d/ufJgCf6jCvGt9C+wF+svVj9Cn9MGb35/r/3vvZgfMSDVHeAiajfoFCV6cakAkwXuHIdi1jVLDZWi77j8sJk+JjxDWiXlDvt6I8wpx4M78xMLipwjRr4qS7zgj/mcsZ7+N9mFpGVH+u8uucq/VUIgbo8haAD+9nv//1lX/+sXv//V1BzpNxdi//pSQKliFbd/die8+PJljk1dSETv/4Dv//V9v/6xe//9X4vt/T1CpqMx/9Jrs3+i7wjIfqVj0ir9/fLIHPFE/n+4kRR0tZ/6/Nz2DIp8r6foLt/8YWQ3TXVGe5Agwsl+1h/8vQHA/mhjtDMKMNJHVELwPr/sRxHahr2rUd5f6Jo2mSF/HB/3VcOqJOkapGgKidoRI6QH2gLTGlK1hC/jcfJbEmVE6ymGrd945Qw6B3neGhuFvVvX4SojZ6xzO/CzIbCO/2X7p7UPxPOEo2SxBD+I17Rl8Q6EuwFnKc2wK3x20D98b69igUaZM+cJyP9CbW270jv/PUK4CuwPXktb8oK+6kVs9P/jnHw//fuE2v1W91zgCuInucSU+hOVEXKMk+e1qYbdONQSmOug0bzt7gx94aJ6a0CQKuH90O03DvmSWJk1kGLJHXloJlj4rZLImdggYgr/kyRqAJ91d6EkOkYmBF7cPbmbx3ZK0RcjZLGBZpxXPO4VlfR3aSZqLHYMM4j0J5/PFZXvLhPP4zZbimGJ0rHCeDH2zPOAxPVxMPFX9je/PArcoYy2MF7utYELr0I0N16B0cFSuGM39Ya0jv+XoNZzMiRLJ94xOrAlE5mc9MLobRQb91AvrGdbFck8hQS5s6umsNJ/reb5eLgMGyBZOko+RT2uDpQ7eXjMuJdlVrdilTJxEMxui5E4H2R2+w30l9Ge4IJugTERWfY/dWK5IPAGneaeMvBupdYOkxAbZf+JDjYDkFw9MCWQ6qD9XvjxLBrzzvkWkVq9vYS1jjXxt52QWo/GoqTBhQfuTXxr5L/9+sehGnbJ7f8fVWUNUbjUW0j4N/qn7RyiWdXShQYKeh/FGLQSqLLqiVSu+XV8RIkoRpiXfBVFL3JChg1ifmXaGvCvGKfsiQ0f4wrAPxHL15eWF8EM9EQM/+XMNRXxz89P85wJOVelt87VZ+65wJOaz1aQyAA=",Qlt="data:image/svg+xml,%3csvg%20width='14'%20height='10'%20viewBox='0%200%2014%2010'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.0572%204.79065C13.0572%205.66981%2012.3474%206.38537%2011.4753%206.38537C10.6034%206.38537%209.8961%205.66981%209.8961%204.79065C9.8961%203.90784%2010.6034%203.19229%2011.4753%203.19229C12.3455%203.19229%2013.0572%203.90911%2013.0572%204.79065ZM2.52608%203.19229C1.65388%203.19229%200.944177%203.90784%200.944177%204.79065C0.944177%205.66981%201.65388%206.38537%202.52608%206.38537C3.39561%206.38537%204.10532%205.66981%204.10532%204.79065C4.10532%203.90911%203.39561%203.19229%202.52608%203.19229ZM6.99882%200C5.71126%200%204.6618%201.0588%204.6618%202.36126C4.6618%203.66355%205.71016%204.72426%206.99882%204.72426C8.28795%204.72426%209.33648%203.66355%209.33648%202.36126C9.33726%201.0588%208.28779%200%206.99882%200ZM13.9998%209.63452C13.9998%208.1818%2012.865%207.00276%2011.473%207.00276C11.2247%207.00276%2010.9875%207.05216%2010.7619%207.12205C11.0592%207.72451%2011.2412%208.39639%2011.2412%209.1191V10H14L13.9998%209.63452ZM3.23516%207.12205C3.01027%207.05216%202.77548%207.00276%202.52718%207.00276C1.13323%207.00276%200%208.18387%200%209.63452V10H2.75584V9.1191C2.75584%208.39639%202.93892%207.72451%203.23516%207.12205ZM3.33495%2010H10.6621V9.16246C10.6621%207.06169%209.01746%205.35262%206.99882%205.35262C4.97689%205.35262%203.33511%207.06185%203.33511%209.16246L3.33495%2010Z'%20fill='%2367FFBD'/%3e%3c/svg%3e",Zlt="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%2011C8.75%2011%2011%208.75%2011%206C11%203.25%208.75%201%206%201C3.25%201%201%203.25%201%206C1%208.75%203.25%2011%206%2011Z'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6%204V6.5'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.99725%208H6.00174'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Jlt="data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.68583%202.96336C8.17833%202.81169%207.61833%202.71252%207%202.71252C4.20583%202.71252%201.9425%204.97586%201.9425%207.77002C1.9425%2010.57%204.20583%2012.8334%207%2012.8334C9.79416%2012.8334%2012.0575%2010.57%2012.0575%207.77586C12.0575%206.73752%2011.7425%205.76919%2011.2058%204.96419'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.40917%203.10335L7.72334%201.16669'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.40917%203.10333L7.44334%204.53833'%20stroke='%23FFAA47'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ime="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.125%2019.5V12.75H9.375'%20stroke='%2334D399'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M21.375%2019.5H2.625'%20stroke='%2334D399'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.375%2019.5V8.25H14.625'%20stroke='%2334D399'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M19.875%203.75H14.625V19.5H19.875V3.75Z'%20stroke='%2334D399'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",bJ="data:image/svg+xml,%3csvg%20width='11'%20height='7'%20viewBox='0%200%2011%207'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.83097%200.791748L6.66431%204.00789C6.6074%204.06569%206.57869%204.09459%206.55322%204.11738C6.1419%204.48554%205.51967%204.48554%205.10835%204.11738C5.08288%204.09459%205.05417%204.06568%204.99726%204.00789C4.94036%203.95009%204.9119%203.92119%204.88643%203.8984C4.47511%203.53024%203.85288%203.53024%203.44156%203.8984C3.41609%203.92119%203.38764%203.9501%203.33073%204.00789L1.16406%206.20841M9.83097%200.791748L9.83073%204.04175M9.83097%200.791748H6.58073'%20stroke='%2334D399'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",yJ="data:image/svg+xml,%3csvg%20width='11'%20height='7'%20viewBox='0%200%2011%207'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.00496%206.41675L4.17163%203.2006C4.22854%203.14281%204.25725%203.1139%204.28271%203.09111C4.69404%202.72296%205.31627%202.72296%205.72759%203.09111C5.75306%203.1139%205.78177%203.14281%205.83868%203.20061C5.89558%203.2584%205.92404%203.28731%205.9495%203.3101C6.36083%203.67826%206.98306%203.67826%207.39438%203.3101C7.41984%203.28731%207.4483%203.2584%207.50521%203.2006L9.67188%201.00008M1.00496%206.41675L1.00521%203.16675M1.00496%206.41675L4.25521%206.41675'%20stroke='%23FB7184'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ect="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='21'%20height='22'%20viewBox='0%200%2021%2022'%20fill='none'%3e%3cpath%20d='M2.625%206.625H18.375'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20d='M5.25%2011H15.75'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20d='M8.75%2015.375H12.25'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3c/svg%3e",tct="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='21'%20height='22'%20viewBox='0%200%2021%2022'%20fill='none'%3e%3cpath%20d='M2.625%206.625H18.375'%20stroke='%2367FFBD'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20d='M5.25%2011H15.75'%20stroke='%2367FFBD'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20d='M8.75%2015.375H12.25'%20stroke='%2367FFBD'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3c/svg%3e",WA="/assets/dextrabotIcon64x64-CGBWeHNW.png",nct="/assets/telegramfilterIcon-D3R-nSo1.svg",rct="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%3e%3cpath%20d='M10.5%2019.25C15.3325%2019.25%2019.25%2015.3325%2019.25%2010.5C19.25%205.66751%2015.3325%201.75%2010.5%201.75C5.66751%201.75%201.75%205.66751%201.75%2010.5C1.75%2015.3325%205.66751%2019.25%2010.5%2019.25Z'%20stroke='%236A6A6A'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.00039%202.625H7.87539C6.16914%207.735%206.16914%2013.265%207.87539%2018.375H7.00039'%20stroke='%236A6A6A'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M13.125%202.625C14.8313%207.735%2014.8313%2013.265%2013.125%2018.375'%20stroke='%236A6A6A'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.625%2014V13.125C7.735%2014.8313%2013.265%2014.8313%2018.375%2013.125V14'%20stroke='%236A6A6A'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2.625%207.8749C7.735%206.16865%2013.265%206.16865%2018.375%207.8749'%20stroke='%236A6A6A'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",pE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='9'%20height='8'%20viewBox='0%200%209%208'%20fill='none'%3e%3cpath%20d='M4.5%200L0%208L9%208L4.5%200Z'%20fill='%233DB380'/%3e%3c/svg%3e",mE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='9'%20height='8'%20viewBox='0%200%209%208'%20fill='none'%3e%3cpath%20d='M4.5%208L9%200L0%202.0772e-08L4.5%208Z'%20fill='%23FF797C'/%3e%3c/svg%3e",R0="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.3726%207.16021L13.4726%206.10688C13.3059%205.90688%2013.1659%205.53355%2013.1659%205.26688V4.13355C13.1659%203.42688%2012.5859%202.84688%2011.8793%202.84688H10.7459C10.4793%202.84688%2010.0993%202.70688%209.89927%202.54021L8.84594%201.64021C8.38594%201.24688%207.6326%201.24688%207.1726%201.64021L6.10594%202.54021C5.90594%202.70688%205.5326%202.84688%205.26594%202.84688H4.1126C3.40594%202.84688%202.82594%203.42688%202.82594%204.13355V5.26688C2.82594%205.52688%202.6926%205.90021%202.52594%206.10021L1.62594%207.16021C1.23927%207.62688%201.23927%208.37355%201.62594%208.82688L2.52594%209.88688C2.6926%2010.0802%202.82594%2010.4602%202.82594%2010.7202V11.8602C2.82594%2012.5669%203.40594%2013.1469%204.1126%2013.1469H5.2726C5.5326%2013.1469%205.9126%2013.2869%206.1126%2013.4535L7.16594%2014.3535C7.62594%2014.7469%208.37927%2014.7469%208.83927%2014.3535L9.8926%2013.4535C10.0926%2013.2869%2010.4659%2013.1469%2010.7326%2013.1469H11.8659C12.5726%2013.1469%2013.1526%2012.5669%2013.1526%2011.8602V10.7269C13.1526%2010.4602%2013.2926%2010.0869%2013.4593%209.88688L14.3593%208.83355C14.7659%208.38022%2014.7659%207.62688%2014.3726%207.16021ZM7.49927%205.42022C7.49927%205.14688%207.72594%204.92022%207.99927%204.92022C8.2726%204.92022%208.49927%205.14688%208.49927%205.42022V8.64021C8.49927%208.91355%208.2726%209.14021%207.99927%209.14021C7.72594%209.14021%207.49927%208.91355%207.49927%208.64021V5.42022ZM7.99927%2011.2469C7.6326%2011.2469%207.3326%2010.9469%207.3326%2010.5802C7.3326%2010.2135%207.62594%209.91355%207.99927%209.91355C8.36594%209.91355%208.66594%2010.2135%208.66594%2010.5802C8.66594%2010.9469%208.3726%2011.2469%207.99927%2011.2469Z'%20fill='%23636363'/%3e%3c/svg%3e",sct="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_257_8126)'%3e%3cpath%20d='M1.5%201C1.36739%201%201.24021%201.05268%201.14645%201.14645C1.05268%201.24021%201%201.36739%201%201.5V5.5C1%205.63261%200.947322%205.75979%200.853553%205.85355C0.759785%205.94732%200.632608%206%200.5%206C0.367392%206%200.240215%205.94732%200.146447%205.85355C0.0526784%205.75979%200%205.63261%200%205.5V1.5C0%201.10218%200.158035%200.720644%200.43934%200.43934C0.720644%200.158035%201.10218%200%201.5%200L5.5%200C5.63261%200%205.75979%200.0526784%205.85355%200.146447C5.94732%200.240215%206%200.367392%206%200.5C6%200.632608%205.94732%200.759785%205.85355%200.853553C5.75979%200.947322%205.63261%201%205.5%201H1.5ZM10%200.5C10%200.367392%2010.0527%200.240215%2010.1464%200.146447C10.2402%200.0526784%2010.3674%200%2010.5%200L14.5%200C14.8978%200%2015.2794%200.158035%2015.5607%200.43934C15.842%200.720644%2016%201.10218%2016%201.5V5.5C16%205.63261%2015.9473%205.75979%2015.8536%205.85355C15.7598%205.94732%2015.6326%206%2015.5%206C15.3674%206%2015.2402%205.94732%2015.1464%205.85355C15.0527%205.75979%2015%205.63261%2015%205.5V1.5C15%201.36739%2014.9473%201.24021%2014.8536%201.14645C14.7598%201.05268%2014.6326%201%2014.5%201H10.5C10.3674%201%2010.2402%200.947322%2010.1464%200.853553C10.0527%200.759785%2010%200.632608%2010%200.5ZM0.5%2010C0.632608%2010%200.759785%2010.0527%200.853553%2010.1464C0.947322%2010.2402%201%2010.3674%201%2010.5V14.5C1%2014.6326%201.05268%2014.7598%201.14645%2014.8536C1.24021%2014.9473%201.36739%2015%201.5%2015H5.5C5.63261%2015%205.75979%2015.0527%205.85355%2015.1464C5.94732%2015.2402%206%2015.3674%206%2015.5C6%2015.6326%205.94732%2015.7598%205.85355%2015.8536C5.75979%2015.9473%205.63261%2016%205.5%2016H1.5C1.10218%2016%200.720644%2015.842%200.43934%2015.5607C0.158035%2015.2794%200%2014.8978%200%2014.5L0%2010.5C0%2010.3674%200.0526784%2010.2402%200.146447%2010.1464C0.240215%2010.0527%200.367392%2010%200.5%2010ZM15.5%2010C15.6326%2010%2015.7598%2010.0527%2015.8536%2010.1464C15.9473%2010.2402%2016%2010.3674%2016%2010.5V14.5C16%2014.8978%2015.842%2015.2794%2015.5607%2015.5607C15.2794%2015.842%2014.8978%2016%2014.5%2016H10.5C10.3674%2016%2010.2402%2015.9473%2010.1464%2015.8536C10.0527%2015.7598%2010%2015.6326%2010%2015.5C10%2015.3674%2010.0527%2015.2402%2010.1464%2015.1464C10.2402%2015.0527%2010.3674%2015%2010.5%2015H14.5C14.6326%2015%2014.7598%2014.9473%2014.8536%2014.8536C14.9473%2014.7598%2015%2014.6326%2015%2014.5V10.5C15%2010.3674%2015.0527%2010.2402%2015.1464%2010.1464C15.2402%2010.0527%2015.3674%2010%2015.5%2010Z'%20fill='%23929292'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_257_8126'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",mae="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%3e%3cpath%20d='M24%2011.9499C24%2019.8843%2019.1443%2022.4303%2016.5859%2020.1633C14.4801%2018.3148%2013.8535%2014.4087%2010.686%2014.0076C6.6657%2013.5019%206.31762%2018.8555%203.67223%2018.8555C0.591733%2018.8555%200%2014.3738%200%2012.0719C0%209.71772%200.661348%206.50904%203.28933%206.50904C6.35243%206.50904%206.52647%2011.0954%2010.3553%2010.8512C14.1668%2010.5897%2014.2364%205.81149%2016.7078%203.77119C18.8658%202.00989%2024%203.91069%2024%2011.9499Z'%20fill='%2397FCE4'/%3e%3c/svg%3e",ict="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%3e%3cpath%20d='M14.1663%201.75H6.83375C3.64875%201.75%201.75%203.64875%201.75%206.83375V14.1575C1.75%2017.3513%203.64875%2019.25%206.83375%2019.25H14.1575C17.3425%2019.25%2019.2412%2017.3513%2019.2412%2014.1663V6.83375C19.25%203.64875%2017.3513%201.75%2014.1663%201.75ZM15.0938%2010.7887C15.0938%2011.1475%2014.7963%2011.445%2014.4375%2011.445C14.0787%2011.445%2013.7812%2011.1475%2013.7812%2010.7887V8.14625L7.02625%2014.9013C6.895%2015.0325%206.72875%2015.0938%206.5625%2015.0938C6.39625%2015.0938%206.23%2015.0325%206.09875%2014.9013C5.845%2014.6475%205.845%2014.2275%206.09875%2013.9738L12.8537%207.21875H10.2113C9.8525%207.21875%209.555%206.92125%209.555%206.5625C9.555%206.20375%209.8525%205.90625%2010.2113%205.90625H14.4375C14.7963%205.90625%2015.0938%206.20375%2015.0938%206.5625V10.7887Z'%20fill='%2300FF91'/%3e%3c/svg%3e",act="/assets/telegramModalIcon-CwWiyADO.png",NEe="data:image/svg+xml,%3csvg%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M43.1198%2021.48L40.3998%2018.32C39.8798%2017.72%2039.4598%2016.6%2039.4598%2015.8V12.4C39.4598%2010.28%2037.7198%208.53999%2035.5998%208.53999H32.1998C31.4198%208.53999%2030.2798%208.12%2029.6798%207.59999L26.5198%204.88C25.1398%203.7%2022.8798%203.7%2021.4798%204.88L18.3398%207.61999C17.7398%208.12%2016.5998%208.53999%2015.8198%208.53999H12.3598C10.2398%208.53999%208.49977%2010.28%208.49977%2012.4V15.82C8.49977%2016.6%208.07977%2017.72%207.57977%2018.32L4.87977%2021.5C3.71977%2022.88%203.71977%2025.12%204.87977%2026.5L7.57977%2029.68C8.07977%2030.28%208.49977%2031.4%208.49977%2032.18V35.6C8.49977%2037.72%2010.2398%2039.46%2012.3598%2039.46H15.8198C16.5998%2039.46%2017.7398%2039.88%2018.3398%2040.4L21.4998%2043.12C22.8798%2044.3%2025.1398%2044.3%2026.5398%2043.12L29.6998%2040.4C30.2998%2039.88%2031.4198%2039.46%2032.2198%2039.46H35.6198C37.7398%2039.46%2039.4798%2037.72%2039.4798%2035.6V32.2C39.4798%2031.42%2039.8998%2030.28%2040.4198%2029.68L43.1398%2026.52C44.2998%2025.14%2044.2998%2022.86%2043.1198%2021.48ZM32.3198%2020.22L22.6598%2029.88C22.3798%2030.16%2021.9998%2030.32%2021.5998%2030.32C21.1998%2030.32%2020.8198%2030.16%2020.5398%2029.88L15.6998%2025.04C15.1198%2024.46%2015.1198%2023.5%2015.6998%2022.92C16.2798%2022.34%2017.2398%2022.34%2017.8198%2022.92L21.5998%2026.7L30.1998%2018.1C30.7798%2017.52%2031.7398%2017.52%2032.3198%2018.1C32.8998%2018.68%2032.8998%2019.64%2032.3198%2020.22Z'%20fill='%231DE674'/%3e%3c/svg%3e",AEe="data:image/svg+xml,%3csvg%20width='21'%20height='22'%20viewBox='0%200%2021%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3765_9549)'%3e%3cpath%20d='M10.5%2021.5C16.299%2021.5%2021%2016.799%2021%2011C21%205.20101%2016.299%200.5%2010.5%200.5C4.70101%200.5%200%205.20101%200%2011C0%2016.799%204.70101%2021.5%2010.5%2021.5Z'%20fill='url(%23paint0_linear_3765_9549)'/%3e%3cpath%20d='M7.10742%2011.7675L8.35316%2015.2156C8.35316%2015.2156%208.50891%2015.5382%208.67568%2015.5382C8.84246%2015.5382%2011.323%2012.9576%2011.323%2012.9576L14.0814%207.62976L7.15187%2010.8775L7.10742%2011.7675Z'%20fill='%23C8DAEA'/%3e%3cpath%20d='M8.75895%2012.6519L8.51981%2015.1934C8.51981%2015.1934%208.41971%2015.9721%209.19829%2015.1934C9.97686%2014.4146%2010.7221%2013.8141%2010.7221%2013.8141'%20fill='%23A9C6D8'/%3e%3cpath%20d='M7.12957%2011.8906L4.56705%2011.0557C4.56705%2011.0557%204.2608%2010.9315%204.35941%2010.6497C4.37971%2010.5916%204.42066%2010.5422%204.54316%2010.4572C5.11095%2010.0614%2015.0524%206.4882%2015.0524%206.4882C15.0524%206.4882%2015.3331%206.39362%2015.4987%206.45653C15.5396%206.46921%2015.5765%206.49254%2015.6055%206.52413C15.6344%206.55572%2015.6545%206.59445%2015.6636%206.63634C15.6815%206.71034%2015.689%206.78647%2015.6858%206.86253C15.6851%206.92833%2015.6771%206.98932%2015.6711%207.08495C15.6105%208.06189%2013.7986%2015.3531%2013.7986%2015.3531C13.7986%2015.3531%2013.6901%2015.7797%2013.3017%2015.7944C13.2063%2015.7974%2013.1112%2015.7813%2013.0221%2015.7468C12.933%2015.7124%2012.8518%2015.6603%2012.7833%2015.5938C12.0211%2014.9382%209.38663%2013.1677%208.8045%2012.7783C8.79136%2012.7694%208.78031%2012.7577%208.77206%2012.7441C8.76382%2012.7305%208.75859%2012.7153%208.75672%2012.6996C8.74858%2012.6585%208.79321%2012.6077%208.79321%2012.6077C8.79321%2012.6077%2013.3805%208.53019%2013.5025%208.10214C13.512%208.06898%2013.4763%208.05262%2013.4283%208.06714C13.1237%208.17923%207.842%2011.5146%207.25907%2011.8828C7.21711%2011.8954%207.17276%2011.8981%207.12957%2011.8906Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_3765_9549'%20x1='10.5'%20y1='21.5'%20x2='10.5'%20y2='0.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231D93D2'/%3e%3cstop%20offset='1'%20stop-color='%2338B0E3'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_3765_9549'%3e%3crect%20width='21'%20height='21'%20fill='white'%20transform='translate(0%200.5)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ame="data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%201.5C4.8675%201.5%201.5%204.8675%201.5%209C1.5%2013.1325%204.8675%2016.5%209%2016.5C13.1325%2016.5%2016.5%2013.1325%2016.5%209C16.5%204.8675%2013.1325%201.5%209%201.5ZM12.585%207.275L8.3325%2011.5275C8.2275%2011.6325%208.085%2011.6925%207.935%2011.6925C7.785%2011.6925%207.6425%2011.6325%207.5375%2011.5275L5.415%209.405C5.1975%209.1875%205.1975%208.8275%205.415%208.61C5.6325%208.3925%205.9925%208.3925%206.21%208.61L7.935%2010.335L11.79%206.48C12.0075%206.2625%2012.3675%206.2625%2012.585%206.48C12.8025%206.6975%2012.8025%207.05%2012.585%207.275Z'%20fill='%231DE674'/%3e%3c/svg%3e",jEe="/assets/basedLogoSvgIcon-C71QETXb.png",lT="/assets/variationalIcon-VFI-7A--.png",xae="/assets/apexIcon-pUC7_jPm.png",cT="/assets/paradexIcon-gNYlng5D.jpg",oct="/assets/basedAppIcon-xn9d9rQz.jpg",lct="/assets/pacificaErrorImage-BKGQKjSV.jpeg",cct=[{type:"link",label:"Terminal",to:"/terminal/BTC",activePaths:["/terminal"]},{type:"dropdown",label:"Leaderboard",activePaths:["/leaderboard","/referral"],items:[{label:"Leaderboard",to:"/leaderboard"},{label:"Referral",to:"/referral"}]},{type:"dropdown",label:"Tracker",activePaths:["/tracked-wallets","/tracker"],items:[{label:"Tracked Wallets",to:"/tracked-wallets"},{label:"My Activities",to:"/tracker"}]},{type:"link",label:"Funding",to:"/funding"},{type:"dropdown",label:"Copy Trade",border_color:"blue",activePaths:["/copy-trade","/wallet-management","/discover-wallets","/hyperliquid-vaults","/back-testing","/hyperliquid-whale-trades","/hyperliquid-fee-calculator"],items:[{label:"Discover Wallets",to:"/discover-wallets"},{label:"My Copy Trading",to:"/copy-trade"},{label:"Wallet Management",to:"/wallet-management"},{label:"Discover Vaults",to:"/hyperliquid-vaults"},{label:"Backtest",to:"/back-testing"},{label:"Whale Trades",to:"/hyperliquid-whale-trades"},{label:"HL Fee Calculator",to:"/hyperliquid-fee-calculator"},{label:"Ticker",to:"ticker"}]},{type:"dropdown",label:"Trading Bots",activePaths:["/terminal/extended/BTC","/dca-bot","/terminal/lighter/BTC","/terminal/hyperliquid/BTC","/market-maker"],badgeTone:"yellow",border_color:"blue",items:[{label:"Extended Grid Bot",to:"/terminal/extended/BTC#gridbot",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{label:"Extended DCA Bot",to:"/dca-bot",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{label:"Lighter Grid Bot",to:"/terminal/lighter/BTC#gridbot",icon:M0},{label:"HL Grid Bot",to:"/terminal/hyperliquid/BTC#gridbot",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg"},{label:"HL Market Maker Bot",to:"/market-maker",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg"}]},{type:"dropdown",label:"Farming Bots",activePaths:[],badgeTone:"yellow",border_color:"blue",items:[{label:"Extended",action:"openExtended",description:"Delta Neutral vs Variational",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{label:"Variational",action:"openVariational",description:"",icon:lT},{label:"Paradex",action:"openParadex",description:"",icon:cT},{label:"Lighter",action:"openLighter",description:"Delta Neutral vs Variational",icon:M0},{label:"Pacifica",action:"openPacifica",description:"",icon:"https://app.pacifica.fi/imgs/icon.svg"},{label:"Apex",action:"openApex",description:"",icon:xae},{label:"Aster",action:"openAster",description:"",icon:$A}]}];function F3(t){"@babel/helpers - typeof";return F3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F3(t)}function uct(t,e){if(F3(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(F3(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EEe(t){var e=uct(t,"string");return F3(e)=="symbol"?e:e+""}function $7(t,e,n){return(e=EEe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ome(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Xs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ome(Object(n),!0).forEach(function(r){$7(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ome(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dct(t){if(Array.isArray(t))return t}function fct(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function vJ(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _Ee(t,e){if(t){if(typeof t=="string")return vJ(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vJ(t,e):void 0}}function hct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e1(t,e){return dct(t)||fct(t,e)||_Ee(t,e)||hct()}function pct(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.includes(r))continue;n[r]=t[r]}return n}function F1(t,e){if(t==null)return{};var n,r,s=pct(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.includes(n)||{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}var mct=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function xct(t){var e=t.defaultInputValue,n=e===void 0?"":e,r=t.defaultMenuIsOpen,s=r===void 0?!1:r,a=t.defaultValue,o=a===void 0?null:a,l=t.inputValue,c=t.menuIsOpen,u=t.onChange,d=t.onInputChange,f=t.onMenuClose,x=t.onMenuOpen,g=t.value,y=F1(t,mct),v=m.useState(l!==void 0?l:n),C=e1(v,2),N=C[0],P=C[1],T=m.useState(c!==void 0?c:s),M=e1(T,2),F=M[0],$=M[1],L=m.useState(g!==void 0?g:o),z=e1(L,2),X=z[0],ne=z[1],J=m.useCallback(function(W,V){typeof u=="function"&&u(W,V),ne(W)},[u]),K=m.useCallback(function(W,V){var ee;typeof d=="function"&&(ee=d(W,V)),P(ee!==void 0?ee:W)},[d]),te=m.useCallback(function(){typeof x=="function"&&x(),$(!0)},[x]),fe=m.useCallback(function(){typeof f=="function"&&f(),$(!1)},[f]),q=l!==void 0?l:N,se=c!==void 0?c:F,ae=g!==void 0?g:X;return Xs(Xs({},y),{},{inputValue:q,menuIsOpen:se,onChange:J,onInputChange:K,onMenuClose:fe,onMenuOpen:te,value:ae})}function ri(){return ri=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ri.apply(null,arguments)}function gct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lme(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,EEe(r.key),r)}}function bct(t,e,n){return lme(t.prototype,e),lme(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wJ(t,e){return wJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},wJ(t,e)}function yct(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wJ(t,e)}function KM(t){return KM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},KM(t)}function kEe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kEe=function(){return!!t})()}function vct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wct(t,e){if(e&&(F3(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vct(t)}function Cct(t){var e=kEe();return function(){var n,r=KM(t);if(e){var s=KM(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return wct(this,n)}}function Sct(t){if(Array.isArray(t))return vJ(t)}function Nct(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Act(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gae(t){return Sct(t)||Nct(t)||_Ee(t)||Act()}function jct(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function Ect(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var _ct=function(){function t(n){var r=this;this._insertTag=function(s){var a;r.tags.length===0?r.insertionPoint?a=r.insertionPoint.nextSibling:r.prepend?a=r.container.firstChild:a=r.before:a=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(s,a),r.tags.push(s)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(r){r.forEach(this._insertTag)},e.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Ect(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var a=jct(s);try{a.insertRule(r,a.cssRules.length)}catch{}}else s.appendChild(document.createTextNode(r));this.ctr++},e.flush=function(){this.tags.forEach(function(r){var s;return(s=r.parentNode)==null?void 0:s.removeChild(r)}),this.tags=[],this.ctr=0},t}(),vu="-ms-",YM="-moz-",wa="-webkit-",TEe="comm",bae="rule",yae="decl",kct="@import",PEe="@keyframes",Tct="@layer",Pct=Math.abs,HB=String.fromCharCode,Ict=Object.assign;function Fct(t,e){return tu(t,0)^45?(((e<<2^tu(t,0))<<2^tu(t,1))<<2^tu(t,2))<<2^tu(t,3):0}function IEe(t){return t.trim()}function Oct(t,e){return(t=e.exec(t))?t[0]:t}function Ca(t,e,n){return t.replace(e,n)}function CJ(t,e){return t.indexOf(e)}function tu(t,e){return t.charCodeAt(e)|0}function xE(t,e,n){return t.slice(e,n)}function j0(t){return t.length}function vae(t){return t.length}function mI(t,e){return e.push(t),t}function Mct(t,e){return t.map(e).join("")}var VB=1,eN=1,FEe=0,mf=0,zl=0,qA="";function WB(t,e,n,r,s,a,o){return{value:t,root:e,parent:n,type:r,props:s,children:a,line:VB,column:eN,length:o,return:""}}function z8(t,e){return Ict(WB("",null,null,"",null,null,0),t,{length:-t.length},e)}function Rct(){return zl}function Lct(){return zl=mf>0?tu(qA,--mf):0,eN--,zl===10&&(eN=1,VB--),zl}function Zf(){return zl=mf<FEe?tu(qA,mf++):0,eN++,zl===10&&(eN=1,VB++),zl}function q0(){return tu(qA,mf)}function EO(){return mf}function uT(t,e){return xE(qA,t,e)}function gE(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function OEe(t){return VB=eN=1,FEe=j0(qA=t),mf=0,[]}function MEe(t){return qA="",t}function _O(t){return IEe(uT(mf-1,SJ(t===91?t+2:t===40?t+1:t)))}function Dct(t){for(;(zl=q0())&&zl<33;)Zf();return gE(t)>2||gE(zl)>3?"":" "}function Bct(t,e){for(;--e&&Zf()&&!(zl<48||zl>102||zl>57&&zl<65||zl>70&&zl<97););return uT(t,EO()+(e<6&&q0()==32&&Zf()==32))}function SJ(t){for(;Zf();)switch(zl){case t:return mf;case 34:case 39:t!==34&&t!==39&&SJ(zl);break;case 40:t===41&&SJ(t);break;case 92:Zf();break}return mf}function $ct(t,e){for(;Zf()&&t+zl!==57;)if(t+zl===84&&q0()===47)break;return"/*"+uT(e,mf-1)+"*"+HB(t===47?t:Zf())}function Uct(t){for(;!gE(q0());)Zf();return uT(t,mf)}function zct(t){return MEe(kO("",null,null,null,[""],t=OEe(t),0,[0],t))}function kO(t,e,n,r,s,a,o,l,c){for(var u=0,d=0,f=o,x=0,g=0,y=0,v=1,C=1,N=1,P=0,T="",M=s,F=a,$=r,L=T;C;)switch(y=P,P=Zf()){case 40:if(y!=108&&tu(L,f-1)==58){CJ(L+=Ca(_O(P),"&","&\f"),"&\f")!=-1&&(N=-1);break}case 34:case 39:case 91:L+=_O(P);break;case 9:case 10:case 13:case 32:L+=Dct(y);break;case 92:L+=Bct(EO()-1,7);continue;case 47:switch(q0()){case 42:case 47:mI(Hct($ct(Zf(),EO()),e,n),c);break;default:L+="/"}break;case 123*v:l[u++]=j0(L)*N;case 125*v:case 59:case 0:switch(P){case 0:case 125:C=0;case 59+d:N==-1&&(L=Ca(L,/\f/g,"")),g>0&&j0(L)-f&&mI(g>32?ume(L+";",r,n,f-1):ume(Ca(L," ","")+";",r,n,f-2),c);break;case 59:L+=";";default:if(mI($=cme(L,e,n,u,d,s,l,T,M=[],F=[],f),a),P===123)if(d===0)kO(L,e,$,$,M,a,f,l,F);else switch(x===99&&tu(L,3)===110?100:x){case 100:case 108:case 109:case 115:kO(t,$,$,r&&mI(cme(t,$,$,0,0,s,l,T,s,M=[],f),F),s,F,f,l,r?M:F);break;default:kO(L,$,$,$,[""],F,0,l,F)}}u=d=g=0,v=N=1,T=L="",f=o;break;case 58:f=1+j0(L),g=y;default:if(v<1){if(P==123)--v;else if(P==125&&v++==0&&Lct()==125)continue}switch(L+=HB(P),P*v){case 38:N=d>0?1:(L+="\f",-1);break;case 44:l[u++]=(j0(L)-1)*N,N=1;break;case 64:q0()===45&&(L+=_O(Zf())),x=q0(),d=f=j0(T=L+=Uct(EO())),P++;break;case 45:y===45&&j0(L)==2&&(v=0)}}return a}function cme(t,e,n,r,s,a,o,l,c,u,d){for(var f=s-1,x=s===0?a:[""],g=vae(x),y=0,v=0,C=0;y<r;++y)for(var N=0,P=xE(t,f+1,f=Pct(v=o[y])),T=t;N<g;++N)(T=IEe(v>0?x[N]+" "+P:Ca(P,/&\f/g,x[N])))&&(c[C++]=T);return WB(t,e,n,s===0?bae:l,c,u,d)}function Hct(t,e,n){return WB(t,e,n,TEe,HB(Rct()),xE(t,2,-2),0)}function ume(t,e,n,r){return WB(t,e,n,yae,xE(t,0,r),xE(t,r+1,-1),r)}function v4(t,e){for(var n="",r=vae(t),s=0;s<r;s++)n+=e(t[s],s,t,e)||"";return n}function Vct(t,e,n,r){switch(t.type){case Tct:if(t.children.length)break;case kct:case yae:return t.return=t.return||t.value;case TEe:return"";case PEe:return t.return=t.value+"{"+v4(t.children,r)+"}";case bae:t.value=t.props.join(",")}return j0(n=v4(t.children,r))?t.return=t.value+"{"+n+"}":""}function Wct(t){var e=vae(t);return function(n,r,s,a){for(var o="",l=0;l<e;l++)o+=t[l](n,r,s,a)||"";return o}}function qct(t){return function(e){e.root||(e=e.return)&&t(e)}}function Gct(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Kct=function(e,n,r){for(var s=0,a=0;s=a,a=q0(),s===38&&a===12&&(n[r]=1),!gE(a);)Zf();return uT(e,mf)},Yct=function(e,n){var r=-1,s=44;do switch(gE(s)){case 0:s===38&&q0()===12&&(n[r]=1),e[r]+=Kct(mf-1,n,r);break;case 2:e[r]+=_O(s);break;case 4:if(s===44){e[++r]=q0()===58?"&\f":"",n[r]=e[r].length;break}default:e[r]+=HB(s)}while(s=Zf());return e},Xct=function(e,n){return MEe(Yct(OEe(e),n))},dme=new WeakMap,Qct=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,r=e.parent,s=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!dme.get(r))&&!s){dme.set(e,!0);for(var a=[],o=Xct(n,a),l=r.props,c=0,u=0;c<o.length;c++)for(var d=0;d<l.length;d++,u++)e.props[u]=a[c]?o[c].replace(/&\f/g,l[d]):l[d]+" "+o[c]}}},Zct=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function REe(t,e){switch(Fct(t,e)){case 5103:return wa+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return wa+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return wa+t+YM+t+vu+t+t;case 6828:case 4268:return wa+t+vu+t+t;case 6165:return wa+t+vu+"flex-"+t+t;case 5187:return wa+t+Ca(t,/(\w+).+(:[^]+)/,wa+"box-$1$2"+vu+"flex-$1$2")+t;case 5443:return wa+t+vu+"flex-item-"+Ca(t,/flex-|-self/,"")+t;case 4675:return wa+t+vu+"flex-line-pack"+Ca(t,/align-content|flex-|-self/,"")+t;case 5548:return wa+t+vu+Ca(t,"shrink","negative")+t;case 5292:return wa+t+vu+Ca(t,"basis","preferred-size")+t;case 6060:return wa+"box-"+Ca(t,"-grow","")+wa+t+vu+Ca(t,"grow","positive")+t;case 4554:return wa+Ca(t,/([^-])(transform)/g,"$1"+wa+"$2")+t;case 6187:return Ca(Ca(Ca(t,/(zoom-|grab)/,wa+"$1"),/(image-set)/,wa+"$1"),t,"")+t;case 5495:case 3959:return Ca(t,/(image-set\([^]*)/,wa+"$1$`$1");case 4968:return Ca(Ca(t,/(.+:)(flex-)?(.*)/,wa+"box-pack:$3"+vu+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+wa+t+t;case 4095:case 3583:case 4068:case 2532:return Ca(t,/(.+)-inline(.+)/,wa+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(j0(t)-1-e>6)switch(tu(t,e+1)){case 109:if(tu(t,e+4)!==45)break;case 102:return Ca(t,/(.+:)(.+)-([^]+)/,"$1"+wa+"$2-$3$1"+YM+(tu(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~CJ(t,"stretch")?REe(Ca(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(tu(t,e+1)!==115)break;case 6444:switch(tu(t,j0(t)-3-(~CJ(t,"!important")&&10))){case 107:return Ca(t,":",":"+wa)+t;case 101:return Ca(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+wa+(tu(t,14)===45?"inline-":"")+"box$3$1"+wa+"$2$3$1"+vu+"$2box$3")+t}break;case 5936:switch(tu(t,e+11)){case 114:return wa+t+vu+Ca(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return wa+t+vu+Ca(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return wa+t+vu+Ca(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return wa+t+vu+t+t}return t}var Jct=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case yae:e.return=REe(e.value,e.length);break;case PEe:return v4([z8(e,{value:Ca(e.value,"@","@"+wa)})],s);case bae:if(e.length)return Mct(e.props,function(a){switch(Oct(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return v4([z8(e,{props:[Ca(a,/:(read-\w+)/,":"+YM+"$1")]})],s);case"::placeholder":return v4([z8(e,{props:[Ca(a,/:(plac\w+)/,":"+wa+"input-$1")]}),z8(e,{props:[Ca(a,/:(plac\w+)/,":"+YM+"$1")]}),z8(e,{props:[Ca(a,/:(plac\w+)/,vu+"input-$1")]})],s)}return""})}},eut=[Jct],tut=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(v){var C=v.getAttribute("data-emotion");C.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var s=e.stylisPlugins||eut,a={},o,l=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(v){for(var C=v.getAttribute("data-emotion").split(" "),N=1;N<C.length;N++)a[C[N]]=!0;l.push(v)});var c,u=[Qct,Zct];{var d,f=[Vct,qct(function(v){d.insert(v)})],x=Wct(u.concat(s,f)),g=function(C){return v4(zct(C),x)};c=function(C,N,P,T){d=P,g(C?C+"{"+N.styles+"}":N.styles),T&&(y.inserted[N.name]=!0)}}var y={key:n,sheet:new _ct({key:n,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:c};return y.sheet.hydrate(l),y},WH={exports:{}},Ia={};/** @license React v16.13.1
* react-is.production.min.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.
*/var fme;function nut(){if(fme)return Ia;fme=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,f=t?Symbol.for("react.suspense"):60113,x=t?Symbol.for("react.suspense_list"):60120,g=t?Symbol.for("react.memo"):60115,y=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,C=t?Symbol.for("react.fundamental"):60117,N=t?Symbol.for("react.responder"):60118,P=t?Symbol.for("react.scope"):60119;function T(F){if(typeof F=="object"&&F!==null){var $=F.$$typeof;switch($){case e:switch(F=F.type,F){case c:case u:case r:case a:case s:case f:return F;default:switch(F=F&&F.$$typeof,F){case l:case d:case y:case g:case o:return F;default:return $}}case n:return $}}}function M(F){return T(F)===u}return Ia.AsyncMode=c,Ia.ConcurrentMode=u,Ia.ContextConsumer=l,Ia.ContextProvider=o,Ia.Element=e,Ia.ForwardRef=d,Ia.Fragment=r,Ia.Lazy=y,Ia.Memo=g,Ia.Portal=n,Ia.Profiler=a,Ia.StrictMode=s,Ia.Suspense=f,Ia.isAsyncMode=function(F){return M(F)||T(F)===c},Ia.isConcurrentMode=M,Ia.isContextConsumer=function(F){return T(F)===l},Ia.isContextProvider=function(F){return T(F)===o},Ia.isElement=function(F){return typeof F=="object"&&F!==null&&F.$$typeof===e},Ia.isForwardRef=function(F){return T(F)===d},Ia.isFragment=function(F){return T(F)===r},Ia.isLazy=function(F){return T(F)===y},Ia.isMemo=function(F){return T(F)===g},Ia.isPortal=function(F){return T(F)===n},Ia.isProfiler=function(F){return T(F)===a},Ia.isStrictMode=function(F){return T(F)===s},Ia.isSuspense=function(F){return T(F)===f},Ia.isValidElementType=function(F){return typeof F=="string"||typeof F=="function"||F===r||F===u||F===a||F===s||F===f||F===x||typeof F=="object"&&F!==null&&(F.$$typeof===y||F.$$typeof===g||F.$$typeof===o||F.$$typeof===l||F.$$typeof===d||F.$$typeof===C||F.$$typeof===N||F.$$typeof===P||F.$$typeof===v)},Ia.typeOf=T,Ia}var hme;function rut(){return hme||(hme=1,WH.exports=nut()),WH.exports}var qH,pme;function sut(){if(pme)return qH;pme=1;var t=rut(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};a[t.ForwardRef]=r,a[t.Memo]=s;function o(y){return t.isMemo(y)?s:a[y.$$typeof]||e}var l=Object.defineProperty,c=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,x=Object.prototype;function g(y,v,C){if(typeof v!="string"){if(x){var N=f(v);N&&N!==x&&g(y,N,C)}var P=c(v);u&&(P=P.concat(u(v)));for(var T=o(y),M=o(v),F=0;F<P.length;++F){var $=P[F];if(!n[$]&&!(C&&C[$])&&!(M&&M[$])&&!(T&&T[$])){var L=d(v,$);try{l(y,$,L)}catch{}}}}return y}return qH=g,qH}sut();var iut=!0;function aut(t,e,n){var r="";return n.split(" ").forEach(function(s){t[s]!==void 0?e.push(t[s]+";"):s&&(r+=s+" ")}),r}var LEe=function(e,n,r){var s=e.key+"-"+n.name;(r===!1||iut===!1)&&e.registered[s]===void 0&&(e.registered[s]=n.styles)},out=function(e,n,r){LEe(e,n,r);var s=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var a=n;do e.insert(n===a?"."+s:"",a,e.sheet,!0),a=a.next;while(a!==void 0)}};function lut(t){for(var e=0,n,r=0,s=t.length;s>=4;++r,s-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(s){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var cut={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},uut=/[A-Z]|^ms/g,dut=/_EMO_([^_]+?)_([^]*?)_EMO_/g,DEe=function(e){return e.charCodeAt(1)===45},mme=function(e){return e!=null&&typeof e!="boolean"},GH=Gct(function(t){return DEe(t)?t:t.replace(uut,"-$&").toLowerCase()}),xme=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(dut,function(r,s,a){return E0={name:s,styles:a,next:E0},s})}return cut[e]!==1&&!DEe(e)&&typeof n=="number"&&n!==0?n+"px":n};function bE(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return E0={name:s.name,styles:s.styles,next:E0},s.name;var a=n;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)E0={name:o.name,styles:o.styles,next:E0},o=o.next;var l=a.styles+";";return l}return fut(t,e,n)}case"function":{if(t!==void 0){var c=E0,u=n(t);return E0=c,bE(t,e,u)}break}}var d=n;return d}function fut(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=bE(t,e,n[s])+";";else for(var a in n){var o=n[a];if(typeof o!="object"){var l=o;mme(l)&&(r+=GH(a)+":"+xme(a,l)+";")}else if(Array.isArray(o)&&typeof o[0]=="string"&&e==null)for(var c=0;c<o.length;c++)mme(o[c])&&(r+=GH(a)+":"+xme(a,o[c])+";");else{var u=bE(t,e,o);switch(a){case"animation":case"animationName":{r+=GH(a)+":"+u+";";break}default:r+=a+"{"+u+"}"}}}return r}var gme=/label:\s*([^\s;{]+)\s*(;|$)/g,E0;function BEe(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var r=!0,s="";E0=void 0;var a=t[0];if(a==null||a.raw===void 0)r=!1,s+=bE(n,e,a);else{var o=a;s+=o[0]}for(var l=1;l<t.length;l++)if(s+=bE(n,e,t[l]),r){var c=a;s+=c[l]}gme.lastIndex=0;for(var u="",d;(d=gme.exec(s))!==null;)u+="-"+d[1];var f=lut(s)+u;return{name:f,styles:s,next:E0}}var hut=function(e){return e()},put=Wy.useInsertionEffect?Wy.useInsertionEffect:!1,mut=put||hut,$Ee=m.createContext(typeof HTMLElement<"u"?tut({key:"css"}):null);$Ee.Provider;var xut=function(e){return m.forwardRef(function(n,r){var s=m.useContext($Ee);return e(n,s,r)})},gut=m.createContext({}),wae={}.hasOwnProperty,NJ="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",but=function(e,n){var r={};for(var s in n)wae.call(n,s)&&(r[s]=n[s]);return r[NJ]=e,r},yut=function(e){var n=e.cache,r=e.serialized,s=e.isStringTag;return LEe(n,r,s),mut(function(){return out(n,r,s)}),null},vut=xut(function(t,e,n){var r=t.css;typeof r=="string"&&e.registered[r]!==void 0&&(r=e.registered[r]);var s=t[NJ],a=[r],o="";typeof t.className=="string"?o=aut(e.registered,a,t.className):t.className!=null&&(o=t.className+" ");var l=BEe(a,void 0,m.useContext(gut));o+=e.key+"-"+l.name;var c={};for(var u in t)wae.call(t,u)&&u!=="css"&&u!==NJ&&(c[u]=t[u]);return c.className=o,n&&(c.ref=n),m.createElement(m.Fragment,null,m.createElement(yut,{cache:e,serialized:l,isStringTag:typeof s=="string"}),m.createElement(s,c))}),wut=vut,qs=function(e,n){var r=arguments;if(n==null||!wae.call(n,"css"))return m.createElement.apply(void 0,r);var s=r.length,a=new Array(s);a[0]=wut,a[1]=but(e,n);for(var o=2;o<s;o++)a[o]=r[o];return m.createElement.apply(null,a)};(function(t){var e;e||(e=t.JSX||(t.JSX={}))})(qs);function Cae(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return BEe(e)}function Cut(){var t=Cae.apply(void 0,arguments),e="animation-"+t.name;return{name:e,styles:"@keyframes "+e+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function Sut(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}const Nut=Math.min,Aut=Math.max,XM=Math.round,xI=Math.floor,QM=t=>({x:t,y:t});function qB(){return typeof window<"u"}function UEe(t){return HEe(t)?(t.nodeName||"").toLowerCase():"#document"}function p1(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zEe(t){var e;return(e=(HEe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function HEe(t){return qB()?t instanceof Node||t instanceof p1(t).Node:!1}function jut(t){return qB()?t instanceof Element||t instanceof p1(t).Element:!1}function Sae(t){return qB()?t instanceof HTMLElement||t instanceof p1(t).HTMLElement:!1}function bme(t){return!qB()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof p1(t).ShadowRoot}function VEe(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Nae(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(s)}function Eut(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function _ut(t){return["html","body","#document"].includes(UEe(t))}function Nae(t){return p1(t).getComputedStyle(t)}function kut(t){if(UEe(t)==="html")return t;const e=t.assignedSlot||t.parentNode||bme(t)&&t.host||zEe(t);return bme(e)?e.host:e}function WEe(t){const e=kut(t);return _ut(e)?t.ownerDocument?t.ownerDocument.body:t.body:Sae(e)&&VEe(e)?e:WEe(e)}function ZM(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=WEe(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=p1(s);if(a){const l=AJ(o);return e.concat(o,o.visualViewport||[],VEe(s)?s:[],l&&n?ZM(l):[])}return e.concat(s,ZM(s,[],n))}function AJ(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Tut(t){const e=Nae(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Sae(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=XM(n)!==a||XM(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function Aae(t){return jut(t)?t:t.contextElement}function yme(t){const e=Aae(t);if(!Sae(e))return QM(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=Tut(e);let o=(a?XM(n.width):n.width)/r,l=(a?XM(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Put=QM(0);function Iut(t){const e=p1(t);return!Eut()||!e.visualViewport?Put:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Fut(t,e,n){return!1}function vme(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),a=Aae(t);let o=QM(1);e&&(o=yme(t));const l=Fut()?Iut(a):QM(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(a){const x=p1(a),g=r;let y=x,v=AJ(y);for(;v&&r&&g!==y;){const C=yme(v),N=v.getBoundingClientRect(),P=Nae(v),T=N.left+(v.clientLeft+parseFloat(P.paddingLeft))*C.x,M=N.top+(v.clientTop+parseFloat(P.paddingTop))*C.y;c*=C.x,u*=C.y,d*=C.x,f*=C.y,c+=T,u+=M,y=p1(v),v=AJ(y)}}return oE({width:d,height:f,x:c,y:u})}function qEe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Out(t,e){let n=null,r;const s=zEe(t);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const u=t.getBoundingClientRect(),{left:d,top:f,width:x,height:g}=u;if(l||e(),!x||!g)return;const y=xI(f),v=xI(s.clientWidth-(d+x)),C=xI(s.clientHeight-(f+g)),N=xI(d),T={rootMargin:-y+"px "+-v+"px "+-C+"px "+-N+"px",threshold:Aut(0,Nut(1,c))||1};let M=!0;function F($){const L=$[0].intersectionRatio;if(L!==c){if(!M)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!qEe(u,t.getBoundingClientRect())&&o(),M=!1}try{n=new IntersectionObserver(F,{...T,root:s.ownerDocument})}catch{n=new IntersectionObserver(F,T)}n.observe(t)}return o(!0),a}function Mut(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Aae(t),d=s||a?[...u?ZM(u):[],...ZM(e)]:[];d.forEach(N=>{s&&N.addEventListener("scroll",n,{passive:!0}),a&&N.addEventListener("resize",n)});const f=u&&l?Out(u,n):null;let x=-1,g=null;o&&(g=new ResizeObserver(N=>{let[P]=N;P&&P.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var T;(T=g)==null||T.observe(e)})),n()}),u&&!c&&g.observe(u),g.observe(e));let y,v=c?vme(t):null;c&&C();function C(){const N=vme(t);v&&!qEe(v,N)&&n(),v=N,y=requestAnimationFrame(C)}return n(),()=>{var N;d.forEach(P=>{s&&P.removeEventListener("scroll",n),a&&P.removeEventListener("resize",n)}),f==null||f(),(N=g)==null||N.disconnect(),g=null,c&&cancelAnimationFrame(y)}}var jJ=m.useLayoutEffect,Rut=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],JM=function(){};function Lut(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function Dut(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var a=[].concat(r);if(e&&t)for(var o in e)e.hasOwnProperty(o)&&e[o]&&a.push("".concat(Lut(t,o)));return a.filter(function(l){return l}).map(function(l){return String(l).trim()}).join(" ")}var wme=function(e){return Gut(e)?e.filter(Boolean):F3(e)==="object"&&e!==null?[e]:[]},GEe=function(e){e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme;var n=F1(e,Rut);return Xs({},n)},fl=function(e,n,r){var s=e.cx,a=e.getStyles,o=e.getClassNames,l=e.className;return{css:a(n,e),className:s(r??{},o(n,e),l)}};function GB(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function But(t){return GB(t)?window.innerHeight:t.clientHeight}function KEe(t){return GB(t)?window.pageYOffset:t.scrollTop}function eR(t,e){if(GB(t)){window.scrollTo(0,e);return}t.scrollTop=e}function $ut(t){var e=getComputedStyle(t),n=e.position==="absolute",r=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var s=t;s=s.parentElement;)if(e=getComputedStyle(s),!(n&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return s;return document.documentElement}function Uut(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function gI(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:JM,s=KEe(t),a=e-s,o=10,l=0;function c(){l+=o;var u=Uut(l,s,a,n);eR(t,u),l<n?window.requestAnimationFrame(c):r(t)}c()}function Cme(t,e){var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=e.offsetHeight/3;r.bottom+s>n.bottom?eR(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s<n.top&&eR(t,Math.max(e.offsetTop-s,0))}function zut(t){var e=t.getBoundingClientRect();return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width}}function Sme(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function Hut(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var YEe=!1,Vut={get passive(){return YEe=!0}},bI=typeof window<"u"?window:{};bI.addEventListener&&bI.removeEventListener&&(bI.addEventListener("p",JM,Vut),bI.removeEventListener("p",JM,!1));var Wut=YEe;function qut(t){return t!=null}function Gut(t){return Array.isArray(t)}function yI(t,e,n){return t?e:n}var Kut=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var a=Object.entries(e).filter(function(o){var l=e1(o,1),c=l[0];return!r.includes(c)});return a.reduce(function(o,l){var c=e1(l,2),u=c[0],d=c[1];return o[u]=d,o},{})},Yut=["children","innerProps"],Xut=["children","innerProps"];function Qut(t){var e=t.maxHeight,n=t.menuEl,r=t.minHeight,s=t.placement,a=t.shouldScroll,o=t.isFixedPosition,l=t.controlHeight,c=$ut(n),u={placement:"bottom",maxHeight:e};if(!n||!n.offsetParent)return u;var d=c.getBoundingClientRect(),f=d.height,x=n.getBoundingClientRect(),g=x.bottom,y=x.height,v=x.top,C=n.offsetParent.getBoundingClientRect(),N=C.top,P=o?window.innerHeight:But(c),T=KEe(c),M=parseInt(getComputedStyle(n).marginBottom,10),F=parseInt(getComputedStyle(n).marginTop,10),$=N-F,L=P-v,z=$+T,X=f-T-v,ne=g-P+T+M,J=T+v-F,K=160;switch(s){case"auto":case"bottom":if(L>=y)return{placement:"bottom",maxHeight:e};if(X>=y&&!o)return a&&gI(c,ne,K),{placement:"bottom",maxHeight:e};if(!o&&X>=r||o&&L>=r){a&&gI(c,ne,K);var te=o?L-M:X-M;return{placement:"bottom",maxHeight:te}}if(s==="auto"||o){var fe=e,q=o?$:z;return q>=r&&(fe=Math.min(q-M-l,e)),{placement:"top",maxHeight:fe}}if(s==="bottom")return a&&eR(c,ne),{placement:"bottom",maxHeight:e};break;case"top":if($>=y)return{placement:"top",maxHeight:e};if(z>=y&&!o)return a&&gI(c,J,K),{placement:"top",maxHeight:e};if(!o&&z>=r||o&&$>=r){var se=e;return(!o&&z>=r||o&&$>=r)&&(se=o?$-F:z-F),a&&gI(c,J,K),{placement:"top",maxHeight:se}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return u}function Zut(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var XEe=function(e){return e==="auto"?"bottom":e},Jut=function(e,n){var r,s=e.placement,a=e.theme,o=a.borderRadius,l=a.spacing,c=a.colors;return Xs((r={label:"menu"},$7(r,Zut(s),"100%"),$7(r,"position","absolute"),$7(r,"width","100%"),$7(r,"zIndex",1),r),n?{}:{backgroundColor:c.neutral0,borderRadius:o,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:l.menuGutter,marginTop:l.menuGutter})},QEe=m.createContext(null),edt=function(e){var n=e.children,r=e.minMenuHeight,s=e.maxMenuHeight,a=e.menuPlacement,o=e.menuPosition,l=e.menuShouldScrollIntoView,c=e.theme,u=m.useContext(QEe)||{},d=u.setPortalPlacement,f=m.useRef(null),x=m.useState(s),g=e1(x,2),y=g[0],v=g[1],C=m.useState(null),N=e1(C,2),P=N[0],T=N[1],M=c.spacing.controlHeight;return jJ(function(){var F=f.current;if(F){var $=o==="fixed",L=l&&!$,z=Qut({maxHeight:s,menuEl:F,minHeight:r,placement:a,shouldScroll:L,isFixedPosition:$,controlHeight:M});v(z.maxHeight),T(z.placement),d==null||d(z.placement)}},[s,a,o,l,r,d,M]),n({ref:f,placerProps:Xs(Xs({},e),{},{placement:P||XEe(a),maxHeight:y})})},tdt=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return qs("div",ri({},fl(e,"menu",{menu:!0}),{ref:r},s),n)},ndt=tdt,rdt=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return Xs({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},sdt=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,a=e.isMulti;return qs("div",ri({},fl(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:s},r),n)},ZEe=function(e,n){var r=e.theme,s=r.spacing.baseUnit,a=r.colors;return Xs({textAlign:"center"},n?{}:{color:a.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},idt=ZEe,adt=ZEe,odt=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,a=F1(e,Yut);return qs("div",ri({},fl(Xs(Xs({},a),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},ldt=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,a=F1(e,Xut);return qs("div",ri({},fl(Xs(Xs({},a),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},cdt=function(e){var n=e.rect,r=e.offset,s=e.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},udt=function(e){var n=e.appendTo,r=e.children,s=e.controlElement,a=e.innerProps,o=e.menuPlacement,l=e.menuPosition,c=m.useRef(null),u=m.useRef(null),d=m.useState(XEe(o)),f=e1(d,2),x=f[0],g=f[1],y=m.useMemo(function(){return{setPortalPlacement:g}},[]),v=m.useState(null),C=e1(v,2),N=C[0],P=C[1],T=m.useCallback(function(){if(s){var L=zut(s),z=l==="fixed"?0:window.pageYOffset,X=L[x]+z;(X!==(N==null?void 0:N.offset)||L.left!==(N==null?void 0:N.rect.left)||L.width!==(N==null?void 0:N.rect.width))&&P({offset:X,rect:L})}},[s,l,x,N==null?void 0:N.offset,N==null?void 0:N.rect.left,N==null?void 0:N.rect.width]);jJ(function(){T()},[T]);var M=m.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),s&&c.current&&(u.current=Mut(s,c.current,T,{elementResize:"ResizeObserver"in window}))},[s,T]);jJ(function(){M()},[M]);var F=m.useCallback(function(L){c.current=L,M()},[M]);if(!n&&l!=="fixed"||!N)return null;var $=qs("div",ri({ref:F},fl(Xs(Xs({},e),{},{offset:N.offset,position:l,rect:N.rect}),"menuPortal",{"menu-portal":!0}),a),r);return qs(QEe.Provider,{value:y},n?Aa.createPortal($,n):$)},ddt=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},fdt=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,a=e.isRtl;return qs("div",ri({},fl(e,"container",{"--is-disabled":s,"--is-rtl":a}),r),n)},hdt=function(e,n){var r=e.theme.spacing,s=e.isMulti,a=e.hasValue,o=e.selectProps.controlShouldRenderValue;return Xs({alignItems:"center",display:s&&a&&o?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},pdt=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,a=e.hasValue;return qs("div",ri({},fl(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":a}),r),n)},mdt=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},xdt=function(e){var n=e.children,r=e.innerProps;return qs("div",ri({},fl(e,"indicatorsContainer",{indicators:!0}),r),n)},Nme,gdt=["size"],bdt=["innerProps","isRtl","size"],ydt={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},JEe=function(e){var n=e.size,r=F1(e,gdt);return qs("svg",ri({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:ydt},r))},jae=function(e){return qs(JEe,ri({size:20},e),qs("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},e_e=function(e){return qs(JEe,ri({size:20},e),qs("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},t_e=function(e,n){var r=e.isFocused,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return Xs({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?o.neutral60:o.neutral20,padding:a*2,":hover":{color:r?o.neutral80:o.neutral40}})},vdt=t_e,wdt=function(e){var n=e.children,r=e.innerProps;return qs("div",ri({},fl(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||qs(e_e,null))},Cdt=t_e,Sdt=function(e){var n=e.children,r=e.innerProps;return qs("div",ri({},fl(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||qs(jae,null))},Ndt=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing.baseUnit,o=s.colors;return Xs({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?o.neutral10:o.neutral20,marginBottom:a*2,marginTop:a*2})},Adt=function(e){var n=e.innerProps;return qs("span",ri({},n,fl(e,"indicatorSeparator",{"indicator-separator":!0})))},jdt=Cut(Nme||(Nme=Sut([`
0%, 80%, 100% { opacity: 0; }
40% { opacity: 1; }
`]))),Edt=function(e,n){var r=e.isFocused,s=e.size,a=e.theme,o=a.colors,l=a.spacing.baseUnit;return Xs({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?o.neutral60:o.neutral20,padding:l*2})},KH=function(e){var n=e.delay,r=e.offset;return qs("span",{css:Cae({animation:"".concat(jdt," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},_dt=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,a=s===void 0?4:s,o=F1(e,bdt);return qs("div",ri({},fl(Xs(Xs({},o),{},{innerProps:n,isRtl:r,size:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),qs(KH,{delay:0,offset:r}),qs(KH,{delay:160,offset:!0}),qs(KH,{delay:320,offset:!r}))},kdt=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.theme,o=a.colors,l=a.borderRadius,c=a.spacing;return Xs({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:c.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?o.neutral5:o.neutral0,borderColor:r?o.neutral10:s?o.primary:o.neutral20,borderRadius:l,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(o.primary):void 0,"&:hover":{borderColor:s?o.primary:o.neutral30}})},Tdt=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.innerRef,o=e.innerProps,l=e.menuIsOpen;return qs("div",ri({ref:a},fl(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":l}),o,{"aria-disabled":r||void 0}),n)},Pdt=Tdt,Idt=["data"],Fdt=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},Odt=function(e){var n=e.children,r=e.cx,s=e.getStyles,a=e.getClassNames,o=e.Heading,l=e.headingProps,c=e.innerProps,u=e.label,d=e.theme,f=e.selectProps;return qs("div",ri({},fl(e,"group",{group:!0}),c),qs(o,ri({},l,{selectProps:f,theme:d,getStyles:s,getClassNames:a,cx:r}),u),qs("div",null,n))},Mdt=function(e,n){var r=e.theme,s=r.colors,a=r.spacing;return Xs({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:a.baseUnit*3,paddingRight:a.baseUnit*3,textTransform:"uppercase"})},Rdt=function(e){var n=GEe(e);n.data;var r=F1(n,Idt);return qs("div",ri({},fl(e,"groupHeading",{"group-heading":!0}),r))},Ldt=Odt,Ddt=["innerRef","isDisabled","isHidden","inputClassName"],Bdt=function(e,n){var r=e.isDisabled,s=e.value,a=e.theme,o=a.spacing,l=a.colors;return Xs(Xs({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},$dt),n?{}:{margin:o.baseUnit/2,paddingBottom:o.baseUnit/2,paddingTop:o.baseUnit/2,color:l.neutral80})},n_e={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},$dt={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Xs({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},n_e)},Udt=function(e){return Xs({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},n_e)},zdt=function(e){var n=e.cx,r=e.value,s=GEe(e),a=s.innerRef,o=s.isDisabled,l=s.isHidden,c=s.inputClassName,u=F1(s,Ddt);return qs("div",ri({},fl(e,"input",{"input-container":!0}),{"data-value":r||""}),qs("input",ri({className:n({input:!0},c),ref:a,style:Udt(l),disabled:o},u)))},Hdt=zdt,Vdt=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors;return Xs({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:o.neutral10,borderRadius:a/2,margin:s.baseUnit/2})},Wdt=function(e,n){var r=e.theme,s=r.borderRadius,a=r.colors,o=e.cropWithEllipsis;return Xs({overflow:"hidden",textOverflow:o||o===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:a.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},qdt=function(e,n){var r=e.theme,s=r.spacing,a=r.borderRadius,o=r.colors,l=e.isFocused;return Xs({alignItems:"center",display:"flex"},n?{}:{borderRadius:a/2,backgroundColor:l?o.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}})},r_e=function(e){var n=e.children,r=e.innerProps;return qs("div",r,n)},Gdt=r_e,Kdt=r_e;function Ydt(t){var e=t.children,n=t.innerProps;return qs("div",ri({role:"button"},n),e||qs(jae,{size:14}))}var Xdt=function(e){var n=e.children,r=e.components,s=e.data,a=e.innerProps,o=e.isDisabled,l=e.removeProps,c=e.selectProps,u=r.Container,d=r.Label,f=r.Remove;return qs(u,{data:s,innerProps:Xs(Xs({},fl(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":o})),a),selectProps:c},qs(d,{data:s,innerProps:Xs({},fl(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),qs(f,{data:s,innerProps:Xs(Xs({},fl(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},Qdt=Xdt,Zdt=function(e,n){var r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.theme,l=o.spacing,c=o.colors;return Xs({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:a?c.primary:s?c.primary25:"transparent",color:r?c.neutral20:a?c.neutral0:"inherit",padding:"".concat(l.baseUnit*2,"px ").concat(l.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:a?c.primary:c.primary50}})},Jdt=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,a=e.isSelected,o=e.innerRef,l=e.innerProps;return qs("div",ri({},fl(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":a}),{ref:o,"aria-disabled":r},l),n)},eft=Jdt,tft=function(e,n){var r=e.theme,s=r.spacing,a=r.colors;return Xs({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:a.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},nft=function(e){var n=e.children,r=e.innerProps;return qs("div",ri({},fl(e,"placeholder",{placeholder:!0}),r),n)},rft=nft,sft=function(e,n){var r=e.isDisabled,s=e.theme,a=s.spacing,o=s.colors;return Xs({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?o.neutral40:o.neutral80,marginLeft:a.baseUnit/2,marginRight:a.baseUnit/2})},ift=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return qs("div",ri({},fl(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},aft=ift,Sa={ClearIndicator:Sdt,Control:Pdt,DropdownIndicator:wdt,DownChevron:e_e,CrossIcon:jae,Group:Ldt,GroupHeading:Rdt,IndicatorsContainer:xdt,IndicatorSeparator:Adt,Input:Hdt,LoadingIndicator:_dt,Menu:ndt,MenuList:sdt,MenuPortal:udt,LoadingMessage:ldt,NoOptionsMessage:odt,MultiValue:Qdt,MultiValueContainer:Gdt,MultiValueLabel:Kdt,MultiValueRemove:Ydt,Option:eft,Placeholder:rft,SelectContainer:fdt,SingleValue:aft,ValueContainer:pdt},oft=function(e){return Xs(Xs({},Sa),e.components)},Ame=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function lft(t,e){return!!(t===e||Ame(t)&&Ame(e))}function cft(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!lft(t[n],e[n]))return!1;return!0}function uft(t,e){e===void 0&&(e=cft);var n=null;function r(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];if(n&&n.lastThis===this&&e(s,n.lastArgs))return n.lastResult;var o=t.apply(this,s);return n={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){n=null},r}var dft={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},fft=function(e){return qs("span",ri({css:dft},e))},jme=fft,hft={guidance:function(e){var n=e.isSearchable,r=e.isMulti,s=e.tabSelectsValue,a=e.context,o=e.isInitialFocus;switch(a){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(s?", press Tab to select the option and exit the menu":"",".");case"input":return o?"".concat(e["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var n=e.action,r=e.label,s=r===void 0?"":r,a=e.labels,o=e.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(s,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(a.length>1?"s":""," ").concat(a.join(","),", selected.");case"select-option":return o?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,s=e.options,a=e.label,o=a===void 0?"":a,l=e.selectValue,c=e.isDisabled,u=e.isSelected,d=e.isAppleDevice,f=function(v,C){return v&&v.length?"".concat(v.indexOf(C)+1," of ").concat(v.length):""};if(n==="value"&&l)return"value ".concat(o," focused, ").concat(f(l,r),".");if(n==="menu"&&d){var x=c?" disabled":"",g="".concat(u?" selected":"").concat(x);return"".concat(o).concat(g,", ").concat(f(s,r),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},pft=function(e){var n=e.ariaSelection,r=e.focusedOption,s=e.focusedValue,a=e.focusableOptions,o=e.isFocused,l=e.selectValue,c=e.selectProps,u=e.id,d=e.isAppleDevice,f=c.ariaLiveMessages,x=c.getOptionLabel,g=c.inputValue,y=c.isMulti,v=c.isOptionDisabled,C=c.isSearchable,N=c.menuIsOpen,P=c.options,T=c.screenReaderStatus,M=c.tabSelectsValue,F=c.isLoading,$=c["aria-label"],L=c["aria-live"],z=m.useMemo(function(){return Xs(Xs({},hft),f||{})},[f]),X=m.useMemo(function(){var q="";if(n&&z.onChange){var se=n.option,ae=n.options,W=n.removedValue,V=n.removedValues,ee=n.value,oe=function(je){return Array.isArray(je)?null:je},de=W||se||oe(ee),Ce=de?x(de):"",me=ae||V||void 0,we=me?me.map(x):[],xe=Xs({isDisabled:de&&v(de,l),label:Ce,labels:we},n);q=z.onChange(xe)}return q},[n,z,v,l,x]),ne=m.useMemo(function(){var q="",se=r||s,ae=!!(r&&l&&l.includes(r));if(se&&z.onFocus){var W={focused:se,label:x(se),isDisabled:v(se,l),isSelected:ae,options:a,context:se===r?"menu":"value",selectValue:l,isAppleDevice:d};q=z.onFocus(W)}return q},[r,s,x,v,z,a,l,d]),J=m.useMemo(function(){var q="";if(N&&P.length&&!F&&z.onFilter){var se=T({count:a.length});q=z.onFilter({inputValue:g,resultsMessage:se})}return q},[a,g,N,z,P,T,F]),K=(n==null?void 0:n.action)==="initial-input-focus",te=m.useMemo(function(){var q="";if(z.guidance){var se=s?"value":N?"menu":"input";q=z.guidance({"aria-label":$,context:se,isDisabled:r&&v(r,l),isMulti:y,isSearchable:C,tabSelectsValue:M,isInitialFocus:K})}return q},[$,r,s,y,v,C,N,z,l,M,K]),fe=qs(m.Fragment,null,qs("span",{id:"aria-selection"},X),qs("span",{id:"aria-focused"},ne),qs("span",{id:"aria-results"},J),qs("span",{id:"aria-guidance"},te));return qs(m.Fragment,null,qs(jme,{id:u},K&&fe),qs(jme,{"aria-live":L,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},o&&!K&&fe))},mft=pft,EJ=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],xft=new RegExp("["+EJ.map(function(t){return t.letters}).join("")+"]","g"),s_e={};for(var YH=0;YH<EJ.length;YH++)for(var XH=EJ[YH],QH=0;QH<XH.letters.length;QH++)s_e[XH.letters[QH]]=XH.base;var i_e=function(e){return e.replace(xft,function(n){return s_e[n]})},gft=uft(i_e),Eme=function(e){return e.replace(/^\s+|\s+$/g,"")},bft=function(e){return"".concat(e.label," ").concat(e.value)},yft=function(e){return function(n,r){if(n.data.__isNew__)return!0;var s=Xs({ignoreCase:!0,ignoreAccents:!0,stringify:bft,trim:!0,matchFrom:"any"},e),a=s.ignoreCase,o=s.ignoreAccents,l=s.stringify,c=s.trim,u=s.matchFrom,d=c?Eme(r):r,f=c?Eme(l(n)):l(n);return a&&(d=d.toLowerCase(),f=f.toLowerCase()),o&&(d=gft(d),f=i_e(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},vft=["innerRef"];function wft(t){var e=t.innerRef,n=F1(t,vft),r=Kut(n,"onExited","in","enter","exit","appear");return qs("input",ri({ref:e},r,{css:Cae({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var Cft=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function Sft(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,s=t.onTopArrive,a=t.onTopLeave,o=m.useRef(!1),l=m.useRef(!1),c=m.useRef(0),u=m.useRef(null),d=m.useCallback(function(C,N){if(u.current!==null){var P=u.current,T=P.scrollTop,M=P.scrollHeight,F=P.clientHeight,$=u.current,L=N>0,z=M-F-T,X=!1;z>N&&o.current&&(r&&r(C),o.current=!1),L&&l.current&&(a&&a(C),l.current=!1),L&&N>z?(n&&!o.current&&n(C),$.scrollTop=M,X=!0,o.current=!0):!L&&-N>T&&(s&&!l.current&&s(C),$.scrollTop=0,X=!0,l.current=!0),X&&Cft(C)}},[n,r,s,a]),f=m.useCallback(function(C){d(C,C.deltaY)},[d]),x=m.useCallback(function(C){c.current=C.changedTouches[0].clientY},[]),g=m.useCallback(function(C){var N=c.current-C.changedTouches[0].clientY;d(C,N)},[d]),y=m.useCallback(function(C){if(C){var N=Wut?{passive:!1}:!1;C.addEventListener("wheel",f,N),C.addEventListener("touchstart",x,N),C.addEventListener("touchmove",g,N)}},[g,x,f]),v=m.useCallback(function(C){C&&(C.removeEventListener("wheel",f,!1),C.removeEventListener("touchstart",x,!1),C.removeEventListener("touchmove",g,!1))},[g,x,f]);return m.useEffect(function(){if(e){var C=u.current;return y(C),function(){v(C)}}},[e,y,v]),function(C){u.current=C}}var _me=["boxSizing","height","overflow","paddingRight","position"],kme={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Tme(t){t.cancelable&&t.preventDefault()}function Pme(t){t.stopPropagation()}function Ime(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Fme(){return"ontouchstart"in window||navigator.maxTouchPoints}var Ome=!!(typeof window<"u"&&window.document&&window.document.createElement),H8=0,nC={capture:!1,passive:!1};function Nft(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,s=m.useRef({}),a=m.useRef(null),o=m.useCallback(function(c){if(Ome){var u=document.body,d=u&&u.style;if(r&&_me.forEach(function(y){var v=d&&d[y];s.current[y]=v}),r&&H8<1){var f=parseInt(s.current.paddingRight,10)||0,x=document.body?document.body.clientWidth:0,g=window.innerWidth-x+f||0;Object.keys(kme).forEach(function(y){var v=kme[y];d&&(d[y]=v)}),d&&(d.paddingRight="".concat(g,"px"))}u&&Fme()&&(u.addEventListener("touchmove",Tme,nC),c&&(c.addEventListener("touchstart",Ime,nC),c.addEventListener("touchmove",Pme,nC))),H8+=1}},[r]),l=m.useCallback(function(c){if(Ome){var u=document.body,d=u&&u.style;H8=Math.max(H8-1,0),r&&H8<1&&_me.forEach(function(f){var x=s.current[f];d&&(d[f]=x)}),u&&Fme()&&(u.removeEventListener("touchmove",Tme,nC),c&&(c.removeEventListener("touchstart",Ime,nC),c.removeEventListener("touchmove",Pme,nC)))}},[r]);return m.useEffect(function(){if(e){var c=a.current;return o(c),function(){l(c)}}},[e,o,l]),function(c){a.current=c}}var Aft=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},jft={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Eft(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,s=r===void 0?!0:r,a=t.onBottomArrive,o=t.onBottomLeave,l=t.onTopArrive,c=t.onTopLeave,u=Sft({isEnabled:s,onBottomArrive:a,onBottomLeave:o,onTopArrive:l,onTopLeave:c}),d=Nft({isEnabled:n}),f=function(g){u(g),d(g)};return qs(m.Fragment,null,n&&qs("div",{onClick:Aft,css:jft}),e(f))}var _ft={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},kft=function(e){var n=e.name,r=e.onFocus;return qs("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:_ft,value:"",onChange:function(){}})},Tft=kft;function Eae(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function Pft(){return Eae(/^iPhone/i)}function a_e(){return Eae(/^Mac/i)}function Ift(){return Eae(/^iPad/i)||a_e()&&navigator.maxTouchPoints>1}function Fft(){return Pft()||Ift()}function Oft(){return a_e()||Fft()}var Mft=function(e){return e.label},Rft=function(e){return e.label},Lft=function(e){return e.value},Dft=function(e){return!!e.isDisabled},Bft={clearIndicator:Cdt,container:ddt,control:kdt,dropdownIndicator:vdt,group:Fdt,groupHeading:Mdt,indicatorsContainer:mdt,indicatorSeparator:Ndt,input:Bdt,loadingIndicator:Edt,loadingMessage:adt,menu:Jut,menuList:rdt,menuPortal:cdt,multiValue:Vdt,multiValueLabel:Wdt,multiValueRemove:qdt,noOptionsMessage:idt,option:Zdt,placeholder:tft,singleValue:sft,valueContainer:hdt},$ft={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Uft=4,o_e=4,zft=38,Hft=o_e*2,Vft={baseUnit:o_e,controlHeight:zft,menuGutter:Hft},ZH={borderRadius:Uft,colors:$ft,spacing:Vft},Wft={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Sme(),captureMenuScroll:!Sme(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:yft(),formatGroupLabel:Mft,getOptionLabel:Rft,getOptionValue:Lft,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Dft,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Hut(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Mme(t,e,n,r){var s=u_e(t,e,n),a=d_e(t,e,n),o=c_e(t,e),l=tR(t,e);return{type:"option",data:e,isDisabled:s,isSelected:a,label:o,value:l,index:r}}function TO(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(o,l){return Mme(t,o,e,l)}).filter(function(o){return Lme(t,o)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var a=Mme(t,n,e,r);return Lme(t,a)?a:void 0}).filter(qut)}function l_e(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,gae(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function Rme(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,gae(r.options.map(function(s){return{data:s.data,id:"".concat(e,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(e,"-").concat(r.index)}),n},[])}function qft(t,e){return l_e(TO(t,e))}function Lme(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,a=e.isSelected,o=e.label,l=e.value;return(!h_e(t)||!a)&&f_e(t,{label:o,value:l,data:s},r)}function Gft(t,e){var n=t.focusedValue,r=t.selectValue,s=r.indexOf(n);if(s>-1){var a=e.indexOf(n);if(a>-1)return n;if(s<e.length)return e[s]}return null}function Kft(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var JH=function(e,n){var r,s=(r=e.find(function(a){return a.data===n}))===null||r===void 0?void 0:r.id;return s||null},c_e=function(e,n){return e.getOptionLabel(n)},tR=function(e,n){return e.getOptionValue(n)};function u_e(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function d_e(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=tR(t,e);return n.some(function(s){return tR(t,s)===r})}function f_e(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var h_e=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},Yft=1,p_e=function(t){yct(n,t);var e=Cct(n);function n(r){var s;if(gct(this,n),s=e.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.isAppleDevice=Oft(),s.controlRef=null,s.getControlRef=function(c){s.controlRef=c},s.focusedOptionRef=null,s.getFocusedOptionRef=function(c){s.focusedOptionRef=c},s.menuListRef=null,s.getMenuListRef=function(c){s.menuListRef=c},s.inputRef=null,s.getInputRef=function(c){s.inputRef=c},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(c,u){var d=s.props,f=d.onChange,x=d.name;u.name=x,s.ariaOnChange(c,u),f(c,u)},s.setValue=function(c,u,d){var f=s.props,x=f.closeMenuOnSelect,g=f.isMulti,y=f.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:y}),x&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(c,{action:u,option:d})},s.selectOption=function(c){var u=s.props,d=u.blurInputOnSelect,f=u.isMulti,x=u.name,g=s.state.selectValue,y=f&&s.isOptionSelected(c,g),v=s.isOptionDisabled(c,g);if(y){var C=s.getOptionValue(c);s.setValue(g.filter(function(N){return s.getOptionValue(N)!==C}),"deselect-option",c)}else if(!v)f?s.setValue([].concat(gae(g),[c]),"select-option",c):s.setValue(c,"select-option");else{s.ariaOnChange(c,{action:"select-option",option:c,name:x});return}d&&s.blurInput()},s.removeValue=function(c){var u=s.props.isMulti,d=s.state.selectValue,f=s.getOptionValue(c),x=d.filter(function(y){return s.getOptionValue(y)!==f}),g=yI(u,x,x[0]||null);s.onChange(g,{action:"remove-value",removedValue:c}),s.focusInput()},s.clearValue=function(){var c=s.state.selectValue;s.onChange(yI(s.props.isMulti,[],null),{action:"clear",removedValues:c})},s.popValue=function(){var c=s.props.isMulti,u=s.state.selectValue,d=u[u.length-1],f=u.slice(0,u.length-1),x=yI(c,f,f[0]||null);d&&s.onChange(x,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(c){return JH(s.state.focusableOptionsWithIds,c)},s.getFocusableOptionsWithIds=function(){return Rme(TO(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return Dut.apply(void 0,[s.props.classNamePrefix].concat(u))},s.getOptionLabel=function(c){return c_e(s.props,c)},s.getOptionValue=function(c){return tR(s.props,c)},s.getStyles=function(c,u){var d=s.props.unstyled,f=Bft[c](u,d);f.boxSizing="border-box";var x=s.props.styles[c];return x?x(f,u):f},s.getClassNames=function(c,u){var d,f;return(d=(f=s.props.classNames)[c])===null||d===void 0?void 0:d.call(f,u)},s.getElementId=function(c){return"".concat(s.state.instancePrefix,"-").concat(c)},s.getComponents=function(){return oft(s.props)},s.buildCategorizedOptions=function(){return TO(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return l_e(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(c,u){s.setState({ariaSelection:Xs({value:c},u)})},s.onMenuMouseDown=function(c){c.button===0&&(c.stopPropagation(),c.preventDefault(),s.focusInput())},s.onMenuMouseMove=function(c){s.blockOptionHover=!1},s.onControlMouseDown=function(c){if(!c.defaultPrevented){var u=s.props.openMenuOnClick;s.state.isFocused?s.props.menuIsOpen?c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&s.onMenuClose():u&&s.openMenu("first"):(u&&(s.openAfterFocus=!0),s.focusInput()),c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.preventDefault()}},s.onDropdownIndicatorMouseDown=function(c){if(!(c&&c.type==="mousedown"&&c.button!==0)&&!s.props.isDisabled){var u=s.props,d=u.isMulti,f=u.menuIsOpen;s.focusInput(),f?(s.setState({inputIsHiddenAfterUpdate:!d}),s.onMenuClose()):s.openMenu("first"),c.preventDefault()}},s.onClearIndicatorMouseDown=function(c){c&&c.type==="mousedown"&&c.button!==0||(s.clearValue(),c.preventDefault(),s.openAfterFocus=!1,c.type==="touchend"?s.focusInput():setTimeout(function(){return s.focusInput()}))},s.onScroll=function(c){typeof s.props.closeMenuOnScroll=="boolean"?c.target instanceof HTMLElement&&GB(c.target)&&s.props.onMenuClose():typeof s.props.closeMenuOnScroll=="function"&&s.props.closeMenuOnScroll(c)&&s.props.onMenuClose()},s.onCompositionStart=function(){s.isComposing=!0},s.onCompositionEnd=function(){s.isComposing=!1},s.onTouchStart=function(c){var u=c.touches,d=u&&u.item(0);d&&(s.initialTouchX=d.clientX,s.initialTouchY=d.clientY,s.userIsDragging=!1)},s.onTouchMove=function(c){var u=c.touches,d=u&&u.item(0);if(d){var f=Math.abs(d.clientX-s.initialTouchX),x=Math.abs(d.clientY-s.initialTouchY),g=5;s.userIsDragging=f>g||x>g}},s.onTouchEnd=function(c){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(c.target)&&s.menuListRef&&!s.menuListRef.contains(c.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(c){s.userIsDragging||s.onControlMouseDown(c)},s.onClearIndicatorTouchEnd=function(c){s.userIsDragging||s.onClearIndicatorMouseDown(c)},s.onDropdownIndicatorTouchEnd=function(c){s.userIsDragging||s.onDropdownIndicatorMouseDown(c)},s.handleInputChange=function(c){var u=s.props.inputValue,d=c.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:u}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(c){s.props.onFocus&&s.props.onFocus(c),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(c){var u=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(c),s.onInputChange("",{action:"input-blur",prevInputValue:u}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(c){if(!(s.blockOptionHover||s.state.focusedOption===c)){var u=s.getFocusableOptions(),d=u.indexOf(c);s.setState({focusedOption:c,focusedOptionId:d>-1?s.getFocusedOptionId(c):null})}},s.shouldHideSelectedOptions=function(){return h_e(s.props)},s.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),s.focus()},s.onKeyDown=function(c){var u=s.props,d=u.isMulti,f=u.backspaceRemovesValue,x=u.escapeClearsValue,g=u.inputValue,y=u.isClearable,v=u.isDisabled,C=u.menuIsOpen,N=u.onKeyDown,P=u.tabSelectsValue,T=u.openMenuOnFocus,M=s.state,F=M.focusedOption,$=M.focusedValue,L=M.selectValue;if(!v&&!(typeof N=="function"&&(N(c),c.defaultPrevented))){switch(s.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if($)s.removeValue($);else{if(!f)return;d?s.popValue():y&&s.clearValue()}break;case"Tab":if(s.isComposing||c.shiftKey||!C||!P||!F||T&&s.isOptionSelected(F,L))return;s.selectOption(F);break;case"Enter":if(c.keyCode===229)break;if(C){if(!F||s.isComposing)return;s.selectOption(F);break}return;case"Escape":C?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):y&&x&&s.clearValue();break;case" ":if(g)return;if(!C){s.openMenu("first");break}if(!F)return;s.selectOption(F);break;case"ArrowUp":C?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":C?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!C)return;s.focusOption("pageup");break;case"PageDown":if(!C)return;s.focusOption("pagedown");break;case"Home":if(!C)return;s.focusOption("first");break;case"End":if(!C)return;s.focusOption("last");break;default:return}c.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++Yft),s.state.selectValue=wme(r.value),r.menuIsOpen&&s.state.selectValue.length){var a=s.getFocusableOptionsWithIds(),o=s.buildFocusableOptions(),l=o.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=a,s.state.focusedOption=o[l],s.state.focusedOptionId=JH(a,o[l])}return s}return bct(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Cme(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(s){var a=this.props,o=a.isDisabled,l=a.menuIsOpen,c=this.state.isFocused;(c&&!o&&s.isDisabled||c&&l&&!s.menuIsOpen)&&this.focusInput(),c&&o&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!c&&!o&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Cme(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,a){this.props.onInputChange(s,a)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var a=this,o=this.state,l=o.selectValue,c=o.isFocused,u=this.buildFocusableOptions(),d=s==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(l[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(c&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return a.onMenuOpen()})}},{key:"focusValue",value:function(s){var a=this.state,o=a.selectValue,l=a.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var c=o.indexOf(l);l||(c=-1);var u=o.length-1,d=-1;if(o.length){switch(s){case"previous":c===0?d=0:c===-1?d=u:d=c-1;break;case"next":c>-1&&c<u&&(d=c+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:o[d]})}}}},{key:"focusOption",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",a=this.props.pageSize,o=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var c=0,u=l.indexOf(o);o||(u=-1),s==="up"?c=u>0?u-1:l.length-1:s==="down"?c=(u+1)%l.length:s==="pageup"?(c=u-a,c<0&&(c=0)):s==="pagedown"?(c=u+a,c>l.length-1&&(c=l.length-1)):s==="last"&&(c=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[c],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[c])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(ZH):Xs(Xs({},ZH),this.props.theme):ZH}},{key:"getCommonProps",value:function(){var s=this.clearValue,a=this.cx,o=this.getStyles,l=this.getClassNames,c=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,x=f.isMulti,g=f.isRtl,y=f.options,v=this.hasValue();return{clearValue:s,cx:a,getStyles:o,getClassNames:l,getValue:c,hasValue:v,isMulti:x,isRtl:g,options:y,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,a=s.isClearable,o=s.isMulti;return a===void 0?o:a}},{key:"isOptionDisabled",value:function(s,a){return u_e(this.props,s,a)}},{key:"isOptionSelected",value:function(s,a){return d_e(this.props,s,a)}},{key:"filterOption",value:function(s,a){return f_e(this.props,s,a)}},{key:"formatOptionLabel",value:function(s,a){if(typeof this.props.formatOptionLabel=="function"){var o=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(s,{context:a,inputValue:o,selectValue:l})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var s=this.props,a=s.isDisabled,o=s.isSearchable,l=s.inputId,c=s.inputValue,u=s.tabIndex,d=s.form,f=s.menuIsOpen,x=s.required,g=this.getComponents(),y=g.Input,v=this.state,C=v.inputIsHidden,N=v.ariaSelection,P=this.commonProps,T=l||this.getElementId("input"),M=Xs(Xs(Xs({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":x,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!o&&{"aria-readonly":!0}),this.hasValue()?(N==null?void 0:N.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return o?m.createElement(y,ri({},P,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:T,innerRef:this.getInputRef,isDisabled:a,isHidden:C,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},M)):m.createElement(wft,ri({id:T,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:JM,onFocus:this.onInputFocus,disabled:a,tabIndex:u,inputMode:"none",form:d,value:""},M))}},{key:"renderPlaceholderOrValue",value:function(){var s=this,a=this.getComponents(),o=a.MultiValue,l=a.MultiValueContainer,c=a.MultiValueLabel,u=a.MultiValueRemove,d=a.SingleValue,f=a.Placeholder,x=this.commonProps,g=this.props,y=g.controlShouldRenderValue,v=g.isDisabled,C=g.isMulti,N=g.inputValue,P=g.placeholder,T=this.state,M=T.selectValue,F=T.focusedValue,$=T.isFocused;if(!this.hasValue()||!y)return N?null:m.createElement(f,ri({},x,{key:"placeholder",isDisabled:v,isFocused:$,innerProps:{id:this.getElementId("placeholder")}}),P);if(C)return M.map(function(z,X){var ne=z===F,J="".concat(s.getOptionLabel(z),"-").concat(s.getOptionValue(z));return m.createElement(o,ri({},x,{components:{Container:l,Label:c,Remove:u},isFocused:ne,isDisabled:v,key:J,index:X,removeProps:{onClick:function(){return s.removeValue(z)},onTouchEnd:function(){return s.removeValue(z)},onMouseDown:function(te){te.preventDefault()}},data:z}),s.formatOptionLabel(z,"value"))});if(N)return null;var L=M[0];return m.createElement(d,ri({},x,{data:L,isDisabled:v}),this.formatOptionLabel(L,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),a=s.ClearIndicator,o=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!a||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return m.createElement(a,ri({},o,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),a=s.LoadingIndicator,o=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!a||!u)return null;var f={"aria-hidden":"true"};return m.createElement(a,ri({},o,{innerProps:f,isDisabled:c,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),a=s.DropdownIndicator,o=s.IndicatorSeparator;if(!a||!o)return null;var l=this.commonProps,c=this.props.isDisabled,u=this.state.isFocused;return m.createElement(o,ri({},l,{isDisabled:c,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),a=s.DropdownIndicator;if(!a)return null;var o=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return m.createElement(a,ri({},o,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var s=this,a=this.getComponents(),o=a.Group,l=a.GroupHeading,c=a.Menu,u=a.MenuList,d=a.MenuPortal,f=a.LoadingMessage,x=a.NoOptionsMessage,g=a.Option,y=this.commonProps,v=this.state.focusedOption,C=this.props,N=C.captureMenuScroll,P=C.inputValue,T=C.isLoading,M=C.loadingMessage,F=C.minMenuHeight,$=C.maxMenuHeight,L=C.menuIsOpen,z=C.menuPlacement,X=C.menuPosition,ne=C.menuPortalTarget,J=C.menuShouldBlockScroll,K=C.menuShouldScrollIntoView,te=C.noOptionsMessage,fe=C.onMenuScrollToTop,q=C.onMenuScrollToBottom;if(!L)return null;var se=function(Ce,me){var we=Ce.type,xe=Ce.data,be=Ce.isDisabled,je=Ce.isSelected,Ie=Ce.label,Re=Ce.value,Qe=v===xe,Ke=be?void 0:function(){return s.onOptionHover(xe)},dt=be?void 0:function(){return s.selectOption(xe)},tt="".concat(s.getElementId("option"),"-").concat(me),nt={id:tt,onClick:dt,onMouseMove:Ke,onMouseOver:Ke,tabIndex:-1,role:"option","aria-selected":s.isAppleDevice?void 0:je};return m.createElement(g,ri({},y,{innerProps:nt,data:xe,isDisabled:be,isSelected:je,key:tt,label:Ie,type:we,value:Re,isFocused:Qe,innerRef:Qe?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(Ce.data,"menu"))},ae;if(this.hasOptions())ae=this.getCategorizedOptions().map(function(de){if(de.type==="group"){var Ce=de.data,me=de.options,we=de.index,xe="".concat(s.getElementId("group"),"-").concat(we),be="".concat(xe,"-heading");return m.createElement(o,ri({},y,{key:xe,data:Ce,options:me,Heading:l,headingProps:{id:be,data:de.data},label:s.formatGroupLabel(de.data)}),de.options.map(function(je){return se(je,"".concat(we,"-").concat(je.index))}))}else if(de.type==="option")return se(de,"".concat(de.index))});else if(T){var W=M({inputValue:P});if(W===null)return null;ae=m.createElement(f,y,W)}else{var V=te({inputValue:P});if(V===null)return null;ae=m.createElement(x,y,V)}var ee={minMenuHeight:F,maxMenuHeight:$,menuPlacement:z,menuPosition:X,menuShouldScrollIntoView:K},oe=m.createElement(edt,ri({},y,ee),function(de){var Ce=de.ref,me=de.placerProps,we=me.placement,xe=me.maxHeight;return m.createElement(c,ri({},y,ee,{innerRef:Ce,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:T,placement:we}),m.createElement(Eft,{captureEnabled:N,onTopArrive:fe,onBottomArrive:q,lockEnabled:J},function(be){return m.createElement(u,ri({},y,{innerRef:function(Ie){s.getMenuListRef(Ie),be(Ie)},innerProps:{role:"listbox","aria-multiselectable":y.isMulti,id:s.getElementId("listbox")},isLoading:T,maxHeight:xe,focusedOption:v}),ae)}))});return ne||X==="fixed"?m.createElement(d,ri({},y,{appendTo:ne,controlElement:this.controlRef,menuPlacement:z,menuPosition:X}),oe):oe}},{key:"renderFormField",value:function(){var s=this,a=this.props,o=a.delimiter,l=a.isDisabled,c=a.isMulti,u=a.name,d=a.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return m.createElement(Tft,{name:u,onFocus:this.onValueInputFocus});if(!(!u||l))if(c)if(o){var x=f.map(function(v){return s.getOptionValue(v)}).join(o);return m.createElement("input",{name:u,type:"hidden",value:x})}else{var g=f.length>0?f.map(function(v,C){return m.createElement("input",{key:"i-".concat(C),name:u,type:"hidden",value:s.getOptionValue(v)})}):m.createElement("input",{name:u,type:"hidden",value:""});return m.createElement("div",null,g)}else{var y=f[0]?this.getOptionValue(f[0]):"";return m.createElement("input",{name:u,type:"hidden",value:y})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,a=this.state,o=a.ariaSelection,l=a.focusedOption,c=a.focusedValue,u=a.isFocused,d=a.selectValue,f=this.getFocusableOptions();return m.createElement(mft,ri({},s,{id:this.getElementId("live-region"),ariaSelection:o,focusedOption:l,focusedValue:c,isFocused:u,selectValue:d,focusableOptions:f,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),a=s.Control,o=s.IndicatorsContainer,l=s.SelectContainer,c=s.ValueContainer,u=this.props,d=u.className,f=u.id,x=u.isDisabled,g=u.menuIsOpen,y=this.state.isFocused,v=this.commonProps=this.getCommonProps();return m.createElement(l,ri({},v,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:x,isFocused:y}),this.renderLiveRegion(),m.createElement(a,ri({},v,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:x,isFocused:y,menuIsOpen:g}),m.createElement(c,ri({},v,{isDisabled:x}),this.renderPlaceholderOrValue(),this.renderInput()),m.createElement(o,ri({},v,{isDisabled:x}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,a){var o=a.prevProps,l=a.clearFocusValueOnUpdate,c=a.inputIsHiddenAfterUpdate,u=a.ariaSelection,d=a.isFocused,f=a.prevWasFocused,x=a.instancePrefix,g=s.options,y=s.value,v=s.menuIsOpen,C=s.inputValue,N=s.isMulti,P=wme(y),T={};if(o&&(y!==o.value||g!==o.options||v!==o.menuIsOpen||C!==o.inputValue)){var M=v?qft(s,P):[],F=v?Rme(TO(s,P),"".concat(x,"-option")):[],$=l?Gft(a,P):null,L=Kft(a,M),z=JH(F,L);T={selectValue:P,focusedOption:L,focusedOptionId:z,focusableOptionsWithIds:F,focusedValue:$,clearFocusValueOnUpdate:!1}}var X=c!=null&&s!==o?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},ne=u,J=d&&f;return d&&!J&&(ne={value:yI(N,P,P[0]||null),options:P,action:"initial-input-focus"},J=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(ne=null),Xs(Xs(Xs({},T),X),{},{prevProps:s,ariaSelection:ne,prevWasFocused:J})}}]),n}(m.Component);p_e.defaultProps=Wft;var Xft=m.forwardRef(function(t,e){var n=xct(t);return m.createElement(p_e,ri({ref:e},n))}),jl=Xft;function cu(t){if(!t)return"--/--/--";const e=new Date(t),n=e.toLocaleString("en-US",{month:"short"}),r=e.getDate(),s=e.getFullYear(),a=String(e.getHours()%12||12).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");String(e.getSeconds()).padStart(2,"0");const l=e.getHours()>=12?" PM":" AM";return`${n} ${r}, ${s}, ${a}:${o} ${l}`}function O3(t){const e=new Date(t),n=e.toLocaleString("en-US",{month:"short"}),r=e.getDate(),s=e.getFullYear();return String(e.getHours()%12||12).padStart(2,"0"),String(e.getMinutes()).padStart(2,"0"),String(e.getSeconds()).padStart(2,"0"),e.getHours()>=12,`${n} ${r}, ${s}`}function $o(t){const e=new Date(t),r=Math.floor((new Date().getTime()-e.getTime())/1e3),s=Math.floor(r/60),a=Math.floor(r/3600),o=Math.floor(r/86400),l=Math.floor(r/31536e3),c=s%60,u=a%24,d=o%365;return{dateTime:r<60?`${r} seconds ago`:r<3600?`${s} minutes ago`:r<86400?c>0?`${a} hours ${c} minutes ago`:`${a} hours ago`:r<31536e3?u>0?`${o} days ${u} hours ago`:`${o} days ago`:d>0?`${l} years ${d} days ago`:`${l} years ago`}}function Qft(t){const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");String(e.getSeconds()).padStart(2,"0");const l=e.getHours()>=12?" PM":" AM";return`${n}/${r}/${s} ${a}:${o} ${l}`}function vI(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear();return String(e.getHours()).padStart(2,"0"),String(e.getMinutes()).padStart(2,"0"),String(e.getSeconds()).padStart(2,"0"),`${n}/${r}/${s}`}function Zft(t){const e=new Date(t),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear();return String(e.getHours()).padStart(2,"0"),String(e.getMinutes()).padStart(2,"0"),`${n}/${r}/${s}`}function Ms(t){if(t==null||isNaN(t))return"-";const e=t.toString();if(e.includes(".")){const n=e.split(".")[0];return new Intl.NumberFormat("en-US").format(parseInt(n))}return new Intl.NumberFormat("en-US").format(parseInt(t))}function Jft(t){try{var e=t.split(".")[1],n=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(n).split("").map(function(s){return"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}catch{return JSON.parse(!1)}}function _r(t){if(t==null||isNaN(t))return"--";const e=parseFloat(t),n=Math.floor(e)===0;let r=e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n?4:2,useGrouping:!0});if(r.includes(".")){const[s,a]=r.split("."),o=a.replace(/0+$/,"");r=o?`${s}.${o}`:s}return r}function eht(t){if(t==null||isNaN(t))return"--";const e=parseFloat(t),n=Math.floor(e)===0,r=e>=1e3;let s=e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:r?0:n?4:2,useGrouping:!0});if(!r&&s.includes(".")){const[a,o]=s.split("."),l=o.replace(/0+$/,"");s=l?`${a}.${l}`:a}return s}function uo(t){if(t==null||isNaN(t)||t===0)return"--";const e=parseFloat(t),n=e>=1e3;let r=e.toLocaleString("en-US",{minimumFractionDigits:n?2:0,maximumFractionDigits:n?2:4,useGrouping:!0});if(r.includes(".")){const[s,a]=r.split(".");r=`${s}.${a.replace(/0+$/,"")}`}return r.replace(/\.$/,"")}function Ay(t){if(t==null||isNaN(t)||t===0)return"--";const e=parseFloat(t),n=e%1!==0;return e.toLocaleString("en-US",{minimumFractionDigits:n?4:0,maximumFractionDigits:4,useGrouping:!0})}function zv(t){if(t==null||isNaN(t)||t===0)return"--";const e=parseFloat(t),n=e>=1e3;let r=e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n?2:4,useGrouping:!0});if(r.includes(".")){const[s,a]=r.split(".");r=`${s}.${a.slice(0,2)}`}return r.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")}const KB=t=>t?`${t.slice(0,4)}..${t.slice(-4)}`:"-";function ad(t){const e=parseFloat(t);return isNaN(e)?"0.00":e>=1e9?(e/1e9).toFixed(2).replace(/\.00$/,"")+"B":e>=1e6?(e/1e6).toFixed(2).replace(/\.00$/,"")+"M":e>=1e3?(e/1e3).toFixed(2).replace(/\.00$/,"")+"K":e.toFixed(2).replace(/\.00$/,"")}function u3(t){if(isNaN(t))return;const e=t.toString().replace(".",",");return Number(e.replace(",",".")).toLocaleString("en-US",{maximumFractionDigits:20})}const m_e="2.28.0";let V8={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${m_e}`},Br=class _J extends Error{constructor(e,n={}){var l;const r=(()=>{var c;return n.cause instanceof _J?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof _J&&n.cause.docsPath||n.docsPath,a=(l=V8.getDocsUrl)==null?void 0:l.call(V8,{...n,docsPath:s}),o=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...V8.version?[`Version: ${V8.version}`]:[]].join(`
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=m_e}walk(e){return x_e(this,e)}};function x_e(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?x_e(t.cause,e):e?null:t}let g_e=class extends Br{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class tht extends Br{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class nht extends Br{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let rht=class extends Br{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}},b_e=class extends Br{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},y_e=class extends Br{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Dme extends Br{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}function GA(t,{dir:e,size:n=32}={}){return typeof t=="string"?My(t,{dir:e,size:n}):sht(t,{dir:e,size:n})}function My(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new y_e({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function sht(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new y_e({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=e==="right";r[a?s:n-s-1]=t[a?s:t.length-s-1]}return r}function ix(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function cl(t){return ix(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function Jf(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=e==="left"?n.slice(r):n.slice(0,n.length-r),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}const iht=new TextEncoder;function KA(t,e={}){return typeof t=="number"||typeof t=="bigint"?oht(t,e):typeof t=="boolean"?aht(t,e):ix(t)?hp(t,e):d3(t,e)}function aht(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(Cp(n,{size:e.size}),GA(n,{size:e.size})):n}const qx={zero:48,nine:57,A:65,F:70,a:97,f:102};function Bme(t){if(t>=qx.zero&&t<=qx.nine)return t-qx.zero;if(t>=qx.A&&t<=qx.F)return t-(qx.A-10);if(t>=qx.a&&t<=qx.f)return t-(qx.a-10)}function hp(t,e={}){let n=t;e.size&&(Cp(n,{size:e.size}),n=GA(n,{dir:"right",size:e.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,a=new Uint8Array(s);for(let o=0,l=0;o<s;o++){const c=Bme(r.charCodeAt(l++)),u=Bme(r.charCodeAt(l++));if(c===void 0||u===void 0)throw new Br(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);a[o]=c*16+u}return a}function oht(t,e){const n=zs(t,e);return hp(n)}function d3(t,e={}){const n=iht.encode(t);return typeof e.size=="number"?(Cp(n,{size:e.size}),GA(n,{dir:"right",size:e.size})):n}function Cp(t,{size:e}){if(cl(t)>e)throw new rht({givenSize:cl(t),maxSize:e})}function cd(t,e={}){const{signed:n}=e;e.size&&Cp(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function lht(t,e={}){let n=t;if(e.size&&(Cp(n,{size:e.size}),n=Jf(n)),Jf(n)==="0x00")return!1;if(Jf(n)==="0x01")return!0;throw new nht(n)}function ax(t,e={}){return Number(cd(t,e))}function cht(t,e={}){let n=hp(t);return e.size&&(Cp(n,{size:e.size}),n=Jf(n,{dir:"right"})),new TextDecoder().decode(n)}const uht=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function di(t,e={}){return typeof t=="number"||typeof t=="bigint"?zs(t,e):typeof t=="string"?tN(t,e):typeof t=="boolean"?v_e(t,e):Gl(t,e)}function v_e(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(Cp(n,{size:e.size}),GA(n,{size:e.size})):n}function Gl(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=uht[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(Cp(r,{size:e.size}),GA(r,{dir:"right",size:e.size})):r}function zs(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<o){const c=typeof t=="bigint"?"n":"";throw new g_e({max:a?`${a}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${t}${c}`})}const l=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?GA(l,{size:r}):l}const dht=new TextEncoder;function tN(t,e={}){const n=dht.encode(t);return Gl(n,e)}function jm(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new Nht(t.type);return`${t.name}(${YB(t.inputs,{includeName:e})})`}function YB(t,{includeName:e=!1}={}){return t?t.map(n=>fht(n,{includeName:e})).join(e?", ":","):""}function fht(t,{includeName:e}){return t.type.startsWith("tuple")?`(${YB(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class hht extends Br{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class $me extends Br{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class w_e extends Br{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${YB(n,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=n,this.size=r}}class dT extends Br{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class pht extends Br{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class mht extends Br{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${cl(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class xht extends Br{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
`),{name:"AbiEncodingLengthMismatchError"})}}class ght extends Br{constructor(e,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${e}", but "${e}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ume extends Br{constructor(e,{docsPath:n}={}){super([`Error ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class C_e extends Br{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class bht extends Br{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class S_e extends Br{constructor(e,{docsPath:n}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class zme extends Br{constructor(e,{docsPath:n}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class nN extends Br{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class N_e extends Br{constructor(e,{docsPath:n}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class yht extends Br{constructor(e,{docsPath:n}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class vht extends Br{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${jm(e.abiItem)}\`, and`,`\`${n.type}\` in \`${jm(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let wht=class extends Br{constructor({expectedSize:e,givenSize:n}){super(`Expected bytes${e}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class yE extends Br{constructor({abiItem:e,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(`
`),{metaMessages:[`Params: (${YB(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=n,this.params=r,this.size=s}}class XB extends Br{constructor({abiItem:e,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${jm(e,{includeName:!0})}".`].join(`
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class Cht extends Br{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Sht extends Br{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let A_e=class extends Br{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
`),{name:"InvalidArrayError"})}};class Nht extends Br{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`),{name:"InvalidDefinitionTypeError"})}}function m1(t){return typeof t[0]=="string"?Im(t):Aht(t)}function Aht(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function Im(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}let Cd=class extends Br{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},QB=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};function nR(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function jht(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function fT(t,...e){if(!jht(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Eht(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");nR(t.outputLen),nR(t.blockLen)}function rN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function j_e(t,e){fT(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const wI=BigInt(2**32-1),Hme=BigInt(32);function _ht(t,e=!1){return e?{h:Number(t&wI),l:Number(t>>Hme&wI)}:{h:Number(t>>Hme&wI)|0,l:Number(t&wI)|0}}function kht(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:a,l:o}=_ht(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const Tht=(t,e,n)=>t<<n|e>>>32-n,Pht=(t,e,n)=>e<<n|t>>>32-n,Iht=(t,e,n)=>e<<n-32|t>>>64-n,Fht=(t,e,n)=>t<<n-32|e>>>64-n,rC=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Oht(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function eV(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function n0(t,e){return t<<32-e|t>>>e}const Vme=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Mht(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Wme(t){for(let e=0;e<t.length;e++)t[e]=Mht(t[e])}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function Rht(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function ZB(t){return typeof t=="string"&&(t=Rht(t)),fT(t),t}function Lht(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];fT(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const a=t[r];n.set(a,s),s+=a.length}return n}let _ae=class{clone(){return this._cloneInto()}};function E_e(t){const e=r=>t().update(ZB(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Dht(t=32){if(rC&&typeof rC.getRandomValues=="function")return rC.getRandomValues(new Uint8Array(t));if(rC&&typeof rC.randomBytes=="function")return Uint8Array.from(rC.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const __e=[],k_e=[],T_e=[],Bht=BigInt(0),W8=BigInt(1),$ht=BigInt(2),Uht=BigInt(7),zht=BigInt(256),Hht=BigInt(113);for(let t=0,e=W8,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],__e.push(2*(5*r+n)),k_e.push((t+1)*(t+2)/2%64);let s=Bht;for(let a=0;a<7;a++)e=(e<<W8^(e>>Uht)*Hht)%zht,e&$ht&&(s^=W8<<(W8<<BigInt(a))-W8);T_e.push(s)}const[Vht,Wht]=kht(T_e,!0),qme=(t,e,n)=>n>32?Iht(t,e,n):Tht(t,e,n),Gme=(t,e,n)=>n>32?Fht(t,e,n):Pht(t,e,n);function qht(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const l=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=qme(u,d,1)^n[l],x=Gme(u,d,1)^n[l+1];for(let g=0;g<50;g+=10)t[o+g]^=f,t[o+g+1]^=x}let s=t[2],a=t[3];for(let o=0;o<24;o++){const l=k_e[o],c=qme(s,a,l),u=Gme(s,a,l),d=__e[o];s=t[d],a=t[d+1],t[d]=c,t[d+1]=u}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)n[l]=t[o+l];for(let l=0;l<10;l++)t[o+l]^=~n[(l+2)%10]&n[(l+4)%10]}t[0]^=Vht[r],t[1]^=Wht[r]}n.fill(0)}let Ght=class P_e extends _ae{constructor(e,n,r,s=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=a,nR(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Oht(this.state)}keccak(){Vme||Wme(this.state32),qht(this.state32,this.rounds),Vme||Wme(this.state32),this.posOut=0,this.pos=0}update(e){rN(this);const{blockLen:n,state:r}=this;e=ZB(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){rN(this,!1),fT(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,a=e.length;s<a;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,a-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return nR(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(j_e(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:a,enableXOF:o}=this;return e||(e=new P_e(n,r,s,o,a)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const Kht=(t,e,n)=>E_e(()=>new Ght(e,t,n)),Yht=Kht(1,136,256/8);function iu(t,e){const n=e||"hex",r=Yht(ix(t,{strict:!1})?KA(t):t);return n==="bytes"?r:di(r)}const tV=new QB(8192);function JB(t,e){if(tV.has(`${t}.${e}`))return tV.get(`${t}.${e}`);const n=e?`${e}${t.toLowerCase()}`:t.substring(2).toLowerCase(),r=iu(d3(n),"bytes"),s=(e?n.substring(`${e}0x`.length):n).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const a=`0x${s.join("")}`;return tV.set(`${t}.${e}`,a),a}function Tc(t,e){if(!uc(t,{strict:!1}))throw new Cd({address:t});return JB(t,e)}const Xht=/^0x[a-fA-F0-9]{40}$/,nV=new QB(8192);function uc(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(nV.has(r))return nV.get(r);const s=Xht.test(t)?t.toLowerCase()===t?!0:n?JB(t)===t:!0:!1;return nV.set(r,s),s}function M3(t,e,n,{strict:r}={}){return ix(t,{strict:!1})?M_e(t,e,n,{strict:r}):O_e(t,e,n,{strict:r})}function I_e(t,e){if(typeof e=="number"&&e>0&&e>cl(t)-1)throw new b_e({offset:e,position:"start",size:cl(t)})}function F_e(t,e,n){if(typeof e=="number"&&typeof n=="number"&&cl(t)!==n-e)throw new b_e({offset:n,position:"end",size:cl(t)})}function O_e(t,e,n,{strict:r}={}){I_e(t,e);const s=t.slice(e,n);return r&&F_e(s,e,n),s}function M_e(t,e,n,{strict:r}={}){I_e(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&F_e(s,e,n),s}const Qht=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,R_e=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function C2(t,e){if(t.length!==e.length)throw new xht({expectedLength:t.length,givenLength:e.length});const n=Zht({params:t,values:e}),r=Tae(n);return r.length===0?"0x":r}function Zht({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(kae({param:t[r],value:e[r]}));return n}function kae({param:t,value:e}){const n=Pae(t.type);if(n){const[r,s]=n;return ept(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return ipt(e,{param:t});if(t.type==="address")return Jht(e);if(t.type==="bool")return npt(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int"),[,,s="256"]=R_e.exec(t.type)??[];return rpt(e,{signed:r,size:Number(s)})}if(t.type.startsWith("bytes"))return tpt(e,{param:t});if(t.type==="string")return spt(e);throw new Cht(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Tae(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?e+=32:e+=cl(l)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?(n.push(zs(e+s,{size:32})),r.push(l),s+=cl(l)):n.push(l)}return m1([...n,...r])}function Jht(t){if(!uc(t))throw new Cd({address:t});return{dynamic:!1,encoded:My(t.toLowerCase())}}function ept(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new A_e(t);if(!r&&t.length!==e)throw new pht({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let o=0;o<t.length;o++){const l=kae({param:n,value:t[o]});l.dynamic&&(s=!0),a.push(l)}if(r||s){const o=Tae(a);if(r){const l=zs(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?m1([l,o]):l}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:m1(a.map(({encoded:o})=>o))}}function tpt(t,{param:e}){const[,n]=e.type.split("bytes"),r=cl(t);if(!n){let s=t;return r%32!==0&&(s=My(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:m1([My(zs(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new mht({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:My(t,{dir:"right"})}}function npt(t){if(typeof t!="boolean")throw new Br(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:My(v_e(t))}}function rpt(t,{signed:e,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-r-1n:0n;if(t>r||t<s)throw new g_e({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:zs(t,{size:32,signed:e})}}function spt(t){const e=tN(t),n=Math.ceil(cl(e)/32),r=[];for(let s=0;s<n;s++)r.push(My(M3(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:m1([My(zs(cl(e),{size:32})),...r])}}function ipt(t,{param:e}){let n=!1;const r=[];for(let s=0;s<e.components.length;s++){const a=e.components[s],o=Array.isArray(t)?s:a.name,l=kae({param:a,value:t[o]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Tae(r):m1(r.map(({encoded:s})=>s))}}function Pae(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const rV="/docs/contract/encodeDeployData";function Iae(t){const{abi:e,args:n,bytecode:r}=t;if(!n||n.length===0)return r;const s=e.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new hht({docsPath:rV});if(!("inputs"in s))throw new $me({docsPath:rV});if(!s.inputs||s.inputs.length===0)throw new $me({docsPath:rV});const a=C2(s.inputs,n);return Im([r,a])}function Vu(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class e$ extends Br{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class sV extends Br{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function apt(t){const e=iu(`0x${t.substring(4)}`).substring(26);return JB(`0x${e}`)}const opt="modulepreload",lpt=function(t){return"/"+t},Kme={},os=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=lpt(c),c in Kme)return;Kme[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":opt,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((x,g)=>{f.addEventListener("load",x),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&a(l.reason);return e().catch(a)})};async function cpt({hash:t,signature:e}){const n=ix(t)?t:di(t),{secp256k1:r}=await os(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>W1t);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:u,s:d,v:f,yParity:x}=e,g=Number(x??f),y=Yme(g);return new r.Signature(cd(u),cd(d)).addRecoveryBit(y)}const o=ix(e)?e:di(e),l=ax(`0x${o.slice(130)}`),c=Yme(l);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Yme(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function L_e({hash:t,signature:e}){return apt(await cpt({hash:t,signature:e}))}class Xme extends Br{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class D_e extends Br{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class upt extends Br{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const dpt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new upt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new D_e({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Xme({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Xme({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Fae(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(dpt);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function Jy(t,e="hex"){const n=B_e(t),r=Fae(new Uint8Array(n.length));return n.encode(r),e==="hex"?Gl(r.bytes):r.bytes}function B_e(t){return Array.isArray(t)?fpt(t.map(e=>B_e(e))):hpt(t)}function fpt(t){const e=t.reduce((s,a)=>s+a.length,0),n=$_e(e);return{length:e<=55?1+e:1+n+e,encode(s){e<=55?s.pushByte(192+e):(s.pushByte(247+n),n===1?s.pushUint8(e):n===2?s.pushUint16(e):n===3?s.pushUint24(e):s.pushUint32(e));for(const{encode:a}of t)a(s)}}}function hpt(t){const e=typeof t=="string"?hp(t):t,n=$_e(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+n+e.length,encode(s){e.length===1&&e[0]<128?s.pushBytes(e):e.length<=55?(s.pushByte(128+e.length),s.pushBytes(e)):(s.pushByte(183+n),n===1?s.pushUint8(e.length):n===2?s.pushUint16(e.length):n===3?s.pushUint24(e.length):s.pushUint32(e.length),s.pushBytes(e))}}}function $_e(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new Br("Length is too large.")}function ppt(t){const{chainId:e,nonce:n,to:r}=t,s=t.contractAddress??t.address,a=iu(Im(["0x05",Jy([e?zs(e):"0x",s,n?zs(n):"0x"])]));return r==="bytes"?hp(a):a}async function U_e(t){const{authorization:e,signature:n}=t;return L_e({hash:ppt(e),signature:n??e})}class kJ extends Br{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}let mpt=class extends Br{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}};class xpt extends Br{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
`),{name:"ChainNotFoundError"})}}class z_e extends Br{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class t$ extends Br{constructor({chainId:e}){super(typeof e=="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function gpt({chain:t,currentChainId:e}){if(!t)throw new xpt;if(e!==t.id)throw new mpt({chain:t,currentChainId:e})}const bpt={gwei:9,wei:18},ypt={ether:-9,wei:9},vpt={ether:-18,gwei:-9};function hT(t,e){let n=t.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,a]=[n.slice(0,n.length-e),n.slice(n.length-e)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${a?`.${a}`:""}`}function cf(t,e="wei"){return hT(t,ypt[e])}class t4 extends Br{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(t4,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(t4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class R3 extends Br{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${cf(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(R3,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class TJ extends Br{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${cf(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(TJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class PJ extends Br{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(PJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class IJ extends Br{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(IJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class FJ extends Br{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(FJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class OJ extends Br{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(OJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class MJ extends Br{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(MJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class RJ extends Br{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(RJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class LJ extends Br{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(LJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class vE extends Br{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${cf(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${cf(r)} gwei`:""}).`].join(`
`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(vE,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class pT extends Br{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function Oae(t,e="wei"){return hT(t,bpt[e])}function mT(t){const e=Object.entries(t).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=e.reduce((r,[s])=>Math.max(r,s.length),0);return e.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
`)}class wpt extends Br{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
`),{name:"FeeConflictError"})}}class Cpt extends Br{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class Spt extends Br{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",mT(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class Npt extends Br{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class Apt extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x}){var y;const g=mT({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:f,value:typeof x<"u"&&`${Oae(x)} ${((y=s==null?void 0:s.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${cf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${cf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${cf(u)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",g].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class H_e extends Br{constructor({blockHash:e,blockNumber:n,blockTag:r,hash:s,index:a}){let o="Transaction";r&&a!==void 0&&(o=`Transaction at block time "${r}" at index "${a}"`),e&&a!==void 0&&(o=`Transaction at block hash "${e}" at index "${a}"`),n&&a!==void 0&&(o=`Transaction at block number "${n}" at index "${a}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class V_e extends Br{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class jpt extends Br{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Mc=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),Ept=t=>t,Mae=t=>t;class w9 extends Br{constructor({body:e,cause:n,details:r,headers:s,status:a,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${Mae(o)}`,e&&`Request body: ${Mc(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=s,this.status=a,this.url=o}}class Rae extends Br{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Mae(r)}`,`Request body: ${Mc(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}class Qme extends Br{constructor({body:e,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Mae(n)}`,`Request body: ${Mc(e)}`],name:"TimeoutError"})}}const _pt=-1;let vf=class extends Br{constructor(e,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:o}){super(o,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof Rae?e.code:n??_pt}};class oh extends vf{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class wE extends vf{constructor(e){super(e,{code:wE.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(wE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class CE extends vf{constructor(e){super(e,{code:CE.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(CE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class SE extends vf{constructor(e,{method:n}={}){super(e,{code:SE.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(SE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class NE extends vf{constructor(e){super(e,{code:NE.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(NE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class L3 extends vf{constructor(e){super(e,{code:L3.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(L3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class D3 extends vf{constructor(e){super(e,{code:D3.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(D3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class AE extends vf{constructor(e){super(e,{code:AE.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(AE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ry extends vf{constructor(e){super(e,{code:Ry.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ry,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class jE extends vf{constructor(e){super(e,{code:jE.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(jE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class uw extends vf{constructor(e,{method:n}={}){super(e,{code:uw.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(uw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class sN extends vf{constructor(e){super(e,{code:sN.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(sN,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class EE extends vf{constructor(e){super(e,{code:EE.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(EE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class So extends oh{constructor(e){super(e,{code:So.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class _E extends oh{constructor(e){super(e,{code:_E.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(_E,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class kE extends oh{constructor(e,{method:n}={}){super(e,{code:kE.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(kE,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class TE extends oh{constructor(e){super(e,{code:TE.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(TE,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class PE extends oh{constructor(e){super(e,{code:PE.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(PE,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class pp extends oh{constructor(e){super(e,{code:pp.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(pp,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class IE extends oh{constructor(e){super(e,{code:IE.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(IE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class FE extends oh{constructor(e){super(e,{code:FE.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(FE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class OE extends oh{constructor(e){super(e,{code:OE.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(OE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ME extends oh{constructor(e){super(e,{code:ME.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ME,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class RE extends oh{constructor(e){super(e,{code:RE.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(RE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class LE extends oh{constructor(e){super(e,{code:LE.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(LE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class DE extends oh{constructor(e){super(e,{code:DE.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(DE,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class kpt extends vf{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function n$(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof Br?t.walk(s=>(s==null?void 0:s.code)===t4.code):t;return r instanceof Br?new t4({cause:t,message:r.details}):t4.nodeMessage.test(n)?new t4({cause:t,message:t.details}):R3.nodeMessage.test(n)?new R3({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):TJ.nodeMessage.test(n)?new TJ({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):PJ.nodeMessage.test(n)?new PJ({cause:t,nonce:e==null?void 0:e.nonce}):IJ.nodeMessage.test(n)?new IJ({cause:t,nonce:e==null?void 0:e.nonce}):FJ.nodeMessage.test(n)?new FJ({cause:t,nonce:e==null?void 0:e.nonce}):OJ.nodeMessage.test(n)?new OJ({cause:t}):MJ.nodeMessage.test(n)?new MJ({cause:t,gas:e==null?void 0:e.gas}):RJ.nodeMessage.test(n)?new RJ({cause:t,gas:e==null?void 0:e.gas}):LJ.nodeMessage.test(n)?new LJ({cause:t}):vE.nodeMessage.test(n)?new vE({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new pT({cause:t})}function Tpt(t,{docsPath:e,...n}){const r=(()=>{const s=n$(t,n);return s instanceof pT?t:s})();return new Apt(r,{docsPath:e,...n})}function r$(t,{format:e}){if(!e)return{};const n={};function r(a){const o=Object.keys(a);for(const l of o)l in t&&(n[l]=t[l]),a[l]&&typeof a[l]=="object"&&!Array.isArray(a[l])&&r(a[l])}const s=e(t||{});return r(s),n}function Lae(t,e){return({exclude:n,format:r})=>({exclude:n,format:s=>{const a=e(s);if(n)for(const o of n)delete a[o];return{...a,...r(s)}},type:t})}const Ppt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function xT(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=Ipt(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(n=>Gl(n)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=zs(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=zs(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=zs(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=zs(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=zs(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=zs(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=Ppt[t.type]),typeof t.value<"u"&&(e.value=zs(t.value)),e}function Ipt(t){return t.map(e=>({address:e.address,r:e.r?zs(BigInt(e.r)):e.r,s:e.s?zs(BigInt(e.s)):e.s,chainId:zs(e.chainId),nonce:zs(e.nonce),...typeof e.yParity<"u"?{yParity:zs(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:zs(e.v)}:{}}))}function ai(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const s$=2n**256n-1n;function YA(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,o=e?Vu(e):void 0;if(o&&!uc(o.address))throw new Cd({address:o.address});if(a&&!uc(a))throw new Cd({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new wpt;if(r&&r>s$)throw new R3({maxFeePerGas:r});if(s&&r&&s>r)throw new vE({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function Dae(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return ax(e)}class Fpt extends Br{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Bae extends Br{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Opt extends Br{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${cf(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class W_e extends Br{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const q_e={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function i$(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?ax(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?ax(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?q_e[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=Rpt(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}const Mpt=Lae("transaction",i$);function Rpt(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function $ae(t){const e=(t.transactions??[]).map(n=>typeof n=="string"?n:i$(n));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}const Lpt=Lae("block",$ae);async function L0(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,f,x;const a=r??"latest",o=s??!1,l=n!==void 0?zs(n):void 0;let c=null;if(e?c=await t.request({method:"eth_getBlockByHash",params:[e,o]},{dedupe:!0}):c=await t.request({method:"eth_getBlockByNumber",params:[l||a,o]},{dedupe:!!l}),!c)throw new W_e({blockHash:e,blockNumber:n});return(((x=(f=(d=t.chain)==null?void 0:d.formatters)==null?void 0:f.block)==null?void 0:x.format)||$ae)(c)}async function Uae(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Dpt(t,e){return G_e(t,e)}async function G_e(t,e){var a,o;const{block:n,chain:r=t.chain,request:s}=e||{};try{const l=((a=r==null?void 0:r.fees)==null?void 0:a.maxPriorityFeePerGas)??((o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee);if(typeof l=="function"){const u=n||await ai(t,L0,"getBlock")({}),d=await l({block:u,client:t,request:s});if(d===null)throw new Error;return d}if(typeof l<"u")return l;const c=await t.request({method:"eth_maxPriorityFeePerGas"});return cd(c)}catch{const[l,c]=await Promise.all([n?Promise.resolve(n):ai(t,L0,"getBlock")({}),ai(t,Uae,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new Bae;const u=c-l.baseFeePerGas;return u<0n?0n:u}}async function Bpt(t,e){return DJ(t,e)}async function DJ(t,e){var x,g;const{block:n,chain:r=t.chain,request:s,type:a="eip1559"}=e||{},o=await(async()=>{var y,v;return typeof((y=r==null?void 0:r.fees)==null?void 0:y.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:t,request:s}):((v=r==null?void 0:r.fees)==null?void 0:v.baseFeeMultiplier)??1.2})();if(o<1)throw new Fpt;const c=10**(((x=o.toString().split(".")[1])==null?void 0:x.length)??0),u=y=>y*BigInt(Math.ceil(o*c))/BigInt(c),d=n||await ai(t,L0,"getBlock")({});if(typeof((g=r==null?void 0:r.fees)==null?void 0:g.estimateFeesPerGas)=="function"){const y=await r.fees.estimateFeesPerGas({block:n,client:t,multiply:u,request:s,type:a});if(y!==null)return y}if(a==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new Bae;const y=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await G_e(t,{block:d,chain:r,request:s}),v=u(d.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??v+y,maxPriorityFeePerGas:y}}return{gasPrice:(s==null?void 0:s.gasPrice)??u(await ai(t,Uae,"getGasPrice")({}))}}class $pt extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x}){var y;const g=mT({from:n==null?void 0:n.address,to:f,value:typeof x<"u"&&`${Oae(x)} ${((y=s==null?void 0:s.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${cf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${cf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${cf(u)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",g].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function Upt(t,{docsPath:e,...n}){const r=(()=>{const s=n$(t,n);return s instanceof pT?t:s})();return new $pt(r,{docsPath:e,...n})}class zpt extends Br{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Hpt extends Br{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Zme(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
`,"")}function Vpt(t){return t.reduce((e,{address:n,...r})=>{let s=`${e} ${n}:
`;return r.nonce&&(s+=` nonce: ${r.nonce}
`),r.balance&&(s+=` balance: ${r.balance}
`),r.code&&(s+=` code: ${r.code}
`),r.state&&(s+=` state:
`,s+=Zme(r.state)),r.stateDiff&&(s+=` stateDiff:
`,s+=Zme(r.stateDiff)),s},` State Override:
`).slice(0,-1)}function Jme(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new Dme({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Dme({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function Wpt(t){const{balance:e,nonce:n,state:r,stateDiff:s,code:a}=t,o={};if(a!==void 0&&(o.code=a),e!==void 0&&(o.balance=zs(e)),n!==void 0&&(o.nonce=zs(n)),r!==void 0&&(o.state=Jme(r)),s!==void 0){if(o.state)throw new Hpt;o.stateDiff=Jme(s)}return o}function zae(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!uc(n,{strict:!1}))throw new Cd({address:n});if(e[n])throw new zpt({address:n});e[n]=Wpt(r)}return e}async function Hae(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?zs(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function Vae(t,e){var s,a,o;const{account:n=t.account}=e,r=n?Vu(n):void 0;try{let fe=function(se){const{block:ae,request:W,rpcStateOverride:V}=se;return t.request({method:"eth_estimateGas",params:V?[W,ae??"latest",V]:ae?[W,ae]:[W]})};const{accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:f,blockTag:x,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:N,maxPriorityFeePerGas:P,nonce:T,value:M,stateOverride:F,...$}=await Kae(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),z=(f?zs(f):void 0)||x,X=zae(F),ne=await(async()=>{if($.to)return $.to;if(c&&c.length>0)return await U_e({authorization:c[0]}).catch(()=>{throw new Br("`to` is required. Could not infer from `authorizationList`")})})();YA(e);const J=(o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:o.format,te=(J||xT)({...r$($,{format:J}),from:r==null?void 0:r.address,accessList:l,authorizationList:c,blobs:u,blobVersionedHashes:d,data:g,gas:y,gasPrice:v,maxFeePerBlobGas:C,maxFeePerGas:N,maxPriorityFeePerGas:P,nonce:T,to:ne,value:M});let q=BigInt(await fe({block:z,request:te,rpcStateOverride:X}));if(c){const se=await Hae(t,{address:te.from}),ae=await Promise.all(c.map(async W=>{const{address:V}=W,ee=await fe({block:z,request:{authorizationList:void 0,data:g,from:r==null?void 0:r.address,to:V,value:zs(se)},rpcStateOverride:X}).catch(()=>100000n);return 2n*BigInt(ee)}));q+=ae.reduce((W,V)=>W+V,0n)}return q}catch(l){throw Upt(l,{...e,account:r,chain:t.chain})}}async function K_e(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?zs(r):n]},{dedupe:!!r});return ax(s)}function Wae(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(a=>hp(a)):t.blobs,s=[];for(const a of r)s.push(Uint8Array.from(e.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>Gl(a))}function qae(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(o=>hp(o)):t.blobs,s=typeof t.commitments[0]=="string"?t.commitments.map(o=>hp(o)):t.commitments,a=[];for(let o=0;o<r.length;o++){const l=r[o],c=s[o];a.push(Uint8Array.from(e.computeBlobKzgProof(l,c)))}return n==="bytes"?a:a.map(o=>Gl(o))}function qpt(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),a=BigInt(4294967295),o=Number(n>>s&a),l=Number(n&a),c=r?4:0,u=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+u,l,r)}function Gpt(t,e,n){return t&e^~t&n}function Kpt(t,e,n){return t&e^t&n^e&n}let Ypt=class extends _ae{constructor(e,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=eV(this.buffer)}update(e){rN(this);const{view:n,buffer:r,blockLen:s}=this;e=ZB(e);const a=e.length;for(let o=0;o<a;){const l=Math.min(s-this.pos,a-o);if(l===s){const c=eV(e);for(;s<=a-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){rN(this),j_e(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:a}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;qpt(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=eV(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)l.setUint32(4*f,d[f],a)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:a,destroyed:o,pos:l}=this;return e.length=s,e.pos=l,e.finished=a,e.destroyed=o,s%n&&e.buffer.set(r),e}};const Xpt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),bb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yb=new Uint32Array(64);let Qpt=class extends Ypt{constructor(e=32){super(64,e,8,!1),this.A=bb[0]|0,this.B=bb[1]|0,this.C=bb[2]|0,this.D=bb[3]|0,this.E=bb[4]|0,this.F=bb[5]|0,this.G=bb[6]|0,this.H=bb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)yb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=yb[f-15],g=yb[f-2],y=n0(x,7)^n0(x,18)^x>>>3,v=n0(g,17)^n0(g,19)^g>>>10;yb[f]=v+yb[f-7]+y+yb[f-16]|0}let{A:r,B:s,C:a,D:o,E:l,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const x=n0(l,6)^n0(l,11)^n0(l,25),g=d+x+Gpt(l,c,u)+Xpt[f]+yb[f]|0,v=(n0(r,2)^n0(r,13)^n0(r,22))+Kpt(r,s,a)|0;d=u,u=c,c=l,l=o+g|0,o=a,a=s,s=r,r=g+v|0}r=r+this.A|0,s=s+this.B|0,a=a+this.C|0,o=o+this.D|0,l=l+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,a,o,l,c,u,d)}roundClean(){yb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Y_e=E_e(()=>new Qpt);function Zpt(t,e){return Y_e(ix(t,{strict:!1})?KA(t):t)}function Jpt(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=Zpt(e);return s.set([n],0),r==="bytes"?s:Gl(s)}function X_e(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(Jpt({commitment:a,to:r,version:n}));return s}const e0e=6,Q_e=32,Gae=4096,Z_e=Q_e*Gae,t0e=Z_e*e0e-1-1*Gae*e0e,J_e=1;class emt extends Br{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class eke extends Br{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class tmt extends Br{constructor({hash:e,size:n}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class nmt extends Br{constructor({hash:e,version:n}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${J_e}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function rmt(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?hp(t.data):t.data,r=cl(n);if(!r)throw new eke;if(r>t0e)throw new emt({maxSize:t0e,size:r});const s=[];let a=!0,o=0;for(;a;){const l=Fae(new Uint8Array(Z_e));let c=0;for(;c<Gae;){const u=n.slice(o,o+(Q_e-1));if(l.pushByte(0),l.pushBytes(u),u.length<31){l.pushByte(128),a=!1;break}c++,o+=31}s.push(l)}return e==="bytes"?s.map(l=>l.bytes):s.map(l=>Gl(l.bytes))}function tke(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??rmt({data:e,to:r}),a=t.commitments??Wae({blobs:s,kzg:n,to:r}),o=t.proofs??qae({blobs:s,commitments:a,kzg:n,to:r}),l=[];for(let c=0;c<s.length;c++)l.push({blob:s[c],commitment:a[c],proof:o[c]});return l}function nke(t){if(t.type)return t.type;if(typeof t.authorizationList<"u")return"eip7702";if(typeof t.blobs<"u"||typeof t.blobVersionedHashes<"u"||typeof t.maxFeePerBlobGas<"u"||typeof t.sidecars<"u")return"eip4844";if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new Spt({transaction:t})}const rke=["blobVersionedHashes","chainId","fees","gas","nonce","type"],n0e=new Map;async function Kae(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:o,nonce:l,nonceManager:c,parameters:u=rke,type:d}=e,f=n&&Vu(n),x={...e,...f?{from:f==null?void 0:f.address}:{}};let g;async function y(){return g||(g=await ai(t,L0,"getBlock")({blockTag:"latest"}),g)}let v;async function C(){return v||(s?s.id:typeof e.chainId<"u"?e.chainId:(v=await ai(t,Dae,"getChainId")({}),v))}if(u.includes("nonce")&&typeof l>"u"&&f)if(c){const N=await C();x.nonce=await c.consume({address:f.address,chainId:N,client:t})}else x.nonce=await ai(t,K_e,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&o){const N=Wae({blobs:r,kzg:o});if(u.includes("blobVersionedHashes")){const P=X_e({commitments:N,to:"hex"});x.blobVersionedHashes=P}if(u.includes("sidecars")){const P=qae({blobs:r,commitments:N,kzg:o}),T=tke({blobs:r,commitments:N,proofs:P,to:"hex"});x.sidecars=T}}if(u.includes("chainId")&&(x.chainId=await C()),(u.includes("fees")||u.includes("type"))&&typeof d>"u")try{x.type=nke(x)}catch{let N=n0e.get(t.uid);if(typeof N>"u"){const P=await y();N=typeof(P==null?void 0:P.baseFeePerGas)=="bigint",n0e.set(t.uid,N)}x.type=N?"eip1559":"legacy"}if(u.includes("fees"))if(x.type!=="legacy"&&x.type!=="eip2930"){if(typeof x.maxFeePerGas>"u"||typeof x.maxPriorityFeePerGas>"u"){const N=await y(),{maxFeePerGas:P,maxPriorityFeePerGas:T}=await DJ(t,{block:N,chain:s,request:x});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<T)throw new Opt({maxPriorityFeePerGas:T});x.maxPriorityFeePerGas=T,x.maxFeePerGas=P}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new Bae;if(typeof e.gasPrice>"u"){const N=await y(),{gasPrice:P}=await DJ(t,{block:N,chain:s,request:x,type:"legacy"});x.gasPrice=P}}return u.includes("gas")&&typeof a>"u"&&(x.gas=await ai(t,Vae,"estimateGas")({...x,account:f&&{address:f.address,type:"json-rpc"}})),YA(x),delete x.parameters,x}async function ske(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const iV=new QB(128);async function smt(t,e){var N,P,T,M;const{account:n=t.account,chain:r=t.chain,accessList:s,authorizationList:a,blobs:o,data:l,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:x,nonce:g,value:y,...v}=e;if(typeof n>"u")throw new e$({docsPath:"/docs/actions/wallet/sendTransaction"});const C=n?Vu(n):null;try{YA(e);const F=await(async()=>{if(e.to)return e.to;if(e.to!==null&&a&&a.length>0)return await U_e({authorization:a[0]}).catch(()=>{throw new Br("`to` is required. Could not infer from `authorizationList`.")})})();if((C==null?void 0:C.type)==="json-rpc"||C===null){let $;r!==null&&($=await ai(t,Dae,"getChainId")({}),gpt({currentChainId:$,chain:r}));const L=(T=(P=(N=t.chain)==null?void 0:N.formatters)==null?void 0:P.transactionRequest)==null?void 0:T.format,X=(L||xT)({...r$(v,{format:L}),accessList:s,authorizationList:a,blobs:o,chainId:$,data:l,from:C==null?void 0:C.address,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:x,nonce:g,to:F,value:y}),ne=iV.get(t.uid),J=ne?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:J,params:[X]},{retryCount:0})}catch(K){if(ne===!1)throw K;const te=K;if(te.name==="InvalidInputRpcError"||te.name==="InvalidParamsRpcError"||te.name==="MethodNotFoundRpcError"||te.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[X]},{retryCount:0}).then(fe=>(iV.set(t.uid,!0),fe)).catch(fe=>{const q=fe;throw q.name==="MethodNotFoundRpcError"||q.name==="MethodNotSupportedRpcError"?(iV.set(t.uid,!1),te):q});throw te}}if((C==null?void 0:C.type)==="local"){const $=await ai(t,Kae,"prepareTransactionRequest")({account:C,accessList:s,authorizationList:a,blobs:o,chain:r,data:l,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:x,nonce:g,nonceManager:C.nonceManager,parameters:[...rke,"sidecars"],value:y,...v,to:F}),L=(M=r==null?void 0:r.serializers)==null?void 0:M.transaction,z=await C.signTransaction($,{serializer:L});return await ai(t,ske,"sendRawTransaction")({serializedTransaction:z})}throw(C==null?void 0:C.type)==="smart"?new sV({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new sV({docsPath:"/docs/actions/wallet/sendTransaction",type:C==null?void 0:C.type})}catch(F){throw F instanceof sV?F:Tpt(F,{...e,account:C,chain:e.chain||void 0})}}const BJ=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],$J=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],ike=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],ake=[...ike,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],imt=[...ike,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],r0e=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],s0e=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],i0e=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];function amt(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Gl(t,e);return cd(n,e)}function omt(t,e={}){let n=t;if(typeof e.size<"u"&&(Cp(n,{size:e.size}),n=Jf(n)),n.length>1||n[0]>1)throw new tht(n);return!!n[0]}function t1(t,e={}){typeof e.size<"u"&&Cp(t,{size:e.size});const n=Gl(t,e);return ax(n,e)}function lmt(t,e={}){let n=t;return typeof e.size<"u"&&(Cp(n,{size:e.size}),n=Jf(n,{dir:"right"})),new TextDecoder().decode(n)}function gT(t,e){const n=typeof e=="string"?hp(e):e,r=Fae(n);if(cl(n)===0&&t.length>0)throw new dT;if(cl(e)&&cl(e)<32)throw new w_e({data:typeof e=="string"?e:Gl(e),params:t,size:cl(e)});let s=0;const a=[];for(let o=0;o<t.length;++o){const l=t[o];r.setPosition(s);const[c,u]=w4(r,l,{staticPosition:0});s+=u,a.push(c)}return a}function w4(t,e,{staticPosition:n}){const r=Pae(e.type);if(r){const[s,a]=r;return umt(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return pmt(t,e,{staticPosition:n});if(e.type==="address")return cmt(t);if(e.type==="bool")return dmt(t);if(e.type.startsWith("bytes"))return fmt(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return hmt(t,e);if(e.type==="string")return mmt(t,{staticPosition:n});throw new Sht(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const a0e=32,UJ=32;function cmt(t){const e=t.readBytes(32);return[JB(Gl(O_e(e,-20))),32]}function umt(t,e,{length:n,staticPosition:r}){if(!n){const o=t1(t.readBytes(UJ)),l=r+o,c=l+a0e;t.setPosition(l);const u=t1(t.readBytes(a0e)),d=BE(e);let f=0;const x=[];for(let g=0;g<u;++g){t.setPosition(c+(d?g*32:f));const[y,v]=w4(t,e,{staticPosition:c});f+=v,x.push(y)}return t.setPosition(r+32),[x,32]}if(BE(e)){const o=t1(t.readBytes(UJ)),l=r+o,c=[];for(let u=0;u<n;++u){t.setPosition(l+u*32);const[d]=w4(t,e,{staticPosition:l});c.push(d)}return t.setPosition(r+32),[c,32]}let s=0;const a=[];for(let o=0;o<n;++o){const[l,c]=w4(t,e,{staticPosition:r+s});s+=c,a.push(l)}return[a,s]}function dmt(t){return[omt(t.readBytes(32),{size:32}),32]}function fmt(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const o=t1(t.readBytes(32));t.setPosition(n+o);const l=t1(t.readBytes(32));if(l===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(l);return t.setPosition(n+32),[Gl(c),32]}return[Gl(t.readBytes(Number.parseInt(s),32)),32]}function hmt(t,e){const n=e.type.startsWith("int"),r=Number.parseInt(e.type.split("int")[1]||"256"),s=t.readBytes(32);return[r>48?amt(s,{signed:n}):t1(s,{signed:n}),32]}function pmt(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:o})=>!o),s=r?[]:{};let a=0;if(BE(e)){const o=t1(t.readBytes(UJ)),l=n+o;for(let c=0;c<e.components.length;++c){const u=e.components[c];t.setPosition(l+a);const[d,f]=w4(t,u,{staticPosition:l});a+=f,s[r?c:u==null?void 0:u.name]=d}return t.setPosition(n+32),[s,32]}for(let o=0;o<e.components.length;++o){const l=e.components[o],[c,u]=w4(t,l,{staticPosition:n});s[r?o:l==null?void 0:l.name]=c,a+=u}return[s,a]}function mmt(t,{staticPosition:e}){const n=t1(t.readBytes(32)),r=e+n;t.setPosition(r);const s=t1(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),o=lmt(Jf(a));return t.setPosition(e+32),[o,32]}function BE(t){var r;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;if(e==="tuple")return(r=t.components)==null?void 0:r.some(BE);const n=Pae(t.type);return!!(n&&BE({...t,type:n[1]}))}const xmt=t=>iu(KA(t));function gmt(t){return xmt(t)}const bmt="1.0.8";let lh=class zJ extends Error{constructor(e,n={}){var o;const r=n.cause instanceof zJ?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof zJ&&n.cause.docsPath||n.docsPath,a=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${bmt}`].join(`
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}};function O1(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const oke=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,lke=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,cke=/^\(.+?\).*?$/,o0e=/^tuple(?<array>(\[(\d*)\])*)$/;function HJ(t){let e=t.type;if(o0e.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s<n;s++){const a=t.components[s];e+=HJ(a),s<n-1&&(e+=", ")}const r=O1(o0e,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,HJ({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function q8(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=HJ(s),r!==n-1&&(e+=", ")}return e}function rR(t){var e;return t.type==="function"?`function ${t.name}(${q8(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${q8(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${q8(t.inputs)})`:t.type==="error"?`error ${t.name}(${q8(t.inputs)})`:t.type==="constructor"?`constructor(${q8(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const uke=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ymt(t){return uke.test(t)}function vmt(t){return O1(uke,t)}const dke=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function wmt(t){return dke.test(t)}function Cmt(t){return O1(dke,t)}const fke=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Smt(t){return fke.test(t)}function Nmt(t){return O1(fke,t)}const hke=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Yae(t){return hke.test(t)}function Amt(t){return O1(hke,t)}const pke=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function jmt(t){return pke.test(t)}function Emt(t){return O1(pke,t)}const mke=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function _mt(t){return mke.test(t)}function kmt(t){return O1(mke,t)}const Tmt=/^receive\(\) external payable$/;function Pmt(t){return Tmt.test(t)}const Imt=new Set(["indexed"]),VJ=new Set(["calldata","memory","storage"]);class Fmt extends lh{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Omt extends lh{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Mmt extends lh{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Rmt extends lh{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Lmt extends lh{constructor({param:e,name:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Dmt extends lh{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Bmt extends lh{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class $mt extends lh{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}let XA=class extends lh{constructor({signature:e,type:n}){super(`Invalid ${n} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class Umt extends lh{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class zmt extends lh{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Hmt extends lh{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Vmt extends lh{constructor({current:e,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Wmt(t,e,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${a}})`}return e?`${e}:${t}${r}`:t}const aV=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function WJ(t,e={}){if(Smt(t))return qmt(t,e);if(wmt(t))return Gmt(t,e);if(ymt(t))return Kmt(t,e);if(jmt(t))return Ymt(t,e);if(_mt(t))return Xmt(t);if(Pmt(t))return{type:"receive",stateMutability:"payable"};throw new Umt({signature:t})}function qmt(t,e={}){const n=Nmt(t);if(!n)throw new XA({signature:t,type:"function"});const r=dm(n.parameters),s=[],a=r.length;for(let l=0;l<a;l++)s.push(B3(r[l],{modifiers:VJ,structs:e,type:"function"}));const o=[];if(n.returns){const l=dm(n.returns),c=l.length;for(let u=0;u<c;u++)o.push(B3(l[u],{modifiers:VJ,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function Gmt(t,e={}){const n=Cmt(t);if(!n)throw new XA({signature:t,type:"event"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(B3(r[o],{modifiers:Imt,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}function Kmt(t,e={}){const n=vmt(t);if(!n)throw new XA({signature:t,type:"error"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(B3(r[o],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}function Ymt(t,e={}){const n=Emt(t);if(!n)throw new XA({signature:t,type:"constructor"});const r=dm(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(B3(r[o],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function Xmt(t){const e=kmt(t);if(!e)throw new XA({signature:t,type:"fallback"});return{type:"fallback",stateMutability:e.stateMutability??"nonpayable"}}const Qmt=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Zmt=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Jmt=/^u?int$/;function B3(t,e){var f,x;const n=Wmt(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(aV.has(n))return aV.get(n);const r=cke.test(t),s=O1(r?Zmt:Qmt,t);if(!s)throw new Rmt({param:t});if(s.name&&t0t(s.name))throw new Lmt({param:t,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},l=(e==null?void 0:e.structs)??{};let c,u={};if(r){c="tuple";const g=dm(s.type),y=[],v=g.length;for(let C=0;C<v;C++)y.push(B3(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(Jmt.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!xke(c))throw new Mmt({type:c});if(s.modifier){if(!((x=(f=e==null?void 0:e.modifiers)==null?void 0:f.has)!=null&&x.call(f,s.modifier)))throw new Dmt({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(VJ.has(s.modifier)&&!n0t(c,!!s.array))throw new Bmt({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...o,...u};return aV.set(n,d),d}function dm(t,e=[],n="",r=0){const s=t.trim().length;for(let a=0;a<s;a++){const o=t[a],l=t.slice(a+1);switch(o){case",":return r===0?dm(l,[...e,n.trim()]):dm(l,e,`${n}${o}`,r);case"(":return dm(l,e,`${n}${o}`,r+1);case")":return dm(l,e,`${n}${o}`,r-1);default:return dm(l,e,`${n}${o}`,r)}}if(n==="")return e;if(r!==0)throw new Vmt({current:n,depth:r});return e.push(n.trim()),e}function xke(t){return t==="address"||t==="bool"||t==="function"||t==="string"||oke.test(t)||lke.test(t)}const e0t=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function t0t(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||oke.test(t)||lke.test(t)||e0t.test(t)}function n0t(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function gke(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!Yae(l))continue;const c=Amt(l);if(!c)throw new XA({signature:l,type:"struct"});const u=c.properties.split(";"),d=[],f=u.length;for(let x=0;x<f;x++){const y=u[x].trim();if(!y)continue;const v=B3(y,{type:"struct"});d.push(v)}if(!d.length)throw new zmt({signature:l});e[c.name]=d}const r={},s=Object.entries(e),a=s.length;for(let o=0;o<a;o++){const[l,c]=s[o];r[l]=bke(c,e)}return r}const r0t=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function bke(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(cke.test(o.type))r.push(o);else{const c=O1(r0t,o.type);if(!(c!=null&&c.type))throw new $mt({abiParameter:o});const{array:u,type:d}=c;if(d in e){if(n.has(d))throw new Hmt({type:d});r.push({...o,type:`tuple${u??""}`,components:bke(e[d]??[],e,new Set([...n,d]))})}else if(xke(d))r.push(o);else throw new Omt({type:d})}}return r}function yke(t){const e=gke(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];Yae(a)||n.push(WJ(a,e))}return n}function l0e(t){let e;if(typeof t=="string")e=WJ(t);else{const n=gke(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!Yae(a)){e=WJ(a,n);break}}}if(!e)throw new Fmt({signature:t});return e}function s0t(t){let e=!0,n="",r=0,s="",a=!1;for(let o=0;o<t.length;o++){const l=t[o];if(["(",")",","].includes(l)&&(e=!0),l==="("&&r++,l===")"&&r--,!!e){if(r===0){if(l===" "&&["event","function",""].includes(s))s="";else if(s+=l,l===")"){a=!0;break}continue}if(l===" "){t[o-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=l,n+=l}}if(!a)throw new Br("Unable to normalize signature.");return s}const i0t=t=>{const e=typeof t=="string"?t:rR(t);return s0t(e)};function vke(t){return gmt(i0t(t))}const a$=vke,bT=t=>M3(vke(t),0,4);function j5(t){const{abi:e,args:n=[],name:r}=t,s=ix(r,{strict:!1}),a=e.filter(l=>s?l.type==="function"?bT(l)===r:l.type==="event"?a$(l)===r:!1:"name"in l&&l.name===r);if(a.length===0)return;if(a.length===1)return a[0];let o;for(const l of a){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((u,d)=>{const f="inputs"in l&&l.inputs[d];return f?qJ(u,f):!1})){if(o&&"inputs"in o&&o.inputs){const u=wke(l.inputs,o.inputs,n);if(u)throw new vht({abiItem:l,type:u[0]},{abiItem:o,type:u[1]})}o=l}}return o||a[0]}function qJ(t,e){const n=typeof t,r=e.type;switch(r){case"address":return uc(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>qJ(Object.values(t)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>qJ(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function wke(t,e,n){for(const r in t){const s=t[r],a=e[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return wke(s.components,a.components,n[r]);const o=[s.type,a.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?uc(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?uc(n[r],{strict:!1}):!1)return o}}const oV="/docs/contract/decodeFunctionResult";function E5(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const l=j5({abi:e,args:n,name:r});if(!l)throw new nN(r,{docsPath:oV});a=l}if(a.type!=="function")throw new nN(void 0,{docsPath:oV});if(!a.outputs)throw new N_e(a.name,{docsPath:oV});const o=gT(a.outputs,s);if(o.length>1)return o;if(o.length===1)return o[0]}const c0e="/docs/contract/encodeFunctionData";function a0t(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=j5({abi:e,args:n,name:r});if(!a)throw new nN(r,{docsPath:c0e});s=a}if(s.type!=="function")throw new nN(void 0,{docsPath:c0e});return{abi:[s],functionName:bT(jm(s))}}function Fm(t){const{args:e}=t,{abi:n,functionName:r}=(()=>{var l;return t.abi.length===1&&((l=t.functionName)!=null&&l.startsWith("0x"))?t:a0t(t)})(),s=n[0],a=r,o="inputs"in s&&s.inputs?C2(s.inputs,e??[]):void 0;return Im([a,o??"0x"])}function QA({blockNumber:t,chain:e,contract:n}){var s;const r=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!r)throw new kJ({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new kJ({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const Cke={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Ske={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},o0t={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function l0t(t){const{abi:e,data:n}=t,r=M3(n,0,4);if(r==="0x")throw new dT;const a=[...e||[],Ske,o0t].find(o=>o.type==="error"&&r===bT(jm(o)));if(!a)throw new C_e(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?gT(a.inputs,M3(n,4)):void 0,errorName:a.name}}function Nke({abiItem:t,args:e,includeFunctionName:n=!0,includeName:r=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,a)=>`${r&&s.name?`${s.name}: `:""}${typeof e[a]=="object"?Mc(e[a]):e[a]}`).join(", ")})`}class Ake extends Br{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:o,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:x,stateOverride:g}){var C;const y=n?Vu(n):void 0;let v=mT({from:y==null?void 0:y.address,to:f,value:typeof x<"u"&&`${Oae(x)} ${((C=s==null?void 0:s.nativeCurrency)==null?void 0:C.symbol)||"ETH"}`,data:a,gas:o,gasPrice:typeof l<"u"&&`${cf(l)} gwei`,maxFeePerGas:typeof c<"u"&&`${cf(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${cf(u)} gwei`,nonce:d});g&&(v+=`
${Vpt(g)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",v].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class jke extends Br{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:o,sender:l}){const c=j5({abi:n,args:r,name:o}),u=c?Nke({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=c?jm(c,{includeName:!0}):void 0,f=mT({address:s&&Ept(s),function:d,args:u&&u!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:l});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:a,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=e,this.contractAddress=s,this.functionName=o,this.sender=l}}class GJ extends Br{constructor({abi:e,data:n,functionName:r,message:s}){let a,o,l,c;if(n&&n!=="0x")try{o=l0t({abi:e,data:n});const{abiItem:d,errorName:f,args:x}=o;if(f==="Error")c=x[0];else if(f==="Panic"){const[g]=x;c=Cke[g]}else{const g=d?jm(d,{includeName:!0}):void 0,y=d&&x?Nke({abiItem:d,args:x,includeFunctionName:!1,includeName:!1}):void 0;l=[g?`Error: ${g}`:"",y&&y!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){a=d}else s&&(c=s);let u;a instanceof C_e&&(u=a.signature,l=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`]),super(c&&c!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,c||u].join(`
`):`The contract function "${r}" reverted.`,{cause:a,metaMessages:l,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=n,this.reason=c,this.signature=u}}class c0t extends Br{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class u0t extends Br{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class o$ extends Br{constructor({data:e,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function Xae(t,e){var r,s,a,o,l,c;if(!(t instanceof Br))return!1;const n=t.walk(u=>u instanceof GJ);return n instanceof GJ?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((s=n.data)==null?void 0:s.errorName)==="ResolverWildcardNotSupported"||((a=n.data)==null?void 0:a.errorName)==="ResolverNotContract"||((o=n.data)==null?void 0:o.errorName)==="ResolverError"||((l=n.data)==null?void 0:l.errorName)==="HttpError"||(c=n.reason)!=null&&c.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&n.reason===Cke[50]):!1}function d0t(t){const{abi:e,data:n}=t,r=M3(n,0,4),s=e.find(a=>a.type==="function"&&r===bT(jm(a)));if(!s)throw new yht(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?gT(s.inputs,M3(n,4)):void 0}}const lV="/docs/contract/encodeErrorResult";function u0e(t){const{abi:e,errorName:n,args:r}=t;let s=e[0];if(n){const c=j5({abi:e,args:r,name:n});if(!c)throw new Ume(n,{docsPath:lV});s=c}if(s.type!=="error")throw new Ume(void 0,{docsPath:lV});const a=jm(s),o=bT(a);let l="0x";if(r&&r.length>0){if(!s.inputs)throw new ght(s.name,{docsPath:lV});l=C2(s.inputs,r)}return Im([o,l])}const cV="/docs/contract/encodeFunctionResult";function f0t(t){const{abi:e,functionName:n,result:r}=t;let s=e[0];if(n){const o=j5({abi:e,name:n});if(!o)throw new nN(n,{docsPath:cV});s=o}if(s.type!=="function")throw new nN(void 0,{docsPath:cV});if(!s.outputs)throw new N_e(s.name,{docsPath:cV});const a=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new A_e(r)})();return C2(s.outputs,a)}const Eke="x-batch-gateway:true";async function SCn(t){const{data:e,ccipRequest:n}=t,{args:[r]}=d0t({abi:$J,data:e}),s=[],a=[];return await Promise.all(r.map(async(o,l)=>{try{a[l]=await n(o),s[l]=!1}catch(c){s[l]=!0,a[l]=h0t(c)}})),f0t({abi:$J,functionName:"query",result:[s,a]})}function h0t(t){return t.name==="HttpRequestError"&&t.status?u0e({abi:$J,errorName:"HttpError",args:[t.status,t.shortMessage]}):u0e({abi:[Ske],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}function _ke(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return ix(e)?e:null}function PO(t){let e=new Uint8Array(32).fill(0);if(!t)return Gl(e);const n=t.split(".");for(let r=n.length-1;r>=0;r-=1){const s=_ke(n[r]),a=s?KA(s):iu(d3(n[r]),"bytes");e=iu(m1([e,a]),"bytes")}return Gl(e)}function p0t(t){return`[${t.slice(2)}]`}function m0t(t){const e=new Uint8Array(32).fill(0);return t?_ke(t)||iu(d3(t)):Gl(e)}function l$(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const n=new Uint8Array(d3(e).byteLength+2);let r=0;const s=e.split(".");for(let a=0;a<s.length;a++){let o=d3(s[a]);o.byteLength>255&&(o=d3(p0t(m0t(s[a])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}const x0t=3;function $3(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:o}){const l=t instanceof o$?t:t instanceof Br?t.walk(y=>"data"in y)||t.walk():{},{code:c,data:u,details:d,message:f,shortMessage:x}=l,g=t instanceof dT?new c0t({functionName:a}):[x0t,L3.code].includes(c)&&(u||d||f||x)?new GJ({abi:e,data:typeof u=="object"?u.data:u,functionName:a,message:l instanceof Rae?d:x??f}):t;return new jke(g,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:o})}const g0t="0x82ad56cb",kke="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",b0t="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",y0t="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";function Tke(t,{docsPath:e,...n}){const r=(()=>{const s=n$(t,n);return s instanceof pT?t:s})();return new Ake(r,{docsPath:e,...n})}function Pke(){let t=()=>{},e=()=>{};return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}const uV=new Map;function Ike({fn:t,id:e,shouldSplitBatch:n,wait:r=0,sort:s}){const a=async()=>{const d=c();o();const f=d.map(({args:x})=>x);f.length!==0&&t(f).then(x=>{s&&Array.isArray(x)&&x.sort(s);for(let g=0;g<d.length;g++){const{resolve:y}=d[g];y==null||y([x[g],x])}}).catch(x=>{for(let g=0;g<d.length;g++){const{reject:y}=d[g];y==null||y(x)}})},o=()=>uV.delete(e),l=()=>c().map(({args:d})=>d),c=()=>uV.get(e)||[],u=d=>uV.set(e,[...c(),d]);return{flush:o,async schedule(d){const{promise:f,resolve:x,reject:g}=Pke();return(n==null?void 0:n([...l(),d]))&&a(),c().length>0?(u({args:d,resolve:x,reject:g}),f):(u({args:d,resolve:x,reject:g}),setTimeout(a,r),f)}}}async function c$(t,e){var J,K,te,fe;const{account:n=t.account,batch:r=!!((J=t.batch)!=null&&J.multicall),blockNumber:s,blockTag:a="latest",accessList:o,blobs:l,code:c,data:u,factory:d,factoryData:f,gas:x,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:C,nonce:N,to:P,value:T,stateOverride:M,...F}=e,$=n?Vu(n):void 0;if(c&&(d||f))throw new Br("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&P)throw new Br("Cannot provide both `code` & `to` as parameters.");const L=c&&u,z=d&&f&&P&&u,X=L||z,ne=L?C0t({code:c,data:u}):z?S0t({data:u,factory:d,factoryData:f,to:P}):u;try{YA(e);const se=(s?zs(s):void 0)||a,ae=zae(M),W=(fe=(te=(K=t.chain)==null?void 0:K.formatters)==null?void 0:te.transactionRequest)==null?void 0:fe.format,ee=(W||xT)({...r$(F,{format:W}),from:$==null?void 0:$.address,accessList:o,blobs:l,data:ne,gas:x,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:v,maxPriorityFeePerGas:C,nonce:N,to:X?void 0:P,value:T});if(r&&v0t({request:ee})&&!ae)try{return await w0t(t,{...ee,blockNumber:s,blockTag:a})}catch(de){if(!(de instanceof z_e)&&!(de instanceof kJ))throw de}const oe=await t.request({method:"eth_call",params:ae?[ee,se,ae]:[ee,se]});return oe==="0x"?{data:void 0}:{data:oe}}catch(q){const se=N0t(q),{offchainLookup:ae,offchainLookupSignature:W}=await os(async()=>{const{offchainLookup:V,offchainLookupSignature:ee}=await import("./ccip-C4U9bs9l.js");return{offchainLookup:V,offchainLookupSignature:ee}},[]);if(t.ccipRead!==!1&&(se==null?void 0:se.slice(0,10))===W&&P)return{data:await ae(t,{data:se,to:P})};throw X&&(se==null?void 0:se.slice(0,10))==="0x101bb98d"?new u0t({factory:d}):Tke(q,{...e,account:$,chain:t.chain})}}function v0t({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(g0t)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function w0t(t,e){var v;const{batchSize:n=1024,wait:r=0}=typeof((v=t.batch)==null?void 0:v.multicall)=="object"?t.batch.multicall:{},{blockNumber:s,blockTag:a="latest",data:o,multicallAddress:l,to:c}=e;let u=l;if(!u){if(!t.chain)throw new z_e;u=QA({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=(s?zs(s):void 0)||a,{schedule:x}=Ike({id:`${t.uid}.${f}`,wait:r,shouldSplitBatch(C){return C.reduce((P,{data:T})=>P+(T.length-2),0)>n*2},fn:async C=>{const N=C.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),P=Fm({abi:BJ,args:[N],functionName:"aggregate3"}),T=await t.request({method:"eth_call",params:[{data:P,to:u},f]});return E5({abi:BJ,args:[N],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:g,success:y}]=await x({data:o,to:c});if(!y)throw new o$({data:g});return g==="0x"?{data:void 0}:{data:g}}function C0t(t){const{code:e,data:n}=t;return Iae({abi:yke(["constructor(bytes, bytes)"]),bytecode:kke,args:[e,n]})}function S0t(t){const{data:e,factory:n,factoryData:r,to:s}=t;return Iae({abi:yke(["constructor(address, bytes, address, bytes)"]),bytecode:b0t,args:[s,e,n,r]})}function N0t(t){var n;if(!(t instanceof Br))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function ox(t,e){const{abi:n,address:r,args:s,functionName:a,...o}=e,l=Fm({abi:n,args:s,functionName:a});try{const{data:c}=await ai(t,c$,"call")({...o,data:l,to:r});return E5({abi:n,args:s,functionName:a,data:c||"0x"})}catch(c){throw $3(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function A0t(t,e){const{blockNumber:n,blockTag:r,coinType:s,name:a,gatewayUrls:o,strict:l}=e,{chain:c}=t,u=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return QA({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c==null?void 0:c.ensTlds;if(d&&!d.some(f=>a.endsWith(f)))return null;try{const f=Fm({abi:s0e,functionName:"addr",...s!=null?{args:[PO(a),BigInt(s)]}:{args:[PO(a)]}}),x={address:u,abi:ake,functionName:"resolve",args:[di(l$(a)),f,o??[Eke]],blockNumber:n,blockTag:r},y=await ai(t,ox,"readContract")(x);if(y[0]==="0x")return null;const v=E5({abi:s0e,args:s!=null?[PO(a),BigInt(s)]:void 0,functionName:"addr",data:y[0]});return v==="0x"||Jf(v)==="0x00"?null:v}catch(f){if(l)throw f;if(Xae(f,"resolve"))return null;throw f}}class j0t extends Br{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}}class G8 extends Br{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class Qae extends Br{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class E0t extends Br{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const _0t=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,k0t=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,T0t=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,P0t=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function I0t(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const n=e.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=t})}}function d0e(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function Fke({uri:t,gatewayUrls:e}){const n=T0t.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=d0e(e==null?void 0:e.ipfs,"https://ipfs.io"),s=d0e(e==null?void 0:e.arweave,"https://arweave.net"),a=t.match(_0t),{protocol:o,subpath:l,target:c,subtarget:u=""}=(a==null?void 0:a.groups)||{},d=o==="ipns:/"||l==="ipns/",f=o==="ipfs:/"||l==="ipfs/"||k0t.test(t);if(t.startsWith("http")&&!d&&!f){let g=t;return e!=null&&e.arweave&&(g=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:g,isOnChain:!1,isEncoded:!1}}if((d||f)&&c)return{uri:`${r}/${d?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${s}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let x=t.replace(P0t,"");if(x.startsWith("<svg")&&(x=`data:image/svg+xml;base64,${btoa(x)}`),x.startsWith("data:")||x.startsWith("{"))return{uri:x,isOnChain:!0,isEncoded:!1};throw new Qae({uri:t})}function Oke(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new j0t({data:t});return t.image||t.image_url||t.image_data}async function F0t({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await Zae({gatewayUrls:t,uri:Oke(n)})}catch{throw new Qae({uri:e})}}async function Zae({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=Fke({uri:e,gatewayUrls:t});if(r||await I0t(n))return n;throw new Qae({uri:e})}function O0t(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=e.split("/"),[a,o]=n.split(":"),[l,c]=r.split(":");if(!a||a.toLowerCase()!=="eip155")throw new G8({reason:"Only EIP-155 supported"});if(!o)throw new G8({reason:"Chain ID not found"});if(!c)throw new G8({reason:"Contract address not found"});if(!s)throw new G8({reason:"Token ID not found"});if(!l)throw new G8({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o),namespace:l.toLowerCase(),contractAddress:c,tokenID:s}}async function M0t(t,{nft:e}){if(e.namespace==="erc721")return ox(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return ox(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new E0t({namespace:e.namespace})}async function R0t(t,{gatewayUrls:e,record:n}){return/eip155:/i.test(n)?L0t(t,{gatewayUrls:e,record:n}):Zae({uri:n,gatewayUrls:e})}async function L0t(t,{gatewayUrls:e,record:n}){const r=O0t(n),s=await M0t(t,{nft:r}),{uri:a,isOnChain:o,isEncoded:l}=Fke({uri:s,gatewayUrls:e});if(o&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const u=l?atob(a.replace("data:application/json;base64,","")):a,d=JSON.parse(u);return Zae({uri:Oke(d),gatewayUrls:e})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),F0t({gatewayUrls:e,uri:a.replace(/(?:0x)?{id}/,c)})}async function Mke(t,e){const{blockNumber:n,blockTag:r,key:s,name:a,gatewayUrls:o,strict:l}=e,{chain:c}=t,u=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return QA({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c==null?void 0:c.ensTlds;if(d&&!d.some(f=>a.endsWith(f)))return null;try{const f={address:u,abi:ake,functionName:"resolve",args:[di(l$(a)),Fm({abi:r0e,functionName:"text",args:[PO(a),s]}),o??[Eke]],blockNumber:n,blockTag:r},g=await ai(t,ox,"readContract")(f);if(g[0]==="0x")return null;const y=E5({abi:r0e,functionName:"text",data:g[0]});return y===""?null:y}catch(f){if(l)throw f;if(Xae(f,"resolve"))return null;throw f}}async function Rke(t,{blockNumber:e,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:a,strict:o,universalResolverAddress:l}){const c=await ai(t,Mke,"getEnsText")({blockNumber:e,blockTag:n,key:"avatar",name:s,universalResolverAddress:l,gatewayUrls:a,strict:o});if(!c)return null;try{return await R0t(t,{record:c,gatewayUrls:r})}catch{return null}}async function Lke(t,{address:e,blockNumber:n,blockTag:r,gatewayUrls:s,strict:a,universalResolverAddress:o}){let l=o;if(!l){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");l=QA({blockNumber:n,chain:t.chain,contract:"ensUniversalResolver"})}const c=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:l,abi:imt,functionName:"reverse",args:[di(l$(c))],blockNumber:n,blockTag:r},d=ai(t,ox,"readContract"),[f,x]=s?await d({...u,args:[...u.args,s]}):await d(u);return e.toLowerCase()!==x.toLowerCase()?null:f}catch(u){if(a)throw u;if(Xae(u,"reverse"))return null;throw u}}async function D0t(t,e){const{blockNumber:n,blockTag:r,name:s}=e,{chain:a}=t,o=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return QA({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(u=>s.endsWith(u)))throw new Error(`${s} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);const[c]=await ai(t,ox,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[di(l$(s))],blockNumber:n,blockTag:r});return c}async function Dke(t,e){var C,N,P;const{account:n=t.account,blockNumber:r,blockTag:s="latest",blobs:a,data:o,gas:l,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:d,maxPriorityFeePerGas:f,to:x,value:g,...y}=e,v=n?Vu(n):void 0;try{YA(e);const M=(r?zs(r):void 0)||s,F=(P=(N=(C=t.chain)==null?void 0:C.formatters)==null?void 0:N.transactionRequest)==null?void 0:P.format,L=(F||xT)({...r$(y,{format:F}),from:v==null?void 0:v.address,blobs:a,data:o,gas:l,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:d,maxPriorityFeePerGas:f,to:x,value:g}),z=await t.request({method:"eth_createAccessList",params:[L,M]});return{accessList:z.accessList,gasUsed:BigInt(z.gasUsed)}}catch(T){throw Tke(T,{...e,account:v,chain:t.chain})}}function u$(t,{method:e}){var r,s;const n={};return t.transport.type==="fallback"&&((s=(r=t.transport).onResponse)==null||s.call(r,({method:a,response:o,status:l,transport:c})=>{l==="success"&&e===a&&(n[o]=c.request)})),a=>n[a]||t.request}async function B0t(t){const e=u$(t,{method:"eth_newBlockFilter"}),n=await t.request({method:"eth_newBlockFilter"});return{id:n,request:e(n),type:"block"}}class $0t extends Br{constructor(e){super(`Filter type "${e}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const f0e="/docs/contract/encodeEventTopics";function yT(t){var c;const{abi:e,eventName:n,args:r}=t;let s=e[0];if(n){const u=j5({abi:e,name:n});if(!u)throw new zme(n,{docsPath:f0e});s=u}if(s.type!=="event")throw new zme(void 0,{docsPath:f0e});const a=jm(s),o=a$(a);let l=[];if(r&&"inputs"in s){const u=(c=s.inputs)==null?void 0:c.filter(f=>"indexed"in f&&f.indexed),d=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];d.length>0&&(l=(u==null?void 0:u.map((f,x)=>Array.isArray(d[x])?d[x].map((g,y)=>h0e({param:f,value:d[x][y]})):typeof d[x]<"u"&&d[x]!==null?h0e({param:f,value:d[x]}):null))??[])}return[o,...l]}function h0e({param:t,value:e}){if(t.type==="string"||t.type==="bytes")return iu(KA(e));if(t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/))throw new $0t(t.type);return C2([t],[e])}async function Bke(t,e){const{address:n,abi:r,args:s,eventName:a,fromBlock:o,strict:l,toBlock:c}=e,u=u$(t,{method:"eth_newFilter"}),d=a?yT({abi:r,args:s,eventName:a}):void 0,f=await t.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?zs(o):o,toBlock:typeof c=="bigint"?zs(c):c,topics:d}]});return{abi:r,args:s,eventName:a,id:f,request:u(f),strict:!!l,type:"event"}}async function $ke(t,{address:e,args:n,event:r,events:s,fromBlock:a,strict:o,toBlock:l}={}){const c=s??(r?[r]:void 0),u=u$(t,{method:"eth_newFilter"});let d=[];c&&(d=[c.flatMap(g=>yT({abi:[g],eventName:g.name,args:n}))],r&&(d=d[0]));const f=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof a=="bigint"?zs(a):a,toBlock:typeof l=="bigint"?zs(l):l,...d.length?{topics:d}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:a,id:f,request:u(f),strict:!!o,toBlock:l,type:"event"}}async function Uke(t){const e=u$(t,{method:"eth_newPendingTransactionFilter"}),n=await t.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:e(n),type:"transaction"}}async function U0t(t,e){const{abi:n,address:r,args:s,functionName:a,dataSuffix:o,...l}=e,c=Fm({abi:n,args:s,functionName:a});try{return await ai(t,Vae,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...l})}catch(u){const d=l.account?Vu(l.account):void 0;throw $3(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:d==null?void 0:d.address})}}async function z0t(t){const e=await t.request({method:"eth_blobBaseFee"});return BigInt(e)}const H0t=new Map,V0t=new Map;function W0t(t){const e=(s,a)=>({clear:()=>a.delete(s),get:()=>a.get(s),set:o=>a.set(s,o)}),n=e(t,H0t),r=e(t,V0t);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function q0t(t,{cacheKey:e,cacheTime:n=Number.POSITIVE_INFINITY}){const r=W0t(e),s=r.response.get();if(s&&n>0&&new Date().getTime()-s.created.getTime()<n)return s.data;let a=r.promise.get();a||(a=t(),r.promise.set(a));try{const o=await a;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const G0t=t=>`blockNumber.${t}`;async function vT(t,{cacheTime:e=t.cacheTime}={}){const n=await q0t(()=>t.request({method:"eth_blockNumber"}),{cacheKey:G0t(t.uid),cacheTime:e});return BigInt(n)}async function K0t(t,{blockHash:e,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?zs(n):void 0;let a;return e?a=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]},{dedupe:!0}):a=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),ax(a)}async function p0e(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?zs(n):void 0,a=await t.request({method:"eth_getCode",params:[e,s||r]},{dedupe:!!s});if(a!=="0x")return a}function Jae(t,e){if(!uc(t,{strict:!1}))throw new Cd({address:t});if(!uc(e,{strict:!1}))throw new Cd({address:e});return t.toLowerCase()===e.toLowerCase()}const m0e="/docs/contract/decodeEventLog";function eoe(t){const{abi:e,data:n,strict:r,topics:s}=t,a=r??!0,[o,...l]=s;if(!o)throw new bht({docsPath:m0e});const c=e.length===1?e[0]:e.find(v=>v.type==="event"&&o===a$(jm(v)));if(!(c&&"name"in c)||c.type!=="event")throw new S_e(o,{docsPath:m0e});const{name:u,inputs:d}=c,f=d==null?void 0:d.some(v=>!("name"in v&&v.name));let x=f?[]:{};const g=d.filter(v=>"indexed"in v&&v.indexed);for(let v=0;v<g.length;v++){const C=g[v],N=l[v];if(!N)throw new XB({abiItem:c,param:C});x[f?v:C.name||v]=Y0t({param:C,value:N})}const y=d.filter(v=>!("indexed"in v&&v.indexed));if(y.length>0){if(n&&n!=="0x")try{const v=gT(y,n);if(v)if(f)x=[...x,...v];else for(let C=0;C<y.length;C++)x[y[C].name]=v[C]}catch(v){if(a)throw v instanceof w_e||v instanceof D_e?new yE({abiItem:c,data:n,params:y,size:cl(n)}):v}else if(a)throw new yE({abiItem:c,data:"0x",params:y,size:0})}return{eventName:u,args:Object.values(x).length>0?x:void 0}}function Y0t({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:gT([t],e)[0]}function toe(t){const{abi:e,args:n,logs:r,strict:s=!0}=t,a=(()=>{if(t.eventName)return Array.isArray(t.eventName)?t.eventName:[t.eventName]})();return r.map(o=>{var l;try{const c=e.find(d=>d.type==="event"&&o.topics[0]===a$(d));if(!c)return null;const u=eoe({...o,abi:[c],strict:s});return a&&!a.includes(u.eventName)||!X0t({args:u.args,inputs:c.inputs,matchArgs:n})?null:{...u,...o}}catch(c){let u,d;if(c instanceof S_e)return null;if(c instanceof yE||c instanceof XB){if(s)return null;u=c.abiItem.name,d=(l=c.abiItem.inputs)==null?void 0:l.some(f=>!("name"in f&&f.name))}return{...o,args:d?[]:{},eventName:u}}}).filter(Boolean)}function X0t(t){const{args:e,inputs:n,matchArgs:r}=t;if(!r)return!0;if(!e)return!1;function s(a,o,l){try{return a.type==="address"?Jae(o,l):a.type==="string"||a.type==="bytes"?iu(KA(o))===l:o===l}catch{return!1}}return Array.isArray(e)&&Array.isArray(r)?r.every((a,o)=>{if(a==null)return!0;const l=n[o];return l?(Array.isArray(a)?a:[a]).some(u=>s(l,u,e[o])):!1}):typeof e=="object"&&!Array.isArray(e)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([a,o])=>{if(o==null)return!0;const l=n.find(u=>u.name===a);return l?(Array.isArray(o)?o:[o]).some(u=>s(l,u,e[a])):!1}):!1}function x1(t,{args:e,eventName:n}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...n?{args:e,eventName:n}:{}}}async function noe(t,{address:e,blockHash:n,fromBlock:r,toBlock:s,event:a,events:o,args:l,strict:c}={}){const u=c??!1,d=o??(a?[a]:void 0);let f=[];d&&(f=[d.flatMap(v=>yT({abi:[v],eventName:v.name,args:o?void 0:l}))],a&&(f=f[0]));let x;n?x=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,blockHash:n}]}):x=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,fromBlock:typeof r=="bigint"?zs(r):r,toBlock:typeof s=="bigint"?zs(s):s}]});const g=x.map(y=>x1(y));return d?toe({abi:d,args:l,logs:g,strict:u}):g}async function zke(t,e){const{abi:n,address:r,args:s,blockHash:a,eventName:o,fromBlock:l,toBlock:c,strict:u}=e,d=o?j5({abi:n,name:o}):void 0,f=d?void 0:n.filter(x=>x.type==="event");return ai(t,noe,"getLogs")({address:r,args:s,blockHash:a,event:d,events:f,fromBlock:l,toBlock:c,strict:u})}class Q0t extends Br{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Z0t(t,e){const{address:n,factory:r,factoryData:s}=e;try{const[a,o,l,c,u,d,f]=await ai(t,ox,"readContract")({abi:J0t,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:o,version:l,chainId:Number(c),verifyingContract:u,salt:d},extensions:f,fields:a}}catch(a){const o=a;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new Q0t({address:n}):o}}const J0t=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function ext(t){var e;return{baseFeePerGas:t.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:t.gasUsedRatio,oldestBlock:BigInt(t.oldestBlock),reward:(e=t.reward)==null?void 0:e.map(n=>n.map(r=>BigInt(r)))}}async function txt(t,{blockCount:e,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const a=n?zs(n):void 0,o=await t.request({method:"eth_feeHistory",params:[zs(e),a||r,s]},{dedupe:!!a});return ext(o)}async function d$(t,{filter:e}){const n="strict"in e&&e.strict,r=await e.request({method:"eth_getFilterChanges",params:[e.id]});if(typeof r[0]=="string")return r;const s=r.map(a=>x1(a));return!("abi"in e)||!e.abi?s:toe({abi:e.abi,logs:s,strict:n})}async function nxt(t,{filter:e}){const n=e.strict??!1,s=(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(a=>x1(a));return e.abi?toe({abi:e.abi,logs:s,strict:n}):s}async function rxt(t,{address:e,blockNumber:n,blockTag:r="latest",slot:s}){const a=n!==void 0?zs(n):void 0;return await t.request({method:"eth_getStorageAt",params:[e,s,a||r]})}async function roe(t,{blockHash:e,blockNumber:n,blockTag:r,hash:s,index:a}){var d,f,x;const o=r||"latest",l=n!==void 0?zs(n):void 0;let c=null;if(s?c=await t.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):e?c=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,zs(a)]},{dedupe:!0}):(l||o)&&(c=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||o,zs(a)]},{dedupe:!!l})),!c)throw new H_e({blockHash:e,blockNumber:n,blockTag:o,hash:s,index:a});return(((x=(f=(d=t.chain)==null?void 0:d.formatters)==null?void 0:f.transaction)==null?void 0:x.format)||i$)(c)}async function sxt(t,{hash:e,transactionReceipt:n}){const[r,s]=await Promise.all([ai(t,vT,"getBlockNumber")({}),e?ai(t,roe,"getTransaction")({hash:e}):void 0]),a=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return a?r-a+1n:0n}const ixt={"0x0":"reverted","0x1":"success"};function Hke(t){const e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(n=>x1(n)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?ax(t.transactionIndex):null,status:t.status?ixt[t.status]:null,type:t.type?q_e[t.type]||t.type:null};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),e}const axt=Lae("transactionReceipt",Hke);async function KJ(t,{hash:e}){var s,a,o;const n=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!n)throw new V_e({hash:e});return(((o=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionReceipt)==null?void 0:o.format)||Hke)(n)}async function Vke(t,e){var C;const{allowFailure:n=!0,batchSize:r,blockNumber:s,blockTag:a,multicallAddress:o,stateOverride:l}=e,c=e.contracts,u=r??(typeof((C=t.batch)==null?void 0:C.multicall)=="object"&&t.batch.multicall.batchSize||1024);let d=o;if(!d){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");d=QA({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=[[]];let x=0,g=0;for(let N=0;N<c.length;N++){const{abi:P,address:T,args:M,functionName:F}=c[N];try{const $=Fm({abi:P,args:M,functionName:F});g+=($.length-2)/2,u>0&&g>u&&f[x].length>0&&(x++,g=($.length-2)/2,f[x]=[]),f[x]=[...f[x],{allowFailure:!0,callData:$,target:T}]}catch($){const L=$3($,{abi:P,address:T,args:M,docsPath:"/docs/contract/multicall",functionName:F});if(!n)throw L;f[x]=[...f[x],{allowFailure:!0,callData:"0x",target:T}]}}const y=await Promise.allSettled(f.map(N=>ai(t,ox,"readContract")({abi:BJ,address:d,args:[N],blockNumber:s,blockTag:a,functionName:"aggregate3",stateOverride:l}))),v=[];for(let N=0;N<y.length;N++){const P=y[N];if(P.status==="rejected"){if(!n)throw P.reason;for(let M=0;M<f[N].length;M++)v.push({status:"failure",error:P.reason,result:void 0});continue}const T=P.value;for(let M=0;M<T.length;M++){const{returnData:F,success:$}=T[M],{callData:L}=f[N][M],{abi:z,address:X,functionName:ne,args:J}=c[v.length];try{if(L==="0x")throw new dT;if(!$)throw new o$({data:F});const K=E5({abi:z,args:J,data:F,functionName:ne});v.push(n?{result:K,status:"success"}:K)}catch(K){const te=$3(K,{abi:z,address:X,args:J,docsPath:"/docs/contract/multicall",functionName:ne});if(!n)throw te;v.push({error:te,result:void 0,status:"failure"})}}}if(v.length!==c.length)throw new Br("multicall results mismatch");return v}const oxt="0.1.1";function lxt(){return oxt}let kl=class YJ extends Error{constructor(e,n={}){const r=(()=>{var c;if(n.cause instanceof YJ){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof YJ&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,l=[e||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(`
`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${lxt()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return Wke(this,e)}};function Wke(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?Wke(t.cause,e):e?null:t}const cxt="#__bigint";function uxt(t,e,n){return JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString()+cxt:s,n)}function dxt(t,e){if(g0e(t)>e)throw new wxt({givenSize:g0e(t),maxSize:e})}const Gx={zero:48,nine:57,A:65,F:70,a:97,f:102};function x0e(t){if(t>=Gx.zero&&t<=Gx.nine)return t-Gx.zero;if(t>=Gx.A&&t<=Gx.F)return t-(Gx.A-10);if(t>=Gx.a&&t<=Gx.f)return t-(Gx.a-10)}function fxt(t,e={}){const{dir:n,size:r=32}=e;if(r===0)return t;if(t.length>r)throw new Cxt({size:t.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let a=0;a<r;a++){const o=n==="right";s[o?a:r-a-1]=t[o?a:t.length-a-1]}return s}function soe(t,e){if(mp(t)>e)throw new Ext({givenSize:mp(t),maxSize:e})}function hxt(t,e){if(typeof e=="number"&&e>0&&e>mp(t)-1)throw new Xke({offset:e,position:"start",size:mp(t)})}function pxt(t,e,n){if(typeof e=="number"&&typeof n=="number"&&mp(t)!==n-e)throw new Xke({offset:n,position:"end",size:mp(t)})}function qke(t,e={}){const{dir:n,size:r=32}=e;if(r===0)return t;const s=t.replace("0x","");if(s.length>r*2)throw new _xt({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const mxt=new TextEncoder;function xxt(t){return t instanceof Uint8Array?t:typeof t=="string"?bxt(t):gxt(t)}function gxt(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function bxt(t,e={}){const{size:n}=e;let r=t;n&&(soe(t,n),r=z3(t,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const a=s.length/2,o=new Uint8Array(a);for(let l=0,c=0;l<a;l++){const u=x0e(s.charCodeAt(c++)),d=x0e(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new kl(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[l]=u*16+d}return o}function yxt(t,e={}){const{size:n}=e,r=mxt.encode(t);return typeof n=="number"?(dxt(r,n),vxt(r,n)):r}function vxt(t,e){return fxt(t,{dir:"right",size:e})}function g0e(t){return t.length}let wxt=class extends kl{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Cxt=class extends kl{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Sxt=new TextEncoder,Nxt=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Axt(t,e={}){const{strict:n=!1}=e;if(!t)throw new b0e(t);if(typeof t!="string")throw new b0e(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new y0e(t);if(!t.startsWith("0x"))throw new y0e(t)}function lx(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function Gke(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(soe(n,e.size),U3(n,e.size)):n}function Kke(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=Nxt[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(soe(r,e.size),z3(r,e.size)):r}function od(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<o){const u=typeof t=="bigint"?"n":"";throw new Yke({max:a?`${a}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${t}${u}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?U3(c,r):c}function ioe(t,e={}){return Kke(Sxt.encode(t),e)}function U3(t,e){return qke(t,{dir:"left",size:e})}function z3(t,e){return qke(t,{dir:"right",size:e})}function aoe(t,e,n,r={}){const{strict:s}=r;hxt(t,e);const a=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return s&&pxt(a,e,n),a}function mp(t){return Math.ceil((t.length-2)/2)}function jxt(t,e={}){const{strict:n=!1}=e;try{return Axt(t,{strict:n}),!0}catch{return!1}}class Yke extends kl{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number \`${a}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class b0e extends kl{constructor(e){super(`Value \`${typeof e=="object"?uxt(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class y0e extends kl{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class Ext extends kl{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Xke extends kl{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class _xt extends kl{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function kxt(t){return{address:t.address,amount:od(t.amount),index:od(t.index),validatorIndex:od(t.validatorIndex)}}function Txt(t){return{...typeof t.baseFeePerGas=="bigint"&&{baseFeePerGas:od(t.baseFeePerGas)},...typeof t.blobBaseFee=="bigint"&&{blobBaseFee:od(t.blobBaseFee)},...typeof t.feeRecipient=="string"&&{feeRecipient:t.feeRecipient},...typeof t.gasLimit=="bigint"&&{gasLimit:od(t.gasLimit)},...typeof t.number=="bigint"&&{number:od(t.number)},...typeof t.prevRandao=="bigint"&&{prevRandao:od(t.prevRandao)},...typeof t.time=="bigint"&&{time:od(t.time)},...t.withdrawals&&{withdrawals:t.withdrawals.map(kxt)}}}async function XJ(t,e){const{blockNumber:n,blockTag:r="latest",blocks:s,returnFullTransactions:a,traceTransfers:o,validation:l}=e;try{const c=[];for(const x of s){const g=x.blockOverrides?Txt(x.blockOverrides):void 0,y=x.calls.map(C=>{const N=C,P=N.account?Vu(N.account):void 0,T={...N,data:N.abi?Fm(N):N.data,from:N.from??(P==null?void 0:P.address)};return YA(T),xT(T)}),v=x.stateOverrides?zae(x.stateOverrides):void 0;c.push({blockOverrides:g,calls:y,stateOverrides:v})}const d=(n?zs(n):void 0)||r;return(await t.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:a,traceTransfers:o,validation:l},d]})).map((x,g)=>({...$ae(x),calls:x.calls.map((y,v)=>{var ne,J;const{abi:C,args:N,functionName:P,to:T}=s[g].calls[v],M=((ne=y.error)==null?void 0:ne.data)??y.returnData,F=BigInt(y.gasUsed),$=(J=y.logs)==null?void 0:J.map(K=>x1(K)),L=y.status==="0x1"?"success":"failure",z=C&&L==="success"&&M!=="0x"?E5({abi:C,data:M,functionName:P}):null,X=(()=>{var te;if(L==="success")return;let K;if(((te=y.error)==null?void 0:te.data)==="0x"?K=new dT:y.error&&(K=new o$(y.error)),!!K)return $3(K,{abi:C??[],address:T,args:N,functionName:P??"<unknown>"})})();return{data:M,gasUsed:F,logs:$,status:L,...L==="success"?{result:z}:{error:X}}})}))}catch(c){const u=c,d=n$(u,{});throw d instanceof pT?u:d}}function v0e(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Pxt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function ooe(t,...e){if(!Pxt(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function w0e(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ixt(t,e){ooe(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fxt=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),C0e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Oxt=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function S0e(t){for(let e=0;e<t.length;e++)t[e]=Oxt(t[e])}function Mxt(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Qke(t){return typeof t=="string"&&(t=Mxt(t)),ooe(t),t}let Rxt=class{clone(){return this._cloneInto()}};function Lxt(t){const e=r=>t().update(Qke(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}const CI=BigInt(2**32-1),N0e=BigInt(32);function Dxt(t,e=!1){return e?{h:Number(t&CI),l:Number(t>>N0e&CI)}:{h:Number(t>>N0e&CI)|0,l:Number(t&CI)|0}}function Bxt(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:a,l:o}=Dxt(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const $xt=(t,e,n)=>t<<n|e>>>32-n,Uxt=(t,e,n)=>e<<n|t>>>32-n,zxt=(t,e,n)=>e<<n-32|t>>>64-n,Hxt=(t,e,n)=>t<<n-32|e>>>64-n,Zke=[],Jke=[],eTe=[],Vxt=BigInt(0),K8=BigInt(1),Wxt=BigInt(2),qxt=BigInt(7),Gxt=BigInt(256),Kxt=BigInt(113);for(let t=0,e=K8,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],Zke.push(2*(5*r+n)),Jke.push((t+1)*(t+2)/2%64);let s=Vxt;for(let a=0;a<7;a++)e=(e<<K8^(e>>qxt)*Kxt)%Gxt,e&Wxt&&(s^=K8<<(K8<<BigInt(a))-K8);eTe.push(s)}const[Yxt,Xxt]=Bxt(eTe,!0),A0e=(t,e,n)=>n>32?zxt(t,e,n):$xt(t,e,n),j0e=(t,e,n)=>n>32?Hxt(t,e,n):Uxt(t,e,n);function Qxt(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const l=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=A0e(u,d,1)^n[l],x=j0e(u,d,1)^n[l+1];for(let g=0;g<50;g+=10)t[o+g]^=f,t[o+g+1]^=x}let s=t[2],a=t[3];for(let o=0;o<24;o++){const l=Jke[o],c=A0e(s,a,l),u=j0e(s,a,l),d=Zke[o];s=t[d],a=t[d+1],t[d]=c,t[d+1]=u}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)n[l]=t[o+l];for(let l=0;l<10;l++)t[o+l]^=~n[(l+2)%10]&n[(l+4)%10]}t[0]^=Yxt[r],t[1]^=Xxt[r]}n.fill(0)}let Zxt=class tTe extends Rxt{constructor(e,n,r,s=!1,a=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,v0e(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Fxt(this.state)}keccak(){C0e||S0e(this.state32),Qxt(this.state32,this.rounds),C0e||S0e(this.state32),this.posOut=0,this.pos=0}update(e){w0e(this);const{blockLen:n,state:r}=this;e=Qke(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){w0e(this,!1),ooe(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,a=e.length;s<a;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,a-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return v0e(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ixt(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:a,enableXOF:o}=this;return e||(e=new tTe(n,r,s,o,a)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const Jxt=(t,e,n)=>Lxt(()=>new Zxt(e,t,n)),egt=Jxt(1,136,256/8);function nTe(t,e={}){const{as:n=typeof t=="string"?"Hex":"Bytes"}=e,r=egt(xxt(t));return n==="Bytes"?r:Kke(r)}class tgt extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const ngt={checksum:new tgt(8192)},dV=ngt.checksum,rgt=/^0x[a-fA-F0-9]{40}$/;function f$(t,e={}){const{strict:n=!0}=e;if(!rgt.test(t))throw new E0e({address:t,cause:new igt});if(n){if(t.toLowerCase()===t)return;if(sgt(t)!==t)throw new E0e({address:t,cause:new agt})}}function sgt(t){if(dV.has(t))return dV.get(t);f$(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=nTe(yxt(e),{as:"Bytes"}),r=e.split("");for(let a=0;a<40;a+=2)n[a>>1]>>4>=8&&r[a]&&(r[a]=r[a].toUpperCase()),(n[a>>1]&15)>=8&&r[a+1]&&(r[a+1]=r[a+1].toUpperCase());const s=`0x${r.join("")}`;return dV.set(t,s),s}function QJ(t,e={}){const{strict:n=!0}=e??{};try{return f$(t,{strict:n}),!0}catch{return!1}}let E0e=class extends kl{constructor({address:e,cause:n}){super(`Address "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},igt=class extends kl{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}};class agt extends kl{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function ZJ(t){let e=!0,n="",r=0,s="",a=!1;for(let o=0;o<t.length;o++){const l=t[o];if(["(",")",","].includes(l)&&(e=!0),l==="("&&r++,l===")"&&r--,!!e){if(r===0){if(l===" "&&["event","function","error",""].includes(s))s="";else if(s+=l,l===")"){a=!0;break}continue}if(l===" "){t[o-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=l,n+=l}}if(!a)throw new kl("Unable to normalize signature.");return s}function JJ(t,e){const n=typeof t,r=e.type;switch(r){case"address":return QJ(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>JJ(Object.values(t)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>JJ(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function rTe(t,e,n){for(const r in t){const s=t[r],a=e[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return rTe(s.components,a.components,n[r]);const o=[s.type,a.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?QJ(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?QJ(n[r],{strict:!1}):!1)return o}}function sTe(t,e={}){const{prepare:n=!0}=e,r=Array.isArray(t)||typeof t=="string"?l0e(t):t;return{...r,...n?{hash:n4(r)}:{}}}function ogt(t,e,n){const{args:r=[],prepare:s=!0}=n,a=jxt(e,{strict:!1}),o=t.filter(u=>a?u.type==="function"||u.type==="error"?iTe(u)===aoe(e,0,4):u.type==="event"?n4(u)===e:!1:"name"in u&&u.name===e);if(o.length===0)throw new eee({name:e});if(o.length===1)return{...o[0],...s?{hash:n4(o[0])}:{}};let l;for(const u of o){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...s?{hash:n4(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,x)=>{const g="inputs"in u&&u.inputs[x];return g?JJ(f,g):!1})){if(l&&"inputs"in l&&l.inputs){const f=rTe(u.inputs,l.inputs,r);if(f)throw new cgt({abiItem:u,type:f[0]},{abiItem:l,type:f[1]})}l=u}}const c=(()=>{if(l)return l;const[u,...d]=o;return{...u,overloads:d}})();if(!c)throw new eee({name:e});return{...c,...s?{hash:n4(c)}:{}}}function iTe(t){return aoe(n4(t),0,4)}function lgt(t){const e=typeof t=="string"?t:rR(t);return ZJ(e)}function n4(t){return typeof t!="string"&&"hash"in t&&t.hash?t.hash:nTe(ioe(lgt(t)))}class cgt extends kl{constructor(e,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${ZJ(rR(e.abiItem))}\`, and`,`\`${n.type}\` in \`${ZJ(rR(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class eee extends kl{constructor({name:e,data:n,type:r="item"}){const s=e?` with name "${e}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const ugt=/^(.*)\[([0-9]*)\]$/,dgt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,aTe=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function fgt({checksumAddress:t,parameters:e,values:n}){const r=[];for(let s=0;s<e.length;s++)r.push(loe({checksumAddress:t,parameter:e[s],value:n[s]}));return r}function loe({checksumAddress:t=!1,parameter:e,value:n}){const r=e,s=vgt(r.type);if(s){const[a,o]=s;return pgt(n,{checksumAddress:t,length:a,parameter:{...r,type:o}})}if(r.type==="tuple")return ygt(n,{checksumAddress:t,parameter:r});if(r.type==="address")return hgt(n,{checksum:t});if(r.type==="bool")return xgt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const a=r.type.startsWith("int"),[,,o="256"]=aTe.exec(r.type)??[];return ggt(n,{signed:a,size:Number(o)})}if(r.type.startsWith("bytes"))return mgt(n,{type:r.type});if(r.type==="string")return bgt(n);throw new dTe(r.type)}function coe(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?e+=32:e+=mp(l)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:o,encoded:l}=t[a];o?(n.push(od(e+s,{size:32})),r.push(l),s+=mp(l)):n.push(l)}return lx(...n,...r)}function hgt(t,e){const{checksum:n=!1}=e;return f$(t,{strict:n}),{dynamic:!1,encoded:U3(t.toLowerCase())}}function pgt(t,e){const{checksumAddress:n,length:r,parameter:s}=e,a=r===null;if(!Array.isArray(t))throw new Cgt(t);if(!a&&t.length!==r)throw new wgt({expectedLength:r,givenLength:t.length,type:`${s.type}[${r}]`});let o=!1;const l=[];for(let c=0;c<t.length;c++){const u=loe({checksumAddress:n,parameter:s,value:t[c]});u.dynamic&&(o=!0),l.push(u)}if(a||o){const c=coe(l);if(a){const u=od(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?lx(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:lx(...l.map(({encoded:c})=>c))}}function mgt(t,{type:e}){const[,n]=e.split("bytes"),r=mp(t);if(!n){let s=t;return r%32!==0&&(s=z3(s,Math.ceil((t.length-2)/2/32)*32)),{dynamic:!0,encoded:lx(U3(od(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new cTe({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:z3(t)}}function xgt(t){if(typeof t!="boolean")throw new kl(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:U3(Gke(t))}}function ggt(t,{signed:e,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-r-1n:0n;if(t>r||t<s)throw new Yke({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:od(t,{size:32,signed:e})}}function bgt(t){const e=ioe(t),n=Math.ceil(mp(e)/32),r=[];for(let s=0;s<n;s++)r.push(z3(aoe(e,s*32,(s+1)*32)));return{dynamic:!0,encoded:lx(z3(od(mp(e),{size:32})),...r)}}function ygt(t,e){const{checksumAddress:n,parameter:r}=e;let s=!1;const a=[];for(let o=0;o<r.components.length;o++){const l=r.components[o],c=Array.isArray(t)?o:l.name,u=loe({checksumAddress:n,parameter:l,value:t[c]});a.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?coe(a):lx(...a.map(({encoded:o})=>o))}}function vgt(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}function oTe(t,e,n){const{checksumAddress:r=!1}={};if(t.length!==e.length)throw new uTe({expectedLength:t.length,givenLength:e.length});const s=fgt({checksumAddress:r,parameters:t,values:e}),a=coe(s);return a.length===0?"0x":a}function lTe(t,e){if(t.length!==e.length)throw new uTe({expectedLength:t.length,givenLength:e.length});const n=[];for(let r=0;r<t.length;r++){const s=t[r],a=e[r];n.push(lTe.encode(s,a))}return lx(...n)}(function(t){function e(n,r,s=!1){if(n==="address"){const c=r;return f$(c),U3(c.toLowerCase(),s?32:0)}if(n==="string")return ioe(r);if(n==="bytes")return r;if(n==="bool")return U3(Gke(r),s?32:1);const a=n.match(aTe);if(a){const[c,u,d="256"]=a,f=Number.parseInt(d)/8;return od(r,{size:s?32:f,signed:u==="int"})}const o=n.match(dgt);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new cTe({expectedSize:Number.parseInt(u),value:r});return z3(r,s?32:0)}const l=n.match(ugt);if(l&&Array.isArray(r)){const[c,u]=l,d=[];for(let f=0;f<r.length;f++)d.push(e(u,r[f],!0));return d.length===0?"0x":lx(...d)}throw new dTe(n)}t.encode=e})(lTe);class wgt extends kl{constructor({expectedLength:e,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${e}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class cTe extends kl{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${mp(n)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class uTe extends kl{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${e}`,`Given length (values): ${n}`].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Cgt extends kl{constructor(e){super(`Value \`${e}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class dTe extends kl{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function Sgt(t,e){var s;const{bytecode:n,args:r}=e;return lx(n,(s=t.inputs)!=null&&s.length&&(r!=null&&r.length)?oTe(t.inputs,r):"0x")}function Ngt(t){return sTe(t)}function Agt(t,...e){const{overloads:n}=t,r=n?jgt([t,...n],t.name,{args:e[0]}):t,s=Egt(r),a=e.length>0?oTe(r.inputs,e[0]):void 0;return a?lx(s,a):s}function sC(t,e={}){return sTe(t,e)}function jgt(t,e,n){const r=ogt(t,e,n);if(r.type!=="function")throw new eee({name:e,type:"function"});return r}function Egt(t){return iTe(t)}const _gt="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",r0="0x0000000000000000000000000000000000000000",SI=new QB(8192);function kgt(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(SI.get(n))return SI.get(n);const r=t().finally(()=>SI.delete(n));return SI.set(n,r),r}async function tee(t){return new Promise(e=>setTimeout(e,t))}function sR(t,{delay:e=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,a)=>{const o=async({count:l=0}={})=>{const c=async({error:u})=>{const d=typeof e=="function"?e({count:l,error:u}):e;d&&await tee(d),o({count:l+1})};try{const u=await t();s(u)}catch(u){if(l<n&&await r({count:l,error:u}))return c({error:u});a(u)}};o()})}function Tgt(t,e={}){return async(n,r={})=>{var f;const{dedupe:s=!1,methods:a,retryDelay:o=150,retryCount:l=3,uid:c}={...e,...r},{method:u}=n;if((f=a==null?void 0:a.exclude)!=null&&f.includes(u))throw new uw(new Error("method not supported"),{method:u});if(a!=null&&a.include&&!a.include.includes(u))throw new uw(new Error("method not supported"),{method:u});const d=s?tN(`${c}.${Mc(n)}`):void 0;return kgt(()=>sR(async()=>{try{return await t(n)}catch(x){const g=x;switch(g.code){case wE.code:throw new wE(g);case CE.code:throw new CE(g);case SE.code:throw new SE(g,{method:n.method});case NE.code:throw new NE(g);case L3.code:throw new L3(g);case D3.code:throw new D3(g);case AE.code:throw new AE(g);case Ry.code:throw new Ry(g);case jE.code:throw new jE(g);case uw.code:throw new uw(g,{method:n.method});case sN.code:throw new sN(g);case EE.code:throw new EE(g);case So.code:throw new So(g);case _E.code:throw new _E(g);case kE.code:throw new kE(g);case TE.code:throw new TE(g);case PE.code:throw new PE(g);case pp.code:throw new pp(g);case IE.code:throw new IE(g);case FE.code:throw new FE(g);case OE.code:throw new OE(g);case ME.code:throw new ME(g);case RE.code:throw new RE(g);case LE.code:throw new LE(g);case DE.code:throw new DE(g);case 5e3:throw new So(g);default:throw x instanceof Br?x:new kpt(g)}}},{delay:({count:x,error:g})=>{var y;if(g&&g instanceof w9){const v=(y=g==null?void 0:g.headers)==null?void 0:y.get("Retry-After");if(v!=null&&v.match(/\d/))return Number.parseInt(v)*1e3}return~~(1<<x)*o},retryCount:l,shouldRetry:({error:x})=>Pgt(x)}),{enabled:s,id:d})}}function Pgt(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===sN.code||t.code===L3.code:t instanceof w9&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function h$(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function uoe(t,{errorInstance:e=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,a)=>{(async()=>{let o;try{const l=new AbortController;n>0&&(o=setTimeout(()=>{r?l.abort():a(e)},n)),s(await t({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&a(e),a(l)}finally{clearTimeout(o)}})()})}function Igt(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const _0e=Igt();function Fgt(t,e={}){return{async request(n){var f;const{body:r,onRequest:s=e.onRequest,onResponse:a=e.onResponse,timeout:o=e.timeout??1e4}=n,l={...e.fetchOptions??{},...n.fetchOptions??{}},{headers:c,method:u,signal:d}=l;try{const x=await uoe(async({signal:y})=>{const v={...l,body:Array.isArray(r)?Mc(r.map(T=>({jsonrpc:"2.0",id:T.id??_0e.take(),...T}))):Mc({jsonrpc:"2.0",id:r.id??_0e.take(),...r}),headers:{"Content-Type":"application/json",...c},method:u||"POST",signal:d||(o>0?y:null)},C=new Request(t,v),N=await(s==null?void 0:s(C,v))??{...v,url:t};return await fetch(N.url??t,N)},{errorInstance:new Qme({body:r,url:t}),timeout:o,signal:!0});a&&await a(x);let g;if((f=x.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))g=await x.json();else{g=await x.text();try{g=JSON.parse(g||"{}")}catch(y){if(x.ok)throw y;g={error:g}}}if(!x.ok)throw new w9({body:r,details:Mc(g.error)||x.statusText,headers:x.headers,status:x.status,url:t});return g}catch(x){throw x instanceof w9||x instanceof Qme?x:new w9({body:r,cause:x,url:t})}}}}class Ogt extends Br{constructor({domain:e}){super(`Invalid domain "${Mc(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class Mgt extends Br{constructor({primaryType:e,types:n}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class Rgt extends Br{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Lgt(t){const{domain:e={},message:n,primaryType:r}=t,s={EIP712Domain:gTe({domain:e}),...t.types};xTe({domain:e,message:n,primaryType:r,types:s});const a=["0x1901"];return e&&a.push(Dgt({domain:e,types:s})),r!=="EIP712Domain"&&a.push(fTe({data:n,primaryType:r,types:s})),iu(m1(a))}function Dgt({domain:t,types:e}){return fTe({data:t,primaryType:"EIP712Domain",types:e})}function fTe({data:t,primaryType:e,types:n}){const r=hTe({data:t,primaryType:e,types:n});return iu(r)}function hTe({data:t,primaryType:e,types:n}){const r=[{type:"bytes32"}],s=[Bgt({primaryType:e,types:n})];for(const a of n[e]){const[o,l]=mTe({types:n,name:a.name,type:a.type,value:t[a.name]});r.push(o),s.push(l)}return C2(r,s)}function Bgt({primaryType:t,types:e}){const n=di($gt({primaryType:t,types:e}));return iu(n)}function $gt({primaryType:t,types:e}){let n="";const r=pTe({primaryType:t,types:e});r.delete(t);const s=[t,...Array.from(r).sort()];for(const a of s)n+=`${a}(${e[a].map(({name:o,type:l})=>`${l} ${o}`).join(",")})`;return n}function pTe({primaryType:t,types:e},n=new Set){const r=t.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||e[s]===void 0)return n;n.add(s);for(const a of e[s])pTe({primaryType:a.type,types:e},n);return n}function mTe({types:t,name:e,type:n,value:r}){if(t[n]!==void 0)return[{type:"bytes32"},iu(hTe({data:r,primaryType:n,types:t}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},iu(r)];if(n==="string")return[{type:"bytes32"},iu(di(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),a=r.map(o=>mTe({name:e,type:s,types:t,value:o}));return[{type:"bytes32"},iu(C2(a.map(([o])=>o),a.map(([,o])=>o)))]}return[{type:n},r]}function Ugt(t){const{domain:e,message:n,primaryType:r,types:s}=t,a=(c,u)=>{const d={...u};for(const f of c){const{name:x,type:g}=f;g==="address"&&(d[x]=d[x].toLowerCase())}return d},o=s.EIP712Domain?e?a(s.EIP712Domain,e):{}:{},l=(()=>{if(r!=="EIP712Domain")return a(s[r],n)})();return Mc({domain:o,message:l,primaryType:r,types:s})}function xTe(t){const{domain:e,message:n,primaryType:r,types:s}=t,a=(o,l)=>{for(const c of o){const{name:u,type:d}=c,f=l[u],x=d.match(R_e);if(x&&(typeof f=="number"||typeof f=="bigint")){const[v,C,N]=x;zs(f,{signed:C==="int",size:Number.parseInt(N)/8})}if(d==="address"&&typeof f=="string"&&!uc(f))throw new Cd({address:f});const g=d.match(Qht);if(g){const[v,C]=g;if(C&&cl(f)!==Number.parseInt(C))throw new wht({expectedSize:Number.parseInt(C),givenSize:cl(f)})}const y=s[d];y&&(zgt(d),a(y,f))}};if(s.EIP712Domain&&e){if(typeof e!="object")throw new Ogt({domain:e});a(s.EIP712Domain,e)}if(r!=="EIP712Domain")if(s[r])a(s[r],n);else throw new Mgt({primaryType:r,types:s})}function gTe({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function zgt(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new Rgt({type:t})}function Hgt(t){const{authorizationList:e}=t;if(e)for(const n of e){const{chainId:r}=n,s=n.address;if(!uc(s))throw new Cd({address:s});if(r<0)throw new t$({chainId:r})}doe(t)}function Vgt(t){const{blobVersionedHashes:e}=t;if(e){if(e.length===0)throw new eke;for(const n of e){const r=cl(n),s=ax(M3(n,0,1));if(r!==32)throw new tmt({hash:n,size:r});if(s!==J_e)throw new nmt({hash:n,version:s})}}doe(t)}function doe(t){const{chainId:e,maxPriorityFeePerGas:n,maxFeePerGas:r,to:s}=t;if(e<=0)throw new t$({chainId:e});if(s&&!uc(s))throw new Cd({address:s});if(r&&r>s$)throw new R3({maxFeePerGas:r});if(n&&r&&n>r)throw new vE({maxFeePerGas:r,maxPriorityFeePerGas:n})}function Wgt(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(e<=0)throw new t$({chainId:e});if(a&&!uc(a))throw new Cd({address:a});if(n||s)throw new Br("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>s$)throw new R3({maxFeePerGas:r})}function qgt(t){const{chainId:e,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:s,to:a}=t;if(a&&!uc(a))throw new Cd({address:a});if(typeof e<"u"&&e<=0)throw new t$({chainId:e});if(n||s)throw new Br("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>s$)throw new R3({maxFeePerGas:r})}function p$(t){if(!t||t.length===0)return[];const e=[];for(let n=0;n<t.length;n++){const{address:r,storageKeys:s}=t[n];for(let a=0;a<s.length;a++)if(s[a].length-2!==64)throw new Npt({storageKey:s[a]});if(!uc(r,{strict:!1}))throw new Cd({address:r});e.push([r,s])}return e}function Ggt(t,e){const n=nke(t);return n==="eip1559"?Xgt(t,e):n==="eip2930"?Qgt(t,e):n==="eip4844"?Ygt(t,e):n==="eip7702"?Kgt(t,e):Zgt(t,e)}function Kgt(t,e){const{authorizationList:n,chainId:r,gas:s,nonce:a,to:o,value:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;Hgt(t);const x=p$(d),g=Jgt(n);return Im(["0x04",Jy([di(r),a?di(a):"0x",u?di(u):"0x",c?di(c):"0x",s?di(s):"0x",o??"0x",l?di(l):"0x",f??"0x",x,g,...wT(t,e)])])}function Ygt(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerBlobGas:l,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f}=t;Vgt(t);let x=t.blobVersionedHashes,g=t.sidecars;if(t.blobs&&(typeof x>"u"||typeof g>"u")){const T=typeof t.blobs[0]=="string"?t.blobs:t.blobs.map($=>Gl($)),M=t.kzg,F=Wae({blobs:T,kzg:M});if(typeof x>"u"&&(x=X_e({commitments:F})),typeof g>"u"){const $=qae({blobs:T,commitments:F,kzg:M});g=tke({blobs:T,commitments:F,proofs:$})}}const y=p$(d),v=[di(n),s?di(s):"0x",u?di(u):"0x",c?di(c):"0x",r?di(r):"0x",a??"0x",o?di(o):"0x",f??"0x",y,l?di(l):"0x",x??[],...wT(t,e)],C=[],N=[],P=[];if(g)for(let T=0;T<g.length;T++){const{blob:M,commitment:F,proof:$}=g[T];C.push(M),N.push(F),P.push($)}return Im(["0x03",Jy(g?[v,C,N,P]:v)])}function Xgt(t,e){const{chainId:n,gas:r,nonce:s,to:a,value:o,maxFeePerGas:l,maxPriorityFeePerGas:c,accessList:u,data:d}=t;doe(t);const f=p$(u),x=[di(n),s?di(s):"0x",c?di(c):"0x",l?di(l):"0x",r?di(r):"0x",a??"0x",o?di(o):"0x",d??"0x",f,...wT(t,e)];return Im(["0x02",Jy(x)])}function Qgt(t,e){const{chainId:n,gas:r,data:s,nonce:a,to:o,value:l,accessList:c,gasPrice:u}=t;Wgt(t);const d=p$(c),f=[di(n),a?di(a):"0x",u?di(u):"0x",r?di(r):"0x",o??"0x",l?di(l):"0x",s??"0x",d,...wT(t,e)];return Im(["0x01",Jy(f)])}function Zgt(t,e){const{chainId:n=0,gas:r,data:s,nonce:a,to:o,value:l,gasPrice:c}=t;qgt(t);let u=[a?di(a):"0x",c?di(c):"0x",r?di(r):"0x",o??"0x",l?di(l):"0x",s??"0x"];if(e){const d=(()=>{if(e.v>=35n)return(e.v-35n)/2n>0?e.v:27n+(e.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+e.v-27n);const g=27n+(e.v===27n?0n:1n);if(e.v!==g)throw new Cpt({v:e.v});return g})(),f=Jf(e.r),x=Jf(e.s);u=[...u,di(d),f==="0x00"?"0x":f,x==="0x00"?"0x":x]}else n>0&&(u=[...u,di(n),"0x","0x"]);return Jy(u)}function wT(t,e){const n=e??t,{v:r,yParity:s}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof r>"u"&&typeof s>"u")return[];const a=Jf(n.r),o=Jf(n.s);return[typeof s=="number"?s?di(1):"0x":r===0n?"0x":r===1n?di(1):r===27n?"0x":di(1),a==="0x00"?"0x":a,o==="0x00"?"0x":o]}function Jgt(t){if(!t||t.length===0)return[];const e=[];for(const n of t){const{chainId:r,nonce:s,...a}=n,o=n.address;e.push([r?di(r):"0x",o,s?di(s):"0x",...wT({},a)])}return e}const e1t=`Ethereum Signed Message:
`;function t1t(t){const e=typeof t=="string"?tN(t):typeof t.raw=="string"?t.raw:Gl(t.raw),n=tN(`${e1t}${cl(e)}`);return m1([n,e])}function bTe(t,e){return iu(t1t(t),e)}const yTe="0x6492649264926492649264926492649264926492649264926492649264926492";function n1t(t){return M_e(t,-32)===yTe}function r1t(t){const{address:e,data:n,signature:r,to:s="hex"}=t,a=Im([C2([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,n,r]),yTe]);return s==="hex"?a:hp(a)}class s1t extends Br{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function i1t(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new s1t({value:t});let[n,r="0"]=t.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),e===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>e){const[a,o,l]=[r.slice(0,e-1),r.slice(e-1,e),r.slice(e)],c=Math.round(+`${o}.${l}`);c>9?r=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):r=`${a}${c}`,r.length>e&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,e)}else r=r.padEnd(e,"0");return BigInt(`${s?"-":""}${n}${r}`)}const a1t="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function o1t(t,e){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:a,traceAssetChanges:o,traceTransfers:l,validation:c}=e,u=e.account?Vu(e.account):void 0;if(o&&!u)throw new Br("`account` is required when `traceAssetChanges` is true");const d=u?Sgt(Ngt("constructor(bytes, bytes)"),{bytecode:kke,args:[a1t,Agt(sC("function getBalance(address)"),[u.address])]}):void 0,f=o?await Promise.all(e.calls.map(async V=>{if(!V.data&&!V.abi)return;const{accessList:ee}=await Dke(t,{account:u.address,...V,data:V.abi?Fm(V):V.data});return ee.map(({address:oe,storageKeys:de})=>de.length>0?oe:null)})).then(V=>V.flat().filter(Boolean)):[],x=a==null?void 0:a.map(V=>V.address===(u==null?void 0:u.address)?{...V,nonce:0}:V),g=await XJ(t,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:d}],stateOverrides:a},{calls:f.map((V,ee)=>({abi:[sC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:V,from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]}]:[],{calls:[...s,{}].map((V,ee)=>({...V,from:u==null?void 0:u.address,nonce:ee})),stateOverrides:x},...o?[{calls:[{data:d}]},{calls:f.map((V,ee)=>({abi:[sC("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:V,from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((V,ee)=>({to:V,abi:[sC("function decimals() returns (uint256)")],functionName:"decimals",from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((V,ee)=>({to:V,abi:[sC("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]},{calls:f.map((V,ee)=>({to:V,abi:[sC("function symbol() returns (string)")],functionName:"symbol",from:r0,nonce:ee})),stateOverrides:[{address:r0,nonce:0}]}]:[]],traceTransfers:l,validation:c}),y=o?g[2]:g[0],[v,C,,N,P,T,M,F]=o?g:[],{calls:$,...L}=y,z=$.slice(0,-1)??[],X=(v==null?void 0:v.calls)??[],ne=(C==null?void 0:C.calls)??[],J=[...X,...ne].map(V=>V.status==="success"?cd(V.data):null),K=(N==null?void 0:N.calls)??[],te=(P==null?void 0:P.calls)??[],fe=[...K,...te].map(V=>V.status==="success"?cd(V.data):null),q=((T==null?void 0:T.calls)??[]).map(V=>V.status==="success"?V.result:null),se=((F==null?void 0:F.calls)??[]).map(V=>V.status==="success"?V.result:null),ae=((M==null?void 0:M.calls)??[]).map(V=>V.status==="success"?V.result:null),W=[];for(const[V,ee]of fe.entries()){const oe=J[V];if(typeof ee!="bigint"||typeof oe!="bigint")continue;const de=q[V-1],Ce=se[V-1],me=ae[V-1],we=V===0?{address:_gt,decimals:18,symbol:"ETH"}:{address:f[V-1],decimals:me||de?Number(de??1):void 0,symbol:Ce??void 0};W.some(xe=>xe.token.address===we.address)||W.push({token:we,value:{pre:oe,post:ee,diff:ee-oe}})}return{assetChanges:W,block:L,results:z}}const fV=new Map,k0e=new Map;let l1t=0;function e2(t,e,n){const r=++l1t,s=()=>fV.get(t)||[],a=()=>{const d=s();fV.set(t,d.filter(f=>f.id!==r))},o=()=>{const d=s();if(!d.some(x=>x.id===r))return;const f=k0e.get(t);d.length===1&&f&&f(),a()},l=s();if(fV.set(t,[...l,{id:r,fns:e}]),l.length>0)return o;const c={};for(const d in e)c[d]=(...f)=>{var g,y;const x=s();if(x.length!==0)for(const v of x)(y=(g=v.fns)[d])==null||y.call(g,...f)};const u=n(c);return typeof u=="function"&&k0e.set(t,u),o}function CT(t,{emitOnBegin:e,initialWaitTime:n,interval:r}){let s=!0;const a=()=>s=!1;return(async()=>{let l;e&&(l=await t({unpoll:a}));const c=await(n==null?void 0:n(l))??r;await tee(c);const u=async()=>{s&&(await t({unpoll:a}),await tee(r),u())};u()})(),a}function c1t(t,{blockTag:e="latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:a,includeTransactions:o,poll:l,pollingInterval:c=t.pollingInterval}){const u=typeof l<"u"?l:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket"),d=o??!1;let f;return u?(()=>{const y=Mc(["watchBlocks",t.uid,e,n,r,d,c]);return e2(y,{onBlock:s,onError:a},v=>CT(async()=>{var C;try{const N=await ai(t,L0,"getBlock")({blockTag:e,includeTransactions:d});if(N.number&&(f!=null&&f.number)){if(N.number===f.number)return;if(N.number-f.number>1&&n)for(let P=(f==null?void 0:f.number)+1n;P<N.number;P++){const T=await ai(t,L0,"getBlock")({blockNumber:P,includeTransactions:d});v.onBlock(T,f),f=T}}(!(f!=null&&f.number)||e==="pending"&&!(N!=null&&N.number)||N.number&&N.number>f.number)&&(v.onBlock(N,f),f=N)}catch(N){(C=v.onError)==null||C.call(v,N)}},{emitOnBegin:r,interval:c}))})():(()=>{let y=!0,v=!0,C=()=>y=!1;return(async()=>{try{r&&ai(t,L0,"getBlock")({blockTag:e,includeTransactions:d}).then(T=>{y&&v&&(s(T,void 0),v=!1)});const N=(()=>{if(t.transport.type==="fallback"){const T=t.transport.transports.find(M=>M.config.type==="webSocket");return T?T.value:t.transport}return t.transport})(),{unsubscribe:P}=await N.subscribe({params:["newHeads"],async onData(T){if(!y)return;const M=await ai(t,L0,"getBlock")({blockNumber:T.blockNumber,includeTransactions:d}).catch(()=>{});y&&(s(M,f),v=!1,f=M)},onError(T){a==null||a(T)}});C=P,y||C()}catch(N){a==null||a(N)}})(),()=>C()})()}function vTe(t,{emitOnBegin:e=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:a,pollingInterval:o=t.pollingInterval}){const l=typeof a<"u"?a:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket");let c;return l?(()=>{const f=Mc(["watchBlockNumber",t.uid,e,n,o]);return e2(f,{onBlockNumber:r,onError:s},x=>CT(async()=>{var g;try{const y=await ai(t,vT,"getBlockNumber")({cacheTime:0});if(c){if(y===c)return;if(y-c>1&&n)for(let v=c+1n;v<y;v++)x.onBlockNumber(v,c),c=v}(!c||y>c)&&(x.onBlockNumber(y,c),c=y)}catch(y){(g=x.onError)==null||g.call(x,y)}},{emitOnBegin:e,interval:o}))})():(()=>{const f=Mc(["watchBlockNumber",t.uid,e,n]);return e2(f,{onBlockNumber:r,onError:s},x=>{let g=!0,y=()=>g=!1;return(async()=>{try{const v=(()=>{if(t.transport.type==="fallback"){const N=t.transport.transports.find(P=>P.config.type==="webSocket");return N?N.value:t.transport}return t.transport})(),{unsubscribe:C}=await v.subscribe({params:["newHeads"],onData(N){var T;if(!g)return;const P=cd((T=N.result)==null?void 0:T.number);x.onBlockNumber(P,c),c=P},onError(N){var P;(P=x.onError)==null||P.call(x,N)}});y=C,g||y()}catch(v){s==null||s(v)}})(),()=>y()})})()}async function m$(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function u1t(t,{address:e,args:n,batch:r=!0,event:s,events:a,fromBlock:o,onError:l,onLogs:c,poll:u,pollingInterval:d=t.pollingInterval,strict:f}){const x=typeof u<"u"?u:typeof o=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket"),g=f??!1;return x?(()=>{const C=Mc(["watchEvent",e,n,r,t.uid,s,d,o]);return e2(C,{onLogs:c,onError:l},N=>{let P;o!==void 0&&(P=o-1n);let T,M=!1;const F=CT(async()=>{var $;if(!M){try{T=await ai(t,$ke,"createEventFilter")({address:e,args:n,event:s,events:a,strict:g,fromBlock:o})}catch{}M=!0;return}try{let L;if(T)L=await ai(t,d$,"getFilterChanges")({filter:T});else{const z=await ai(t,vT,"getBlockNumber")({});P&&P!==z?L=await ai(t,noe,"getLogs")({address:e,args:n,event:s,events:a,fromBlock:P+1n,toBlock:z}):L=[],P=z}if(L.length===0)return;if(r)N.onLogs(L);else for(const z of L)N.onLogs([z])}catch(L){T&&L instanceof D3&&(M=!1),($=N.onError)==null||$.call(N,L)}},{emitOnBegin:!0,interval:d});return async()=>{T&&await ai(t,m$,"uninstallFilter")({filter:T}),F()}})})():(()=>{let C=!0,N=()=>C=!1;return(async()=>{try{const P=(()=>{if(t.transport.type==="fallback"){const $=t.transport.transports.find(L=>L.config.type==="webSocket");return $?$.value:t.transport}return t.transport})(),T=a??(s?[s]:void 0);let M=[];T&&(M=[T.flatMap(L=>yT({abi:[L],eventName:L.name,args:n}))],s&&(M=M[0]));const{unsubscribe:F}=await P.subscribe({params:["logs",{address:e,topics:M}],onData($){var z;if(!C)return;const L=$.result;try{const{eventName:X,args:ne}=eoe({abi:T??[],data:L.data,topics:L.topics,strict:g}),J=x1(L,{args:ne,eventName:X});c([J])}catch(X){let ne,J;if(X instanceof yE||X instanceof XB){if(f)return;ne=X.abiItem.name,J=(z=X.abiItem.inputs)==null?void 0:z.some(te=>!("name"in te&&te.name))}const K=x1(L,{args:J?[]:{},eventName:ne});c([K])}},onError($){l==null||l($)}});N=F,C||N()}catch(P){l==null||l(P)}})(),()=>N()})()}function d1t(t,{batch:e=!0,onError:n,onTransactions:r,poll:s,pollingInterval:a=t.pollingInterval}){return(typeof s<"u"?s:t.transport.type!=="webSocket")?(()=>{const u=Mc(["watchPendingTransactions",t.uid,e,a]);return e2(u,{onTransactions:r,onError:n},d=>{let f;const x=CT(async()=>{var g;try{if(!f)try{f=await ai(t,Uke,"createPendingTransactionFilter")({});return}catch(v){throw x(),v}const y=await ai(t,d$,"getFilterChanges")({filter:f});if(y.length===0)return;if(e)d.onTransactions(y);else for(const v of y)d.onTransactions([v])}catch(y){(g=d.onError)==null||g.call(d,y)}},{emitOnBegin:!0,interval:a});return async()=>{f&&await ai(t,m$,"uninstallFilter")({filter:f}),x()}})})():(()=>{let u=!0,d=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await t.transport.subscribe({params:["newPendingTransactions"],onData(x){if(!u)return;const g=x.result;r([g])},onError(x){n==null||n(x)}});d=f,u||d()}catch(f){n==null||n(f)}})(),()=>d()})()}function f1t(t){return t.map(e=>({...e,value:BigInt(e.value)}))}function h1t(t){return{...t,balance:t.balance?BigInt(t.balance):void 0,nonce:t.nonce?ax(t.nonce):void 0,storageProof:t.storageProof?f1t(t.storageProof):void 0}}async function p1t(t,{address:e,blockNumber:n,blockTag:r,storageKeys:s}){const a=r??"latest",o=n!==void 0?zs(n):void 0,l=await t.request({method:"eth_getProof",params:[e,s,o||a]});return h1t(l)}async function m1t(t,{confirmations:e=1,hash:n,onReplaced:r,pollingInterval:s=t.pollingInterval,retryCount:a=6,retryDelay:o=({count:c})=>~~(1<<c)*200,timeout:l=18e4}){const c=Mc(["waitForTransactionReceipt",t.uid,n]);let u,d,f,x=!1;const{promise:g,resolve:y,reject:v}=Pke(),C=l?setTimeout(()=>v(new jpt({hash:n})),l):void 0,N=e2(c,{onReplaced:r,resolve:y,reject:v},P=>{const T=ai(t,vTe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:s,async onBlockNumber(M){const F=L=>{clearTimeout(C),T(),L(),N()};let $=M;if(!x)try{if(f){if(e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>P.resolve(f));return}if(u||(x=!0,await sR(async()=>{u=await ai(t,roe,"getTransaction")({hash:n}),u.blockNumber&&($=u.blockNumber)},{delay:o,retryCount:a}),x=!1),f=await ai(t,KJ,"getTransactionReceipt")({hash:n}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e))return;F(()=>P.resolve(f))}catch(L){if(L instanceof H_e||L instanceof V_e){if(!u){x=!1;return}try{d=u,x=!0;const z=await sR(()=>ai(t,L0,"getBlock")({blockNumber:$,includeTransactions:!0}),{delay:o,retryCount:a,shouldRetry:({error:J})=>J instanceof W_e});x=!1;const X=z.transactions.find(({from:J,nonce:K})=>J===d.from&&K===d.nonce);if(!X||(f=await ai(t,KJ,"getTransactionReceipt")({hash:X.hash}),e>1&&(!f.blockNumber||$-f.blockNumber+1n<e)))return;let ne="replaced";X.to===d.to&&X.value===d.value&&X.input===d.input?ne="repriced":X.from===X.to&&X.value===0n&&(ne="cancelled"),F(()=>{var J;(J=P.onReplaced)==null||J.call(P,{reason:ne,replacedTransaction:d,transaction:X,transactionReceipt:f}),P.resolve(f)})}catch(z){F(()=>P.reject(z))}}else F(()=>P.reject(L))}}})});return g}async function x1t(t,{account:e=t.account,message:n}){if(!e)throw new e$({docsPath:"/docs/actions/wallet/signMessage"});const r=Vu(e);if(r.signMessage)return r.signMessage({message:n});const s=typeof n=="string"?tN(n):n.raw instanceof Uint8Array?di(n.raw):n.raw;return t.request({method:"personal_sign",params:[s,r.address]},{retryCount:0})}async function g1t(t,e){const{account:n=t.account,domain:r,message:s,primaryType:a}=e;if(!n)throw new e$({docsPath:"/docs/actions/wallet/signTypedData"});const o=Vu(n),l={EIP712Domain:gTe({domain:r}),...e.types};if(xTe({domain:r,message:s,primaryType:a,types:l}),o.signTypedData)return o.signTypedData({domain:r,message:s,primaryType:a,types:l});const c=Ugt({domain:r,message:s,primaryType:a,types:l});return t.request({method:"eth_signTypedData_v4",params:[o.address,c]},{retryCount:0})}async function b1t(t,e){const{abi:n,address:r,args:s,dataSuffix:a,functionName:o,...l}=e,c=l.account?Vu(l.account):t.account,u=Fm({abi:n,args:s,functionName:o});try{const{data:d}=await ai(t,c$,"call")({batch:!1,data:`${u}${a?a.replace("0x",""):""}`,to:r,...l,account:c}),f=E5({abi:n,args:s,functionName:o,data:d||"0x"}),x=n.filter(g=>"name"in g&&g.name===e.functionName);return{result:f,request:{abi:x,address:r,args:s,dataSuffix:a,functionName:o,...l,account:c}}}catch(d){throw $3(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:o,sender:c==null?void 0:c.address})}}let wTe=class extends _ae{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Eht(e);const r=ZB(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<a.length;o++)a[o]^=54;this.iHash.update(a),this.oHash=e.create();for(let o=0;o<a.length;o++)a[o]^=106;this.oHash.update(a),a.fill(0)}update(e){return rN(this),this.iHash.update(e),this}digestInto(e){rN(this),fT(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:a,blockLen:o,outputLen:l}=this;return e=e,e.finished=s,e.destroyed=a,e.blockLen=o,e.outputLen=l,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const CTe=(t,e,n)=>new wTe(t,e).update(n).digest();CTe.create=(t,e)=>new wTe(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const foe=BigInt(0),nee=BigInt(1);function iN(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function hoe(t){if(!iN(t))throw new Error("Uint8Array expected")}function $E(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function NI(t){const e=t.toString(16);return e.length&1?"0"+e:e}function STe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?foe:BigInt("0x"+t)}const NTe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",y1t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function UE(t){if(hoe(t),NTe)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=y1t[t[n]];return e}const Kx={_0:48,_9:57,A:65,F:70,a:97,f:102};function T0e(t){if(t>=Kx._0&&t<=Kx._9)return t-Kx._0;if(t>=Kx.A&&t<=Kx.F)return t-(Kx.A-10);if(t>=Kx.a&&t<=Kx.f)return t-(Kx.a-10)}function iR(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(NTe)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let s=0,a=0;s<n;s++,a+=2){const o=T0e(t.charCodeAt(a)),l=T0e(t.charCodeAt(a+1));if(o===void 0||l===void 0){const c=t[a]+t[a+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+a)}r[s]=o*16+l}return r}function f3(t){return STe(UE(t))}function ATe(t){return hoe(t),STe(UE(Uint8Array.from(t).reverse()))}function zE(t,e){return iR(t.toString(16).padStart(e*2,"0"))}function jTe(t,e){return zE(t,e).reverse()}function Gp(t,e,n){let r;if(typeof e=="string")try{r=iR(e)}catch(a){throw new Error(t+" must be hex string or Uint8Array, cause: "+a)}else if(iN(e))r=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return r}function aR(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];hoe(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const a=t[r];n.set(a,s),s+=a.length}return n}const hV=t=>typeof t=="bigint"&&foe<=t;function poe(t,e,n){return hV(t)&&hV(e)&&hV(n)&&e<=t&&t<n}function C4(t,e,n,r){if(!poe(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function v1t(t){let e;for(e=0;t>foe;t>>=nee,e+=1);return e}const x$=t=>(nee<<BigInt(t))-nee,pV=t=>new Uint8Array(t),P0e=t=>Uint8Array.from(t);function w1t(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=pV(t),s=pV(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=pV(0))=>{s=l(P0e([0]),f),r=l(),f.length!==0&&(s=l(P0e([1]),f),r=l())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const x=[];for(;f<e;){r=l();const g=r.slice();x.push(g),f+=r.length}return aR(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const C1t={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||iN(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function g$(t,e,n={}){const r=(s,a,o)=>{const l=C1t[a];if(typeof l!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!l(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+a+", got "+c)};for(const[s,a]of Object.entries(e))r(s,a,!1);for(const[s,a]of Object.entries(n))r(s,a,!0);return t}function I0e(t){const e=new WeakMap;return(n,...r)=>{const s=e.get(n);if(s!==void 0)return s;const a=t(n,...r);return e.set(n,a),a}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pc=BigInt(0),Cl=BigInt(1),Jv=BigInt(2),S1t=BigInt(3),ree=BigInt(4),F0e=BigInt(5),O0e=BigInt(8);function Yd(t,e){const n=t%e;return n>=Pc?n:e+n}function N1t(t,e,n){if(e<Pc)throw new Error("invalid exponent, negatives unsupported");if(n<=Pc)throw new Error("invalid modulus");if(n===Cl)return Pc;let r=Cl;for(;e>Pc;)e&Cl&&(r=r*t%n),t=t*t%n,e>>=Cl;return r}function Ah(t,e,n){let r=t;for(;e-- >Pc;)r*=r,r%=n;return r}function see(t,e){if(t===Pc)throw new Error("invert: expected non-zero number");if(e<=Pc)throw new Error("invert: expected positive modulus, got "+e);let n=Yd(t,e),r=e,s=Pc,a=Cl;for(;n!==Pc;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==Cl)throw new Error("invert: does not exist");return Yd(s,e)}function A1t(t){const e=(t-Cl)/Jv;let n,r,s;for(n=t-Cl,r=0;n%Jv===Pc;n/=Jv,r++);for(s=Jv;s<t&&N1t(s,e,t)!==t-Cl;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(t+Cl)/ree;return function(c,u){const d=c.pow(u,o);if(!c.eql(c.sqr(d),u))throw new Error("Cannot find square root");return d}}const a=(n+Cl)/Jv;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,Cl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function j1t(t){if(t%ree===S1t){const e=(t+Cl)/ree;return function(r,s){const a=r.pow(s,e);if(!r.eql(r.sqr(a),s))throw new Error("Cannot find square root");return a}}if(t%O0e===F0e){const e=(t-F0e)/O0e;return function(r,s){const a=r.mul(s,Jv),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,Jv),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return A1t(t)}const E1t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function _1t(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=E1t.reduce((r,s)=>(r[s]="function",r),e);return g$(t,n)}function k1t(t,e,n){if(n<Pc)throw new Error("invalid exponent, negatives unsupported");if(n===Pc)return t.ONE;if(n===Cl)return e;let r=t.ONE,s=e;for(;n>Pc;)n&Cl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Cl;return r}function T1t(t,e){const n=new Array(e.length),r=e.reduce((a,o,l)=>t.is0(o)?a:(n[l]=a,t.mul(a,o)),t.ONE),s=t.inv(r);return e.reduceRight((a,o,l)=>t.is0(o)?a:(n[l]=t.mul(a,n[l]),t.mul(a,o)),s),n}function ETe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function _Te(t,e,n=!1,r={}){if(t<=Pc)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:a}=ETe(t,e);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const l=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:a,MASK:x$(s),ZERO:Pc,ONE:Cl,create:c=>Yd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Pc<=c&&c<t},is0:c=>c===Pc,isOdd:c=>(c&Cl)===Cl,neg:c=>Yd(-c,t),eql:(c,u)=>c===u,sqr:c=>Yd(c*c,t),add:(c,u)=>Yd(c+u,t),sub:(c,u)=>Yd(c-u,t),mul:(c,u)=>Yd(c*u,t),pow:(c,u)=>k1t(l,c,u),div:(c,u)=>Yd(c*see(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>see(c,t),sqrt:r.sqrt||(c=>(o||(o=j1t(t)),o(l,c))),invertBatch:c=>T1t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?jTe(c,a):zE(c,a),fromBytes:c=>{if(c.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+c.length);return n?ATe(c):f3(c)}});return Object.freeze(l)}function kTe(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function TTe(t){const e=kTe(t);return e+Math.ceil(e/2)}function P1t(t,e,n=!1){const r=t.length,s=kTe(e),a=TTe(e);if(r<16||r<a||r>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+r);const o=n?ATe(t):f3(t),l=Yd(o,e-Cl)+Cl;return n?jTe(l,s):zE(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const M0e=BigInt(0),iee=BigInt(1);function mV(t,e){const n=e.negate();return t?n:e}function PTe(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function xV(t,e){PTe(t,e);const n=Math.ceil(e/t)+1,r=2**(t-1),s=2**t,a=x$(t),o=BigInt(t);return{windows:n,windowSize:r,mask:a,maxNumber:s,shiftBy:o}}function R0e(t,e,n){const{windowSize:r,mask:s,maxNumber:a,shiftBy:o}=n;let l=Number(t&s),c=t>>o;l>r&&(l-=a,c+=iee);const u=e*r,d=u+Math.abs(l)-1,f=l===0,x=l<0,g=e%2!==0;return{nextN:c,offset:d,isZero:f,isNeg:x,isNegF:g,offsetF:u}}function I1t(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,r)=>{if(!(n instanceof e))throw new Error("invalid point at index "+r)})}function F1t(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,r)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+r)})}const gV=new WeakMap,ITe=new WeakMap;function bV(t){return ITe.get(t)||1}function O1t(t,e){return{constTimeNegate:mV,hasPrecomputes(n){return bV(n)!==1},unsafeLadder(n,r,s=t.ZERO){let a=n;for(;r>M0e;)r&iee&&(s=s.add(a)),a=a.double(),r>>=iee;return s},precomputeWindow(n,r){const{windows:s,windowSize:a}=xV(r,e),o=[];let l=n,c=l;for(let u=0;u<s;u++){c=l,o.push(c);for(let d=1;d<a;d++)c=c.add(l),o.push(c);l=c.double()}return o},wNAF(n,r,s){let a=t.ZERO,o=t.BASE;const l=xV(n,e);for(let c=0;c<l.windows;c++){const{nextN:u,offset:d,isZero:f,isNeg:x,isNegF:g,offsetF:y}=R0e(s,c,l);s=u,f?o=o.add(mV(g,r[y])):a=a.add(mV(x,r[d]))}return{p:a,f:o}},wNAFUnsafe(n,r,s,a=t.ZERO){const o=xV(n,e);for(let l=0;l<o.windows&&s!==M0e;l++){const{nextN:c,offset:u,isZero:d,isNeg:f}=R0e(s,l,o);if(s=c,!d){const x=r[u];a=a.add(f?x.negate():x)}}return a},getPrecomputes(n,r,s){let a=gV.get(r);return a||(a=this.precomputeWindow(r,n),n!==1&&gV.set(r,s(a))),a},wNAFCached(n,r,s){const a=bV(n);return this.wNAF(a,this.getPrecomputes(a,n,s),r)},wNAFCachedUnsafe(n,r,s,a){const o=bV(n);return o===1?this.unsafeLadder(n,r,a):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,a)},setWindowSize(n,r){PTe(r,e),ITe.set(n,r),gV.delete(n)}}}function M1t(t,e,n,r){if(I1t(n,t),F1t(r,e),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,a=v1t(BigInt(n.length)),o=a>12?a-3:a>4?a-2:a?2:1,l=x$(o),c=new Array(Number(l)+1).fill(s),u=Math.floor((e.BITS-1)/o)*o;let d=s;for(let f=u;f>=0;f-=o){c.fill(s);for(let g=0;g<r.length;g++){const y=r[g],v=Number(y>>BigInt(f)&l);c[v]=c[v].add(n[g])}let x=s;for(let g=c.length-1,y=s;g>0;g--)y=y.add(c[g]),x=x.add(y);if(d=d.add(x),f!==0)for(let g=0;g<o;g++)d=d.double()}return d}function FTe(t){return _1t(t.Fp),g$(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ETe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function L0e(t){t.lowS!==void 0&&$E("lowS",t.lowS),t.prehash!==void 0&&$E("prehash",t.prehash)}function R1t(t){const e=FTe(t);g$(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}class L1t extends Error{constructor(e=""){super(e)}}const yg={Err:L1t,_tlv:{encode:(t,e)=>{const{Err:n}=yg;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const r=e.length/2,s=NI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const a=r>127?NI(s.length/2|128):"";return NI(t)+a+s+e},decode(t,e){const{Err:n}=yg;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[r++],a=!!(s&128);let o=0;if(!a)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=e.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of u)o=o<<8|d;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const l=e.subarray(r,r+o);if(l.length!==o)throw new n("tlv.decode: wrong value length");return{v:l,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=yg;if(t<Dg)throw new e("integer: negative integers are not allowed");let n=NI(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=yg;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return f3(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=yg,s=Gp("signature",t),{v:a,l:o}=r.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:l,l:c}=r.decode(2,a),{v:u,l:d}=r.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(u)}},hexFromSig(t){const{_tlv:e,_int:n}=yg,r=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),a=r+s;return e.encode(48,a)}},Dg=BigInt(0),Ec=BigInt(1);BigInt(2);const D0e=BigInt(3);BigInt(4);function D1t(t){const e=R1t(t),{Fp:n}=e,r=_Te(e.n,e.nBitLength),s=e.toBytes||((v,C,N)=>{const P=C.toAffine();return aR(Uint8Array.from([4]),n.toBytes(P.x),n.toBytes(P.y))}),a=e.fromBytes||(v=>{const C=v.subarray(1),N=n.fromBytes(C.subarray(0,n.BYTES)),P=n.fromBytes(C.subarray(n.BYTES,2*n.BYTES));return{x:N,y:P}});function o(v){const{a:C,b:N}=e,P=n.sqr(v),T=n.mul(P,v);return n.add(n.add(T,n.mul(v,C)),N)}if(!n.eql(n.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function l(v){return poe(v,Ec,e.n)}function c(v){const{allowedPrivateKeyLengths:C,nByteLength:N,wrapPrivateKey:P,n:T}=e;if(C&&typeof v!="bigint"){if(iN(v)&&(v=UE(v)),typeof v!="string"||!C.includes(v.length))throw new Error("invalid private key");v=v.padStart(N*2,"0")}let M;try{M=typeof v=="bigint"?v:f3(Gp("private key",v,N))}catch{throw new Error("invalid private key, expected hex or "+N+" bytes, got "+typeof v)}return P&&(M=Yd(M,T)),C4("private key",M,Ec,T),M}function u(v){if(!(v instanceof x))throw new Error("ProjectivePoint expected")}const d=I0e((v,C)=>{const{px:N,py:P,pz:T}=v;if(n.eql(T,n.ONE))return{x:N,y:P};const M=v.is0();C==null&&(C=M?n.ONE:n.inv(T));const F=n.mul(N,C),$=n.mul(P,C),L=n.mul(T,C);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(L,n.ONE))throw new Error("invZ was invalid");return{x:F,y:$}}),f=I0e(v=>{if(v.is0()){if(e.allowInfinityPoint&&!n.is0(v.py))return;throw new Error("bad point: ZERO")}const{x:C,y:N}=v.toAffine();if(!n.isValid(C)||!n.isValid(N))throw new Error("bad point: x or y not FE");const P=n.sqr(N),T=o(C);if(!n.eql(P,T))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class x{constructor(C,N,P){if(C==null||!n.isValid(C))throw new Error("x required");if(N==null||!n.isValid(N))throw new Error("y required");if(P==null||!n.isValid(P))throw new Error("z required");this.px=C,this.py=N,this.pz=P,Object.freeze(this)}static fromAffine(C){const{x:N,y:P}=C||{};if(!C||!n.isValid(N)||!n.isValid(P))throw new Error("invalid affine point");if(C instanceof x)throw new Error("projective point not allowed");const T=M=>n.eql(M,n.ZERO);return T(N)&&T(P)?x.ZERO:new x(N,P,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const N=n.invertBatch(C.map(P=>P.pz));return C.map((P,T)=>P.toAffine(N[T])).map(x.fromAffine)}static fromHex(C){const N=x.fromAffine(a(Gp("pointHex",C)));return N.assertValidity(),N}static fromPrivateKey(C){return x.BASE.multiply(c(C))}static msm(C,N){return M1t(x,r,C,N)}_setWindowSize(C){y.setWindowSize(this,C)}assertValidity(){f(this)}hasEvenY(){const{y:C}=this.toAffine();if(n.isOdd)return!n.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){u(C);const{px:N,py:P,pz:T}=this,{px:M,py:F,pz:$}=C,L=n.eql(n.mul(N,$),n.mul(M,T)),z=n.eql(n.mul(P,$),n.mul(F,T));return L&&z}negate(){return new x(this.px,n.neg(this.py),this.pz)}double(){const{a:C,b:N}=e,P=n.mul(N,D0e),{px:T,py:M,pz:F}=this;let $=n.ZERO,L=n.ZERO,z=n.ZERO,X=n.mul(T,T),ne=n.mul(M,M),J=n.mul(F,F),K=n.mul(T,M);return K=n.add(K,K),z=n.mul(T,F),z=n.add(z,z),$=n.mul(C,z),L=n.mul(P,J),L=n.add($,L),$=n.sub(ne,L),L=n.add(ne,L),L=n.mul($,L),$=n.mul(K,$),z=n.mul(P,z),J=n.mul(C,J),K=n.sub(X,J),K=n.mul(C,K),K=n.add(K,z),z=n.add(X,X),X=n.add(z,X),X=n.add(X,J),X=n.mul(X,K),L=n.add(L,X),J=n.mul(M,F),J=n.add(J,J),X=n.mul(J,K),$=n.sub($,X),z=n.mul(J,ne),z=n.add(z,z),z=n.add(z,z),new x($,L,z)}add(C){u(C);const{px:N,py:P,pz:T}=this,{px:M,py:F,pz:$}=C;let L=n.ZERO,z=n.ZERO,X=n.ZERO;const ne=e.a,J=n.mul(e.b,D0e);let K=n.mul(N,M),te=n.mul(P,F),fe=n.mul(T,$),q=n.add(N,P),se=n.add(M,F);q=n.mul(q,se),se=n.add(K,te),q=n.sub(q,se),se=n.add(N,T);let ae=n.add(M,$);return se=n.mul(se,ae),ae=n.add(K,fe),se=n.sub(se,ae),ae=n.add(P,T),L=n.add(F,$),ae=n.mul(ae,L),L=n.add(te,fe),ae=n.sub(ae,L),X=n.mul(ne,se),L=n.mul(J,fe),X=n.add(L,X),L=n.sub(te,X),X=n.add(te,X),z=n.mul(L,X),te=n.add(K,K),te=n.add(te,K),fe=n.mul(ne,fe),se=n.mul(J,se),te=n.add(te,fe),fe=n.sub(K,fe),fe=n.mul(ne,fe),se=n.add(se,fe),K=n.mul(te,se),z=n.add(z,K),K=n.mul(ae,se),L=n.mul(q,L),L=n.sub(L,K),K=n.mul(q,te),X=n.mul(ae,X),X=n.add(X,K),new x(L,z,X)}subtract(C){return this.add(C.negate())}is0(){return this.equals(x.ZERO)}wNAF(C){return y.wNAFCached(this,C,x.normalizeZ)}multiplyUnsafe(C){const{endo:N,n:P}=e;C4("scalar",C,Dg,P);const T=x.ZERO;if(C===Dg)return T;if(this.is0()||C===Ec)return this;if(!N||y.hasPrecomputes(this))return y.wNAFCachedUnsafe(this,C,x.normalizeZ);let{k1neg:M,k1:F,k2neg:$,k2:L}=N.splitScalar(C),z=T,X=T,ne=this;for(;F>Dg||L>Dg;)F&Ec&&(z=z.add(ne)),L&Ec&&(X=X.add(ne)),ne=ne.double(),F>>=Ec,L>>=Ec;return M&&(z=z.negate()),$&&(X=X.negate()),X=new x(n.mul(X.px,N.beta),X.py,X.pz),z.add(X)}multiply(C){const{endo:N,n:P}=e;C4("scalar",C,Ec,P);let T,M;if(N){const{k1neg:F,k1:$,k2neg:L,k2:z}=N.splitScalar(C);let{p:X,f:ne}=this.wNAF($),{p:J,f:K}=this.wNAF(z);X=y.constTimeNegate(F,X),J=y.constTimeNegate(L,J),J=new x(n.mul(J.px,N.beta),J.py,J.pz),T=X.add(J),M=ne.add(K)}else{const{p:F,f:$}=this.wNAF(C);T=F,M=$}return x.normalizeZ([T,M])[0]}multiplyAndAddUnsafe(C,N,P){const T=x.BASE,M=($,L)=>L===Dg||L===Ec||!$.equals(T)?$.multiplyUnsafe(L):$.multiply(L),F=M(this,N).add(M(C,P));return F.is0()?void 0:F}toAffine(C){return d(this,C)}isTorsionFree(){const{h:C,isTorsionFree:N}=e;if(C===Ec)return!0;if(N)return N(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:N}=e;return C===Ec?this:N?N(x,this):this.multiplyUnsafe(e.h)}toRawBytes(C=!0){return $E("isCompressed",C),this.assertValidity(),s(x,this,C)}toHex(C=!0){return $E("isCompressed",C),UE(this.toRawBytes(C))}}x.BASE=new x(e.Gx,e.Gy,n.ONE),x.ZERO=new x(n.ZERO,n.ONE,n.ZERO);const g=e.nBitLength,y=O1t(x,e.endo?Math.ceil(g/2):g);return{CURVE:e,ProjectivePoint:x,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:l}}function B1t(t){const e=FTe(t);return g$(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function $1t(t){const e=B1t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(fe){return Yd(fe,r)}function l(fe){return see(fe,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=D1t({...e,toBytes(fe,q,se){const ae=q.toAffine(),W=n.toBytes(ae.x),V=aR;return $E("isCompressed",se),se?V(Uint8Array.from([q.hasEvenY()?2:3]),W):V(Uint8Array.from([4]),W,n.toBytes(ae.y))},fromBytes(fe){const q=fe.length,se=fe[0],ae=fe.subarray(1);if(q===s&&(se===2||se===3)){const W=f3(ae);if(!poe(W,Ec,n.ORDER))throw new Error("Point is not on curve");const V=d(W);let ee;try{ee=n.sqrt(V)}catch(Ce){const me=Ce instanceof Error?": "+Ce.message:"";throw new Error("Point is not on curve"+me)}const oe=(ee&Ec)===Ec;return(se&1)===1!==oe&&(ee=n.neg(ee)),{x:W,y:ee}}else if(q===a&&se===4){const W=n.fromBytes(ae.subarray(0,n.BYTES)),V=n.fromBytes(ae.subarray(n.BYTES,2*n.BYTES));return{x:W,y:V}}else{const W=s,V=a;throw new Error("invalid Point, expected length of "+W+", or uncompressed "+V+", got "+q)}}}),x=fe=>UE(zE(fe,e.nByteLength));function g(fe){const q=r>>Ec;return fe>q}function y(fe){return g(fe)?o(-fe):fe}const v=(fe,q,se)=>f3(fe.slice(q,se));class C{constructor(q,se,ae){C4("r",q,Ec,r),C4("s",se,Ec,r),this.r=q,this.s=se,ae!=null&&(this.recovery=ae),Object.freeze(this)}static fromCompact(q){const se=e.nByteLength;return q=Gp("compactSignature",q,se*2),new C(v(q,0,se),v(q,se,2*se))}static fromDER(q){const{r:se,s:ae}=yg.toSig(Gp("DER",q));return new C(se,ae)}assertValidity(){}addRecoveryBit(q){return new C(this.r,this.s,q)}recoverPublicKey(q){const{r:se,s:ae,recovery:W}=this,V=$(Gp("msgHash",q));if(W==null||![0,1,2,3].includes(W))throw new Error("recovery id invalid");const ee=W===2||W===3?se+e.n:se;if(ee>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const oe=W&1?"03":"02",de=c.fromHex(oe+x(ee)),Ce=l(ee),me=o(-V*Ce),we=o(ae*Ce),xe=c.BASE.multiplyAndAddUnsafe(de,me,we);if(!xe)throw new Error("point at infinify");return xe.assertValidity(),xe}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new C(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return iR(this.toDERHex())}toDERHex(){return yg.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return iR(this.toCompactHex())}toCompactHex(){return x(this.r)+x(this.s)}}const N={isValidPrivateKey(fe){try{return u(fe),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const fe=TTe(e.n);return P1t(e.randomBytes(fe),e.n)},precompute(fe=8,q=c.BASE){return q._setWindowSize(fe),q.multiply(BigInt(3)),q}};function P(fe,q=!0){return c.fromPrivateKey(fe).toRawBytes(q)}function T(fe){const q=iN(fe),se=typeof fe=="string",ae=(q||se)&&fe.length;return q?ae===s||ae===a:se?ae===2*s||ae===2*a:fe instanceof c}function M(fe,q,se=!0){if(T(fe))throw new Error("first arg must be private key");if(!T(q))throw new Error("second arg must be public key");return c.fromHex(q).multiply(u(fe)).toRawBytes(se)}const F=e.bits2int||function(fe){if(fe.length>8192)throw new Error("input is too large");const q=f3(fe),se=fe.length*8-e.nBitLength;return se>0?q>>BigInt(se):q},$=e.bits2int_modN||function(fe){return o(F(fe))},L=x$(e.nBitLength);function z(fe){return C4("num < 2^"+e.nBitLength,fe,Dg,L),zE(fe,e.nByteLength)}function X(fe,q,se=ne){if(["recovered","canonical"].some(je=>je in se))throw new Error("sign() legacy options not supported");const{hash:ae,randomBytes:W}=e;let{lowS:V,prehash:ee,extraEntropy:oe}=se;V==null&&(V=!0),fe=Gp("msgHash",fe),L0e(se),ee&&(fe=Gp("prehashed msgHash",ae(fe)));const de=$(fe),Ce=u(q),me=[z(Ce),z(de)];if(oe!=null&&oe!==!1){const je=oe===!0?W(n.BYTES):oe;me.push(Gp("extraEntropy",je))}const we=aR(...me),xe=de;function be(je){const Ie=F(je);if(!f(Ie))return;const Re=l(Ie),Qe=c.BASE.multiply(Ie).toAffine(),Ke=o(Qe.x);if(Ke===Dg)return;const dt=o(Re*o(xe+Ke*Ce));if(dt===Dg)return;let tt=(Qe.x===Ke?0:2)|Number(Qe.y&Ec),nt=dt;return V&&g(dt)&&(nt=y(dt),tt^=1),new C(Ke,nt,tt)}return{seed:we,k2sig:be}}const ne={lowS:e.lowS,prehash:!1},J={lowS:e.lowS,prehash:!1};function K(fe,q,se=ne){const{seed:ae,k2sig:W}=X(fe,q,se),V=e;return w1t(V.hash.outputLen,V.nByteLength,V.hmac)(ae,W)}c.BASE._setWindowSize(8);function te(fe,q,se,ae=J){var tt;const W=fe;q=Gp("msgHash",q),se=Gp("publicKey",se);const{lowS:V,prehash:ee,format:oe}=ae;if(L0e(ae),"strict"in ae)throw new Error("options.strict was renamed to lowS");if(oe!==void 0&&oe!=="compact"&&oe!=="der")throw new Error("format must be compact or der");const de=typeof W=="string"||iN(W),Ce=!de&&!oe&&typeof W=="object"&&W!==null&&typeof W.r=="bigint"&&typeof W.s=="bigint";if(!de&&!Ce)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let me,we;try{if(Ce&&(me=new C(W.r,W.s)),de){try{oe!=="compact"&&(me=C.fromDER(W))}catch(nt){if(!(nt instanceof yg.Err))throw nt}!me&&oe!=="der"&&(me=C.fromCompact(W))}we=c.fromHex(se)}catch{return!1}if(!me||V&&me.hasHighS())return!1;ee&&(q=e.hash(q));const{r:xe,s:be}=me,je=$(q),Ie=l(be),Re=o(je*Ie),Qe=o(xe*Ie),Ke=(tt=c.BASE.multiplyAndAddUnsafe(we,Re,Qe))==null?void 0:tt.toAffine();return Ke?o(Ke.x)===xe:!1}return{CURVE:e,getPublicKey:P,getSharedSecret:M,sign:K,verify:te,ProjectivePoint:c,Signature:C,utils:N}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function U1t(t){return{hash:t,hmac:(e,...n)=>CTe(t,e,Lht(...n)),randomBytes:Dht}}function z1t(t,e){const n=r=>$1t({...t,...U1t(r)});return{...n(e),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const OTe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),B0e=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),H1t=BigInt(1),aee=BigInt(2),$0e=(t,e)=>(t+e/aee)/e;function V1t(t){const e=OTe,n=BigInt(3),r=BigInt(6),s=BigInt(11),a=BigInt(22),o=BigInt(23),l=BigInt(44),c=BigInt(88),u=t*t*t%e,d=u*u*t%e,f=Ah(d,n,e)*d%e,x=Ah(f,n,e)*d%e,g=Ah(x,aee,e)*u%e,y=Ah(g,s,e)*g%e,v=Ah(y,a,e)*y%e,C=Ah(v,l,e)*v%e,N=Ah(C,c,e)*C%e,P=Ah(N,l,e)*v%e,T=Ah(P,n,e)*d%e,M=Ah(T,o,e)*y%e,F=Ah(M,r,e)*u%e,$=Ah(F,aee,e);if(!oee.eql(oee.sqr($),t))throw new Error("Cannot find square root");return $}const oee=_Te(OTe,void 0,void 0,{sqrt:V1t}),moe=z1t({a:BigInt(0),b:BigInt(7),Fp:oee,n:B0e,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=B0e,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-H1t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=$0e(a*t,e),c=$0e(-r*t,e);let u=Yd(t-l*n-c*s,e),d=Yd(-l*r-c*a,e);const f=u>o,x=d>o;if(f&&(u=e-u),x&&(d=e-d),u>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:x,k2:d}}}},Y_e);BigInt(0);moe.ProjectivePoint;const W1t=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:moe},Symbol.toStringTag,{value:"Module"}));function q1t({r:t,s:e,to:n="hex",v:r,yParity:s}){const a=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new moe.Signature(cd(t),cd(e)).toCompactHex()}${a===0?"1b":"1c"}`;return n==="hex"?o:hp(o)}async function xoe(t,e){var f,x,g;const{address:n,factory:r,factoryData:s,hash:a,signature:o,universalSignatureVerifierAddress:l=(g=(x=(f=t.chain)==null?void 0:f.contracts)==null?void 0:x.universalSignatureVerifier)==null?void 0:g.address,...c}=e,u=ix(o)?o:typeof o=="object"&&"r"in o&&"s"in o?q1t(o):Gl(o),d=await(async()=>!r&&!s||n1t(u)?u:r1t({address:r,data:s,signature:u}))();try{const y=l?{to:l,data:Fm({abi:i0e,functionName:"isValidSig",args:[n,a,d]}),...c}:{data:Iae({abi:i0e,args:[n,a,d],bytecode:y0t}),...c},{data:v}=await ai(t,c$,"call")(y);return lht(v??"0x0")}catch(y){try{if(Jae(Tc(n),await L_e({hash:a,signature:o})))return!0}catch{}if(y instanceof Ake)return!1;throw y}}async function G1t(t,{address:e,message:n,factory:r,factoryData:s,signature:a,...o}){const l=bTe(n);return xoe(t,{address:e,factory:r,factoryData:s,hash:l,signature:a,...o})}async function K1t(t,e){const{address:n,factory:r,factoryData:s,signature:a,message:o,primaryType:l,types:c,domain:u,...d}=e,f=Lgt({message:o,primaryType:l,types:c,domain:u});return xoe(t,{address:n,factory:r,factoryData:s,hash:f,signature:a,...d})}function Y1t(t,e){const{abi:n,address:r,args:s,batch:a=!0,eventName:o,fromBlock:l,onError:c,onLogs:u,poll:d,pollingInterval:f=t.pollingInterval,strict:x}=e;return(typeof d<"u"?d:typeof l=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket"))?(()=>{const C=x??!1,N=Mc(["watchContractEvent",r,s,a,t.uid,o,f,C,l]);return e2(N,{onLogs:u,onError:c},P=>{let T;l!==void 0&&(T=l-1n);let M,F=!1;const $=CT(async()=>{var L;if(!F){try{M=await ai(t,Bke,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:C,fromBlock:l})}catch{}F=!0;return}try{let z;if(M)z=await ai(t,d$,"getFilterChanges")({filter:M});else{const X=await ai(t,vT,"getBlockNumber")({});T&&T<X?z=await ai(t,zke,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:T+1n,toBlock:X,strict:C}):z=[],T=X}if(z.length===0)return;if(a)P.onLogs(z);else for(const X of z)P.onLogs([X])}catch(z){M&&z instanceof D3&&(F=!1),(L=P.onError)==null||L.call(P,z)}},{emitOnBegin:!0,interval:f});return async()=>{M&&await ai(t,m$,"uninstallFilter")({filter:M}),$()}})})():(()=>{const C=x??!1,N=Mc(["watchContractEvent",r,s,a,t.uid,o,f,C]);let P=!0,T=()=>P=!1;return e2(N,{onLogs:u,onError:c},M=>((async()=>{try{const F=(()=>{if(t.transport.type==="fallback"){const z=t.transport.transports.find(X=>X.config.type==="webSocket");return z?z.value:t.transport}return t.transport})(),$=o?yT({abi:n,eventName:o,args:s}):[],{unsubscribe:L}=await F.subscribe({params:["logs",{address:r,topics:$}],onData(z){var ne;if(!P)return;const X=z.result;try{const{eventName:J,args:K}=eoe({abi:n,data:X.data,topics:X.topics,strict:x}),te=x1(X,{args:K,eventName:J});M.onLogs([te])}catch(J){let K,te;if(J instanceof yE||J instanceof XB){if(x)return;K=J.abiItem.name,te=(ne=J.abiItem.inputs)==null?void 0:ne.some(q=>!("name"in q&&q.name))}const fe=x1(X,{args:te?[]:{},eventName:K});M.onLogs([fe])}},onError(z){var X;(X=M.onError)==null||X.call(M,z)}});T=L,P||T()}catch(F){c==null||c(F)}})(),()=>T()))})()}async function X1t(t,e){const{abi:n,account:r=t.account,address:s,args:a,dataSuffix:o,functionName:l,...c}=e;if(typeof r>"u")throw new e$({docsPath:"/docs/contract/writeContract"});const u=r?Vu(r):null,d=Fm({abi:n,args:a,functionName:l});try{return await ai(t,smt,"sendTransaction")({data:`${d}${o?o.replace("0x",""):""}`,to:s,account:u,...c})}catch(f){throw $3(f,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:l,sender:u==null?void 0:u.address})}}function S2(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const IO="2.16.7",Q1t=()=>`@wagmi/core@${IO}`;var MTe=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},oR,RTe;let M1=class lee extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Q1t()}constructor(e,n={}){var a;super(),oR.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const r=n.cause instanceof lee?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details,s=n.cause instanceof lee&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${this.docsBaseUrl}${s}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
`),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return MTe(this,oR,"m",RTe).call(this,this,e)}};oR=new WeakSet,RTe=function t(e,n){return n!=null&&n(e)?e:e.cause?MTe(this,oR,"m",t).call(this,e.cause,n):e};class H3 extends M1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class Z1t extends M1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class J1t extends M1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ebt extends M1{constructor({address:e,connector:n}){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class tbt extends M1{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class nbt extends M1{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function rbt(t,e){var r;let n;if(typeof e.connector=="function"?n=t._internal.connectors.setup(e.connector):n=e.connector,n.uid===t.state.current)throw new Z1t;try{t.setState(c=>({...c,status:"connecting"})),n.emitter.emit("message",{type:"connecting"});const{connector:s,...a}=e,o=await n.connect(a),l=o.accounts;return n.emitter.off("connect",t._internal.events.connect),n.emitter.on("change",t._internal.events.change),n.emitter.on("disconnect",t._internal.events.disconnect),await((r=t.storage)==null?void 0:r.setItem("recentConnectorId",n.id)),t.setState(c=>({...c,connections:new Map(c.connections).set(n.uid,{accounts:l,chainId:o.chainId,connector:n}),current:n.uid,status:"connected"})),{accounts:l,chainId:o.chainId}}catch(s){throw t.setState(a=>({...a,status:a.current?"connected":"disconnected"})),s}}const cee=256;let AI=cee,jI;function LTe(t=11){if(!jI||AI+t>cee*2){jI="",AI=0;for(let e=0;e<cee;e++)jI+=(256+Math.random()*256|0).toString(16).substring(1)}return jI.substring(AI,AI+++t)}function DTe(t){const{batch:e,cacheTime:n=t.pollingInterval??4e3,ccipRead:r,key:s="base",name:a="Base Client",pollingInterval:o=4e3,type:l="base"}=t,c=t.chain,u=t.account?Vu(t.account):void 0,{config:d,request:f,value:x}=t.transport({chain:c,pollingInterval:o}),g={...d,...x},y={account:u,batch:e,cacheTime:n,ccipRead:r,chain:c,key:s,name:a,pollingInterval:o,request:f,transport:g,type:l,uid:LTe()};function v(C){return N=>{const P=N(C);for(const M in y)delete P[M];const T={...C,...P};return Object.assign(T,{extend:v(T)})}}return Object.assign(y,{extend:v(y)})}function BTe({key:t,methods:e,name:n,request:r,retryCount:s=3,retryDelay:a=150,timeout:o,type:l},c){const u=LTe();return{config:{key:t,methods:e,name:n,request:r,retryCount:s,retryDelay:a,timeout:o,type:l},request:Tgt(r,{methods:e,retryCount:s,retryDelay:a,uid:u}),value:c}}function sbt(t,e={}){const{key:n="custom",methods:r,name:s="Custom Provider",retryDelay:a}=e;return({retryCount:o})=>BTe({key:n,methods:r,name:s,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:a,type:"custom"})}class ibt extends Br{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function U7(t,e={}){const{batch:n,fetchOptions:r,key:s="http",methods:a,name:o="HTTP JSON-RPC",onFetchRequest:l,onFetchResponse:c,retryDelay:u,raw:d}=e;return({chain:f,retryCount:x,timeout:g})=>{const{batchSize:y=1e3,wait:v=0}=typeof n=="object"?n:{},C=e.retryCount??x,N=g??e.timeout??1e4,P=f==null?void 0:f.rpcUrls.default.http[0];if(!P)throw new ibt;const T=Fgt(P,{fetchOptions:r,onRequest:l,onResponse:c,timeout:N});return BTe({key:s,methods:a,name:o,async request({method:M,params:F}){const $={method:M,params:F},{schedule:L}=Ike({id:P,wait:v,shouldSplitBatch(J){return J.length>y},fn:J=>T.request({body:J}),sort:(J,K)=>J.id-K.id}),z=async J=>n?L(J):[await T.request({body:J})],[{error:X,result:ne}]=await z($);if(d)return{error:X,result:ne};if(X)throw new Rae({body:$,error:X,url:P});return ne},retryCount:C,retryDelay:u,timeout:N,type:"http"},{fetchOptions:r,url:P})}}function abt(t){var f,x,g;const{scheme:e,statement:n,...r}=((f=t.match(obt))==null?void 0:f.groups)??{},{chainId:s,expirationTime:a,issuedAt:o,notBefore:l,requestId:c,...u}=((x=t.match(lbt))==null?void 0:x.groups)??{},d=(g=t.split("Resources:")[1])==null?void 0:g.split(`
- `).slice(1);return{...r,...u,...s?{chainId:Number(s)}:{},...a?{expirationTime:new Date(a)}:{},...o?{issuedAt:new Date(o)}:{},...l?{notBefore:new Date(l)}:{},...c?{requestId:c}:{},...d?{resources:d}:{},...e?{scheme:e}:{},...n?{statement:n}:{}}}const obt=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,lbt=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function cbt(t){const{address:e,domain:n,message:r,nonce:s,scheme:a,time:o=new Date}=t;if(n&&r.domain!==n||s&&r.nonce!==s||a&&r.scheme!==a||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||e&&!Jae(r.address,e))return!1}catch{return!1}return!0}async function ubt(t,e){const{address:n,domain:r,message:s,nonce:a,scheme:o,signature:l,time:c=new Date,...u}=e,d=abt(s);if(!d.address||!cbt({address:n,domain:r,message:d,nonce:a,scheme:o,time:c}))return!1;const x=bTe(s);return xoe(t,{address:d.address,hash:x,signature:l,...u})}function dbt(t){return{call:e=>c$(t,e),createAccessList:e=>Dke(t,e),createBlockFilter:()=>B0t(t),createContractEventFilter:e=>Bke(t,e),createEventFilter:e=>$ke(t,e),createPendingTransactionFilter:()=>Uke(t),estimateContractGas:e=>U0t(t,e),estimateGas:e=>Vae(t,e),getBalance:e=>Hae(t,e),getBlobBaseFee:()=>z0t(t),getBlock:e=>L0(t,e),getBlockNumber:e=>vT(t,e),getBlockTransactionCount:e=>K0t(t,e),getBytecode:e=>p0e(t,e),getChainId:()=>Dae(t),getCode:e=>p0e(t,e),getContractEvents:e=>zke(t,e),getEip712Domain:e=>Z0t(t,e),getEnsAddress:e=>A0t(t,e),getEnsAvatar:e=>Rke(t,e),getEnsName:e=>Lke(t,e),getEnsResolver:e=>D0t(t,e),getEnsText:e=>Mke(t,e),getFeeHistory:e=>txt(t,e),estimateFeesPerGas:e=>Bpt(t,e),getFilterChanges:e=>d$(t,e),getFilterLogs:e=>nxt(t,e),getGasPrice:()=>Uae(t),getLogs:e=>noe(t,e),getProof:e=>p1t(t,e),estimateMaxPriorityFeePerGas:e=>Dpt(t,e),getStorageAt:e=>rxt(t,e),getTransaction:e=>roe(t,e),getTransactionConfirmations:e=>sxt(t,e),getTransactionCount:e=>K_e(t,e),getTransactionReceipt:e=>KJ(t,e),multicall:e=>Vke(t,e),prepareTransactionRequest:e=>Kae(t,e),readContract:e=>ox(t,e),sendRawTransaction:e=>ske(t,e),simulate:e=>XJ(t,e),simulateBlocks:e=>XJ(t,e),simulateCalls:e=>o1t(t,e),simulateContract:e=>b1t(t,e),verifyMessage:e=>G1t(t,e),verifySiweMessage:e=>ubt(t,e),verifyTypedData:e=>K1t(t,e),uninstallFilter:e=>m$(t,e),waitForTransactionReceipt:e=>m1t(t,e),watchBlocks:e=>c1t(t,e),watchBlockNumber:e=>vTe(t,e),watchContractEvent:e=>Y1t(t,e),watchEvent:e=>u1t(t,e),watchPendingTransactions:e=>d1t(t,e)}}async function goe(t,e={}){let n;if(e.connector){const{connector:u}=e;if(t.state.status==="reconnecting"&&!u.getAccounts&&!u.getChainId)throw new nbt({connector:u});const[d,f]=await Promise.all([u.getAccounts().catch(x=>{if(e.account===null)return[];throw x}),u.getChainId()]);n={accounts:d,chainId:f,connector:u}}else n=t.state.connections.get(t.state.current);if(!n)throw new J1t;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new tbt({connectionChainId:n.chainId,connectorChainId:s});const a=n.connector;if(a.getClient)return a.getClient({chainId:r});const o=Vu(e.account??n.accounts[0]);if(o&&(o.address=Tc(o.address)),e.account&&!n.accounts.some(u=>u.toLowerCase()===o.address.toLowerCase()))throw new ebt({address:o.address,connector:a});const l=t.chains.find(u=>u.id===r),c=await n.connector.getProvider({chainId:r});return DTe({account:o,chain:l,name:"Connector Client",transport:u=>sbt(c)({...u,retryCount:0})})}async function fbt(t,e={}){var s,a;let n;if(e.connector)n=e.connector;else{const{connections:o,current:l}=t.state,c=o.get(l);n=c==null?void 0:c.connector}const r=t.state.connections;n&&(await n.disconnect(),n.emitter.off("change",t._internal.events.change),n.emitter.off("disconnect",t._internal.events.disconnect),n.emitter.on("connect",t._internal.events.connect),r.delete(n.uid)),t.setState(o=>{if(r.size===0)return{...o,connections:new Map,current:null,status:"disconnected"};const l=r.values().next().value;return{...o,connections:new Map(r),current:l.connector.uid}});{const o=t.state.current;if(!o)return;const l=(s=t.state.connections.get(o))==null?void 0:s.connector;if(!l)return;await((a=t.storage)==null?void 0:a.setItem("recentConnectorId",l.id))}}function $Te(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(vpt[t])}function UTe(t){const e=t.state.current,n=t.state.connections.get(e),r=n==null?void 0:n.accounts,s=r==null?void 0:r[0],a=t.chains.find(l=>l.id===(n==null?void 0:n.chainId)),o=t.state.status;switch(o){case"connected":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:o};case"reconnecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!s,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:o};case"connecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:o};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:o}}}async function hbt(t,e){const{allowFailure:n=!0,chainId:r,contracts:s,...a}=e,o=t.getClient({chainId:r});return S2(o,Vke,"multicall")({allowFailure:n,contracts:s,...a})}function zTe(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,ox,"readContract")(r)}async function pbt(t,e){var l;const{allowFailure:n=!0,blockNumber:r,blockTag:s,...a}=e,o=e.contracts;try{const c={};for(const[x,g]of o.entries()){const y=g.chainId??t.state.chainId;c[y]||(c[y]=[]),(l=c[y])==null||l.push({contract:g,index:x})}const u=()=>Object.entries(c).map(([x,g])=>hbt(t,{...a,allowFailure:n,blockNumber:r,blockTag:s,chainId:Number.parseInt(x),contracts:g.map(({contract:y})=>y)})),d=(await Promise.all(u())).flat(),f=Object.values(c).flatMap(x=>x.map(({index:g})=>g));return d.reduce((x,g,y)=>(x&&(x[f[y]]=g),x),[])}catch(c){if(c instanceof jke)throw c;const u=()=>o.map(d=>zTe(t,{...d,blockNumber:r,blockTag:s}));return n?(await Promise.allSettled(u())).map(d=>d.status==="fulfilled"?{result:d.value,status:"success"}:{error:d.reason,result:void 0,status:"failure"}):await Promise.all(u())}}async function mbt(t,e){const{address:n,blockNumber:r,blockTag:s,chainId:a,token:o,unit:l="ether"}=e;if(o)try{return await U0e(t,{balanceAddress:n,chainId:a,symbolType:"string",tokenAddress:o})}catch(x){if(x.name==="ContractFunctionExecutionError"){const g=await U0e(t,{balanceAddress:n,chainId:a,symbolType:"bytes32",tokenAddress:o}),y=cht(Jf(g.symbol,{dir:"right"}));return{...g,symbol:y}}throw x}const c=t.getClient({chainId:a}),d=await S2(c,Hae,"getBalance")(r?{address:n,blockNumber:r}:{address:n,blockTag:s}),f=t.chains.find(x=>x.id===a)??c.chain;return{decimals:f.nativeCurrency.decimals,formatted:hT(d,$Te(l)),symbol:f.nativeCurrency.symbol,value:d}}async function U0e(t,e){const{balanceAddress:n,chainId:r,symbolType:s,tokenAddress:a,unit:o}=e,l={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:s}]}],address:a},[c,u,d]=await pbt(t,{allowFailure:!1,contracts:[{...l,functionName:"balanceOf",args:[n],chainId:r},{...l,functionName:"decimals",chainId:r},{...l,functionName:"symbol",chainId:r}]}),f=hT(c??"0",$Te(o??u));return{decimals:u,formatted:f,symbol:d,value:c}}function z0e(t){return t.state.chainId}function t2(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!t2(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(a&&!t2(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}let yV=[];function H0e(t){const e=t.chains;return t2(yV,e)?yV:(yV=e,e)}function xbt(t,e={}){let n;try{n=t.getClient(e)}catch{}return n}let EI=[];function uee(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||t2(EI,e)?EI:(EI=e,e)}let vV=[];function V0e(t){const e=t.connectors;return t2(vV,e)?vV:(vV=e,e)}function gbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,Rke,"getEnsAvatar")(r)}function bbt(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return S2(s,Lke,"getEnsName")(r)}function dee(t,e={}){const n=xbt(t,e);return n==null?void 0:n.extend(dbt)}let wV=!1;async function ybt(t,e={}){var u,d;if(wV)return[];wV=!0,t.setState(f=>({...f,status:f.current?"reconnecting":"connecting"}));const n=[];if((u=e.connectors)!=null&&u.length)for(const f of e.connectors){let x;typeof f=="function"?x=t._internal.connectors.setup(f):x=f,n.push(x)}else n.push(...t.connectors);let r;try{r=await((d=t.storage)==null?void 0:d.getItem("recentConnectorId"))}catch{}const s={};for(const[,f]of t.state.connections)s[f.connector.id]=1;r&&(s[r]=0);const a=Object.keys(s).length>0?[...n].sort((f,x)=>(s[f.id]??10)-(s[x.id]??10)):n;let o=!1;const l=[],c=[];for(const f of a){const x=await f.getProvider().catch(()=>{});if(!x||c.some(v=>v===x)||!await f.isAuthorized())continue;const y=await f.connect({isReconnecting:!0}).catch(()=>null);y&&(f.emitter.off("connect",t._internal.events.connect),f.emitter.on("change",t._internal.events.change),f.emitter.on("disconnect",t._internal.events.disconnect),t.setState(v=>{const C=new Map(o?v.connections:new Map).set(f.uid,{accounts:y.accounts,chainId:y.chainId,connector:f});return{...v,current:o?v.current:f.uid,connections:C}}),l.push({accounts:y.accounts,chainId:y.chainId,connector:f}),c.push(x),o=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(o?t.setState(f=>({...f,status:"connected"})):t.setState(f=>({...f,connections:new Map,current:null,status:"disconnected"}))),wV=!1,l}async function vbt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await goe(t,{account:n,connector:r}),S2(a,x1t,"signMessage")({...s,...n?{account:n}:{}})}async function wbt(t,e){const{account:n,connector:r,...s}=e;let a;return typeof n=="object"&&n.type==="local"?a=t.getClient():a=await goe(t,{account:n,connector:r}),S2(a,g1t,"signTypedData")({...s,...n?{account:n}:{}})}class tp extends M1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class Cbt extends M1{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Sbt(t,e){var o;const{addEthereumChainParameter:n,chainId:r}=e,s=t.state.connections.get(((o=e.connector)==null?void 0:o.uid)??t.state.current);if(s){const l=s.connector;if(!l.switchChain)throw new Cbt({connector:l});return await l.switchChain({addEthereumChainParameter:n,chainId:r})}const a=t.chains.find(l=>l.id===r);if(!a)throw new H3;return t.setState(l=>({...l,chainId:r})),a}function HTe(t,e){const{onChange:n}=e;return t.subscribe(()=>UTe(t),n,{equalityFn(r,s){const{connector:a,...o}=r,{connector:l,...c}=s;return t2(o,c)&&(a==null?void 0:a.id)===(l==null?void 0:l.id)&&(a==null?void 0:a.uid)===(l==null?void 0:l.uid)}})}function Nbt(t,e){const{onChange:n}=e;return t.subscribe(r=>r.chainId,n)}function Abt(t,e){const{onChange:n}=e;return t.subscribe(()=>uee(t),n,{equalityFn:t2})}function jbt(t,e){const{onChange:n}=e;return t._internal.connectors.subscribe((r,s)=>{n(Object.values(r),s)})}function Ebt(t,e){const{onChange:n}=e;return t.subscribe(()=>dee(t),n,{equalityFn(r,s){return(r==null?void 0:r.uid)===(s==null?void 0:s.uid)}})}async function _bt(t,e){const{account:n,chainId:r,connector:s,...a}=e;let o;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?o=t.getClient({chainId:r}):o=await goe(t,{account:n??void 0,chainId:r,connector:s}),await S2(o,X1t,"writeContract")({...a,...n?{account:n}:{},chain:r?{id:r}:null})}b$.type="injected";function b$(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:n}=t;function r(){const c=t.target;if(typeof c=="function"){const u=c();if(u)return u}return typeof c=="object"?c:typeof c=="string"?{...kbt[c]??{id:c,name:`${c[0].toUpperCase()}${c.slice(1)}`,provider:`is${c[0].toUpperCase()}${c.slice(1)}`}}:{id:"injected",name:"Injected",provider(u){return u==null?void 0:u.ethereum}}}let s,a,o,l;return c=>({get icon(){return r().icon},get id(){return r().id},get name(){return r().name},get supportsSimulation(){return!0},type:b$.type,async setup(){const u=await this.getProvider();u!=null&&u.on&&t.target&&(o||(o=this.onConnect.bind(this),u.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),u.on("accountsChanged",s)))},async connect({chainId:u,isReconnecting:d}={}){var g,y,v,C,N,P;const f=await this.getProvider();if(!f)throw new tp;let x=[];if(d)x=await this.getAccounts().catch(()=>[]);else if(e)try{x=(C=(v=(y=(g=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:g.caveats)==null?void 0:y[0])==null?void 0:v.value)==null?void 0:C.map(M=>Tc(M)),x.length>0&&(x=await this.getAccounts())}catch(T){const M=T;if(M.code===So.code)throw new So(M);if(M.code===Ry.code)throw M}try{!(x!=null&&x.length)&&!d&&(x=(await f.request({method:"eth_requestAccounts"})).map(F=>Tc(F))),o&&(f.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),f.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),f.on("chainChanged",a)),l||(l=this.onDisconnect.bind(this),f.on("disconnect",l));let T=await this.getChainId();if(u&&T!==u){const M=await this.switchChain({chainId:u}).catch(F=>{if(F.code===So.code)throw F;return{id:T}});T=(M==null?void 0:M.id)??T}return e&&await((N=c.storage)==null?void 0:N.removeItem(`${this.id}.disconnected`)),t.target||await((P=c.storage)==null?void 0:P.setItem("injected.connected",!0)),{accounts:x,chainId:T}}catch(T){const M=T;throw M.code===So.code?new So(M):M.code===Ry.code?new Ry(M):M}},async disconnect(){var d,f;const u=await this.getProvider();if(!u)throw new tp;a&&(u.removeListener("chainChanged",a),a=void 0),l&&(u.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),u.on("connect",o));try{await uoe(()=>u.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((d=c.storage)==null?void 0:d.setItem(`${this.id}.disconnected`,!0)),t.target||await((f=c.storage)==null?void 0:f.removeItem("injected.connected"))},async getAccounts(){const u=await this.getProvider();if(!u)throw new tp;return(await u.request({method:"eth_accounts"})).map(f=>Tc(f))},async getChainId(){const u=await this.getProvider();if(!u)throw new tp;const d=await u.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let u;const d=r();return typeof d.provider=="function"?u=d.provider(window):typeof d.provider=="string"?u=FO(window,d.provider):u=d.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){var u,d;try{if(e&&await((u=c.storage)==null?void 0:u.getItem(`${this.id}.disconnected`))||!t.target&&!await((d=c.storage)==null?void 0:d.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const y=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",y),!!await this.getProvider()),v=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(N=>window.addEventListener("ethereum#initialized",()=>N(y()),{once:!0}))]:[],new Promise(N=>setTimeout(()=>N(y()),v))]))return!0}throw new tp}return!!(await sR(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:d}){var y,v,C,N;const f=await this.getProvider();if(!f)throw new tp;const x=c.chains.find(P=>P.id===d);if(!x)throw new pp(new H3);const g=new Promise(P=>{const T=M=>{"chainId"in M&&M.chainId===d&&(c.emitter.off("change",T),P())};c.emitter.on("change",T)});try{return await Promise.all([f.request({method:"wallet_switchEthereumChain",params:[{chainId:zs(d)}]}).then(async()=>{await this.getChainId()===d&&c.emitter.emit("change",{chainId:d})}),g]),x}catch(P){const T=P;if(T.code===4902||((v=(y=T==null?void 0:T.data)==null?void 0:y.originalError)==null?void 0:v.code)===4902)try{const{default:M,...F}=x.blockExplorers??{};let $;u!=null&&u.blockExplorerUrls?$=u.blockExplorerUrls:M&&($=[M.url,...Object.values(F).map(X=>X.url)]);let L;(C=u==null?void 0:u.rpcUrls)!=null&&C.length?L=u.rpcUrls:L=[((N=x.rpcUrls.default)==null?void 0:N.http[0])??""];const z={blockExplorerUrls:$,chainId:zs(d),chainName:(u==null?void 0:u.chainName)??x.name,iconUrls:u==null?void 0:u.iconUrls,nativeCurrency:(u==null?void 0:u.nativeCurrency)??x.nativeCurrency,rpcUrls:L};return await Promise.all([f.request({method:"wallet_addEthereumChain",params:[z]}).then(async()=>{if(await this.getChainId()===d)c.emitter.emit("change",{chainId:d});else throw new So(new Error("User rejected switch after adding network."))}),g]),x}catch(M){throw new So(M)}throw T.code===So.code?new So(T):new pp(T)}},async onAccountsChanged(u){var d;if(u.length===0)this.onDisconnect();else if(c.emitter.listenerCount("connect")){const f=(await this.getChainId()).toString();this.onConnect({chainId:f}),e&&await((d=c.storage)==null?void 0:d.removeItem(`${this.id}.disconnected`))}else c.emitter.emit("change",{accounts:u.map(f=>Tc(f))})},onChainChanged(u){const d=Number(u);c.emitter.emit("change",{chainId:d})},async onConnect(u){const d=await this.getAccounts();if(d.length===0)return;const f=Number(u.chainId);c.emitter.emit("connect",{accounts:d,chainId:f});const x=await this.getProvider();x&&(o&&(x.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),x.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),x.on("chainChanged",a)),l||(l=this.onDisconnect.bind(this),x.on("disconnect",l)))},async onDisconnect(u){const d=await this.getProvider();u&&u.code===1013&&d&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),d&&(a&&(d.removeListener("chainChanged",a),a=void 0),l&&(d.removeListener("disconnect",l),l=void 0),o||(o=this.onConnect.bind(this),d.on("connect",o))))}})}const kbt={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:FO(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return FO(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const r of n)if(e[r])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){var e,n;return(e=t==null?void 0:t.phantom)!=null&&e.ethereum?(n=t.phantom)==null?void 0:n.ethereum:FO(t,"isPhantom")}}};function FO(t,e){function n(s){return typeof e=="function"?e(s):typeof e=="string"?s[e]:!0}const r=t.ethereum;if(r!=null&&r.providers)return r.providers.find(s=>n(s));if(r&&n(r))return r}function Tbt(t){if(typeof window>"u")return;const e=n=>t(n.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Pbt(){const t=new Set;let e=[];const n=()=>Tbt(s=>{e.some(({info:a})=>a.uuid===s.info.uuid)||(e=[...e,s],t.forEach(a=>a(e,{added:[s]})))});let r=n();return{_listeners(){return t},clear(){t.forEach(s=>s([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),r==null||r()},findProvider({rdns:s}){return e.find(a=>a.info.rdns===s)},getProviders(){return e},reset(){this.clear(),r==null||r(),r=n()},subscribe(s,{emitImmediately:a}={}){return t.add(s),a&&s(e,{added:e}),()=>t.delete(s)}}}const Ibt=t=>(e,n,r)=>{const s=r.subscribe;return r.subscribe=(o,l,c)=>{let u=o;if(l){const d=(c==null?void 0:c.equalityFn)||Object.is;let f=o(r.getState());u=x=>{const g=o(x);if(!d(f,g)){const y=f;l(f=g,y)}},c!=null&&c.fireImmediately&&l(f,f)}return s(u)},t(e,n,r)},Fbt=Ibt;function Obt(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var a;const o=c=>c===null?null:JSON.parse(c,void 0),l=(a=n.getItem(s))!=null?a:null;return l instanceof Promise?l.then(o):o(l)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const fee=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return fee(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return fee(r)(n)}}}},Mbt=(t,e)=>(n,r,s)=>{let a={storage:Obt(()=>localStorage),partialize:v=>v,version:0,merge:(v,C)=>({...C,...v}),...e},o=!1;const l=new Set,c=new Set;let u=a.storage;if(!u)return t((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...v)},r,s);const d=()=>{const v=a.partialize({...r()});return u.setItem(a.name,{state:v,version:a.version})},f=s.setState;s.setState=(v,C)=>{f(v,C),d()};const x=t((...v)=>{n(...v),d()},r,s);s.getInitialState=()=>x;let g;const y=()=>{var v,C;if(!u)return;o=!1,l.forEach(P=>{var T;return P((T=r())!=null?T:x)});const N=((C=a.onRehydrateStorage)==null?void 0:C.call(a,(v=r())!=null?v:x))||void 0;return fee(u.getItem.bind(u))(a.name).then(P=>{if(P)if(typeof P.version=="number"&&P.version!==a.version){if(a.migrate)return[!0,a.migrate(P.state,P.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,P.state];return[!1,void 0]}).then(P=>{var T;const[M,F]=P;if(g=a.merge(F,(T=r())!=null?T:x),n(g,!0),M)return d()}).then(()=>{N==null||N(g,void 0),g=r(),o=!0,c.forEach(P=>P(g))}).catch(P=>{N==null||N(void 0,P)})};return s.persist={setOptions:v=>{a={...a,...v},v.storage&&(u=v.storage)},clearStorage:()=>{u==null||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>y(),hasHydrated:()=>o,onHydrate:v=>(l.add(v),()=>{l.delete(v)}),onFinishHydration:v=>(c.add(v),()=>{c.delete(v)})},a.skipHydration||y(),g||x},Rbt=Mbt,W0e=t=>{let e;const n=new Set,r=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const x=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(g=>g(e,x))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=e=t(r,s,l);return l},CV=t=>t?W0e(t):W0e;var SV={exports:{}},q0e;function Lbt(){return q0e||(q0e=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,x){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new s(d,f||c,x),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],g]:c._events[y].push(g):(c._events[y]=g,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var x=0,g=f.length,y=new Array(g);x<g;x++)y[x]=f[x].fn;return y},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,x,g,y){var v=n?n+u:u;if(!this._events[v])return!1;var C=this._events[v],N=arguments.length,P,T;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),N){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,f),!0;case 4:return C.fn.call(C.context,d,f,x),!0;case 5:return C.fn.call(C.context,d,f,x,g),!0;case 6:return C.fn.call(C.context,d,f,x,g,y),!0}for(T=1,P=new Array(N-1);T<N;T++)P[T-1]=arguments[T];C.fn.apply(C.context,P)}else{var M=C.length,F;for(T=0;T<M;T++)switch(C[T].once&&this.removeListener(u,C[T].fn,void 0,!0),N){case 1:C[T].fn.call(C[T].context);break;case 2:C[T].fn.call(C[T].context,d);break;case 3:C[T].fn.call(C[T].context,d,f);break;case 4:C[T].fn.call(C[T].context,d,f,x);break;default:if(!P)for(F=1,P=new Array(N-1);F<N;F++)P[F-1]=arguments[F];C[T].fn.apply(C[T].context,P)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,x){var g=n?n+u:u;if(!this._events[g])return this;if(!d)return o(this,g),this;var y=this._events[g];if(y.fn)y.fn===d&&(!x||y.once)&&(!f||y.context===f)&&o(this,g);else{for(var v=0,C=[],N=y.length;v<N;v++)(y[v].fn!==d||x&&!y[v].once||f&&y[v].context!==f)&&C.push(y[v]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(SV)),SV.exports}var Dbt=Lbt();const boe=Ii(Dbt);let Bbt=class{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new boe})}on(e,n){this._emitter.on(e,n)}once(e,n){this._emitter.once(e,n)}off(e,n){this._emitter.off(e,n)}emit(e,...n){const r=n[0];this._emitter.emit(e,{uid:this.uid,...r})}listenerCount(e){return this._emitter.listenerCount(e)}};function $bt(t){return new Bbt(t)}function Ubt(t,e){return JSON.parse(t,(n,r)=>{let s=r;return(s==null?void 0:s.__type)==="bigint"&&(s=BigInt(s.value)),(s==null?void 0:s.__type)==="Map"&&(s=new Map(s.value)),(e==null?void 0:e(n,s))??s})}function G0e(t,e){return t.slice(0,e).join(".")||"."}function K0e(t,e){const{length:n}=t;for(let r=0;r<n;++r)if(t[r]===e)return r+1;return 0}function zbt(t,e){const n=typeof t=="function",r=typeof e=="function",s=[],a=[];return function(l,c){if(typeof c=="object")if(s.length){const u=K0e(s,this);u===0?s[s.length]=this:(s.splice(u),a.splice(u)),a[a.length]=l;const d=K0e(s,c);if(d!==0)return r?e.call(this,l,c,G0e(a,d)):`[ref=${G0e(a,d)}]`}else s[0]=c,a[0]=l;return n?t.call(this,l,c):c}}function Hbt(t,e,n,r){return JSON.stringify(t,zbt((s,a)=>{let o=a;return typeof o=="bigint"&&(o={__type:"bigint",value:a.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(a.entries())}),(e==null?void 0:e(s,o))??o},r),n??void 0)}function Vbt(t){const{deserialize:e=Ubt,key:n="wagmi",serialize:r=Hbt,storage:s=VTe}=t;function a(o){return o instanceof Promise?o.then(l=>l).catch(()=>null):o}return{...s,key:n,async getItem(o,l){const c=s.getItem(`${n}.${o}`),u=await a(c);return u?e(u)??null:l??null},async setItem(o,l){const c=`${n}.${o}`;l===null?await a(s.removeItem(c)):await a(s.setItem(c,r(l)))},async removeItem(o){await a(s.removeItem(`${n}.${o}`))}}}const VTe={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Wbt(){const t=typeof window<"u"&&window.localStorage?window.localStorage:VTe;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,n){try{t.setItem(e,n)}catch{}}}}const hee=256;let _I=hee,kI;function qbt(t=11){if(!kI||_I+t>hee*2){kI="",_I=0;for(let e=0;e<hee;e++)kI+=(256+Math.random()*256|0).toString(16).substring(1)}return kI.substring(_I,_I+++t)}function Gbt(t){const{multiInjectedProviderDiscovery:e=!0,storage:n=Vbt({storage:Wbt()}),syncConnectedChain:r=!0,ssr:s=!1,...a}=t,o=typeof window<"u"&&e?Pbt():void 0,l=CV(()=>a.chains),c=CV(()=>{const F=[],$=new Set;for(const L of a.connectors??[]){const z=u(L);if(F.push(z),!s&&z.rdns){const X=typeof z.rdns=="string"?[z.rdns]:z.rdns;for(const ne of X)$.add(ne)}}if(!s&&o){const L=o.getProviders();for(const z of L)$.has(z.info.rdns)||F.push(u(d(z)))}return F});function u(F){var z;const $=$bt(qbt()),L={...F({emitter:$,chains:l.getState(),storage:n,transports:a.transports}),emitter:$,uid:$.uid};return $.on("connect",T),(z=L.setup)==null||z.call(L),L}function d(F){const{info:$}=F,L=F.provider;return b$({target:{...$,id:$.rdns,provider:L}})}const f=new Map;function x(F={}){const $=F.chainId??C.getState().chainId,L=l.getState().find(X=>X.id===$);if(F.chainId&&!L)throw new H3;{const X=f.get(C.getState().chainId);if(X&&!L)return X;if(!L)throw new H3}{const X=f.get($);if(X)return X}let z;if(a.client)z=a.client({chain:L});else{const X=L.id,ne=l.getState().map(te=>te.id),J={},K=Object.entries(a);for(const[te,fe]of K)if(!(te==="chains"||te==="client"||te==="connectors"||te==="transports"))if(typeof fe=="object")if(X in fe)J[te]=fe[X];else{if(ne.some(se=>se in fe))continue;J[te]=fe}else J[te]=fe;z=DTe({...J,chain:L,batch:J.batch??{multicall:!0},transport:te=>a.transports[X]({...te,connectors:c})})}return f.set($,z),z}function g(){return{chainId:l.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let y;const v="0.0.0-canary-";IO.startsWith(v)?y=Number.parseInt(IO.replace(v,"")):y=Number.parseInt(IO.split(".")[0]??"0");const C=CV(Fbt(n?Rbt(g,{migrate(F,$){if($===y)return F;const L=g(),z=N(F,L.chainId);return{...L,chainId:z}},name:"store",partialize(F){return{connections:{__type:"Map",value:Array.from(F.connections.entries()).map(([$,L])=>{const{id:z,name:X,type:ne,uid:J}=L.connector;return[$,{...L,connector:{id:z,name:X,type:ne,uid:J}}]})},chainId:F.chainId,current:F.current}},merge(F,$){typeof F=="object"&&F&&"status"in F&&delete F.status;const L=N(F,$.chainId);return{...$,...F,chainId:L}},skipHydration:s,storage:n,version:y}):g));C.setState(g());function N(F,$){return F&&typeof F=="object"&&"chainId"in F&&typeof F.chainId=="number"&&l.getState().some(L=>L.id===F.chainId)?F.chainId:$}r&&C.subscribe(({connections:F,current:$})=>{var L;return $?(L=F.get($))==null?void 0:L.chainId:void 0},F=>{if(l.getState().some(L=>L.id===F))return C.setState(L=>({...L,chainId:F??L.chainId}))}),o==null||o.subscribe(F=>{const $=new Set,L=new Set;for(const X of c.getState())if($.add(X.id),X.rdns){const ne=typeof X.rdns=="string"?[X.rdns]:X.rdns;for(const J of ne)L.add(J)}const z=[];for(const X of F){if(L.has(X.info.rdns))continue;const ne=u(d(X));$.has(ne.id)||z.push(ne)}n&&!C.persist.hasHydrated()||c.setState(X=>[...X,...z],!0)});function P(F){C.setState($=>{const L=$.connections.get(F.uid);return L?{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts??L.accounts,chainId:F.chainId??L.chainId,connector:L.connector})}:$})}function T(F){C.getState().status==="connecting"||C.getState().status==="reconnecting"||C.setState($=>{const L=c.getState().find(z=>z.uid===F.uid);return L?(L.emitter.listenerCount("connect")&&L.emitter.off("connect",P),L.emitter.listenerCount("change")||L.emitter.on("change",P),L.emitter.listenerCount("disconnect")||L.emitter.on("disconnect",M),{...$,connections:new Map($.connections).set(F.uid,{accounts:F.accounts,chainId:F.chainId,connector:L}),current:F.uid,status:"connected"}):$})}function M(F){C.setState($=>{const L=$.connections.get(F.uid);if(L){const X=L.connector;X.emitter.listenerCount("change")&&L.connector.emitter.off("change",P),X.emitter.listenerCount("disconnect")&&L.connector.emitter.off("disconnect",M),X.emitter.listenerCount("connect")||L.connector.emitter.on("connect",T)}if($.connections.delete(F.uid),$.connections.size===0)return{...$,connections:new Map,current:null,status:"disconnected"};const z=$.connections.values().next().value;return{...$,connections:new Map($.connections),current:z.connector.uid}})}return{get chains(){return l.getState()},get connectors(){return c.getState()},storage:n,getClient:x,get state(){return C.getState()},setState(F){let $;typeof F=="function"?$=F(C.getState()):$=F;const L=g();typeof $!="object"&&($=L),Object.keys(L).some(X=>!(X in $))&&($=L),C.setState($,!0)},subscribe(F,$,L){return C.subscribe(F,$,L?{...L,fireImmediately:L.emitImmediately}:void 0)},_internal:{mipd:o,store:C,ssr:!!s,syncConnectedChain:r,transports:a.transports,chains:{setState(F){const $=typeof F=="function"?F(l.getState()):F;if($.length!==0)return l.setState($,!0)},subscribe(F){return l.subscribe(F)}},connectors:{providerDetailToConnector:d,setup:u,setState(F){return c.setState(typeof F=="function"?F(c.getState()):F,!0)},subscribe(F){return c.subscribe(F)}},events:{change:P,connect:T,disconnect:M}}}}function Kbt(t,e){const{initialState:n,reconnectOnMount:r}=e;return n&&!t._internal.store.persist.hasHydrated()&&t.setState({...n,chainId:t.chains.some(s=>s.id===n.chainId)?n.chainId:t.chains[0].id,connections:r?n.connections:new Map,status:r?"reconnecting":"disconnected"}),{async onMount(){t._internal.ssr&&(await t._internal.store.persist.rehydrate(),t._internal.mipd&&t._internal.connectors.setState(s=>{var c;const a=new Set;for(const u of s??[])if(u.rdns){const d=Array.isArray(u.rdns)?u.rdns:[u.rdns];for(const f of d)a.add(f)}const o=[],l=((c=t._internal.mipd)==null?void 0:c.getProviders())??[];for(const u of l){if(a.has(u.info.rdns))continue;const d=t._internal.connectors.providerDetailToConnector(u),f=t._internal.connectors.setup(d);o.push(f)}return[...s,...o]})),r?ybt(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}function Ybt(t){var a,o,l;const{chain:e}=t,n=e.rpcUrls.default.http[0];if(!t.transports)return[n];const r=(o=(a=t.transports)==null?void 0:a[e.id])==null?void 0:o.call(a,{chain:e});return(((l=r==null?void 0:r.value)==null?void 0:l.transports)||[r]).map(({value:c})=>(c==null?void 0:c.url)||n)}function Xbt(t){const{children:e,config:n,initialState:r,reconnectOnMount:s=!0}=t,{onMount:a}=Kbt(n,{initialState:r,reconnectOnMount:s});n._internal.ssr||a();const o=m.useRef(!0);return m.useEffect(()=>{if(o.current&&n._internal.ssr)return a(),()=>{o.current=!1}},[]),e}const WTe=m.createContext(void 0);function Qbt(t){const{children:e,config:n}=t,r={value:n};return m.createElement(Xbt,t,m.createElement(WTe.Provider,r,e))}const Zbt="2.14.16",Jbt=()=>`wagmi@${Zbt}`;let eyt=class extends M1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return Jbt()}};class tyt extends eyt{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Tl(t={}){const e=t.config??m.useContext(WTe);if(!e)throw new tyt;return e}function nyt(t,e){const{onChange:n}=e;return t._internal.chains.subscribe((r,s)=>{n(r,s)})}var NV={exports:{}},AV={},jV={exports:{}},EV={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Y0e;function ryt(){if(Y0e)return EV;Y0e=1;var t=xx();function e(f,x){return f===x&&(f!==0||1/f===1/x)||f!==f&&x!==x}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function l(f,x){var g=x(),y=r({inst:{value:g,getSnapshot:x}}),v=y[0].inst,C=y[1];return a(function(){v.value=g,v.getSnapshot=x,c(v)&&C({inst:v})},[f,g,x]),s(function(){return c(v)&&C({inst:v}),f(function(){c(v)&&C({inst:v})})},[f]),o(g),g}function c(f){var x=f.getSnapshot;f=f.value;try{var g=x();return!n(f,g)}catch{return!0}}function u(f,x){return x()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:l;return EV.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,EV}var X0e;function syt(){return X0e||(X0e=1,jV.exports=ryt()),jV.exports}/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Q0e;function iyt(){if(Q0e)return AV;Q0e=1;var t=xx(),e=syt();function n(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,l=t.useMemo,c=t.useDebugValue;return AV.useSyncExternalStoreWithSelector=function(u,d,f,x,g){var y=a(null);if(y.current===null){var v={hasValue:!1,value:null};y.current=v}else v=y.current;y=l(function(){function N($){if(!P){if(P=!0,T=$,$=x($),g!==void 0&&v.hasValue){var L=v.value;if(g(L,$))return M=L}return M=$}if(L=M,r(T,$))return L;var z=x($);return g!==void 0&&g(L,z)?(T=$,L):(T=$,M=z)}var P=!1,T,M,F=f===void 0?null:f;return[function(){return N(d())},F===null?void 0:function(){return N(F())}]},[d,f,x,g]);var C=s(u,y[0],y[1]);return o(function(){v.hasValue=!0,v.value=C},[C]),c(C),C},AV}var Z0e;function ayt(){return Z0e||(Z0e=1,NV.exports=iyt()),NV.exports}var qTe=ayt();const _V=t=>typeof t=="object"&&!Array.isArray(t);function oyt(t,e,n=e,r=t2){const s=m.useRef([]),a=qTe.useSyncExternalStoreWithSelector(t,e,n,o=>o,(o,l)=>{if(_V(o)&&_V(l)&&s.current.length){for(const c of s.current)if(!r(o[c],l[c]))return!1;return!0}return r(o,l)});return m.useMemo(()=>{if(_V(a)){const o={...a};let l={};for(const[c,u]of Object.entries(o))l={...l,[c]:{configurable:!1,enumerable:!0,get:()=>(s.current.includes(c)||s.current.push(c),u)}};return Object.defineProperties(o,l),o}return a},[a])}function ns(t={}){const e=Tl(t);return oyt(n=>HTe(e,{onChange:n}),()=>UTe(e))}function GTe(t={}){const{onConnect:e,onDisconnect:n}=t,r=Tl(t);m.useEffect(()=>HTe(r,{onChange(s,a){if((a.status==="reconnecting"||a.status==="connecting"&&a.address===void 0)&&s.status==="connected"){const{address:o,addresses:l,chain:c,chainId:u,connector:d}=s,f=a.status==="reconnecting"||a.status===void 0;e==null||e({address:o,addresses:l,chain:c,chainId:u,connector:d,isReconnected:f})}else a.status==="connected"&&s.status==="disconnected"&&(n==null||n())}}),[r,e,n])}var ZA=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},V3=typeof window>"u"||"Deno"in globalThis;function Qh(){}function lyt(t,e){return typeof t=="function"?t(e):t}function pee(t){return typeof t=="number"&&t>=0&&t!==1/0}function KTe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function S4(t,e){return typeof t=="function"?t(e):t}function lm(t,e){return typeof t=="function"?t(e):t}function J0e(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==yoe(o,e.options))return!1}else if(!HE(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||a&&!a(e))}function exe(t,e){const{exact:n,status:r,predicate:s,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(W3(e.options.mutationKey)!==W3(a))return!1}else if(!HE(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function yoe(t,e){return((e==null?void 0:e.queryKeyHashFn)||W3)(t)}function W3(t){return JSON.stringify(t,(e,n)=>mee(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function HE(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>HE(t[n],e[n])):!1}function voe(t,e){if(t===e)return t;const n=txe(t)&&txe(e);if(n||mee(t)&&mee(e)){const r=n?t:Object.keys(t),s=r.length,a=n?e:Object.keys(e),o=a.length,l=n?[]:{};let c=0;for(let u=0;u<o;u++){const d=n?u:a[u];(!n&&r.includes(d)||n)&&t[d]===void 0&&e[d]===void 0?(l[d]=void 0,c++):(l[d]=voe(t[d],e[d]),l[d]===t[d]&&t[d]!==void 0&&c++)}return s===o&&c===s?t:l}return e}function lR(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function txe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function mee(t){if(!nxe(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!nxe(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function nxe(t){return Object.prototype.toString.call(t)==="[object Object]"}function cyt(t){return new Promise(e=>{setTimeout(e,t)})}function xee(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?voe(t,e):e}function uyt(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function dyt(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var woe=Symbol();function YTe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===woe?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Tw,Xb,V4,i8e,fyt=(i8e=class extends ZA{constructor(){super();Rn(this,Tw);Rn(this,Xb);Rn(this,V4);Ut(this,V4,e=>{if(!V3&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){He(this,Xb)||this.setEventListener(He(this,V4))}onUnsubscribe(){var e;this.hasListeners()||((e=He(this,Xb))==null||e.call(this),Ut(this,Xb,void 0))}setEventListener(e){var n;Ut(this,V4,e),(n=He(this,Xb))==null||n.call(this),Ut(this,Xb,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){He(this,Tw)!==e&&(Ut(this,Tw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof He(this,Tw)=="boolean"?He(this,Tw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Tw=new WeakMap,Xb=new WeakMap,V4=new WeakMap,i8e),Coe=new fyt,W4,Qb,q4,a8e,hyt=(a8e=class extends ZA{constructor(){super();Rn(this,W4,!0);Rn(this,Qb);Rn(this,q4);Ut(this,q4,e=>{if(!V3&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){He(this,Qb)||this.setEventListener(He(this,q4))}onUnsubscribe(){var e;this.hasListeners()||((e=He(this,Qb))==null||e.call(this),Ut(this,Qb,void 0))}setEventListener(e){var n;Ut(this,q4,e),(n=He(this,Qb))==null||n.call(this),Ut(this,Qb,e(this.setOnline.bind(this)))}setOnline(e){He(this,W4)!==e&&(Ut(this,W4,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return He(this,W4)}},W4=new WeakMap,Qb=new WeakMap,q4=new WeakMap,a8e),cR=new hyt;function gee(){let t,e;const n=new Promise((s,a)=>{t=s,e=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}function pyt(t){return Math.min(1e3*2**t,3e4)}function XTe(t){return(t??"online")==="online"?cR.isOnline():!0}var QTe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function kV(t){return t instanceof QTe}function ZTe(t){let e=!1,n=0,r=!1,s;const a=gee(),o=v=>{var C;r||(x(new QTe(v)),(C=t.abort)==null||C.call(t))},l=()=>{e=!0},c=()=>{e=!1},u=()=>Coe.isFocused()&&(t.networkMode==="always"||cR.isOnline())&&t.canRun(),d=()=>XTe(t.networkMode)&&t.canRun(),f=v=>{var C;r||(r=!0,(C=t.onSuccess)==null||C.call(t,v),s==null||s(),a.resolve(v))},x=v=>{var C;r||(r=!0,(C=t.onError)==null||C.call(t,v),s==null||s(),a.reject(v))},g=()=>new Promise(v=>{var C;s=N=>{(r||u())&&v(N)},(C=t.onPause)==null||C.call(t)}).then(()=>{var v;s=void 0,r||(v=t.onContinue)==null||v.call(t)}),y=()=>{if(r)return;let v;const C=n===0?t.initialPromise:void 0;try{v=C??t.fn()}catch(N){v=Promise.reject(N)}Promise.resolve(v).then(f).catch(N=>{var $;if(r)return;const P=t.retry??(V3?0:3),T=t.retryDelay??pyt,M=typeof T=="function"?T(n,N):T,F=P===!0||typeof P=="number"&&n<P||typeof P=="function"&&P(n,N);if(e||!F){x(N);return}n++,($=t.onFail)==null||$.call(t,n,N),cyt(M).then(()=>u()?void 0:g()).then(()=>{e?x(N):y()})})};return{promise:a,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?y():g().then(y),a)}}var myt=t=>setTimeout(t,0);function xyt(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=myt;const a=l=>{e?t.push(l):s(()=>{n(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var sc=xyt(),Pw,o8e,JTe=(o8e=class{constructor(){Rn(this,Pw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pee(this.gcTime)&&Ut(this,Pw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(V3?1/0:5*60*1e3))}clearGcTimeout(){He(this,Pw)&&(clearTimeout(He(this,Pw)),Ut(this,Pw,void 0))}},Pw=new WeakMap,o8e),G4,K4,qh,Iw,Su,Ik,Fw,Xp,fg,l8e,gyt=(l8e=class extends JTe{constructor(e){super();Rn(this,Xp);Rn(this,G4);Rn(this,K4);Rn(this,qh);Rn(this,Iw);Rn(this,Su);Rn(this,Ik);Rn(this,Fw);Ut(this,Fw,!1),Ut(this,Ik,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ut(this,Iw,e.client),Ut(this,qh,He(this,Iw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ut(this,G4,byt(this.options)),this.state=e.state??He(this,G4),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=He(this,Su))==null?void 0:e.promise}setOptions(e){this.options={...He(this,Ik),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&He(this,qh).remove(this)}setData(e,n){const r=xee(this.state.data,e,this.options);return Cr(this,Xp,fg).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Cr(this,Xp,fg).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=He(this,Su))==null?void 0:r.promise;return(s=He(this,Su))==null||s.cancel(e),n?n.then(Qh).catch(Qh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(He(this,G4))}isActive(){return this.observers.some(e=>lm(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===woe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!KTe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=He(this,Su))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=He(this,Su))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),He(this,qh).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(He(this,Su)&&(He(this,Fw)?He(this,Su).cancel({revert:!0}):He(this,Su).cancelRetry()),this.scheduleGc()),He(this,qh).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Cr(this,Xp,fg).call(this,{type:"invalidate"})}fetch(e,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(He(this,Su))return He(this,Su).continueRetry(),He(this,Su).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(x=>x.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Ut(this,Fw,!0),r.signal)})},a=()=>{const f=YTe(this.options,n),x={client:He(this,Iw),queryKey:this.queryKey,meta:this.meta};return s(x),Ut(this,Fw,!1),this.options.persister?this.options.persister(f,x,this):f(x)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:He(this,Iw),state:this.state,fetchFn:a};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),Ut(this,K4,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Cr(this,Xp,fg).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var x,g,y,v;kV(f)&&f.silent||Cr(this,Xp,fg).call(this,{type:"error",error:f}),kV(f)||((g=(x=He(this,qh).config).onError)==null||g.call(x,f,this),(v=(y=He(this,qh).config).onSettled)==null||v.call(y,this.state.data,f,this)),this.scheduleGc()};return Ut(this,Su,ZTe({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var x,g,y,v;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(C){l(C);return}(g=(x=He(this,qh).config).onSuccess)==null||g.call(x,f,this),(v=(y=He(this,qh).config).onSettled)==null||v.call(y,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,x)=>{Cr(this,Xp,fg).call(this,{type:"failed",failureCount:f,error:x})},onPause:()=>{Cr(this,Xp,fg).call(this,{type:"pause"})},onContinue:()=>{Cr(this,Xp,fg).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),He(this,Su).start()}},G4=new WeakMap,K4=new WeakMap,qh=new WeakMap,Iw=new WeakMap,Su=new WeakMap,Ik=new WeakMap,Fw=new WeakMap,Xp=new WeakSet,fg=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ePe(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return kV(s)&&s.revert&&He(this,K4)?{...He(this,K4),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),sc.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),He(this,qh).notify({query:this,type:"updated",action:e})})},l8e);function ePe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XTe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function byt(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var p0,c8e,yyt=(c8e=class extends ZA{constructor(e={}){super();Rn(this,p0);this.config=e,Ut(this,p0,new Map)}build(e,n,r){const s=n.queryKey,a=n.queryHash??yoe(s,n);let o=this.get(a);return o||(o=new gyt({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){He(this,p0).has(e.queryHash)||(He(this,p0).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=He(this,p0).get(e.queryHash);n&&(e.destroy(),n===e&&He(this,p0).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){sc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return He(this,p0).get(e)}getAll(){return[...He(this,p0).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>J0e(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>J0e(e,r)):n}notify(e){sc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){sc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},p0=new WeakMap,c8e),m0,td,Ow,x0,Lb,u8e,vyt=(u8e=class extends JTe{constructor(e){super();Rn(this,x0);Rn(this,m0);Rn(this,td);Rn(this,Ow);this.mutationId=e.mutationId,Ut(this,td,e.mutationCache),Ut(this,m0,[]),this.state=e.state||tPe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){He(this,m0).includes(e)||(He(this,m0).push(e),this.clearGcTimeout(),He(this,td).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ut(this,m0,He(this,m0).filter(n=>n!==e)),this.scheduleGc(),He(this,td).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){He(this,m0).length||(this.state.status==="pending"?this.scheduleGc():He(this,td).remove(this))}continue(){var e;return((e=He(this,Ow))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,u,d,f,x,g,y,v,C,N,P,T,M,F,$,L,z;const n=()=>{Cr(this,x0,Lb).call(this,{type:"continue"})};Ut(this,Ow,ZTe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(X,ne)=>{Cr(this,x0,Lb).call(this,{type:"failed",failureCount:X,error:ne})},onPause:()=>{Cr(this,x0,Lb).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>He(this,td).canRun(this)}));const r=this.state.status==="pending",s=!He(this,Ow).canStart();try{if(r)n();else{Cr(this,x0,Lb).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(a=He(this,td).config).onMutate)==null?void 0:o.call(a,e,this));const ne=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));ne!==this.state.context&&Cr(this,x0,Lb).call(this,{type:"pending",context:ne,variables:e,isPaused:s})}const X=await He(this,Ow).start();return await((d=(u=He(this,td).config).onSuccess)==null?void 0:d.call(u,X,e,this.state.context,this)),await((x=(f=this.options).onSuccess)==null?void 0:x.call(f,X,e,this.state.context)),await((y=(g=He(this,td).config).onSettled)==null?void 0:y.call(g,X,null,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,X,null,e,this.state.context)),Cr(this,x0,Lb).call(this,{type:"success",data:X}),X}catch(X){try{throw await((P=(N=He(this,td).config).onError)==null?void 0:P.call(N,X,e,this.state.context,this)),await((M=(T=this.options).onError)==null?void 0:M.call(T,X,e,this.state.context)),await(($=(F=He(this,td).config).onSettled)==null?void 0:$.call(F,void 0,X,this.state.variables,this.state.context,this)),await((z=(L=this.options).onSettled)==null?void 0:z.call(L,void 0,X,e,this.state.context)),X}finally{Cr(this,x0,Lb).call(this,{type:"error",error:X})}}finally{He(this,td).runNext(this)}}},m0=new WeakMap,td=new WeakMap,Ow=new WeakMap,x0=new WeakSet,Lb=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sc.batch(()=>{He(this,m0).forEach(r=>{r.onMutationUpdate(e)}),He(this,td).notify({mutation:this,type:"updated",action:e})})},u8e);function tPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ng,Qp,Fk,d8e,wyt=(d8e=class extends ZA{constructor(e={}){super();Rn(this,Ng);Rn(this,Qp);Rn(this,Fk);this.config=e,Ut(this,Ng,new Set),Ut(this,Qp,new Map),Ut(this,Fk,0)}build(e,n,r){const s=new vyt({mutationCache:this,mutationId:++gb(this,Fk)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){He(this,Ng).add(e);const n=TI(e);if(typeof n=="string"){const r=He(this,Qp).get(n);r?r.push(e):He(this,Qp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(He(this,Ng).delete(e)){const n=TI(e);if(typeof n=="string"){const r=He(this,Qp).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&He(this,Qp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=TI(e);if(typeof n=="string"){const r=He(this,Qp).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=TI(e);if(typeof n=="string"){const s=(r=He(this,Qp).get(n))==null?void 0:r.find(a=>a!==e&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sc.batch(()=>{He(this,Ng).forEach(e=>{this.notify({type:"removed",mutation:e})}),He(this,Ng).clear(),He(this,Qp).clear()})}getAll(){return Array.from(He(this,Ng))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>exe(n,r))}findAll(e={}){return this.getAll().filter(n=>exe(e,n))}notify(e){sc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return sc.batch(()=>Promise.all(e.map(n=>n.continue().catch(Qh))))}},Ng=new WeakMap,Qp=new WeakMap,Fk=new WeakMap,d8e);function TI(t){var e;return(e=t.options.scope)==null?void 0:e.id}function rxe(t){return{onFetch:(e,n)=>{var d,f,x,g,y;const r=e.options,s=(x=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:x.direction,a=((g=e.state.data)==null?void 0:g.pages)||[],o=((y=e.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const C=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},N=YTe(e.options,e.fetchOptions),P=async(T,M,F)=>{if(v)return Promise.reject();if(M==null&&T.pages.length)return Promise.resolve(T);const $={client:e.client,queryKey:e.queryKey,pageParam:M,direction:F?"backward":"forward",meta:e.options.meta};C($);const L=await N($),{maxPages:z}=e.options,X=F?dyt:uyt;return{pages:X(T.pages,L,z),pageParams:X(T.pageParams,M,z)}};if(s&&a.length){const T=s==="backward",M=T?Cyt:sxe,F={pages:a,pageParams:o},$=M(r,F);l=await P(F,$,T)}else{const T=t??a.length;do{const M=c===0?o[0]??r.initialPageParam:sxe(r,l);if(c>0&&M==null)break;l=await P(l,M),c++}while(c<T)}return l};e.options.persister?e.fetchFn=()=>{var v,C;return(C=(v=e.options).persister)==null?void 0:C.call(v,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function sxe(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Cyt(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var tl,Zb,Jb,Y4,X4,ey,Q4,Z4,f8e,Syt=(f8e=class{constructor(t={}){Rn(this,tl);Rn(this,Zb);Rn(this,Jb);Rn(this,Y4);Rn(this,X4);Rn(this,ey);Rn(this,Q4);Rn(this,Z4);Ut(this,tl,t.queryCache||new yyt),Ut(this,Zb,t.mutationCache||new wyt),Ut(this,Jb,t.defaultOptions||{}),Ut(this,Y4,new Map),Ut(this,X4,new Map),Ut(this,ey,0)}mount(){gb(this,ey)._++,He(this,ey)===1&&(Ut(this,Q4,Coe.subscribe(async t=>{t&&(await this.resumePausedMutations(),He(this,tl).onFocus())})),Ut(this,Z4,cR.subscribe(async t=>{t&&(await this.resumePausedMutations(),He(this,tl).onOnline())})))}unmount(){var t,e;gb(this,ey)._--,He(this,ey)===0&&((t=He(this,Q4))==null||t.call(this),Ut(this,Q4,void 0),(e=He(this,Z4))==null||e.call(this),Ut(this,Z4,void 0))}isFetching(t){return He(this,tl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return He(this,Zb).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=He(this,tl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=He(this,tl).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(S4(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return He(this,tl).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=He(this,tl).get(r.queryHash),a=s==null?void 0:s.state.data,o=lyt(e,a);if(o!==void 0)return He(this,tl).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return sc.batch(()=>He(this,tl).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=He(this,tl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=He(this,tl);sc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=He(this,tl);return sc.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=sc.batch(()=>He(this,tl).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Qh).catch(Qh)}invalidateQueries(t,e={}){return sc.batch(()=>(He(this,tl).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=sc.batch(()=>He(this,tl).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Qh)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Qh)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=He(this,tl).build(this,e);return n.isStaleByTime(S4(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Qh).catch(Qh)}fetchInfiniteQuery(t){return t.behavior=rxe(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Qh).catch(Qh)}ensureInfiniteQueryData(t){return t.behavior=rxe(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return cR.isOnline()?He(this,Zb).resumePausedMutations():Promise.resolve()}getQueryCache(){return He(this,tl)}getMutationCache(){return He(this,Zb)}getDefaultOptions(){return He(this,Jb)}setDefaultOptions(t){Ut(this,Jb,t)}setQueryDefaults(t,e){He(this,Y4).set(W3(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...He(this,Y4).values()],n={};return e.forEach(r=>{HE(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){He(this,X4).set(W3(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...He(this,X4).values()],n={};return e.forEach(r=>{HE(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...He(this,Jb).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=yoe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===woe&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...He(this,Jb).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){He(this,tl).clear(),He(this,Zb).clear()}},tl=new WeakMap,Zb=new WeakMap,Jb=new WeakMap,Y4=new WeakMap,X4=new WeakMap,ey=new WeakMap,Q4=new WeakMap,Z4=new WeakMap,f8e),Wd,ea,Ok,nd,Mw,J4,ty,ny,Mk,eS,tS,Rw,Lw,ry,nS,La,z7,bee,yee,vee,wee,Cee,See,Nee,nPe,h8e,Nyt=(h8e=class extends ZA{constructor(e,n){super();Rn(this,La);Rn(this,Wd);Rn(this,ea);Rn(this,Ok);Rn(this,nd);Rn(this,Mw);Rn(this,J4);Rn(this,ty);Rn(this,ny);Rn(this,Mk);Rn(this,eS);Rn(this,tS);Rn(this,Rw);Rn(this,Lw);Rn(this,ry);Rn(this,nS,new Set);this.options=n,Ut(this,Wd,e),Ut(this,ny,null),Ut(this,ty,gee()),this.options.experimental_prefetchInRender||He(this,ty).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(He(this,ea).addObserver(this),ixe(He(this,ea),this.options)?Cr(this,La,z7).call(this):this.updateResult(),Cr(this,La,wee).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Aee(He(this,ea),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Aee(He(this,ea),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Cr(this,La,Cee).call(this),Cr(this,La,See).call(this),He(this,ea).removeObserver(this)}setOptions(e){const n=this.options,r=He(this,ea);if(this.options=He(this,Wd).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof lm(this.options.enabled,He(this,ea))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Cr(this,La,Nee).call(this),He(this,ea).setOptions(this.options),n._defaulted&&!lR(this.options,n)&&He(this,Wd).getQueryCache().notify({type:"observerOptionsUpdated",query:He(this,ea),observer:this});const s=this.hasListeners();s&&axe(He(this,ea),r,this.options,n)&&Cr(this,La,z7).call(this),this.updateResult(),s&&(He(this,ea)!==r||lm(this.options.enabled,He(this,ea))!==lm(n.enabled,He(this,ea))||S4(this.options.staleTime,He(this,ea))!==S4(n.staleTime,He(this,ea)))&&Cr(this,La,bee).call(this);const a=Cr(this,La,yee).call(this);s&&(He(this,ea)!==r||lm(this.options.enabled,He(this,ea))!==lm(n.enabled,He(this,ea))||a!==He(this,ry))&&Cr(this,La,vee).call(this,a)}getOptimisticResult(e){const n=He(this,Wd).getQueryCache().build(He(this,Wd),e),r=this.createResult(n,e);return jyt(this,r)&&(Ut(this,nd,r),Ut(this,J4,this.options),Ut(this,Mw,He(this,ea).state)),r}getCurrentResult(){return He(this,nd)}trackResult(e,n){const r={};return Object.keys(e).forEach(s=>{Object.defineProperty(r,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),n==null||n(s),e[s])})}),r}trackProp(e){He(this,nS).add(e)}getCurrentQuery(){return He(this,ea)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=He(this,Wd).defaultQueryOptions(e),r=He(this,Wd).getQueryCache().build(He(this,Wd),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Cr(this,La,z7).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),He(this,nd)))}createResult(e,n){var X;const r=He(this,ea),s=this.options,a=He(this,nd),o=He(this,Mw),l=He(this,J4),u=e!==r?e.state:He(this,Ok),{state:d}=e;let f={...d},x=!1,g;if(n._optimisticResults){const ne=this.hasListeners(),J=!ne&&ixe(e,n),K=ne&&axe(e,r,n,s);(J||K)&&(f={...f,...ePe(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:C}=f;g=f.data;let N=!1;if(n.placeholderData!==void 0&&g===void 0&&C==="pending"){let ne;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(ne=a.data,N=!0):ne=typeof n.placeholderData=="function"?n.placeholderData((X=He(this,tS))==null?void 0:X.state.data,He(this,tS)):n.placeholderData,ne!==void 0&&(C="success",g=xee(a==null?void 0:a.data,ne,n),x=!0)}if(n.select&&g!==void 0&&!N)if(a&&g===(o==null?void 0:o.data)&&n.select===He(this,Mk))g=He(this,eS);else try{Ut(this,Mk,n.select),g=n.select(g),g=xee(a==null?void 0:a.data,g,n),Ut(this,eS,g),Ut(this,ny,null)}catch(ne){Ut(this,ny,ne)}He(this,ny)&&(y=He(this,ny),g=He(this,eS),v=Date.now(),C="error");const P=f.fetchStatus==="fetching",T=C==="pending",M=C==="error",F=T&&P,$=g!==void 0,z={status:C,fetchStatus:f.fetchStatus,isPending:T,isSuccess:C==="success",isError:M,isInitialLoading:F,isLoading:F,data:g,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:P,isRefetching:P&&!T,isLoadingError:M&&!$,isPaused:f.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:M&&$,isStale:Soe(e,n),refetch:this.refetch,promise:He(this,ty)};if(this.options.experimental_prefetchInRender){const ne=te=>{z.status==="error"?te.reject(z.error):z.data!==void 0&&te.resolve(z.data)},J=()=>{const te=Ut(this,ty,z.promise=gee());ne(te)},K=He(this,ty);switch(K.status){case"pending":e.queryHash===r.queryHash&&ne(K);break;case"fulfilled":(z.status==="error"||z.data!==K.value)&&J();break;case"rejected":(z.status!=="error"||z.error!==K.reason)&&J();break}}return z}updateResult(){const e=He(this,nd),n=this.createResult(He(this,ea),this.options);if(Ut(this,Mw,He(this,ea).state),Ut(this,J4,this.options),He(this,Mw).data!==void 0&&Ut(this,tS,He(this,ea)),lR(n,e))return;Ut(this,nd,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!He(this,nS).size)return!0;const o=new Set(a??He(this,nS));return this.options.throwOnError&&o.add("error"),Object.keys(He(this,nd)).some(l=>{const c=l;return He(this,nd)[c]!==e[c]&&o.has(c)})};Cr(this,La,nPe).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Cr(this,La,wee).call(this)}},Wd=new WeakMap,ea=new WeakMap,Ok=new WeakMap,nd=new WeakMap,Mw=new WeakMap,J4=new WeakMap,ty=new WeakMap,ny=new WeakMap,Mk=new WeakMap,eS=new WeakMap,tS=new WeakMap,Rw=new WeakMap,Lw=new WeakMap,ry=new WeakMap,nS=new WeakMap,La=new WeakSet,z7=function(e){Cr(this,La,Nee).call(this);let n=He(this,ea).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Qh)),n},bee=function(){Cr(this,La,Cee).call(this);const e=S4(this.options.staleTime,He(this,ea));if(V3||He(this,nd).isStale||!pee(e))return;const r=KTe(He(this,nd).dataUpdatedAt,e)+1;Ut(this,Rw,setTimeout(()=>{He(this,nd).isStale||this.updateResult()},r))},yee=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(He(this,ea)):this.options.refetchInterval)??!1},vee=function(e){Cr(this,La,See).call(this),Ut(this,ry,e),!(V3||lm(this.options.enabled,He(this,ea))===!1||!pee(He(this,ry))||He(this,ry)===0)&&Ut(this,Lw,setInterval(()=>{(this.options.refetchIntervalInBackground||Coe.isFocused())&&Cr(this,La,z7).call(this)},He(this,ry)))},wee=function(){Cr(this,La,bee).call(this),Cr(this,La,vee).call(this,Cr(this,La,yee).call(this))},Cee=function(){He(this,Rw)&&(clearTimeout(He(this,Rw)),Ut(this,Rw,void 0))},See=function(){He(this,Lw)&&(clearInterval(He(this,Lw)),Ut(this,Lw,void 0))},Nee=function(){const e=He(this,Wd).getQueryCache().build(He(this,Wd),this.options);if(e===He(this,ea))return;const n=He(this,ea);Ut(this,ea,e),Ut(this,Ok,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},nPe=function(e){sc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(He(this,nd))}),He(this,Wd).getQueryCache().notify({query:He(this,ea),type:"observerResultsUpdated"})})},h8e);function Ayt(t,e){return lm(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function ixe(t,e){return Ayt(t,e)||t.state.data!==void 0&&Aee(t,e,e.refetchOnMount)}function Aee(t,e,n){if(lm(e.enabled,t)!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Soe(t,e)}return!1}function axe(t,e,n,r){return(t!==e||lm(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Soe(t,n)}function Soe(t,e){return lm(e.enabled,t)!==!1&&t.isStaleByTime(S4(e.staleTime,t))}function jyt(t,e){return!lR(t.getCurrentResult(),e)}var sy,iy,qd,Ag,d1,OO,jee,p8e,Eyt=(p8e=class extends ZA{constructor(n,r){super();Rn(this,d1);Rn(this,sy);Rn(this,iy);Rn(this,qd);Rn(this,Ag);Ut(this,sy,n),this.setOptions(r),this.bindMethods(),Cr(this,d1,OO).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=He(this,sy).defaultMutationOptions(n),lR(this.options,r)||He(this,sy).getMutationCache().notify({type:"observerOptionsUpdated",mutation:He(this,qd),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&W3(r.mutationKey)!==W3(this.options.mutationKey)?this.reset():((s=He(this,qd))==null?void 0:s.state.status)==="pending"&&He(this,qd).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=He(this,qd))==null||n.removeObserver(this)}onMutationUpdate(n){Cr(this,d1,OO).call(this),Cr(this,d1,jee).call(this,n)}getCurrentResult(){return He(this,iy)}reset(){var n;(n=He(this,qd))==null||n.removeObserver(this),Ut(this,qd,void 0),Cr(this,d1,OO).call(this),Cr(this,d1,jee).call(this)}mutate(n,r){var s;return Ut(this,Ag,r),(s=He(this,qd))==null||s.removeObserver(this),Ut(this,qd,He(this,sy).getMutationCache().build(He(this,sy),this.options)),He(this,qd).addObserver(this),He(this,qd).execute(n)}},sy=new WeakMap,iy=new WeakMap,qd=new WeakMap,Ag=new WeakMap,d1=new WeakSet,OO=function(){var r;const n=((r=He(this,qd))==null?void 0:r.state)??tPe();Ut(this,iy,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},jee=function(n){sc.batch(()=>{var r,s,a,o,l,c,u,d;if(He(this,Ag)&&this.hasListeners()){const f=He(this,iy).variables,x=He(this,iy).context;(n==null?void 0:n.type)==="success"?((s=(r=He(this,Ag)).onSuccess)==null||s.call(r,n.data,f,x),(o=(a=He(this,Ag)).onSettled)==null||o.call(a,n.data,null,f,x)):(n==null?void 0:n.type)==="error"&&((c=(l=He(this,Ag)).onError)==null||c.call(l,n.error,f,x),(d=(u=He(this,Ag)).onSettled)==null||d.call(u,void 0,n.error,f,x))}this.listeners.forEach(f=>{f(He(this,iy))})})},p8e);function _yt(t,e){return voe(t,e)}function kyt(t){return JSON.stringify(t,(e,n)=>Tyt(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):typeof n=="bigint"?n.toString():n)}function Tyt(t){if(!oxe(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const n=e.prototype;return!(!oxe(n)||!n.hasOwnProperty("isPrototypeOf"))}function oxe(t){return Object.prototype.toString.call(t)==="[object Object]"}function y$(t){const{_defaulted:e,behavior:n,gcTime:r,initialData:s,initialDataUpdatedAt:a,maxPages:o,meta:l,networkMode:c,queryFn:u,queryHash:d,queryKey:f,queryKeyHashFn:x,retry:g,retryDelay:y,structuralSharing:v,getPreviousPageParam:C,getNextPageParam:N,initialPageParam:P,_optimisticResults:T,enabled:M,notifyOnChangeProps:F,placeholderData:$,refetchInterval:L,refetchIntervalInBackground:z,refetchOnMount:X,refetchOnReconnect:ne,refetchOnWindowFocus:J,retryOnMount:K,select:te,staleTime:fe,suspense:q,throwOnError:se,config:ae,connector:W,query:V,...ee}=t;return ee}function Pyt(t){return{mutationFn(e){return rbt(t,e)},mutationKey:["connect"]}}function Iyt(t){return{mutationFn(e){return fbt(t,e)},mutationKey:["disconnect"]}}function Fyt(t,e={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("address is required");return await mbt(t,{...a,address:r})??null},queryKey:Oyt(e)}}function Oyt(t={}){return["balance",y$(t)]}function Myt(t,e={}){return{async queryFn({queryKey:n}){const{name:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("name is required");return gbt(t,{...a,name:r})},queryKey:Ryt(e)}}function Ryt(t={}){return["ensAvatar",y$(t)]}function Lyt(t,e={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:s,...a}=n[1];if(!r)throw new Error("address is required");return bbt(t,{...a,address:r})},queryKey:Dyt(e)}}function Dyt(t={}){return["ensName",y$(t)]}function Byt(t,e={}){return{async queryFn({queryKey:n}){const r=e.abi;if(!r)throw new Error("abi is required");const{functionName:s,scopeKey:a,...o}=n[1],l=(()=>{const c=n[1];if(c.address)return{address:c.address};if(c.code)return{code:c.code};throw new Error("address or code is required")})();if(!s)throw new Error("functionName is required");return zTe(t,{abi:r,functionName:s,args:o.args,...l,...o})},queryKey:$yt(e)}}function $yt(t={}){const{abi:e,...n}=t;return["readContract",y$(n)]}function Uyt(t){return{mutationFn(e){return vbt(t,e)},mutationKey:["signMessage"]}}function zyt(t){return{mutationFn(e){return wbt(t,e)},mutationKey:["signTypedData"]}}function Hyt(t){return{mutationFn(e){return Sbt(t,e)},mutationKey:["switchChain"]}}function Vyt(t){return{mutationFn(e){return _bt(t,e)},mutationKey:["writeContract"]}}var rPe=m.createContext(void 0),sPe=t=>{const e=m.useContext(rPe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Wyt=({client:t,children:e})=>(m.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),i.jsx(rPe.Provider,{value:t,children:e})),iPe=m.createContext(!1),qyt=()=>m.useContext(iPe);iPe.Provider;function Gyt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Kyt=m.createContext(Gyt()),Yyt=()=>m.useContext(Kyt);function aPe(t,e){return typeof t=="function"?t(...e):!!t}function Eee(){}var Xyt=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Qyt=t=>{m.useEffect(()=>{t.clearReset()},[t])},Zyt=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||aPe(n,[t.error,r])),Jyt=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...n)=>Math.max(e(...n),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},e2t=(t,e)=>t.isLoading&&t.isFetching&&!e,t2t=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,lxe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function n2t(t,e,n){var f,x,g,y,v;const r=sPe(),s=qyt(),a=Yyt(),o=r.defaultQueryOptions(t);(x=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||x.call(f,o),o._optimisticResults=s?"isRestoring":"optimistic",Jyt(o),Xyt(o,a),Qyt(a);const l=!r.getQueryCache().get(o.queryHash),[c]=m.useState(()=>new e(r,o)),u=c.getOptimisticResult(o),d=!s&&t.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(C=>{const N=d?c.subscribe(sc.batchCalls(C)):Eee;return c.updateResult(),N},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setOptions(o)},[o,c]),t2t(o,u))throw lxe(o,c,a);if(Zyt({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((y=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||y.call(g,o,u),o.experimental_prefetchInRender&&!V3&&e2t(u,s)){const C=l?lxe(o,c,a):(v=r.getQueryCache().get(o.queryHash))==null?void 0:v.promise;C==null||C.catch(Eee).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function oPe(t,e){return n2t(t,Nyt)}function JA(t,e){const n=sPe(),[r]=m.useState(()=>new Eyt(n,t));m.useEffect(()=>{r.setOptions(t)},[r,t]);const s=m.useSyncExternalStore(m.useCallback(o=>r.subscribe(sc.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=m.useCallback((o,l)=>{r.mutate(o,l).catch(Eee)},[r]);if(s.error&&aPe(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function v$(t){const e=oPe({...t,queryKeyHashFn:kyt});return e.queryKey=t.queryKey,e}function ej(t={}){const e=Tl(t);return m.useSyncExternalStore(n=>Nbt(e,{onChange:n}),()=>z0e(e),()=>z0e(e))}function lPe(t={}){const{address:e,query:n={}}=t,r=Tl(t),s=ej({config:r}),a=Fyt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return v$({...n,...a,enabled:o})}function r2t(t={}){const e=Tl(t);return m.useSyncExternalStore(n=>nyt(e,{onChange:n}),()=>H0e(e),()=>H0e(e))}function s2t(t={}){const e=Tl(t);return m.useSyncExternalStore(n=>jbt(e,{onChange:n}),()=>V0e(e),()=>V0e(e))}function i2t(t={}){const{mutation:e}=t,n=Tl(t),r=Pyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return m.useEffect(()=>n.subscribe(({status:l})=>l,(l,c)=>{c==="connected"&&l==="disconnected"&&o.reset()}),[n,o.reset]),{...o,connect:s,connectAsync:a,connectors:s2t({config:n})}}function a2t(t={}){const e=Tl(t);return m.useSyncExternalStore(n=>Abt(e,{onChange:n}),()=>uee(e),()=>uee(e))}function w$(t={}){const{mutation:e}=t,n=Tl(t),r=Iyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return{...o,connectors:a2t({config:n}).map(l=>l.connector),disconnect:s,disconnectAsync:a}}function o2t(t={}){const{name:e,query:n={}}=t,r=Tl(t),s=ej({config:r}),a=Myt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return v$({...n,...a,enabled:o})}function l2t(t={}){const{address:e,query:n={}}=t,r=Tl(t),s=ej({config:r}),a=Lyt(r,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return v$({...n,...a,enabled:o})}function cPe(t={}){const e=Tl(t);return qTe.useSyncExternalStoreWithSelector(n=>Ebt(e,{onChange:n}),()=>dee(e,t),()=>dee(e,t),n=>n,(n,r)=>(n==null?void 0:n.uid)===(r==null?void 0:r.uid))}function cxe(t={}){const{abi:e,address:n,functionName:r,query:s={}}=t,a=t.code,o=Tl(t),l=ej({config:o}),c=Byt(o,{...t,chainId:t.chainId??l}),u=!!((n||a)&&e&&r&&(s.enabled??!0));return v$({...s,...c,enabled:u,structuralSharing:s.structuralSharing??_yt})}function uPe(t={}){const{mutation:e}=t,n=Tl(t),r=Uyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return{...o,signMessage:s,signMessageAsync:a}}function c2t(t={}){const{mutation:e}=t,n=Tl(t),r=zyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return{...o,signTypedData:s,signTypedDataAsync:a}}function Noe(t={}){const{mutation:e}=t,n=Tl(t),r=Hyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return{...o,chains:r2t({config:n}),switchChain:s,switchChainAsync:a}}function u2t(t={}){const{mutation:e}=t,n=Tl(t),r=Vyt(n),{mutate:s,mutateAsync:a,...o}=JA({...e,...r});return{...o,writeContract:s,writeContractAsync:a}}const cx=Object.create(null);cx.open="0";cx.close="1";cx.ping="2";cx.pong="3";cx.message="4";cx.upgrade="5";cx.noop="6";const MO=Object.create(null);Object.keys(cx).forEach(t=>{MO[cx[t]]=t});const _ee={type:"error",data:"parser error"},dPe=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",fPe=typeof ArrayBuffer=="function",hPe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Aoe=({type:t,data:e},n,r)=>dPe&&e instanceof Blob?n?r(e):uxe(e,r):fPe&&(e instanceof ArrayBuffer||hPe(e))?n?r(e):uxe(new Blob([e]),r):r(cx[t]+(e||"")),uxe=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function dxe(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let TV;function d2t(t,e){if(dPe&&t.data instanceof Blob)return t.data.arrayBuffer().then(dxe).then(e);if(fPe&&(t.data instanceof ArrayBuffer||hPe(t.data)))return e(dxe(t.data));Aoe(t,!1,n=>{TV||(TV=new TextEncoder),e(TV.encode(n))})}const fxe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",H7=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<fxe.length;t++)H7[fxe.charCodeAt(t)]=t;const f2t=t=>{let e=t.length*.75,n=t.length,r,s=0,a,o,l,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r<n;r+=4)a=H7[t.charCodeAt(r)],o=H7[t.charCodeAt(r+1)],l=H7[t.charCodeAt(r+2)],c=H7[t.charCodeAt(r+3)],d[s++]=a<<2|o>>4,d[s++]=(o&15)<<4|l>>2,d[s++]=(l&3)<<6|c&63;return u},h2t=typeof ArrayBuffer=="function",joe=(t,e)=>{if(typeof t!="string")return{type:"message",data:pPe(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:p2t(t.substring(1),e)}:MO[n]?t.length>1?{type:MO[n],data:t.substring(1)}:{type:MO[n]}:_ee},p2t=(t,e)=>{if(h2t){const n=f2t(t);return pPe(n,e)}else return{base64:!0,data:t}},pPe=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},mPe="",m2t=(t,e)=>{const n=t.length,r=new Array(n);let s=0;t.forEach((a,o)=>{Aoe(a,!1,l=>{r[o]=l,++s===n&&e(r.join(mPe))})})},x2t=(t,e)=>{const n=t.split(mPe),r=[];for(let s=0;s<n.length;s++){const a=joe(n[s],e);if(r.push(a),a.type==="error")break}return r};function g2t(){return new TransformStream({transform(t,e){d2t(t,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const a=new DataView(s.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{s=new Uint8Array(9);const a=new DataView(s.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(n)})}})}let PV;function PI(t){return t.reduce((e,n)=>e+n.length,0)}function II(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let s=0;s<e;s++)n[s]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function b2t(t,e){PV||(PV=new TextDecoder);const n=[];let r=0,s=-1,a=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(r===0){if(PI(n)<1)break;const c=II(n,1);a=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(PI(n)<2)break;const c=II(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(PI(n)<8)break;const c=II(n,8),u=new DataView(c.buffer,c.byteOffset,c.length),d=u.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(_ee);break}s=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(PI(n)<s)break;const c=II(n,s);l.enqueue(joe(a?c:PV.decode(c),e)),r=0}if(s===0||s>t){l.enqueue(_ee);break}}}})}const xPe=4;function Hl(t){if(t)return y2t(t)}function y2t(t){for(var e in Hl.prototype)t[e]=Hl.prototype[e];return t}Hl.prototype.on=Hl.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Hl.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Hl.prototype.off=Hl.prototype.removeListener=Hl.prototype.removeAllListeners=Hl.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===e||r.fn===e){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Hl.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,e)}return this};Hl.prototype.emitReserved=Hl.prototype.emit;Hl.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Hl.prototype.hasListeners=function(t){return!!this.listeners(t).length};const C$=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),np=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),v2t="arraybuffer";function gPe(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const w2t=np.setTimeout,C2t=np.clearTimeout;function S$(t,e){e.useNativeTimers?(t.setTimeoutFn=w2t.bind(np),t.clearTimeoutFn=C2t.bind(np)):(t.setTimeoutFn=np.setTimeout.bind(np),t.clearTimeoutFn=np.clearTimeout.bind(np))}const S2t=1.33;function N2t(t){return typeof t=="string"?A2t(t):Math.ceil((t.byteLength||t.size)*S2t)}function A2t(t){let e=0,n=0;for(let r=0,s=t.length;r<s;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function bPe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function j2t(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function E2t(t){let e={},n=t.split("&");for(let r=0,s=n.length;r<s;r++){let a=n[r].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}class _2t extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}let Eoe=class extends Hl{constructor(e){super(),this.writable=!1,S$(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new _2t(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=joe(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=j2t(e);return n.length?"?"+n:""}};class k2t extends Eoe{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};x2t(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,m2t(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=bPe()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let yPe=!1;try{yPe=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const T2t=yPe;function P2t(){}class I2t extends k2t{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(s,a)=>{this.onError("xhr post error",s,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let N4=class RO extends Hl{constructor(e,n,r){super(),this.createRequest=e,S$(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=gPe(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=RO.requestsCount++,RO.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=P2t,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete RO.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};N4.requestsCount=0;N4.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",hxe);else if(typeof addEventListener=="function"){const t="onpagehide"in np?"pagehide":"unload";addEventListener(t,hxe,!1)}}function hxe(){for(let t in N4.requests)N4.requests.hasOwnProperty(t)&&N4.requests[t].abort()}const F2t=function(){const t=vPe({xdomain:!1});return t&&t.responseType!==null}();class O2t extends I2t{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=F2t&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new N4(vPe,this.uri(),e)}}function vPe(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||T2t))return new XMLHttpRequest}catch{}if(!e)try{return new np[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const wPe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class M2t extends Eoe{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=wPe?{}:gPe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],s=n===e.length-1;Aoe(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}s&&C$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=bPe()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const IV=np.WebSocket||np.MozWebSocket;let R2t=class extends M2t{createSocket(e,n,r){return wPe?new IV(e,n,r):n?new IV(e,n):new IV(e)}doWrite(e,n){this.ws.send(n)}};class L2t extends Eoe{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=b2t(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),s=g2t();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const a=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),a())}).catch(l=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],s=n===e.length-1;this._writer.write(r).then(()=>{s&&C$(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const D2t={websocket:R2t,webtransport:L2t,polling:O2t},B2t=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$2t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function kee(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let s=B2t.exec(t||""),a={},o=14;for(;o--;)a[$2t[o]]=s[o]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=U2t(a,a.path),a.queryKey=z2t(a,a.query),a}function U2t(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function z2t(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,a){s&&(n[s]=a)}),n}const Tee=typeof addEventListener=="function"&&typeof removeEventListener=="function",LO=[];Tee&&addEventListener("offline",()=>{LO.forEach(t=>t())},!1);class Ly extends Hl{constructor(e,n){if(super(),this.binaryType=v2t,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=kee(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=kee(n.host).host);S$(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=E2t(this.opts.query)),Tee&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},LO.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=xPe,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ly.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Ly.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=N2t(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,C$(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Ly.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Tee&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=LO.indexOf(this._offlineEventListener);r!==-1&&LO.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ly.protocol=xPe;class H2t extends Ly{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;Ly.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ly.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function a(){r||(r=!0,d(),n.close(),n=null)}const o=f=>{const x=new Error("probe error: "+f);x.transport=n.name,a(),this.emitReserved("upgradeError",x)};function l(){o("transport closed")}function c(){o("socket closed")}function u(f){n&&f.name!==n.name&&a()}const d=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let V2t=class extends H2t{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>D2t[s]).filter(s=>!!s)),super(e,r)}};function W2t(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=kee(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+e,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const q2t=typeof ArrayBuffer=="function",G2t=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,CPe=Object.prototype.toString,K2t=typeof Blob=="function"||typeof Blob<"u"&&CPe.call(Blob)==="[object BlobConstructor]",Y2t=typeof File=="function"||typeof File<"u"&&CPe.call(File)==="[object FileConstructor]";function _oe(t){return q2t&&(t instanceof ArrayBuffer||G2t(t))||K2t&&t instanceof Blob||Y2t&&t instanceof File}function DO(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(DO(t[n]))return!0;return!1}if(_oe(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return DO(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&DO(t[n]))return!0;return!1}function X2t(t){const e=[],n=t.data,r=t;return r.data=Pee(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Pee(t,e){if(!t)return t;if(_oe(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Pee(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Pee(t[r],e));return n}return t}function Q2t(t,e){return t.data=Iee(t.data,e),delete t.attachments,t}function Iee(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Iee(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Iee(t[n],e));return t}const Z2t=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],J2t=5;var ta;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(ta||(ta={}));let evt=class{constructor(e){this.replacer=e}encode(e){return(e.type===ta.EVENT||e.type===ta.ACK)&&DO(e)?this.encodeAsBinary({type:e.type===ta.EVENT?ta.BINARY_EVENT:ta.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ta.BINARY_EVENT||e.type===ta.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=X2t(e),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}};function pxe(t){return Object.prototype.toString.call(t)==="[object Object]"}class koe extends Hl{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===ta.BINARY_EVENT;r||n.type===ta.BINARY_ACK?(n.type=r?ta.EVENT:ta.ACK,this.reconstructor=new tvt(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(_oe(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(ta[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ta.BINARY_EVENT||r.type===ta.BINARY_ACK){const a=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(a,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(a,n)}else r.nsp="/";const s=e.charAt(n+1);if(s!==""&&Number(s)==s){const a=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}r.id=Number(e.substring(a,n+1))}if(e.charAt(++n)){const a=this.tryParse(e.substr(n));if(koe.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case ta.CONNECT:return pxe(n);case ta.DISCONNECT:return n===void 0;case ta.CONNECT_ERROR:return typeof n=="string"||pxe(n);case ta.EVENT:case ta.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Z2t.indexOf(n[0])===-1);case ta.ACK:case ta.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tvt{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=Q2t(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const nvt=Object.freeze(Object.defineProperty({__proto__:null,Decoder:koe,Encoder:evt,get PacketType(){return ta},protocol:J2t},Symbol.toStringTag,{value:"Module"}));function rm(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const rvt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class SPe extends Hl{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[rm(e,"open",this.onopen.bind(this)),rm(e,"packet",this.onpacket.bind(this)),rm(e,"error",this.onerror.bind(this)),rm(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,s,a;if(rvt.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:ta.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const d=this.ids++,f=n.pop();this._registerAckCallback(d,f),o.id=d}const l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(a),n.apply(this,l)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...n){return new Promise((r,s)=>{const a=(o,l)=>o?s(o):r(l);a.withError=!0,n.push(a),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...a)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ta.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ta.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ta.EVENT:case ta.BINARY_EVENT:this.onevent(e);break;case ta.ACK:case ta.BINARY_ACK:this.onack(e);break;case ta.DISCONNECT:this.ondisconnect();break;case ta.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:ta.ACK,id:e,data:s}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ta.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function tj(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}tj.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};tj.prototype.reset=function(){this.attempts=0};tj.prototype.setMin=function(t){this.ms=t};tj.prototype.setMax=function(t){this.max=t};tj.prototype.setJitter=function(t){this.jitter=t};class Fee extends Hl{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,S$(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new tj({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const s=n.parser||nvt;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new V2t(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=rm(n,"open",function(){r.onopen(),e&&e()}),a=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},o=rm(n,"error",a);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{s(),a(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rm(e,"ping",this.onping.bind(this)),rm(e,"data",this.ondata.bind(this)),rm(e,"error",this.onerror.bind(this)),rm(e,"close",this.onclose.bind(this)),rm(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){C$(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new SPe(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Y8={};function Dy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=W2t(t,e.path||"/socket.io"),r=n.source,s=n.id,a=n.path,o=Y8[s]&&a in Y8[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return l?c=new Fee(r,e):(Y8[s]||(Y8[s]=new Fee(r,e)),c=Y8[s]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(Dy,{Manager:Fee,Socket:SPe,io:Dy,connect:Dy});function NPe(t,e){return function(){return t.apply(e,arguments)}}const{toString:svt}=Object.prototype,{getPrototypeOf:Toe}=Object,N$=(t=>e=>{const n=svt.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Om=t=>(t=t.toLowerCase(),e=>N$(e)===t),A$=t=>e=>typeof e===t,{isArray:nj}=Array,VE=A$("undefined");function ivt(t){return t!==null&&!VE(t)&&t.constructor!==null&&!VE(t.constructor)&&eh(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const APe=Om("ArrayBuffer");function avt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&APe(t.buffer),e}const ovt=A$("string"),eh=A$("function"),jPe=A$("number"),j$=t=>t!==null&&typeof t=="object",lvt=t=>t===!0||t===!1,BO=t=>{if(N$(t)!=="object")return!1;const e=Toe(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},cvt=Om("Date"),uvt=Om("File"),dvt=Om("Blob"),fvt=Om("FileList"),hvt=t=>j$(t)&&eh(t.pipe),pvt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||eh(t.append)&&((e=N$(t))==="formdata"||e==="object"&&eh(t.toString)&&t.toString()==="[object FormData]"))},mvt=Om("URLSearchParams"),[xvt,gvt,bvt,yvt]=["ReadableStream","Request","Response","Headers"].map(Om),vvt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ST(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),nj(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{const a=n?Object.getOwnPropertyNames(t):Object.keys(t),o=a.length;let l;for(r=0;r<o;r++)l=a[r],e.call(null,t[l],l,t)}}function EPe(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const dw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,_Pe=t=>!VE(t)&&t!==dw;function Oee(){const{caseless:t}=_Pe(this)&&this||{},e={},n=(r,s)=>{const a=t&&EPe(e,s)||s;BO(e[a])&&BO(r)?e[a]=Oee(e[a],r):BO(r)?e[a]=Oee({},r):nj(r)?e[a]=r.slice():e[a]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&ST(arguments[r],n);return e}const wvt=(t,e,n,{allOwnKeys:r}={})=>(ST(e,(s,a)=>{n&&eh(s)?t[a]=NPe(s,n):t[a]=s},{allOwnKeys:r}),t),Cvt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Svt=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Nvt=(t,e,n,r)=>{let s,a,o;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),a=s.length;a-- >0;)o=s[a],(!r||r(o,t,e))&&!l[o]&&(e[o]=t[o],l[o]=!0);t=n!==!1&&Toe(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Avt=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},jvt=t=>{if(!t)return null;if(nj(t))return t;let e=t.length;if(!jPe(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Evt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Toe(Uint8Array)),_vt=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let s;for(;(s=r.next())&&!s.done;){const a=s.value;e.call(t,a[0],a[1])}},kvt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Tvt=Om("HTMLFormElement"),Pvt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),mxe=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Ivt=Om("RegExp"),kPe=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};ST(n,(s,a)=>{let o;(o=e(s,a,t))!==!1&&(r[a]=o||s)}),Object.defineProperties(t,r)},Fvt=t=>{kPe(t,(e,n)=>{if(eh(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(eh(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ovt=(t,e)=>{const n={},r=s=>{s.forEach(a=>{n[a]=!0})};return nj(t)?r(t):r(String(t).split(e)),n},Mvt=()=>{},Rvt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,FV="abcdefghijklmnopqrstuvwxyz",xxe="0123456789",TPe={DIGIT:xxe,ALPHA:FV,ALPHA_DIGIT:FV+FV.toUpperCase()+xxe},Lvt=(t=16,e=TPe.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function Dvt(t){return!!(t&&eh(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const Bvt=t=>{const e=new Array(10),n=(r,s)=>{if(j$(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const a=nj(r)?[]:{};return ST(r,(o,l)=>{const c=n(o,s+1);!VE(c)&&(a[l]=c)}),e[s]=void 0,a}}return r};return n(t,0)},$vt=Om("AsyncFunction"),Uvt=t=>t&&(j$(t)||eh(t))&&eh(t.then)&&eh(t.catch),PPe=((t,e)=>t?setImmediate:e?((n,r)=>(dw.addEventListener("message",({source:s,data:a})=>{s===dw&&a===n&&r.length&&r.shift()()},!1),s=>{r.push(s),dw.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",eh(dw.postMessage)),zvt=typeof queueMicrotask<"u"?queueMicrotask.bind(dw):typeof process<"u"&&process.nextTick||PPe,vr={isArray:nj,isArrayBuffer:APe,isBuffer:ivt,isFormData:pvt,isArrayBufferView:avt,isString:ovt,isNumber:jPe,isBoolean:lvt,isObject:j$,isPlainObject:BO,isReadableStream:xvt,isRequest:gvt,isResponse:bvt,isHeaders:yvt,isUndefined:VE,isDate:cvt,isFile:uvt,isBlob:dvt,isRegExp:Ivt,isFunction:eh,isStream:hvt,isURLSearchParams:mvt,isTypedArray:Evt,isFileList:fvt,forEach:ST,merge:Oee,extend:wvt,trim:vvt,stripBOM:Cvt,inherits:Svt,toFlatObject:Nvt,kindOf:N$,kindOfTest:Om,endsWith:Avt,toArray:jvt,forEachEntry:_vt,matchAll:kvt,isHTMLForm:Tvt,hasOwnProperty:mxe,hasOwnProp:mxe,reduceDescriptors:kPe,freezeMethods:Fvt,toObjectSet:Ovt,toCamelCase:Pvt,noop:Mvt,toFiniteNumber:Rvt,findKey:EPe,global:dw,isContextDefined:_Pe,ALPHABET:TPe,generateString:Lvt,isSpecCompliantForm:Dvt,toJSONObject:Bvt,isAsyncFn:$vt,isThenable:Uvt,setImmediate:PPe,asap:zvt};function Ti(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}vr.inherits(Ti,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:vr.toJSONObject(this.config),code:this.code,status:this.status}}});const IPe=Ti.prototype,FPe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{FPe[t]={value:t}});Object.defineProperties(Ti,FPe);Object.defineProperty(IPe,"isAxiosError",{value:!0});Ti.from=(t,e,n,r,s,a)=>{const o=Object.create(IPe);return vr.toFlatObject(t,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),Ti.call(o,t.message,e,n,r,s),o.cause=t,o.name=t.name,a&&Object.assign(o,a),o};const Hvt=null;function Mee(t){return vr.isPlainObject(t)||vr.isArray(t)}function OPe(t){return vr.endsWith(t,"[]")?t.slice(0,-2):t}function gxe(t,e,n){return t?t.concat(e).map(function(s,a){return s=OPe(s),!n&&a?"["+s+"]":s}).join(n?".":""):e}function Vvt(t){return vr.isArray(t)&&!t.some(Mee)}const Wvt=vr.toFlatObject(vr,{},null,function(e){return/^is[A-Z]/.test(e)});function E$(t,e,n){if(!vr.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=vr.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,C){return!vr.isUndefined(C[v])});const r=n.metaTokens,s=n.visitor||d,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&vr.isSpecCompliantForm(e);if(!vr.isFunction(s))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(vr.isDate(y))return y.toISOString();if(!c&&vr.isBlob(y))throw new Ti("Blob is not supported. Use a Buffer instead.");return vr.isArrayBuffer(y)||vr.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function d(y,v,C){let N=y;if(y&&!C&&typeof y=="object"){if(vr.endsWith(v,"{}"))v=r?v:v.slice(0,-2),y=JSON.stringify(y);else if(vr.isArray(y)&&Vvt(y)||(vr.isFileList(y)||vr.endsWith(v,"[]"))&&(N=vr.toArray(y)))return v=OPe(v),N.forEach(function(T,M){!(vr.isUndefined(T)||T===null)&&e.append(o===!0?gxe([v],M,a):o===null?v:v+"[]",u(T))}),!1}return Mee(y)?!0:(e.append(gxe(C,v,a),u(y)),!1)}const f=[],x=Object.assign(Wvt,{defaultVisitor:d,convertValue:u,isVisitable:Mee});function g(y,v){if(!vr.isUndefined(y)){if(f.indexOf(y)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(y),vr.forEach(y,function(N,P){(!(vr.isUndefined(N)||N===null)&&s.call(e,N,vr.isString(P)?P.trim():P,v,x))===!0&&g(N,v?v.concat(P):[P])}),f.pop()}}if(!vr.isObject(t))throw new TypeError("data must be an object");return g(t),e}function bxe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Poe(t,e){this._pairs=[],t&&E$(t,this,e)}const MPe=Poe.prototype;MPe.append=function(e,n){this._pairs.push([e,n])};MPe.toString=function(e){const n=e?function(r){return e.call(this,r,bxe)}:bxe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function qvt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function RPe(t,e,n){if(!e)return t;const r=n&&n.encode||qvt;vr.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let a;if(s?a=s(e,n):a=vr.isURLSearchParams(e)?e.toString():new Poe(e,n).toString(r),a){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class yxe{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vr.forEach(this.handlers,function(r){r!==null&&e(r)})}}const LPe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Gvt=typeof URLSearchParams<"u"?URLSearchParams:Poe,Kvt=typeof FormData<"u"?FormData:null,Yvt=typeof Blob<"u"?Blob:null,Xvt={isBrowser:!0,classes:{URLSearchParams:Gvt,FormData:Kvt,Blob:Yvt},protocols:["http","https","file","blob","url","data"]},Ioe=typeof window<"u"&&typeof document<"u",Ree=typeof navigator=="object"&&navigator||void 0,Qvt=Ioe&&(!Ree||["ReactNative","NativeScript","NS"].indexOf(Ree.product)<0),Zvt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Jvt=Ioe&&window.location.href||"http://localhost",ewt=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ioe,hasStandardBrowserEnv:Qvt,hasStandardBrowserWebWorkerEnv:Zvt,navigator:Ree,origin:Jvt},Symbol.toStringTag,{value:"Module"})),Mu={...ewt,...Xvt};function twt(t,e){return E$(t,new Mu.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,a){return Mu.isNode&&vr.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function nwt(t){return vr.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function rwt(t){const e={},n=Object.keys(t);let r;const s=n.length;let a;for(r=0;r<s;r++)a=n[r],e[a]=t[a];return e}function DPe(t){function e(n,r,s,a){let o=n[a++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),c=a>=n.length;return o=!o&&vr.isArray(s)?s.length:o,c?(vr.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!vr.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],a)&&vr.isArray(s[o])&&(s[o]=rwt(s[o])),!l)}if(vr.isFormData(t)&&vr.isFunction(t.entries)){const n={};return vr.forEachEntry(t,(r,s)=>{e(nwt(r),s,n,0)}),n}return null}function swt(t,e,n){if(vr.isString(t))try{return(e||JSON.parse)(t),vr.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const NT={transitional:LPe,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,a=vr.isObject(e);if(a&&vr.isHTMLForm(e)&&(e=new FormData(e)),vr.isFormData(e))return s?JSON.stringify(DPe(e)):e;if(vr.isArrayBuffer(e)||vr.isBuffer(e)||vr.isStream(e)||vr.isFile(e)||vr.isBlob(e)||vr.isReadableStream(e))return e;if(vr.isArrayBufferView(e))return e.buffer;if(vr.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return twt(e,this.formSerializer).toString();if((l=vr.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return E$(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return a||s?(n.setContentType("application/json",!1),swt(e)):e}],transformResponse:[function(e){const n=this.transitional||NT.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(vr.isResponse(e)||vr.isReadableStream(e))return e;if(e&&vr.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?Ti.from(l,Ti.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Mu.classes.FormData,Blob:Mu.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vr.forEach(["delete","get","head","post","put","patch"],t=>{NT.headers[t]={}});const iwt=vr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),awt=t=>{const e={};let n,r,s;return t&&t.split(`
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&iwt[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},vxe=Symbol("internals");function X8(t){return t&&String(t).trim().toLowerCase()}function $O(t){return t===!1||t==null?t:vr.isArray(t)?t.map($O):String(t)}function owt(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const lwt=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function OV(t,e,n,r,s){if(vr.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!vr.isString(e)){if(vr.isString(r))return e.indexOf(r)!==-1;if(vr.isRegExp(r))return r.test(e)}}function cwt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function uwt(t,e){const n=vr.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,a,o){return this[r].call(this,e,s,a,o)},configurable:!0})})}class uf{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function a(l,c,u){const d=X8(c);if(!d)throw new Error("header name must be a non-empty string");const f=vr.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=$O(l))}const o=(l,c)=>vr.forEach(l,(u,d)=>a(u,d,c));if(vr.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(vr.isString(e)&&(e=e.trim())&&!lwt(e))o(awt(e),n);else if(vr.isHeaders(e))for(const[l,c]of e.entries())a(c,l,r);else e!=null&&a(n,e,r);return this}get(e,n){if(e=X8(e),e){const r=vr.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return owt(s);if(vr.isFunction(n))return n.call(this,s,r);if(vr.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=X8(e),e){const r=vr.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||OV(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function a(o){if(o=X8(o),o){const l=vr.findKey(r,o);l&&(!n||OV(r,r[l],l,n))&&(delete r[l],s=!0)}}return vr.isArray(e)?e.forEach(a):a(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const a=n[r];(!e||OV(this,this[a],a,e,!0))&&(delete this[a],s=!0)}return s}normalize(e){const n=this,r={};return vr.forEach(this,(s,a)=>{const o=vr.findKey(r,a);if(o){n[o]=$O(s),delete n[a];return}const l=e?cwt(a):String(a).trim();l!==a&&delete n[a],n[l]=$O(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return vr.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&vr.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[vxe]=this[vxe]={accessors:{}}).accessors,s=this.prototype;function a(o){const l=X8(o);r[l]||(uwt(s,o),r[l]=!0)}return vr.isArray(e)?e.forEach(a):a(e),this}}uf.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);vr.reduceDescriptors(uf.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});vr.freezeMethods(uf);function MV(t,e){const n=this||NT,r=e||n,s=uf.from(r.headers);let a=r.data;return vr.forEach(t,function(l){a=l.call(n,a,s.normalize(),e?e.status:void 0)}),s.normalize(),a}function BPe(t){return!!(t&&t.__CANCEL__)}function rj(t,e,n){Ti.call(this,t??"canceled",Ti.ERR_CANCELED,e,n),this.name="CanceledError"}vr.inherits(rj,Ti,{__CANCEL__:!0});function $Pe(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ti("Request failed with status code "+n.status,[Ti.ERR_BAD_REQUEST,Ti.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function dwt(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function fwt(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,a=0,o;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),d=r[a];o||(o=u),n[s]=c,r[s]=u;let f=a,x=0;for(;f!==s;)x+=n[f++],f=f%t;if(s=(s+1)%t,s===a&&(a=(a+1)%t),u-o<e)return;const g=d&&u-d;return g?Math.round(x*1e3/g):void 0}}function hwt(t,e){let n=0,r=1e3/e,s,a;const o=(u,d=Date.now())=>{n=d,s=null,a&&(clearTimeout(a),a=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,a||(a=setTimeout(()=>{a=null,o(s)},r-f)))},()=>s&&o(s)]}const uR=(t,e,n=3)=>{let r=0;const s=fwt(50,250);return hwt(a=>{const o=a.loaded,l=a.lengthComputable?a.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:a,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(f)},n)},wxe=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Cxe=t=>(...e)=>vr.asap(()=>t(...e)),pwt=Mu.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Mu.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Mu.origin),Mu.navigator&&/(msie|trident)/i.test(Mu.navigator.userAgent)):()=>!0,mwt=Mu.hasStandardBrowserEnv?{write(t,e,n,r,s,a){const o=[t+"="+encodeURIComponent(e)];vr.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),vr.isString(r)&&o.push("path="+r),vr.isString(s)&&o.push("domain="+s),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xwt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gwt(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function UPe(t,e){return t&&!xwt(e)?gwt(t,e):e}const Sxe=t=>t instanceof uf?{...t}:t;function q3(t,e){e=e||{};const n={};function r(u,d,f,x){return vr.isPlainObject(u)&&vr.isPlainObject(d)?vr.merge.call({caseless:x},u,d):vr.isPlainObject(d)?vr.merge({},d):vr.isArray(d)?d.slice():d}function s(u,d,f,x){if(vr.isUndefined(d)){if(!vr.isUndefined(u))return r(void 0,u,f,x)}else return r(u,d,f,x)}function a(u,d){if(!vr.isUndefined(d))return r(void 0,d)}function o(u,d){if(vr.isUndefined(d)){if(!vr.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in e)return r(u,d);if(f in t)return r(void 0,u)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(Sxe(u),Sxe(d),f,!0)};return vr.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=c[d]||s,x=f(t[d],e[d],d);vr.isUndefined(x)&&f!==l||(n[d]=x)}),n}const zPe=t=>{const e=q3({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:l}=e;e.headers=o=uf.from(o),e.url=RPe(UPe(e.baseURL,e.url),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(vr.isFormData(n)){if(Mu.hasStandardBrowserEnv||Mu.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Mu.hasStandardBrowserEnv&&(r&&vr.isFunction(r)&&(r=r(e)),r||r!==!1&&pwt(e.url))){const u=s&&a&&mwt.read(a);u&&o.set(s,u)}return e},bwt=typeof XMLHttpRequest<"u",ywt=bwt&&function(t){return new Promise(function(n,r){const s=zPe(t);let a=s.data;const o=uf.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,x,g,y;function v(){g&&g(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let C=new XMLHttpRequest;C.open(s.method.toUpperCase(),s.url,!0),C.timeout=s.timeout;function N(){if(!C)return;const T=uf.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),F={data:!l||l==="text"||l==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:T,config:t,request:C};$Pe(function(L){n(L),v()},function(L){r(L),v()},F),C=null}"onloadend"in C?C.onloadend=N:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(N)},C.onabort=function(){C&&(r(new Ti("Request aborted",Ti.ECONNABORTED,t,C)),C=null)},C.onerror=function(){r(new Ti("Network Error",Ti.ERR_NETWORK,t,C)),C=null},C.ontimeout=function(){let M=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||LPe;s.timeoutErrorMessage&&(M=s.timeoutErrorMessage),r(new Ti(M,F.clarifyTimeoutError?Ti.ETIMEDOUT:Ti.ECONNABORTED,t,C)),C=null},a===void 0&&o.setContentType(null),"setRequestHeader"in C&&vr.forEach(o.toJSON(),function(M,F){C.setRequestHeader(F,M)}),vr.isUndefined(s.withCredentials)||(C.withCredentials=!!s.withCredentials),l&&l!=="json"&&(C.responseType=s.responseType),u&&([x,y]=uR(u,!0),C.addEventListener("progress",x)),c&&C.upload&&([f,g]=uR(c),C.upload.addEventListener("progress",f),C.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=T=>{C&&(r(!T||T.type?new rj(null,t,C):T),C.abort(),C=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const P=dwt(s.url);if(P&&Mu.protocols.indexOf(P)===-1){r(new Ti("Unsupported protocol "+P+":",Ti.ERR_BAD_REQUEST,t));return}C.send(a||null)})},vwt=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const a=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof Ti?d:new rj(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,a(new Ti(`timeout ${e} of ms exceeded`,Ti.ETIMEDOUT))},e);const l=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),t=null)};t.forEach(u=>u.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>vr.asap(l),c}},wwt=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Cwt=async function*(t,e){for await(const n of Swt(t))yield*wwt(n,e)},Swt=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Nxe=(t,e,n,r)=>{const s=Cwt(t,e);let a=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let x=a+=f;n(x)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},_$=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",HPe=_$&&typeof ReadableStream=="function",Nwt=_$&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),VPe=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Awt=HPe&&VPe(()=>{let t=!1;const e=new Request(Mu.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Axe=64*1024,Lee=HPe&&VPe(()=>vr.isReadableStream(new Response("").body)),dR={stream:Lee&&(t=>t.body)};_$&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!dR[e]&&(dR[e]=vr.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new Ti(`Response type '${e}' is not supported`,Ti.ERR_NOT_SUPPORT,r)})})})(new Response);const jwt=async t=>{if(t==null)return 0;if(vr.isBlob(t))return t.size;if(vr.isSpecCompliantForm(t))return(await new Request(Mu.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(vr.isArrayBufferView(t)||vr.isArrayBuffer(t))return t.byteLength;if(vr.isURLSearchParams(t)&&(t=t+""),vr.isString(t))return(await Nwt(t)).byteLength},Ewt=async(t,e)=>{const n=vr.toFiniteNumber(t.getContentLength());return n??jwt(e)},_wt=_$&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:a,timeout:o,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:x}=zPe(t);u=u?(u+"").toLowerCase():"text";let g=vwt([s,a&&a.toAbortSignal()],o),y;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let C;try{if(c&&Awt&&n!=="get"&&n!=="head"&&(C=await Ewt(d,r))!==0){let F=new Request(e,{method:"POST",body:r,duplex:"half"}),$;if(vr.isFormData(r)&&($=F.headers.get("content-type"))&&d.setContentType($),F.body){const[L,z]=wxe(C,uR(Cxe(c)));r=Nxe(F.body,Axe,L,z)}}vr.isString(f)||(f=f?"include":"omit");const N="credentials"in Request.prototype;y=new Request(e,{...x,signal:g,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:N?f:void 0});let P=await fetch(y);const T=Lee&&(u==="stream"||u==="response");if(Lee&&(l||T&&v)){const F={};["status","statusText","headers"].forEach(X=>{F[X]=P[X]});const $=vr.toFiniteNumber(P.headers.get("content-length")),[L,z]=l&&wxe($,uR(Cxe(l),!0))||[];P=new Response(Nxe(P.body,Axe,L,()=>{z&&z(),v&&v()}),F)}u=u||"text";let M=await dR[vr.findKey(dR,u)||"text"](P,t);return!T&&v&&v(),await new Promise((F,$)=>{$Pe(F,$,{data:M,headers:uf.from(P.headers),status:P.status,statusText:P.statusText,config:t,request:y})})}catch(N){throw v&&v(),N&&N.name==="TypeError"&&/fetch/i.test(N.message)?Object.assign(new Ti("Network Error",Ti.ERR_NETWORK,t,y),{cause:N.cause||N}):Ti.from(N,N&&N.code,t,y)}}),Dee={http:Hvt,xhr:ywt,fetch:_wt};vr.forEach(Dee,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const jxe=t=>`- ${t}`,kwt=t=>vr.isFunction(t)||t===null||t===!1,WPe={getAdapter:t=>{t=vr.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let a=0;a<e;a++){n=t[a];let o;if(r=n,!kwt(n)&&(r=Dee[(o=String(n)).toLowerCase()],r===void 0))throw new Ti(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+a]=r}if(!r){const a=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=e?a.length>1?`since :
`+a.map(jxe).join(`
`):" "+jxe(a[0]):"as no adapter specified";throw new Ti("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Dee};function RV(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new rj(null,t)}function Exe(t){return RV(t),t.headers=uf.from(t.headers),t.data=MV.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),WPe.getAdapter(t.adapter||NT.adapter)(t).then(function(r){return RV(t),r.data=MV.call(t,t.transformResponse,r),r.headers=uf.from(r.headers),r},function(r){return BPe(r)||(RV(t),r&&r.response&&(r.response.data=MV.call(t,t.transformResponse,r.response),r.response.headers=uf.from(r.response.headers))),Promise.reject(r)})}const qPe="1.7.9",k$={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{k$[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const _xe={};k$.transitional=function(e,n,r){function s(a,o){return"[Axios v"+qPe+"] Transitional option '"+a+"'"+o+(r?". "+r:"")}return(a,o,l)=>{if(e===!1)throw new Ti(s(o," has been removed"+(n?" in "+n:"")),Ti.ERR_DEPRECATED);return n&&!_xe[o]&&(_xe[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(a,o,l):!0}};k$.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Twt(t,e,n){if(typeof t!="object")throw new Ti("options must be an object",Ti.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const a=r[s],o=e[a];if(o){const l=t[a],c=l===void 0||o(l,a,t);if(c!==!0)throw new Ti("option "+a+" must be "+c,Ti.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ti("Unknown option "+a,Ti.ERR_BAD_OPTION)}}const UO={assertOptions:Twt,validators:k$},s0=UO.validators;class h3{constructor(e){this.defaults=e,this.interceptors={request:new yxe,response:new yxe}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const a=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+a):r.stack=a}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=q3(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&UO.assertOptions(r,{silentJSONParsing:s0.transitional(s0.boolean),forcedJSONParsing:s0.transitional(s0.boolean),clarifyTimeoutError:s0.transitional(s0.boolean)},!1),s!=null&&(vr.isFunction(s)?n.paramsSerializer={serialize:s}:UO.assertOptions(s,{encode:s0.function,serialize:s0.function},!0)),UO.assertOptions(n,{baseUrl:s0.spelling("baseURL"),withXsrfToken:s0.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&vr.merge(a.common,a[n.method]);a&&vr.forEach(["delete","get","head","post","put","patch","common"],y=>{delete a[y]}),n.headers=uf.concat(o,a);const l=[];let c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(c=c&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,f=0,x;if(!c){const y=[Exe.bind(this),void 0];for(y.unshift.apply(y,l),y.push.apply(y,u),x=y.length,d=Promise.resolve(n);f<x;)d=d.then(y[f++],y[f++]);return d}x=l.length;let g=n;for(f=0;f<x;){const y=l[f++],v=l[f++];try{g=y(g)}catch(C){v.call(this,C);break}}try{d=Exe.call(this,g)}catch(y){return Promise.reject(y)}for(f=0,x=u.length;f<x;)d=d.then(u[f++],u[f++]);return d}getUri(e){e=q3(this.defaults,e);const n=UPe(e.baseURL,e.url);return RPe(n,e.params,e.paramsSerializer)}}vr.forEach(["delete","get","head","options"],function(e){h3.prototype[e]=function(n,r){return this.request(q3(r||{},{method:e,url:n,data:(r||{}).data}))}});vr.forEach(["post","put","patch"],function(e){function n(r){return function(a,o,l){return this.request(q3(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:o}))}}h3.prototype[e]=n(),h3.prototype[e+"Form"]=n(!0)});class Foe{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(s=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const o=new Promise(l=>{r.subscribe(l),a=l}).then(s);return o.cancel=function(){r.unsubscribe(a)},o},e(function(a,o,l){r.reason||(r.reason=new rj(a,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Foe(function(s){e=s}),cancel:e}}}function Pwt(t){return function(n){return t.apply(null,n)}}function Iwt(t){return vr.isObject(t)&&t.isAxiosError===!0}const Bee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Bee).forEach(([t,e])=>{Bee[e]=t});function GPe(t){const e=new h3(t),n=NPe(h3.prototype.request,e);return vr.extend(n,h3.prototype,e,{allOwnKeys:!0}),vr.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return GPe(q3(t,s))},n}const ps=GPe(NT);ps.Axios=h3;ps.CanceledError=rj;ps.CancelToken=Foe;ps.isCancel=BPe;ps.VERSION=qPe;ps.toFormData=E$;ps.AxiosError=Ti;ps.Cancel=ps.CanceledError;ps.all=function(e){return Promise.all(e)};ps.spread=Pwt;ps.isAxiosError=Iwt;ps.mergeConfig=q3;ps.AxiosHeaders=uf;ps.formToJSON=t=>DPe(vr.isHTMLForm(t)?new FormData(t):t);ps.getAdapter=WPe.getAdapter;ps.HttpStatusCode=Bee;ps.default=ps;var n2="https://dextrabothypev2.nftinit.io/";async function Fwt(t,e){if(e==1||e==null)return fetch(n2+"api/subscriber/sign_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t})}).then(n=>n.json());if(e>1)return fetch(n2+"api/subscriber/sign_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token_slot:e})}).then(n=>n.json())}async function Owt(t,e,n,r){if(r==1||r==null)return fetch(n2+"api/subscriber/sign_complete_v2/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,temp_password:e,signature:n})}).then(s=>s.json());if(r>1)return fetch(n2+"api/subscriber/sign_complete_v2/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,temp_password:e,signature:n,token_slot:r})}).then(s=>s.json())}async function ki(t,e){if(t)return await fetch(n2+"api/subscriber/check_account/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Mwt(t,e){if(t)return await fetch(n2+"api/subscriber/telegram_start/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Rwt(t,e){if(t)return await fetch(n2+"api/hyper/following/list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Lwt(t,e){if(t)return await fetch(n2+"api/hyper/tracker/list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})}).then(n=>n.json())}async function Dwt(t){try{const e=await fetch(`${API_URL}/refresh_token/`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({address:t})});if(!e.ok)throw new Error("Refresh token failed");const n=await e.json();if(n.success&&n.trade_token)return localStorage.setItem("hyperTradeToken",n.trade_token),localStorage.setItem("hyperAddress",n.address),n.trade_token;throw new Error("Refresh response invalid")}catch(e){return console.error("Token refresh error:",e),null}}let LV=null;function Bwt(t){LV&&clearInterval(LV),LV=setInterval(async()=>{const e=localStorage.getItem("hyperTradeTokenExp"),n=Date.now()/1e3;(!e||e-n<600)&&await Dwt(t)&&(localStorage.setItem("hyperTradeTokenExp",n+259200),console.log("Trade token refreshed"))},5*60*1e3)}const $wt=t=>{const e=[...t].sort((r,s)=>s.time-r.time),n=new Map;return e.forEach(r=>{var a;const s=r.oid;if(!n.has(s)){const o=e.filter(y=>y.oid===r.oid),l=o.reduce((y,v)=>y+parseFloat(v.sz),0),c=o.map(y=>parseFloat(y.startPosition));let u;c.includes(0)?u=0:c.every(y=>y>0)?u=Math.max(...c):c.every(y=>y<0)?u=Math.min(...c):u=o.reduce((y,v)=>y+parseFloat(v.startPosition),0);const d=o.reduce((y,v)=>y+parseFloat(v.sz)*parseFloat(v.px),0),f=o.reduce((y,v)=>y+parseFloat(v.closedPnl||0),0),x=o.reduce((y,v)=>y+parseFloat(v.fee||0),0),g=((a=o.find(y=>y.dir==="Long > Short"||y.dir==="Short > Long"))==null?void 0:a.dir)||"";n.set(s,{oid:r.oid,asset:r.coin,direction:g===""?r.dir:g,fills:o,totalSize:l,totalStartPositions:u,totalValue:d,pnl:f-x,latestFill:r.time})}}),Array.from(n.values()).sort((r,s)=>s.latestFill-r.latestFill)},Qr=m.createContext(),Uwt=({children:t})=>{const e=Kl(),{isConnected:n,address:r}=ns(),{signMessageAsync:s}=uPe(),[a,o]=m.useState("user"),[l,c]=m.useState(null),[u,d]=m.useState(0),[f,x]=m.useState(0),[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(!1),[T,M]=m.useState(0),[F,$]=m.useState(window.localStorage.getItem("hyperToken")),[L,z]=m.useState(window.localStorage.getItem("hyperAddress")),[X,ne]=m.useState(!1),[J,K]=m.useState(!1),[te,fe]=m.useState(!1),[q,se]=m.useState(null),[ae,W]=m.useState(!1),[V,ee]=m.useState(null),[oe,de]=m.useState(null),[Ce,me]=m.useState([]),[we,xe]=m.useState([]),[be,je]=m.useState([]),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState({activeRange:"",day:0,week:0,month:0}),[dt,tt]=m.useState([]),nt=m.useCallback(async()=>{const Xt=window.localStorage.getItem("hyperToken"),an=window.localStorage.getItem("hyperAddress");if(!Xt||!an){tt([]);return}try{const Jt=await ki(an.toLowerCase(),Xt);Jt!=null&&Jt.success&&tt((Jt==null?void 0:Jt.bot_slots_info)||[])}catch{}},[]);async function Le(){var Ye,Je;const Xt=window.localStorage.getItem("hyperToken"),an=window.localStorage.getItem("hyperAddress"),Jt=Jft(Xt);if(Xt&&Jt!==!1){const It=await ki(an,Xt);It.success?(tt((It==null?void 0:It.bot_slots_info)||[]),c(It.telegram_chat_id),o(It.subscriber_role),d((Ye=It==null?void 0:It.mushboomer_counts)==null?void 0:Ye.eth),x((Je=It==null?void 0:It.mushboomer_counts)==null?void 0:Je.sol),y(It==null?void 0:It.referral_code),C(It==null?void 0:It.refcode),P(It==null?void 0:It.whitelist),M(It==null?void 0:It.subs_expire_day),$(localStorage.getItem("hyperToken")),z(localStorage.getItem("hyperAddress")),cn(),Gt()):tt([])}else Be(1)}async function Be(Xt){try{if(!r)throw new Error("No accounts found. Please connect your wallet.");const an=await Fwt(r,Xt);if(!an.success)return{success:!1,message:an.error_message};const Jt=an.temp_password,Ye=`dextrabot.io verification code : ${Jt}`,Je=await s({message:Ye}),It=await Owt(an.address,Jt,Je,Xt);if(It&&It.token){if(window.localStorage.setItem("hyperAddress",It.address),window.localStorage.setItem("hyperToken",It.token),It.trade_token){window.localStorage.setItem("hyperTradeToken",It.trade_token);const hn=Date.now()/1e3;window.localStorage.setItem("hyperTradeTokenExp",hn+(It.expires_in||259200)),Bwt(It.address)}return Le(),window.dispatchEvent(new Event("localStorageUpdated")),{success:!0,initToken:It.token}}else throw new Error("Failed to complete the signing process.")}catch(an){return console.error("Error during sign-in:",an),{success:!1,message:an.message||"An unknown error occurred."}}}const[ht,pt]=m.useState([]);async function Gt(){const Xt=window.localStorage.getItem("hyperToken"),an=window.localStorage.getItem("hyperAddress");try{fe(!0);const Jt=await Rwt(r||an,Xt);if(!Jt.success){Jt.error_message!="User not verified"&&tn.error(Jt.error_message),Jt.error_message=="User not verified";return}Jt.success?pt(Jt==null?void 0:Jt.data):pt([])}catch(Jt){Jt.name!=="AbortError"&&(se(Jt.message),tn.error(Jt.message)),pt([])}finally{fe(!1)}}const[wt,nn]=m.useState([]);async function cn(){const Xt=window.localStorage.getItem("hyperToken"),an=window.localStorage.getItem("hyperAddress");try{W(!0);const Jt=await Lwt(r||an,Xt);if(!Jt.success){Jt.error_message!="User not verified"&&tn.error(Jt.error_message),Jt.error_message=="User not verified";return}Jt.success?nn(Jt==null?void 0:Jt.data):nn([])}catch(Jt){Jt.name!=="AbortError"&&(ee(Jt.message),tn.error(Jt.message)),nn([])}finally{W(!1)}}m.useEffect(()=>{window.localStorage.getItem("hyperToken")==null&&e.pathname!="/tracked-wallets"&&J&&ne(!0)},[n]),m.useEffect(()=>{!n&&!F||(e.pathname=="/wallet-management"||e.pathname.includes("referral")||e.pathname=="/leaderboard")&&F!=null&&F&&Gt()},[F]),m.useRef(!1),m.useEffect(()=>{if(e.pathname==="/"||e.pathname==="/sitemap"||e.pathname==="/videos"||!window.localStorage.getItem("hyperToken"))return;const Jt=`notificationsFeedSocket_${r==null?void 0:r.toLowerCase()}`,Ye=localStorage.getItem(Jt);me(Ye?JSON.parse(Ye):[]);const Je=Dy("https://dextrabothypesocketv2.nftinit.io/");return de(Je),Je.on("connect",()=>{console.log("Socket connected")}),Je.on("disconnect",()=>{console.log("Socket disconnected")}),Je.on("hyper_get_trade_message",async It=>{const hn=(Array.isArray(It)?It:[It]).map(ot=>({...ot,is_read:!1,trader_pnl:null}));me(ot=>{const De=new Set(ot.map(rt=>rt==null?void 0:rt.oid)),ze=[...hn==null?void 0:hn.filter(rt=>!(De!=null&&De.has(rt==null?void 0:rt.oid))),...ot].slice(0,100);return localStorage.setItem(Jt,JSON.stringify(ze)),ze});const Yt=window.localStorage.getItem("hyperToken");if(!r||!Yt){console.log("User logged out before timeout - skipping PNL fetch.");return}const Rt=hn.map(ot=>ot==null?void 0:ot.trader_wallet).filter(Boolean)[0];try{const ot=await ps.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:Rt});if(ot.data){const De=$wt(ot.data),At=new Map(De==null?void 0:De.map(ze=>[ze==null?void 0:ze.oid,ze==null?void 0:ze.pnl]));me(ze=>{const rt=ze==null?void 0:ze.map(mt=>At!=null&&At.has(mt==null?void 0:mt.trader_oid)?{...mt,trader_pnl:At==null?void 0:At.get(mt==null?void 0:mt.trader_oid)}:mt);return localStorage.setItem(Jt,JSON.stringify(rt)),rt})}else console.log("Unexpected API response")}catch(ot){console.error("PNL API error:",ot)}}),()=>{Je.disconnect()}},[F]),m.useEffect(()=>{if(!oe||!r||!ht||ht.length===0)return;ht.map(an=>an.wallet_address);const Xt=window.localStorage.getItem("hyperToken");return oe.emit("subscribe",{login:r==null?void 0:r.toLowerCase(),token:Xt}),()=>{}},[oe,r,ht]);const Un=async()=>{try{const Xt=window.localStorage.getItem("hyperToken"),an="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/getannouncements/";let Jt={};r&&Xt&&(Jt={address:r.toLowerCase(),token:Xt});const Ye=await fetch(an,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Jt)});if(!Ye.ok)throw new Error(`Server responded with status ${Ye.status}`);const Je=await Ye.json();Je.success?xe(Je):console.log(Je.error_message)}catch(Xt){console.error("Error in handleAnnouncement:",Xt)}};return m.useEffect(()=>{Un();const Xt=setInterval(()=>{Un()},6e4);return()=>clearInterval(Xt)},[n,F]),m.useEffect(()=>{(async()=>{try{const Ye=(await(await fetch("https://dextradata.nftinit.io/api/hyper/terminal_coins/v2/")).json()).coins;je(Ye)}catch(an){console.error("Data retrieval error:",an),Re(an.message)}})()},[]),i.jsx(Qr.Provider,{value:{subscriberRole:a,setSubscriberRole:o,subsExpireDay:T,setSubsExpireDay:M,hyperToken:F,setHyperToken:$,hyperAddress:L,setHyperAddress:z,signModalOpen:X,setSignModalOpen:ne,walletLogin:Le,signIn:Be,copyTradeWatchList:ht,setCopyTradeWatchList:pt,trackedWatchList:wt,setTrackedWatchList:nn,getCopyTradeWatchList:Gt,getTrackedWatchList:cn,copyWatchListLoading:te,setCopyWatchListLoading:fe,trackedWatchListLoading:ae,setTrackedWatchListLoading:W,copyWatchListError:q,setCopyWatchListError:se,trackedWatchListError:V,setTrackedWatchListError:ee,signInConnectButtonOpen:J,setSignInConnectButtonOpen:K,telegramChatId:l,setTelegramChatId:c,mushboomerETH:u,setMushboomerETH:d,isWhitelist:N,setIsWhitelist:P,mushboomerSOL:f,setMushboomerSOL:x,isReferralCode:g,setIsReferralCode:y,isReferralCodeName:v,setIsReferralCodeName:C,latestPnL:Qe,setLatestPnL:Ke,notificationData:Ce,setNotificationData:me,announcementData:we,setAnnouncementData:xe,handleAnnouncement:Un,searchTerminalCoin:be,setSearchTerminalCoin:je,isSearchTerminalError:Ie,setIsSearchTerminalError:Re,botSlotsInfo:dt,setBotSlotsInfo:tt,refreshBotSlots:nt},children:t})};function zwt({open:t,setOpen:e,setGenModalOpen:n,setGenWalletSuccess:r,setGenWalletData:s,setShowPrivateKey:a}){return i.jsx(i.Fragment,{children:i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-[9999999999] font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-[9999999999] w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[300px] sm:w-[480px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:"text-center text-white text-xl sm:text-2xl font-semibold font-manrope leading-7",children:"Last Chance to Save Your Private Key"}),i.jsx("div",{className:"w-[248px] sm:w-[348px] text-center text-white/60 text-[16px] font-medium font-manrope leading-5",children:"You will not be able to recover it later."})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsxs("div",{onClick:()=>{e(!1),r(!1),s([]),a(!1),tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#67ffbd",paddingLeft:"5px"},children:"The process is successful."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.32)",width:"340px",minWidth:"340px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"h-8 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"I Already Saved It"})]})]})]})})})})})]})})}const Hwt=()=>i.jsxs("div",{className:"w-full flex flex-col items-center justify-center h-full gap-4 font-manrope",children:[i.jsxs("div",{role:"status",className:"flex justify-center items-center w-full",children:[i.jsxs("svg",{"aria-hidden":"true",className:"w-[48px] h-[48px] animate-spin text-gray-600 fill-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}),i.jsx("div",{className:"font-manrope font-medium text-sm sm:text-lg leading-5.5 text-gray-600",children:"Loading"})]}),$a=Ne.memo(Hwt),Vwt=({loading:t,genWalletSuccess:e,genWalletData:n,showPrivateKey:r,genWalletName:s,setGenWalletName:a,errorMessage:o,setShowPrivateKey:l,setGenWalletData:c,setGenWalletSuccess:u,setErrorMessage:d,setLoading:f,handleListRequest:x,handlePageChange:g})=>{const{setSignModalOpen:y}=m.useContext(Qr),{address:v}=ns(),C=async()=>{const P=window.localStorage.getItem("hyperToken");if(!P){y(!0);return}if(!s){d("Please enter a name.");return}f(!0),d("");const T=window.localStorage.getItem("hyperAddress");try{const F=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:v?v.toLowerCase():T,token:P,wallet_name:s})})).json();F.success?(c(F==null?void 0:F.wallet),u(!0),a(""),x(),g(1)):(console.log("An error has occurred. Please try again."),d(F==null?void 0:F.error_message))}catch(M){console.error("An error has occurred:",M.message),d(M==null?void 0:M.message)}finally{f(!1)}},N=()=>{l(P=>!P)};return i.jsx(i.Fragment,{children:t?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx($a,{})}):e&&Object.keys(n).length>0?i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4",children:[i.jsx("div",{className:"w-full flex justify-center items-center",children:i.jsx("span",{className:"flex justify-center items-center w-[286px] sm:w-[480px] text-center text-white/60 text-[16px] leading-5 font-medium font-['Inter'] tracking-tight",children:"Please copy the private key below and store it in a secure location. This private key will not be shown again."})}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-4 py-4 text-white w-full",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Label"}),i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none",children:n==null?void 0:n.wallet_name})]}),i.jsx("div",{className:"w-full h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2 w-[286px] sm:w-[400px]",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Address"}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none break-all",children:n==null?void 0:n.address}),i.jsx("img",{onClick:P=>{P.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]}),i.jsx("div",{className:"w-full h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Private Key"}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none max-w-[280px] sm:max-w-[380px] break-all",children:r?n==null?void 0:n.private_key:"••••••••••••••••••"}),i.jsx("img",{onClick:P=>{P.stopPropagation(),navigator.clipboard.writeText(n==null?void 0:n.private_key),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"}),i.jsx("span",{onClick:()=>{N()},className:"p-1 rounded cursor-pointer",children:r?i.jsx(Trt,{className:"w-4 h-4"}):i.jsx(_rt,{className:"w-4 h-4"})})]})]})]})]}):i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 w-full -mt-2",children:[i.jsx("div",{className:"text-white text-sm font-medium leading-normal tracking-[-0.14px] w-full",children:"Enter a name for your follower wallet"}),i.jsx("div",{className:"w-full",children:i.jsx("input",{type:"text",value:s,onChange:P=>a(P.target.value),placeholder:"Wallet Name",className:"px-4 py-2 focus:outline-none focus:ring-0 w-full h-10 bg-[#1b1b1b] rounded-xl border border-[#303030] text-white text-sm font-medium font-['Inter'] leading-[8px] placeholder:text-[14px] placeholder:font-medium placeholder:tracking-[-0.28px] placeholder:leading-[8px] placeholder:font-inter focus:placeholder:text-white"})}),i.jsx("button",{onClick:()=>{C()},disabled:t,className:"w-full h-10 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] focus:ring-0 focus:outline-none justify-center items-center gap-1.5 inline-flex mt-2.5",children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Generate"})}),o&&i.jsxs("div",{className:"mt-2 w-full h-10 p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:o})]})]})})},Wwt=({agentWalletData:t,setAgentWalletData:e,agentWalletName:n,setAgentWalletName:r,errorAgentMessage:s,setErrorAgentMessage:a,loadingAgent:o,setLoadingAgent:l,handleListRequest:c,handlePageChange:u,agentWalletAddress:d,setAgentWalletAddress:f,agentWalletPkey:x,setAgentWalletPkey:g})=>{const{setSignModalOpen:y}=m.useContext(Qr),{address:v}=ns(),C=async()=>{const N=window.localStorage.getItem("hyperToken");if(!N){y(!0);return}if(!n||!d||!x){n?d?x||a("Please enter the agent wallet private key."):a("Please enter the main public address."):a("Please enter a name.");return}l(!0),a("");const P=window.localStorage.getItem("hyperAddress");try{const M=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:v?v.toLowerCase():P,token:N,name:n,connet_wallet_address:d,agent_wallet_pkey:x})})).json();M.success?(e(M==null?void 0:M.wallet),r(""),c(),u(1)):(console.log("An error has occurred. Please try again."),a(M==null?void 0:M.error_message))}catch(T){console.error("An error has occurred:",T.message),a(T==null?void 0:T.message)}finally{l(!1)}};return i.jsx(i.Fragment,{children:o?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx($a,{})}):Object.keys(t).length>0?i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4",children:[i.jsx("div",{className:"w-full flex justify-center items-center",children:i.jsx("span",{className:"flex justify-center items-center w-[400px] text-center text-white/60 text-[16px] leading-5 font-medium font-manrope tracking-tight",children:"Please copy the private key below and store it in a secure location. This private key will not be shown again."})}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-4 p-4 text-white",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Label"}),i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none",children:t==null?void 0:t.wallet_name})]}),i.jsx("div",{className:"w-[440px] h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#b1b1b1] text-[16px] font-medium font-inter leading-none",children:"Address"}),i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("div",{className:"text-white text-[16px] font-medium font-inter leading-none",children:t==null?void 0:t.address})})]}),i.jsx("div",{className:"w-[440px] h-px bg-[#353535]"})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2",children:[i.jsx("div",{className:"font-bold text-white",children:"Manually add api & secret key"}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2",children:[i.jsx("input",{type:"text",value:n,onChange:N=>r(N.target.value),placeholder:"Wallet Name",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"}),i.jsx("input",{type:"text",value:d,onChange:N=>f(N.target.value),placeholder:"Main Public Address",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"}),i.jsx("input",{type:"text",value:x,onChange:N=>g(N.target.value),placeholder:"Agent Wallet Private Key",className:"px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white"})]}),i.jsxs("button",{onClick:()=>{C()},disabled:o,className:"w-[285px] h-8 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Connect"})]}),s&&i.jsx("p",{className:"mt-2 text-sm text-red-500",children:s})]})})},KPe="6.15.0";function qwt(t,e,n){const r=e.split("|").map(a=>a.trim());for(let a=0;a<r.length;a++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function _u(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,s,a)=>(r[e[a]]=s,r),{})}function $s(t,e,n){for(let r in e){let s=e[r];const a=n?n[r]:null;a&&qwt(s,a,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function r4(t,e){if(t==null)return"null";if(e==null&&(e=new Set),typeof t=="object"){if(e.has(t))return"[Circular]";e.add(t)}if(Array.isArray(t))return"[ "+t.map(n=>r4(n,e)).join(", ")+" ]";if(t instanceof Uint8Array){const n="0123456789abcdef";let r="0x";for(let s=0;s<t.length;s++)r+=n[t[s]>>4],r+=n[t[s]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return r4(t.toJSON(),e);switch(typeof t){case"boolean":case"number":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const n=Object.keys(t);return n.sort(),"{ "+n.map(r=>`${r4(r,e)}: ${r4(t[r],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function ru(t,e){return t&&t.code===e}function Ooe(t){return ru(t,"CALL_EXCEPTION")}function Fo(t,e,n){let r=t;{const a=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${r4(n)}`);for(const o in n){if(o==="shortMessage")continue;const l=n[o];a.push(o+"="+r4(l))}}a.push(`code=${e}`),a.push(`version=${KPe}`),a.length&&(t+=" ("+a.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return $s(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&$s(s,{shortMessage:r}),s}function Dr(t,e,n,r){if(!t)throw Fo(e,n,r)}function vn(t,e,n,r){Dr(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function YPe(t,e,n){n==null&&(n=""),n&&(n=": "+n),Dr(t>=e,"missing argument"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Dr(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const Gwt=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function XPe(t){Dr(Gwt.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function _5(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),Dr(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function QPe(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let s=2;for(let a=0;a<r.length;a++)r[a]=parseInt(t.substring(s,s+2),16),s+=2;return r}vn(!1,"invalid BytesLike value",e||"value",t)}function ms(t,e){return QPe(t,e,!1)}function su(t,e){return QPe(t,e,!0)}function po(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function T$(t){return po(t,!0)||t instanceof Uint8Array}const kxe="0123456789abcdef";function Kr(t){const e=ms(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=kxe[(s&240)>>4]+kxe[s&15]}return n}function Da(t){return"0x"+t.map(e=>Kr(e).substring(2)).join("")}function A4(t){return po(t,!0)?(t.length-2)/2:ms(t).length}function Co(t,e,n){const r=ms(t);return n!=null&&n>r.length&&Dr(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),Kr(r.slice(e??0,n??r.length))}function ZPe(t,e,n){const r=ms(t);Dr(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),Kr(s)}function g1(t,e){return ZPe(t,e,!0)}function Kwt(t,e){return ZPe(t,e,!1)}const P$=BigInt(0),fm=BigInt(1),$ee=9007199254740991;function Ywt(t,e){const n=I$(t,"value"),r=BigInt($i(e,"width"));if(Dr(n>>r===P$,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-fm){const s=(fm<<r)-fm;return-((~n&s)+fm)}return n}function JPe(t,e){let n=Es(t,"value");const r=BigInt($i(e,"width")),s=fm<<r-fm;if(n<P$){n=-n,Dr(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const a=(fm<<r)-fm;return(~n&a)+fm}else Dr(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function V7(t,e){const n=I$(t,"value"),r=BigInt($i(e,"bits"));return n&(fm<<r)-fm}function Es(t,e){switch(typeof t){case"bigint":return t;case"number":return vn(Number.isInteger(t),"underflow",e||"value",t),vn(t>=-9007199254740991&&t<=$ee,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){vn(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}vn(!1,"invalid BigNumberish value",e||"value",t)}function I$(t,e){const n=Es(t,e);return Dr(n>=P$,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const Txe="0123456789abcdef";function F$(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=Txe[n>>4],e+=Txe[n&15];return BigInt(e)}return Es(t)}function $i(t,e){switch(typeof t){case"bigint":return vn(t>=-9007199254740991&&t<=$ee,"overflow",e||"value",t),Number(t);case"number":return vn(Number.isInteger(t),"underflow",e||"value",t),vn(t>=-9007199254740991&&t<=$ee,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return $i(BigInt(t),e)}catch(n){vn(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}vn(!1,"invalid numeric value",e||"value",t)}function Xwt(t){return $i(F$(t))}function b1(t,e){let r=I$(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=$i(e,"width");for(Dr(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function ul(t){const e=I$(t,"value");if(e===P$)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const a=s*2;r[s]=parseInt(n.substring(a,a+2),16)}return r}function cm(t){let e=Kr(T$(t)?t:ul(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const fR="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let FI=null;function Qwt(t){if(FI==null){FI={};for(let n=0;n<fR.length;n++)FI[fR[n]]=BigInt(n)}const e=FI[t];return vn(e!=null,"invalid base58 value","letter",t),e}const Zwt=BigInt(0),Uee=BigInt(58);function eIe(t){const e=ms(t);let n=F$(e),r="";for(;n;)r=fR[Number(n%Uee)]+r,n/=Uee;for(let s=0;s<e.length&&!e[s];s++)r=fR[0]+r;return r}function Jwt(t){let e=Zwt;for(let n=0;n<t.length;n++)e*=Uee,e+=Qwt(t[n]);return e}function e3t(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ms(e)}function t3t(t){const e=ms(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}var rS;class tIe{constructor(e,n,r){$n(this,"filter");$n(this,"emitter");Rn(this,rS);Ut(this,rS,n),$s(this,{emitter:e,filter:r})}async removeListener(){He(this,rS)!=null&&await this.emitter.off(this.filter,He(this,rS))}}rS=new WeakMap;function n3t(t,e,n,r,s){vn(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function nIe(t,e,n,r,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let a=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)a++;return a}return t==="OVERRUN"?n.length-e-1:0}function r3t(t,e,n,r,s){return t==="OVERLONG"?(vn(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),nIe(t,e,n))}const s3t=Object.freeze({error:n3t,ignore:nIe,replace:r3t});function i3t(t,e){e==null&&(e=s3t.error);const n=ms(t,"bytes"),r=[];let s=0;for(;s<n.length;){const a=n[s++];if(!(a>>7)){r.push(a);continue}let o=null,l=null;if((a&224)===192)o=1,l=127;else if((a&240)===224)o=2,l=2047;else if((a&248)===240)o=3,l=65535;else{(a&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let c=a&(1<<8-o-1)-1;for(let u=0;u<o;u++){let d=n[s];if((d&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),c=null;break}c=c<<6|d&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,c);continue}if(c<=l){s+=e("OVERLONG",s-1-o,n,r,c);continue}r.push(c)}}return r}function gd(t,e){vn(typeof t=="string","invalid string value","str",t),e!=null&&(XPe(e),t=t.normalize(e));let n=[];for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);if(s<128)n.push(s);else if(s<2048)n.push(s>>6|192),n.push(s&63|128);else if((s&64512)==55296){r++;const a=t.charCodeAt(r);vn(r<t.length&&(a&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(a&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(s&63|128)}return new Uint8Array(n)}function a3t(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function hR(t,e){return a3t(i3t(t,e))}function rIe(t){async function e(n,r){Dr(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();Dr(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),Dr(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let a=null;const o=new AbortController,l=setTimeout(()=>{a=Fo("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{a=Fo("request cancelled","CANCELLED"),o.abort()});const c=Object.assign({},t,{method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal});let u;try{u=await fetch(n.url,c)}catch(g){throw clearTimeout(l),a||g}clearTimeout(l);const d={};u.headers.forEach((g,y)=>{d[y.toLowerCase()]=g});const f=await u.arrayBuffer(),x=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:d,body:x}}return e}const o3t=12,l3t=250;let Pxe=rIe();const c3t=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),u3t=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let DV=!1;async function sIe(t,e){try{const n=t.match(c3t);if(!n)throw new Error("invalid data");return new By(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?e3t(n[3]):f3t(n[3]))}catch{return new By(599,"BAD REQUEST (invalid data: URI)",{},null,new r2(t))}}function iIe(t){async function e(n,r){try{const s=n.match(u3t);if(!s)throw new Error("invalid link");return new r2(`${t}${s[2]}`)}catch{return new By(599,"BAD REQUEST (invalid IPFS URI)",{},null,new r2(n))}}return e}const OI={data:sIe,ipfs:iIe("https://gateway.ipfs.io/ipfs/")},aIe=new WeakMap;var Dw,ay;class d3t{constructor(e){Rn(this,Dw);Rn(this,ay);Ut(this,Dw,[]),Ut(this,ay,!1),aIe.set(e,()=>{if(!He(this,ay)){Ut(this,ay,!0);for(const n of He(this,Dw))setTimeout(()=>{n()},0);Ut(this,Dw,[])}})}addListener(e){Dr(!He(this,ay),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),He(this,Dw).push(e)}get cancelled(){return He(this,ay)}checkSignal(){Dr(!this.cancelled,"cancelled","CANCELLED",{})}}Dw=new WeakMap,ay=new WeakMap;function MI(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var sS,iS,Zp,jg,aS,oS,Ac,Uf,Eg,Bw,$w,Uw,g0,Jp,oy,zw,W7;const uB=class uB{constructor(e){Rn(this,zw);Rn(this,sS);Rn(this,iS);Rn(this,Zp);Rn(this,jg);Rn(this,aS);Rn(this,oS);Rn(this,Ac);Rn(this,Uf);Rn(this,Eg);Rn(this,Bw);Rn(this,$w);Rn(this,Uw);Rn(this,g0);Rn(this,Jp);Rn(this,oy);Ut(this,oS,String(e)),Ut(this,sS,!1),Ut(this,iS,!0),Ut(this,Zp,{}),Ut(this,jg,""),Ut(this,aS,3e5),Ut(this,Jp,{slotInterval:l3t,maxAttempts:o3t}),Ut(this,oy,null)}get url(){return He(this,oS)}set url(e){Ut(this,oS,String(e))}get body(){return He(this,Ac)==null?null:new Uint8Array(He(this,Ac))}set body(e){if(e==null)Ut(this,Ac,void 0),Ut(this,Uf,void 0);else if(typeof e=="string")Ut(this,Ac,gd(e)),Ut(this,Uf,"text/plain");else if(e instanceof Uint8Array)Ut(this,Ac,e),Ut(this,Uf,"application/octet-stream");else if(typeof e=="object")Ut(this,Ac,gd(JSON.stringify(e))),Ut(this,Uf,"application/json");else throw new Error("invalid body")}hasBody(){return He(this,Ac)!=null}get method(){return He(this,jg)?He(this,jg):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),Ut(this,jg,String(e).toUpperCase())}get headers(){const e=Object.assign({},He(this,Zp));return He(this,Eg)&&(e.authorization=`Basic ${t3t(gd(He(this,Eg)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&He(this,Uf)&&(e["content-type"]=He(this,Uf)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){He(this,Zp)[String(e).toLowerCase()]=String(n)}clearHeaders(){Ut(this,Zp,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return He(this,Eg)||null}setCredentials(e,n){vn(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),Ut(this,Eg,`${e}:${n}`)}get allowGzip(){return He(this,iS)}set allowGzip(e){Ut(this,iS,!!e)}get allowInsecureAuthentication(){return!!He(this,sS)}set allowInsecureAuthentication(e){Ut(this,sS,!!e)}get timeout(){return He(this,aS)}set timeout(e){vn(e>=0,"timeout must be non-zero","timeout",e),Ut(this,aS,e)}get preflightFunc(){return He(this,Bw)||null}set preflightFunc(e){Ut(this,Bw,e)}get processFunc(){return He(this,$w)||null}set processFunc(e){Ut(this,$w,e)}get retryFunc(){return He(this,Uw)||null}set retryFunc(e){Ut(this,Uw,e)}get getUrlFunc(){return He(this,oy)||Pxe}set getUrlFunc(e){Ut(this,oy,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${He(this,Ac)?Kr(He(this,Ac)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(He(this,Jp).slotInterval=e.slotInterval),e.maxAttempts!=null&&(He(this,Jp).maxAttempts=e.maxAttempts)}send(){return Dr(He(this,g0)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),Ut(this,g0,new d3t(this)),Cr(this,zw,W7).call(this,0,Ixe()+this.timeout,0,this,new By(0,"",{},null,this))}cancel(){Dr(He(this,g0)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=aIe.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();Dr(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new uB(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,Ut(s,Zp,Object.assign({},He(this,Zp))),He(this,Ac)&&Ut(s,Ac,new Uint8Array(He(this,Ac))),Ut(s,Uf,He(this,Uf)),s}clone(){const e=new uB(this.url);return Ut(e,jg,He(this,jg)),He(this,Ac)&&Ut(e,Ac,He(this,Ac)),Ut(e,Uf,He(this,Uf)),Ut(e,Zp,Object.assign({},He(this,Zp))),Ut(e,Eg,He(this,Eg)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),Ut(e,Bw,He(this,Bw)),Ut(e,$w,He(this,$w)),Ut(e,Uw,He(this,Uw)),Ut(e,Jp,Object.assign({},He(this,Jp))),Ut(e,oy,He(this,oy)),e}static lockConfig(){DV=!0}static getGateway(e){return OI[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(DV)throw new Error("gateways locked");OI[e]=n}static registerGetUrl(e){if(DV)throw new Error("gateways locked");Pxe=e}static createGetUrlFunc(e){return rIe(e)}static createDataGateway(){return sIe}static createIpfsGatewayFunc(e){return iIe(e)}};sS=new WeakMap,iS=new WeakMap,Zp=new WeakMap,jg=new WeakMap,aS=new WeakMap,oS=new WeakMap,Ac=new WeakMap,Uf=new WeakMap,Eg=new WeakMap,Bw=new WeakMap,$w=new WeakMap,Uw=new WeakMap,g0=new WeakMap,Jp=new WeakMap,oy=new WeakMap,zw=new WeakSet,W7=async function(e,n,r,s,a){var d,f,x;if(e>=He(this,Jp).maxAttempts)return a.makeServerError("exceeded maximum retry limit");Dr(Ixe()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await h3t(r);let o=this.clone();const l=(o.url.split(":")[0]||"").toLowerCase();if(l in OI){const g=await OI[l](o.url,MI(He(s,g0)));if(g instanceof By){let y=g;if(this.processFunc){MI(He(s,g0));try{y=await this.processFunc(o,y)}catch(v){(v.throttle==null||typeof v.stall!="number")&&y.makeServerError("error in post-processing function",v).assertOk()}}return y}o=g}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,MI(He(s,g0)));let u=new By(c.statusCode,c.statusMessage,c.headers,c.body,s);if(u.statusCode===301||u.statusCode===302){try{const g=u.headers.location||"";return Cr(d=o.redirect(g),zw,W7).call(d,e+1,n,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const g=u.headers["retry-after"];let y=He(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(y=parseInt(g)),Cr(f=o.clone(),zw,W7).call(f,e+1,n,y,s,u)}if(this.processFunc){MI(He(s,g0));try{u=await this.processFunc(o,u)}catch(g){(g.throttle==null||typeof g.stall!="number")&&u.makeServerError("error in post-processing function",g).assertOk();let y=He(this,Jp).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(y=g.stall),Cr(x=o.clone(),zw,W7).call(x,e+1,n,y,s,u)}}return u};let r2=uB;var Rk,Lk,Dk,zf,lS,Hw;const jfe=class jfe{constructor(e,n,r,s,a){Rn(this,Rk);Rn(this,Lk);Rn(this,Dk);Rn(this,zf);Rn(this,lS);Rn(this,Hw);Ut(this,Rk,e),Ut(this,Lk,n),Ut(this,Dk,Object.keys(r).reduce((o,l)=>(o[l.toLowerCase()]=String(r[l]),o),{})),Ut(this,zf,s==null?null:new Uint8Array(s)),Ut(this,lS,a||null),Ut(this,Hw,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${He(this,zf)?Kr(He(this,zf)):"null"}>`}get statusCode(){return He(this,Rk)}get statusMessage(){return He(this,Lk)}get headers(){return Object.assign({},He(this,Dk))}get body(){return He(this,zf)==null?null:new Uint8Array(He(this,zf))}get bodyText(){try{return He(this,zf)==null?"":hR(He(this,zf))}catch{Dr(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Dr(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new jfe(599,r,this.headers,this.body,He(this,lS)||void 0);return Ut(s,Hw,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:vn(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw $s(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return He(this,zf)!=null}get request(){return He(this,lS)}ok(){return He(this,Hw).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=He(this,Hw);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{He(this,zf)&&(s=hR(He(this,zf)))}catch{}Dr(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Rk=new WeakMap,Lk=new WeakMap,Dk=new WeakMap,zf=new WeakMap,lS=new WeakMap,Hw=new WeakMap;let By=jfe;function Ixe(){return new Date().getTime()}function f3t(t){return gd(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function h3t(t){return new Promise(e=>setTimeout(e,t))}function p3t(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function Fxe(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function Oxe(t,e,n,r){const s=[];for(;n<e+1+r;){const a=oIe(t,n);s.push(a.result),n+=a.consumed,Dr(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function oIe(t,e){Dr(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{Dr(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=Fxe(t,e+1,r);return n(e+1+r+s),Oxe(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),Oxe(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=Fxe(t,e+1,r);n(e+1+r+s);const a=Kr(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:a}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=Kr(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:p3t(t[e])}}function AT(t){const e=ms(t,"data"),n=oIe(e,0);return vn(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function Mxe(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function lIe(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(a){r=r.concat(lIe(a))}),r.length<=55)return r.unshift(192+r.length),r;const s=Mxe(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ms(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=Mxe(e.length);return n.unshift(183+n.length),n.concat(e)}const Rxe="0123456789abcdef";function y1(t){let e="0x";for(const n of lIe(t))e+=Rxe[n>>4],e+=Rxe[n&15];return e}function m3t(t){const e=ms(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Kr(e);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const fd=32,zee=new Uint8Array(fd),x3t=["then"],RI={},cIe=new WeakMap;function ew(t){return cIe.get(t)}function Lxe(t,e){cIe.set(t,e)}function Q8(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function Hee(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof pR?Hee(ew(r),r,n):r):t.reduce((r,s,a)=>{let o=e.getValue(s);return s in r||(n&&o instanceof pR&&(o=Hee(ew(o),o,n)),r[s]=o),r},{})}var cS,Zg;let pR=(Zg=class extends Array{constructor(...n){const r=n[0];let s=n[1],a=(n[2]||[]).slice(),o=!0;r!==RI&&(s=n,a=[],o=!1);super(s.length);Rn(this,cS);s.forEach((u,d)=>{this[d]=u});const l=a.reduce((u,d)=>(typeof d=="string"&&u.set(d,(u.get(d)||0)+1),u),new Map);if(Lxe(this,Object.freeze(s.map((u,d)=>{const f=a[d];return f!=null&&l.get(f)===1?f:null}))),Ut(this,cS,[]),He(this,cS)==null&&He(this,cS),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(u,d,f)=>{if(typeof d=="string"){if(d.match(/^[0-9]+$/)){const g=$i(d,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const y=u[g];return y instanceof Error&&Q8(`index ${g}`,y),y}if(x3t.indexOf(d)>=0)return Reflect.get(u,d,f);const x=u[d];if(x instanceof Function)return function(...g){return x.apply(this===f?u:this,g)};if(!(d in u))return u.getValue.apply(this===f?u:this,[d])}return Reflect.get(u,d,f)}});return Lxe(c,ew(this)),c}toArray(n){const r=[];return this.forEach((s,a)=>{s instanceof Error&&Q8(`index ${a}`,s),n&&s instanceof Zg&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=ew(this);return r.reduce((s,a,o)=>(Dr(a!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Hee(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=ew(this),a=[],o=[];for(let l=n;l<r;l++)a.push(this[l]),o.push(s[l]);return new Zg(RI,a,o)}filter(n,r){const s=ew(this),a=[],o=[];for(let l=0;l<this.length;l++){const c=this[l];c instanceof Error&&Q8(`index ${l}`,c),n.call(r,c,l,this)&&(a.push(c),o.push(s[l]))}return new Zg(RI,a,o)}map(n,r){const s=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&Q8(`index ${a}`,o),s.push(n.call(r,o,a,this))}return s}getValue(n){const r=ew(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&Q8(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new Zg(RI,n,r)}},cS=new WeakMap,Zg);function Dxe(t){let e=ul(t);return Dr(e.length<=fd,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:fd,offset:e.length}),e.length!==fd&&(e=su(Da([zee.slice(e.length%fd),e]))),e}class R1{constructor(e,n,r,s){$n(this,"name");$n(this,"type");$n(this,"localName");$n(this,"dynamic");$s(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){vn(!1,e,this.localName,n)}}var _g,Vw,uS,zO;class Vee{constructor(){Rn(this,uS);Rn(this,_g);Rn(this,Vw);Ut(this,_g,[]),Ut(this,Vw,0)}get data(){return Da(He(this,_g))}get length(){return He(this,Vw)}appendWriter(e){return Cr(this,uS,zO).call(this,su(e.data))}writeBytes(e){let n=su(e);const r=n.length%fd;return r&&(n=su(Da([n,zee.slice(r)]))),Cr(this,uS,zO).call(this,n)}writeValue(e){return Cr(this,uS,zO).call(this,Dxe(e))}writeUpdatableValue(){const e=He(this,_g).length;return He(this,_g).push(zee),Ut(this,Vw,He(this,Vw)+fd),n=>{He(this,_g)[e]=Dxe(n)}}}_g=new WeakMap,Vw=new WeakMap,uS=new WeakSet,zO=function(e){return He(this,_g).push(e),Ut(this,Vw,He(this,Vw)+e.length),e.length};var Gd,Hf,Ww,qw,ly,v5,qee,uIe;const Efe=class Efe{constructor(e,n,r){Rn(this,v5);$n(this,"allowLoose");Rn(this,Gd);Rn(this,Hf);Rn(this,Ww);Rn(this,qw);Rn(this,ly);$s(this,{allowLoose:!!n}),Ut(this,Gd,su(e)),Ut(this,Ww,0),Ut(this,qw,null),Ut(this,ly,r??1024),Ut(this,Hf,0)}get data(){return Kr(He(this,Gd))}get dataLength(){return He(this,Gd).length}get consumed(){return He(this,Hf)}get bytes(){return new Uint8Array(He(this,Gd))}subReader(e){const n=new Efe(He(this,Gd).slice(He(this,Hf)+e),this.allowLoose,He(this,ly));return Ut(n,qw,this),n}readBytes(e,n){let r=Cr(this,v5,uIe).call(this,0,e,!!n);return Cr(this,v5,qee).call(this,e),Ut(this,Hf,He(this,Hf)+r.length),r.slice(0,e)}readValue(){return F$(this.readBytes(fd))}readIndex(){return Xwt(this.readBytes(fd))}};Gd=new WeakMap,Hf=new WeakMap,Ww=new WeakMap,qw=new WeakMap,ly=new WeakMap,v5=new WeakSet,qee=function(e){var n;if(He(this,qw))return Cr(n=He(this,qw),v5,qee).call(n,e);Ut(this,Ww,He(this,Ww)+e),Dr(He(this,ly)<1||He(this,Ww)<=He(this,ly)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${He(this,ly)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:su(He(this,Gd)),offset:He(this,Hf),length:e,info:{bytesRead:He(this,Ww),dataLength:this.dataLength}})},uIe=function(e,n,r){let s=Math.ceil(n/fd)*fd;return He(this,Hf)+s>He(this,Gd).length&&(this.allowLoose&&r&&He(this,Hf)+n<=He(this,Gd).length?s=n:Dr(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:su(He(this,Gd)),length:He(this,Gd).length,offset:He(this,Hf)+s})),He(this,Gd).slice(He(this,Hf),He(this,Hf)+s)};let Wee=Efe;function Gf(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Moe(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function dIe(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gf(t.outputLen),Gf(t.blockLen)}function aN(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function fIe(t,e){Moe(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const BV=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hIe=t=>t instanceof Uint8Array,HO=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),VO=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),i0=(t,e)=>t<<32-e|t>>>e,g3t=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!g3t)throw new Error("Non little-endian hardware is not supported");const b3t=async()=>{};async function Bxe(t,e,n){let r=Date.now();for(let s=0;s<t;s++){n(s);const a=Date.now()-r;a>=0&&a<e||(await b3t(),r+=a)}}function y3t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function oN(t){if(typeof t=="string"&&(t=y3t(t)),!hIe(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function v3t(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!hIe(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}let Roe=class{clone(){return this._cloneInto()}};const w3t={}.toString;function pIe(t,e){if(e!==void 0&&w3t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function O$(t){const e=r=>t().update(oN(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function C3t(t=32){if(BV&&typeof BV.getRandomValues=="function")return BV.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let mIe=class extends Roe{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,dIe(e);const r=oN(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<a.length;o++)a[o]^=54;this.iHash.update(a),this.oHash=e.create();for(let o=0;o<a.length;o++)a[o]^=106;this.oHash.update(a),a.fill(0)}update(e){return aN(this),this.iHash.update(e),this}digestInto(e){aN(this),Moe(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:a,blockLen:o,outputLen:l}=this;return e=e,e.finished=s,e.destroyed=a,e.blockLen=o,e.outputLen=l,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const M$=(t,e,n)=>new mIe(t,e).update(n).digest();M$.create=(t,e)=>new mIe(t,e);function S3t(t,e,n,r){dIe(t);const s=pIe({dkLen:32,asyncTick:10},r),{c:a,dkLen:o,asyncTick:l}=s;if(Gf(a),Gf(o),Gf(l),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=oN(e),u=oN(n),d=new Uint8Array(o),f=M$.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function N3t(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function Loe(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=S3t(t,e,n,r);let u;const d=new Uint8Array(4),f=VO(d),x=new Uint8Array(l.outputLen);for(let g=1,y=0;y<a;g++,y+=l.outputLen){const v=o.subarray(y,y+l.outputLen);f.setInt32(0,g,!1),(u=c._cloneInto(u)).update(d).digestInto(x),v.set(x.subarray(0,v.length));for(let C=1;C<s;C++){l._cloneInto(u).update(x).digestInto(x);for(let N=0;N<v.length;N++)v[N]^=x[N]}}return N3t(l,c,o,u,x)}function A3t(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),a=BigInt(4294967295),o=Number(n>>s&a),l=Number(n&a),c=r?4:0,u=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+u,l,r)}class Doe extends Roe{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=VO(this.buffer)}update(e){aN(this);const{view:n,buffer:r,blockLen:s}=this;e=oN(e);const a=e.length;for(let o=0;o<a;){const l=Math.min(s-this.pos,a-o);if(l===s){const c=VO(e);for(;s<=a-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){aN(this),fIe(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:a}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;A3t(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=VO(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)l.setUint32(4*f,d[f],a)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:a,destroyed:o,pos:l}=this;return e.length=s,e.pos=l,e.finished=a,e.destroyed=o,s%n&&e.buffer.set(r),e}}const j3t=(t,e,n)=>t&e^~t&n,E3t=(t,e,n)=>t&e^t&n^e&n,_3t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wb=new Uint32Array(64);let k3t=class extends Doe{constructor(){super(64,32,8,!1),this.A=vb[0]|0,this.B=vb[1]|0,this.C=vb[2]|0,this.D=vb[3]|0,this.E=vb[4]|0,this.F=vb[5]|0,this.G=vb[6]|0,this.H=vb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)wb[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=wb[f-15],g=wb[f-2],y=i0(x,7)^i0(x,18)^x>>>3,v=i0(g,17)^i0(g,19)^g>>>10;wb[f]=v+wb[f-7]+y+wb[f-16]|0}let{A:r,B:s,C:a,D:o,E:l,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const x=i0(l,6)^i0(l,11)^i0(l,25),g=d+x+j3t(l,c,u)+_3t[f]+wb[f]|0,v=(i0(r,2)^i0(r,13)^i0(r,22))+E3t(r,s,a)|0;d=u,u=c,c=l,l=o+g|0,o=a,a=s,s=r,r=g+v|0}r=r+this.A|0,s=s+this.B|0,a=a+this.C|0,o=o+this.D|0,l=l+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,a,o,l,c,u,d)}roundClean(){wb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sj=O$(()=>new k3t),LI=BigInt(2**32-1),Gee=BigInt(32);function xIe(t,e=!1){return e?{h:Number(t&LI),l:Number(t>>Gee&LI)}:{h:Number(t>>Gee&LI)|0,l:Number(t&LI)|0}}function gIe(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:a,l:o}=xIe(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const T3t=(t,e)=>BigInt(t>>>0)<<Gee|BigInt(e>>>0),P3t=(t,e,n)=>t>>>n,I3t=(t,e,n)=>t<<32-n|e>>>n,F3t=(t,e,n)=>t>>>n|e<<32-n,O3t=(t,e,n)=>t<<32-n|e>>>n,M3t=(t,e,n)=>t<<64-n|e>>>n-32,R3t=(t,e,n)=>t>>>n-32|e<<64-n,L3t=(t,e)=>e,D3t=(t,e)=>t,bIe=(t,e,n)=>t<<n|e>>>32-n,yIe=(t,e,n)=>e<<n|t>>>32-n,vIe=(t,e,n)=>e<<n-32|t>>>64-n,wIe=(t,e,n)=>t<<n-32|e>>>64-n;function B3t(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const $3t=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),U3t=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,z3t=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),H3t=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,V3t=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),W3t=(t,e,n,r,s,a)=>e+n+r+s+a+(t/2**32|0)|0,Di={fromBig:xIe,split:gIe,toBig:T3t,shrSH:P3t,shrSL:I3t,rotrSH:F3t,rotrSL:O3t,rotrBH:M3t,rotrBL:R3t,rotr32H:L3t,rotr32L:D3t,rotlSH:bIe,rotlSL:yIe,rotlBH:vIe,rotlBL:wIe,add:B3t,add3L:$3t,add3H:U3t,add4L:z3t,add4H:H3t,add5H:W3t,add5L:V3t},[q3t,G3t]=Di.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Cb=new Uint32Array(80),Sb=new Uint32Array(80);class K3t extends Doe{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:a,Cl:o,Dh:l,Dl:c,Eh:u,El:d,Fh:f,Fl:x,Gh:g,Gl:y,Hh:v,Hl:C}=this;return[e,n,r,s,a,o,l,c,u,d,f,x,g,y,v,C]}set(e,n,r,s,a,o,l,c,u,d,f,x,g,y,v,C){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=a|0,this.Cl=o|0,this.Dh=l|0,this.Dl=c|0,this.Eh=u|0,this.El=d|0,this.Fh=f|0,this.Fl=x|0,this.Gh=g|0,this.Gl=y|0,this.Hh=v|0,this.Hl=C|0}process(e,n){for(let T=0;T<16;T++,n+=4)Cb[T]=e.getUint32(n),Sb[T]=e.getUint32(n+=4);for(let T=16;T<80;T++){const M=Cb[T-15]|0,F=Sb[T-15]|0,$=Di.rotrSH(M,F,1)^Di.rotrSH(M,F,8)^Di.shrSH(M,F,7),L=Di.rotrSL(M,F,1)^Di.rotrSL(M,F,8)^Di.shrSL(M,F,7),z=Cb[T-2]|0,X=Sb[T-2]|0,ne=Di.rotrSH(z,X,19)^Di.rotrBH(z,X,61)^Di.shrSH(z,X,6),J=Di.rotrSL(z,X,19)^Di.rotrBL(z,X,61)^Di.shrSL(z,X,6),K=Di.add4L(L,J,Sb[T-7],Sb[T-16]),te=Di.add4H(K,$,ne,Cb[T-7],Cb[T-16]);Cb[T]=te|0,Sb[T]=K|0}let{Ah:r,Al:s,Bh:a,Bl:o,Ch:l,Cl:c,Dh:u,Dl:d,Eh:f,El:x,Fh:g,Fl:y,Gh:v,Gl:C,Hh:N,Hl:P}=this;for(let T=0;T<80;T++){const M=Di.rotrSH(f,x,14)^Di.rotrSH(f,x,18)^Di.rotrBH(f,x,41),F=Di.rotrSL(f,x,14)^Di.rotrSL(f,x,18)^Di.rotrBL(f,x,41),$=f&g^~f&v,L=x&y^~x&C,z=Di.add5L(P,F,L,G3t[T],Sb[T]),X=Di.add5H(z,N,M,$,q3t[T],Cb[T]),ne=z|0,J=Di.rotrSH(r,s,28)^Di.rotrBH(r,s,34)^Di.rotrBH(r,s,39),K=Di.rotrSL(r,s,28)^Di.rotrBL(r,s,34)^Di.rotrBL(r,s,39),te=r&a^r&l^a&l,fe=s&o^s&c^o&c;N=v|0,P=C|0,v=g|0,C=y|0,g=f|0,y=x|0,{h:f,l:x}=Di.add(u|0,d|0,X|0,ne|0),u=l|0,d=c|0,l=a|0,c=o|0,a=r|0,o=s|0;const q=Di.add3L(ne,K,fe);r=Di.add3H(q,X,J,te),s=q|0}({h:r,l:s}=Di.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:a,l:o}=Di.add(this.Bh|0,this.Bl|0,a|0,o|0),{h:l,l:c}=Di.add(this.Ch|0,this.Cl|0,l|0,c|0),{h:u,l:d}=Di.add(this.Dh|0,this.Dl|0,u|0,d|0),{h:f,l:x}=Di.add(this.Eh|0,this.El|0,f|0,x|0),{h:g,l:y}=Di.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:v,l:C}=Di.add(this.Gh|0,this.Gl|0,v|0,C|0),{h:N,l:P}=Di.add(this.Hh|0,this.Hl|0,N|0,P|0),this.set(r,s,a,o,l,c,u,d,f,x,g,y,v,C,N,P)}roundClean(){Cb.fill(0),Sb.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Boe=O$(()=>new K3t);function Y3t(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const $xe=Y3t(),Uxe=$xe.crypto||$xe.msCrypto;function X3t(t){switch(t){case"sha256":return sj.create();case"sha512":return Boe.create()}vn(!1,"invalid hashing algorithm name","algorithm",t)}function Q3t(t,e){const n={sha256:sj,sha512:Boe}[t];return vn(n!=null,"invalid hmac algorithm","algorithm",t),M$.create(n,e)}function Z3t(t,e,n,r,s){const a={sha256:sj,sha512:Boe}[s];return vn(a!=null,"invalid pbkdf2 algorithm","algorithm",s),Loe(a,t,e,{c:n,dkLen:r})}function J3t(t){Dr(Uxe!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),vn(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return Uxe.getRandomValues(e),e}let CIe=!1;const SIe=function(t,e,n){return Q3t(t,e).update(n).digest()};let NIe=SIe;function ij(t,e,n){const r=ms(e,"key"),s=ms(n,"data");return Kr(NIe(t,r,s))}ij._=SIe;ij.lock=function(){CIe=!0};ij.register=function(t){if(CIe)throw new Error("computeHmac is locked");NIe=t};Object.freeze(ij);const[AIe,jIe,EIe]=[[],[],[]],e5t=BigInt(0),Z8=BigInt(1),t5t=BigInt(2),n5t=BigInt(7),r5t=BigInt(256),s5t=BigInt(113);for(let t=0,e=Z8,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],AIe.push(2*(5*r+n)),jIe.push((t+1)*(t+2)/2%64);let s=e5t;for(let a=0;a<7;a++)e=(e<<Z8^(e>>n5t)*s5t)%r5t,e&t5t&&(s^=Z8<<(Z8<<BigInt(a))-Z8);EIe.push(s)}const[i5t,a5t]=gIe(EIe,!0),zxe=(t,e,n)=>n>32?vIe(t,e,n):bIe(t,e,n),Hxe=(t,e,n)=>n>32?wIe(t,e,n):yIe(t,e,n);function o5t(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const l=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=zxe(u,d,1)^n[l],x=Hxe(u,d,1)^n[l+1];for(let g=0;g<50;g+=10)t[o+g]^=f,t[o+g+1]^=x}let s=t[2],a=t[3];for(let o=0;o<24;o++){const l=jIe[o],c=zxe(s,a,l),u=Hxe(s,a,l),d=AIe[o];s=t[d],a=t[d+1],t[d]=c,t[d+1]=u}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)n[l]=t[o+l];for(let l=0;l<10;l++)t[o+l]^=~n[(l+2)%10]&n[(l+4)%10]}t[0]^=i5t[r],t[1]^=a5t[r]}n.fill(0)}let l5t=class _Ie extends Roe{constructor(e,n,r,s=!1,a=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Gf(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=HO(this.state)}keccak(){o5t(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){aN(this);const{blockLen:n,state:r}=this;e=oN(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){aN(this,!1),Moe(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,a=e.length;s<a;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,a-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Gf(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(fIe(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:a,enableXOF:o}=this;return e||(e=new _Ie(n,r,s,o,a)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const c5t=(t,e,n)=>O$(()=>new l5t(e,t,n)),u5t=c5t(1,136,256/8);let kIe=!1;const TIe=function(t){return u5t(t)};let PIe=TIe;function ho(t){const e=ms(t,"data");return Kr(PIe(e))}ho._=TIe;ho.lock=function(){kIe=!0};ho.register=function(t){if(kIe)throw new TypeError("keccak256 is locked");PIe=t};Object.freeze(ho);const d5t=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),IIe=Uint8Array.from({length:16},(t,e)=>e),f5t=IIe.map(t=>(9*t+5)%16);let $oe=[IIe],Uoe=[f5t];for(let t=0;t<4;t++)for(let e of[$oe,Uoe])e.push(e[t].map(n=>d5t[n]));const FIe=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),h5t=$oe.map((t,e)=>t.map(n=>FIe[e][n])),p5t=Uoe.map((t,e)=>t.map(n=>FIe[e][n])),m5t=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),x5t=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),DI=(t,e)=>t<<e|t>>>32-e;function Vxe(t,e,n,r){return t===0?e^n^r:t===1?e&n|~e&r:t===2?(e|~n)^r:t===3?e&r|n&~r:e^(n|~r)}const BI=new Uint32Array(16);class g5t extends Doe{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:n,h2:r,h3:s,h4:a}=this;return[e,n,r,s,a]}set(e,n,r,s,a){this.h0=e|0,this.h1=n|0,this.h2=r|0,this.h3=s|0,this.h4=a|0}process(e,n){for(let g=0;g<16;g++,n+=4)BI[g]=e.getUint32(n,!0);let r=this.h0|0,s=r,a=this.h1|0,o=a,l=this.h2|0,c=l,u=this.h3|0,d=u,f=this.h4|0,x=f;for(let g=0;g<5;g++){const y=4-g,v=m5t[g],C=x5t[g],N=$oe[g],P=Uoe[g],T=h5t[g],M=p5t[g];for(let F=0;F<16;F++){const $=DI(r+Vxe(g,a,l,u)+BI[N[F]]+v,T[F])+f|0;r=f,f=u,u=DI(l,10)|0,l=a,a=$}for(let F=0;F<16;F++){const $=DI(s+Vxe(y,o,c,d)+BI[P[F]]+C,M[F])+x|0;s=x,x=d,d=DI(c,10)|0,c=o,o=$}}this.set(this.h1+l+d|0,this.h2+u+x|0,this.h3+f+s|0,this.h4+r+o|0,this.h0+a+c|0)}roundClean(){BI.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const b5t=O$(()=>new g5t);let OIe=!1;const MIe=function(t){return b5t(t)};let RIe=MIe;function aj(t){const e=ms(t,"data");return Kr(RIe(e))}aj._=MIe;aj.lock=function(){OIe=!0};aj.register=function(t){if(OIe)throw new TypeError("ripemd160 is locked");RIe=t};Object.freeze(aj);let LIe=!1;const DIe=function(t,e,n,r,s){return Z3t(t,e,n,r,s)};let BIe=DIe;function N2(t,e,n,r,s){const a=ms(t,"password"),o=ms(e,"salt");return Kr(BIe(a,o,n,r,s))}N2._=DIe;N2.lock=function(){LIe=!0};N2.register=function(t){if(LIe)throw new Error("pbkdf2 is locked");BIe=t};Object.freeze(N2);let $Ie=!1;const UIe=function(t){return new Uint8Array(J3t(t))};let zIe=UIe;function n1(t){return zIe(t)}n1._=UIe;n1.lock=function(){$Ie=!0};n1.register=function(t){if($Ie)throw new Error("randomBytes is locked");zIe=t};Object.freeze(n1);const ma=(t,e)=>t<<e|t>>>32-e;function Wxe(t,e,n,r,s,a){let o=t[e++]^n[r++],l=t[e++]^n[r++],c=t[e++]^n[r++],u=t[e++]^n[r++],d=t[e++]^n[r++],f=t[e++]^n[r++],x=t[e++]^n[r++],g=t[e++]^n[r++],y=t[e++]^n[r++],v=t[e++]^n[r++],C=t[e++]^n[r++],N=t[e++]^n[r++],P=t[e++]^n[r++],T=t[e++]^n[r++],M=t[e++]^n[r++],F=t[e++]^n[r++],$=o,L=l,z=c,X=u,ne=d,J=f,K=x,te=g,fe=y,q=v,se=C,ae=N,W=P,V=T,ee=M,oe=F;for(let de=0;de<8;de+=2)ne^=ma($+W|0,7),fe^=ma(ne+$|0,9),W^=ma(fe+ne|0,13),$^=ma(W+fe|0,18),q^=ma(J+L|0,7),V^=ma(q+J|0,9),L^=ma(V+q|0,13),J^=ma(L+V|0,18),ee^=ma(se+K|0,7),z^=ma(ee+se|0,9),K^=ma(z+ee|0,13),se^=ma(K+z|0,18),X^=ma(oe+ae|0,7),te^=ma(X+oe|0,9),ae^=ma(te+X|0,13),oe^=ma(ae+te|0,18),L^=ma($+X|0,7),z^=ma(L+$|0,9),X^=ma(z+L|0,13),$^=ma(X+z|0,18),K^=ma(J+ne|0,7),te^=ma(K+J|0,9),ne^=ma(te+K|0,13),J^=ma(ne+te|0,18),ae^=ma(se+q|0,7),fe^=ma(ae+se|0,9),q^=ma(fe+ae|0,13),se^=ma(q+fe|0,18),W^=ma(oe+ee|0,7),V^=ma(W+oe|0,9),ee^=ma(V+W|0,13),oe^=ma(ee+V|0,18);s[a++]=o+$|0,s[a++]=l+L|0,s[a++]=c+z|0,s[a++]=u+X|0,s[a++]=d+ne|0,s[a++]=f+J|0,s[a++]=x+K|0,s[a++]=g+te|0,s[a++]=y+fe|0,s[a++]=v+q|0,s[a++]=C+se|0,s[a++]=N+ae|0,s[a++]=P+W|0,s[a++]=T+V|0,s[a++]=M+ee|0,s[a++]=F+oe|0}function j4(t,e,n,r,s){let a=r+0,o=r+16*s;for(let l=0;l<16;l++)n[o+l]=t[e+(2*s-1)*16+l];for(let l=0;l<s;l++,a+=16,e+=16)Wxe(n,o,t,e,n,a),l>0&&(o+=16),Wxe(n,a,t,e+=16,n,o)}function HIe(t,e,n){const r=pIe({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:s,r:a,p:o,dkLen:l,asyncTick:c,maxmem:u,onProgress:d}=r;if(Gf(s),Gf(a),Gf(o),Gf(l),Gf(c),Gf(u),d!==void 0&&typeof d!="function")throw new Error("progressCb should be function");const f=128*a,x=f/4;if(s<=1||s&s-1||s>=2**(f/8)||s>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(o<0||o>(2**32-1)*32/f)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(l<0||l>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const g=f*(s+o);if(g>u)throw new Error(`Scrypt: parameters too large, ${g} (128 * r * (N + p)) > ${u} (maxmem)`);const y=Loe(sj,t,e,{c:1,dkLen:f*o}),v=HO(y),C=HO(new Uint8Array(f*s)),N=HO(new Uint8Array(f));let P=()=>{};if(d){const T=2*s*o,M=Math.max(Math.floor(T/1e4),1);let F=0;P=()=>{F++,d&&(!(F%M)||F===T)&&d(F/T)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:N,blockMixCb:P,asyncTick:c}}function VIe(t,e,n,r,s){const a=Loe(sj,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),s.fill(0),a}function y5t(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x}=HIe(t,e,n);for(let g=0;g<a;g++){const y=l*g;for(let v=0;v<l;v++)c[v]=u[y+v];for(let v=0,C=0;v<r-1;v++)j4(c,C,c,C+=l,s),x();j4(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let N=0;N<l;N++)f[N]=u[y+N]^c[C*l+N];j4(f,0,u,y,s),x()}}return VIe(t,o,d,c,f)}async function v5t(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x,asyncTick:g}=HIe(t,e,n);for(let y=0;y<a;y++){const v=l*y;for(let N=0;N<l;N++)c[N]=u[v+N];let C=0;await Bxe(r-1,g,()=>{j4(c,C,c,C+=l,s),x()}),j4(c,(r-1)*l,u,v,s),x(),await Bxe(r,g,()=>{const N=u[v+l-16]%r;for(let P=0;P<l;P++)f[P]=u[v+P]^c[N*l+P];j4(f,0,u,v,s),x()})}return VIe(t,o,d,c,f)}let WIe=!1,qIe=!1;const GIe=async function(t,e,n,r,s,a,o){return await v5t(t,e,{N:n,r,p:s,dkLen:a,onProgress:o})},KIe=function(t,e,n,r,s,a){return y5t(t,e,{N:n,r,p:s,dkLen:a})};let YIe=GIe,XIe=KIe;async function oj(t,e,n,r,s,a,o){const l=ms(t,"passwd"),c=ms(e,"salt");return Kr(await YIe(l,c,n,r,s,a,o))}oj._=GIe;oj.lock=function(){qIe=!0};oj.register=function(t){if(qIe)throw new Error("scrypt is locked");YIe=t};Object.freeze(oj);function lj(t,e,n,r,s,a){const o=ms(t,"passwd"),l=ms(e,"salt");return Kr(XIe(o,l,n,r,s,a))}lj._=KIe;lj.lock=function(){WIe=!0};lj.register=function(t){if(WIe)throw new Error("scryptSync is locked");XIe=t};Object.freeze(lj);const QIe=function(t){return X3t("sha256").update(t).digest()};let ZIe=QIe,JIe=!1;function xp(t){const e=ms(t,"data");return Kr(ZIe(e))}xp._=QIe;xp.lock=function(){JIe=!0};xp.register=function(t){if(JIe)throw new Error("sha256 is locked");ZIe=t};Object.freeze(xp);Object.freeze(xp);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const eFe=BigInt(0),R$=BigInt(1),w5t=BigInt(2),L$=t=>t instanceof Uint8Array,C5t=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function lN(t){if(!L$(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=C5t[t[n]];return e}function tFe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function zoe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function cN(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,a=t.slice(s,s+2),o=Number.parseInt(a,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function p3(t){return zoe(lN(t))}function Hoe(t){if(!L$(t))throw new Error("Uint8Array expected");return zoe(lN(Uint8Array.from(t).reverse()))}function uN(t,e){return cN(t.toString(16).padStart(e*2,"0"))}function Voe(t,e){return uN(t,e).reverse()}function S5t(t){return cN(tFe(t))}function Kp(t,e,n){let r;if(typeof e=="string")try{r=cN(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(L$(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function WE(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!L$(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function N5t(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function A5t(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function j5t(t){let e;for(e=0;t>eFe;t>>=R$,e+=1);return e}function E5t(t,e){return t>>BigInt(e)&R$}const _5t=(t,e,n)=>t|(n?R$:eFe)<<BigInt(e),Woe=t=>(w5t<<BigInt(t-1))-R$,$V=t=>new Uint8Array(t),qxe=t=>Uint8Array.from(t);function nFe(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=$V(t),s=$V(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=$V())=>{s=l(qxe([0]),f),r=l(),f.length!==0&&(s=l(qxe([1]),f),r=l())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const x=[];for(;f<e;){r=l();const g=r.slice();x.push(g),f+=r.length}return WE(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const k5t={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function jT(t,e,n={}){const r=(s,a,o)=>{const l=k5t[a];if(typeof l!="function")throw new Error(`Invalid validator "${a}", expected function`);const c=t[s];if(!(o&&c===void 0)&&!l(c,t))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${a}`)};for(const[s,a]of Object.entries(e))r(s,a,!1);for(const[s,a]of Object.entries(n))r(s,a,!0);return t}const T5t=Object.freeze(Object.defineProperty({__proto__:null,bitGet:E5t,bitLen:j5t,bitMask:Woe,bitSet:_5t,bytesToHex:lN,bytesToNumberBE:p3,bytesToNumberLE:Hoe,concatBytes:WE,createHmacDrbg:nFe,ensureBytes:Kp,equalBytes:N5t,hexToBytes:cN,hexToNumber:zoe,numberToBytesBE:uN,numberToBytesLE:Voe,numberToHexUnpadded:tFe,numberToVarBytesBE:S5t,utf8ToBytes:A5t,validateObject:jT},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ic=BigInt(0),Sl=BigInt(1),tw=BigInt(2),P5t=BigInt(3),Kee=BigInt(4),Gxe=BigInt(5),Kxe=BigInt(8);BigInt(9);BigInt(16);function Xd(t,e){const n=t%e;return n>=Ic?n:e+n}function I5t(t,e,n){if(n<=Ic||e<Ic)throw new Error("Expected power/modulo > 0");if(n===Sl)return Ic;let r=Sl;for(;e>Ic;)e&Sl&&(r=r*t%n),t=t*t%n,e>>=Sl;return r}function jh(t,e,n){let r=t;for(;e-- >Ic;)r*=r,r%=n;return r}function Yee(t,e){if(t===Ic||e<=Ic)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Xd(t,e),r=e,s=Ic,a=Sl;for(;n!==Ic;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==Sl)throw new Error("invert: does not exist");return Xd(s,e)}function F5t(t){const e=(t-Sl)/tw;let n,r,s;for(n=t-Sl,r=0;n%tw===Ic;n/=tw,r++);for(s=tw;s<t&&I5t(s,e,t)!==t-Sl;s++);if(r===1){const o=(t+Sl)/Kee;return function(c,u){const d=c.pow(u,o);if(!c.eql(c.sqr(d),u))throw new Error("Cannot find square root");return d}}const a=(n+Sl)/tw;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,Sl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function O5t(t){if(t%Kee===P5t){const e=(t+Sl)/Kee;return function(r,s){const a=r.pow(s,e);if(!r.eql(r.sqr(a),s))throw new Error("Cannot find square root");return a}}if(t%Kxe===Gxe){const e=(t-Gxe)/Kxe;return function(r,s){const a=r.mul(s,tw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,tw),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return F5t(t)}const M5t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function R5t(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=M5t.reduce((r,s)=>(r[s]="function",r),e);return jT(t,n)}function L5t(t,e,n){if(n<Ic)throw new Error("Expected power > 0");if(n===Ic)return t.ONE;if(n===Sl)return e;let r=t.ONE,s=e;for(;n>Ic;)n&Sl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Sl;return r}function D5t(t,e){const n=new Array(e.length),r=e.reduce((a,o,l)=>t.is0(o)?a:(n[l]=a,t.mul(a,o)),t.ONE),s=t.inv(r);return e.reduceRight((a,o,l)=>t.is0(o)?a:(n[l]=t.mul(a,n[l]),t.mul(a,o)),s),n}function rFe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function B5t(t,e,n=!1,r={}){if(t<=Ic)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=rFe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=O5t(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:Woe(s),ZERO:Ic,ONE:Sl,create:c=>Xd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Ic<=c&&c<t},is0:c=>c===Ic,isOdd:c=>(c&Sl)===Sl,neg:c=>Xd(-c,t),eql:(c,u)=>c===u,sqr:c=>Xd(c*c,t),add:(c,u)=>Xd(c+u,t),sub:(c,u)=>Xd(c-u,t),mul:(c,u)=>Xd(c*u,t),pow:(c,u)=>L5t(l,c,u),div:(c,u)=>Xd(c*Yee(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Yee(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>D5t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?Voe(c,a):uN(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?Hoe(c):p3(c)}});return Object.freeze(l)}function sFe(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function iFe(t){const e=sFe(t);return e+Math.ceil(e/2)}function $5t(t,e,n=!1){const r=t.length,s=sFe(e),a=iFe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?p3(t):Hoe(t),l=Xd(o,e-Sl)+Sl;return n?Voe(l,s):uN(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const U5t=BigInt(0),UV=BigInt(1);function z5t(t,e){const n=(s,a)=>{const o=a.negate();return s?o:a},r=s=>{const a=Math.ceil(e/s)+1,o=2**(s-1);return{windows:a,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,a){let o=t.ZERO,l=s;for(;a>U5t;)a&UV&&(o=o.add(l)),l=l.double(),a>>=UV;return o},precomputeWindow(s,a){const{windows:o,windowSize:l}=r(a),c=[];let u=s,d=u;for(let f=0;f<o;f++){d=u,c.push(d);for(let x=1;x<l;x++)d=d.add(u),c.push(d);u=d.double()}return c},wNAF(s,a,o){const{windows:l,windowSize:c}=r(s);let u=t.ZERO,d=t.BASE;const f=BigInt(2**s-1),x=2**s,g=BigInt(s);for(let y=0;y<l;y++){const v=y*c;let C=Number(o&f);o>>=g,C>c&&(C-=x,o+=UV);const N=v,P=v+Math.abs(C)-1,T=y%2!==0,M=C<0;C===0?d=d.add(n(T,a[N])):u=u.add(n(M,a[P]))}return{p:u,f:d}},wNAFCached(s,a,o,l){const c=s._WINDOW_SIZE||1;let u=a.get(s);return u||(u=this.precomputeWindow(s,c),c!==1&&a.set(s,l(u))),this.wNAF(c,u,o)}}}function aFe(t){return R5t(t.Fp),jT(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...rFe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function H5t(t){const e=aFe(t);jT(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:V5t,hexToBytes:W5t}=T5t,fw={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=fw;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:V5t(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=fw,n=typeof t=="string"?W5t(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:a}=fw._parseInt(n.subarray(2)),{d:o,l}=fw._parseInt(a);if(l.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const d=u.toString(16);return d.length&1?`0${d}`:d},r=e(n(t.s)),s=e(n(t.r)),a=r.length/2,o=s.length/2,l=n(a),c=n(o);return`30${n(o+a+4)}02${c}${s}02${l}${r}`}},Bg=BigInt(0),Zh=BigInt(1);BigInt(2);const Yxe=BigInt(3);BigInt(4);function q5t(t){const e=H5t(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const N=v.toAffine();return WE(Uint8Array.from([4]),n.toBytes(N.x),n.toBytes(N.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),N=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:N}});function a(y){const{a:v,b:C}=e,N=n.sqr(y),P=n.mul(N,y);return n.add(n.add(P,n.mul(y,v)),C)}if(!n.eql(n.sqr(e.Gy),a(e.Gx)))throw new Error("bad generator point: equation left != right");function o(y){return typeof y=="bigint"&&Bg<y&&y<e.n}function l(y){if(!o(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(y){const{allowedPrivateKeyLengths:v,nByteLength:C,wrapPrivateKey:N,n:P}=e;if(v&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=lN(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let T;try{T=typeof y=="bigint"?y:p3(Kp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return N&&(T=Xd(T,P)),l(T),T}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,N){if(this.px=v,this.py=C,this.pz=N,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(N==null||!n.isValid(N))throw new Error("z required")}static fromAffine(v){const{x:C,y:N}=v||{};if(!v||!n.isValid(C)||!n.isValid(N))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const P=T=>n.eql(T,n.ZERO);return P(C)&&P(N)?f.ZERO:new f(C,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(N=>N.pz));return v.map((N,P)=>N.toAffine(C[P])).map(f.fromAffine)}static fromHex(v){const C=f.fromAffine(s(Kp("pointHex",v)));return C.assertValidity(),C}static fromPrivateKey(v){return f.BASE.multiply(c(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:C}=this.toAffine();if(!n.isValid(v)||!n.isValid(C))throw new Error("bad point: x or y not FE");const N=n.sqr(C),P=a(v);if(!n.eql(N,P))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(n.isOdd)return!n.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){d(v);const{px:C,py:N,pz:P}=this,{px:T,py:M,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(T,P)),L=n.eql(n.mul(N,F),n.mul(M,P));return $&&L}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,N=n.mul(C,Yxe),{px:P,py:T,pz:M}=this;let F=n.ZERO,$=n.ZERO,L=n.ZERO,z=n.mul(P,P),X=n.mul(T,T),ne=n.mul(M,M),J=n.mul(P,T);return J=n.add(J,J),L=n.mul(P,M),L=n.add(L,L),F=n.mul(v,L),$=n.mul(N,ne),$=n.add(F,$),F=n.sub(X,$),$=n.add(X,$),$=n.mul(F,$),F=n.mul(J,F),L=n.mul(N,L),ne=n.mul(v,ne),J=n.sub(z,ne),J=n.mul(v,J),J=n.add(J,L),L=n.add(z,z),z=n.add(L,z),z=n.add(z,ne),z=n.mul(z,J),$=n.add($,z),ne=n.mul(T,M),ne=n.add(ne,ne),z=n.mul(ne,J),F=n.sub(F,z),L=n.mul(ne,X),L=n.add(L,L),L=n.add(L,L),new f(F,$,L)}add(v){d(v);const{px:C,py:N,pz:P}=this,{px:T,py:M,pz:F}=v;let $=n.ZERO,L=n.ZERO,z=n.ZERO;const X=e.a,ne=n.mul(e.b,Yxe);let J=n.mul(C,T),K=n.mul(N,M),te=n.mul(P,F),fe=n.add(C,N),q=n.add(T,M);fe=n.mul(fe,q),q=n.add(J,K),fe=n.sub(fe,q),q=n.add(C,P);let se=n.add(T,F);return q=n.mul(q,se),se=n.add(J,te),q=n.sub(q,se),se=n.add(N,P),$=n.add(M,F),se=n.mul(se,$),$=n.add(K,te),se=n.sub(se,$),z=n.mul(X,q),$=n.mul(ne,te),z=n.add($,z),$=n.sub(K,z),z=n.add(K,z),L=n.mul($,z),K=n.add(J,J),K=n.add(K,J),te=n.mul(X,te),q=n.mul(ne,q),K=n.add(K,te),te=n.sub(J,te),te=n.mul(X,te),q=n.add(q,te),J=n.mul(K,q),L=n.add(L,J),J=n.mul(se,q),$=n.mul(fe,$),$=n.sub($,J),J=n.mul(fe,K),z=n.mul(se,z),z=n.add(z,J),new f($,L,z)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const N=n.invertBatch(C.map(P=>P.pz));return C.map((P,T)=>P.toAffine(N[T])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===Bg)return C;if(l(v),v===Zh)return this;const{endo:N}=e;if(!N)return g.unsafeLadder(this,v);let{k1neg:P,k1:T,k2neg:M,k2:F}=N.splitScalar(v),$=C,L=C,z=this;for(;T>Bg||F>Bg;)T&Zh&&($=$.add(z)),F&Zh&&(L=L.add(z)),z=z.double(),T>>=Zh,F>>=Zh;return P&&($=$.negate()),M&&(L=L.negate()),L=new f(n.mul(L.px,N.beta),L.py,L.pz),$.add(L)}multiply(v){l(v);let C=v,N,P;const{endo:T}=e;if(T){const{k1neg:M,k1:F,k2neg:$,k2:L}=T.splitScalar(C);let{p:z,f:X}=this.wNAF(F),{p:ne,f:J}=this.wNAF(L);z=g.constTimeNegate(M,z),ne=g.constTimeNegate($,ne),ne=new f(n.mul(ne.px,T.beta),ne.py,ne.pz),N=z.add(ne),P=X.add(J)}else{const{p:M,f:F}=this.wNAF(C);N=M,P=F}return f.normalizeZ([N,P])[0]}multiplyAndAddUnsafe(v,C,N){const P=f.BASE,T=(F,$)=>$===Bg||$===Zh||!F.equals(P)?F.multiplyUnsafe($):F.multiply($),M=T(this,C).add(T(v,N));return M.is0()?void 0:M}toAffine(v){const{px:C,py:N,pz:P}=this,T=this.is0();v==null&&(v=T?n.ONE:n.inv(P));const M=n.mul(C,v),F=n.mul(N,v),$=n.mul(P,v);if(T)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:M,y:F}}isTorsionFree(){const{h:v,isTorsionFree:C}=e;if(v===Zh)return!0;if(C)return C(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:C}=e;return v===Zh?this:C?C(f,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),r(f,this,v)}toHex(v=!0){return lN(this.toRawBytes(v))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const x=e.nBitLength,g=z5t(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function G5t(t){const e=aFe(t);return jT(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function K5t(t){const e=G5t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(q){return Bg<q&&q<n.ORDER}function l(q){return Xd(q,r)}function c(q){return Yee(q,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=q5t({...e,toBytes(q,se,ae){const W=se.toAffine(),V=n.toBytes(W.x),ee=WE;return ae?ee(Uint8Array.from([se.hasEvenY()?2:3]),V):ee(Uint8Array.from([4]),V,n.toBytes(W.y))},fromBytes(q){const se=q.length,ae=q[0],W=q.subarray(1);if(se===s&&(ae===2||ae===3)){const V=p3(W);if(!o(V))throw new Error("Point is not on curve");const ee=f(V);let oe=n.sqrt(ee);const de=(oe&Zh)===Zh;return(ae&1)===1!==de&&(oe=n.neg(oe)),{x:V,y:oe}}else if(se===a&&ae===4){const V=n.fromBytes(W.subarray(0,n.BYTES)),ee=n.fromBytes(W.subarray(n.BYTES,2*n.BYTES));return{x:V,y:ee}}else throw new Error(`Point of length ${se} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=q=>lN(uN(q,e.nByteLength));function y(q){const se=r>>Zh;return q>se}function v(q){return y(q)?l(-q):q}const C=(q,se,ae)=>p3(q.slice(se,ae));class N{constructor(se,ae,W){this.r=se,this.s=ae,this.recovery=W,this.assertValidity()}static fromCompact(se){const ae=e.nByteLength;return se=Kp("compactSignature",se,ae*2),new N(C(se,0,ae),C(se,ae,2*ae))}static fromDER(se){const{r:ae,s:W}=fw.toSig(Kp("DER",se));return new N(ae,W)}assertValidity(){if(!x(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!x(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(se){return new N(this.r,this.s,se)}recoverPublicKey(se){const{r:ae,s:W,recovery:V}=this,ee=L(Kp("msgHash",se));if(V==null||![0,1,2,3].includes(V))throw new Error("recovery id invalid");const oe=V===2||V===3?ae+e.n:ae;if(oe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const de=V&1?"03":"02",Ce=u.fromHex(de+g(oe)),me=c(oe),we=l(-ee*me),xe=l(W*me),be=u.BASE.multiplyAndAddUnsafe(Ce,we,xe);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return cN(this.toDERHex())}toDERHex(){return fw.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return cN(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const P={isValidPrivateKey(q){try{return d(q),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const q=iFe(e.n);return $5t(e.randomBytes(q),e.n)},precompute(q=8,se=u.BASE){return se._setWindowSize(q),se.multiply(BigInt(3)),se}};function T(q,se=!0){return u.fromPrivateKey(q).toRawBytes(se)}function M(q){const se=q instanceof Uint8Array,ae=typeof q=="string",W=(se||ae)&&q.length;return se?W===s||W===a:ae?W===2*s||W===2*a:q instanceof u}function F(q,se,ae=!0){if(M(q))throw new Error("first arg must be private key");if(!M(se))throw new Error("second arg must be public key");return u.fromHex(se).multiply(d(q)).toRawBytes(ae)}const $=e.bits2int||function(q){const se=p3(q),ae=q.length*8-e.nBitLength;return ae>0?se>>BigInt(ae):se},L=e.bits2int_modN||function(q){return l($(q))},z=Woe(e.nBitLength);function X(q){if(typeof q!="bigint")throw new Error("bigint expected");if(!(Bg<=q&&q<z))throw new Error(`bigint expected < 2^${e.nBitLength}`);return uN(q,e.nByteLength)}function ne(q,se,ae=J){if(["recovered","canonical"].some(Ie=>Ie in ae))throw new Error("sign() legacy options not supported");const{hash:W,randomBytes:V}=e;let{lowS:ee,prehash:oe,extraEntropy:de}=ae;ee==null&&(ee=!0),q=Kp("msgHash",q),oe&&(q=Kp("prehashed msgHash",W(q)));const Ce=L(q),me=d(se),we=[X(me),X(Ce)];if(de!=null){const Ie=de===!0?V(n.BYTES):de;we.push(Kp("extraEntropy",Ie))}const xe=WE(...we),be=Ce;function je(Ie){const Re=$(Ie);if(!x(Re))return;const Qe=c(Re),Ke=u.BASE.multiply(Re).toAffine(),dt=l(Ke.x);if(dt===Bg)return;const tt=l(Qe*l(be+dt*me));if(tt===Bg)return;let nt=(Ke.x===dt?0:2)|Number(Ke.y&Zh),Le=tt;return ee&&y(tt)&&(Le=v(tt),nt^=1),new N(dt,Le,nt)}return{seed:xe,k2sig:je}}const J={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function te(q,se,ae=J){const{seed:W,k2sig:V}=ne(q,se,ae),ee=e;return nFe(ee.hash.outputLen,ee.nByteLength,ee.hmac)(W,V)}u.BASE._setWindowSize(8);function fe(q,se,ae,W=K){var Ke;const V=q;if(se=Kp("msgHash",se),ae=Kp("publicKey",ae),"strict"in W)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:oe}=W;let de,Ce;try{if(typeof V=="string"||V instanceof Uint8Array)try{de=N.fromDER(V)}catch(dt){if(!(dt instanceof fw.Err))throw dt;de=N.fromCompact(V)}else if(typeof V=="object"&&typeof V.r=="bigint"&&typeof V.s=="bigint"){const{r:dt,s:tt}=V;de=new N(dt,tt)}else throw new Error("PARSE");Ce=u.fromHex(ae)}catch(dt){if(dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&de.hasHighS())return!1;oe&&(se=e.hash(se));const{r:me,s:we}=de,xe=L(se),be=c(we),je=l(xe*be),Ie=l(me*be),Re=(Ke=u.BASE.multiplyAndAddUnsafe(Ce,je,Ie))==null?void 0:Ke.toAffine();return Re?l(Re.x)===me:!1}return{CURVE:e,getPublicKey:T,getSharedSecret:F,sign:te,verify:fe,ProjectivePoint:u,Signature:N,utils:P}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Y5t(t){return{hash:t,hmac:(e,...n)=>M$(t,e,v3t(...n)),randomBytes:C3t}}function X5t(t,e){const n=r=>K5t({...t,...Y5t(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oFe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Xxe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Q5t=BigInt(1),Xee=BigInt(2),Qxe=(t,e)=>(t+e/Xee)/e;function Z5t(t){const e=oFe,n=BigInt(3),r=BigInt(6),s=BigInt(11),a=BigInt(22),o=BigInt(23),l=BigInt(44),c=BigInt(88),u=t*t*t%e,d=u*u*t%e,f=jh(d,n,e)*d%e,x=jh(f,n,e)*d%e,g=jh(x,Xee,e)*u%e,y=jh(g,s,e)*g%e,v=jh(y,a,e)*y%e,C=jh(v,l,e)*v%e,N=jh(C,c,e)*C%e,P=jh(N,l,e)*v%e,T=jh(P,n,e)*d%e,M=jh(T,o,e)*y%e,F=jh(M,r,e)*u%e,$=jh(F,Xee,e);if(!Qee.eql(Qee.sqr($),t))throw new Error("Cannot find square root");return $}const Qee=B5t(oFe,void 0,void 0,{sqrt:Z5t}),Db=X5t({a:BigInt(0),b:BigInt(7),Fp:Qee,n:Xxe,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=Xxe,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Q5t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=Qxe(a*t,e),c=Qxe(-r*t,e);let u=Xd(t-l*n-c*s,e),d=Xd(-l*r-c*a,e);const f=u>o,x=d>o;if(f&&(u=e-u),x&&(d=e-d),u>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:x,k2:d}}}},sj);BigInt(0);Db.ProjectivePoint;const qE="0x0000000000000000000000000000000000000000",Zxe="0x0000000000000000000000000000000000000000000000000000000000000000",J5t=`Ethereum Signed Message:
`,Jxe=BigInt(0),ege=BigInt(1),tge=BigInt(2),nge=BigInt(27),rge=BigInt(28),$I=BigInt(35),iC={};function sge(t){return g1(ul(t),32)}var dS,b0,fS,Gw;const Wp=class Wp{constructor(e,n,r,s){Rn(this,dS);Rn(this,b0);Rn(this,fS);Rn(this,Gw);_5(e,iC,"Signature"),Ut(this,dS,n),Ut(this,b0,r),Ut(this,fS,s),Ut(this,Gw,null)}get r(){return He(this,dS)}set r(e){vn(A4(e)===32,"invalid r","value",e),Ut(this,dS,Kr(e))}get s(){return vn(parseInt(He(this,b0).substring(0,3))<8,"non-canonical s; use ._s","s",He(this,b0)),He(this,b0)}set s(e){vn(A4(e)===32,"invalid s","value",e),Ut(this,b0,Kr(e))}get _s(){return He(this,b0)}isValid(){return parseInt(He(this,b0).substring(0,3))<8}get v(){return He(this,fS)}set v(e){const n=$i(e,"value");vn(n===27||n===28,"invalid v","v",e),Ut(this,fS,n)}get networkV(){return He(this,Gw)}get legacyChainId(){const e=this.networkV;return e==null?null:Wp.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ms(this.s);return this.yParity&&(e[0]|=128),Kr(e)}get compactSerialized(){return Da([this.r,this.yParityAndS])}get serialized(){return Da([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Wp(iC,this.r,this._s,this.v);return this.networkV&&Ut(e,Gw,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(e){const n=Es(e,"v");return n==nge||n==rge?Jxe:(vn(n>=$I,"invalid EIP-155 v","v",e),(n-$I)/tge)}static getChainIdV(e,n){return Es(e)*tge+BigInt(35+n-27)}static getNormalizedV(e){const n=Es(e);return n===Jxe||n===nge?27:n===ege||n===rge?28:(vn(n>=$I,"invalid v","v",e),n&ege?27:28)}static from(e){function n(u,d){vn(u,d,"signature",e)}if(e==null)return new Wp(iC,Zxe,Zxe,27);if(typeof e=="string"){const u=ms(e,"signature");if(u.length===64){const d=Kr(u.slice(0,32)),f=u.slice(32,64),x=f[0]&128?28:27;return f[0]&=127,new Wp(iC,d,Kr(f),x)}if(u.length===65){const d=Kr(u.slice(0,32)),f=Kr(u.slice(32,64)),x=Wp.getNormalizedV(u[64]);return new Wp(iC,d,f,x)}n(!1,"invalid raw signature length")}if(e instanceof Wp)return e.clone();const r=e.r;n(r!=null,"missing r");const s=sge(r),a=function(u,d){if(u!=null)return sge(u);if(d!=null){n(po(d,32),"invalid yParityAndS");const f=ms(d);return f[0]&=127,Kr(f)}n(!1,"missing s")}(e.s,e.yParityAndS),{networkV:o,v:l}=function(u,d,f){if(u!=null){const x=Es(u);return{networkV:x>=$I?x:void 0,v:Wp.getNormalizedV(x)}}if(d!=null)return n(po(d,32),"invalid yParityAndS"),{v:ms(d)[0]&128?28:27};if(f!=null){switch($i(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Wp(iC,s,a,l);return o&&Ut(c,Gw,o),n(e.yParity==null||$i(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};dS=new WeakMap,b0=new WeakMap,fS=new WeakMap,Gw=new WeakMap;let ou=Wp;var kg;const rw=class rw{constructor(e){Rn(this,kg);vn(A4(e)===32,"invalid private key","privateKey","[REDACTED]"),Ut(this,kg,Kr(e))}get privateKey(){return He(this,kg)}get publicKey(){return rw.computePublicKey(He(this,kg))}get compressedPublicKey(){return rw.computePublicKey(He(this,kg),!0)}sign(e){vn(A4(e)===32,"invalid digest length","digest",e);const n=Db.sign(su(e),su(He(this,kg)),{lowS:!0});return ou.from({r:b1(n.r,32),s:b1(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=rw.computePublicKey(e);return Kr(Db.getSharedSecret(su(He(this,kg)),ms(n),!1))}static computePublicKey(e,n){let r=ms(e,"key");if(r.length===32){const a=Db.getPublicKey(r,!!n);return Kr(a)}if(r.length===64){const a=new Uint8Array(65);a[0]=4,a.set(r,1),r=a}const s=Db.ProjectivePoint.fromHex(r);return Kr(s.toRawBytes(n))}static recoverPublicKey(e,n){vn(A4(e)===32,"invalid digest length","digest",e);const r=ou.from(n);let s=Db.Signature.fromCompact(su(Da([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const a=s.recoverPublicKey(su(e));return vn(a!=null,"invalid signature for digest","signature",n),"0x"+a.toHex(!1)}static addPoints(e,n,r){const s=Db.ProjectivePoint.fromHex(rw.computePublicKey(e).substring(2)),a=Db.ProjectivePoint.fromHex(rw.computePublicKey(n).substring(2));return"0x"+s.add(a).toHex(!!r)}};kg=new WeakMap;let G0=rw;const e6t=BigInt(0),t6t=BigInt(36);function ige(t){t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let s=0;s<40;s++)n[s]=e[s].charCodeAt(0);const r=ms(ho(n));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const qoe={};for(let t=0;t<10;t++)qoe[String(t)]=String(t);for(let t=0;t<26;t++)qoe[String.fromCharCode(65+t)]=String(10+t);const age=15;function n6t(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>qoe[r]).join("");for(;e.length>=age;){let r=e.substring(0,age);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const r6t=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function s6t(t){t=t.toLowerCase();let e=e6t;for(let n=0;n<t.length;n++)e=e*t6t+r6t[t[n]];return e}function aa(t){if(vn(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=ige(t);return vn(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){vn(t.substring(2,4)===n6t(t),"bad icap checksum","address",t);let e=s6t(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return ige("0x"+e)}vn(!1,"invalid address","address",t)}function i6t(t){const e=aa(t.from);let r=Es(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,aa(Co(ho(y1([e,r])),12))}function lFe(t){return t&&typeof t.getAddress=="function"}async function zV(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(Dr(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),vn(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),aa(n)}function Fc(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?aa(t):(Dr(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),zV(t,e.resolveName(t)));if(lFe(t))return zV(t,t.getAddress());if(t&&typeof t.then=="function")return zV(t,t);vn(!1,"unsupported addressable value","target",t)}const xg={};function Ts(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Uu(xg,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function xa(t,e){return new Uu(xg,`bytes${e||""}`,t,{size:e})}const oge=Symbol.for("_ethers_typed");var Kw;const bg=class bg{constructor(e,n,r,s){$n(this,"type");$n(this,"value");Rn(this,Kw);$n(this,"_typedSymbol");s==null&&(s=null),_5(xg,e,"Typed"),$s(this,{_typedSymbol:oge,type:n,value:r}),Ut(this,Kw,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return He(this,Kw)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return He(this,Kw)===!0?-1:He(this,Kw)===!1?this.value.length:null}static from(e,n){return new bg(xg,e,n)}static uint8(e){return Ts(e,8)}static uint16(e){return Ts(e,16)}static uint24(e){return Ts(e,24)}static uint32(e){return Ts(e,32)}static uint40(e){return Ts(e,40)}static uint48(e){return Ts(e,48)}static uint56(e){return Ts(e,56)}static uint64(e){return Ts(e,64)}static uint72(e){return Ts(e,72)}static uint80(e){return Ts(e,80)}static uint88(e){return Ts(e,88)}static uint96(e){return Ts(e,96)}static uint104(e){return Ts(e,104)}static uint112(e){return Ts(e,112)}static uint120(e){return Ts(e,120)}static uint128(e){return Ts(e,128)}static uint136(e){return Ts(e,136)}static uint144(e){return Ts(e,144)}static uint152(e){return Ts(e,152)}static uint160(e){return Ts(e,160)}static uint168(e){return Ts(e,168)}static uint176(e){return Ts(e,176)}static uint184(e){return Ts(e,184)}static uint192(e){return Ts(e,192)}static uint200(e){return Ts(e,200)}static uint208(e){return Ts(e,208)}static uint216(e){return Ts(e,216)}static uint224(e){return Ts(e,224)}static uint232(e){return Ts(e,232)}static uint240(e){return Ts(e,240)}static uint248(e){return Ts(e,248)}static uint256(e){return Ts(e,256)}static uint(e){return Ts(e,256)}static int8(e){return Ts(e,-8)}static int16(e){return Ts(e,-16)}static int24(e){return Ts(e,-24)}static int32(e){return Ts(e,-32)}static int40(e){return Ts(e,-40)}static int48(e){return Ts(e,-48)}static int56(e){return Ts(e,-56)}static int64(e){return Ts(e,-64)}static int72(e){return Ts(e,-72)}static int80(e){return Ts(e,-80)}static int88(e){return Ts(e,-88)}static int96(e){return Ts(e,-96)}static int104(e){return Ts(e,-104)}static int112(e){return Ts(e,-112)}static int120(e){return Ts(e,-120)}static int128(e){return Ts(e,-128)}static int136(e){return Ts(e,-136)}static int144(e){return Ts(e,-144)}static int152(e){return Ts(e,-152)}static int160(e){return Ts(e,-160)}static int168(e){return Ts(e,-168)}static int176(e){return Ts(e,-176)}static int184(e){return Ts(e,-184)}static int192(e){return Ts(e,-192)}static int200(e){return Ts(e,-200)}static int208(e){return Ts(e,-208)}static int216(e){return Ts(e,-216)}static int224(e){return Ts(e,-224)}static int232(e){return Ts(e,-232)}static int240(e){return Ts(e,-240)}static int248(e){return Ts(e,-248)}static int256(e){return Ts(e,-256)}static int(e){return Ts(e,-256)}static bytes1(e){return xa(e,1)}static bytes2(e){return xa(e,2)}static bytes3(e){return xa(e,3)}static bytes4(e){return xa(e,4)}static bytes5(e){return xa(e,5)}static bytes6(e){return xa(e,6)}static bytes7(e){return xa(e,7)}static bytes8(e){return xa(e,8)}static bytes9(e){return xa(e,9)}static bytes10(e){return xa(e,10)}static bytes11(e){return xa(e,11)}static bytes12(e){return xa(e,12)}static bytes13(e){return xa(e,13)}static bytes14(e){return xa(e,14)}static bytes15(e){return xa(e,15)}static bytes16(e){return xa(e,16)}static bytes17(e){return xa(e,17)}static bytes18(e){return xa(e,18)}static bytes19(e){return xa(e,19)}static bytes20(e){return xa(e,20)}static bytes21(e){return xa(e,21)}static bytes22(e){return xa(e,22)}static bytes23(e){return xa(e,23)}static bytes24(e){return xa(e,24)}static bytes25(e){return xa(e,25)}static bytes26(e){return xa(e,26)}static bytes27(e){return xa(e,27)}static bytes28(e){return xa(e,28)}static bytes29(e){return xa(e,29)}static bytes30(e){return xa(e,30)}static bytes31(e){return xa(e,31)}static bytes32(e){return xa(e,32)}static address(e){return new bg(xg,"address",e)}static bool(e){return new bg(xg,"bool",!!e)}static bytes(e){return new bg(xg,"bytes",e)}static string(e){return new bg(xg,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new bg(xg,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===oge}static dereference(e,n){if(bg.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};Kw=new WeakMap;let Uu=bg;class a6t extends R1{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Uu.dereference(n,"string");try{r=aa(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return aa(b1(e.readValue(),20))}}class o6t extends R1{constructor(n){super(n.name,n.type,"_",n.dynamic);$n(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function cFe(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let c={};r=e.map(u=>{const d=u.localName;return Dr(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),Dr(!c[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),c[d]=!0,n[d]})}else vn(!1,"invalid tuple value","tuple",n);vn(e.length===r.length,"types/value length mismatch","tuple",n);let s=new Vee,a=new Vee,o=[];e.forEach((c,u)=>{let d=r[u];if(c.dynamic){let f=a.length;c.encode(a,d);let x=s.writeUpdatableValue();o.push(g=>{x(g+f)})}else c.encode(s,d)}),o.forEach(c=>{c(s.length)});let l=t.appendWriter(s);return l+=t.appendWriter(a),l}function uFe(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach(a=>{let o=null;if(a.dynamic){let l=t.readIndex(),c=s.subReader(l);try{o=a.decode(c)}catch(u){if(ru(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=a.name,o.name=a.localName,o.type=a.type}}else try{o=a.decode(t)}catch(l){if(ru(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=a.name,o.name=a.localName,o.type=a.type}if(o==null)throw new Error("investigate");n.push(o),r.push(a.localName||null)}),pR.fromItems(n,r)}class l6t extends R1{constructor(n,r,s){const a=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",a,s,o);$n(this,"coder");$n(this,"length");$s(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Uu.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let a=this.length;a===-1&&(a=s.length,n.writeValue(s.length)),YPe(s.length,a,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let l=0;l<s.length;l++)o.push(this.coder);return cFe(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),Dr(r*fd<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*fd,length:n.dataLength}));let s=[];for(let a=0;a<r;a++)s.push(new o6t(this.coder));return uFe(n,s)}}class c6t extends R1{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Uu.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class dFe extends R1{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=su(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class u6t extends dFe{constructor(e){super("bytes",e)}decode(e){return Kr(super.decode(e))}}class d6t extends R1{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);$n(this,"size");$s(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=su(Uu.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return Kr(n.readBytes(this.size))}}const f6t=new Uint8Array([]);class h6t extends R1{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(f6t)}decode(e){return e.readBytes(0),null}}const p6t=BigInt(0),m6t=BigInt(1),x6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class g6t extends R1{constructor(n,r,s){const a=(r?"int":"uint")+n*8;super(a,a,s,!1);$n(this,"size");$n(this,"signed");$s(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=Es(Uu.dereference(r,this.type)),a=V7(x6t,fd*8);if(this.signed){let o=V7(a,this.size*8-1);(s>o||s<-(o+m6t))&&this._throwError("value out-of-bounds",r),s=JPe(s,8*fd)}else(s<p6t||s>V7(a,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=V7(n.readValue(),this.size*8);return this.signed&&(r=Ywt(r,this.size*8)),r}}class b6t extends dFe{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,gd(Uu.dereference(n,"string")))}decode(e){return hR(super.decode(e))}}class UI extends R1{constructor(n,r){let s=!1;const a=[];n.forEach(l=>{l.dynamic&&(s=!0),a.push(l.type)});const o="tuple("+a.join(",")+")";super("tuple",o,r,s);$n(this,"coders");$s(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,a)=>{const o=a.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,a)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[a]))}),Object.freeze(n)}encode(n,r){const s=Uu.dereference(r,"tuple");return cFe(n,this.coders,s)}decode(n){return uFe(n,this.coders)}}function HV(t,e){return{address:aa(t),storageKeys:e.map((n,r)=>(vn(po(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function k5(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?(vn(n.length===2,"invalid slot set",`value[${r}]`,n),HV(n[0],n[1])):(vn(n!=null&&typeof n=="object","invalid address-slot set","value",t),HV(n.address,n.storageKeys)));vn(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((s,a)=>(s[a]=!0,s),{});return HV(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function fFe(t){return{address:aa(t.address),nonce:Es(t.nonce!=null?t.nonce:0),chainId:Es(t.chainId!=null?t.chainId:0),signature:ou.from(t.signature)}}function ET(t){let e;return typeof t=="string"?e=G0.computePublicKey(t,!1):e=t.publicKey,aa(ho("0x"+e.substring(4)).substring(26))}function y6t(t,e){return ET(G0.recoverPublicKey(t,e))}const kc=BigInt(0),v6t=BigInt(2),w6t=BigInt(27),C6t=BigInt(28),S6t=BigInt(35),N6t=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),VV=4096*32;function A6t(t){return{blobToKzgCommitment:r=>{if("computeBlobProof"in t){if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return ms(t.blobToKzgCommitment(Kr(r)))}else if("blobToKzgCommitment"in t&&typeof t.blobToKzgCommitment=="function")return ms(t.blobToKzgCommitment(r));if("blobToKZGCommitment"in t&&typeof t.blobToKZGCommitment=="function")return ms(t.blobToKZGCommitment(Kr(r)));vn(!1,"unsupported KZG library","kzg",t)},computeBlobKzgProof:(r,s)=>{if("computeBlobProof"in t&&typeof t.computeBlobProof=="function")return ms(t.computeBlobProof(Kr(r),Kr(s)));if("computeBlobKzgProof"in t&&typeof t.computeBlobKzgProof=="function")return t.computeBlobKzgProof(r,s);if("computeBlobKZGProof"in t&&typeof t.computeBlobKZGProof=="function")return ms(t.computeBlobKZGProof(Kr(r),Kr(s)));vn(!1,"unsupported KZG library","kzg",t)}}}function lge(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=xp(e).substring(4),"0x"+n}function cj(t){return t==="0x"?null:aa(t)}function D$(t,e){try{return k5(t)}catch(n){vn(!1,n.message,e,t)}}function j6t(t,e){try{if(!Array.isArray(t))throw new Error("authorizationList: invalid array");const n=[];for(let r=0;r<t.length;r++){const s=t[r];if(!Array.isArray(s))throw new Error(`authorization[${r}]: invalid array`);if(s.length!==6)throw new Error(`authorization[${r}]: wrong length`);if(!s[1])throw new Error(`authorization[${r}]: null address`);n.push({address:cj(s[1]),nonce:Wa(s[2],"nonce"),chainId:Wa(s[0],"chainId"),signature:ou.from({yParity:T5(s[3],"yParity"),r:g1(s[4],32),s:g1(s[5],32)})})}return n}catch(n){vn(!1,n.message,e,t)}}function T5(t,e){return t==="0x"?0:$i(t,e)}function Wa(t,e){if(t==="0x")return kc;const n=Es(t,e);return vn(n<=N6t,"value exceeds uint size",e,n),n}function ra(t,e){const n=Es(t,"value"),r=ul(n);return vn(r.length<=32,"value too large",`tx.${e}`,n),r}function B$(t){return k5(t).map(e=>[e.address,e.storageKeys])}function E6t(t){return t.map(e=>[ra(e.chainId,"chainId"),e.address,ra(e.nonce,"nonce"),ra(e.signature.yParity,"yParity"),ul(e.signature.r),ul(e.signature.s)])}function _6t(t,e){vn(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)vn(po(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function k6t(t){const e=AT(t);vn(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:T5(e[0],"nonce"),gasPrice:Wa(e[1],"gasPrice"),gasLimit:Wa(e[2],"gasLimit"),to:cj(e[3]),value:Wa(e[4],"value"),data:Kr(e[5]),chainId:kc};if(e.length===6)return n;const r=Wa(e[6],"v"),s=Wa(e[7],"r"),a=Wa(e[8],"s");if(s===kc&&a===kc)n.chainId=r;else{let o=(r-S6t)/v6t;o<kc&&(o=kc),n.chainId=o,vn(o!==kc||r===w6t||r===C6t,"non-canonical legacy v","v",e[6]),n.signature=ou.from({r:g1(e[7],32),s:g1(e[8],32),v:r})}return n}function T6t(t,e){const n=[ra(t.nonce,"nonce"),ra(t.gasPrice||0,"gasPrice"),ra(t.gasLimit,"gasLimit"),t.to||"0x",ra(t.value,"value"),t.data];let r=kc;if(t.chainId!=kc)r=Es(t.chainId,"tx.chainId"),vn(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const a=t.signature.legacyChainId;a!=null&&(r=a)}if(!e)return r!==kc&&(n.push(ul(r)),n.push("0x"),n.push("0x")),y1(n);let s=BigInt(27+e.yParity);return r!==kc?s=ou.getChainIdV(r,e.v):BigInt(e.v)!==s&&vn(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(ul(s)),n.push(ul(e.r)),n.push(ul(e.s)),y1(n)}function $$(t,e){let n;try{if(n=T5(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{vn(!1,"invalid yParity","yParity",e[0])}const r=g1(e[1],32),s=g1(e[2],32),a=ou.from({r,s,yParity:n});t.signature=a}function P6t(t){const e=AT(ms(t).slice(1));vn(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Kr(t));const n={type:2,chainId:Wa(e[0],"chainId"),nonce:T5(e[1],"nonce"),maxPriorityFeePerGas:Wa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wa(e[4],"gasLimit"),to:cj(e[5]),value:Wa(e[6],"value"),data:Kr(e[7]),accessList:D$(e[8],"accessList")};return e.length===9||$$(n,e.slice(9)),n}function I6t(t,e){const n=[ra(t.chainId,"chainId"),ra(t.nonce,"nonce"),ra(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ra(t.maxFeePerGas||0,"maxFeePerGas"),ra(t.gasLimit,"gasLimit"),t.to||"0x",ra(t.value,"value"),t.data,B$(t.accessList||[])];return e&&(n.push(ra(e.yParity,"yParity")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x02",y1(n)])}function F6t(t){const e=AT(ms(t).slice(1));vn(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Kr(t));const n={type:1,chainId:Wa(e[0],"chainId"),nonce:T5(e[1],"nonce"),gasPrice:Wa(e[2],"gasPrice"),gasLimit:Wa(e[3],"gasLimit"),to:cj(e[4]),value:Wa(e[5],"value"),data:Kr(e[6]),accessList:D$(e[7],"accessList")};return e.length===8||$$(n,e.slice(8)),n}function O6t(t,e){const n=[ra(t.chainId,"chainId"),ra(t.nonce,"nonce"),ra(t.gasPrice||0,"gasPrice"),ra(t.gasLimit,"gasLimit"),t.to||"0x",ra(t.value,"value"),t.data,B$(t.accessList||[])];return e&&(n.push(ra(e.yParity,"recoveryParam")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x01",y1(n)])}function M6t(t){let e=AT(ms(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const a=e[1],o=e[2],l=e[3];vn(Array.isArray(a),"invalid network format: blobs not an array","fields[1]",a),vn(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),vn(Array.isArray(l),"invalid network format: proofs not an array","fields[3]",l),vn(a.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),vn(a.length===l.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let c=0;c<e[1].length;c++)r.push({data:a[c],commitment:o[c],proof:l[c]});e=e[0]}vn(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",Kr(t));const s={type:3,chainId:Wa(e[0],"chainId"),nonce:T5(e[1],"nonce"),maxPriorityFeePerGas:Wa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wa(e[4],"gasLimit"),to:cj(e[5]),value:Wa(e[6],"value"),data:Kr(e[7]),accessList:D$(e[8],"accessList"),maxFeePerBlobGas:Wa(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),vn(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),vn(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let a=0;a<s.blobVersionedHashes.length;a++)vn(po(s.blobVersionedHashes[a],32),`invalid blobVersionedHash at index ${a}: must be length 32`,"data",t);return e.length===11||$$(s,e.slice(11)),s}function R6t(t,e,n){const r=[ra(t.chainId,"chainId"),ra(t.nonce,"nonce"),ra(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ra(t.maxFeePerGas||0,"maxFeePerGas"),ra(t.gasLimit,"gasLimit"),t.to||qE,ra(t.value,"value"),t.data,B$(t.accessList||[]),ra(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),_6t(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(ra(e.yParity,"yParity")),r.push(ul(e.r)),r.push(ul(e.s)),n)?Da(["0x03",y1([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):Da(["0x03",y1(r)])}function L6t(t){const e=AT(ms(t).slice(1));vn(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",Kr(t));const n={type:4,chainId:Wa(e[0],"chainId"),nonce:T5(e[1],"nonce"),maxPriorityFeePerGas:Wa(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wa(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wa(e[4],"gasLimit"),to:cj(e[5]),value:Wa(e[6],"value"),data:Kr(e[7]),accessList:D$(e[8],"accessList"),authorizationList:j6t(e[9],"authorizationList")};return e.length===10||$$(n,e.slice(10)),n}function D6t(t,e){const n=[ra(t.chainId,"chainId"),ra(t.nonce,"nonce"),ra(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ra(t.maxFeePerGas||0,"maxFeePerGas"),ra(t.gasLimit,"gasLimit"),t.to||"0x",ra(t.value,"value"),t.data,B$(t.accessList||[]),E6t(t.authorizationList||[])];return e&&(n.push(ra(e.yParity,"yParity")),n.push(ul(e.r)),n.push(ul(e.s))),Da(["0x04",y1(n)])}var em,hS,pS,mS,xS,gS,bS,yS,vS,wS,CS,SS,Yw,cy,y0,uy,NS,AS,WO,qf;let Goe=(qf=class{constructor(){Rn(this,AS);Rn(this,em);Rn(this,hS);Rn(this,pS);Rn(this,mS);Rn(this,xS);Rn(this,gS);Rn(this,bS);Rn(this,yS);Rn(this,vS);Rn(this,wS);Rn(this,CS);Rn(this,SS);Rn(this,Yw);Rn(this,cy);Rn(this,y0);Rn(this,uy);Rn(this,NS);Ut(this,em,null),Ut(this,hS,null),Ut(this,mS,0),Ut(this,xS,kc),Ut(this,gS,null),Ut(this,bS,null),Ut(this,yS,null),Ut(this,pS,"0x"),Ut(this,vS,kc),Ut(this,wS,kc),Ut(this,CS,null),Ut(this,SS,null),Ut(this,Yw,null),Ut(this,cy,null),Ut(this,y0,null),Ut(this,uy,null),Ut(this,NS,null)}get type(){return He(this,em)}set type(e){switch(e){case null:Ut(this,em,null);break;case 0:case"legacy":Ut(this,em,0);break;case 1:case"berlin":case"eip-2930":Ut(this,em,1);break;case 2:case"london":case"eip-1559":Ut(this,em,2);break;case 3:case"cancun":case"eip-4844":Ut(this,em,3);break;case 4:case"pectra":case"eip-7702":Ut(this,em,4);break;default:vn(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=He(this,hS);return e==null&&this.type===3?qE:e}set to(e){Ut(this,hS,e==null?null:aa(e))}get nonce(){return He(this,mS)}set nonce(e){Ut(this,mS,$i(e,"value"))}get gasLimit(){return He(this,xS)}set gasLimit(e){Ut(this,xS,Es(e))}get gasPrice(){const e=He(this,gS);return e==null&&(this.type===0||this.type===1)?kc:e}set gasPrice(e){Ut(this,gS,e==null?null:Es(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=He(this,bS);return e??(this.type===2||this.type===3?kc:null)}set maxPriorityFeePerGas(e){Ut(this,bS,e==null?null:Es(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=He(this,yS);return e??(this.type===2||this.type===3?kc:null)}set maxFeePerGas(e){Ut(this,yS,e==null?null:Es(e,"maxFeePerGas"))}get data(){return He(this,pS)}set data(e){Ut(this,pS,Kr(e))}get value(){return He(this,vS)}set value(e){Ut(this,vS,Es(e,"value"))}get chainId(){return He(this,wS)}set chainId(e){Ut(this,wS,Es(e))}get signature(){return He(this,CS)||null}set signature(e){Ut(this,CS,e==null?null:ou.from(e))}get accessList(){const e=He(this,SS)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){Ut(this,SS,e==null?null:k5(e))}get authorizationList(){const e=He(this,NS)||null;return e==null&&this.type===4?[]:e}set authorizationList(e){Ut(this,NS,e==null?null:e.map(n=>fFe(n)))}get maxFeePerBlobGas(){const e=He(this,Yw);return e==null&&this.type===3?kc:e}set maxFeePerBlobGas(e){Ut(this,Yw,e==null?null:Es(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=He(this,cy);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){vn(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)vn(po(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}Ut(this,cy,e)}get blobs(){return He(this,uy)==null?null:He(this,uy).map(e=>Object.assign({},e))}set blobs(e){if(e==null){Ut(this,uy,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const a=e[s];if(T$(a)){Dr(He(this,y0),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ms(a);if(vn(o.length<=VV,"blob is too large",`blobs[${s}]`,a),o.length!==VV){const u=new Uint8Array(VV);u.set(o),o=u}const l=He(this,y0).blobToKzgCommitment(o),c=Kr(He(this,y0).computeBlobKzgProof(o,l));n.push({data:Kr(o),commitment:Kr(l),proof:c}),r.push(lge(1,l))}else{const o=Kr(a.commitment);n.push({data:Kr(a.data),commitment:o,proof:Kr(a.proof)}),r.push(lge(1,o))}}Ut(this,uy,n),Ut(this,cy,r)}get kzg(){return He(this,y0)}set kzg(e){e==null?Ut(this,y0,null):Ut(this,y0,A6t(e))}get hash(){return this.signature==null?null:ho(Cr(this,AS,WO).call(this,!0,!1))}get unsignedHash(){return ho(this.unsignedSerialized)}get from(){return this.signature==null?null:y6t(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:G0.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return Cr(this,AS,WO).call(this,!0,!0)}get unsignedSerialized(){return Cr(this,AS,WO).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=He(this,Yw)!=null||He(this,cy);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Dr(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Dr(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Dr(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const a=[];return this.type!=null?a.push(this.type):this.authorizationList&&this.authorizationList.length?a.push(4):n?a.push(2):e?(a.push(1),r||a.push(0)):r?(a.push(1),a.push(2)):(s&&this.to||(a.push(0),a.push(1),a.push(2)),a.push(3)),a.sort(),a}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return qf.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new qf;if(typeof e=="string"){const r=ms(e);if(r[0]>=127)return qf.from(k6t(r));switch(r[0]){case 1:return qf.from(F6t(r));case 2:return qf.from(P6t(r));case 3:return qf.from(M6t(r));case 4:return qf.from(L6t(r))}Dr(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new qf;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=ou.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.authorizationList!=null&&(n.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&(vn(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),vn(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(vn(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),vn(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}},em=new WeakMap,hS=new WeakMap,pS=new WeakMap,mS=new WeakMap,xS=new WeakMap,gS=new WeakMap,bS=new WeakMap,yS=new WeakMap,vS=new WeakMap,wS=new WeakMap,CS=new WeakMap,SS=new WeakMap,Yw=new WeakMap,cy=new WeakMap,y0=new WeakMap,uy=new WeakMap,NS=new WeakMap,AS=new WeakSet,WO=function(e,n){Dr(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return T6t(this,r);case 1:return O6t(this,r);case 2:return I6t(this,r);case 3:return R6t(this,r,n?this.blobs:null);case 4:return D6t(this,r)}Dr(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})},qf);function B6t(t){return vn(typeof t.address=="string","invalid address for hashAuthorization","auth.address",t),ho(Da(["0x05",y1([t.chainId!=null?ul(t.chainId):"0x",aa(t.address),t.nonce!=null?ul(t.nonce):"0x"])]))}function v1(t){return ho(gd(t))}var $6t="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const cge=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),uge=4;function U6t(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],P=0,T=x;for(;;){let F=Math.floor(((C-P+1)*s-1)/T),$=0,L=r;for(;L-$>1;){let ne=$+L>>>1;F<a[ne]?L=ne:$=ne}if($==0)break;N.push($);let z=P+Math.floor(T*a[$]/s),X=P+Math.floor(T*a[$+1]/s)-1;for(;!((z^X)&g);)C=C<<1&v|d(),z=z<<1&v,X=X<<1&v|1;for(;z&~X&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,X=(X^g)<<1|g|1;P=z,T=1+X-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function z6t(t){let e=0;return()=>t[e++]}function hFe(t){return z6t(U6t(H6t(t)))}function H6t(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,a)=>e[s.charCodeAt(0)]=a);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,a=0,o=0,l=0;s<n;s++)l=l<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[a++]=l>>(o-=8));return r}function V6t(t){return t&1?~t>>1:t>>1}function W6t(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=V6t(e());return n}function GE(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let a=0;a<s;a++)n.push(e+a);e+=s+1}return n}function pFe(t){return KE(()=>{let e=GE(t);if(e.length)return e})}function mFe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(q6t(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(G6t(n,t))}return e.flat()}function KE(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function xFe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)W6t(t,n).forEach((a,o)=>r[o].push(a));return r}function q6t(t,e){let n=1+e(),r=e(),s=KE(e);return xFe(s.length,1+t,e).flatMap((o,l)=>{let[c,...u]=o;return Array(s[l]).fill().map((d,f)=>{let x=f*r;return[c+f*n,u.map(g=>g+x)]})})}function G6t(t,e){let n=1+e();return xFe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function K6t(t){let e=[],n=GE(t);return s(r([]),[]),e;function r(a){let o=t(),l=KE(()=>{let c=GE(t).map(u=>n[u]);if(c.length)return r(c)});return{S:o,B:l,Q:a}}function s({S:a,B:o},l,c){if(!(a&4&&c===l[l.length-1])){a&2&&(c=l[l.length-1]),a&1&&e.push(l);for(let u of o)for(let d of u.Q)s(u,[...l,d],c)}}}function Y6t(t){return t.toString(16).toUpperCase().padStart(2,"0")}function gFe(t){return`{${Y6t(t)}}`}function X6t(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function dN(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function Q6t(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var Z6t="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwWjFcHE9fBgMLJSPHFKhQIA0lQLd4SBobBxUlqQKRQ3BKh1E2HpMh9jw9DWYuE1F8B/U8BRlPC4E8nkarRQ4R0j6NPUgiSUwsBDV/LC8niwnPD4UMuXxyAVkJIQmxDHETMREXN8UIOQcZLZckJxUIIUaVYJoE958D8xPRAwsFPwlBBxMDtRwtEy4VKQUNgSTXAvM21S6zAo9WgAEXBcsPJR/fEFBH4A7pCJsCZQODJesALRUhABcimwhDYwBfj9hTBS7LCMdqbCN0A2cU52ERcweRDlcHpxwzFb8c4XDIXguGCCijrwlbAXUJmQFfBOMICTVbjKAgQWdTi1gYmyBhQT9d/AIxDGUVn0S9h3gCiw9rEhsBNQFzBzkNAQJ3Ee0RaxCVCOuGBDW1M/g6JQRPIYMgEQonA09szgsnJvkM+GkBoxJiAww0PXfuZ6tgtiQX/QcZMsVBYCHxC5JPzQycGsEYQlQuGeQHvwPzGvMn6kFXBf8DowMTOk0z7gS9C2kIiwk/AEkOoxcH1xhqCnGM0AExiwG3mQNXkYMCb48GNwcLAGcLhwV55QAdAqcIowAFAM8DVwA5Aq0HnQAZAIVBAT0DJy8BIeUCjwOTCDHLAZUvAfMpBBvDDBUA9zduSgLDsQKAamaiBd1YAo4CSTUBTSUEBU5HUQOvceEA2wBLBhPfRwEVq0rLGuNDAd9vKwDHAPsABTUHBUEBzQHzbQC3AV8LMQmis7UBTekpAIMAFWsB1wKJAN0ANQB/8QFTAE0FWfkF0wJPSQERMRgrV2EBuwMfATMBDQB5BsuNpckHHwRtB9MCEBsV4QLvLge1AQMi3xPNQsUCvd5VoWACZIECYkJbTa9bNyACofcCaJgCZgkCn4Q4GwsCZjsCZiYEbgR/A38TA36SOQY5dxc5gjojIwJsHQIyNjgKAm3HAm2u74ozZ0UrAWcA3gDhAEoFB5gMjQD+C8IADbUCdy8CdqI/AnlLQwJ4uh1c20WuRtcCfD8CesgCfQkCfPAFWQUgSABIfWMkAoFtAoAAAoAFAn+uSVhKWxUXSswC0QEC0MxLJwOITwOH5kTFkTIC8qFdAwMDrkvOTC0lA89NTE2vAos/AorYwRsHHUNnBbcCjjcCjlxAl4ECjtkCjlx4UbRTNQpS1FSFApP7ApMMAOkAHFUeVa9V0AYsGymVhjLheGZFOzkCl58C77JYIagAWSUClo8ClnycAKlZrFoJgU0AOwKWtQKWTlxEXNECmcsCmWRcyl0HGQKcmznCOp0CnBYCn5sCnriKAB0PMSoPAp3xAp6SALU9YTRh7wKe0wKgbgGpAp6fHwKeTqVjyGQnJSsCJ68CJn4CoPsCoEwCot0CocQCpi8Cpc4Cp/8AfQKn8mh8aLEAA0lqHGrRAqzjAqyuAq1nAq0CAlcdAlXcArHh1wMfTmyXArK9DQKy6Bds4G1jbUhfAyXNArZcOz9ukAMpRQK4XgK5RxUCuSp3cDZw4QK9GQK72nCWAzIRAr6IcgIDM3ECvhpzInNPAsPLAsMEc4J0SzVFdOADPKcDPJoDPb8CxXwCxkcCxhCJAshpUQLIRALJTwLJLgJknQLd0nh5YXiueSVL0AMYo2cCAmH0GfOVJHsLXpJeuxECz2sCz2wvS1PS8xOfAMatAs9zASnqA04SfksFAtwnAtuKAtJPA1JcA1NfAQEDVYyAiT8AyxbtYEWCHILTgs6DjQLaxwLZ3oQQhEmnPAOGpQAvA2QOhnFZ+QBVAt9lAt64c3cC4i/tFAHzMCcB9JsB8tKHAuvzAulweQLq+QLq5AD5RwG5Au6JAuuclqqXAwLuPwOF4Jh5cOBxoQLzAwBpA44WmZMC9xMDkW4DkocC95gC+dkC+GaaHJqruzebHgOdgwL++gEbADmfHJ+zAwWNA6ZqA6bZANHFAwZqoYiiBQkDDEkCwAA/AwDhQRdTARHzA2sHl2cFAJMtK7evvdsBiZkUfxEEOQH7KQUhDp0JnwCS/SlXxQL3AZ0AtwW5AG8LbUEuFCaNLgFDAYD8AbUmAHUDDgRtACwCFgyhAAAKAj0CagPdA34EkQEgRQUhfAoABQBEABMANhICdwEABdUDa+8KxQIA9wqfJ7+xt+UBkSFBQgHpFH8RNMCJAAQAGwBaAkUChIsABjpTOpSNbQC4Oo860ACNOME63AClAOgAywE6gTo7Ofw5+Tt2iTpbO56JOm85GAFWATMBbAUvNV01njWtNWY1dTW2NcU1gjWRNdI14TWeNa017jX9NbI1wTYCNhE1xjXVNhY2JzXeNe02LjY9Ni41LSE2OjY9Njw2yTcIBJA8VzY4Nt03IDcPNsogN4k3MAoEsDxnNiQ3GTdsOo03IULUQwdC4EMLHA8PCZsobShRVQYA6X8A6bABFCnXAukBowC9BbcAbwNzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgBFLWZAu0BhQCjBcEAbykBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUABavAj626xQAJP0A3etzuf4NNRA7efy2Z9NQrCnC0OSyANz5BBIbJ5IFDR6miIavYS6tprjjmuKebxm5C74Q225X1pkaYYPb6f1DK4k3xMEBb9S2WMjEibTNWhsRJIA+vwNVEiXTE5iXs/wezV66oFLfp9NZGYW+Gk19J2+bCT6Ye2w6LDYdgzKMUabk595eLBCXANz9HUpWbATq9vqXVx9XDg+Pc9Xp4+bsS005SVM/BJBM4687WUuf+Uj9dEi8aDNaPxtpbDxcG1THTImUMZq4UCaaNYpsVqraNyKLJXDYsFZ/5jl7bLRtO88t7P3xZaAxhb5OdPMXqsSkp1WCieG8jXm1U99+blvLlXzPCS+M93VnJCiK+09LfaSaBAVBomyDgJua8dfUzR7ga34IvR2Nvj+A9heJ6lsl1KG4NkI1032Cnff1m1wof2B9oHJK4bi6JkEdSqeNeiuo6QoZZincoc73/TH9SXF8sCE7XyuYyW8WSgbGFCjPV0ihLKhdPs08Tx82fYAkLLc4I2wdl4apY7GU5lHRFzRWJep7Ww3wbeA3qmd59/86P4xuNaqDpygXt6M85glSBHOCGgJDnt+pN9bK7HApMguX6+06RZNjzVmcZJ+wcUrJ9//bpRNxNuKpNl9uFds+S9tdx7LaM5ZkIrPj6nIU9mnbFtVbs9s/uLgl8MVczAwet+iOEzzBlYW7RCMgE6gyNLeq6+1tIx4dpgZnd0DksJS5f+JNDpwwcPNXaaVspq1fbQajOrJgK0ofKtJ1Ne90L6VO4MOl5S886p7u6xo7OLjG8TGL+HU1JXGJgppg4nNbNJ5nlzSpuPYy21JUEcUA94PoFiZfjZue+QnyQ80ekOuZVkxx4g+cvhJfHgNl4hy1/a6+RKcKlar/J29y//EztlbVPHVUeQ1zX86eQVAjR/M3dA9w4W8LfaXp4EgM85wOWasli837PzVMOnsLzR+k3o75/lRPAJSE1xAKQzEi5v10ke+VBvRt1cwQRMd+U5mLCTGVd6XiZtgBG5cDi0w22GKcVNvHiu5LQbZEDVtz0onn7k5+heuKXVsZtSzilkLRAUmjMXEMB3J9YC50XBxPiz53SC+EhnPl9WsKCv92SM/OFFIMJZYfl0WW8tIO3UxYcwdMAj7FSmgrsZ2aAZO03BOhP1bNNZItyXYQFTpC3SG1VuPDqH9GkiCDmE+JwxyIVSO5siDErAOpEXFgjy6PQtOVDj+s6e1r8heWVvmZnTciuf4EiNZzCAd7SOMhXERIOlsHIMG399i9aLTy3m2hRLZjJVDNLS53iGIK11dPqQt0zBDyg6qc7YqkDm2M5Ve6dCWCaCbTXX2rToaIgz6+zh4lYUi/+6nqcFMAkQJKHYLK0wYk5N9szV6xihDbDDFr45lN1K4aCXBq/FitPSud9gLt5ZVn+ZqGX7cwm2z5EGMgfFpIFyhGGuDPmso6TItTMwny+7uPnLCf4W6goFQFV0oQSsc9VfMmVLcLr6ZetDZbaSFTLqnSO/bIPjA3/zAUoqgGFAEQS4IhuMzEp2I3jJzbzkk/IEmyax+rhZTwd6f+CGtwPixu8IvzACquPWPREu9ZvGkUzpRwvRRuaNN6cr0W1wWits9ICdYJ7ltbgMiSL3sTPeufgNcVqMVWFkCPDH4jG2jA0XcVgQj62Cb29v9f/z/+2KbYvIv/zzjpQAPkliaVDzNrW57TZ/ZOyZD0nlfMmAIBIAGAI0D3k/mdN4xr9v85ZbZbbqfH2jGd5hUqNZWwl5SPfoGmfElmazUIeNL1j/mkF7VNAzTq4jNt8JoQ11NQOcmhprXoxSxfRGJ9LDEOAQ+dmxAQH90iti9e2u/MoeuaGcDTHoC+xsmEeWmxEKefQuIzHbpw5Tc5cEocboAD09oipWQhtTO1wivf/O+DRe2rpl/E9wlrzBorjJsOeG1B/XPW4EaJEFdNlECEZga5ZoGRHXgYouGRuVkm8tDESiEyFNo+3s5M5puSdTyUL2llnINVHEt91XUNW4ewdMgJ4boJfEyt/iY5WXqbA+A2Fkt5Z0lutiWhe9nZIyIUjyXDC3UsaG1t+eNx6z4W/OYoTB7A6x+dNSTOi9AInctbESqm5gvOLww7OWXPrmHwVZasrl4eD113pm+JtT7JVOvnCXqdzzdTRHgJ0PiGTFYW5Gvt9R9LD6Lzfs0v/TZZHSmyVNq7viIHE6DBK7Qp07Iz55EM8SYtQvZf/obBniTWi5C2/ovHfw4VndkE5XYdjOhCMRjDeOEfXeN/CwfGduiUIfsoFeUxXeQXba7c7972XNv8w+dTjjUM0QeNAReW+J014dKAD/McQYXT7c0GQPIkn3Ll6R7gGjuiQoZD0TEeEqQpKoZ15g/0OPQI17QiSv9AUROa/V/TQN3dvLArec3RrsYlvBm1b8LWzltdugsC50lNKYLEp2a+ZZYqPejULRlOJh5zj/LVMyTDvwKhMxxwuDkxJ1QpoNI0OTWLom4Z71SNzI9TV1iXJrIu9Wcnd+MCaAw8o1jSXd94YU/1gnkrC9BUEOtQvEIQ7g0i6h+KL2JKk8Ydl7HruvgWMSAmNe+LshGhV4qnWHhO9/RIPQzY1tHRj2VqOyNsDpK0cww+56AdDC4gsWwY0XxoucIWIqs/GcwnWqlaT0KPr8mbK5U94/301i1WLt4YINTVvCFBrFZbIbY8eycOdeJ2teD5IfPLCRg7jjcFTwlMFNl9zdh/o3E/hHPwj7BWg0MU09pPrBLbrCgm54A6H+I6v27+jL5gkjWg/iYdks9jbfVP5y/n0dlgWEMlKasl7JvFZd56LfybW1eeaVO0gxTfXZwD8G4SI116yx7UKVRgui6Ya1YpixqXeNLc8IxtAwCU5IhwQgn+NqHnRaDv61CxKhOq4pOX7M6pkA+Pmpd4j1vn6ACUALoLLc4vpXci8VidLxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const YE=44032,mR=4352,xR=4449,gR=4519,bFe=19,yFe=21,fN=28,bR=yFe*fN,J6t=bFe*bR,eCt=YE+J6t,tCt=mR+bFe,nCt=xR+yFe,rCt=gR+fN;function q7(t){return t>>24&255}function vFe(t){return t&16777215}let Zee,dge,Jee,qO;function sCt(){let t=hFe(Z6t);Zee=new Map(pFe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),dge=new Set(GE(t)),Jee=new Map,qO=new Map;for(let[e,n]of mFe(t)){if(!dge.has(e)&&n.length==2){let[r,s]=n,a=qO.get(r);a||(a=new Map,qO.set(r,a)),a.set(s,e)}Jee.set(e,n.reverse())}}function wFe(t){return t>=YE&&t<eCt}function iCt(t,e){if(t>=mR&&t<tCt&&e>=xR&&e<nCt)return YE+(t-mR)*bR+(e-xR)*fN;if(wFe(t)&&e>gR&&e<rCt&&(t-YE)%fN==0)return t+(e-gR);{let n=qO.get(t);return n&&(n=n.get(e),n)?n:-1}}function CFe(t){Zee||sCt();let e=[],n=[],r=!1;function s(a){let o=Zee.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(wFe(a)){let o=a-YE,l=o/bR|0,c=o%bR/fN|0,u=o%fN;s(mR+l),s(xR+c),u>0&&s(gR+u)}else{let o=Jee.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=q7(e[0]);for(let o=1;o<e.length;o++){let l=q7(e[o]);if(l==0||a<=l){a=l;continue}let c=o-1;for(;;){let u=e[c+1];if(e[c+1]=e[c],e[c]=u,!c||(a=q7(e[--c]),a<=l))break}a=q7(e[o])}}return e}function aCt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=q7(a),l=vFe(a);if(r==-1)o==0?r=l:e.push(l);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=l):n.push(l),s=o;else{let c=iCt(r,l);c>=0?r=c:s==0&&o==0?(e.push(r),r=l):(n.push(l),s=o)}}return r>=0&&e.push(r,...n),e}function SFe(t){return CFe(t).map(vFe)}function oCt(t){return aCt(CFe(t))}const fge=45,NFe=".",AFe=65039,jFe=1,yR=t=>Array.from(t);function XE(t,e){return t.P.has(e)||t.Q.has(e)}let lCt=class extends Array{get is_emoji(){return!0}},ete,EFe,hw,tte,_Fe,E4,WV,$C,Hv,hge,nte;function Koe(){if(ete)return;let t=hFe($6t);const e=()=>GE(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));ete=new Map(mFe(t)),EFe=n(),hw=e(),tte=new Set(e().map(d=>hw[d])),hw=new Set(hw),_Fe=n(),n();let s=pFe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};E4=KE(d=>{let f=KE(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=dN(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),WV=n(),$C=new Map;let l=e().concat(yR(WV)).sort((d,f)=>d-f);l.forEach((d,f)=>{let x=t(),g=l[f]=x?l[f-x]:{V:[],M:new Map};g.V.push(d),WV.has(d)||$C.set(d,g)});for(let{V:d,M:f}of new Set($C.values())){let x=[];for(let y of d){let v=E4.filter(N=>XE(N,y)),C=x.find(({G:N})=>v.some(P=>N.has(P)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>yR(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}Hv=new Set;let c=new Set;const u=d=>Hv.has(d)?c.add(d):Hv.add(d);for(let d of E4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Hv)!$C.has(d)&&!c.has(d)&&$C.set(d,jFe);r(Hv,SFe(Hv)),hge=K6t(t).map(d=>lCt.from(d)).sort(Q6t),nte=new Map;for(let d of hge){let f=[nte];for(let x of d){let g=f.map(y=>{let v=y.get(x);return v||(v=new Map,y.set(x,v)),v});x===AFe?f.push(...g):f=g}for(let x of f)x.V=d}}function Yoe(t){return(kFe(t)?"":`${Xoe(U$([t]))} `)+gFe(t)}function Xoe(t){return`"${t}"`}function cCt(t){if(t.length>=4&&t[2]==fge&&t[3]==fge)throw new Error(`invalid label extension: "${dN(t.slice(0,4))}"`)}function uCt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function dCt(t){let e=t[0],n=cge.get(e);if(n)throw C9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=cge.get(e);if(o){if(s==a)throw C9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw C9(`trailing ${n}`)}function U$(t,e=1/0,n=gFe){let r=[];fCt(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,a=t.length;for(let o=0;o<a;o++){let l=t[o];kFe(l)&&(r.push(dN(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(dN(t.slice(s,a))),r.join("")}function fCt(t){return Koe(),hw.has(t)}function kFe(t){return Koe(),_Fe.has(t)}function hCt(t){return gCt(pCt(t,oCt,vCt))}function pCt(t,e,n){if(!t)return[];Koe();let r=0;return t.split(NFe).map(s=>{let a=X6t(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=yCt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(uCt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))cCt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(hw.has(d[0]))throw C9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&hw.has(C[0]))throw C9(`emoji + combining mark: "${dN(l[v-1])} + ${U$([C[0]])}"`)}dCt(d);let g=yR(new Set(x)),[y]=xCt(g);bCt(y,x),mCt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function mCt(t,e){let n,r=[];for(let s of e){let a=$C.get(s);if(a===jFe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):yR(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>XE(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function xCt(t){let e=E4;for(let n of t){let r=e.filter(s=>XE(s,n));if(!r.length)throw E4.some(s=>XE(s,n))?PFe(e[0],n):TFe(n);if(e=r,r.length==1)break}return e}function gCt(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${Xoe(U$(e,63))}: ${s}`)}return dN(r)}).join(NFe)}function TFe(t){return new Error(`disallowed character: ${Yoe(t)}`)}function PFe(t,e){let n=Yoe(e),r=E4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function C9(t){return new Error(`illegal placement: ${t}`)}function bCt(t,e){for(let n of e)if(!XE(t,n))throw PFe(t,n);if(t.M){let n=SFe(e);for(let r=1,s=n.length;r<s;r++)if(tte.has(n[r])){let a=r+1;for(let o;a<s&&tte.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${Yoe(o)}`);if(a-r>uge)throw new Error(`excessive non-spacing marks: ${Xoe(U$(n.slice(r-1,a)))} (${a-r}/${uge})`);r=a}}}function yCt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=wCt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Hv.has(o))s.push(o);else{let l=ete.get(o);if(l)s.push(...l);else if(!EFe.has(o))throw TFe(o)}}}return s.length&&r.push(e(s)),r}function vCt(t){return t.filter(e=>e!=AFe)}function wCt(t,e){let n=nte,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:a}=n;a&&(r=a,t.length=s)}return r}const IFe=new Uint8Array(32);IFe.fill(0);function pge(t){return vn(t.length!==0,"invalid ENS name; empty component","comp",t),t}function FFe(t){const e=gd(CCt(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(pge(e.slice(r,s))),r=s+1);return vn(r<e.length,"invalid ENS name; empty component","name",t),n.push(pge(e.slice(r))),n}function CCt(t){try{if(t.length===0)throw new Error("empty label");return hCt(t)}catch(e){vn(!1,`invalid ENS name (${e.message})`,"name",t)}}function rte(t){vn(typeof t=="string","invalid ENS name; not a string","name",t),vn(t.length,"invalid ENS name (empty label)","name",t);let e=IFe;const n=FFe(t);for(;n.length;)e=ho(Da([e,ho(n.pop())]));return Kr(e)}function SCt(t,e){const n=e;return vn(n<=255,"DNS encoded label cannot exceed 255","length",n),Kr(Da(FFe(t).map(r=>{vn(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function NCt(t){return typeof t=="string"&&(t=gd(t)),ho(Da([gd(J5t),gd(String(t.length)),t]))}const OFe=new Uint8Array(32);OFe.fill(0);const ACt=BigInt(-1),MFe=BigInt(0),RFe=BigInt(1),jCt=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ECt(t){const e=ms(t),n=e.length%32;return n?Da([e,OFe.slice(n)]):Kr(e)}const _Ct=b1(RFe,32),kCt=b1(MFe,32),mge={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},qV=["name","version","chainId","verifyingContract","salt"];function xge(t){return function(e){return vn(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const TCt={name:xge("name"),version:xge("version"),chainId:function(t){const e=Es(t,"domain.chainId");return vn(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):cm(e)},verifyingContract:function(t){try{return aa(t).toLowerCase()}catch{}vn(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ms(t,"domain.salt");return vn(e.length===32,'invalid domain value "salt"',"domain.salt",t),Kr(e)}};function GV(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);vn(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=V7(jCt,n?r-1:r),a=n?(s+RFe)*ACt:MFe;return function(o){const l=Es(o,"value");return vn(l>=a&&l<=s,`value out-of-bounds for ${t}`,"value",l),b1(n?JPe(l,256):l,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return vn(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ms(r);return vn(s.length===n,`invalid length for ${t}`,"value",r),ECt(r)}}}switch(t){case"address":return function(e){return g1(aa(e),32)};case"bool":return function(e){return e?_Ct:kCt};case"bytes":return function(e){return ho(e)};case"string":return function(e){return v1(e)}}return null}function gge(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function zI(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Bk,Tg,jS,dB,LFe;const zh=class zh{constructor(e){Rn(this,dB);$n(this,"primaryType");Rn(this,Bk);Rn(this,Tg);Rn(this,jS);Ut(this,Tg,new Map),Ut(this,jS,new Map);const n=new Map,r=new Map,s=new Map,a={};Object.keys(e).forEach(c=>{a[c]=e[c].map(({name:u,type:d})=>{let{base:f,index:x}=zI(d);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(x||"")}}),n.set(c,new Set),r.set(c,[]),s.set(c,new Set)}),Ut(this,Bk,JSON.stringify(a));for(const c in a){const u=new Set;for(const d of a[c]){vn(!u.has(d.name),`duplicate variable name ${JSON.stringify(d.name)} in ${JSON.stringify(c)}`,"types",e),u.add(d.name);const f=zI(d.type).base;vn(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!GV(f)&&(vn(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(c),n.get(c).add(f))}}const o=Array.from(r.keys()).filter(c=>r.get(c).length===0);vn(o.length!==0,"missing primary type","types",e),vn(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),$s(this,{primaryType:o[0]});function l(c,u){vn(!u.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),u.add(c);for(const d of n.get(c))if(r.has(d)){l(d,u);for(const f of u)s.get(f).add(d)}u.delete(c)}l(this.primaryType,new Set);for(const[c,u]of s){const d=Array.from(u);d.sort(),He(this,Tg).set(c,gge(c,a[c])+d.map(f=>gge(f,a[f])).join(""))}}get types(){return JSON.parse(He(this,Bk))}getEncoder(e){let n=He(this,jS).get(e);return n||(n=Cr(this,dB,LFe).call(this,e),He(this,jS).set(e,n)),n}encodeType(e){const n=He(this,Tg).get(e);return vn(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return ho(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(GV(e))return r(e,n);const s=zI(e).array;if(s)return vn(s.count===-1||s.count===n.length,`array length mismatch; expected length ${s.count}`,"value",n),n.map(o=>this._visit(s.prefix,o,r));const a=this.types[e];if(a)return a.reduce((o,{name:l,type:c})=>(o[l]=this._visit(c,n[l],r),o),{});vn(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new zh(e)}static getPrimaryType(e){return zh.from(e).primaryType}static hashStruct(e,n,r){return zh.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const s=mge[r];vn(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>qV.indexOf(r.name)-qV.indexOf(s.name)),zh.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return Da(["0x1901",zh.hashDomain(e),zh.from(n).hash(r)])}static hash(e,n,r){return ho(zh.encode(e,n,r))}static async resolveNames(e,n,r,s){e=Object.assign({},e);for(const l in e)e[l]==null&&delete e[l];const a={};e.verifyingContract&&!po(e.verifyingContract,20)&&(a[e.verifyingContract]="0x");const o=zh.from(n);o.visit(r,(l,c)=>(l==="address"&&!po(c,20)&&(a[c]="0x"),c));for(const l in a)a[l]=await s(l);return e.verifyingContract&&a[e.verifyingContract]&&(e.verifyingContract=a[e.verifyingContract]),r=o.visit(r,(l,c)=>l==="address"&&a[c]?a[c]:c),{domain:e,value:r}}static getPayload(e,n,r){zh.hashDomain(e);const s={},a=[];qV.forEach(c=>{const u=e[c];u!=null&&(s[c]=TCt[c](u),a.push({name:c,type:mge[c]}))});const o=zh.from(n);n=o.types;const l=Object.assign({},n);return vn(l.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),l.EIP712Domain=a,o.encode(r),{types:l,domain:s,primaryType:o.primaryType,message:o.visit(r,(c,u)=>{if(c.match(/^bytes(\d*)/))return Kr(ms(u));if(c.match(/^u?int/))return Es(u).toString();switch(c){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return vn(typeof u=="string","invalid string","value",u),u}vn(!1,"unsupported type","type",c)})}}};Bk=new WeakMap,Tg=new WeakMap,jS=new WeakMap,dB=new WeakSet,LFe=function(e){{const s=GV(e);if(s)return s}const n=zI(e).array;if(n){const s=n.prefix,a=this.getEncoder(s);return o=>{vn(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let l=o.map(a);return He(this,Tg).has(s)&&(l=l.map(ho)),ho(Da(l))}}const r=this.types[e];if(r){const s=v1(He(this,Tg).get(e));return a=>{const o=r.map(({name:l,type:c})=>{const u=this.getEncoder(c)(a[l]);return He(this,Tg).has(c)?ho(u):u});return o.unshift(s),Da(o)}}vn(!1,`unknown type: ${e}`,"type",e)};let hN=zh;function hd(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const PCt="external public payable override",ICt=hd(PCt.split(" ")),DFe="constant external internal payable private public pure view override",FCt=hd(DFe.split(" ")),BFe="constructor error event fallback function receive struct",$Fe=hd(BFe.split(" ")),UFe="calldata memory storage payable indexed",OCt=hd(UFe.split(" ")),MCt="tuple returns",RCt=[BFe,UFe,MCt,DFe].join(" "),LCt=hd(RCt.split(" ")),DCt={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},BCt=new RegExp("^(\\s*)"),$Ct=new RegExp("^([0-9]+)"),UCt=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),zFe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),HFe=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Yc,tm,$k,ste;const fB=class fB{constructor(e){Rn(this,$k);Rn(this,Yc);Rn(this,tm);Ut(this,Yc,0),Ut(this,tm,e.slice())}get offset(){return He(this,Yc)}get length(){return He(this,tm).length-He(this,Yc)}clone(){return new fB(He(this,tm))}reset(){Ut(this,Yc,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=Cr(this,$k,ste).call(this,He(this,Yc)+1,e.match+1);return Ut(this,Yc,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;He(this,Yc)<e.match-1;){const r=this.peek().linkNext;n.push(Cr(this,$k,ste).call(this,He(this,Yc)+1,r)),Ut(this,Yc,r)}return Ut(this,Yc,e.match+1),n}peek(){if(He(this,Yc)>=He(this,tm).length)throw new Error("out-of-bounds");return He(this,tm)[He(this,Yc)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return gb(this,Yc)._++,e}toString(){const e=[];for(let n=He(this,Yc);n<He(this,tm).length;n++){const r=He(this,tm)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Yc=new WeakMap,tm=new WeakMap,$k=new WeakSet,ste=function(e=0,n=0){return new fB(He(this,tm).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let Em=fB;function A2(t){const e=[],n=o=>{const l=a<t.length?JSON.stringify(t[a]):"$EOI";throw new Error(`invalid token ${l} at ${a}: ${o}`)};let r=[],s=[],a=0;for(;a<t.length;){let o=t.substring(a),l=o.match(BCt);l&&(a+=l[1].length,o=t.substring(a));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};e.push(c);let u=DCt[o[0]]||"";if(u){if(c.type=u,c.text=o[0],a++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),c.match=r.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(u==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")c.type="BRACKET";else if(u==="CLOSE_BRACKET"){let d=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;d=f+d,e[e.length-1].value=$i(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=d}continue}if(l=o.match(UCt),l){if(c.text=l[1],a+=c.text.length,LCt.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(HFe)){c.type="TYPE";continue}c.type="ID";continue}if(l=o.match($Ct),l){c.text=l[1],c.type="NUMBER",a+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${a}`)}return new Em(e.map(o=>Object.freeze(o)))}function bge(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function z$(t,e){if(e.peekKeyword($Fe)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function w1(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function VFe(t){let e=w1(t,FCt);return bge(e,hd("constant payable nonpayable".split(" "))),bge(e,hd("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function r1(t,e){return t.popParams().map(n=>lu.from(n,e))}function WFe(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Es(t.pop().text);throw new Error("invalid gas")}return null}function G3(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const zCt=new RegExp(/^(.*)\[([0-9]*)\]$/);function yge(t){const e=t.match(HFe);if(vn(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);vn(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);vn(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Wo={},xf=Symbol.for("_ethers_internal"),vge="_ParamTypeInternal",wge="_ErrorInternal",Cge="_EventInternal",Sge="_ConstructorInternal",Nge="_FallbackInternal",Age="_FunctionInternal",jge="_StructInternal";var ES,GO;const Hh=class Hh{constructor(e,n,r,s,a,o,l,c){Rn(this,ES);$n(this,"name");$n(this,"type");$n(this,"baseType");$n(this,"indexed");$n(this,"components");$n(this,"arrayLength");$n(this,"arrayChildren");if(_5(e,Wo,"ParamType"),Object.defineProperty(this,xf,{value:vge}),o&&(o=Object.freeze(o.slice())),s==="array"){if(l==null||c==null)throw new Error("")}else if(l!=null||c!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");$s(this,{name:n,type:r,baseType:s,indexed:a,components:o,arrayLength:l,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const a=JSON.parse(this.arrayChildren.format("json"));return a.name=r,a.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(a)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(a=>JSON.parse(a.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,a)=>r.components[a].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return Cr(this,ES,GO).call(this,r,e,n,a=>{s[0]=a}),r.length&&await Promise.all(r),s[0]}static from(e,n){if(Hh.isParamType(e))return e;if(typeof e=="string")try{return Hh.from(A2(e),n)}catch{vn(!1,"invalid param type","obj",e)}else if(e instanceof Em){let l="",c="",u=null;w1(e,hd(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",u=e.popParams().map(v=>Hh.from(v)),l=`tuple(${u.map(v=>v.format()).join(",")})`):(l=yge(e.popType("TYPE")),c=l);let d=null,f=null;for(;e.length&&e.peekType("BRACKET");){const v=e.pop();d=new Hh(Wo,"",l,c,null,u,f,d),f=v.value,l+=v.text,c="array",u=null}let x=null;if(w1(e,OCt).has("indexed")){if(!n)throw new Error("");x=!0}const y=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Hh(Wo,y,l,c,x,u,f,d)}const r=e.name;vn(!r||typeof r=="string"&&r.match(zFe),"invalid name","obj.name",r);let s=e.indexed;s!=null&&(vn(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let a=e.type,o=a.match(zCt);if(o){const l=parseInt(o[2]||"-1"),c=Hh.from({type:o[1],components:e.components});return new Hh(Wo,r||"",a,"array",s,null,l,c)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){const l=e.components!=null?e.components.map(u=>Hh.from(u)):null;return new Hh(Wo,r||"",a,"tuple",s,l,null,null)}return a=yge(e.type),new Hh(Wo,r||"",a,a,s,null,null,null)}static isParamType(e){return e&&e[xf]===vge}};ES=new WeakSet,GO=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,l=n.slice();l.forEach((c,u)=>{var d;Cr(d=o,ES,GO).call(d,e,c,r,f=>{l[u]=f})}),s(l);return}if(this.isTuple()){const o=this.components;let l;if(Array.isArray(n))l=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");l=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in n))throw new Error(`missing value for component ${c.name}`);return n[c.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((c,u)=>{var d;Cr(d=o[u],ES,GO).call(d,e,c,r,f=>{l[u]=f})}),s(l);return}const a=r(this.type,n);a.then?e.push(async function(){s(await a)}()):s(a)};let lu=Hh;class K3{constructor(e,n,r){$n(this,"type");$n(this,"inputs");_5(e,Wo,"Fragment"),r=Object.freeze(r.slice()),$s(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{K3.from(JSON.parse(e))}catch{}return K3.from(A2(e))}if(e instanceof Em)switch(e.peekKeyword($Fe)){case"constructor":return Wg.from(e);case"error":return Jd.from(e);case"event":return T0.from(e);case"fallback":case"receive":return vg.from(e);case"function":return P0.from(e);case"struct":return m3.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Wg.from(e);case"error":return Jd.from(e);case"event":return T0.from(e);case"fallback":case"receive":return vg.from(e);case"function":return P0.from(e);case"struct":return m3.from(e)}Dr(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}vn(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Wg.isFragment(e)}static isError(e){return Jd.isFragment(e)}static isEvent(e){return T0.isFragment(e)}static isFunction(e){return P0.isFragment(e)}static isStruct(e){return m3.isFragment(e)}}class H$ extends K3{constructor(n,r,s,a){super(n,r,a);$n(this,"name");vn(typeof s=="string"&&s.match(zFe),"invalid identifier","name",s),a=Object.freeze(a.slice()),$s(this,{name:s})}}function QE(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class Jd extends H${constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,xf,{value:wge})}get selector(){return v1(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+QE(e,this.inputs)),n.join(" ")}static from(e){if(Jd.isFragment(e))return e;if(typeof e=="string")return Jd.from(A2(e));if(e instanceof Em){const n=z$("error",e),r=r1(e);return G3(e),new Jd(Wo,n,r)}return new Jd(Wo,e.name,e.inputs?e.inputs.map(lu.from):[])}static isFragment(e){return e&&e[xf]===wge}}class T0 extends H${constructor(n,r,s,a){super(n,"event",r,s);$n(this,"anonymous");Object.defineProperty(this,xf,{value:Cge}),$s(this,{anonymous:a})}get topicHash(){return v1(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+QE(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(a=>lu.from(a)),new T0(Wo,n,r,!1).topicHash}static from(n){if(T0.isFragment(n))return n;if(typeof n=="string")try{return T0.from(A2(n))}catch{vn(!1,"invalid event fragment","obj",n)}else if(n instanceof Em){const r=z$("event",n),s=r1(n,!0),a=!!w1(n,hd(["anonymous"])).has("anonymous");return G3(n),new T0(Wo,r,s,a)}return new T0(Wo,n.name,n.inputs?n.inputs.map(r=>lu.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[xf]===Cge}}class Wg extends K3{constructor(n,r,s,a,o){super(n,r,s);$n(this,"payable");$n(this,"gas");Object.defineProperty(this,xf,{value:Sge}),$s(this,{payable:a,gas:o})}format(n){if(Dr(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${QE(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Wg.isFragment(n))return n;if(typeof n=="string")try{return Wg.from(A2(n))}catch{vn(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof Em){w1(n,hd(["constructor"]));const r=r1(n),s=!!w1(n,ICt).has("payable"),a=WFe(n);return G3(n),new Wg(Wo,"constructor",r,s,a)}return new Wg(Wo,"constructor",n.inputs?n.inputs.map(lu.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[xf]===Sge}}class vg extends K3{constructor(n,r,s){super(n,"fallback",r);$n(this,"payable");Object.defineProperty(this,xf,{value:Nge}),$s(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(vg.isFragment(n))return n;if(typeof n=="string")try{return vg.from(A2(n))}catch{vn(!1,"invalid fallback fragment","obj",n)}else if(n instanceof Em){const r=n.toString(),s=n.peekKeyword(hd(["fallback","receive"]));if(vn(s,"type must be fallback or receive","obj",r),n.popKeyword(hd(["fallback","receive"]))==="receive"){const c=r1(n);return vn(c.length===0,"receive cannot have arguments","obj.inputs",c),w1(n,hd(["payable"])),G3(n),new vg(Wo,[],!0)}let o=r1(n);o.length?vn(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[lu.from("bytes")];const l=VFe(n);if(vn(l==="nonpayable"||l==="payable","fallback cannot be constants","obj.stateMutability",l),w1(n,hd(["returns"])).has("returns")){const c=r1(n);vn(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(u=>u.format("minimal")).join(", "))}return G3(n),new vg(Wo,o,l==="payable")}if(n.type==="receive")return new vg(Wo,[],!0);if(n.type==="fallback"){const r=[lu.from("bytes")],s=n.stateMutability==="payable";return new vg(Wo,r,s)}vn(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[xf]===Nge}}class P0 extends H${constructor(n,r,s,a,o,l){super(n,"function",r,a);$n(this,"constant");$n(this,"outputs");$n(this,"stateMutability");$n(this,"payable");$n(this,"gas");Object.defineProperty(this,xf,{value:Age}),o=Object.freeze(o.slice()),$s(this,{constant:s==="view"||s==="pure",gas:l,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return v1(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+QE(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(QE(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(a=>lu.from(a)),new P0(Wo,n,"view",r,[],null).selector}static from(n){if(P0.isFragment(n))return n;if(typeof n=="string")try{return P0.from(A2(n))}catch{vn(!1,"invalid function fragment","obj",n)}else if(n instanceof Em){const s=z$("function",n),a=r1(n),o=VFe(n);let l=[];w1(n,hd(["returns"])).has("returns")&&(l=r1(n));const c=WFe(n);return G3(n),new P0(Wo,s,o,a,l,c)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new P0(Wo,n.name,r,n.inputs?n.inputs.map(lu.from):[],n.outputs?n.outputs.map(lu.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[xf]===Age}}class m3 extends H${constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,xf,{value:jge})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return m3.from(A2(e))}catch{vn(!1,"invalid struct fragment","obj",e)}else if(e instanceof Em){const n=z$("struct",e),r=r1(e);return G3(e),new m3(Wo,n,r)}return new m3(Wo,e.name,e.inputs?e.inputs.map(lu.from):[])}static isFragment(e){return e&&e[xf]===jge}}const Mm=new Map;Mm.set(0,"GENERIC_PANIC");Mm.set(1,"ASSERT_FALSE");Mm.set(17,"OVERFLOW");Mm.set(18,"DIVIDE_BY_ZERO");Mm.set(33,"ENUM_RANGE_ERROR");Mm.set(34,"BAD_STORAGE_DATA");Mm.set(49,"STACK_UNDERFLOW");Mm.set(50,"ARRAY_RANGE_ERROR");Mm.set(65,"OUT_OF_MEMORY");Mm.set(81,"UNINITIALIZED_FUNCTION_CALL");const HCt=new RegExp(/^bytes([0-9]*)$/),VCt=new RegExp(/^(u?int)([0-9]*)$/);let KV=null,Ege=1024;function WCt(t,e,n,r){let s="missing revert data",a=null;const o=null;let l=null;if(n){s="execution reverted";const u=ms(n);if(n=Kr(n),u.length===0)s+=" (no data present; likely require(false) occurred",a="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Kr(u.slice(0,4))==="0x08c379a0")try{a=r.decode(["string"],u.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[a]},s+=`: ${JSON.stringify(a)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Kr(u.slice(0,4))==="0x4e487b71")try{const d=Number(r.decode(["uint256"],u.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},a=`Panic due to ${Mm.get(d)||"UNKNOWN"}(${d})`,s+=`: ${a}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?aa(e.to):null,data:e.data||"0x"};return e.from&&(c.from=aa(e.from)),Fo(s,"CALL_EXCEPTION",{action:t,data:n,reason:a,transaction:c,invocation:o,revert:l})}var dy,UC;const hB=class hB{constructor(){Rn(this,dy)}getDefaultValue(e){const n=e.map(s=>Cr(this,dy,UC).call(this,lu.from(s)));return new UI(n,"_").defaultValue()}encode(e,n){YPe(n.length,e.length,"types/values length mismatch");const r=e.map(o=>Cr(this,dy,UC).call(this,lu.from(o))),s=new UI(r,"_"),a=new Vee;return s.encode(a,n),a.data}decode(e,n,r){const s=e.map(o=>Cr(this,dy,UC).call(this,lu.from(o)));return new UI(s,"_").decode(new Wee(n,r,Ege))}static _setDefaultMaxInflation(e){vn(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Ege=e}static defaultAbiCoder(){return KV==null&&(KV=new hB),KV}static getBuiltinCallException(e,n,r){return WCt(e,n,r,hB.defaultAbiCoder())}};dy=new WeakSet,UC=function(e){if(e.isArray())return new l6t(Cr(this,dy,UC).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new UI(e.components.map(r=>Cr(this,dy,UC).call(this,r)),e.name);switch(e.baseType){case"address":return new a6t(e.name);case"bool":return new c6t(e.name);case"string":return new b6t(e.name);case"bytes":return new u6t(e.name);case"":return new h6t(e.name)}let n=e.type.match(VCt);if(n){let r=parseInt(n[2]||"256");return vn(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new g6t(r/8,n[1]==="int",e.name)}if(n=e.type.match(HCt),n){let r=parseInt(n[1]);return vn(r!==0&&r<=32,"invalid bytes length","param",e),new d6t(r,e.name)}vn(!1,"invalid type","type",e.type)};let ZE=hB;class qCt{constructor(e,n,r){$n(this,"fragment");$n(this,"name");$n(this,"signature");$n(this,"topic");$n(this,"args");const s=e.name,a=e.format();$s(this,{fragment:e,name:s,signature:a,topic:n,args:r})}}class GCt{constructor(e,n,r,s){$n(this,"fragment");$n(this,"name");$n(this,"args");$n(this,"signature");$n(this,"selector");$n(this,"value");const a=e.name,o=e.format();$s(this,{fragment:e,name:a,args:r,signature:o,selector:n,value:s})}}class KCt{constructor(e,n,r){$n(this,"fragment");$n(this,"name");$n(this,"args");$n(this,"signature");$n(this,"selector");const s=e.name,a=e.format();$s(this,{fragment:e,name:s,args:r,signature:a,selector:n})}}class _ge{constructor(e){$n(this,"hash");$n(this,"_isIndexed");$s(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const kge={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Tge={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&kge[t.toString()]&&(e=kge[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var v0,w0,C0,Nu,tx,KO,YO;const sw=class sw{constructor(e){Rn(this,tx);$n(this,"fragments");$n(this,"deploy");$n(this,"fallback");$n(this,"receive");Rn(this,v0);Rn(this,w0);Rn(this,C0);Rn(this,Nu);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,Ut(this,C0,new Map),Ut(this,v0,new Map),Ut(this,w0,new Map);const r=[];for(const o of n)try{r.push(K3.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}$s(this,{fragments:Object.freeze(r)});let s=null,a=!1;Ut(this,Nu,this.getAbiCoder()),this.fragments.forEach((o,l)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}$s(this,{deploy:o});return;case"fallback":o.inputs.length===0?a=!0:(vn(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${l}]`,o),s=o,a=s.payable);return;case"function":c=He(this,C0);break;case"event":c=He(this,w0);break;case"error":c=He(this,v0);break;default:return}const u=o.format();c.has(u)||c.set(u,o)}),this.deploy||$s(this,{deploy:Wg.from("constructor()")}),$s(this,{fallback:s,receive:a})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return ZE.defaultAbiCoder()}getFunctionName(e){const n=Cr(this,tx,KO).call(this,e,null,!1);return vn(n,"no matching function","key",e),n.name}hasFunction(e){return!!Cr(this,tx,KO).call(this,e,null,!1)}getFunction(e,n){return Cr(this,tx,KO).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(He(this,C0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(He(this,C0).get(s),r)}}getEventName(e){const n=Cr(this,tx,YO).call(this,e,null,!1);return vn(n,"no matching event","key",e),n.name}hasEvent(e){return!!Cr(this,tx,YO).call(this,e,null,!1)}getEvent(e,n){return Cr(this,tx,YO).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(He(this,w0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(He(this,w0).get(s),r)}}getError(e,n){if(po(e)){const s=e.toLowerCase();if(Tge[s])return Jd.from(Tge[s].signature);for(const a of He(this,v0).values())if(s===a.selector)return a;return null}if(e.indexOf("(")===-1){const s=[];for(const[a,o]of He(this,v0))a.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?Jd.from("error Error(string)"):e==="Panic"?Jd.from("error Panic(uint256)"):null;if(s.length>1){const a=s.map(o=>JSON.stringify(o.format())).join(", ");vn(!1,`ambiguous error description (i.e. ${a})`,"name",e)}return s[0]}if(e=Jd.from(e).format(),e==="Error(string)")return Jd.from("error Error(string)");if(e==="Panic(uint256)")return Jd.from("error Panic(uint256)");const r=He(this,v0).get(e);return r||null}forEachError(e){const n=Array.from(He(this,v0).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(He(this,v0).get(s),r)}}_decodeParams(e,n){return He(this,Nu).decode(e,n)}_encodeParams(e,n){return He(this,Nu).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);vn(r,"unknown error","fragment",e),e=r}return vn(Co(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,Co(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);vn(r,"unknown error","fragment",e),e=r}return Da([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);vn(r,"unknown function","fragment",e),e=r}return vn(Co(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,Co(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);vn(r,"unknown function","fragment",e),e=r}return Da([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const a=this.getFunction(e);vn(a,"unknown function","fragment",e),e=a}let r="invalid length for result data";const s=su(n);if(s.length%32===0)try{return He(this,Nu).decode(e.outputs,s)}catch{r="could not decode result data"}Dr(!1,r,"BAD_DATA",{value:Kr(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ms(e,"data"),s=ZE.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const l=Kr(r.slice(0,4)),c=this.getError(l);if(c)try{const u=He(this,Nu).decode(c.inputs,r.slice(4));s.revert={name:c.name,signature:c.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);vn(r,"unknown function","fragment",e),e=r}return Kr(He(this,Nu).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const a=this.getEvent(e);vn(a,"unknown event","eventFragment",e),e=a}Dr(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(a,o)=>a.type==="string"?v1(o):a.type==="bytes"?ho(Kr(o)):(a.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":a.type.match(/^u?int/)?o=b1(o):a.type.match(/^bytes/)?o=Kwt(o,32):a.type==="address"&&He(this,Nu).encode(["address"],[o]),g1(Kr(o),32));for(n.forEach((a,o)=>{const l=e.inputs[o];if(!l.indexed){vn(a==null,"cannot filter non-indexed parameters; must be null","contract."+l.name,a);return}a==null?r.push(null):l.baseType==="array"||l.baseType==="tuple"?vn(!1,"filtering with tuples or arrays not supported","contract."+l.name,a):Array.isArray(a)?r.push(a.map(c=>s(l,c))):r.push(s(l,a))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);vn(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],a=[];return e.anonymous||r.push(e.topicHash),vn(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,l)=>{const c=n[l];if(o.indexed)if(o.type==="string")r.push(v1(c));else if(o.type==="bytes")r.push(ho(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(He(this,Nu).encode([o.type],[c]))}else s.push(o),a.push(c)}),{data:He(this,Nu).encode(s,a),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const g=this.getEvent(e);vn(g,"unknown event","eventFragment",e),e=g}if(r!=null&&!e.anonymous){const g=e.topicHash;vn(po(r[0],32)&&r[0].toLowerCase()===g,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],a=[],o=[];e.inputs.forEach((g,y)=>{g.indexed?g.type==="string"||g.type==="bytes"||g.baseType==="tuple"||g.baseType==="array"?(s.push(lu.from({type:"bytes32",name:g.name})),o.push(!0)):(s.push(g),o.push(!1)):(a.push(g),o.push(!1))});const l=r!=null?He(this,Nu).decode(s,Da(r)):null,c=He(this,Nu).decode(a,n,!0),u=[],d=[];let f=0,x=0;return e.inputs.forEach((g,y)=>{let v=null;if(g.indexed)if(l==null)v=new _ge(null);else if(o[y])v=new _ge(l[x++]);else try{v=l[x++]}catch(C){v=C}else try{v=c[f++]}catch(C){v=C}u.push(v),d.push(g.name||null)}),pR.fromItems(u,d)}parseTransaction(e){const n=ms(e.data,"tx.data"),r=Es(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Kr(n.slice(0,4)));if(!s)return null;const a=He(this,Nu).decode(s.inputs,n.slice(4));return new GCt(s,s.selector,a,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new qCt(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=Kr(e),r=this.getError(Co(n,0,4));if(!r)return null;const s=He(this,Nu).decode(r.inputs,Co(n,4));return new KCt(r,r.selector,s)}static from(e){return e instanceof sw?e:typeof e=="string"?new sw(JSON.parse(e)):typeof e.formatJson=="function"?new sw(e.formatJson()):typeof e.format=="function"?new sw(e.format("json")):new sw(e)}};v0=new WeakMap,w0=new WeakMap,C0=new WeakMap,Nu=new WeakMap,tx=new WeakSet,KO=function(e,n,r){if(po(e)){const a=e.toLowerCase();for(const o of He(this,C0).values())if(a===o.selector)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of He(this,C0))o.split("(")[0]===e&&a.push(l);if(n){const o=n.length>0?n[n.length-1]:null;let l=n.length,c=!0;Uu.isTyped(o)&&o.type==="overrides"&&(c=!1,l--);for(let u=a.length-1;u>=0;u--){const d=a[u].inputs.length;d!==l&&(!c||d!==l-1)&&a.splice(u,1)}for(let u=a.length-1;u>=0;u--){const d=a[u].inputs;for(let f=0;f<n.length;f++)if(Uu.isTyped(n[f])){if(f>=d.length){if(n[f].type==="overrides")continue;a.splice(u,1);break}if(n[f].type!==d[f].baseType){a.splice(u,1);break}}}}if(a.length===1&&n&&n.length!==a[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&a.splice(0,1)}if(a.length===0)return null;if(a.length>1&&r){const o=a.map(l=>JSON.stringify(l.format())).join(", ");vn(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return a[0]}const s=He(this,C0).get(P0.from(e).format());return s||null},YO=function(e,n,r){if(po(e)){const a=e.toLowerCase();for(const o of He(this,w0).values())if(a===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const a=[];for(const[o,l]of He(this,w0))o.split("(")[0]===e&&a.push(l);if(n){for(let o=a.length-1;o>=0;o--)a[o].inputs.length<n.length&&a.splice(o,1);for(let o=a.length-1;o>=0;o--){const l=a[o].inputs;for(let c=0;c<n.length;c++)if(Uu.isTyped(n[c])&&n[c].type!==l[c].baseType){a.splice(o,1);break}}}if(a.length===0)return null;if(a.length>1&&r){const o=a.map(l=>JSON.stringify(l.format())).join(", ");vn(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return a[0]}const s=He(this,w0).get(T0.from(e).format());return s||null};let ite=sw;const qFe=BigInt(0);function _4(t){return t??null}function wl(t){return t==null?null:t.toString()}class Pge{constructor(e,n,r){$n(this,"gasPrice");$n(this,"maxFeePerGas");$n(this,"maxPriorityFeePerGas");$s(this,{gasPrice:_4(e),maxFeePerGas:_4(n),maxPriorityFeePerGas:_4(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:wl(e),maxFeePerGas:wl(n),maxPriorityFeePerGas:wl(r)}}}function JE(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Kr(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=Es(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=$i(t[s],`request.${s}`));return t.accessList&&(e.accessList=k5(t.accessList)),t.authorizationList&&(e.authorizationList=t.authorizationList.slice()),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>T$(s)?Kr(s):Object.assign({},s))),e}var Pg;class YCt{constructor(e,n){$n(this,"provider");$n(this,"number");$n(this,"hash");$n(this,"timestamp");$n(this,"parentHash");$n(this,"parentBeaconBlockRoot");$n(this,"nonce");$n(this,"difficulty");$n(this,"gasLimit");$n(this,"gasUsed");$n(this,"stateRoot");$n(this,"receiptsRoot");$n(this,"blobGasUsed");$n(this,"excessBlobGas");$n(this,"miner");$n(this,"prevRandao");$n(this,"extraData");$n(this,"baseFeePerGas");Rn(this,Pg);Ut(this,Pg,e.transactions.map(r=>typeof r!="string"?new e_(r,n):r)),$s(this,{provider:n,hash:_4(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:_4(e.prevRandao),extraData:e.extraData,baseFeePerGas:_4(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return He(this,Pg).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=He(this,Pg).slice();return e.length===0?[]:(Dr(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:a,hash:o,miner:l,prevRandao:c,nonce:u,number:d,parentHash:f,parentBeaconBlockRoot:x,stateRoot:g,receiptsRoot:y,timestamp:v,transactions:C}=this;return{_type:"Block",baseFeePerGas:wl(e),difficulty:wl(n),extraData:r,gasLimit:wl(s),gasUsed:wl(a),blobGasUsed:wl(this.blobGasUsed),excessBlobGas:wl(this.excessBlobGas),hash:o,miner:l,prevRandao:c,nonce:u,number:d,parentHash:f,timestamp:v,parentBeaconBlockRoot:x,stateRoot:g,receiptsRoot:y,transactions:C}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return He(this,Pg).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=He(this,Pg)[e];else{const r=e.toLowerCase();for(const s of He(this,Pg))if(typeof s=="string"){if(s!==r)continue;n=s;break}else{if(s.hash!==r)continue;n=s;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;vn(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return XCt(this)}}Pg=new WeakMap;class _T{constructor(e,n){$n(this,"provider");$n(this,"transactionHash");$n(this,"blockHash");$n(this,"blockNumber");$n(this,"removed");$n(this,"address");$n(this,"data");$n(this,"topics");$n(this,"index");$n(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());$s(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:a,removed:o,topics:l,transactionHash:c,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:a,removed:o,topics:l,transactionHash:c,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return Dr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return Dr(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return Dr(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return QCt(this)}}var Uk;class GFe{constructor(e,n){$n(this,"provider");$n(this,"to");$n(this,"from");$n(this,"contractAddress");$n(this,"hash");$n(this,"index");$n(this,"blockHash");$n(this,"blockNumber");$n(this,"logsBloom");$n(this,"gasUsed");$n(this,"blobGasUsed");$n(this,"cumulativeGasUsed");$n(this,"gasPrice");$n(this,"blobGasPrice");$n(this,"type");$n(this,"status");$n(this,"root");Rn(this,Uk);Ut(this,Uk,Object.freeze(e.logs.map(s=>new _T(s,n))));let r=qFe;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),$s(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return He(this,Uk)}toJSON(){const{to:e,from:n,contractAddress:r,hash:s,index:a,blockHash:o,blockNumber:l,logsBloom:c,logs:u,status:d,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:l,contractAddress:r,cumulativeGasUsed:wl(this.cumulativeGasUsed),from:n,gasPrice:wl(this.gasPrice),blobGasUsed:wl(this.blobGasUsed),blobGasPrice:wl(this.blobGasPrice),gasUsed:wl(this.gasUsed),hash:s,index:a,logs:u,logsBloom:c,root:f,status:d,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return YFe(this)}reorderedEvent(e){return Dr(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),KFe(this,e)}}Uk=new WeakMap;var fy;const _fe=class _fe{constructor(e,n){$n(this,"provider");$n(this,"blockNumber");$n(this,"blockHash");$n(this,"index");$n(this,"hash");$n(this,"type");$n(this,"to");$n(this,"from");$n(this,"nonce");$n(this,"gasLimit");$n(this,"gasPrice");$n(this,"maxPriorityFeePerGas");$n(this,"maxFeePerGas");$n(this,"maxFeePerBlobGas");$n(this,"data");$n(this,"value");$n(this,"chainId");$n(this,"signature");$n(this,"accessList");$n(this,"blobVersionedHashes");$n(this,"authorizationList");Rn(this,fy);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,Ut(this,fy,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:a,to:o,from:l,nonce:c,data:u,signature:d,accessList:f,blobVersionedHashes:x}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:x,chainId:wl(this.chainId),data:u,from:l,gasLimit:wl(this.gasLimit),gasPrice:wl(this.gasPrice),hash:s,maxFeePerGas:wl(this.maxFeePerGas),maxPriorityFeePerGas:wl(this.maxPriorityFeePerGas),maxFeePerBlobGas:wl(this.maxFeePerBlobGas),nonce:c,signature:d,to:o,index:r,type:a,value:wl(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await _u({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,s=n??0;let a=He(this,fy),o=-1,l=a===-1;const c=async()=>{if(l)return null;const{blockNumber:x,nonce:g}=await _u({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(g<this.nonce){a=x;return}if(l)return null;const y=await this.getTransaction();if(!(y&&y.blockNumber!=null))for(o===-1&&(o=a-3,o<He(this,fy)&&(o=He(this,fy)));o<=x;){if(l)return null;const v=await this.provider.getBlock(o,!0);if(v==null)return;for(const C of v)if(C===this.hash)return;for(let C=0;C<v.length;C++){const N=await v.getTransaction(C);if(N.from===this.from&&N.nonce===this.nonce){if(l)return null;const P=await this.provider.getTransactionReceipt(N.hash);if(P==null||x-P.blockNumber+1<r)return;let T="replaced";N.data===this.data&&N.to===this.to&&N.value===this.value?T="repriced":N.data==="0x"&&N.from===N.to&&N.value===qFe&&(T="cancelled"),Dr(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:T==="replaced"||T==="cancelled",reason:T,replacement:N.replaceableTransaction(a),hash:N.hash,receipt:P})}}o++}},u=x=>{if(x==null||x.status!==0)return x;Dr(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:x.to,from:x.from,data:""},receipt:x})},d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(d);if(d){if(r===1||await d.confirmations()>=r)return u(d)}else if(await c(),r===0)return null;return await new Promise((x,g)=>{const y=[],v=()=>{y.forEach(N=>N())};if(y.push(()=>{l=!0}),s>0){const N=setTimeout(()=>{v(),g(Fo("wait for transaction timeout","TIMEOUT"))},s);y.push(()=>{clearTimeout(N)})}const C=async N=>{if(await N.confirmations()>=r){v();try{x(u(N))}catch(P){g(P)}}};if(y.push(()=>{this.provider.off(this.hash,C)}),this.provider.on(this.hash,C),a>=0){const N=async()=>{try{await c()}catch(P){if(ru(P,"TRANSACTION_REPLACED")){v(),g(P);return}}l||this.provider.once("block",N)};y.push(()=>{this.provider.off("block",N)}),this.provider.once("block",N)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Dr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),YFe(this)}reorderedEvent(e){return Dr(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Dr(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),KFe(this,e)}replaceableTransaction(e){vn(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new _fe(this,this.provider);return Ut(n,fy,e),n}};fy=new WeakMap;let e_=_fe;function XCt(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function KFe(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function YFe(t){return{orphan:"drop-transaction",tx:t}}function QCt(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class Qoe extends _T{constructor(n,r,s){super(n,n.provider);$n(this,"interface");$n(this,"fragment");$n(this,"args");const a=r.decodeEventLog(s,n.data,n.topics);$s(this,{args:a,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class XFe extends _T{constructor(n,r){super(n,n.provider);$n(this,"error");$s(this,{error:r})}}var _S;class ZCt extends GFe{constructor(n,r,s){super(s,r);Rn(this,_S);Ut(this,_S,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?He(this,_S).getEvent(n.topics[0]):null;if(r)try{return new Qoe(n,He(this,_S),r)}catch(s){return new XFe(n,s)}return n})}}_S=new WeakMap;var zk;class Zoe extends e_{constructor(n,r,s){super(s,r);Rn(this,zk);Ut(this,zk,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new ZCt(He(this,zk),this.provider,s)}}zk=new WeakMap;class QFe extends tIe{constructor(n,r,s,a){super(n,r,s);$n(this,"log");$s(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class JCt extends QFe{constructor(e,n,r,s,a){super(e,n,r,new Qoe(a,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);$s(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const Ige=BigInt(0);function ZFe(t){return t&&typeof t.call=="function"}function JFe(t){return t&&typeof t.estimateGas=="function"}function V$(t){return t&&typeof t.resolveName=="function"}function eOe(t){return t&&typeof t.sendTransaction=="function"}function tOe(t){if(t!=null){if(V$(t))return t;if(t.provider)return t.provider}}var Hk;class e4t{constructor(e,n,r){Rn(this,Hk);$n(this,"fragment");if($s(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=Y3(e.runner,"resolveName"),a=V$(s)?s:null;Ut(this,Hk,async function(){const o=await Promise.all(n.inputs.map((l,c)=>r[c]==null?null:l.walkAsync(r[c],(d,f)=>d==="address"?Array.isArray(f)?Promise.all(f.map(x=>Fc(x,a))):Fc(f,a):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return He(this,Hk)}}Hk=new WeakMap;function Y3(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function pw(t){return t==null?null:t.provider||null}async function nOe(t,e){const n=Uu.dereference(t,"overrides");vn(typeof n=="object","invalid overrides parameter","overrides",t);const r=JE(n);return vn(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),vn(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function t4t(t,e,n){const r=Y3(t,"resolveName"),s=V$(r)?r:null;return await Promise.all(e.map((a,o)=>a.walkAsync(n[o],(l,c)=>(c=Uu.dereference(c,l),l==="address"?Fc(c,s):c))))}function n4t(t){const e=async function(o){const l=await nOe(o,["data"]);l.to=await t.getAddress(),l.from&&(l.from=await Fc(l.from,tOe(t.runner)));const c=t.interface,u=Es(l.value||Ige,"overrides.value")===Ige,d=(l.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!d&&!u&&vn(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),vn(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);const f=c.receive||c.fallback&&c.fallback.payable;return vn(f||u,"cannot send value to non-payable fallback","overrides.value",l.value),vn(c.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},n=async function(o){const l=Y3(t.runner,"call");Dr(ZFe(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await l.call(c)}catch(u){throw Ooe(u)&&u.data?t.interface.makeError(u.data,c):u}},r=async function(o){const l=t.runner;Dr(eOe(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await l.sendTransaction(await e(o)),u=pw(t.runner);return new Zoe(t.interface,u,c)},s=async function(o){const l=Y3(t.runner,"estimateGas");return Dr(JFe(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await e(o))},a=async o=>await r(o);return $s(a,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),a}function r4t(t,e){const n=function(...u){const d=t.interface.getFunction(e,u);return Dr(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),d},r=async function(...u){const d=n(...u);let f={};if(d.inputs.length+1===u.length&&(f=await nOe(u.pop()),f.from&&(f.from=await Fc(f.from,tOe(t.runner)))),d.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const x=await t4t(t.runner,d.inputs,u);return Object.assign({},f,await _u({to:t.getAddress(),data:t.interface.encodeFunctionData(d,x)}))},s=async function(...u){const d=await l(...u);return d.length===1?d[0]:d},a=async function(...u){const d=t.runner;Dr(eOe(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await d.sendTransaction(await r(...u)),x=pw(t.runner);return new Zoe(t.interface,x,f)},o=async function(...u){const d=Y3(t.runner,"estimateGas");return Dr(JFe(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...u))},l=async function(...u){const d=Y3(t.runner,"call");Dr(ZFe(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let x="0x";try{x=await d.call(f)}catch(y){throw Ooe(y)&&y.data?t.interface.makeError(y.data,f):y}const g=n(...u);return t.interface.decodeFunctionResult(g,x)},c=async(...u)=>n(...u).constant?await s(...u):await a(...u);return $s(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:a,staticCall:s,staticCallResult:l}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return Dr(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),c}function s4t(t,e){const n=function(...s){const a=t.interface.getEvent(e,s);return Dr(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),a},r=function(...s){return new e4t(t,n(...s),s)};return $s(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return Dr(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const vR=Symbol.for("_ethersInternal_contract"),rOe=new WeakMap;function i4t(t,e){rOe.set(t[vR],e)}function Bf(t){return rOe.get(t[vR])}function a4t(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function Joe(t,e){let n,r=null;if(Array.isArray(e)){const a=function(o){if(po(o,32))return o;const l=t.interface.getEvent(o);return vn(l,"unknown fragment","name",o),l.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(a):a(o))}else e==="*"?n=[null]:typeof e=="string"?po(e,32)?n=[e]:(r=t.interface.getEvent(e),vn(r,"unknown fragment","event",e),n=[r.topicHash]):a4t(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):vn(!1,"unknown event name","event",e);n=n.map(a=>{if(a==null)return null;if(Array.isArray(a)){const o=Array.from(new Set(a.map(l=>l.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return a.toLowerCase()});const s=n.map(a=>a==null?"null":Array.isArray(a)?a.join("|"):a).join("&");return{fragment:r,tag:s,topics:n}}async function G7(t,e){const{subs:n}=Bf(t);return n.get((await Joe(t,e)).tag)||null}async function Fge(t,e,n){const r=pw(t.runner);Dr(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:a,topics:o}=await Joe(t,n),{addr:l,subs:c}=Bf(t);let u=c.get(a);if(!u){const f={address:l||t,topics:o},x=C=>{let N=s;if(N==null)try{N=t.interface.getEvent(C.topics[0])}catch{}if(N){const P=N,T=s?t.interface.decodeEventLog(s,C.data,C.topics):[];ote(t,n,T,M=>new JCt(t,M,n,P,C))}else ote(t,n,[],P=>new QFe(t,P,n,C))};let g=[];u={tag:a,listeners:[],start:()=>{g.length||g.push(r.on(f,x))},stop:async()=>{if(g.length==0)return;let C=g;g=[],await Promise.all(C),r.off(f,x)}},c.set(a,u)}return u}let ate=Promise.resolve();async function o4t(t,e,n,r){await ate;const s=await G7(t,e);if(!s)return!1;const a=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:l})=>{const c=Array.from(n);r&&c.push(r(l?null:o));try{o.call(t,...c)}catch{}return!l}),s.listeners.length===0&&(s.stop(),Bf(t).subs.delete(s.tag)),a>0}async function ote(t,e,n,r){try{await ate}catch{}const s=o4t(t,e,n,r);return ate=s,await s}const HI=["then"];var m8e;m8e=vR;const eE=class eE{constructor(e,n,r,s){$n(this,"target");$n(this,"interface");$n(this,"runner");$n(this,"filters");$n(this,m8e);$n(this,"fallback");vn(typeof e=="string"||lFe(e),"invalid value for Contract target","target",e),r==null&&(r=null);const a=ite.from(n);$s(this,{target:e,runner:r,interface:a}),Object.defineProperty(this,vR,{value:{}});let o,l=null,c=null;if(s){const f=pw(r);c=new Zoe(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(po(e))l=e,o=Promise.resolve(e);else{const f=Y3(r,"resolveName");if(!V$(f))throw Fo("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(x=>{if(x==null)throw Fo("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Bf(this).addr=x,x})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Bf(this).addr=f,f});i4t(this,{addrPromise:o,addr:l,deployTx:c,subs:u});const d=new Proxy({},{get:(f,x,g)=>{if(typeof x=="symbol"||HI.indexOf(x)>=0)return Reflect.get(f,x,g);try{return this.getEvent(x)}catch(y){if(!ru(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(f,x)=>HI.indexOf(x)>=0?Reflect.has(f,x):Reflect.has(f,x)||this.interface.hasEvent(String(x))});return $s(this,{filters:d}),$s(this,{fallback:a.receive||a.fallback?n4t(this):null}),new Proxy(this,{get:(f,x,g)=>{if(typeof x=="symbol"||x in f||HI.indexOf(x)>=0)return Reflect.get(f,x,g);try{return f.getFunction(x)}catch(y){if(!ru(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(f,x)=>typeof x=="symbol"||x in f||HI.indexOf(x)>=0?Reflect.has(f,x):f.interface.hasFunction(x)})}connect(e){return new eE(this.target,this.interface,e)}attach(e){return new eE(e,this.interface,this.runner)}async getAddress(){return await Bf(this).addrPromise}async getDeployedCode(){const e=pw(this.runner);Dr(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=pw(this.runner);return Dr(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,a)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(l){a(l)}};o()})}deploymentTransaction(){return Bf(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),r4t(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),s4t(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:s,addrPromise:a}=Bf(this),o=s||await a,{fragment:l,topics:c}=await Joe(this,e),u={address:o,topics:c,fromBlock:n,toBlock:r},d=pw(this.runner);return Dr(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(u)).map(f=>{let x=l;if(x==null)try{x=this.interface.getEvent(f.topics[0])}catch{}if(x)try{return new Qoe(f,this.interface,x)}catch(g){return new XFe(f,g)}return new _T(f,d)})}async on(e,n){const r=await Fge(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await Fge(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await ote(this,e,n,null)}async listenerCount(e){if(e){const s=await G7(this,e);return s?s.listeners.length:0}const{subs:n}=Bf(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await G7(this,e);return s?s.listeners.map(({listener:a})=>a):[]}const{subs:n}=Bf(this);let r=[];for(const{listeners:s}of n.values())r=r.concat(s.map(({listener:a})=>a));return r}async off(e,n){const r=await G7(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:a})=>a).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(n==null||r.listeners.length===0)&&(r.stop(),Bf(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await G7(this,e);if(!n)return this;n.stop(),Bf(this).subs.delete(n.tag)}else{const{subs:n}=Bf(this);for(const{tag:r,stop:s}of n.values())s(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends eE{constructor(s,a=null){super(s,e,a)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let lte=eE;function l4t(){return lte}let S9=class extends l4t(){};function YV(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):vn(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class c4t{constructor(e){$n(this,"name");$s(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const sOe=new RegExp("^(ipfs)://(.*)$","i"),Oge=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),sOe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var hy,Xw,py,zC,pB,iOe;const x4=class x4{constructor(e,n,r){Rn(this,py);$n(this,"provider");$n(this,"address");$n(this,"name");Rn(this,hy);Rn(this,Xw);$s(this,{provider:e,address:n,name:r}),Ut(this,hy,null),Ut(this,Xw,new S9(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return He(this,hy)==null&&Ut(this,hy,(async()=>{try{return await He(this,Xw).supportsInterface("0x9061b923")}catch(e){if(ru(e,"CALL_EXCEPTION"))return!1;throw Ut(this,hy,null),e}})()),await He(this,hy)}async getAddress(e){if(e==null&&(e=60),e===60)try{const a=await Cr(this,py,zC).call(this,"addr(bytes32)");return a==null||a===qE?null:a}catch(a){if(ru(a,"CALL_EXCEPTION"))return null;throw a}if(e>=0&&e<2147483648){let a=e+2147483648;const o=await Cr(this,py,zC).call(this,"addr(bytes32,uint)",[a]);if(po(o,20))return aa(o)}let n=null;for(const a of this.provider.plugins)if(a instanceof c4t&&a.supportsCoinType(e)){n=a;break}if(n==null)return null;const r=await Cr(this,py,zC).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;Dr(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await Cr(this,py,zC).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await Cr(this,py,zC).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const s=n[1]==="e3010170"?"ipfs":"ipns",a=parseInt(n[4],16);if(n[5].length===a*2)return`${s}://${eIe("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;Dr(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<Oge.length;r++){const s=n.match(Oge[r]);if(s==null)continue;const a=s[1].toLowerCase();switch(a){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=YV(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=a==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:a,value:n});const l=await this.getAddress();if(l==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const c=(s[2]||"").split("/");if(c.length!==2)return e.push({type:`!${a}caip`,value:s[2]||""}),{url:null,linkage:e};const u=c[1],d=new S9(c[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(a==="erc721"){const v=await d.ownerOf(u);if(l!==v)return e.push({type:"!owner",value:v}),{url:null,linkage:e};e.push({type:"owner",value:v})}else if(a==="erc1155"){const v=await d.balanceOf(l,u);if(!v)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:v.toString()})}let f=await d[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),a==="erc1155"&&(f=f.replace("{id}",b1(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=YV(f)),e.push({type:"metadata-url",value:f});let x={};const g=await new r2(f).send();g.assertOk();try{x=g.bodyJson}catch{try{e.push({type:"!metadata",value:g.bodyText})}catch{const N=g.body;return N&&e.push({type:"!metadata",value:Kr(N)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!x)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(x)});let y=x.image;if(typeof y!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!y.match(/^(https:\/\/|data:)/i)){if(y.match(sOe)==null)return e.push({type:"!imageUrl-ipfs",value:y}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:y}),y=YV(y)}return e.push({type:"url",value:y}),{linkage:e,url:y}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return Dr(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const a=await Cr(s=x4,pB,iOe).call(s,e,r);if(a!=null){const o=new x4(e,a,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};hy=new WeakMap,Xw=new WeakMap,py=new WeakSet,zC=async function(e,n){n=(n||[]).slice();const r=He(this,Xw).interface;n.unshift(rte(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),Dr(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[SCt(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const a=await He(this,Xw)[e](...n);return s?r.decodeFunctionResult(s,a)[0]:a}catch(a){if(!ru(a,"CALL_EXCEPTION"))throw a}return null},pB=new WeakSet,iOe=async function(e,n){const r=await x4.getEnsAddress(e);try{const a=await new S9(r,["function resolver(bytes32) view returns (address)"],e).resolver(rte(n),{enableCcipRead:!0});return a===qE?null:a}catch(s){throw s}return null},Rn(x4,pB);let wR=x4;const Mge=BigInt(0);function na(t,e){return function(n){return n==null?e:t(n)}}function t_(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function kT(t,e){return n=>{const r={};for(const s in t){let a=s;if(e&&s in e&&!(a in n)){for(const o of e[s])if(o in n){a=o;break}}try{const o=t[s](n[a]);o!==void 0&&(r[s]=o)}catch(o){const l=o instanceof Error?o.message:"not-an-error";Dr(!1,`invalid value for value.${s} (${l})`,"BAD_DATA",{value:n})}}return r}}function u4t(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}vn(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function pN(t){return vn(po(t,!0),"invalid data","value",t),t}function nu(t){return vn(po(t,32),"invalid hash","value",t),t}const d4t=kT({address:aa,blockHash:nu,blockNumber:$i,data:pN,index:$i,removed:na(u4t,!1),topics:t_(nu),transactionHash:nu,transactionIndex:$i},{index:["logIndex"]});function f4t(t){return d4t(t)}const h4t=kT({hash:na(nu),parentHash:nu,parentBeaconBlockRoot:na(nu,null),number:$i,timestamp:$i,nonce:na(pN),difficulty:Es,gasLimit:Es,gasUsed:Es,stateRoot:na(nu,null),receiptsRoot:na(nu,null),blobGasUsed:na(Es,null),excessBlobGas:na(Es,null),miner:na(aa),prevRandao:na(nu,null),extraData:pN,baseFeePerGas:na(Es)},{prevRandao:["mixHash"]});function p4t(t){const e=h4t(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:aOe(n)),e}const m4t=kT({transactionIndex:$i,blockNumber:$i,transactionHash:nu,address:aa,topics:t_(nu),data:pN,index:$i,blockHash:nu},{index:["logIndex"]});function x4t(t){return m4t(t)}const g4t=kT({to:na(aa,null),from:na(aa,null),contractAddress:na(aa,null),index:$i,root:na(Kr),gasUsed:Es,blobGasUsed:na(Es,null),logsBloom:na(pN),blockHash:nu,hash:nu,logs:t_(x4t),blockNumber:$i,cumulativeGasUsed:Es,effectiveGasPrice:na(Es),blobGasPrice:na(Es,null),status:na($i),type:na($i,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function b4t(t){return g4t(t)}function aOe(t){t.to&&Es(t.to)===Mge&&(t.to="0x0000000000000000000000000000000000000000");const e=kT({hash:nu,index:na($i,void 0),type:n=>n==="0x"||n==null?0:$i(n),accessList:na(k5,null),blobVersionedHashes:na(t_(nu,!0),null),authorizationList:na(t_(n=>{let r;if(n.signature)r=n.signature;else{let s=n.yParity;s==="0x1b"?s=0:s==="0x1c"&&(s=1),r=Object.assign({},n,{yParity:s})}return{address:aa(n.address),chainId:Es(n.chainId),nonce:Es(n.nonce),signature:ou.from(r)}},!1),null),blockHash:na(nu,null),blockNumber:na($i,null),transactionIndex:na($i,null),from:aa,gasPrice:na(Es),maxPriorityFeePerGas:na(Es),maxFeePerGas:na(Es),maxFeePerBlobGas:na(Es,null),gasLimit:Es,to:na(aa,null),value:Es,nonce:$i,data:pN,creates:na(aa,null),chainId:na(Es,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=i6t(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=ou.from(t.signature):e.signature=ou.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&Es(e.blockHash)===Mge&&(e.blockHash=null),e}const y4t="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class TT{constructor(e){$n(this,"name");$s(this,{name:e})}clone(){return new TT(this.name)}}class W$ extends TT{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);$n(this,"effectiveBlock");$n(this,"txBase");$n(this,"txCreate");$n(this,"txDataZero");$n(this,"txDataNonzero");$n(this,"txAccessListStorageKey");$n(this,"txAccessListAddress");const s={effectiveBlock:n};function a(o,l){let c=(r||{})[o];c==null&&(c=l),vn(typeof c=="number",`invalud value for ${o}`,"costs",r),s[o]=c}a("txBase",21e3),a("txCreate",32e3),a("txDataZero",4),a("txDataNonzero",16),a("txAccessListStorageKey",1900),a("txAccessListAddress",2400),$s(this,s)}clone(){return new W$(this.effectiveBlock,this)}}class q$ extends TT{constructor(n,r){super("org.ethers.plugins.network.Ens");$n(this,"address");$n(this,"targetNetwork");$s(this,{address:n||y4t,targetNetwork:r??1})}clone(){return new q$(this.address,this.targetNetwork)}}var Vk,Wk;class v4t extends TT{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");Rn(this,Vk);Rn(this,Wk);Ut(this,Vk,n),Ut(this,Wk,r)}get url(){return He(this,Vk)}get processFunc(){return He(this,Wk)}clone(){return this}}Vk=new WeakMap,Wk=new WeakMap;const XV=new Map;var kS,TS,my,Jg;let jy=(Jg=class{constructor(e,n){Rn(this,kS);Rn(this,TS);Rn(this,my);Ut(this,kS,e),Ut(this,TS,Es(n)),Ut(this,my,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return He(this,kS)}set name(e){Ut(this,kS,e)}get chainId(){return He(this,TS)}set chainId(e){Ut(this,TS,Es(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Es(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Es(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Es(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(He(this,my).values())}attachPlugin(e){if(He(this,my).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return He(this,my).set(e.name,e.clone()),this}getPlugin(e){return He(this,my).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Jg(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new W$;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const s=k5(e.accessList);for(const a in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[a].storageKeys.length}return r}static from(e){if(w4t(),e==null)return Jg.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=XV.get(e);if(n)return n();if(typeof e=="bigint")return new Jg("unknown",e);vn(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){vn(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Jg(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new q$(e.ensAddress,e.ensNetwork)),n}vn(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=XV.get(e);r&&vn(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),XV.set(e,n)}},kS=new WeakMap,TS=new WeakMap,my=new WeakMap,Jg);function Rge(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function Lge(t){return new v4t(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[a,o]=await Promise.all([r.send(),e()]);s=a;const l=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:Rge(l.maxFee,9),maxPriorityFeePerGas:Rge(l.maxPriorityFee,9)}}catch(a){Dr(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:a})}})}let Dge=!1;function w4t(){if(Dge)return;Dge=!0;function t(e,n,r){const s=function(){const a=new jy(e,n);return r.ensNetwork!=null&&a.attachPlugin(new q$(null,r.ensNetwork)),a.attachPlugin(new W$),(r.plugins||[]).forEach(o=>{a.attachPlugin(o)}),a};jy.register(e,s),jy.register(n,s),r.altNames&&r.altNames.forEach(a=>{jy.register(a,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[Lge("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[Lge("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function cte(t){return JSON.parse(JSON.stringify(t))}var Ig,Gh,xy,S0,PS,XO;class C4t{constructor(e){Rn(this,PS);Rn(this,Ig);Rn(this,Gh);Rn(this,xy);Rn(this,S0);Ut(this,Ig,e),Ut(this,Gh,null),Ut(this,xy,4e3),Ut(this,S0,-2)}get pollingInterval(){return He(this,xy)}set pollingInterval(e){Ut(this,xy,e)}start(){He(this,Gh)||(Ut(this,Gh,He(this,Ig)._setTimeout(Cr(this,PS,XO).bind(this),He(this,xy))),Cr(this,PS,XO).call(this))}stop(){He(this,Gh)&&(He(this,Ig)._clearTimeout(He(this,Gh)),Ut(this,Gh,null))}pause(e){this.stop(),e&&Ut(this,S0,-2)}resume(){this.start()}}Ig=new WeakMap,Gh=new WeakMap,xy=new WeakMap,S0=new WeakMap,PS=new WeakSet,XO=async function(){try{const e=await He(this,Ig).getBlockNumber();if(He(this,S0)===-2){Ut(this,S0,e);return}if(e!==He(this,S0)){for(let n=He(this,S0)+1;n<=e;n++){if(He(this,Gh)==null)return;await He(this,Ig).emit("block",n)}Ut(this,S0,e)}}catch{}He(this,Gh)!=null&&Ut(this,Gh,He(this,Ig)._setTimeout(Cr(this,PS,XO).bind(this),He(this,xy)))};var Qw,Zw,gy;class ele{constructor(e){Rn(this,Qw);Rn(this,Zw);Rn(this,gy);Ut(this,Qw,e),Ut(this,gy,!1),Ut(this,Zw,n=>{this._poll(n,He(this,Qw))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){He(this,gy)||(Ut(this,gy,!0),He(this,Zw).call(this,-2),He(this,Qw).on("block",He(this,Zw)))}stop(){He(this,gy)&&(Ut(this,gy,!1),He(this,Qw).off("block",He(this,Zw)))}pause(e){this.stop()}resume(){this.start()}}Qw=new WeakMap,Zw=new WeakMap,gy=new WeakMap;var IS,Fg;class S4t extends ele{constructor(n,r){super(n);Rn(this,IS);Rn(this,Fg);Ut(this,IS,r),Ut(this,Fg,-2)}pause(n){n&&Ut(this,Fg,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(He(this,IS));s!=null&&(He(this,Fg)===-2?Ut(this,Fg,s.number):s.number>He(this,Fg)&&(r.emit(He(this,IS),s.number),Ut(this,Fg,s.number)))}}IS=new WeakMap,Fg=new WeakMap;var mB;class N4t extends ele{constructor(n,r){super(n);Rn(this,mB);Ut(this,mB,cte(r))}async _poll(n,r){throw new Error("@TODO")}}mB=new WeakMap;var FS;class A4t extends ele{constructor(n,r){super(n);Rn(this,FS);Ut(this,FS,r)}async _poll(n,r){const s=await r.getTransactionReceipt(He(this,FS));s&&r.emit(He(this,FS),s)}}FS=new WeakMap;var Og,OS,MS,by,Kh,xB,oOe;class tle{constructor(e,n){Rn(this,xB);Rn(this,Og);Rn(this,OS);Rn(this,MS);Rn(this,by);Rn(this,Kh);Ut(this,Og,e),Ut(this,OS,cte(n)),Ut(this,MS,Cr(this,xB,oOe).bind(this)),Ut(this,by,!1),Ut(this,Kh,-2)}start(){He(this,by)||(Ut(this,by,!0),He(this,Kh)===-2&&He(this,Og).getBlockNumber().then(e=>{Ut(this,Kh,e)}),He(this,Og).on("block",He(this,MS)))}stop(){He(this,by)&&(Ut(this,by,!1),He(this,Og).off("block",He(this,MS)))}pause(e){this.stop(),e&&Ut(this,Kh,-2)}resume(){this.start()}}Og=new WeakMap,OS=new WeakMap,MS=new WeakMap,by=new WeakMap,Kh=new WeakMap,xB=new WeakSet,oOe=async function(e){if(He(this,Kh)===-2)return;const n=cte(He(this,OS));n.fromBlock=He(this,Kh)+1,n.toBlock=e;const r=await He(this,Og).getLogs(n);if(r.length===0){He(this,Kh)<e-60&&Ut(this,Kh,e-60);return}for(const s of r)He(this,Og).emit(He(this,OS),s),Ut(this,Kh,s.blockNumber)};const j4t=BigInt(2),E4t=10;function VI(t){return t&&typeof t.then=="function"}function QO(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((a,o)=>(a[o]=r[o],a),{})}return r})}class lOe{constructor(e){$n(this,"name");$s(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function _4t(t){return JSON.parse(JSON.stringify(t))}function ute(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function QV(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(po(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:QO("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:QO("orphan",n),filter:_4t(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?ute(s.map(a=>a.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],a=[],o=l=>{po(l)?s.push(l):a.push((async()=>{s.push(await Fc(l,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),a.length&&await Promise.all(a),r.address=ute(s.map(l=>l.toLowerCase()))}return{filter:r,tag:QO("event",r),type:"event"}}vn(!1,"unknown ProviderEvent","event",t)}function ZV(){return new Date().getTime()}const k4t={cacheTimeout:250,pollingInterval:4e3};var Au,yy,ju,RS,Vf,Jw,vy,Mg,qk,Yh,LS,DS,Wi,Rf,dte,fte,K7,hte,Y7,ZO;class T4t{constructor(e,n){Rn(this,Wi);Rn(this,Au);Rn(this,yy);Rn(this,ju);Rn(this,RS);Rn(this,Vf);Rn(this,Jw);Rn(this,vy);Rn(this,Mg);Rn(this,qk);Rn(this,Yh);Rn(this,LS);Rn(this,DS);if(Ut(this,DS,Object.assign({},k4t,n||{})),e==="any")Ut(this,Jw,!0),Ut(this,Vf,null);else if(e){const r=jy.from(e);Ut(this,Jw,!1),Ut(this,Vf,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else Ut(this,Jw,!1),Ut(this,Vf,null);Ut(this,Mg,-1),Ut(this,vy,new Map),Ut(this,Au,new Map),Ut(this,yy,new Map),Ut(this,ju,null),Ut(this,RS,!1),Ut(this,qk,1),Ut(this,Yh,new Map),Ut(this,LS,!1)}get pollingInterval(){return He(this,DS).pollingInterval}get provider(){return this}get plugins(){return Array.from(He(this,yy).values())}attachPlugin(e){if(He(this,yy).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return He(this,yy).set(e.name,e.connect(this)),this}getPlugin(e){return He(this,yy).get(e)||null}get disableCcipRead(){return He(this,LS)}set disableCcipRead(e){Ut(this,LS,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),a=n.toLowerCase(),o=[];for(let l=0;l<r.length;l++){const c=r[l],u=c.replace("{sender}",s).replace("{data}",a),d=new r2(u);c.indexOf("{data}")===-1&&(d.body={data:a,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:d,index:l,urls:r});let f="unknown error",x;try{x=await d.send()}catch(g){o.push(g.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:{error:g}});continue}try{const g=x.bodyJson;if(g.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:d,result:g}),g.data;g.message&&(f=g.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:d,result:g})}catch{}Dr(x.statusCode<400||x.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:f}}),o.push(f)}Dr(!1,`error encountered during CCIP fetch: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new YCt(p4t(e),this)}_wrapLog(e,n){return new _T(f4t(e),this)}_wrapTransactionReceipt(e,n){return new GFe(b4t(e),this)}_wrapTransactionResponse(e,n){return new e_(aOe(e),this)}_detectNetwork(){Dr(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Dr(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=$i(await Cr(this,Wi,Rf).call(this,{method:"getBlockNumber"}),"%response");return He(this,Mg)>=0&&Ut(this,Mg,e),e}_getAddress(e){return Fc(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(po(e))return po(e,32)?e:cm(e);if(typeof e=="bigint"&&(e=$i(e,"blockTag")),typeof e=="number")return e>=0?cm(e):He(this,Mg)>=0?cm(He(this,Mg)+e):this.getBlockNumber().then(n=>cm(n+e));vn(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?ute(c.map(u=>u.toLowerCase())):c.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(c,u,d)=>{let f;switch(c.length){case 0:break;case 1:f=c[0];break;default:c.sort(),f=c}if(r&&(u!=null||d!=null))throw new Error("invalid filter");const x={};return f&&(x.address=f),n.length&&(x.topics=n),u&&(x.fromBlock=u),d&&(x.toBlock=d),r&&(x.blockHash=r),x};let a=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)a.push(this._getAddress(c));else a.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let l;return"toBlock"in e&&(l=this._getBlockTag(e.toBlock)),a.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||l!=null&&typeof l!="string"?Promise.all([Promise.all(a),o,l]).then(c=>s(c[0],c[1],c[2])):s(a,o,l)}_getTransactionRequest(e){const n=JE(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const a=Fc(n[s],this);VI(a)?r.push(async function(){n[s]=await a}()):n[s]=a}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);VI(s)?r.push(async function(){n.blockTag=await s}()):n.blockTag=s}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(He(this,Vf)==null){const s=(async()=>{try{const a=await this._detectNetwork();return this.emit("network",a,null),a}catch(a){throw He(this,Vf)===s&&Ut(this,Vf,null),a}})();return Ut(this,Vf,s),(await s).clone()}const e=He(this,Vf),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(He(this,Jw)?(this.emit("network",r,n),He(this,Vf)===e&&Ut(this,Vf,Promise.resolve(r))):Dr(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:a,priorityFee:o}=await _u({_block:Cr(this,Wi,hte).call(this,"latest",!1),gasPrice:(async()=>{try{const d=await Cr(this,Wi,Rf).call(this,{method:"getGasPrice"});return Es(d,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const d=await Cr(this,Wi,Rf).call(this,{method:"getPriorityFee"});return Es(d,"%response")}catch{}return null})()});let l=null,c=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(c=o??BigInt("1000000000"),l=u.baseFeePerGas*j4t+c),new Pge(a,l,c)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new r2(r.url),a=await r.processFunc(n,this,s);return new Pge(a.gasPrice,a.maxFeePerGas,a.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return VI(n)&&(n=await n),Es(await Cr(this,Wi,Rf).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await _u({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Cr(this,Wi,fte).call(this,Cr(this,Wi,dte).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return Es(await Cr(this,Wi,K7).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return $i(await Cr(this,Wi,K7).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return Kr(await Cr(this,Wi,K7).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=Es(n,"position");return Kr(await Cr(this,Wi,K7).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await _u({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),a=Goe.from(e);if(a.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(a,s).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:s}=await _u({network:this.getNetwork(),params:Cr(this,Wi,hte).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await _u({network:this.getNetwork(),params:Cr(this,Wi,Rf).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await _u({network:this.getNetwork(),params:Cr(this,Wi,Rf).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await Cr(this,Wi,Rf).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await _u({network:this.getNetwork(),result:Cr(this,Wi,Rf).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:Kr(n)}async getLogs(e){let n=this._getFilter(e);VI(n)&&(n=await n);const{network:r,params:s}=await _u({network:this.getNetwork(),params:Cr(this,Wi,Rf).call(this,{method:"getLogs",filter:n})});return s.map(a=>this._wrapLog(a,r))}_getProvider(e){Dr(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await wR.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=aa(e);const n=rte(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await wR.getEnsAddress(this),a=await new S9(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(a==null||a===qE)return null;const l=await new S9(a,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(l)!==e?null:l}catch(r){if(ru(r,"BAD_DATA")&&r.value==="0x"||ru(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const s=n??1;return s===0?this.getTransactionReceipt(e):new Promise(async(a,o)=>{let l=null;const c=async u=>{try{const d=await this.getTransactionReceipt(e);if(d!=null&&u-d.blockNumber+1>=s){a(d),l&&(clearTimeout(l),l=null);return}}catch(d){console.log("EEE",d)}this.once("block",c)};r!=null&&(l=setTimeout(()=>{l!=null&&(l=null,this.off("block",c),o(Fo("timeout","TIMEOUT",{reason:"timeout"})))},r)),c(await this.getBlockNumber())})}async waitForBlock(e){Dr(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=He(this,Yh).get(e);n&&(n.timer&&clearTimeout(n.timer),He(this,Yh).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=gb(this,qk)._++,s=()=>{He(this,Yh).delete(r),e()};if(this.paused)He(this,Yh).set(r,{timer:null,func:s,time:n});else{const a=setTimeout(s,n);He(this,Yh).set(r,{timer:a,func:s,time:ZV()})}return r}_forEachSubscriber(e){for(const n of He(this,Au).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new lOe(e.type);case"block":{const n=new C4t(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new S4t(this,e.type);case"event":return new tle(this,e.filter);case"transaction":return new A4t(this,e.hash);case"orphan":return new N4t(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of He(this,Au).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),He(this,ju)!=null&&n.pause(He(this,ju));break}}async on(e,n){const r=await Cr(this,Wi,ZO).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,He(this,ju)!=null&&r.subscriber.pause(He(this,ju))),this}async once(e,n){const r=await Cr(this,Wi,ZO).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,He(this,ju)!=null&&r.subscriber.pause(He(this,ju))),this}async emit(e,...n){const r=await Cr(this,Wi,Y7).call(this,e,n);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:a,once:o})=>{const l=new tIe(this,o?null:a,e);try{a.call(this,...n,l)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),He(this,Au).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await Cr(this,Wi,Y7).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of He(this,Au).values())n+=r.length;return n}async listeners(e){if(e){const r=await Cr(this,Wi,Y7).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of He(this,Au).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await Cr(this,Wi,Y7).call(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:a})=>a).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),He(this,Au).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await Cr(this,Wi,ZO).call(this,e);r&&s.stop(),He(this,Au).delete(n)}else for(const[n,{started:r,subscriber:s}]of He(this,Au))r&&s.stop(),He(this,Au).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return He(this,RS)}destroy(){this.removeAllListeners();for(const e of He(this,Yh).keys())this._clearTimeout(e);Ut(this,RS,!0)}get paused(){return He(this,ju)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(Ut(this,Mg,-1),He(this,ju)!=null){if(He(this,ju)==!!e)return;Dr(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),Ut(this,ju,!!e);for(const n of He(this,Yh).values())n.timer&&clearTimeout(n.timer),n.time=ZV()-n.time}resume(){if(He(this,ju)!=null){this._forEachSubscriber(e=>e.resume()),Ut(this,ju,null);for(const e of He(this,Yh).values()){let n=e.time;n<0&&(n=0),e.time=ZV(),setTimeout(e.func,n)}}}}Au=new WeakMap,yy=new WeakMap,ju=new WeakMap,RS=new WeakMap,Vf=new WeakMap,Jw=new WeakMap,vy=new WeakMap,Mg=new WeakMap,qk=new WeakMap,Yh=new WeakMap,LS=new WeakMap,DS=new WeakMap,Wi=new WeakSet,Rf=async function(e){const n=He(this,DS).cacheTimeout;if(n<0)return await this._perform(e);const r=QO(e.method,e);let s=He(this,vy).get(r);return s||(s=this._perform(e),He(this,vy).set(r,s),setTimeout(()=>{He(this,vy).get(r)===s&&He(this,vy).delete(r)},n)),await s},dte=async function(e,n,r){Dr(r<E4t,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=JE(e);try{return Kr(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(a){if(!this.disableCcipRead&&Ooe(a)&&a.data&&r>=0&&n==="latest"&&s.to!=null&&Co(a.data,0,4)==="0x556f1830"){const o=a.data,l=await Fc(s.to,this);let c;try{c=M4t(Co(a.data,4))}catch(f){Dr(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}Dr(c.sender.toLowerCase()===l.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const u=await this.ccipReadFetch(s,c.calldata,c.urls);Dr(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:a.data,errorArgs:c.errorArgs}});const d={to:l,data:Da([c.selector,O4t([u,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:d});try{const f=await Cr(this,Wi,dte).call(this,d,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},d),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},d),error:f}),f}}throw a}},fte=async function(e){const{value:n}=await _u({network:this.getNetwork(),value:e});return n},K7=async function(e,n,r){let s=this._getAddress(n),a=this._getBlockTag(r);return(typeof s!="string"||typeof a!="string")&&([s,a]=await Promise.all([s,a])),await Cr(this,Wi,fte).call(this,Cr(this,Wi,Rf).call(this,Object.assign(e,{address:s,blockTag:a})))},hte=async function(e,n){if(po(e,32))return await Cr(this,Wi,Rf).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await Cr(this,Wi,Rf).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Y7=async function(e,n){let r=await QV(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await QV({orphan:"drop-log",log:n[0]},this)),He(this,Au).get(r.tag)||null},ZO=async function(e){const n=await QV(e,this),r=n.tag;let s=He(this,Au).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},He(this,Au).set(r,s)),s};function P4t(t,e){try{const n=pte(t,e);if(n)return hR(n)}catch{}return null}function pte(t,e){if(t==="0x")return null;try{const n=$i(Co(t,e,e+32)),r=$i(Co(t,n,n+32));return Co(t,n+32,n+32+r)}catch{}return null}function Bge(t){const e=ul(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function I4t(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const F4t=new Uint8Array([]);function O4t(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(F4t),n+=32;for(let r=0;r<t.length;r++){const s=ms(t[r]);e[r]=Bge(n),e.push(Bge(s.length)),e.push(I4t(s)),n+=32+Math.ceil(s.length/32)*32}return Da(e)}const $ge="0x0000000000000000000000000000000000000000000000000000000000000000";function M4t(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};Dr(A4(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=Co(t,0,32);Dr(Co(n,0,12)===Co($ge,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Co(n,12);try{const r=[],s=$i(Co(t,32,64)),a=$i(Co(t,s,s+32)),o=Co(t,s+32);for(let l=0;l<a;l++){const c=P4t(o,l*32);if(c==null)throw new Error("abort");r.push(c)}e.urls=r}catch{Dr(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=pte(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{Dr(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}Dr(Co(t,100,128)===Co($ge,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Co(t,96,100);try{const r=pte(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{Dr(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function Av(t,e){if(t.provider)return t.provider;Dr(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function Uge(t,e){let n=JE(e);if(n.to!=null&&(n.to=Fc(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Fc(r,t)]).then(([s,a])=>(vn(s.toLowerCase()===a.toLowerCase(),"transaction from mismatch","tx.from",a),s))}else n.from=t.getAddress();return await _u(n)}class nle{constructor(e){$n(this,"provider");$s(this,{provider:e||null})}async getNonce(e){return Av(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Uge(this,e)}async populateTransaction(e){const n=Av(this,"populateTransaction"),r=await Uge(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const s=await this.provider.getNetwork();if(r.chainId!=null){const o=Es(r.chainId);vn(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const a=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||a)?vn(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&a&&vn(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();Dr(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,r.gasPrice!=null){const l=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=l,r.maxPriorityFeePerGas=l}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Dr(!a,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):Dr(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3||r.type===4)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await _u(r)}async populateAuthorization(e){const n=Object.assign({},e);return n.chainId==null&&(n.chainId=(await Av(this,"getNetwork").getNetwork()).chainId),n.nonce==null&&(n.nonce=await this.getNonce()),n}async estimateGas(e){return Av(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Av(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Av(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=Av(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=Goe.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}authorize(e){Dr(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}var BS,JO;const kfe=class kfe extends nle{constructor(n,r){super(r);Rn(this,BS);$n(this,"address");$s(this,{address:n})}async getAddress(){return this.address}connect(n){return new kfe(this.address,n)}async signTransaction(n){Cr(this,BS,JO).call(this,"transactions","signTransaction")}async signMessage(n){Cr(this,BS,JO).call(this,"messages","signMessage")}async signTypedData(n,r,s){Cr(this,BS,JO).call(this,"typed-data","signTypedData")}};BS=new WeakSet,JO=function(n,r){Dr(!1,`VoidSigner cannot sign ${n}`,"UNSUPPORTED_OPERATION",{operation:r})};let mte=kfe;function R4t(t){return JSON.parse(JSON.stringify(t))}var rd,N0,e3,wy,t3,$S,x2,xte,gte;class cOe{constructor(e){Rn(this,x2);Rn(this,rd);Rn(this,N0);Rn(this,e3);Rn(this,wy);Rn(this,t3);Rn(this,$S);Ut(this,rd,e),Ut(this,N0,null),Ut(this,e3,Cr(this,x2,xte).bind(this)),Ut(this,wy,!1),Ut(this,t3,null),Ut(this,$S,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){He(this,wy)||(Ut(this,wy,!0),Cr(this,x2,xte).call(this,-2))}stop(){He(this,wy)&&(Ut(this,wy,!1),Ut(this,$S,!0),Cr(this,x2,gte).call(this),He(this,rd).off("block",He(this,e3)))}pause(e){e&&Cr(this,x2,gte).call(this),He(this,rd).off("block",He(this,e3))}resume(){this.start()}}rd=new WeakMap,N0=new WeakMap,e3=new WeakMap,wy=new WeakMap,t3=new WeakMap,$S=new WeakMap,x2=new WeakSet,xte=async function(e){try{He(this,N0)==null&&Ut(this,N0,this._subscribe(He(this,rd)));let n=null;try{n=await He(this,N0)}catch(a){if(!ru(a,"UNSUPPORTED_OPERATION")||a.operation!=="eth_newFilter")throw a}if(n==null){Ut(this,N0,null),He(this,rd)._recoverSubscriber(this,this._recover(He(this,rd)));return}const r=await He(this,rd).getNetwork();if(He(this,t3)||Ut(this,t3,r),He(this,t3).chainId!==r.chainId)throw new Error("chaid changed");if(He(this,$S))return;const s=await He(this,rd).send("eth_getFilterChanges",[n]);await this._emitResults(He(this,rd),s)}catch(n){console.log("@TODO",n)}He(this,rd).once("block",He(this,e3))},gte=function(){const e=He(this,N0);e&&(Ut(this,N0,null),e.then(n=>{He(this,rd).destroyed||He(this,rd).send("eth_uninstallFilter",[n])}))};var n3;class L4t extends cOe{constructor(n,r){super(n);Rn(this,n3);Ut(this,n3,R4t(r))}_recover(n){return new tle(n,He(this,n3))}async _subscribe(n){return await n.send("eth_newFilter",[He(this,n3)])}async _emitResults(n,r){for(const s of r)n.emit(He(this,n3),n._wrapLog(s,n._network))}}n3=new WeakMap;class D4t extends cOe{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const B4t="bigint,boolean,function,number,string,symbol".split(/,/g);function eM(t){if(t==null||B4t.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(eM);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function $4t(t){return new Promise(e=>{setTimeout(e,t)})}function aC(t){return t&&t.toLowerCase()}function zge(t){return t&&typeof t.pollingInterval=="number"}const uOe={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class JV extends nle{constructor(n,r){super(n);$n(this,"address");r=aa(r),$s(this,{address:r})}connect(n){Dr(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=eM(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const l=await Fc(o,this.provider);vn(l!=null&&l.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=l})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Fc(o,this.provider)})())}s.length&&await Promise.all(s);const a=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[a])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(n);return await new Promise((a,o)=>{const l=[1e3,100];let c=0;const u=async()=>{try{const d=await this.provider.getTransaction(s);if(d!=null){a(d.replaceableTransaction(r));return}}catch(d){if(ru(d,"CANCELLED")||ru(d,"BAD_DATA")||ru(d,"NETWORK_ERROR")||ru(d,"UNSUPPORTED_OPERATION")){d.info==null&&(d.info={}),d.info.sendTransactionHash=s,o(d);return}if(ru(d,"INVALID_ARGUMENT")&&(c++,d.info==null&&(d.info={}),d.info.sendTransactionHash=s,c>10)){o(d);return}this.provider.emit("error",Fo("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:d}))}this.provider._setTimeout(()=>{u()},l.pop()||4e3)};u()})}async signTransaction(n){const r=eM(n);if(r.from){const a=await Fc(r.from,this.provider);vn(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(n){const r=typeof n=="string"?gd(n):n;return await this.provider.send("personal_sign",[Kr(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const a=eM(s),o=await hN.resolveNames(n,r,a,async l=>{const c=await Fc(l);return vn(c!=null,"TypedData does not support null address","value",l),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(hN.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?gd(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Kr(r)])}}var r3,US,Rg,A0,nm,Xh,Kd,Gk,bte;class U4t extends T4t{constructor(n,r){super(n,r);Rn(this,Gk);Rn(this,r3);Rn(this,US);Rn(this,Rg);Rn(this,A0);Rn(this,nm);Rn(this,Xh);Rn(this,Kd);Ut(this,US,1),Ut(this,r3,Object.assign({},uOe,r||{})),Ut(this,Rg,[]),Ut(this,A0,null),Ut(this,Xh,null),Ut(this,Kd,null);{let a=null;const o=new Promise(l=>{a=l});Ut(this,nm,{promise:o,resolve:a})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(vn(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&Ut(this,Xh,jy.from(n))):s&&(vn(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),Ut(this,Xh,s))}_getOption(n){return He(this,r3)[n]}get _network(){return Dr(He(this,Xh),"network is not available yet","NETWORK_ERROR"),He(this,Xh)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&Es(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const a=await this.getFeeData();a.maxFeePerGas==null&&a.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(He(this,Xh))return He(this,Xh)}else return n;return He(this,Kd)?await He(this,Kd):this.ready?(Ut(this,Kd,(async()=>{try{const r=jy.from(Es(await this.send("eth_chainId",[])));return Ut(this,Kd,null),r}catch(r){throw Ut(this,Kd,null),r}})()),await He(this,Kd)):(Ut(this,Kd,(async()=>{const r={id:gb(this,US)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],Ut(this,Kd,null)}catch(a){throw Ut(this,Kd,null),this.emit("debug",{action:"receiveRpcError",error:a}),a}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return jy.from(Es(s.result));throw this.getRpcError(r,s)})()),await He(this,Kd))}_start(){He(this,nm)==null||He(this,nm).resolve==null||(He(this,nm).resolve(),Ut(this,nm,null),(async()=>{for(;He(this,Xh)==null&&!this.destroyed;)try{Ut(this,Xh,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Fo("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await $4t(1e3)}Cr(this,Gk,bte).call(this)})())}async _waitUntilReady(){if(He(this,nm)!=null)return await He(this,nm).promise}_getSubscriber(n){return n.type==="pending"?new D4t(this):n.type==="event"?this._getOption("polling")?new tle(this,n.filter):new L4t(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new lOe("orphan"):super._getSubscriber(n)}get ready(){return He(this,nm)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(n[s]==null)return;let a=s;s==="gasLimit"&&(a="gas"),r[a]=cm(Es(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=Kr(n[s]))}),n.accessList&&(r.accessList=k5(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),n.authorizationList&&(r.authorizationList=n.authorizationList.map(s=>{const a=fFe(s);return{address:a.address,nonce:cm(a.nonce),chainId:cm(a.chainId),yParity:cm(a.signature.yParity),r:cm(a.signature.r),s:cm(a.signature.s)}})),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[aC(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[aC(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[aC(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[aC(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map(aC):n.filter.address=aC(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:s}=n,{error:a}=r;if(s==="eth_estimateGas"&&a.message){const c=a.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Fo("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:a}});if(c.match(/nonce/i)&&c.match(/too low/i))return Fo("nonce has already been used","NONCE_EXPIRED",{transaction:n.params[0],info:{payload:n,error:a}})}if(s==="eth_call"||s==="eth_estimateGas"){const c=yte(a),u=ZE.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",n.params[0],c?c.data:null);return u.info={error:a,payload:n},u}const o=JSON.stringify(H4t(a));if(typeof a.message=="string"&&a.message.match(/user denied|ethers-user-denied/i))return Fo("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:n,error:a}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const c=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Fo("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:a}});if(o.match(/nonce/i)&&o.match(/too low/i))return Fo("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:a}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Fo("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:a}});if(o.match(/only replay-protected/i))return Fo("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:c,info:{error:a}}})}let l=!!o.match(/the method .* does not exist/i);return l||a&&a.details&&a.details.startsWith("Unauthorized method:")&&(l=!0),l?Fo("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:a,payload:n}}):Fo("could not coalesce error","UNKNOWN_ERROR",{error:a,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(Fo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=gb(this,US)._++,a=new Promise((o,l)=>{He(this,Rg).push({resolve:o,reject:l,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return Cr(this,Gk,bte).call(this),a}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const a=await r;if(n>=a.length)throw new Error("no such account");return new JV(this,a[n])}const{accounts:s}=await _u({network:this.getNetwork(),accounts:r});n=aa(n);for(const a of s)if(aa(a)===n)return new JV(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new JV(this,r))}destroy(){He(this,A0)&&(clearTimeout(He(this,A0)),Ut(this,A0,null));for(const{payload:n,reject:r}of He(this,Rg))r(Fo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));Ut(this,Rg,[]),super.destroy()}}r3=new WeakMap,US=new WeakMap,Rg=new WeakMap,A0=new WeakMap,nm=new WeakMap,Xh=new WeakMap,Kd=new WeakMap,Gk=new WeakSet,bte=function(){if(He(this,A0))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");Ut(this,A0,setTimeout(()=>{Ut(this,A0,null);const r=He(this,Rg);for(Ut(this,Rg,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==He(this,r3).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>He(this,r3).batchMaxSize){r.unshift(s.pop());break}(async()=>{const a=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:a});try{const o=await this._send(a);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:l,reject:c,payload:u}of s){if(this.destroyed){c(Fo("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const d=o.filter(f=>f.id===u.id)[0];if(d==null){const f=Fo("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),c(f);continue}if("error"in d){c(this.getRpcError(u,d));continue}l(d.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:l}of s)l(o)}})()}},n))};var Cy;class z4t extends U4t{constructor(n,r){super(n,r);Rn(this,Cy);let s=this._getOption("pollingInterval");s==null&&(s=uOe.pollingInterval),Ut(this,Cy,s)}_getSubscriber(n){const r=super._getSubscriber(n);return zge(r)&&(r.pollingInterval=He(this,Cy)),r}get pollingInterval(){return He(this,Cy)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");Ut(this,Cy,n),this._forEachSubscriber(r=>{zge(r)&&(r.pollingInterval=He(this,Cy))})}}Cy=new WeakMap;function yte(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&po(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=yte(t[e]);if(n)return n}return null}if(typeof t=="string")try{return yte(JSON.parse(t))}catch{}return null}function vte(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)vte(t[n],e);if(typeof t=="string")try{return vte(JSON.parse(t),e)}catch{}}}function H4t(t){const e=[];return vte(t,e),e}var zS,HS;const iw=class iw extends z4t{constructor(n,r,s){const a=Object.assign({},s??{},{batchMaxCount:1});vn(n&&n.request,"invalid EIP-1193 provider","ethereum",n);super(r,a);Rn(this,zS);Rn(this,HS);Ut(this,HS,null),s&&s.providerInfo&&Ut(this,HS,s.providerInfo),Ut(this,zS,async(o,l)=>{const c={method:o,params:l};this.emit("debug",{action:"sendEip1193Request",payload:c});try{const u=await n.request(c);return this.emit("debug",{action:"receiveEip1193Result",result:u}),u}catch(u){const d=new Error(u.message);throw d.code=u.code,d.data=u.data,d.payload=c,this.emit("debug",{action:"receiveEip1193Error",error:d}),d}})}get providerInfo(){return He(this,HS)}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){vn(!Array.isArray(n),"EIP-1193 does not support batch request","payload",n);try{const r=await He(this,zS).call(this,n.method,n.params||[]);return[{id:n.id,result:r}]}catch(r){return[{id:n.id,error:{code:r.code,data:r.data,message:r.message}}]}}getRpcError(n,r){switch(r=JSON.parse(JSON.stringify(r)),r.error.code||-1){case 4001:r.error.message=`ethers-user-denied: ${r.error.message}`;break;case 4200:r.error.message=`ethers-unsupported: ${r.error.message}`;break}return super.getRpcError(n,r)}async hasSigner(n){n==null&&(n=0);const r=await this.send("eth_accounts",[]);return typeof n=="number"?r.length>n:(n=n.toLowerCase(),r.filter(s=>s.toLowerCase()===n).length!==0)}async getSigner(n){if(n==null&&(n=0),!await this.hasSigner(n))try{await He(this,zS).call(this,"eth_requestAccounts",[])}catch(r){const s=r.payload;throw this.getRpcError(s,{id:s.id,error:r})}return await super.getSigner(n)}static async discover(n){if(n==null&&(n={}),n.provider)return new iw(n.provider);const r=n.window?n.window:typeof window<"u"?window:null;if(r==null)return null;const s=n.anyProvider;if(s&&r.ethereum)return new iw(r.ethereum);if(!("addEventListener"in r&&"dispatchEvent"in r&&"removeEventListener"in r))return null;const a=n.timeout?n.timeout:300;return a===0?null:await new Promise((o,l)=>{let c=[];const u=x=>{c.push(x.detail),s&&d()},d=()=>{if(clearTimeout(f),c.length)if(n&&n.filter){const x=n.filter(c.map(g=>Object.assign({},g.info)));if(x==null)o(null);else if(x instanceof iw)o(x);else{let g=null;if(x.uuid&&(g=c.filter(v=>x.uuid===v.info.uuid)[0]),g){const{provider:y,info:v}=g;o(new iw(y,void 0,{providerInfo:v}))}else l(Fo("filter returned unknown info","UNSUPPORTED_OPERATION",{value:x}))}}else{const{provider:x,info:g}=c[0];o(new iw(x,void 0,{providerInfo:g}))}else o(null);r.removeEventListener("eip6963:announceProvider",u)},f=setTimeout(()=>{d()},a);r.addEventListener("eip6963:announceProvider",u),r.dispatchEvent(new Event("eip6963:requestProvider"))})}};zS=new WeakMap,HS=new WeakMap;let CR=iw;var VS;const Tfe=class Tfe extends nle{constructor(n,r){super(r);$n(this,"address");Rn(this,VS);vn(n&&typeof n.sign=="function","invalid private key","privateKey","[ REDACTED ]"),Ut(this,VS,n);const s=ET(this.signingKey.publicKey);$s(this,{address:s})}get signingKey(){return He(this,VS)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(n){return new Tfe(He(this,VS),n)}async signTransaction(n){n=JE(n);const{to:r,from:s}=await _u({to:n.to?Fc(n.to,this):void 0,from:n.from?Fc(n.from,this):void 0});r!=null&&(n.to=r),s!=null&&(n.from=s),n.from!=null&&(vn(aa(n.from)===this.address,"transaction from address mismatch","tx.from",n.from),delete n.from);const a=Goe.from(n);return a.signature=this.signingKey.sign(a.unsignedHash),a.serialized}async signMessage(n){return this.signMessageSync(n)}signMessageSync(n){return this.signingKey.sign(NCt(n)).serialized}authorizeSync(n){vn(typeof n.address=="string","invalid address for authorizeSync","auth.address",n);const r=this.signingKey.sign(B6t(n));return Object.assign({},{address:aa(n.address),nonce:Es(n.nonce||0),chainId:Es(n.chainId||0)},{signature:r})}async authorize(n){return n=Object.assign({},n,{address:await Fc(n.address,this)}),this.authorizeSync(await this.populateAuthorization(n))}async signTypedData(n,r,s){const a=await hN.resolveNames(n,r,s,async o=>{Dr(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const l=await this.provider.resolveName(o);return Dr(l!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),l});return this.signingKey.sign(hN.hash(a.domain,r,a.value)).serialized}};VS=new WeakMap;let SR=Tfe;const NR=" !#$%&'()*+,-./<=>?@[]^_`{|}~",V4t=/^[a-z]*$/i;function Hge(t,e){let n=97;return t.reduce((r,s)=>(s===e?n++:s.match(V4t)?r.push(String.fromCharCode(n)+s):(n=97,r.push(s)),r),[])}function W4t(t,e){for(let s=NR.length-1;s>=0;s--)t=t.split(NR[s]).join(e.substring(2*s,2*s+2));const n=[],r=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(s,a,o,l)=>{if(o)for(let c=parseInt(o);c>=0;c--)n.push(";");else n.push(a.toLowerCase());return""});if(r)throw new Error(`leftovers: ${JSON.stringify(r)}`);return Hge(Hge(n,";"),":")}function q4t(t){return vn(t[0]==="0","unsupported auwl data","data",t),W4t(t.substring(1+2*NR.length),t.substring(1,1+2*NR.length))}class G4t{constructor(e){$n(this,"locale");$s(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var WS,Kk,s3,Yk,wte;class K4t extends G4t{constructor(n,r,s){super(n);Rn(this,Yk);Rn(this,WS);Rn(this,Kk);Rn(this,s3);Ut(this,WS,r),Ut(this,Kk,s),Ut(this,s3,null)}get _data(){return He(this,WS)}_decodeWords(){return q4t(He(this,WS))}getWord(n){const r=Cr(this,Yk,wte).call(this);return vn(n>=0&&n<r.length,`invalid word index: ${n}`,"index",n),r[n]}getWordIndex(n){return Cr(this,Yk,wte).call(this).indexOf(n)}}WS=new WeakMap,Kk=new WeakMap,s3=new WeakMap,Yk=new WeakSet,wte=function(){if(He(this,s3)==null){const n=this._decodeWords();if(v1(n.join(`
`)+`
`)!==He(this,Kk))throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);Ut(this,s3,n)}return He(this,s3)};const Y4t="0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO",X4t="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let eW=null;class X3 extends K4t{constructor(){super("en",Y4t,X4t)}static wordlist(){return eW==null&&(eW=new X3),eW}}function dOe(t){return(1<<t)-1<<8-t&255}function Q4t(t){return(1<<t)-1&255}function tW(t,e){XPe("NFKD"),e==null&&(e=X3.wordlist());const n=e.split(t);vn(n.length%3===0&&n.length>=12&&n.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const r=new Uint8Array(Math.ceil(11*n.length/8));let s=0;for(let u=0;u<n.length;u++){let d=e.getWordIndex(n[u].normalize("NFKD"));vn(d>=0,`invalid mnemonic word at index ${u}`,"mnemonic","[ REDACTED ]");for(let f=0;f<11;f++)d&1<<10-f&&(r[s>>3]|=1<<7-s%8),s++}const a=32*n.length/3,o=n.length/3,l=dOe(o),c=ms(xp(r.slice(0,a/8)))[0]&l;return vn(c===(r[r.length-1]&l),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),Kr(r.slice(0,a/8))}function nW(t,e){vn(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=X3.wordlist());const n=[0];let r=11;for(let o=0;o<t.length;o++)r>8?(n[n.length-1]<<=8,n[n.length-1]|=t[o],r-=8):(n[n.length-1]<<=r,n[n.length-1]|=t[o]>>8-r,n.push(t[o]&Q4t(8-r)),r+=3);const s=t.length/4,a=parseInt(xp(t).substring(2,4),16)&dOe(s);return n[n.length-1]<<=s,n[n.length-1]|=a>>8-s,e.join(n.map(o=>e.getWord(o)))}const rW={};class mN{constructor(e,n,r,s,a){$n(this,"phrase");$n(this,"password");$n(this,"wordlist");$n(this,"entropy");s==null&&(s=""),a==null&&(a=X3.wordlist()),_5(e,rW,"Mnemonic"),$s(this,{phrase:r,password:s,wordlist:a,entropy:n})}computeSeed(){const e=gd("mnemonic"+this.password,"NFKD");return N2(gd(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,n,r){const s=tW(e,r);return e=nW(ms(s),r),new mN(rW,s,e,n,r)}static fromEntropy(e,n,r){const s=ms(e,"entropy"),a=nW(s,r);return new mN(rW,Kr(s),a,n,r)}static entropyToPhrase(e,n){const r=ms(e,"entropy");return nW(r,n)}static phraseToEntropy(e,n){return tW(e,n)}static isValidMnemonic(e,n){try{return tW(e,n),!0}catch{}return!1}}/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */var Kc=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},sW=function(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n},tM,Lh,d0;const Z4t={16:10,24:12,32:14},J4t=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Eh=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],WI=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],eSt=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],tSt=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],nSt=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],rSt=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],sSt=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],iSt=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],aSt=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],oSt=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],lSt=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],cSt=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],uSt=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],dSt=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function iW(t){const e=[];for(let n=0;n<t.length;n+=4)e.push(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]);return e}class rle{get key(){return Kc(this,tM,"f").slice()}constructor(e){if(tM.set(this,void 0),Lh.set(this,void 0),d0.set(this,void 0),!(this instanceof rle))throw Error("AES must be instanitated with `new`");sW(this,tM,new Uint8Array(e),"f");const n=Z4t[this.key.length];if(n==null)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");sW(this,d0,[],"f"),sW(this,Lh,[],"f");for(let d=0;d<=n;d++)Kc(this,d0,"f").push([0,0,0,0]),Kc(this,Lh,"f").push([0,0,0,0]);const r=(n+1)*4,s=this.key.length/4,a=iW(this.key);let o;for(let d=0;d<s;d++)o=d>>2,Kc(this,d0,"f")[o][d%4]=a[d],Kc(this,Lh,"f")[n-o][d%4]=a[d];let l=0,c=s,u;for(;c<r;){if(u=a[s-1],a[0]^=Eh[u>>16&255]<<24^Eh[u>>8&255]<<16^Eh[u&255]<<8^Eh[u>>24&255]^J4t[l]<<24,l+=1,s!=8)for(let g=1;g<s;g++)a[g]^=a[g-1];else{for(let g=1;g<s/2;g++)a[g]^=a[g-1];u=a[s/2-1],a[s/2]^=Eh[u&255]^Eh[u>>8&255]<<8^Eh[u>>16&255]<<16^Eh[u>>24&255]<<24;for(let g=s/2+1;g<s;g++)a[g]^=a[g-1]}let d=0,f,x;for(;d<s&&c<r;)f=c>>2,x=c%4,Kc(this,d0,"f")[f][x]=a[d],Kc(this,Lh,"f")[n-f][x]=a[d++],c++}for(let d=1;d<n;d++)for(let f=0;f<4;f++)u=Kc(this,Lh,"f")[d][f],Kc(this,Lh,"f")[d][f]=lSt[u>>24&255]^cSt[u>>16&255]^uSt[u>>8&255]^dSt[u&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const n=Kc(this,d0,"f").length-1,r=[0,0,0,0];let s=iW(e);for(let l=0;l<4;l++)s[l]^=Kc(this,d0,"f")[0][l];for(let l=1;l<n;l++){for(let c=0;c<4;c++)r[c]=eSt[s[c]>>24&255]^tSt[s[(c+1)%4]>>16&255]^nSt[s[(c+2)%4]>>8&255]^rSt[s[(c+3)%4]&255]^Kc(this,d0,"f")[l][c];s=r.slice()}const a=new Uint8Array(16);let o=0;for(let l=0;l<4;l++)o=Kc(this,d0,"f")[n][l],a[4*l]=(Eh[s[l]>>24&255]^o>>24)&255,a[4*l+1]=(Eh[s[(l+1)%4]>>16&255]^o>>16)&255,a[4*l+2]=(Eh[s[(l+2)%4]>>8&255]^o>>8)&255,a[4*l+3]=(Eh[s[(l+3)%4]&255]^o)&255;return a}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const n=Kc(this,Lh,"f").length-1,r=[0,0,0,0];let s=iW(e);for(let l=0;l<4;l++)s[l]^=Kc(this,Lh,"f")[0][l];for(let l=1;l<n;l++){for(let c=0;c<4;c++)r[c]=sSt[s[c]>>24&255]^iSt[s[(c+3)%4]>>16&255]^aSt[s[(c+2)%4]>>8&255]^oSt[s[(c+1)%4]&255]^Kc(this,Lh,"f")[l][c];s=r.slice()}const a=new Uint8Array(16);let o=0;for(let l=0;l<4;l++)o=Kc(this,Lh,"f")[n][l],a[4*l]=(WI[s[l]>>24&255]^o>>24)&255,a[4*l+1]=(WI[s[(l+3)%4]>>16&255]^o>>16)&255,a[4*l+2]=(WI[s[(l+2)%4]>>8&255]^o>>8)&255,a[4*l+3]=(WI[s[(l+1)%4]&255]^o)&255;return a}}tM=new WeakMap,Lh=new WeakMap,d0=new WeakMap;class fOe{constructor(e,n,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new rle(n)},name:{enumerable:!0,value:e}})}}var qI=function(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n},oC=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},X7,hg;class sle extends fOe{constructor(e,n){if(super("ECC",e,sle),X7.set(this,void 0),hg.set(this,void 0),n){if(n.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");qI(this,X7,new Uint8Array(n),"f")}else qI(this,X7,new Uint8Array(16),"f");qI(this,hg,this.iv,"f")}get iv(){return new Uint8Array(oC(this,X7,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let s=0;s<16;s++)oC(this,hg,"f")[s]^=e[r+s];qI(this,hg,this.aes.encrypt(oC(this,hg,"f")),"f"),n.set(oC(this,hg,"f"),r)}return n}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const n=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const s=this.aes.decrypt(e.subarray(r,r+16));for(let a=0;a<16;a++)n[r+a]=s[a]^oC(this,hg,"f")[a],oC(this,hg,"f")[a]=e[r+a]}return n}}X7=new WeakMap,hg=new WeakMap;var lC=function(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n},_h=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Q7,Vv,Dh;class xN extends fOe{constructor(e,n){super("CTR",e,xN),Q7.set(this,void 0),Vv.set(this,void 0),Dh.set(this,void 0),lC(this,Dh,new Uint8Array(16),"f"),_h(this,Dh,"f").fill(0),lC(this,Q7,_h(this,Dh,"f"),"f"),lC(this,Vv,16,"f"),n==null&&(n=1),typeof n=="number"?this.setCounterValue(n):this.setCounterBytes(n)}get counter(){return new Uint8Array(_h(this,Dh,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let n=15;n>=0;--n)_h(this,Dh,"f")[n]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");_h(this,Dh,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(_h(this,Dh,"f")[e]===255)_h(this,Dh,"f")[e]=0;else{_h(this,Dh,"f")[e]++;break}}encrypt(e){var n,r;const s=new Uint8Array(e);for(let a=0;a<s.length;a++)_h(this,Vv,"f")===16&&(lC(this,Q7,this.aes.encrypt(_h(this,Dh,"f")),"f"),lC(this,Vv,0,"f"),this.increment()),s[a]^=_h(this,Q7,"f")[lC(this,Vv,(r=_h(this,Vv,"f"),n=r++,r),"f"),n];return s}decrypt(e){return this.encrypt(e)}}Q7=new WeakMap,Vv=new WeakMap,Dh=new WeakMap;function fSt(t){if(t.length<16)throw new TypeError("PKCS#7 invalid length");const e=t[t.length-1];if(e>16)throw new TypeError("PKCS#7 padding byte out of range");const n=t.length-e;for(let r=0;r<e;r++)if(t[n+r]!==e)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(t.subarray(0,n))}function hOe(t){return typeof t=="string"&&!t.startsWith("0x")&&(t="0x"+t),su(t)}function J8(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function PT(t){return typeof t=="string"?gd(t,"NFKC"):su(t)}function vl(t,e){const n=e.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);vn(n!=null,"invalid path","path",e);const r=n[1],s=n[3],a=n[4]==="!";let o=t;for(const l of r.toLowerCase().split(".")){if(Array.isArray(o)){if(!l.match(/^[0-9]+$/))break;o=o[parseInt(l)]}else if(typeof o=="object"){let c=null;for(const u in o)if(u.toLowerCase()===l){c=o[u];break}o=c}else o=null;if(o==null)break}if(vn(!a||o!=null,"missing required value","path",r),s&&o!=null){if(s==="int"){if(typeof o=="string"&&o.match(/^-?[0-9]+$/))return parseInt(o);if(Number.isSafeInteger(o))return o}if(s==="number"&&typeof o=="string"&&o.match(/^-?[0-9.]*$/))return parseFloat(o);if(s==="data"&&typeof o=="string")return hOe(o);if(s==="array"&&Array.isArray(o)||s===typeof o)return o;vn(!1,`wrong type found for ${s} `,"path",r)}return o}const pOe="m/44'/60'/0'/0/0";function Vge(t){try{const e=JSON.parse(t);if((e.version!=null?parseInt(e.version):0)===3)return!0}catch{}return!1}function hSt(t,e,n){if(vl(t,"crypto.cipher:string")==="aes-128-ctr"){const s=vl(t,"crypto.cipherparams.iv:data!"),a=new xN(e,s);return Kr(a.decrypt(n))}Dr(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}function AR(t,e){const n=ms(e),r=vl(t,"crypto.ciphertext:data!"),s=Kr(ho(Da([n.slice(16,32),r]))).substring(2);vn(s===vl(t,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const a=hSt(t,n.slice(0,16),r),o=ET(a);if(t.address){let u=t.address.toLowerCase();u.startsWith("0x")||(u="0x"+u),vn(aa(u)===o,"keystore address/privateKey mismatch","address",t.address)}const l={address:o,privateKey:a};if(vl(t,"x-ethers.version:string")==="0.1"){const u=n.slice(32,64),d=vl(t,"x-ethers.mnemonicCiphertext:data!"),f=vl(t,"x-ethers.mnemonicCounter:data!"),x=new xN(u,f);l.mnemonic={path:vl(t,"x-ethers.path:string")||pOe,locale:vl(t,"x-ethers.locale:string")||"en",entropy:Kr(ms(x.decrypt(d)))}}return l}function mOe(t){const e=vl(t,"crypto.kdf:string");if(e&&typeof e=="string"){if(e.toLowerCase()==="scrypt"){const n=vl(t,"crypto.kdfparams.salt:data!"),r=vl(t,"crypto.kdfparams.n:int!"),s=vl(t,"crypto.kdfparams.r:int!"),a=vl(t,"crypto.kdfparams.p:int!");vn(r>0&&(r&r-1)===0,"invalid kdf.N","kdf.N",r),vn(s>0&&a>0,"invalid kdf","kdf",e);const o=vl(t,"crypto.kdfparams.dklen:int!");return vn(o===32,"invalid kdf.dklen","kdf.dflen",o),{name:"scrypt",salt:n,N:r,r:s,p:a,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const n=vl(t,"crypto.kdfparams.salt:data!"),r=vl(t,"crypto.kdfparams.prf:string!"),s=r.split("-").pop();vn(s==="sha256"||s==="sha512","invalid kdf.pdf","kdf.pdf",r);const a=vl(t,"crypto.kdfparams.c:int!"),o=vl(t,"crypto.kdfparams.dklen:int!");return vn(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:n,count:a,dkLen:o,algorithm:s}}}vn(!1,"unsupported key-derivation function","kdf",e)}function pSt(t,e){const n=JSON.parse(t),r=PT(e),s=mOe(n);if(s.name==="pbkdf2"){const{salt:f,count:x,dkLen:g,algorithm:y}=s,v=N2(r,f,x,g,y);return AR(n,v)}Dr(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:a,N:o,r:l,p:c,dkLen:u}=s,d=lj(r,a,o,l,c,u);return AR(n,d)}function Wge(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function mSt(t,e,n){const r=JSON.parse(t),s=PT(e),a=mOe(r);if(a.name==="pbkdf2"){n&&(n(0),await Wge(0));const{salt:x,count:g,dkLen:y,algorithm:v}=a,C=N2(s,x,g,y,v);return n&&(n(1),await Wge(0)),AR(r,C)}Dr(a.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:a});const{salt:o,N:l,r:c,p:u,dkLen:d}=a,f=await oj(s,o,l,c,u,d,n);return AR(r,f)}function xOe(t){const e=t.salt!=null?ms(t.salt,"options.salt"):n1(32);let n=1<<17,r=8,s=1;return t.scrypt&&(t.scrypt.N&&(n=t.scrypt.N),t.scrypt.r&&(r=t.scrypt.r),t.scrypt.p&&(s=t.scrypt.p)),vn(typeof n=="number"&&n>0&&Number.isSafeInteger(n)&&(BigInt(n)&BigInt(n-1))===BigInt(0),"invalid scrypt N parameter","options.N",n),vn(typeof r=="number"&&r>0&&Number.isSafeInteger(r),"invalid scrypt r parameter","options.r",r),vn(typeof s=="number"&&s>0&&Number.isSafeInteger(s),"invalid scrypt p parameter","options.p",s),{name:"scrypt",dkLen:32,salt:e,N:n,r,p:s}}function gOe(t,e,n,r){const s=ms(n.privateKey,"privateKey"),a=r.iv!=null?ms(r.iv,"options.iv"):n1(16);vn(a.length===16,"invalid options.iv length","options.iv",r.iv);const o=r.uuid!=null?ms(r.uuid,"options.uuid"):n1(16);vn(o.length===16,"invalid options.uuid length","options.uuid",r.iv);const l=t.slice(0,16),c=t.slice(16,32),u=new xN(l,a),d=ms(u.encrypt(s)),f=ho(Da([c,d])),x={address:n.address.substring(2).toLowerCase(),id:m3t(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Kr(a).substring(2)},ciphertext:Kr(d).substring(2),kdf:"scrypt",kdfparams:{salt:Kr(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:f.substring(2)}};if(n.mnemonic){const g=r.client!=null?r.client:`ethers/${KPe}`,y=n.mnemonic.path||pOe,v=n.mnemonic.locale||"en",C=t.slice(32,64),N=ms(n.mnemonic.entropy,"account.mnemonic.entropy"),P=n1(16),T=new xN(C,P),M=ms(T.encrypt(N)),F=new Date,L="UTC--"+(F.getUTCFullYear()+"-"+J8(F.getUTCMonth()+1,2)+"-"+J8(F.getUTCDate(),2)+"T"+J8(F.getUTCHours(),2)+"-"+J8(F.getUTCMinutes(),2)+"-"+J8(F.getUTCSeconds(),2)+".0Z")+"--"+x.address;x["x-ethers"]={client:g,gethFilename:L,path:y,locale:v,mnemonicCounter:Kr(P).substring(2),mnemonicCiphertext:Kr(M).substring(2),version:"0.1"}}return JSON.stringify(x)}function bOe(t,e,n){n==null&&(n={});const r=PT(e),s=xOe(n),a=lj(r,s.salt,s.N,s.r,s.p,64);return gOe(ms(a),s,t,n)}async function yOe(t,e,n){n==null&&(n={});const r=PT(e),s=xOe(n),a=await oj(r,s.salt,s.N,s.r,s.p,64,n.progressCallback);return gOe(ms(a),s,t,n)}const aW="m/44'/60'/0'/0/0",xSt=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),k4=2147483648,gSt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),bSt="0123456789abcdef";function jR(t,e){let n="";for(;t;)n=bSt[t%16]+n,t=Math.trunc(t/16);for(;n.length<e*2;)n="0"+n;return"0x"+n}function Cte(t){const e=ms(t),n=Co(xp(xp(e)),0,4),r=Da([e,n]);return eIe(r)}const f0={};function vOe(t,e,n,r){const s=new Uint8Array(37);t&k4?(Dr(r!=null,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),s.set(ms(r),1)):s.set(ms(n));for(let o=24;o>=0;o-=8)s[33+(o>>3)]=t>>24-o&255;const a=ms(ij("sha512",e,s));return{IL:a.slice(0,32),IR:a.slice(32)}}function wOe(t,e){const n=e.split("/");vn(n.length>0,"invalid path","path",e),n[0]==="m"&&(vn(t.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${t.depth}`,"path",e),n.shift());let r=t;for(let s=0;s<n.length;s++){const a=n[s];if(a.match(/^[0-9]+'$/)){const o=parseInt(a.substring(0,a.length-1));vn(o<k4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(k4+o)}else if(a.match(/^[0-9]+$/)){const o=parseInt(a);vn(o<k4,"invalid path index",`path[${s}]`,a),r=r.deriveChild(o)}else vn(!1,"invalid path component",`path[${s}]`,a)}return r}var Xk,Ste,i3,Z7;const qp=class qp extends SR{constructor(n,r,s,a,o,l,c,u,d){super(r,d);Rn(this,Xk);$n(this,"publicKey");$n(this,"fingerprint");$n(this,"parentFingerprint");$n(this,"mnemonic");$n(this,"chainCode");$n(this,"path");$n(this,"index");$n(this,"depth");_5(n,f0,"HDNodeWallet"),$s(this,{publicKey:r.compressedPublicKey});const f=Co(aj(xp(this.publicKey)),0,4);$s(this,{parentFingerprint:s,fingerprint:f,chainCode:a,path:o,index:l,depth:c}),$s(this,{mnemonic:u})}connect(n){return new qp(f0,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,n)}async encrypt(n,r){return await yOe(Cr(this,Xk,Ste).call(this),n,{progressCallback:r})}encryptSync(n){return bOe(Cr(this,Xk,Ste).call(this),n)}get extendedKey(){return Dr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Cte(Da(["0x0488ADE4",jR(this.depth,1),this.parentFingerprint,jR(this.index,4),this.chainCode,Da(["0x00",this.privateKey])]))}hasPath(){return this.path!=null}neuter(){return new n_(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(n){const r=$i(n,"index");vn(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&k4&&(s+="'"));const{IR:a,IL:o}=vOe(r,this.chainCode,this.publicKey,this.privateKey),l=new G0(b1((F$(o)+BigInt(this.privateKey))%gSt,32));return new qp(f0,l,this.fingerprint,Kr(a),s,r,this.depth+1,this.mnemonic,this.provider)}derivePath(n){return wOe(this,n)}static fromExtendedKey(n){const r=ul(Jwt(n));vn(r.length===82||Cte(r.slice(0,78))===n,"invalid extended key","extendedKey","[ REDACTED ]");const s=r[4],a=Kr(r.slice(5,9)),o=parseInt(Kr(r.slice(9,13)).substring(2),16),l=Kr(r.slice(13,45)),c=r.slice(45,78);switch(Kr(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const u=Kr(c);return new n_(f0,ET(u),u,a,l,null,o,s,null)}case"0x0488ade4":case"0x04358394 ":if(c[0]!==0)break;return new qp(f0,new G0(c.slice(1)),a,l,null,o,s,null,null)}vn(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(n,r,s){var o;n==null&&(n=""),r==null&&(r=aW),s==null&&(s=X3.wordlist());const a=mN.fromEntropy(n1(16),n,s);return Cr(o=qp,i3,Z7).call(o,a.computeSeed(),a).derivePath(r)}static fromMnemonic(n,r){var s;return r||(r=aW),Cr(s=qp,i3,Z7).call(s,n.computeSeed(),n).derivePath(r)}static fromPhrase(n,r,s,a){var l;r==null&&(r=""),s==null&&(s=aW),a==null&&(a=X3.wordlist());const o=mN.fromPhrase(n,r,a);return Cr(l=qp,i3,Z7).call(l,o.computeSeed(),o).derivePath(s)}static fromSeed(n){var r;return Cr(r=qp,i3,Z7).call(r,n,null)}};Xk=new WeakSet,Ste=function(){const n={address:this.address,privateKey:this.privateKey},r=this.mnemonic;return this.path&&r&&r.wordlist.locale==="en"&&r.password===""&&(n.mnemonic={path:this.path,locale:"en",entropy:r.entropy}),n},i3=new WeakSet,Z7=function(n,r){vn(T$(n),"invalid seed","seed","[REDACTED]");const s=ms(n,"seed");vn(s.length>=16&&s.length<=64,"invalid seed","seed","[REDACTED]");const a=ms(ij("sha512",xSt,s)),o=new G0(Kr(a.slice(0,32)));return new qp(f0,o,"0x00000000",Kr(a.slice(32)),"m",0,0,r,null)},Rn(qp,i3);let N9=qp;class n_ extends mte{constructor(n,r,s,a,o,l,c,u,d){super(r,d);$n(this,"publicKey");$n(this,"fingerprint");$n(this,"parentFingerprint");$n(this,"chainCode");$n(this,"path");$n(this,"index");$n(this,"depth");_5(n,f0,"HDNodeVoidWallet"),$s(this,{publicKey:s});const f=Co(aj(xp(s)),0,4);$s(this,{publicKey:s,fingerprint:f,parentFingerprint:a,chainCode:o,path:l,index:c,depth:u})}connect(n){return new n_(f0,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,n)}get extendedKey(){return Dr(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Cte(Da(["0x0488B21E",jR(this.depth,1),this.parentFingerprint,jR(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(n){const r=$i(n,"index");vn(r<=4294967295,"invalid index","index",r);let s=this.path;s&&(s+="/"+(r&2147483647),r&k4&&(s+="'"));const{IR:a,IL:o}=vOe(r,this.chainCode,this.publicKey,null),l=G0.addPoints(o,this.publicKey,!0),c=ET(l);return new n_(f0,c,l,this.fingerprint,Kr(a),s,r,this.depth+1,this.provider)}derivePath(n){return wOe(this,n)}}function qge(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function Gge(t,e){const n=JSON.parse(t),r=PT(e),s=aa(vl(n,"ethaddr:string!")),a=hOe(vl(n,"encseed:string!"));vn(a&&a.length%16===0,"invalid encseed","json",t);const o=ms(N2(r,r,2e3,32,"sha256")).slice(0,16),l=a.slice(0,16),c=a.slice(16),u=new sle(o,l),d=fSt(ms(u.decrypt(c)));let f="";for(let x=0;x<d.length;x++)f+=String.fromCharCode(d[x]);return{address:s,privateKey:v1(f)}}function Kge(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}var Qk,H0,Nte;let ile=(H0=class extends SR{constructor(e,n){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let r=typeof e=="string"?new G0(e):e;super(r,n)}connect(e){return new H0(this.signingKey,e)}async encrypt(e,n){const r={address:this.address,privateKey:this.privateKey};return await yOe(r,e,{progressCallback:n})}encryptSync(e){const n={address:this.address,privateKey:this.privateKey};return bOe(n,e)}static async fromEncryptedJson(e,n,r){var a;let s=null;return Vge(e)?s=await mSt(e,n,r):qge(e)&&(r&&(r(0),await Kge(0)),s=Gge(e,n),r&&(r(1),await Kge(0))),Cr(a=H0,Qk,Nte).call(a,s)}static fromEncryptedJsonSync(e,n){var s;let r=null;return Vge(e)?r=pSt(e,n):qge(e)?r=Gge(e,n):vn(!1,"invalid JSON wallet","json","[ REDACTED ]"),Cr(s=H0,Qk,Nte).call(s,r)}static createRandom(e){const n=N9.createRandom();return e?n.connect(e):n}static fromPhrase(e,n){const r=N9.fromPhrase(e);return n?r.connect(n):r}},Qk=new WeakSet,Nte=function(e){if(vn(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const r=mN.fromEntropy(e.mnemonic.entropy),s=N9.fromMnemonic(r,e.mnemonic.path);if(s.address===e.address&&s.privateKey===e.privateKey)return s;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const n=new H0(e.privateKey);return vn(n.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),n},Rn(H0,Qk),H0);async function Yge(t,e,n){let r;if(t===2?r=e==null?void 0:e.builder_sign_data:t===1?r=e==null?void 0:e.sign_data:r=(e==null?void 0:e.builder_sign_data)??(e==null?void 0:e.sign_data),!r)throw new Error("No data found to sign (no sign_data / builder_sign_data).");const{domain:s,types:a,message:o,primaryType:l}=r,{EIP712Domain:c,primary_type:u,...d}=a||{},f={[l]:u||[],...d},x={...o,nonce:(o==null?void 0:o.nonce)!=null?o.nonce.toString():o==null?void 0:o.nonce};if(typeof n.signTypedData!="function")throw new Error("Signer does not support EIP-712 typed data signing");const g=await n.signTypedData(s,f,x),y=ou.from(g);return{signature:{r:y.r,s:y.s,v:y.v},action:{...x,nonce:Number(x==null?void 0:x.nonce)},nonce:(x==null?void 0:x.nonce)||""}}const ER=({className:t})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:t,children:i.jsx("path",{d:"M9 1.5C4.8675 1.5 1.5 4.8675 1.5 9C1.5 13.1325 4.8675 16.5 9 16.5C13.1325 16.5 16.5 13.1325 16.5 9C16.5 4.8675 13.1325 1.5 9 1.5ZM8.4375 6C8.4375 5.6925 8.6925 5.4375 9 5.4375C9.3075 5.4375 9.5625 5.6925 9.5625 6V9.75C9.5625 10.0575 9.3075 10.3125 9 10.3125C8.6925 10.3125 8.4375 10.0575 8.4375 9.75V6ZM9.69 12.285C9.6525 12.3825 9.6 12.4575 9.5325 12.5325C9.4575 12.6 9.375 12.6525 9.285 12.69C9.195 12.7275 9.0975 12.75 9 12.75C8.9025 12.75 8.805 12.7275 8.715 12.69C8.625 12.6525 8.5425 12.6 8.4675 12.5325C8.4 12.4575 8.3475 12.3825 8.31 12.285C8.2725 12.195 8.25 12.0975 8.25 12C8.25 11.9025 8.2725 11.805 8.31 11.715C8.3475 11.625 8.4 11.5425 8.4675 11.4675C8.5425 11.4 8.625 11.3475 8.715 11.31C8.895 11.235 9.105 11.235 9.285 11.31C9.375 11.3475 9.4575 11.4 9.5325 11.4675C9.6 11.5425 9.6525 11.625 9.69 11.715C9.7275 11.805 9.75 11.9025 9.75 12C9.75 12.0975 9.7275 12.195 9.69 12.285Z",fill:"currentColor"})});var COe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Xge=Ne.createContext&&Ne.createContext(COe),ySt=["attr","size","title"];function vSt(t,e){if(t==null)return{};var n=wSt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function wSt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function _R(){return _R=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_R.apply(this,arguments)}function Qge(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function kR(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qge(Object(n),!0).forEach(function(r){CSt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qge(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function CSt(t,e,n){return e=SSt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function SSt(t){var e=NSt(t,"string");return typeof e=="symbol"?e:e+""}function NSt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function SOe(t){return t&&t.map((e,n)=>Ne.createElement(e.tag,kR({key:n},e.attr),SOe(e.child)))}function Pl(t){return e=>Ne.createElement(ASt,_R({attr:kR({},t.attr)},e),SOe(t.child))}function ASt(t){var e=n=>{var{attr:r,size:s,title:a}=t,o=vSt(t,ySt),l=s||n.size||"1em",c;return n.className&&(c=n.className),t.className&&(c=(c?c+" ":"")+t.className),Ne.createElement("svg",_R({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:c,style:kR(kR({color:t.color||n.color},n.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),a&&Ne.createElement("title",null,a),t.children)};return Xge!==void 0?Ne.createElement(Xge.Consumer,null,n=>e(n)):e(COe)}function jSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M446.7 98.6l-67.6 318.8c-5.1 22.5-18.4 28.1-37.3 17.5l-103-75.9-49.7 47.8c-5.5 5.5-10.1 10.1-20.7 10.1l7.4-104.9 190.9-172.5c8.3-7.4-1.8-11.5-12.9-4.1L117.8 284 16.2 252.2c-22.1-6.9-22.5-22.1 4.6-32.7L418.2 66.4c18.4-6.9 34.5 4.1 28.5 32.2z"},child:[]}]})(t)}function IT(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"},child:[]}]})(t)}function ESt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(t)}function ale(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 168v-16c0-13.255 10.745-24 24-24h360V80c0-21.367 25.899-32.042 40.971-16.971l80 80c9.372 9.373 9.372 24.569 0 33.941l-80 80C409.956 271.982 384 261.456 384 240v-48H24c-13.255 0-24-10.745-24-24zm488 152H128v-48c0-21.314-25.862-32.08-40.971-16.971l-80 80c-9.372 9.373-9.372 24.569 0 33.941l80 80C102.057 463.997 128 453.437 128 432v-48h360c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24z"},child:[]}]})(t)}function sa(t){return Pl({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"},child:[]}]})(t)}function ia(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"},child:[]}]})(t)}function _St(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z"},child:[]}]})(t)}function kSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z"},child:[]}]})(t)}function TSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M272 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h224c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM160 480c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm112-108c0 6.6-5.4 12-12 12H60c-6.6 0-12-5.4-12-12V60c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v312z"},child:[]}]})(t)}function PSt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M476 3.2L12.5 270.6c-18.1 10.4-15.8 35.6 2.2 43.2L121 358.4l287.3-253.2c5.5-4.9 13.3 2.6 8.6 8.3L176 407v80.5c0 23.6 28.5 32.9 42.5 15.8L282 426l124.6 52.2c14.2 6 30.4-2.9 33-18.2l72-432C515 7.8 493.3-6.8 476 3.2z"},child:[]}]})(t)}function ISt(t){return Pl({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"},child:[]}]})(t)}function s2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(t)}function i2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M279 224H41c-21.4 0-32.1-25.9-17-41L143 64c9.4-9.4 24.6-9.4 33.9 0l119 119c15.2 15.1 4.5 41-16.9 41z"},child:[]}]})(t)}function a2(t){return Pl({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41zm255-105L177 64c-9.4-9.4-24.6-9.4-33.9 0L24 183c-15.1 15.1-4.4 41 17 41h238c21.4 0 32.1-25.9 17-41z"},child:[]}]})(t)}function NOe(t){return Pl({tag:"svg",attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(t)}const FSt=({handleListRequest:t,isLighterInfoValue:e,handleLighterWalletInfo:n})=>{var fe;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=m.useContext(Qr),[a,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,x]=m.useState(""),[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(""),[T,M]=m.useState(""),[F,$]=m.useState(!0),[L,z]=m.useState({}),X=q=>/^\d*$/.test(q),ne=q=>{["e","E","+","-"].includes(q.key)&&q.preventDefault()},J=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!=="",K=async()=>{if(!J){P("Please fill in all fields.");return}try{C(!0),P(""),M("");const q=window.localStorage.getItem("hyperToken"),se=window.localStorage.getItem("hyperAddress");if(!q||!se){s(!0),C(!1);return}const ae={address:se.toLowerCase(),token:q,wallet_name:a,main_wallet:l,api_wallet_idx:f,api_wallet_private_key:u},V=await(await fetch(`${r}/api/wallet/generate-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ae)})).json();V!=null&&V.success?(tn.success("Wallet created successfully.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),t(),n(se),o(""),c(""),d(""),x(""),P(""),M(V==null?void 0:V.message)):P((V==null?void 0:V.error_message)||"An error has occurred.")}catch(q){P(q.message||"An error has occurred.")}finally{C(!1)}},te=async(q,se)=>{console.log("id :>> ",q);const ae=`${q}_${se}`;try{z(Ce=>({...Ce,[ae]:!0})),P(""),M("");const W=window.localStorage.getItem("hyperToken"),V=window.localStorage.getItem("hyperAddress");if(!W||!V){s(!0),z(Ce=>({...Ce,[ae]:!1}));return}const ee={address:V.toLowerCase(),token:W,wallet_id:Number(q)},de=await(await fetch(`${r}/api/wallet/delete-lighter`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(ee)})).json();de!=null&&de.success?(tn.success("Wallet deleted successfully.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),n(V),P(""),M(de==null?void 0:de.message)):P((de==null?void 0:de.error_message)||"An error has occurred.")}catch(W){P(W.message||"An error has occurred.")}finally{C(!1)}};return i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full relative",children:[v&&i.jsx("div",{role:"status",className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 flex justify-center items-center w-full z-[60] -mt-20 h-full min-h-[450px] sm:min-h-[280px]",children:i.jsx($a,{})}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 w-full",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Wallet Name"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:a,onChange:q=>o(q.target.value),autoComplete:"off",placeholder:"Wallet Name",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#1b1b1b] text-white border text-[13px] outline-none placeholder:text-[#7F7F7F] ${a===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:v})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Login Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:l,onChange:q=>c(q.target.value),autoComplete:"off",placeholder:"Login Address",type:"text",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${l===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:v})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:u,onChange:q=>d(q.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:g?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${u===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:v}),i.jsx("button",{type:"button",onClick:()=>y(q=>!q),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:v,children:g?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:f,onChange:q=>{const se=q.target.value.trim();if(se==="")return x("");X(se)&&x(se)},onKeyDown:ne,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${f===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:v})})]})]}),i.jsx("button",{onClick:()=>{!v&&K()},disabled:v,className:"w-full h-10 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] focus:ring-0 focus:outline-none justify-center items-center gap-1.5 inline-flex mt-2.5",children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Generate"})}),i.jsx("div",{className:"w-full mt-2",children:(e==null?void 0:e.length)>0?i.jsxs("div",{className:"flex flex-col items-start gap-3 w-full ",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 cursor-pointer text-sm text-zinc-300 w-full",onClick:()=>$(!F),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"Lighter Wallets"}),i.jsx(Iie,{className:`w-3.5 h-3.5 transition-transform text-white ${F?"":"rotate-180"}`})]}),i.jsx("div",{className:"flex flex-col items-start gap-1 sm:gap-1.5 w-full max-h-[80px] overflow-y-auto",children:F&&((fe=[...e].sort((q,se)=>(se==null?void 0:se.wallet_created_data)-(q==null?void 0:q.wallet_created_data)))==null?void 0:fe.map((q,se)=>{var ae,W;return i.jsx("div",{className:"flex flex-col items-start w-full",children:i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("span",{className:"text-[#929292] text-[11px] font-normal min-w-[110px]",children:((ae=q==null?void 0:q.wallet_name)==null?void 0:ae.length)>18?((W=q==null?void 0:q.wallet_name)==null?void 0:W.slice(0,18))+"...":q==null?void 0:q.wallet_name})}),i.jsxs("div",{className:"flex justify-start items-center w-max",children:[i.jsx("span",{className:"text-[#929292] text-[11px] font-normal min-w-[75px]",children:(q==null?void 0:q.wallet_address.slice(0,6))+"..."+(q==null?void 0:q.wallet_address.slice(-4))}),i.jsx("img",{onClick:V=>{V.stopPropagation(),navigator.clipboard.writeText(q==null?void 0:q.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),i.jsx("span",{className:"text-[#929292] text-[11px] font-normal font-['Inter'] leading-4 min-w-max hidden sm:flex",children:cu(q==null?void 0:q.wallet_created_data)}),L[`${q==null?void 0:q.wallet_id}_${q==null?void 0:q.wallet_name.toLowerCase()}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[90px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{te(q==null?void 0:q.wallet_id,q==null?void 0:q.wallet_name)},className:"w-[70px] sm:w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Delete"})})]})},se)}))})]}):""}),N&&i.jsxs("div",{className:"mt-2 w-full min-h-10 p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 max-w-[480px]",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:N})]}),T&&i.jsxs("div",{className:"mt-2 w-full min-h-10 p-3 bg-[#67ffbd]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 max-w-[480px]",children:[i.jsx("img",{src:fae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:T})]})]})},Zge=({handleListRequest:t,isExtendedInfoValue:e,handleExtendedWalletInfo:n})=>{var me;const r="https://dextrabothypev2.nftinit.io",{setSignModalOpen:s}=m.useContext(Qr),[a,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,x]=m.useState(""),[g,y]=m.useState(""),[v,C]=m.useState(""),[N,P]=m.useState(!1),[T,M]=m.useState(!1),[F,$]=m.useState(!1),[L,z]=m.useState(!1),[X,ne]=m.useState(!1),[J,K]=m.useState(""),[te,fe]=m.useState(""),[q,se]=m.useState(!0),[ae,W]=m.useState({}),V=we=>/^\d*$/.test(we),ee=we=>{["e","E","+","-"].includes(we.key)&&we.preventDefault()},oe=a.trim()!==""&&l.trim()!==""&&u.trim()!==""&&f.trim()!==""&&g.trim()!==""&&v.trim()!=="",de=async()=>{if(!oe){K("Please fill in all fields.");return}try{ne(!0),K(""),fe("");const we=window.localStorage.getItem("hyperToken"),xe=window.localStorage.getItem("hyperAddress");if(!we||!xe){s(!0),ne(!1);return}const be={address:xe.toLowerCase(),token:we,wallet_name:a,main_wallet:l,api_key:f,stark_public:u,stark_private:g,vault_number:v},Ie=await(await fetch(`${r}/api/wallet/generate-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(be)})).json();Ie!=null&&Ie.success?(tn.success("Wallet created successfully.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),t(),n(xe),o(""),c(""),d(""),x(""),y(""),C(""),K(""),fe(Ie==null?void 0:Ie.message)):K((Ie==null?void 0:Ie.error_message)||"An error has occurred.")}catch(we){K(we.message||"An error has occurred.")}finally{ne(!1)}},Ce=async(we,xe)=>{console.log("id :>> ",we);const be=`${we}_${xe}`;try{W(dt=>({...dt,[be]:!0})),K(""),fe("");const je=window.localStorage.getItem("hyperToken"),Ie=window.localStorage.getItem("hyperAddress");if(!je||!Ie){s(!0),W(dt=>({...dt,[be]:!1}));return}const Re={address:Ie.toLowerCase(),token:je,wallet_id:Number(we)},Ke=await(await fetch(`${r}/api/wallet/delete-extended`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Re)})).json();Ke!=null&&Ke.success?(t(),tn.success("Wallet deleted successfully.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),n(Ie),K(""),fe(Ke==null?void 0:Ke.message)):K((Ke==null?void 0:Ke.error_message)||"An error has occurred.")}catch(je){K(je.message||"An error has occurred.")}finally{ne(!1)}};return i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full relative",children:[X&&i.jsx("div",{role:"status",className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 flex justify-center items-center w-full z-[60] -mt-20 h-full min-h-[450px] sm:min-h-[280px]",children:i.jsx($a,{})}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 w-full",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Wallet Name"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:a,onChange:we=>o(we.target.value),autoComplete:"off",placeholder:"Wallet Name",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#1b1b1b] text-white border text-[13px] outline-none placeholder:text-[#7F7F7F] ${a===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Login Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:l,onChange:we=>c(we.target.value),autoComplete:"off",placeholder:"Login Address",type:"text",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${l===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:f,onChange:we=>x(we.target.value),autoComplete:"off",placeholder:"API_KEY",type:N?"text":"password",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${f===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X}),i.jsx("button",{type:"button",onClick:()=>P(we=>!we),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:X,children:N?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stark Key Public"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:u,onChange:we=>d(we.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:T?"text":"password",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${u===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X}),i.jsx("button",{type:"button",onClick:()=>M(we=>!we),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:X,children:T?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stark Key Private"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:g,onChange:we=>y(we.target.value),autoComplete:"off",placeholder:"STARK_KEY_PRIVATE",type:F?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${g===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X}),i.jsx("button",{type:"button",onClick:()=>$(we=>!we),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:X,children:F?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Vault Number"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:v,onChange:we=>{const xe=we.target.value.trim();if(xe==="")return C("");V(xe)&&C(xe)},onKeyDown:ee,inputMode:"numeric",autoComplete:"off",type:L?"text":"password",placeholder:"VAULT_NUMBER",className:`w-full h-8 px-3 rounded-md text-white bg-[#1b1b1b] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${v===""?"border-[#303030]":"border-[#303030] focus:border-[#67FFBD]"}`,disabled:X}),i.jsx("button",{type:"button",onClick:()=>z(we=>!we),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:X,children:L?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),i.jsx("button",{onClick:()=>{!X&&de()},disabled:X,className:"w-full h-10 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] focus:ring-0 focus:outline-none justify-center items-center gap-1.5 inline-flex mt-2.5",children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Generate"})}),i.jsx("div",{className:"w-full mt-2",children:(e==null?void 0:e.length)>0?i.jsxs("div",{className:"flex flex-col items-start gap-3 w-full ",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 cursor-pointer text-sm text-zinc-300 w-full",onClick:()=>se(!q),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"Extended Wallets"}),i.jsx(Iie,{className:`w-3.5 h-3.5 transition-transform text-white ${q?"":"rotate-180"}`})]}),i.jsx("div",{className:"flex flex-col items-start gap-1 sm:gap-1.5 w-full max-h-[80px] overflow-y-auto",children:q&&((me=[...e].sort((we,xe)=>(xe==null?void 0:xe.wallet_created_data)-(we==null?void 0:we.wallet_created_data)))==null?void 0:me.map((we,xe)=>{var be,je;return i.jsx("div",{className:"flex flex-col items-start w-full",children:i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("span",{className:"text-[#929292] text-[11px] font-normal min-w-[110px]",children:((be=we==null?void 0:we.wallet_name)==null?void 0:be.length)>18?((je=we==null?void 0:we.wallet_name)==null?void 0:je.slice(0,18))+"...":we==null?void 0:we.wallet_name})}),i.jsxs("div",{className:"flex justify-start items-center w-max",children:[i.jsx("span",{className:"text-[#929292] text-[11px] font-normal min-w-[75px]",children:(we==null?void 0:we.wallet_address.slice(0,6))+"..."+(we==null?void 0:we.wallet_address.slice(-4))}),i.jsx("img",{onClick:Ie=>{Ie.stopPropagation(),navigator.clipboard.writeText(we==null?void 0:we.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),i.jsx("span",{className:"text-[#929292] text-[11px] font-normal font-['Inter'] leading-4 min-w-max hidden sm:flex",children:cu(we==null?void 0:we.wallet_created_data)}),ae[`${we==null?void 0:we.wallet_id}_${we==null?void 0:we.wallet_name.toLowerCase()}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[90px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{Ce(we==null?void 0:we.wallet_id,we==null?void 0:we.wallet_name)},className:"w-[70px] sm:w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Delete"})})]})},xe)}))})]}):""}),J&&i.jsxs("div",{className:"mt-2 w-full min-h-10 p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 max-w-[480px]",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:J})]}),te&&i.jsxs("div",{className:"mt-2 w-full min-h-10 p-3 bg-[#67ffbd]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 max-w-[480px]",children:[i.jsx("img",{src:fae,alt:"Dextrabot",className:"w-4 h-4"}),i.jsx("p",{className:"text-[#67FFBD] text-[13px] font-normal font-['Inter'] leading-4",children:te})]})]})},AOe=({className:t})=>i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M10.5001 6.31166C10.3454 6.31166 10.197 6.37312 10.0876 6.48252C9.97821 6.59191 9.91675 6.74029 9.91675 6.895V11.0833C9.91675 11.238 9.85529 11.3864 9.74589 11.4958C9.6365 11.6052 9.48812 11.6667 9.33341 11.6667H2.91675C2.76204 11.6667 2.61367 11.6052 2.50427 11.4958C2.39487 11.3864 2.33341 11.238 2.33341 11.0833V4.66666C2.33341 4.51195 2.39487 4.36358 2.50427 4.25419C2.61367 4.14479 2.76204 4.08333 2.91675 4.08333H7.10508C7.25979 4.08333 7.40816 4.02187 7.51756 3.91248C7.62696 3.80308 7.68841 3.65471 7.68841 3.5C7.68841 3.34529 7.62696 3.19691 7.51756 3.08752C7.40816 2.97812 7.25979 2.91666 7.10508 2.91666H2.91675C2.45262 2.91666 2.0075 3.10104 1.67931 3.42923C1.35112 3.75742 1.16675 4.20254 1.16675 4.66666V11.0833C1.16675 11.5475 1.35112 11.9926 1.67931 12.3208C2.0075 12.649 2.45262 12.8333 2.91675 12.8333H9.33341C9.79754 12.8333 10.2427 12.649 10.5709 12.3208C10.899 11.9926 11.0834 11.5475 11.0834 11.0833V6.895C11.0834 6.74029 11.022 6.59191 10.9126 6.48252C10.8032 6.37312 10.6548 6.31166 10.5001 6.31166ZM12.7867 1.52833C12.7276 1.38579 12.6143 1.27252 12.4717 1.21333C12.4016 1.18344 12.3263 1.16759 12.2501 1.16666H8.75008C8.59537 1.16666 8.447 1.22812 8.3376 1.33752C8.22821 1.44691 8.16675 1.59529 8.16675 1.75C8.16675 1.90471 8.22821 2.05308 8.3376 2.16248C8.447 2.27187 8.59537 2.33333 8.75008 2.33333H10.8442L4.83591 8.33583C4.78124 8.39006 4.73784 8.45458 4.70823 8.52566C4.67861 8.59675 4.66337 8.67299 4.66337 8.75C4.66337 8.827 4.67861 8.90325 4.70823 8.97433C4.73784 9.04542 4.78124 9.10994 4.83591 9.16416C4.89014 9.21884 4.95466 9.26224 5.02574 9.29185C5.09683 9.32147 5.17307 9.33671 5.25008 9.33671C5.32709 9.33671 5.40333 9.32147 5.47442 9.29185C5.5455 9.26224 5.61002 9.21884 5.66425 9.16416L11.6667 3.15583V5.25C11.6667 5.40471 11.7282 5.55308 11.8376 5.66248C11.947 5.77187 12.0954 5.83333 12.2501 5.83333C12.4048 5.83333 12.5532 5.77187 12.6626 5.66248C12.772 5.55308 12.8334 5.40471 12.8334 5.25V1.75C12.8325 1.67377 12.8166 1.59846 12.7867 1.52833Z",fill:"currentColor"})}),OSt=({errorConnectMessage:t,setErrorConnectMessage:e,loadingConnect:n,setLoadingConnect:r,handleListRequest:s,handlePageChange:a,isBalanceValue:o,isBalanceLoading:l,isAgentInfoLoading:c,isAgentInfoValue:u,handleAgentWalletInfo:d,isBuilderFeeLoading:f,isBuilderFeeValue:x,refreshAgent:g,handleBuilderFeeInfo:y,isLighterInfoValue:v,handleLighterWalletInfo:C,isExtendedInfoValue:N,handleExtendedWalletInfo:P,isPacificaInfoValue:T,handlePacificaWalletInfo:M,isSelectAPIMenu:F,setIsSelectAPIMenu:$})=>{var me,we;const{setSignModalOpen:L}=m.useContext(Qr),{address:z}=ns(),X=Kl(),[ne,J]=m.useState(!0),[K,te]=m.useState(!1),[fe,q]=m.useState(!1);m.useEffect(()=>{const xe=X.hash,be=localStorage.getItem("isWalletSelectMenu");if(xe){const je=xe.split("#").filter(Boolean);je[2]&&$(je[2].toUpperCase()),be==="LIGHTER"?$("LIGHTER"):be==="EXTENDED"?$("EXTENDED"):be==="PACIFICA"?$("PACIFICA"):be==="HYPER"&&$("HYPERLIQUID")}},[X.hash]),m.useEffect(()=>{(async()=>{var Ie;const be=window.localStorage.getItem("hyperToken"),je=(Ie=z||window.localStorage.getItem("hyperAddress"))==null?void 0:Ie.toLowerCase();if(!be){L(!0);return}if(je&&be)try{const Re=await ki(je,be);te(!!(Re!=null&&Re.is_generated))}catch{te(!1)}finally{q(!0)}})()},[z,L]);const se=xe=>{var Qe,Ke,dt,tt,nt,Le;const be=(xe==null?void 0:xe.code)||((Qe=xe==null?void 0:xe.error)==null?void 0:Qe.code)||((dt=(Ke=xe==null?void 0:xe.info)==null?void 0:Ke.error)==null?void 0:dt.code)||((tt=xe==null?void 0:xe.cause)==null?void 0:tt.code)||"",je=typeof be=="string"?be.toUpperCase():String(be).toUpperCase(),Ie=String((xe==null?void 0:xe.message)||"").toUpperCase();if(je==="ACTION_REJECTED"||je==="4001"||Ie.includes("USER REJECT")||Ie.includes("USER DENIED")){e("Request cancelled by user.");return}if([typeof xe=="string"?xe:"",xe==null?void 0:xe.message,xe==null?void 0:xe.code,xe==null?void 0:xe.name,xe==null?void 0:xe.shortMessage,(nt=xe==null?void 0:xe.cause)==null?void 0:nt.message,(Le=xe==null?void 0:xe.cause)==null?void 0:Le.code].filter(Boolean).join(" ").toUpperCase().includes("UNSUPPORTED_OPERATION")){e(i.jsxs(i.Fragment,{children:[i.jsx("b",{children:"Wallet Extension Conflict Detected"})," — It looks like you are using multiple wallet extensions at the same time, which is causing a conflict."," ",i.jsx("a",{href:"https://docs.dextrabot.com/errors/wallet-extension-conflict-fix",target:"_blank",rel:"noreferrer",className:"underline",children:"Read Guide"})]}));return}e(typeof xe=="string"?xe:(xe==null?void 0:xe.message)||"Something went wrong.")},ae=()=>{if(!window.ethereum)throw new Error("MetaMask not found.");return window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0xa4b1"}]})},W=async xe=>{var Ie,Re;if(K)return;const be=window.localStorage.getItem("hyperToken");if(!be||!z){L(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await ae();const dt=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate-agent",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():je,token:be})})).json();if(!(dt!=null&&dt.success)){se((dt==null?void 0:dt.error_message)||"Agent could not be produced.");return}if(!window.ethereum)throw new Error("MetaMask not found.");const nt=await new CR(window.ethereum).getSigner(),Le=await Yge(xe,dt,nt),ht=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/complete-agent",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({signature:Le.signature,action:Le.action,nonce:Le.nonce,address:z?z.toLowerCase():je,token:be})})).json();if(ht!=null&&ht.success){if(((Ie=ht==null?void 0:ht.result)==null?void 0:Ie.status)==="err"){se(((Re=ht==null?void 0:ht.result)==null?void 0:Re.response)||"Approval failed."),r(!1);return}s(),a(1),d(z||je)}else se((ht==null?void 0:ht.error_message)||"Approval failed.")}catch(Qe){se(Qe)}finally{r(!1)}},V=async xe=>{var Ie,Re;if(K)return;const be=window.localStorage.getItem("hyperToken");if(!be||!z){L(!0);return}r(!0),e("");const je=window.localStorage.getItem("hyperAddress");try{await window.ethereum.request({method:"eth_chainId"})!=="0xa4b1"&&await ae();const dt=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/generate-agent",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():je,token:be})})).json();if(!(dt!=null&&dt.success))throw new Error((dt==null?void 0:dt.error_message)||"Generate builder fee failed");if(!window.ethereum)throw new Error("MetaMask not found.");const nt=await new CR(window.ethereum).getSigner(),Le=await Yge(xe,dt,nt),ht=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/complete-builder",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({signature:Le.signature,action:Le.action,nonce:Le.nonce,address:z?z.toLowerCase():je,token:be})})).json();if(ht!=null&&ht.success){if(((Ie=ht==null?void 0:ht.result)==null?void 0:Ie.status)==="err"){se(((Re=ht==null?void 0:ht.result)==null?void 0:Re.response)||"Approve builder fee failed"),r(!1);return}W(1),y(z||je)}else se((ht==null?void 0:ht.error_message)||"Approval failed."),r(!1)}catch(Qe){se(Qe),r(!1)}},ee=m.useMemo(()=>u?u.some(xe=>{var be;return((be=(xe==null?void 0:xe.name)??"")==null?void 0:be.trim().toLowerCase())==="dextrabot"}):!1,[u]),oe=Number(((me=o==null?void 0:o.marginSummary)==null?void 0:me.accountValue)??0),de=`You can’t create an API Wallet while logged in with a Dextrabot-generated wallet.
How To Login: Log in with a non Dextrabot-generated wallet and try again.`,Ce=n||c||l||f||!fe&&z;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-full",children:i.jsxs("div",{className:"flex flex-col items-start justify-center sm:flex-row sm:justify-between sm:items-center w-full gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(oW,{title:"HYPERLIQUID",set_click:()=>$("HYPERLIQUID"),isSelectAPIMenu:F}),i.jsx(oW,{title:"LIGHTER",set_click:()=>$("LIGHTER"),isSelectAPIMenu:F}),i.jsx(oW,{title:"EXTENDED",set_click:()=>$("EXTENDED"),isSelectAPIMenu:F})]}),F==="EXTENDED"&&i.jsxs("button",{onClick:()=>window.open("https://app.extended.exchange/join/DEXTRABOT","_blank"),className:"group px-1.5 py-1 rounded-full border border-[#3ec78c] text-[#3ec78c] text-[11px] font-bold flex items-center gap-1 transition-all duration-200 hover:bg-[#3ec78c]/15 hover:border-[#3ec78c]/80 active:scale-95",children:[i.jsx("span",{children:"Go To API Page"}),i.jsx(AOe,{className:"w-4 h-4"})]})]})}),Ce?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx($a,{})}):F==="HYPERLIQUID"?i.jsxs("div",{className:"flex flex-col items-center justify-start gap-[24px] w-full",children:[i.jsxs("div",{className:"flex flex-col items-start gap-2 -mt-[8px] w-full",children:[i.jsx("label",{htmlFor:"address",className:"text-center justify-start text-white text-sm font-medium font-['Inter']",children:"Connected Wallet"}),i.jsxs("div",{id:"address",className:"min-h-10 px-2.5 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] outline outline-1 outline-offset-[-1px] outline-[#2a2a2a] gap-2 flex justify-start items-center w-full text-white text-sm font-medium font-['Inter'] leading-[16px] break-all",children:[z&&i.jsx("img",{src:ame,alt:"agent icon"}),z||"--"]}),!K&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex justify-start items-center gap-4 w-full mt-2",children:i.jsxs("div",{className:"flex flex-col items-start gap-1.5 text-[#929292] text-[13px] font-normal font-['Inter'] leading-4 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsx("span",{className:"text-[#929292]",children:"USDC Available "}),i.jsxs("div",{className:"flex justify-center items-center gap-4",children:[i.jsx("div",{onClick:()=>{g()},className:"flex justify-center items-center cursor-pointer",children:i.jsx(XS,{className:"w-4 h-4 text-[#929292] hover:text-white"})}),i.jsx("span",{className:`${oe>=5?"text-[#1DE674]":"text-[#929292]"} `,children:oe===0||oe?"$"+_r(oe):"--"})]})]}),(oe===0&&!ee||oe<5&&!ee)&&i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsx("span",{className:"text-text-[#929292]",children:"Min. Deposit"}),i.jsx("span",{className:"text-[#929292]",children:"5 USDC"})]})]})}),i.jsx("div",{className:"w-full flex justify-center items-center mt-2",children:x!=null&&Number(x)>0?ee?i.jsxs("div",{className:"px-3 py-2.5 bg-[#1de674]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 w-full max-w-[480px] text-[#1DE674] text-[13px] font-normal font-['Inter'] leading-4",children:[i.jsx("img",{src:ame,alt:"agent icon"}),"You’re ready to trade!"]}):"":oe>0?oe>=5?"":i.jsxs("div",{className:"px-3 py-2.5 bg-[#ffb14b]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 w-full max-w-[480px] text-[#FFB14B] text-[13px] font-normal font-['Inter'] leading-4",children:[i.jsx(ER,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Your Hyperliquid perps balance is $",_r(oe)," USDC. A minimum of 5 USDC is required."]}):i.jsxs("div",{className:"px-3 py-2.5 bg-[#ffb14b]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 w-full max-w-[480px] text-[#FFB14B] text-[13px] font-normal font-['Inter'] leading-4",children:[i.jsx(ER,{className:"text-[#FFB14B] w-[18px] h-[18px] min-w-[18px] min-h-[18px]"}),"Please fund your Hyperliquid Perpetual balance to start trading"]})})]})]}),K?i.jsxs("div",{className:"-mt-2.5 w-full p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] max-w-[480px] flex justify-start items-center gap-2.5",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),i.jsx("p",{className:"whitespace-pre-line text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:de})]}):i.jsxs(i.Fragment,{children:[x!=null&&Number(x)>0?ee?"":i.jsx("div",{onClick:()=>{W(1)},className:`${!n&&!c&&!f?"cursor-pointer bg-[#7445ff] border border-[#8860ff] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)]":"bg-[#6B7280] text-[#D1D5DB] cursor-auto"} w-full h-10 px-6 py-3 rounded-xl inline-flex justify-center items-center gap-2.5 text-white text-sm font-semibold font-['Inter'] leading-[8px] -mt-4`,children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Enable Trading"})}):i.jsx("div",{onClick:xe=>{xe.preventDefault(),oe>=5&&!l&&V(2)},className:`${oe>=5&&!l?"cursor-pointer bg-[#7445ff] border border-[#8860ff] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)]":"bg-[#6B7280] text-[#D1D5DB] cursor-auto"} w-full h-10 px-6 py-3 rounded-xl inline-flex justify-center items-center gap-2.5 text-white text-sm font-semibold font-['Inter'] leading-[8px] -mt-4`,children:i.jsx("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px]",children:"Enable Trading"})}),i.jsx("div",{className:"w-full",children:(u==null?void 0:u.length)>0?i.jsxs("div",{className:"flex flex-col items-start gap-3 w-full ",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 cursor-pointer text-sm text-zinc-300 w-full",onClick:()=>J(!ne),children:[i.jsx("span",{className:"text-white text-sm font-medium font-['Inter'] leading-normal",children:"API Wallets"}),i.jsx(Iie,{className:`w-3.5 h-3.5 transition-transform text-white ${ne?"":"rotate-180"}`})]}),i.jsx("div",{className:"flex flex-col items-start gap-1 sm:gap-1.5 w-full max-h-[80px] overflow-y-auto",children:ne&&((we=[...u].sort((xe,be)=>(be==null?void 0:be.validUntil)-(xe==null?void 0:xe.validUntil)))==null?void 0:we.map((xe,be)=>i.jsx("div",{className:"flex flex-col items-start w-full",children:i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-2 sm:gap-6",children:i.jsx("span",{className:`${(xe==null?void 0:xe.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal min-w-[110px]`,children:xe==null?void 0:xe.name})}),i.jsxs("span",{className:`${(xe==null?void 0:xe.name)==="dextrabot"?"text-white":"text-[#929292]"} text-[11px] font-normal font-['Inter'] leading-4 min-w-max`,children:["Valid until:"," ",Qft(xe==null?void 0:xe.validUntil)]})]})},be)))})]}):""}),t&&i.jsxs("div",{className:"-mt-2.5 w-full h-10 p-3 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] max-w-[480px] flex justify-start items-center gap-2.5",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),i.jsx("p",{className:"text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4",children:t})]})]})]}):F==="LIGHTER"?i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(FSt,{handleListRequest:s,isLighterInfoValue:v,handleLighterWalletInfo:C})}):F==="EXTENDED"?i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(Zge,{handleListRequest:s,isExtendedInfoValue:N,handleExtendedWalletInfo:P})}):i.jsx("div",{className:"flex items-center justify-start w-full",children:i.jsx(Zge,{handleListRequest:s,isExtendedInfoValue:N,handleExtendedWalletInfo:P})})]})},oW=({title:t,set_click:e,isSelectAPIMenu:n})=>i.jsx("div",{onClick:e,className:`${n==t?"bg-[#67ffbd]/20 text-[#67FFBD]":"bg-transparent text-[#9b9b9b]"} text-[13px] font-medium font-manrope leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-[22px]`,children:t}),Jge=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:t,children:[i.jsx("path",{d:"M3.75 11.25C3.045 11.25 2.3925 11.4975 1.875 11.91C1.185 12.4575 0.75 13.305 0.75 14.25C0.75 15.9075 2.0925 17.25 3.75 17.25C4.5075 17.25 5.1975 16.965 5.73 16.5C6.3525 15.9525 6.75 15.15 6.75 14.25C6.75 12.5925 5.4075 11.25 3.75 11.25ZM4.5 14.4375C4.5 14.6325 4.395 14.82 4.23 14.9175L3.2925 15.48C3.2025 15.54 3.0975 15.5625 3 15.5625C2.8125 15.5625 2.625 15.465 2.52 15.2925C2.3625 15.0225 2.445 14.6775 2.715 14.52L3.3825 14.1225V13.3125C3.375 13.005 3.63 12.75 3.9375 12.75C4.245 12.75 4.5 13.005 4.5 13.3125V14.4375Z",fill:"currentColor"}),i.jsx("path",{d:"M11.1375 2.96251V5.81251H10.0125V2.96251C10.0125 2.76001 9.8325 2.66251 9.7125 2.66251C9.675 2.66251 9.6375 2.67001 9.6 2.68501L3.6525 4.92751C3.255 5.07751 3 5.45251 3 5.88001V6.38251C2.3175 6.89251 1.875 7.71001 1.875 8.63251V5.88001C1.875 4.98751 2.4225 4.19251 3.255 3.87751L9.21 1.62751C9.375 1.56751 9.5475 1.53751 9.7125 1.53751C10.4625 1.53751 11.1375 2.14501 11.1375 2.96251Z",fill:"currentColor"}),i.jsx("path",{d:"M16.1245 10.875V11.625C16.1245 11.8275 15.967 11.9925 15.757 12H14.662C14.2645 12 13.9045 11.7075 13.8745 11.3175C13.852 11.085 13.942 10.8675 14.092 10.7175C14.227 10.575 14.4145 10.5 14.617 10.5H15.7495C15.967 10.5075 16.1245 10.6725 16.1245 10.875Z",fill:"currentColor"}),i.jsx("path",{d:"M14.61 9.7125H15.375C15.7875 9.7125 16.125 9.375 16.125 8.9625V8.6325C16.125 7.08 14.8575 5.8125 13.305 5.8125H4.695C4.0575 5.8125 3.4725 6.0225 3 6.3825C2.3175 6.8925 1.875 7.71 1.875 8.6325V9.9675C1.875 10.2525 2.175 10.4325 2.445 10.3425C2.865 10.2 3.3075 10.125 3.75 10.125C6.0225 10.125 7.875 11.9775 7.875 14.25C7.875 14.79 7.7325 15.3825 7.5075 15.9075C7.3875 16.1775 7.575 16.5 7.8675 16.5H13.305C14.8575 16.5 16.125 15.2325 16.125 13.68V13.5375C16.125 13.125 15.7875 12.7875 15.375 12.7875H14.7225C14.0025 12.7875 13.3125 12.345 13.125 11.6475C12.975 11.0775 13.155 10.5225 13.53 10.1625C13.8075 9.8775 14.19 9.7125 14.61 9.7125ZM10.5 9.5625H6.75C6.4425 9.5625 6.1875 9.3075 6.1875 9C6.1875 8.6925 6.4425 8.4375 6.75 8.4375H10.5C10.8075 8.4375 11.0625 8.6925 11.0625 9C11.0625 9.3075 10.8075 9.5625 10.5 9.5625Z",fill:"currentColor"})]});function P5({open:t,setOpen:e,handleListRequest:n,handlePageChange:r,source:s}){const{isConnected:a,address:o}=ns(),{hyperToken:l}=m.useContext(Qr);Kl();const[c,u]=m.useState("HYPERLIQUID");m.useEffect(()=>{t&&s&&u(s)},[t,s]);const[d,f]=m.useState([]),[x,g]=m.useState(""),[y,v]=m.useState(!1),[C,N]=m.useState(""),[P,T]=m.useState(!1),[M,F]=m.useState(!1),[$,L]=m.useState(!1),[z,X]=m.useState("account"),[ne,J]=m.useState(!1),K=m.useRef(null),[te,fe]=m.useState([]),[q,se]=m.useState(""),[ae,W]=m.useState(""),[V,ee]=m.useState(!1),[oe,de]=m.useState(""),[Ce,me]=m.useState(""),[we,xe]=m.useState(""),[be,je]=m.useState(!1),[Ie,Re]=m.useState(!1),[Qe,Ke]=m.useState(null),[dt,tt]=m.useState(!1),[nt,Le]=m.useState([]),[Be,ht]=m.useState([]),[pt,Gt]=m.useState([]),[wt,nn]=m.useState([]),[cn,Un]=m.useState(!1),[Xt,an]=m.useState(null),Jt=[{id:"account",name:"Add API Wallet",href:"#account",icon:Jge},{id:"generate",name:"Generate HL Wallet",href:"#generate",icon:Jge}];function Ye(...De){return De.filter(Boolean).join(" ")}const Je=async(De,At)=>{try{At===1&&Re(!0);const ze=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:De})});if(!ze.ok)throw new Error("Network response was not ok");const rt=await ze.json();rt&&(Ke(rt),Re(!1))}catch(ze){console.error("Error fetching user balance info:",ze),Re(!1)}},It=async De=>{try{tt(!0);const At=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"extraAgents",user:De})});if(!At.ok)throw new Error("Network response was not ok");const ze=await At.json();ze&&(Le(ze),tt(!1))}catch(At){console.error("Error fetching user balance info:",At),tt(!1)}},hn=async De=>{const At=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress");if(!(!At||!De))try{const rt=await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:De?De.toLowerCase():ze,token:At})});if(!rt.ok)throw new Error("Network response was not ok");const mt=await rt.json();mt.success&&ht((mt==null?void 0:mt.data)||[])}catch(rt){console.error("Error fetching user balance info:",rt)}},Yt=async De=>{const At=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress");if(!(!At||!De))try{const rt=await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:De?De.toLowerCase():ze,token:At})});if(!rt.ok)throw new Error("Network response was not ok");const mt=await rt.json();mt.success&&Gt((mt==null?void 0:mt.data)||[])}catch(rt){console.error("Error fetching user balance info:",rt)}},Rt=async De=>{try{Un(!0);const At=await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"maxBuilderFee",user:De,builder:"0x49ae63056b3a0be0b166813ee687309ab653c07c"})});if(!At.ok)throw new Error("Network response was not ok");const ze=await At.text(),rt=parseInt(ze,10);an(rt),Un(!1)}catch(At){console.error("Error fetching user balance info:",At),Un(!1)}};m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&o&&t&&(Je(o,1),It(o),hn(o),Yt(o),Rt(o))},[t]),m.useEffect(()=>{var ze;return!t||z!="account"||(nt==null?void 0:nt.some(rt=>((rt==null?void 0:rt.name)??"").trim().toLowerCase()==="dextrabot"))?void 0:(Number(((ze=Qe==null?void 0:Qe.marginSummary)==null?void 0:ze.accountValue)??0)<5?K.current||(K.current=setInterval(()=>{Je(o,2)},1e4)):K.current&&(clearInterval(K.current),K.current=null),()=>{K.current&&(clearInterval(K.current),K.current=null)})},[Qe,t,z,o]),m.useEffect(()=>{const De=window.localStorage.getItem("hyperToken");(!o||!a||!De)&&(e(!1),g(""),N(""),xe(""))},[o,a,l]);const ot=()=>{window.localStorage.getItem("hyperToken")&&o&&t?(Je(o,1),It(o),Rt(o)):tn.error("Please connect wallet")};return m.useEffect(()=>{if(t&&!ne)if((nt==null?void 0:nt.length)>0){const De=nt==null?void 0:nt.some(ze=>((ze==null?void 0:ze.name)??"").trim().toLowerCase()==="dextrabot"),At=localStorage.getItem("isWalletSelectMenu");X(At==="LIGHTER"||At==="EXTENDED"||At==="PACIFICA"?"account":At==="HYPER"?De?"generate":"account":De&&(Be==null?void 0:Be.length)>0&&(pt==null?void 0:pt.length)>0&&(wt==null?void 0:wt.length)>0?"generate":"account"),J(!0)}else X("account"),J(!0)},[nt,ne]),i.jsxs(i.Fragment,{children:[i.jsx(zwt,{open:$,setOpen:L,setGenModalOpen:e,setGenWalletSuccess:F,setGenWalletData:f,setShowPrivateKey:T}),i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-[9999999998] font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-[9999999998] w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,style:{boxShadow:"0 4px 24px 0 #000",backdropFilter:"blur(16px)"},className:"relative transform overflow-hidden bg-[rgba(16,16,16,0.64)] border border-[rgba(46,46,46,0.32)] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:`${M&&Object.keys(d).length>0?"w-max":"w-[400px]"} flex flex-col justify-start items-center gap-[26px] h-max relative bg-[#0f0f0f]/60 rounded-3xl pt-[29px] pb-[24px] px-[26px] w-full min-w-[320px]`,children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:De=>{De.preventDefault(),y&&z==="generate"||z==="account"&&be?tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Please wait until completion."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}):z==="generate"&&M&&Object.keys(d).length>0?(L(!0),T(!1)):(e(!1),g(""),N(""),xe(""),Le([]),an(null),J(!1))},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-3.5",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"flex justify-start text-white text-base font-medium font-manrope w-full",children:"Generate your wallet"}),i.jsxs("div",{className:"flex justify-start items-center w-full",children:[i.jsxs("div",{className:"grid grid-cols-1 sm:hidden w-full",children:[i.jsx("select",{value:z,onChange:De=>{const At=De.target.value;if(!y){if(z==="generate"&&At!=="generate"&&M&&Object.keys(d).length>0){T(!1),L(!0);return}if(z==="account"&&At!=="account"&&be){tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Please wait until completion."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}X(At),g("")}},"aria-label":"Select a tab",className:"col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pl-3 pr-8 text-base text-gray-900 outline outline-1 -outline-offset-1 outline-gray-300 focus:outline focus:outline-2 focus:-outline-offset-2 dark:bg-white/5 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800",children:Jt==null?void 0:Jt.map(De=>i.jsx("option",{value:De==null?void 0:De.id,children:De==null?void 0:De.name},De==null?void 0:De.id))}),i.jsx(lE,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),i.jsx("div",{style:{boxShadow:"0 2px 4px 0 rgba(0, 0, 0, 0.16)"},className:"hidden sm:flex w-full justify-center items-center border border-[#2A2A2A] rounded-2xl p-1 h-10",children:i.jsx("nav",{"aria-label":"Tabs",role:"tablist",className:"flex items-center space-x-8",children:Jt==null?void 0:Jt.map(De=>{const At=(De==null?void 0:De.id)===z;return i.jsxs("a",{href:De==null?void 0:De.href,onClick:ze=>{ze.preventDefault();const rt=De==null?void 0:De.id;if(y)return;if(z==="generate"&&rt!=="generate"&&M&&Object.keys(d).length>0){T(!1),L(!0);return}if(z==="account"&&rt!=="account"&&be){tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Please wait until completion."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}X(rt);const mt=document.querySelector(De.href);mt&&mt.scrollIntoView({behavior:"smooth",block:"start"}),g("")},"aria-current":At?"page":void 0,className:Ye(At?"bg-[#2e2e2e] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] h-8 px-6 py-3 text-white":"text-[#878787]","group flex justify-center items-center px-1 py-4 text-[13px] font-medium tracking-[-0.13px] w-[220px] hover:text-white group"),children:[i.jsx(De.icon,{"aria-hidden":"true",className:Ye(At?"text-white group-hover:text-white":"text-[#878787] group-hover:text-white","-ml-0.5 mr-2 size-[18px]")}),i.jsx("span",{children:De==null?void 0:De.name})]},De==null?void 0:De.id)})})})]}),z==="generate"?i.jsx(Vwt,{loading:y,genWalletSuccess:M,genWalletData:d,showPrivateKey:P,genWalletName:x,setGenWalletName:g,errorMessage:C,setShowPrivateKey:T,setErrorMessage:N,setLoading:v,setGenWalletData:f,setGenWalletSuccess:F,handleListRequest:n,handlePageChange:r}):z==="agent"?i.jsx(Wwt,{agentWalletData:te,setAgentWalletData:fe,agentWalletName:q,setAgentWalletName:se,errorAgentMessage:ae,setErrorAgentMessage:W,loadingAgent:V,setLoadingAgent:ee,handleListRequest:n,handlePageChange:r,agentWalletAddress:oe,setAgentWalletAddress:de,agentWalletPkey:Ce,setAgentWalletPkey:me}):z==="account"?i.jsx(OSt,{errorConnectMessage:we,setErrorConnectMessage:xe,loadingConnect:be,setLoadingConnect:je,handleListRequest:n,handlePageChange:r,isBalanceValue:Qe,isBalanceLoading:Ie,isAgentInfoLoading:dt,isAgentInfoValue:nt,handleAgentWalletInfo:It,isBuilderFeeLoading:cn,isBuilderFeeValue:Xt,refreshAgent:ot,handleBuilderFeeInfo:Rt,isLighterInfoValue:Be,handleLighterWalletInfo:hn,isExtendedInfoValue:pt,handleExtendedWalletInfo:Yt,isPacificaInfoValue:wt,handlePacificaWalletInfo:Yt,isSelectAPIMenu:c,setIsSelectAPIMenu:u}):""]})})})})})]})]})}var df="top",gp="bottom",bp="right",ff="left",ole="auto",FT=[df,gp,bp,ff],gN="start",r_="end",MSt="clippingParents",jOe="viewport",e7="popper",RSt="reference",e1e=FT.reduce(function(t,e){return t.concat([e+"-"+gN,e+"-"+r_])},[]),EOe=[].concat(FT,[ole]).reduce(function(t,e){return t.concat([e,e+"-"+gN,e+"-"+r_])},[]),LSt="beforeRead",DSt="read",BSt="afterRead",$St="beforeMain",USt="main",zSt="afterMain",HSt="beforeWrite",VSt="write",WSt="afterWrite",qSt=[LSt,DSt,BSt,$St,USt,zSt,HSt,VSt,WSt];function ux(t){return t?(t.nodeName||"").toLowerCase():null}function sh(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q3(t){var e=sh(t).Element;return t instanceof e||t instanceof Element}function cp(t){var e=sh(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function lle(t){if(typeof ShadowRoot>"u")return!1;var e=sh(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function GSt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},s=e.attributes[n]||{},a=e.elements[n];!cp(a)||!ux(a)||(Object.assign(a.style,r),Object.keys(s).forEach(function(o){var l=s[o];l===!1?a.removeAttribute(o):a.setAttribute(o,l===!0?"":l)}))})}function KSt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],a=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=o.reduce(function(c,u){return c[u]="",c},{});!cp(s)||!ux(s)||(Object.assign(s.style,l),Object.keys(a).forEach(function(c){s.removeAttribute(c)}))})}}const _Oe={name:"applyStyles",enabled:!0,phase:"write",fn:GSt,effect:KSt,requires:["computeStyles"]};function K0(t){return t.split("-")[0]}var x3=Math.max,TR=Math.min,bN=Math.round;function Ate(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function kOe(){return!/^((?!chrome|android).)*safari/i.test(Ate())}function yN(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),s=1,a=1;e&&cp(t)&&(s=t.offsetWidth>0&&bN(r.width)/t.offsetWidth||1,a=t.offsetHeight>0&&bN(r.height)/t.offsetHeight||1);var o=Q3(t)?sh(t):window,l=o.visualViewport,c=!kOe()&&n,u=(r.left+(c&&l?l.offsetLeft:0))/s,d=(r.top+(c&&l?l.offsetTop:0))/a,f=r.width/s,x=r.height/a;return{width:f,height:x,top:d,right:u+f,bottom:d+x,left:u,x:u,y:d}}function cle(t){var e=yN(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function TOe(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&lle(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function C1(t){return sh(t).getComputedStyle(t)}function YSt(t){return["table","td","th"].indexOf(ux(t))>=0}function j2(t){return((Q3(t)?t.ownerDocument:t.document)||window.document).documentElement}function G$(t){return ux(t)==="html"?t:t.assignedSlot||t.parentNode||(lle(t)?t.host:null)||j2(t)}function t1e(t){return!cp(t)||C1(t).position==="fixed"?null:t.offsetParent}function XSt(t){var e=/firefox/i.test(Ate()),n=/Trident/i.test(Ate());if(n&&cp(t)){var r=C1(t);if(r.position==="fixed")return null}var s=G$(t);for(lle(s)&&(s=s.host);cp(s)&&["html","body"].indexOf(ux(s))<0;){var a=C1(s);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||e&&a.willChange==="filter"||e&&a.filter&&a.filter!=="none")return s;s=s.parentNode}return null}function OT(t){for(var e=sh(t),n=t1e(t);n&&YSt(n)&&C1(n).position==="static";)n=t1e(n);return n&&(ux(n)==="html"||ux(n)==="body"&&C1(n).position==="static")?e:n||XSt(t)||e}function ule(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function A9(t,e,n){return x3(t,TR(e,n))}function QSt(t,e,n){var r=A9(t,e,n);return r>n?n:r}function POe(){return{top:0,right:0,bottom:0,left:0}}function IOe(t){return Object.assign({},POe(),t)}function FOe(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var ZSt=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,IOe(typeof e!="number"?e:FOe(e,FT))};function JSt(t){var e,n=t.state,r=t.name,s=t.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,l=K0(n.placement),c=ule(l),u=[ff,bp].indexOf(l)>=0,d=u?"height":"width";if(!(!a||!o)){var f=ZSt(s.padding,n),x=cle(a),g=c==="y"?df:ff,y=c==="y"?gp:bp,v=n.rects.reference[d]+n.rects.reference[c]-o[c]-n.rects.popper[d],C=o[c]-n.rects.reference[c],N=OT(a),P=N?c==="y"?N.clientHeight||0:N.clientWidth||0:0,T=v/2-C/2,M=f[g],F=P-x[d]-f[y],$=P/2-x[d]/2+T,L=A9(M,$,F),z=c;n.modifiersData[r]=(e={},e[z]=L,e.centerOffset=L-$,e)}}function eNt(t){var e=t.state,n=t.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||TOe(e.elements.popper,s)&&(e.elements.arrow=s))}const tNt={name:"arrow",enabled:!0,phase:"main",fn:JSt,effect:eNt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vN(t){return t.split("-")[1]}var nNt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function rNt(t,e){var n=t.x,r=t.y,s=e.devicePixelRatio||1;return{x:bN(n*s)/s||0,y:bN(r*s)/s||0}}function n1e(t){var e,n=t.popper,r=t.popperRect,s=t.placement,a=t.variation,o=t.offsets,l=t.position,c=t.gpuAcceleration,u=t.adaptive,d=t.roundOffsets,f=t.isFixed,x=o.x,g=x===void 0?0:x,y=o.y,v=y===void 0?0:y,C=typeof d=="function"?d({x:g,y:v}):{x:g,y:v};g=C.x,v=C.y;var N=o.hasOwnProperty("x"),P=o.hasOwnProperty("y"),T=ff,M=df,F=window;if(u){var $=OT(n),L="clientHeight",z="clientWidth";if($===sh(n)&&($=j2(n),C1($).position!=="static"&&l==="absolute"&&(L="scrollHeight",z="scrollWidth")),$=$,s===df||(s===ff||s===bp)&&a===r_){M=gp;var X=f&&$===F&&F.visualViewport?F.visualViewport.height:$[L];v-=X-r.height,v*=c?1:-1}if(s===ff||(s===df||s===gp)&&a===r_){T=bp;var ne=f&&$===F&&F.visualViewport?F.visualViewport.width:$[z];g-=ne-r.width,g*=c?1:-1}}var J=Object.assign({position:l},u&&nNt),K=d===!0?rNt({x:g,y:v},sh(n)):{x:g,y:v};if(g=K.x,v=K.y,c){var te;return Object.assign({},J,(te={},te[M]=P?"0":"",te[T]=N?"0":"",te.transform=(F.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",te))}return Object.assign({},J,(e={},e[M]=P?v+"px":"",e[T]=N?g+"px":"",e.transform="",e))}function sNt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,s=r===void 0?!0:r,a=n.adaptive,o=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,u={placement:K0(e.placement),variation:vN(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,n1e(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,n1e(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const iNt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:sNt,data:{}};var GI={passive:!0};function aNt(t){var e=t.state,n=t.instance,r=t.options,s=r.scroll,a=s===void 0?!0:s,o=r.resize,l=o===void 0?!0:o,c=sh(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return a&&u.forEach(function(d){d.addEventListener("scroll",n.update,GI)}),l&&c.addEventListener("resize",n.update,GI),function(){a&&u.forEach(function(d){d.removeEventListener("scroll",n.update,GI)}),l&&c.removeEventListener("resize",n.update,GI)}}const oNt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:aNt,data:{}};var lNt={left:"right",right:"left",bottom:"top",top:"bottom"};function nM(t){return t.replace(/left|right|bottom|top/g,function(e){return lNt[e]})}var cNt={start:"end",end:"start"};function r1e(t){return t.replace(/start|end/g,function(e){return cNt[e]})}function dle(t){var e=sh(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function fle(t){return yN(j2(t)).left+dle(t).scrollLeft}function uNt(t,e){var n=sh(t),r=j2(t),s=n.visualViewport,a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;var u=kOe();(u||!u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l+fle(t),y:c}}function dNt(t){var e,n=j2(t),r=dle(t),s=(e=t.ownerDocument)==null?void 0:e.body,a=x3(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=x3(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),l=-r.scrollLeft+fle(t),c=-r.scrollTop;return C1(s||n).direction==="rtl"&&(l+=x3(n.clientWidth,s?s.clientWidth:0)-a),{width:a,height:o,x:l,y:c}}function hle(t){var e=C1(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function OOe(t){return["html","body","#document"].indexOf(ux(t))>=0?t.ownerDocument.body:cp(t)&&hle(t)?t:OOe(G$(t))}function j9(t,e){var n;e===void 0&&(e=[]);var r=OOe(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),a=sh(r),o=s?[a].concat(a.visualViewport||[],hle(r)?r:[]):r,l=e.concat(o);return s?l:l.concat(j9(G$(o)))}function jte(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function fNt(t,e){var n=yN(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function s1e(t,e,n){return e===jOe?jte(uNt(t,n)):Q3(e)?fNt(e,n):jte(dNt(j2(t)))}function hNt(t){var e=j9(G$(t)),n=["absolute","fixed"].indexOf(C1(t).position)>=0,r=n&&cp(t)?OT(t):t;return Q3(r)?e.filter(function(s){return Q3(s)&&TOe(s,r)&&ux(s)!=="body"}):[]}function pNt(t,e,n,r){var s=e==="clippingParents"?hNt(t):[].concat(e),a=[].concat(s,[n]),o=a[0],l=a.reduce(function(c,u){var d=s1e(t,u,r);return c.top=x3(d.top,c.top),c.right=TR(d.right,c.right),c.bottom=TR(d.bottom,c.bottom),c.left=x3(d.left,c.left),c},s1e(t,o,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function MOe(t){var e=t.reference,n=t.element,r=t.placement,s=r?K0(r):null,a=r?vN(r):null,o=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(s){case df:c={x:o,y:e.y-n.height};break;case gp:c={x:o,y:e.y+e.height};break;case bp:c={x:e.x+e.width,y:l};break;case ff:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var u=s?ule(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(a){case gN:c[u]=c[u]-(e[d]/2-n[d]/2);break;case r_:c[u]=c[u]+(e[d]/2-n[d]/2);break}}return c}function s_(t,e){e===void 0&&(e={});var n=e,r=n.placement,s=r===void 0?t.placement:r,a=n.strategy,o=a===void 0?t.strategy:a,l=n.boundary,c=l===void 0?MSt:l,u=n.rootBoundary,d=u===void 0?jOe:u,f=n.elementContext,x=f===void 0?e7:f,g=n.altBoundary,y=g===void 0?!1:g,v=n.padding,C=v===void 0?0:v,N=IOe(typeof C!="number"?C:FOe(C,FT)),P=x===e7?RSt:e7,T=t.rects.popper,M=t.elements[y?P:x],F=pNt(Q3(M)?M:M.contextElement||j2(t.elements.popper),c,d,o),$=yN(t.elements.reference),L=MOe({reference:$,element:T,strategy:"absolute",placement:s}),z=jte(Object.assign({},T,L)),X=x===e7?z:$,ne={top:F.top-X.top+N.top,bottom:X.bottom-F.bottom+N.bottom,left:F.left-X.left+N.left,right:X.right-F.right+N.right},J=t.modifiersData.offset;if(x===e7&&J){var K=J[s];Object.keys(ne).forEach(function(te){var fe=[bp,gp].indexOf(te)>=0?1:-1,q=[df,gp].indexOf(te)>=0?"y":"x";ne[te]+=K[q]*fe})}return ne}function mNt(t,e){e===void 0&&(e={});var n=e,r=n.placement,s=n.boundary,a=n.rootBoundary,o=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,u=c===void 0?EOe:c,d=vN(r),f=d?l?e1e:e1e.filter(function(y){return vN(y)===d}):FT,x=f.filter(function(y){return u.indexOf(y)>=0});x.length===0&&(x=f);var g=x.reduce(function(y,v){return y[v]=s_(t,{placement:v,boundary:s,rootBoundary:a,padding:o})[K0(v)],y},{});return Object.keys(g).sort(function(y,v){return g[y]-g[v]})}function xNt(t){if(K0(t)===ole)return[];var e=nM(t);return[r1e(t),e,r1e(e)]}function gNt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var s=n.mainAxis,a=s===void 0?!0:s,o=n.altAxis,l=o===void 0?!0:o,c=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,x=n.altBoundary,g=n.flipVariations,y=g===void 0?!0:g,v=n.allowedAutoPlacements,C=e.options.placement,N=K0(C),P=N===C,T=c||(P||!y?[nM(C)]:xNt(C)),M=[C].concat(T).reduce(function(me,we){return me.concat(K0(we)===ole?mNt(e,{placement:we,boundary:d,rootBoundary:f,padding:u,flipVariations:y,allowedAutoPlacements:v}):we)},[]),F=e.rects.reference,$=e.rects.popper,L=new Map,z=!0,X=M[0],ne=0;ne<M.length;ne++){var J=M[ne],K=K0(J),te=vN(J)===gN,fe=[df,gp].indexOf(K)>=0,q=fe?"width":"height",se=s_(e,{placement:J,boundary:d,rootBoundary:f,altBoundary:x,padding:u}),ae=fe?te?bp:ff:te?gp:df;F[q]>$[q]&&(ae=nM(ae));var W=nM(ae),V=[];if(a&&V.push(se[K]<=0),l&&V.push(se[ae]<=0,se[W]<=0),V.every(function(me){return me})){X=J,z=!1;break}L.set(J,V)}if(z)for(var ee=y?3:1,oe=function(we){var xe=M.find(function(be){var je=L.get(be);if(je)return je.slice(0,we).every(function(Ie){return Ie})});if(xe)return X=xe,"break"},de=ee;de>0;de--){var Ce=oe(de);if(Ce==="break")break}e.placement!==X&&(e.modifiersData[r]._skip=!0,e.placement=X,e.reset=!0)}}const bNt={name:"flip",enabled:!0,phase:"main",fn:gNt,requiresIfExists:["offset"],data:{_skip:!1}};function i1e(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function a1e(t){return[df,bp,gp,ff].some(function(e){return t[e]>=0})}function yNt(t){var e=t.state,n=t.name,r=e.rects.reference,s=e.rects.popper,a=e.modifiersData.preventOverflow,o=s_(e,{elementContext:"reference"}),l=s_(e,{altBoundary:!0}),c=i1e(o,r),u=i1e(l,s,a),d=a1e(c),f=a1e(u);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const vNt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:yNt};function wNt(t,e,n){var r=K0(t),s=[ff,df].indexOf(r)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=a[0],l=a[1];return o=o||0,l=(l||0)*s,[ff,bp].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function CNt(t){var e=t.state,n=t.options,r=t.name,s=n.offset,a=s===void 0?[0,0]:s,o=EOe.reduce(function(d,f){return d[f]=wNt(f,e.rects,a),d},{}),l=o[e.placement],c=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}const SNt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:CNt};function NNt(t){var e=t.state,n=t.name;e.modifiersData[n]=MOe({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const ANt={name:"popperOffsets",enabled:!0,phase:"read",fn:NNt,data:{}};function jNt(t){return t==="x"?"y":"x"}function ENt(t){var e=t.state,n=t.options,r=t.name,s=n.mainAxis,a=s===void 0?!0:s,o=n.altAxis,l=o===void 0?!1:o,c=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,x=n.tether,g=x===void 0?!0:x,y=n.tetherOffset,v=y===void 0?0:y,C=s_(e,{boundary:c,rootBoundary:u,padding:f,altBoundary:d}),N=K0(e.placement),P=vN(e.placement),T=!P,M=ule(N),F=jNt(M),$=e.modifiersData.popperOffsets,L=e.rects.reference,z=e.rects.popper,X=typeof v=="function"?v(Object.assign({},e.rects,{placement:e.placement})):v,ne=typeof X=="number"?{mainAxis:X,altAxis:X}:Object.assign({mainAxis:0,altAxis:0},X),J=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,K={x:0,y:0};if($){if(a){var te,fe=M==="y"?df:ff,q=M==="y"?gp:bp,se=M==="y"?"height":"width",ae=$[M],W=ae+C[fe],V=ae-C[q],ee=g?-z[se]/2:0,oe=P===gN?L[se]:z[se],de=P===gN?-z[se]:-L[se],Ce=e.elements.arrow,me=g&&Ce?cle(Ce):{width:0,height:0},we=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:POe(),xe=we[fe],be=we[q],je=A9(0,L[se],me[se]),Ie=T?L[se]/2-ee-je-xe-ne.mainAxis:oe-je-xe-ne.mainAxis,Re=T?-L[se]/2+ee+je+be+ne.mainAxis:de+je+be+ne.mainAxis,Qe=e.elements.arrow&&OT(e.elements.arrow),Ke=Qe?M==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,dt=(te=J==null?void 0:J[M])!=null?te:0,tt=ae+Ie-dt-Ke,nt=ae+Re-dt,Le=A9(g?TR(W,tt):W,ae,g?x3(V,nt):V);$[M]=Le,K[M]=Le-ae}if(l){var Be,ht=M==="x"?df:ff,pt=M==="x"?gp:bp,Gt=$[F],wt=F==="y"?"height":"width",nn=Gt+C[ht],cn=Gt-C[pt],Un=[df,ff].indexOf(N)!==-1,Xt=(Be=J==null?void 0:J[F])!=null?Be:0,an=Un?nn:Gt-L[wt]-z[wt]-Xt+ne.altAxis,Jt=Un?Gt+L[wt]+z[wt]-Xt-ne.altAxis:cn,Ye=g&&Un?QSt(an,Gt,Jt):A9(g?an:nn,Gt,g?Jt:cn);$[F]=Ye,K[F]=Ye-Gt}e.modifiersData[r]=K}}const _Nt={name:"preventOverflow",enabled:!0,phase:"main",fn:ENt,requiresIfExists:["offset"]};function kNt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function TNt(t){return t===sh(t)||!cp(t)?dle(t):kNt(t)}function PNt(t){var e=t.getBoundingClientRect(),n=bN(e.width)/t.offsetWidth||1,r=bN(e.height)/t.offsetHeight||1;return n!==1||r!==1}function INt(t,e,n){n===void 0&&(n=!1);var r=cp(e),s=cp(e)&&PNt(e),a=j2(e),o=yN(t,s,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((ux(e)!=="body"||hle(a))&&(l=TNt(e)),cp(e)?(c=yN(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):a&&(c.x=fle(a))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function FNt(t){var e=new Map,n=new Set,r=[];t.forEach(function(a){e.set(a.name,a)});function s(a){n.add(a.name);var o=[].concat(a.requires||[],a.requiresIfExists||[]);o.forEach(function(l){if(!n.has(l)){var c=e.get(l);c&&s(c)}}),r.push(a)}return t.forEach(function(a){n.has(a.name)||s(a)}),r}function ONt(t){var e=FNt(t);return qSt.reduce(function(n,r){return n.concat(e.filter(function(s){return s.phase===r}))},[])}function MNt(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function RNt(t){var e=t.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var o1e={placement:"bottom",modifiers:[],strategy:"absolute"};function l1e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function LNt(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,s=e.defaultOptions,a=s===void 0?o1e:s;return function(l,c,u){u===void 0&&(u=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},o1e,a),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},f=[],x=!1,g={state:d,setOptions:function(N){var P=typeof N=="function"?N(d.options):N;v(),d.options=Object.assign({},a,d.options,P),d.scrollParents={reference:Q3(l)?j9(l):l.contextElement?j9(l.contextElement):[],popper:j9(c)};var T=ONt(RNt([].concat(r,d.options.modifiers)));return d.orderedModifiers=T.filter(function(M){return M.enabled}),y(),g.update()},forceUpdate:function(){if(!x){var N=d.elements,P=N.reference,T=N.popper;if(l1e(P,T)){d.rects={reference:INt(P,OT(T),d.options.strategy==="fixed"),popper:cle(T)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(ne){return d.modifiersData[ne.name]=Object.assign({},ne.data)});for(var M=0;M<d.orderedModifiers.length;M++){if(d.reset===!0){d.reset=!1,M=-1;continue}var F=d.orderedModifiers[M],$=F.fn,L=F.options,z=L===void 0?{}:L,X=F.name;typeof $=="function"&&(d=$({state:d,options:z,name:X,instance:g})||d)}}}},update:MNt(function(){return new Promise(function(C){g.forceUpdate(),C(d)})}),destroy:function(){v(),x=!0}};if(!l1e(l,c))return g;g.setOptions(u).then(function(C){!x&&u.onFirstUpdate&&u.onFirstUpdate(C)});function y(){d.orderedModifiers.forEach(function(C){var N=C.name,P=C.options,T=P===void 0?{}:P,M=C.effect;if(typeof M=="function"){var F=M({state:d,name:N,instance:g,options:T}),$=function(){};f.push(F||$)}})}function v(){f.forEach(function(C){return C()}),f=[]}return g}}var DNt=[oNt,ANt,iNt,_Oe,SNt,bNt,_Nt,tNt,vNt],BNt=LNt({defaultModifiers:DNt}),$Nt="tippy-box",ROe="tippy-content",UNt="tippy-backdrop",LOe="tippy-arrow",DOe="tippy-svg-arrow",Wv={passive:!0,capture:!0},BOe=function(){return document.body};function lW(t,e,n){if(Array.isArray(t)){var r=t[e];return r??(Array.isArray(n)?n[e]:n)}return t}function ple(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function $Oe(t,e){return typeof t=="function"?t.apply(void 0,e):t}function c1e(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function zNt(t){return t.split(/\s+/).filter(Boolean)}function HC(t){return[].concat(t)}function u1e(t,e){t.indexOf(e)===-1&&t.push(e)}function HNt(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function VNt(t){return t.split("-")[0]}function PR(t){return[].slice.call(t)}function d1e(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function E9(){return document.createElement("div")}function K$(t){return["Element","Fragment"].some(function(e){return ple(t,e)})}function WNt(t){return ple(t,"NodeList")}function UOe(t){return ple(t,"MouseEvent")}function qNt(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function GNt(t){return K$(t)?[t]:WNt(t)?PR(t):Array.isArray(t)?t:PR(document.querySelectorAll(t))}function cW(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function f1e(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function zOe(t){var e,n=HC(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function KNt(t,e){var n=e.clientX,r=e.clientY;return t.every(function(s){var a=s.popperRect,o=s.popperState,l=s.props,c=l.interactiveBorder,u=VNt(o.placement),d=o.modifiersData.offset;if(!d)return!0;var f=u==="bottom"?d.top.y:0,x=u==="top"?d.bottom.y:0,g=u==="right"?d.left.x:0,y=u==="left"?d.right.x:0,v=a.top-r+f>c,C=r-a.bottom-x>c,N=a.left-n+g>c,P=n-a.right-y>c;return v||C||N||P})}function uW(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){t[r](s,n)})}function h1e(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var _0={isTouch:!1},p1e=0;function YNt(){_0.isTouch||(_0.isTouch=!0,window.performance&&document.addEventListener("mousemove",HOe))}function HOe(){var t=performance.now();t-p1e<20&&(_0.isTouch=!1,document.removeEventListener("mousemove",HOe)),p1e=t}function XNt(){var t=document.activeElement;if(qNt(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function QNt(){document.addEventListener("touchstart",YNt,Wv),window.addEventListener("blur",XNt)}var ZNt=typeof window<"u"&&typeof document<"u",JNt=ZNt?!!window.msCrypto:!1,eAt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},tAt={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},mm=Object.assign({appendTo:BOe,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},eAt,tAt),nAt=Object.keys(mm),rAt=function(e){var n=Object.keys(e);n.forEach(function(r){mm[r]=e[r]})};function VOe(t){var e=t.plugins||[],n=e.reduce(function(r,s){var a=s.name,o=s.defaultValue;if(a){var l;r[a]=t[a]!==void 0?t[a]:(l=mm[a])!=null?l:o}return r},{});return Object.assign({},t,n)}function sAt(t,e){var n=e?Object.keys(VOe(Object.assign({},mm,{plugins:e}))):nAt,r=n.reduce(function(s,a){var o=(t.getAttribute("data-tippy-"+a)||"").trim();if(!o)return s;if(a==="content")s[a]=o;else try{s[a]=JSON.parse(o)}catch{s[a]=o}return s},{});return r}function m1e(t,e){var n=Object.assign({},e,{content:$Oe(e.content,[t])},e.ignoreAttributes?{}:sAt(t,e.plugins));return n.aria=Object.assign({},mm.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var iAt=function(){return"innerHTML"};function Ete(t,e){t[iAt()]=e}function x1e(t){var e=E9();return t===!0?e.className=LOe:(e.className=DOe,K$(t)?e.appendChild(t):Ete(e,t)),e}function g1e(t,e){K$(e.content)?(Ete(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ete(t,e.content):t.textContent=e.content)}function _te(t){var e=t.firstElementChild,n=PR(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(ROe)}),arrow:n.find(function(r){return r.classList.contains(LOe)||r.classList.contains(DOe)}),backdrop:n.find(function(r){return r.classList.contains(UNt)})}}function WOe(t){var e=E9(),n=E9();n.className=$Nt,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=E9();r.className=ROe,r.setAttribute("data-state","hidden"),g1e(r,t.props),e.appendChild(n),n.appendChild(r),s(t.props,t.props);function s(a,o){var l=_te(e),c=l.box,u=l.content,d=l.arrow;o.theme?c.setAttribute("data-theme",o.theme):c.removeAttribute("data-theme"),typeof o.animation=="string"?c.setAttribute("data-animation",o.animation):c.removeAttribute("data-animation"),o.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?c.setAttribute("role",o.role):c.removeAttribute("role"),(a.content!==o.content||a.allowHTML!==o.allowHTML)&&g1e(u,t.props),o.arrow?d?a.arrow!==o.arrow&&(c.removeChild(d),c.appendChild(x1e(o.arrow))):c.appendChild(x1e(o.arrow)):d&&c.removeChild(d)}return{popper:e,onUpdate:s}}WOe.$$tippy=!0;var aAt=1,KI=[],dW=[];function oAt(t,e){var n=m1e(t,Object.assign({},mm,VOe(d1e(e)))),r,s,a,o=!1,l=!1,c=!1,u=!1,d,f,x,g=[],y=c1e(tt,n.interactiveDebounce),v,C=aAt++,N=null,P=HNt(n.plugins),T={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},M={id:C,reference:t,popper:E9(),popperInstance:N,props:n,state:T,plugins:P,clearDelayTimeouts:an,setProps:Jt,setContent:Ye,show:Je,hide:It,hideWithInteractivity:hn,enable:Un,disable:Xt,unmount:Yt,destroy:Rt};if(!n.render)return M;var F=n.render(M),$=F.popper,L=F.onUpdate;$.setAttribute("data-tippy-root",""),$.id="tippy-"+M.id,M.popper=$,t._tippy=M,$._tippy=M;var z=P.map(function(ot){return ot.fn(M)}),X=t.hasAttribute("aria-expanded");return Qe(),ee(),ae(),W("onCreate",[M]),n.showOnCreate&&nn(),$.addEventListener("mouseenter",function(){M.props.interactive&&M.state.isVisible&&M.clearDelayTimeouts()}),$.addEventListener("mouseleave",function(){M.props.interactive&&M.props.trigger.indexOf("mouseenter")>=0&&fe().addEventListener("mousemove",y)}),M;function ne(){var ot=M.props.touch;return Array.isArray(ot)?ot:[ot,0]}function J(){return ne()[0]==="hold"}function K(){var ot;return!!((ot=M.props.render)!=null&&ot.$$tippy)}function te(){return v||t}function fe(){var ot=te().parentNode;return ot?zOe(ot):document}function q(){return _te($)}function se(ot){return M.state.isMounted&&!M.state.isVisible||_0.isTouch||d&&d.type==="focus"?0:lW(M.props.delay,ot?0:1,mm.delay)}function ae(ot){ot===void 0&&(ot=!1),$.style.pointerEvents=M.props.interactive&&!ot?"":"none",$.style.zIndex=""+M.props.zIndex}function W(ot,De,At){if(At===void 0&&(At=!0),z.forEach(function(rt){rt[ot]&&rt[ot].apply(rt,De)}),At){var ze;(ze=M.props)[ot].apply(ze,De)}}function V(){var ot=M.props.aria;if(ot.content){var De="aria-"+ot.content,At=$.id,ze=HC(M.props.triggerTarget||t);ze.forEach(function(rt){var mt=rt.getAttribute(De);if(M.state.isVisible)rt.setAttribute(De,mt?mt+" "+At:At);else{var Lt=mt&&mt.replace(At,"").trim();Lt?rt.setAttribute(De,Lt):rt.removeAttribute(De)}})}}function ee(){if(!(X||!M.props.aria.expanded)){var ot=HC(M.props.triggerTarget||t);ot.forEach(function(De){M.props.interactive?De.setAttribute("aria-expanded",M.state.isVisible&&De===te()?"true":"false"):De.removeAttribute("aria-expanded")})}}function oe(){fe().removeEventListener("mousemove",y),KI=KI.filter(function(ot){return ot!==y})}function de(ot){if(!(_0.isTouch&&(c||ot.type==="mousedown"))){var De=ot.composedPath&&ot.composedPath()[0]||ot.target;if(!(M.props.interactive&&h1e($,De))){if(HC(M.props.triggerTarget||t).some(function(At){return h1e(At,De)})){if(_0.isTouch||M.state.isVisible&&M.props.trigger.indexOf("click")>=0)return}else W("onClickOutside",[M,ot]);M.props.hideOnClick===!0&&(M.clearDelayTimeouts(),M.hide(),l=!0,setTimeout(function(){l=!1}),M.state.isMounted||xe())}}}function Ce(){c=!0}function me(){c=!1}function we(){var ot=fe();ot.addEventListener("mousedown",de,!0),ot.addEventListener("touchend",de,Wv),ot.addEventListener("touchstart",me,Wv),ot.addEventListener("touchmove",Ce,Wv)}function xe(){var ot=fe();ot.removeEventListener("mousedown",de,!0),ot.removeEventListener("touchend",de,Wv),ot.removeEventListener("touchstart",me,Wv),ot.removeEventListener("touchmove",Ce,Wv)}function be(ot,De){Ie(ot,function(){!M.state.isVisible&&$.parentNode&&$.parentNode.contains($)&&De()})}function je(ot,De){Ie(ot,De)}function Ie(ot,De){var At=q().box;function ze(rt){rt.target===At&&(uW(At,"remove",ze),De())}if(ot===0)return De();uW(At,"remove",f),uW(At,"add",ze),f=ze}function Re(ot,De,At){At===void 0&&(At=!1);var ze=HC(M.props.triggerTarget||t);ze.forEach(function(rt){rt.addEventListener(ot,De,At),g.push({node:rt,eventType:ot,handler:De,options:At})})}function Qe(){J()&&(Re("touchstart",dt,{passive:!0}),Re("touchend",nt,{passive:!0})),zNt(M.props.trigger).forEach(function(ot){if(ot!=="manual")switch(Re(ot,dt),ot){case"mouseenter":Re("mouseleave",nt);break;case"focus":Re(JNt?"focusout":"blur",Le);break;case"focusin":Re("focusout",Le);break}})}function Ke(){g.forEach(function(ot){var De=ot.node,At=ot.eventType,ze=ot.handler,rt=ot.options;De.removeEventListener(At,ze,rt)}),g=[]}function dt(ot){var De,At=!1;if(!(!M.state.isEnabled||Be(ot)||l)){var ze=((De=d)==null?void 0:De.type)==="focus";d=ot,v=ot.currentTarget,ee(),!M.state.isVisible&&UOe(ot)&&KI.forEach(function(rt){return rt(ot)}),ot.type==="click"&&(M.props.trigger.indexOf("mouseenter")<0||o)&&M.props.hideOnClick!==!1&&M.state.isVisible?At=!0:nn(ot),ot.type==="click"&&(o=!At),At&&!ze&&cn(ot)}}function tt(ot){var De=ot.target,At=te().contains(De)||$.contains(De);if(!(ot.type==="mousemove"&&At)){var ze=wt().concat($).map(function(rt){var mt,Lt=rt._tippy,kt=(mt=Lt.popperInstance)==null?void 0:mt.state;return kt?{popperRect:rt.getBoundingClientRect(),popperState:kt,props:n}:null}).filter(Boolean);KNt(ze,ot)&&(oe(),cn(ot))}}function nt(ot){var De=Be(ot)||M.props.trigger.indexOf("click")>=0&&o;if(!De){if(M.props.interactive){M.hideWithInteractivity(ot);return}cn(ot)}}function Le(ot){M.props.trigger.indexOf("focusin")<0&&ot.target!==te()||M.props.interactive&&ot.relatedTarget&&$.contains(ot.relatedTarget)||cn(ot)}function Be(ot){return _0.isTouch?J()!==ot.type.indexOf("touch")>=0:!1}function ht(){pt();var ot=M.props,De=ot.popperOptions,At=ot.placement,ze=ot.offset,rt=ot.getReferenceClientRect,mt=ot.moveTransition,Lt=K()?_te($).arrow:null,kt=rt?{getBoundingClientRect:rt,contextElement:rt.contextElement||te()}:t,dn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(An){var kn=An.state;if(K()){var yn=q(),Vn=yn.box;["placement","reference-hidden","escaped"].forEach(function(Kn){Kn==="placement"?Vn.setAttribute("data-placement",kn.placement):kn.attributes.popper["data-popper-"+Kn]?Vn.setAttribute("data-"+Kn,""):Vn.removeAttribute("data-"+Kn)}),kn.attributes.popper={}}}},rn=[{name:"offset",options:{offset:ze}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!mt}},dn];K()&&Lt&&rn.push({name:"arrow",options:{element:Lt,padding:3}}),rn.push.apply(rn,(De==null?void 0:De.modifiers)||[]),M.popperInstance=BNt(kt,$,Object.assign({},De,{placement:At,onFirstUpdate:x,modifiers:rn}))}function pt(){M.popperInstance&&(M.popperInstance.destroy(),M.popperInstance=null)}function Gt(){var ot=M.props.appendTo,De,At=te();M.props.interactive&&ot===BOe||ot==="parent"?De=At.parentNode:De=$Oe(ot,[At]),De.contains($)||De.appendChild($),M.state.isMounted=!0,ht()}function wt(){return PR($.querySelectorAll("[data-tippy-root]"))}function nn(ot){M.clearDelayTimeouts(),ot&&W("onTrigger",[M,ot]),we();var De=se(!0),At=ne(),ze=At[0],rt=At[1];_0.isTouch&&ze==="hold"&&rt&&(De=rt),De?r=setTimeout(function(){M.show()},De):M.show()}function cn(ot){if(M.clearDelayTimeouts(),W("onUntrigger",[M,ot]),!M.state.isVisible){xe();return}if(!(M.props.trigger.indexOf("mouseenter")>=0&&M.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(ot.type)>=0&&o)){var De=se(!1);De?s=setTimeout(function(){M.state.isVisible&&M.hide()},De):a=requestAnimationFrame(function(){M.hide()})}}function Un(){M.state.isEnabled=!0}function Xt(){M.hide(),M.state.isEnabled=!1}function an(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(a)}function Jt(ot){if(!M.state.isDestroyed){W("onBeforeUpdate",[M,ot]),Ke();var De=M.props,At=m1e(t,Object.assign({},De,d1e(ot),{ignoreAttributes:!0}));M.props=At,Qe(),De.interactiveDebounce!==At.interactiveDebounce&&(oe(),y=c1e(tt,At.interactiveDebounce)),De.triggerTarget&&!At.triggerTarget?HC(De.triggerTarget).forEach(function(ze){ze.removeAttribute("aria-expanded")}):At.triggerTarget&&t.removeAttribute("aria-expanded"),ee(),ae(),L&&L(De,At),M.popperInstance&&(ht(),wt().forEach(function(ze){requestAnimationFrame(ze._tippy.popperInstance.forceUpdate)})),W("onAfterUpdate",[M,ot])}}function Ye(ot){M.setProps({content:ot})}function Je(){var ot=M.state.isVisible,De=M.state.isDestroyed,At=!M.state.isEnabled,ze=_0.isTouch&&!M.props.touch,rt=lW(M.props.duration,0,mm.duration);if(!(ot||De||At||ze)&&!te().hasAttribute("disabled")&&(W("onShow",[M],!1),M.props.onShow(M)!==!1)){if(M.state.isVisible=!0,K()&&($.style.visibility="visible"),ae(),we(),M.state.isMounted||($.style.transition="none"),K()){var mt=q(),Lt=mt.box,kt=mt.content;cW([Lt,kt],0)}x=function(){var rn;if(!(!M.state.isVisible||u)){if(u=!0,$.offsetHeight,$.style.transition=M.props.moveTransition,K()&&M.props.animation){var gn=q(),An=gn.box,kn=gn.content;cW([An,kn],rt),f1e([An,kn],"visible")}V(),ee(),u1e(dW,M),(rn=M.popperInstance)==null||rn.forceUpdate(),W("onMount",[M]),M.props.animation&&K()&&je(rt,function(){M.state.isShown=!0,W("onShown",[M])})}},Gt()}}function It(){var ot=!M.state.isVisible,De=M.state.isDestroyed,At=!M.state.isEnabled,ze=lW(M.props.duration,1,mm.duration);if(!(ot||De||At)&&(W("onHide",[M],!1),M.props.onHide(M)!==!1)){if(M.state.isVisible=!1,M.state.isShown=!1,u=!1,o=!1,K()&&($.style.visibility="hidden"),oe(),xe(),ae(!0),K()){var rt=q(),mt=rt.box,Lt=rt.content;M.props.animation&&(cW([mt,Lt],ze),f1e([mt,Lt],"hidden"))}V(),ee(),M.props.animation?K()&&be(ze,M.unmount):M.unmount()}}function hn(ot){fe().addEventListener("mousemove",y),u1e(KI,y),y(ot)}function Yt(){M.state.isVisible&&M.hide(),M.state.isMounted&&(pt(),wt().forEach(function(ot){ot._tippy.unmount()}),$.parentNode&&$.parentNode.removeChild($),dW=dW.filter(function(ot){return ot!==M}),M.state.isMounted=!1,W("onHidden",[M]))}function Rt(){M.state.isDestroyed||(M.clearDelayTimeouts(),M.unmount(),Ke(),delete t._tippy,M.state.isDestroyed=!0,W("onDestroy",[M]))}}function MT(t,e){e===void 0&&(e={});var n=mm.plugins.concat(e.plugins||[]);QNt();var r=Object.assign({},e,{plugins:n}),s=GNt(t),a=s.reduce(function(o,l){var c=l&&oAt(l,r);return c&&o.push(c),o},[]);return K$(t)?a[0]:a}MT.defaultProps=mm;MT.setDefaultProps=rAt;MT.currentInput=_0;Object.assign({},_Oe,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});var kte={clientX:0,clientY:0},YI=[];function qOe(t){var e=t.clientX,n=t.clientY;kte={clientX:e,clientY:n}}function lAt(t){t.addEventListener("mousemove",qOe)}function cAt(t){t.removeEventListener("mousemove",qOe)}var uAt={name:"followCursor",defaultValue:!1,fn:function(e){var n=e.reference,r=zOe(e.props.triggerTarget||n),s=!1,a=!1,o=!0,l=e.props;function c(){return e.props.followCursor==="initial"&&e.state.isVisible}function u(){r.addEventListener("mousemove",x)}function d(){r.removeEventListener("mousemove",x)}function f(){s=!0,e.setProps({getReferenceClientRect:null}),s=!1}function x(v){var C=v.target?n.contains(v.target):!0,N=e.props.followCursor,P=v.clientX,T=v.clientY,M=n.getBoundingClientRect(),F=P-M.left,$=T-M.top;(C||!e.props.interactive)&&e.setProps({getReferenceClientRect:function(){var z=n.getBoundingClientRect(),X=P,ne=T;N==="initial"&&(X=z.left+F,ne=z.top+$);var J=N==="horizontal"?z.top:ne,K=N==="vertical"?z.right:X,te=N==="horizontal"?z.bottom:ne,fe=N==="vertical"?z.left:X;return{width:K-fe,height:te-J,top:J,right:K,bottom:te,left:fe}}})}function g(){e.props.followCursor&&(YI.push({instance:e,doc:r}),lAt(r))}function y(){YI=YI.filter(function(v){return v.instance!==e}),YI.filter(function(v){return v.doc===r}).length===0&&cAt(r)}return{onCreate:g,onDestroy:y,onBeforeUpdate:function(){l=e.props},onAfterUpdate:function(C,N){var P=N.followCursor;s||P!==void 0&&l.followCursor!==P&&(y(),P?(g(),e.state.isMounted&&!a&&!c()&&u()):(d(),f()))},onMount:function(){e.props.followCursor&&!a&&(o&&(x(kte),o=!1),c()||u())},onTrigger:function(C,N){UOe(N)&&(kte={clientX:N.clientX,clientY:N.clientY}),a=N.type==="focus"},onHidden:function(){e.props.followCursor&&(f(),d(),o=!0)}}}};MT.setDefaultProps({render:WOe});function gi({content:t,children:e,align:n="center"}){const r=m.useRef(null),s=m.useRef(null),a=m.useRef(null),o=m.useRef(null);return m.useEffect(()=>{const l=()=>{o.current.hide()},c=document.querySelectorAll("*");return c.forEach(u=>{u.addEventListener("scroll",l,{passive:!0})}),()=>{c.forEach(u=>{u.removeEventListener("scroll",l)})}},[]),m.useEffect(()=>{if(!r.current)return;const l=typeof t!="string";l&&(s.current=document.createElement("div"),a.current=y8e.createRoot(s.current),a.current.render(t));const c=MT(r.current,{content:l?s.current:`
<div style="
border-radius: 12px;
border: 0.8px solid rgba(133, 133, 133, 0.32);
background: rgba(255, 255, 255, 0.08);
box-shadow: 0 4px 4px 0 #050505;
backdrop-filter: blur(43px);
color: #FFF;
text-align: ${n};
font-family: Inter, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 14px;
letter-spacing: -0.12px;
padding: 6px 10px;
">
${t}
</div>
`,allowHTML:!l,followCursor:!0,plugins:[uAt],delay:[0,0],offset:[10,10],animation:"scale-subtle",duration:[50,100],placement:"top",popperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["right","bottom","left"]}},{name:"preventOverflow",options:{padding:8}}]},interactive:!1,moveTransition:"",trigger:"mouseenter mousemove",theme:"custom",onShow(){setTimeout(()=>{window.dispatchEvent(new Event("resize"))},50)}});return o.current=c,()=>{a.current&&Promise.resolve().then(()=>{var u;(u=a.current)==null||u.unmount()})}},[t]),m.isValidElement(e)?m.cloneElement(e,{ref:r}):i.jsx("span",{ref:r,children:e})}var ap;(function(t){t.NUMBER="NUMBER_NUMBER",t.HEX="NUMBER_HEX",t.STR="NUMBER_STR",t.BIGINT="NUMBER_BIGINT"})(ap||(ap={}));var S1;(function(t){t.HEX="BYTES_HEX",t.UINT8ARRAY="BYTES_UINT8ARRAY"})(S1||(S1={}));const bd={number:ap.BIGINT,bytes:S1.HEX},xi={number:ap.HEX,bytes:S1.HEX};var $g;(function(t){t.EARLIEST="earliest",t.LATEST="latest",t.PENDING="pending",t.SAFE="safe",t.FINALIZED="finalized",t.COMMITTED="committed"})($g||($g={}));var _9;(function(t){t.chainstart="chainstart",t.frontier="frontier",t.homestead="homestead",t.dao="dao",t.tangerineWhistle="tangerineWhistle",t.spuriousDragon="spuriousDragon",t.byzantium="byzantium",t.constantinople="constantinople",t.petersburg="petersburg",t.istanbul="istanbul",t.muirGlacier="muirGlacier",t.berlin="berlin",t.london="london",t.altair="altair",t.arrowGlacier="arrowGlacier",t.grayGlacier="grayGlacier",t.bellatrix="bellatrix",t.merge="merge",t.capella="capella",t.shanghai="shanghai"})(_9||(_9={}));const mle=Object.getPrototypeOf(Uint8Array);var b1e=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const y1e=Symbol.for("web3/base-provider");class RT{static isWeb3Provider(e){return e instanceof RT||!!(e&&e[y1e])}get[y1e](){return!0}send(e,n){this.request(e).then(r=>{n(null,r)}).catch(r=>{n(r)})}sendAsync(e){return b1e(this,void 0,void 0,function*(){return this.request(e)})}asEIP1193Provider(){const e=Object.create(this),n=e.request;return e.request=function(s){return b1e(this,void 0,void 0,function*(){return(yield n(s)).result})},e.asEIP1193Provider=void 0,e}}class dAt extends Array{constructor(e){super(),this._accountProvider=e}}const fAt=100,hAt=101,pAt=201,mAt=202,xAt=203,gAt=204,bAt=205,yAt=206,vAt=207,wAt=208,CAt=300,SAt=301,NAt=310,AAt=311,jAt=400,EAt=402,_At=405,kAt=407,TAt=408,PAt=410,IAt=411,FAt=412,OAt=413,MAt=414,RAt=415,LAt=416,DAt=417,BAt=418,$At=419,UAt=420,zAt=421,HAt=422,VAt=423,WAt=424,qAt=425,GAt=426,KAt=427,YAt=428,XAt=429,QAt=430,ZAt=431,JAt=432,ejt=433,tjt=434,njt=435,rjt=436,sjt=437,ijt=438,ajt=439,ojt=440,ljt=441,cjt=500,ujt=503,djt=505,fjt=506,hjt=507,pjt=600,mjt=602,xjt=603,gjt=604,bjt=701,yjt=702,vjt=703,wjt=704,Cjt=705,Sjt=706,Njt=707,Ajt=709,jjt=801,Ejt=802,_jt=4001,kjt=4100,Tjt=4200,Pjt=4900,Ijt=4901,Fjt=902,Ojt=903,Mjt=1001,Rjt=1002,Ljt=1003,Djt=1004,Bjt=1005,$jt=1006,Ujt=1008,zjt=1009,Hjt=1010,Vjt=1011,Wjt=1012,qjt=1014,Gjt=1015,Kjt=1100,GOe=1101,Yjt=1200,IR=-32700,FR=-32600,OR=-32601,MR=-32602,RR=-32603,LR=-32e3,DR=-32001,BR=-32002,$R=-32003,UR=-32004,zR=-32005,HR=-32006;class hi extends Error{get innerError(){return this.cause instanceof k9?this.cause.errors:this.cause}set innerError(e){Array.isArray(e)?this.cause=new k9(e):this.cause=e}constructor(e,n){super(e),Array.isArray(n)?this.cause=new k9(n):this.cause=n,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(new.target.constructor):this.stack=new Error().stack}static convertToString(e,n=!1){if(e==null)return"undefined";const r=JSON.stringify(e,(s,a)=>typeof a=="bigint"?a.toString():a);return n&&["bigint","string"].includes(typeof e)?r.replace(/['\\"]+/g,""):r}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:this.cause,innerError:this.cause}}}class k9 extends hi{constructor(e){super(`Multiple errors occurred: [${e.map(n=>n.message).join("], [")}]`),this.code=wAt,this.errors=e}}class Hi extends hi{constructor(e,n){super(`Invalid value given "${hi.convertToString(e,!0)}". Error: ${n}.`),this.name=this.constructor.name}}class v1e extends hi{constructor(){super("Private key must be 32 bytes."),this.code=bjt}}class Xjt extends hi{constructor(){super("Invalid Private Key, Not a valid string or uint8Array"),this.code=yjt}}class Qjt extends hi{constructor(e){super(`"${e}"`),this.code=Ejt}}class KOe extends hi{constructor(){super("Invalid key derivation function"),this.code=vjt}}class Zjt extends hi{constructor(){super("Key derivation failed - possibly wrong password"),this.code=wjt}}class Jjt extends hi{constructor(){super("Unsupported key store version"),this.code=Cjt}}class e8t extends hi{constructor(){super("Password cannot be empty"),this.code=Sjt}}class t8t extends hi{constructor(){super("Initialization vector must be 16 bytes"),this.code=Njt}}class n8t extends hi{constructor(){super("c > 1000, pbkdf2 is less secure with less iterations"),this.code=Ajt}}class LT extends hi{constructor(e,n){super(e),this.code=cjt,n&&(this.errorCode=n.code,this.errorReason=n.reason)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{errorCode:this.errorCode,errorReason:this.errorReason})}}class Tte extends LT{constructor(e){super("Connection not open",e),this.code=ujt}}class r8t extends LT{constructor(e){super(`Maximum number of reconnect attempts reached! (${e})`),this.code=djt}}class s8t extends LT{constructor(){super("CONNECTION ERROR: Provider started to reconnect before the response got received!"),this.code=fjt}}class i8t extends LT{constructor(e){super(`Request already sent with following id: ${e}`),this.code=hjt}}class yd extends hi{constructor(e,n){super(e),this.code=CAt,this.receipt=n}}class w1e extends hi{constructor(e,n){super(`The resolver at ${e} does not implement requested method: "${n}".`),this.address=e,this.name=n,this.code=SAt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{address:this.address,name:this.name})}}class Y$ extends yd{constructor(e){if(super(e.message||"Error"),this.name="name"in e&&e.name||this.constructor.name,this.stack="stack"in e&&e.stack||void 0,this.code=e.code,typeof e.data=="object"){let n;e.data&&"originalError"in e.data?n=e.data.originalError:n=e.data,this.data=n.data,this.cause=new Y$(n)}else this.data=e.data}setDecodedProperties(e,n,r){this.errorName=e,this.errorSignature=n,this.errorArgs=r}toJSON(){let e=Object.assign(Object.assign({},super.toJSON()),{data:this.data});return this.errorName&&(e=Object.assign(Object.assign({},e),{errorName:this.errorName,errorSignature:this.errorSignature,errorArgs:this.errorArgs})),e}}class g3 extends yd{constructor(e){super("Error happened while trying to execute a function inside a smart contract"),this.code=NAt,this.cause=new Y$(e)}}class a8t extends Hi{constructor(e){var n,r;super(`data: ${(n=e.data)!==null&&n!==void 0?n:"undefined"}, input: ${(r=e.input)!==null&&r!==void 0?r:"undefined"}`,`You can't have "data" and "input" as properties of a contract at the same time, please use either "data" or "input" instead.`),this.code=AAt}}class o8t extends hi{constructor(e){super(`ENS is not supported on network ${e}`),this.code=Fjt}}class l8t extends hi{constructor(){super("Network not synced"),this.code=Ojt}}class C1e extends hi{constructor(e){super(`Invalid parameters passed. "${typeof e<"u"?e:""}"`),this.hint=e,this.code=vAt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{hint:this.hint})}}class Pte extends hi{constructor(){super(...arguments),this.code=pAt}}class Yx extends hi{constructor(){super("The method you're trying to call is not implemented."),this.code=mAt}}class YOe extends hi{constructor(){super(...arguments),this.code=xAt}}class c8t extends hi{constructor(){super(...arguments),this.code=gAt}}class Xi extends hi{constructor(e,n){super(e),this.code=bAt,this.props=n??{}}}class u8t extends hi{constructor(e){super(`A plugin with the namespace: ${e} has already been registered.`),this.code=yAt}}class rM extends hi{constructor(){super(...arguments),this.code=pjt}}class Ite extends hi{constructor(e){super(`Client URL "${e}" is invalid.`),this.code=mjt}}class gg extends hi{constructor(){super(...arguments),this.code=xjt}}class d8t extends hi{constructor(){super(...arguments),this.code=gjt}}class f8t extends Hi{constructor(){super(...arguments),this.code=jjt}}class xle extends hi{constructor(e,n){super(e),this.receipt=n,this.code=jAt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{receipt:this.receipt})}}class VR extends hi{constructor(e,n,r,s){super(`Transaction has been reverted by the EVM${r===void 0?"":`:
${hi.convertToString(r)}`}`),this.reason=e,this.signature=n,this.receipt=r,this.data=s,this.code=EAt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,signature:this.signature,receipt:this.receipt,data:this.data})}}class XOe extends VR{constructor(e,n,r,s,a,o,l){super(e),this.reason=e,this.customErrorName=n,this.customErrorDecodedSignature=r,this.customErrorArguments=s,this.signature=a,this.receipt=o,this.data=l,this.code=ijt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,customErrorName:this.customErrorName,customErrorDecodedSignature:this.customErrorDecodedSignature,customErrorArguments:this.customErrorArguments,signature:this.signature,receipt:this.receipt,data:this.data})}}class QOe extends xle{constructor(e){super(`Transaction has been reverted by the EVM${e===void 0?"":`:
${hi.convertToString(e)}`}`,e),this.code=_At}}class h8t extends xle{constructor(){super("Raw transaction undefined"),this.code=kAt}}class S1e extends xle{constructor(){super("Transaction not found"),this.code=QAt}}class p8t extends Hi{constructor(e){super(e,"invalid transaction with invalid sender"),this.code=TAt}}class m8t extends Hi{constructor(e){super(e,"invalid transaction with invalid receiver"),this.code=sjt}}class x8t extends Hi{constructor(){super("MissingCustomChainError","If tx.common is provided it must have tx.common.customChain"),this.code=PAt}}class g8t extends Hi{constructor(){super("MissingCustomChainIdError","If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId"),this.code=IAt}}class b8t extends Hi{constructor(e){super(JSON.stringify(e),"Chain Id doesnt match in tx.chainId tx.common.customChain.chainId"),this.code=FAt}}class y8t extends Hi{constructor(e){super(JSON.stringify(e),"Chain doesnt match in tx.chain tx.common.basechain"),this.code=njt}}class v8t extends Hi{constructor(e){super(JSON.stringify(e),"hardfork doesnt match in tx.hardfork tx.common.hardfork"),this.code=rjt}}class w8t extends Hi{constructor(){super("CommonOrChainAndHardforkError","Please provide the common object or the chain and hardfork property but not all together."),this.code=OAt}}class C8t extends Hi{constructor(e){var n,r;super("MissingChainOrHardforkError",`When specifying chain and hardfork, both values must be defined. Received "chain": ${(n=e.chain)!==null&&n!==void 0?n:"undefined"}, "hardfork": ${(r=e.hardfork)!==null&&r!==void 0?r:"undefined"}`),this.code=MAt}}class S8t extends hi{constructor(){super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions'),this.code=ojt}}class N8t extends Hi{constructor(e){var n,r,s,a;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}, maxPriorityFeePerGas: ${(s=e.maxPriorityFeePerGas)!==null&&s!==void 0?s:"undefined"}, maxFeePerGas: ${(a=e.maxFeePerGas)!==null&&a!==void 0?a:"undefined"}`,'"gas" is missing'),this.code=RAt,this.cause=new S8t}}class A8t extends hi{constructor(){super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both'),this.code=ljt}}class j8t extends Hi{constructor(e){var n,r,s,a;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}, maxPriorityFeePerGas: ${(s=e.maxPriorityFeePerGas)!==null&&s!==void 0?s:"undefined"}, maxFeePerGas: ${(a=e.maxFeePerGas)!==null&&a!==void 0?a:"undefined"}`,"transaction must specify legacy or fee market gas properties, not both"),this.code=tjt,this.cause=new A8t}}class E8t extends Hi{constructor(e){var n,r;super(`gas: ${(n=e.gas)!==null&&n!==void 0?n:"undefined"}, gasPrice: ${(r=e.gasPrice)!==null&&r!==void 0?r:"undefined"}`,"Gas or gasPrice is lower than 0"),this.code=LAt}}class _8t extends Hi{constructor(e){var n,r;super(`maxPriorityFeePerGas: ${(n=e.maxPriorityFeePerGas)!==null&&n!==void 0?n:"undefined"}, maxFeePerGas: ${(r=e.maxFeePerGas)!==null&&r!==void 0?r:"undefined"}`,"maxPriorityFeePerGas or maxFeePerGas is lower than 0"),this.code=DAt}}class k8t extends Hi{constructor(e){super(e,"eip-1559 transactions don't support gasPrice"),this.code=BAt}}class ZOe extends Hi{constructor(e){var n,r;super(`maxPriorityFeePerGas: ${(n=e.maxPriorityFeePerGas)!==null&&n!==void 0?n:"undefined"}, maxFeePerGas: ${(r=e.maxFeePerGas)!==null&&r!==void 0?r:"undefined"}`,"pre-eip-1559 transaction don't support maxFeePerGas/maxPriorityFeePerGas"),this.code=$At}}class T8t extends Hi{constructor(e){super(e,"invalid transaction object"),this.code=UAt}}class P8t extends Hi{constructor(e){var n,r;super(`nonce: ${(n=e.nonce)!==null&&n!==void 0?n:"undefined"}, chainId: ${(r=e.chainId)!==null&&r!==void 0?r:"undefined"}`,"Nonce or chainId is lower than 0"),this.code=zAt}}class I8t extends Hi{constructor(){super("UnableToPopulateNonceError","unable to populate nonce, no from address available"),this.code=HAt}}class F8t extends Hi{constructor(){super("Eip1559NotSupportedError","Network doesn't support eip-1559"),this.code=VAt}}class N1e extends Hi{constructor(e){super(e,"unsupported transaction type"),this.code=WAt}}class JOe extends Hi{constructor(e){var n,r;super(`data: ${(n=e.data)!==null&&n!==void 0?n:"undefined"}, input: ${(r=e.input)!==null&&r!==void 0?r:"undefined"}`,`You can't have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.`),this.code=qAt}}class O8t extends hi{constructor(e){super(`The connected Ethereum Node did not respond within ${e.numberOfSeconds} seconds, please make sure your transaction was properly sent and you are connected to a healthy Node. Be aware that transaction might still be pending or mined!
Transaction Hash: ${e.transactionHash?e.transactionHash.toString():"not available"}`),this.code=ZAt}}function eMe(t){return`Please make sure your transaction was properly sent and there are no previous pending transaction for the same account. However, be aware that it might still be mined!
Transaction Hash: ${t?t.toString():"not available"}`}class tMe extends hi{constructor(e){super(`Transaction was not mined within ${e.numberOfSeconds} seconds. ${eMe(e.transactionHash)}`),this.code=GAt}}class nMe extends hi{constructor(e){super(`Transaction started at ${e.starterBlockNumber} but was not mined within ${e.numberOfBlocks} blocks. ${eMe(e.transactionHash)}`),this.code=JAt}}class M8t extends Hi{constructor(e){var n,r;super(`receipt: ${JSON.stringify(e.receipt)}, blockHash: ${(n=e.blockHash)===null||n===void 0?void 0:n.toString()}, transactionHash: ${(r=e.transactionHash)===null||r===void 0?void 0:r.toString()}`,"Receipt missing or blockHash null"),this.code=KAt}}class R8t extends Hi{constructor(e){super(`receipt: ${JSON.stringify(e.receipt)}`,"Receipt missing block number"),this.code=YAt}}class Fte extends hi{constructor(e){super(`Invalid signature. "${e}"`),this.code=ejt}}class A1e extends Hi{constructor(){super("LocalWalletNotAvailableError","Attempted to index account in local wallet, but no wallet is available"),this.code=XAt}}class L8t extends hi{constructor(e,n){const r=[];e.forEach(s=>r.push(s.keyword)),super(`The following properties are invalid for the transaction type ${n}: ${r.join(", ")}`),this.code=ajt}}class T4 extends Hi{constructor(e){super(e,"can not parse as byte data"),this.code=Rjt}}class gle extends Hi{constructor(e){super(e,"can not parse as number data"),this.code=Ljt}}class ble extends Hi{constructor(e){super(e,"invalid ethereum address"),this.code=Bjt}}class D8t extends Hi{constructor(e){super(e,"not a valid string"),this.code=Mjt}}class rMe extends Hi{constructor(e){super(e,"invalid unit"),this.code=Djt}}class sMe extends Hi{constructor(e){super(e,"not a valid unit. Must be a positive integer"),this.code=Gjt}}class B8t extends Hi{constructor(e){super(e,"can not be converted to hex"),this.code=$jt}}class iMe extends Hi{constructor(e){super(e,"value greater than the nibble width"),this.code=qjt}}class yle extends Hi{constructor(e){super(e,"not a valid boolean."),this.code=Ujt}}class $8t extends Hi{constructor(e){super(e,"not a valid unsigned integer."),this.code=zjt}}class j1e extends Hi{constructor(e){super(e,"invalid size given."),this.code=Hjt}}class E1e extends Hi{constructor(e){super(e,"value is larger than size."),this.code=Vjt}}class U8t extends Hi{constructor(e){super(e,"invalid string given"),this.code=Wjt}}const z8t=t=>!Array.isArray(t)&&t.jsonrpc==="2.0"&&!!t&&(t.result===void 0||t.result===null)&&"error"in t&&(typeof t.id=="number"||typeof t.id=="string"),_1e=t=>z8t(t)?t.error.message:"";class I0 extends hi{constructor(e,n,r,s){var a;super(n??`Returned error: ${Array.isArray(e)?e.map(l=>_1e(l)).join(","):_1e(e)}`),this.code=fAt,n||(this.data=Array.isArray(e)?e.map(l=>{var c;return(c=l.error)===null||c===void 0?void 0:c.data}):(a=e==null?void 0:e.error)===null||a===void 0?void 0:a.data),this.statusCode=s,this.request=r;let o;"error"in e?o=e.error:e instanceof Array&&(o=e.filter(l=>l.error).map(l=>l.error)),Array.isArray(o)&&o.length>0?this.cause=new k9(o):this.cause=o}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{data:this.data,request:this.request,statusCode:this.statusCode})}}class X$ extends I0{constructor(e,n){super(e,void 0,n),this.code=hAt;let r;"error"in e?r=e.error:e instanceof Array&&(r=e.map(s=>s.error)),Array.isArray(r)?this.cause=new k9(r):this.cause=r}}class k1e extends hi{constructor(e,n){super(`Web3Config hardfork doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=GOe}}class T1e extends hi{constructor(e,n){super(`Web3Config chain doesnt match in defaultHardfork ${e} and common.hardfork ${n}`),this.code=GOe}}const aMe="An Rpc error has occured with a code of *code*",Du={[IR]:{message:"Parse error",description:"Invalid JSON"},[FR]:{message:"Invalid request",description:"JSON is not a valid request object "},[OR]:{message:"Method not found",description:"Method does not exist "},[MR]:{message:"Invalid params",description:"Invalid method parameters"},[RR]:{message:"Internal error",description:"Internal JSON-RPC error"},[LR]:{message:"Invalid input",description:"Missing or invalid parameters"},[DR]:{message:"Resource not found",description:"Requested resource not found"},[BR]:{message:"Resource unavailable",description:"Requested resource not available"},[$R]:{message:"Transaction rejected",description:"Transaction creation failed"},[UR]:{message:"Method not supported",description:"Method is not implemented"},[zR]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[HR]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[_jt]:{name:"User Rejected Request",message:"The user rejected the request."},[kjt]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[Tjt]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[Pjt]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[Ijt]:{name:"Chain Disconnected",message:"The Provider is not connected to the requested chain."},"0-999":{name:"",message:"Not used."},1e3:{name:"Normal Closure",message:"The connection successfully completed the purpose for which it was created."},1001:{name:"Going Away",message:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{name:"Protocol error",message:"The endpoint is terminating the connection due to a protocol error."},1003:{name:"Unsupported Data",message:"The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"},1004:{name:"Reserved",message:"Reserved. A meaning might be defined in the future."},1005:{name:"No Status Rcvd",message:"Reserved. Indicates that no status code was provided even though one was expected."},1006:{name:"Abnormal Closure",message:"Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{name:"Invalid frame payload data",message:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{name:"Policy Violation",message:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{name:"Message Too Big",message:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{name:"Mandatory Ext.",message:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{name:"Internal Error",message:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{name:"Service Restart",message:"The server is terminating the connection because it is restarting."},1013:{name:"Try Again Later",message:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{name:"Bad Gateway",message:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{name:"TLS handshake",message:"Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},"1016-2999":{name:"",message:"For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."},"3000-3999":{name:"",message:"For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol."},"4000-4999":{name:"",message:"For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."}};class ch extends hi{constructor(e,n){super(n??aMe.replace("*code*",e.error.code.toString())),this.code=e.error.code,this.id=e.id,this.jsonrpc=e.jsonrpc,this.jsonRpcError=e.error}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{error:this.jsonRpcError,id:this.id,jsonRpc:this.jsonrpc})}}class H8t extends hi{constructor(e,n){var r,s,a,o;if(!e)super();else if(!((r=Du[e])===null||r===void 0)&&r.message)super(Du[e].message);else{const l=Object.keys(Du).find(c=>typeof c=="string"&&e>=parseInt(c.split("-")[0],10)&&e<=parseInt(c.split("-")[1],10));super((a=(s=Du[l??""])===null||s===void 0?void 0:s.message)!==null&&a!==void 0?a:aMe.replace("*code*",(o=e==null?void 0:e.toString())!==null&&o!==void 0?o:'""'))}this.code=e,this.data=n}}class V8t extends ch{constructor(e){super(e,Du[IR].message),this.code=IR}}class W8t extends ch{constructor(e){super(e,Du[FR].message),this.code=FR}}class q8t extends ch{constructor(e){super(e,Du[OR].message),this.code=OR}}class G8t extends ch{constructor(e){super(e,Du[MR].message),this.code=MR}}class K8t extends ch{constructor(e){super(e,Du[RR].message),this.code=RR}}class Y8t extends ch{constructor(e){super(e,Du[LR].message),this.code=LR}}class X8t extends ch{constructor(e){super(e,Du[UR].message),this.code=UR}}class Q8t extends ch{constructor(e){super(e,Du[BR].message),this.code=BR}}class Z8t extends ch{constructor(e){super(e,Du[DR].message),this.code=DR}}class J8t extends ch{constructor(e){super(e,Du[HR].message),this.code=HR}}class e7t extends ch{constructor(e){super(e,Du[$R].message),this.code=$R}}class t7t extends ch{constructor(e){super(e,Du[zR].message),this.code=zR}}const Sd=new Map;Sd.set(IR,{error:V8t});Sd.set(FR,{error:W8t});Sd.set(OR,{error:q8t});Sd.set(MR,{error:G8t});Sd.set(RR,{error:K8t});Sd.set(LR,{error:Y8t});Sd.set(UR,{error:X8t});Sd.set(BR,{error:Q8t});Sd.set($R,{error:e7t});Sd.set(DR,{error:Z8t});Sd.set(HR,{error:J8t});Sd.set(zR,{error:t7t});class n7t extends hi{constructor(e){super(`Format for the type ${e} is unsupported`),this.type=e,this.code=Yjt}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type})}}function ef(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function r7t(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function s7t(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function uj(t,...e){if(!s7t(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function vle(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ef(t.outputLen),ef(t.blockLen)}function Z3(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wle(t,e){uj(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const oMe={number:ef,bool:r7t,bytes:uj,hash:vle,exists:Z3,output:wle},XI=BigInt(2**32-1),P1e=BigInt(32);function i7t(t,e=!1){return e?{h:Number(t&XI),l:Number(t>>P1e&XI)}:{h:Number(t>>P1e&XI)|0,l:Number(t&XI)|0}}function a7t(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:a,l:o}=i7t(t[s],e);[n[s],r[s]]=[a,o]}return[n,r]}const o7t=(t,e,n)=>t<<n|e>>>32-n,l7t=(t,e,n)=>e<<n|t>>>32-n,c7t=(t,e,n)=>e<<n-32|t>>>64-n,u7t=(t,e,n)=>t<<n-32|e>>>64-n,sM=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const iM=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),aM=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),a0=(t,e)=>t<<32-e|t>>>e,ga=(t,e)=>t<<e|t>>>32-e>>>0,WR=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,d7t=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function qR(t){for(let e=0;e<t.length;e++)t[e]=d7t(t[e])}function wN(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function CN(t){return typeof t=="string"&&(t=wN(t)),uj(t),t}function GR(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];uj(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const a=t[r];n.set(a,s),s+=a.length}return n}class Cle{clone(){return this._cloneInto()}}const f7t={}.toString;function lMe(t,e){if(e!==void 0&&f7t.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function cMe(t){const e=r=>t().update(CN(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function uMe(t=32){if(sM&&typeof sM.getRandomValues=="function")return sM.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const dMe=[],fMe=[],hMe=[],h7t=BigInt(0),t7=BigInt(1),p7t=BigInt(2),m7t=BigInt(7),x7t=BigInt(256),g7t=BigInt(113);for(let t=0,e=t7,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],dMe.push(2*(5*r+n)),fMe.push((t+1)*(t+2)/2%64);let s=h7t;for(let a=0;a<7;a++)e=(e<<t7^(e>>m7t)*g7t)%x7t,e&p7t&&(s^=t7<<(t7<<BigInt(a))-t7);hMe.push(s)}const[b7t,y7t]=a7t(hMe,!0),I1e=(t,e,n)=>n>32?c7t(t,e,n):o7t(t,e,n),F1e=(t,e,n)=>n>32?u7t(t,e,n):l7t(t,e,n);function v7t(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const l=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=I1e(u,d,1)^n[l],x=F1e(u,d,1)^n[l+1];for(let g=0;g<50;g+=10)t[o+g]^=f,t[o+g+1]^=x}let s=t[2],a=t[3];for(let o=0;o<24;o++){const l=fMe[o],c=I1e(s,a,l),u=F1e(s,a,l),d=dMe[o];s=t[d],a=t[d+1],t[d]=c,t[d+1]=u}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)n[l]=t[o+l];for(let l=0;l<10;l++)t[o+l]^=~n[(l+2)%10]&n[(l+4)%10]}t[0]^=b7t[r],t[1]^=y7t[r]}n.fill(0)}class Sle extends Cle{constructor(e,n,r,s=!1,a=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ef(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=iM(this.state)}keccak(){WR||qR(this.state32),v7t(this.state32,this.rounds),WR||qR(this.state32),this.posOut=0,this.pos=0}update(e){Z3(this);const{blockLen:n,state:r}=this;e=CN(e);const s=e.length;for(let a=0;a<s;){const o=Math.min(n-this.pos,s-a);for(let l=0;l<o;l++)r[this.pos++]^=e[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Z3(this,!1),uj(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,a=e.length;s<a;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,a-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ef(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(wle(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:a,enableXOF:o}=this;return e||(e=new Sle(n,r,s,o,a)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const w7t=(t,e,n)=>cMe(()=>new Sle(e,t,n)),O1e=w7t(1,136,256/8),KR=oMe.bytes;function pMe(t){if(!(t instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof t}`);return new TextDecoder().decode(t)}function C7t(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function S7t(t){return e=>(oMe.bytes(e),t(e))}(()=>{const t=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,e=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:e&&!t?e("crypto"):void 0,web:t}})();const pd=(()=>{const t=S7t(O1e);return t.create=O1e.create,t})();var fa;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of a)o[l]=s[l];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},t.find=(s,a)=>{for(const o of s)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(fa||(fa={}));var Ote;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ote||(Ote={}));const Cs=fa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wg=t=>{switch(typeof t){case"undefined":return Cs.undefined;case"string":return Cs.string;case"number":return Number.isNaN(t)?Cs.nan:Cs.number;case"boolean":return Cs.boolean;case"function":return Cs.function;case"bigint":return Cs.bigint;case"symbol":return Cs.symbol;case"object":return Array.isArray(t)?Cs.array:t===null?Cs.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Cs.promise:typeof Map<"u"&&t instanceof Map?Cs.map:typeof Set<"u"&&t instanceof Set?Cs.set:typeof Date<"u"&&t instanceof Date?Cs.date:Cs.object;default:return Cs.unknown}},Gr=fa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N7t=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class th extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(this),r}static assert(e){if(!(e instanceof th))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fa.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];n[a]=n[a]||[],n[a].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}th.create=t=>new th(t);const SN=(t,e)=>{let n;switch(t.code){case Gr.invalid_type:t.received===Cs.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Gr.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,fa.jsonStringifyReplacer)}`;break;case Gr.unrecognized_keys:n=`Unrecognized key(s) in object: ${fa.joinValues(t.keys,", ")}`;break;case Gr.invalid_union:n="Invalid input";break;case Gr.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fa.joinValues(t.options)}`;break;case Gr.invalid_enum_value:n=`Invalid enum value. Expected ${fa.joinValues(t.options)}, received '${t.received}'`;break;case Gr.invalid_arguments:n="Invalid function arguments";break;case Gr.invalid_return_type:n="Invalid function return type";break;case Gr.invalid_date:n="Invalid date";break;case Gr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:fa.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Gr.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Gr.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Gr.custom:n="Invalid input";break;case Gr.invalid_intersection_types:n="Intersection results could not be merged";break;case Gr.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Gr.not_finite:n="Number must be finite";break;default:n=e.defaultError,fa.assertNever(t)}return{message:n}};let mMe=SN;function A7t(t){mMe=t}function YR(){return mMe}const XR=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:e,defaultError:l}).message;return{...s,path:a,message:l}},j7t=[];function fs(t,e){const n=YR(),r=XR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===SN?void 0:SN].filter(s=>!!s)});t.common.issues.push(r)}class Hu{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return ii;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const a=await s.key,o=await s.value;r.push({key:a,value:o})}return Hu.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return ii;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}}const ii=Object.freeze({status:"aborted"}),s4=t=>({status:"dirty",value:t}),Nd=t=>({status:"valid",value:t}),Mte=t=>t.status==="aborted",Rte=t=>t.status==="dirty",J3=t=>t.status==="valid",i_=t=>typeof Promise<"u"&&t instanceof Promise;var Bs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Bs||(Bs={}));class dx{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const M1e=(t,e)=>{if(J3(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new th(t.common.issues);return this._error=n,this._error}}};function Pi(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,l)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:s}}class Ui{get description(){return this._def.description}_getType(e){return wg(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:wg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hu,ctx:{common:e.parent.common,data:e.data,parsedType:wg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(i_(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)},s=this._parseSync({data:e,path:r.path,parent:r});return M1e(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:n});return J3(a)?{value:a.value}:{issues:n.common.issues}}catch(a){(s=(r=a==null?void 0:a.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>J3(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wg(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(i_(s)?s:Promise.resolve(s));return M1e(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const o=e(s),l=()=>a.addIssue({code:Gr.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new _m({schema:this,typeName:li.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Y0.create(this,this._def)}nullable(){return u2.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vm.create(this)}promise(){return AN.create(this,this._def)}or(e){return c_.create([this,e],this._def)}and(e){return u_.create(this,e,this._def)}transform(e){return new _m({...Pi(this._def),schema:this,typeName:li.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new m_({...Pi(this._def),innerType:this,defaultValue:n,typeName:li.ZodDefault})}brand(){return new Nle({typeName:li.ZodBranded,type:this,...Pi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new x_({...Pi(this._def),innerType:this,catchValue:n,typeName:li.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return DT.create(this,e)}readonly(){return g_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const E7t=/^c[^\s-]{8,}$/i,_7t=/^[0-9a-z]+$/,k7t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,T7t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,P7t=/^[a-z0-9_-]{21}$/i,I7t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,F7t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,O7t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M7t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let fW;const R7t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,L7t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,D7t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,B7t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$7t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,U7t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xMe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",z7t=new RegExp(`^${xMe}$`);function gMe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function H7t(t){return new RegExp(`^${gMe(t)}$`)}function bMe(t){let e=`${xMe}T${gMe(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function V7t(t,e){return!!((e==="v4"||!e)&&R7t.test(t)||(e==="v6"||!e)&&D7t.test(t))}function W7t(t,e){if(!I7t.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function q7t(t,e){return!!((e==="v4"||!e)&&L7t.test(t)||(e==="v6"||!e)&&B7t.test(t))}class xm extends Ui{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cs.string){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.string,received:a.parsedType}),ii}const r=new Hu;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,l=e.data.length<a.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?fs(s,{code:Gr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&fs(s,{code:Gr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")O7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"email",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")fW||(fW=new RegExp(M7t,"u")),fW.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"emoji",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")T7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"uuid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")P7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"nanoid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")E7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cuid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")_7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cuid2",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")k7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"ulid",code:Gr.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),fs(s,{validation:"url",code:Gr.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"regex",code:Gr.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?bMe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?z7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?H7t(a).test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?F7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"duration",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?V7t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"ip",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?W7t(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"jwt",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?q7t(e.data,a.version)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"cidr",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?$7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"base64",code:Gr.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?U7t.test(e.data)||(s=this._getOrReturnCtx(e,s),fs(s,{validation:"base64url",code:Gr.invalid_string,message:a.message}),r.dirty()):fa.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:Gr.invalid_string,...Bs.errToObj(r)})}_addCheck(e){return new xm({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Bs.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Bs.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Bs.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Bs.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Bs.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Bs.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Bs.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Bs.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Bs.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Bs.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Bs.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Bs.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Bs.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Bs.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Bs.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Bs.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Bs.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Bs.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Bs.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Bs.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Bs.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Bs.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Bs.errToObj(n)})}nonempty(e){return this.min(1,Bs.errToObj(e))}trim(){return new xm({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xm({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xm({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}xm.create=t=>new xm({checks:[],typeName:li.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Pi(t)});function G7t(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return a%o/10**s}class o2 extends Ui{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Cs.number){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.number,received:a.parsedType}),ii}let r;const s=new Hu;for(const a of this._def.checks)a.kind==="int"?fa.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?G7t(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_finite,message:a.message}),s.dirty()):fa.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,r,s){return new o2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bs.toString(s)}]})}_addCheck(e){return new o2({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Bs.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Bs.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Bs.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Bs.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&fa.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}o2.create=t=>new o2({checks:[],typeName:li.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Pi(t)});class l2 extends Ui{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Cs.bigint)return this._getInvalidInput(e);let r;const s=new Hu;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),fs(r,{code:Gr.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):fa.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return fs(n,{code:Gr.invalid_type,expected:Cs.bigint,received:n.parsedType}),ii}gte(e,n){return this.setLimit("min",e,!0,Bs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Bs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Bs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Bs.toString(n))}setLimit(e,n,r,s){return new l2({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Bs.toString(s)}]})}_addCheck(e){return new l2({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Bs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Bs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Bs.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}l2.create=t=>new l2({checks:[],typeName:li.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Pi(t)});class a_ extends Ui{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cs.boolean){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.boolean,received:r.parsedType}),ii}return Nd(e.data)}}a_.create=t=>new a_({typeName:li.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Pi(t)});class e5 extends Ui{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cs.date){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_type,expected:Cs.date,received:a.parsedType}),ii}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return fs(a,{code:Gr.invalid_date}),ii}const r=new Hu;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),fs(s,{code:Gr.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):fa.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new e5({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Bs.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Bs.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}e5.create=t=>new e5({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:li.ZodDate,...Pi(t)});class QR extends Ui{_parse(e){if(this._getType(e)!==Cs.symbol){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.symbol,received:r.parsedType}),ii}return Nd(e.data)}}QR.create=t=>new QR({typeName:li.ZodSymbol,...Pi(t)});class o_ extends Ui{_parse(e){if(this._getType(e)!==Cs.undefined){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.undefined,received:r.parsedType}),ii}return Nd(e.data)}}o_.create=t=>new o_({typeName:li.ZodUndefined,...Pi(t)});class l_ extends Ui{_parse(e){if(this._getType(e)!==Cs.null){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.null,received:r.parsedType}),ii}return Nd(e.data)}}l_.create=t=>new l_({typeName:li.ZodNull,...Pi(t)});class NN extends Ui{constructor(){super(...arguments),this._any=!0}_parse(e){return Nd(e.data)}}NN.create=t=>new NN({typeName:li.ZodAny,...Pi(t)});class b3 extends Ui{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nd(e.data)}}b3.create=t=>new b3({typeName:li.ZodUnknown,...Pi(t)});class N1 extends Ui{_parse(e){const n=this._getOrReturnCtx(e);return fs(n,{code:Gr.invalid_type,expected:Cs.never,received:n.parsedType}),ii}}N1.create=t=>new N1({typeName:li.ZodNever,...Pi(t)});class ZR extends Ui{_parse(e){if(this._getType(e)!==Cs.undefined){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.void,received:r.parsedType}),ii}return Nd(e.data)}}ZR.create=t=>new ZR({typeName:li.ZodVoid,...Pi(t)});class vm extends Ui{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Cs.array)return fs(n,{code:Gr.invalid_type,expected:Cs.array,received:n.parsedType}),ii;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(fs(n,{code:o?Gr.too_big:Gr.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(fs(n,{code:Gr.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(fs(n,{code:Gr.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new dx(n,o,n.path,l)))).then(o=>Hu.mergeArray(r,o));const a=[...n.data].map((o,l)=>s.type._parseSync(new dx(n,o,n.path,l)));return Hu.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new vm({...this._def,minLength:{value:e,message:Bs.toString(n)}})}max(e,n){return new vm({...this._def,maxLength:{value:e,message:Bs.toString(n)}})}length(e,n){return new vm({...this._def,exactLength:{value:e,message:Bs.toString(n)}})}nonempty(e){return this.min(1,e)}}vm.create=(t,e)=>new vm({type:t,minLength:null,maxLength:null,exactLength:null,typeName:li.ZodArray,...Pi(e)});function VC(t){if(t instanceof Vo){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Y0.create(VC(r))}return new Vo({...t._def,shape:()=>e})}else return t instanceof vm?new vm({...t._def,type:VC(t.element)}):t instanceof Y0?Y0.create(VC(t.unwrap())):t instanceof u2?u2.create(VC(t.unwrap())):t instanceof fx?fx.create(t.items.map(e=>VC(e))):t}class Vo extends Ui{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=fa.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Cs.object){const u=this._getOrReturnCtx(e);return fs(u,{code:Gr.invalid_type,expected:Cs.object,received:u.parsedType}),ii}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof N1&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new dx(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof N1){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(fs(s,{code:Gr.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new dx(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,x=await d.value;u.push({key:f,value:x,alwaysSet:d.alwaysSet})}return u}).then(u=>Hu.mergeObjectSync(r,u)):Hu.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Bs.errToObj,new Vo({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var a,o;const s=((o=(a=this._def).errorMap)==null?void 0:o.call(a,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Bs.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Vo({...this._def,unknownKeys:"strip"})}passthrough(){return new Vo({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vo({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vo({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:li.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Vo({...this._def,catchall:e})}pick(e){const n={};for(const r of fa.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Vo({...this._def,shape:()=>n})}omit(e){const n={};for(const r of fa.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Vo({...this._def,shape:()=>n})}deepPartial(){return VC(this)}partial(e){const n={};for(const r of fa.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Vo({...this._def,shape:()=>n})}required(e){const n={};for(const r of fa.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Y0;)a=a._def.innerType;n[r]=a}return new Vo({...this._def,shape:()=>n})}keyof(){return yMe(fa.objectKeys(this.shape))}}Vo.create=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strip",catchall:N1.create(),typeName:li.ZodObject,...Pi(e)});Vo.strictCreate=(t,e)=>new Vo({shape:()=>t,unknownKeys:"strict",catchall:N1.create(),typeName:li.ZodObject,...Pi(e)});Vo.lazycreate=(t,e)=>new Vo({shape:t,unknownKeys:"strip",catchall:N1.create(),typeName:li.ZodObject,...Pi(e)});class c_ extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=a.map(l=>new th(l.ctx.common.issues));return fs(n,{code:Gr.invalid_union,unionErrors:o}),ii}if(n.common.async)return Promise.all(r.map(async a=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new th(c));return fs(n,{code:Gr.invalid_union,unionErrors:l}),ii}}get options(){return this._def.options}}c_.create=(t,e)=>new c_({options:t,typeName:li.ZodUnion,...Pi(e)});const pg=t=>t instanceof f_?pg(t.schema):t instanceof _m?pg(t.innerType()):t instanceof h_?[t.value]:t instanceof c2?t.options:t instanceof p_?fa.objectValues(t.enum):t instanceof m_?pg(t._def.innerType):t instanceof o_?[void 0]:t instanceof l_?[null]:t instanceof Y0?[void 0,...pg(t.unwrap())]:t instanceof u2?[null,...pg(t.unwrap())]:t instanceof Nle||t instanceof g_?pg(t.unwrap()):t instanceof x_?pg(t._def.innerType):[];class Q$ extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.object)return fs(n,{code:Gr.invalid_type,expected:Cs.object,received:n.parsedType}),ii;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(fs(n,{code:Gr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ii)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const o=pg(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);s.set(l,a)}}return new Q$({typeName:li.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Pi(r)})}}function Lte(t,e){const n=wg(t),r=wg(e);if(t===e)return{valid:!0,data:t};if(n===Cs.object&&r===Cs.object){const s=fa.objectKeys(e),a=fa.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of a){const c=Lte(t[l],e[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Cs.array&&r===Cs.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const o=t[a],l=e[a],c=Lte(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Cs.date&&r===Cs.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class u_ extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,o)=>{if(Mte(a)||Mte(o))return ii;const l=Lte(a.value,o.value);return l.valid?((Rte(a)||Rte(o))&&n.dirty(),{status:n.value,value:l.data}):(fs(r,{code:Gr.invalid_intersection_types}),ii)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}u_.create=(t,e,n)=>new u_({left:t,right:e,typeName:li.ZodIntersection,...Pi(n)});class fx extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.array)return fs(r,{code:Gr.invalid_type,expected:Cs.array,received:r.parsedType}),ii;if(r.data.length<this._def.items.length)return fs(r,{code:Gr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ii;!this._def.rest&&r.data.length>this._def.items.length&&(fs(r,{code:Gr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new dx(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>Hu.mergeArray(n,o)):Hu.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new fx({...this._def,rest:e})}}fx.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fx({items:t,typeName:li.ZodTuple,rest:null,...Pi(e)})};class d_ extends Ui{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.object)return fs(r,{code:Gr.invalid_type,expected:Cs.object,received:r.parsedType}),ii;const s=[],a=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:a._parse(new dx(r,l,r.path,l)),value:o._parse(new dx(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?Hu.mergeObjectAsync(n,s):Hu.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ui?new d_({keyType:e,valueType:n,typeName:li.ZodRecord,...Pi(r)}):new d_({keyType:xm.create(),valueType:e,typeName:li.ZodRecord,...Pi(n)})}}class JR extends Ui{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.map)return fs(r,{code:Gr.invalid_type,expected:Cs.map,received:r.parsedType}),ii;const s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new dx(r,l,r.path,[u,"key"])),value:a._parse(new dx(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ii;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ii;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}JR.create=(t,e,n)=>new JR({valueType:e,keyType:t,typeName:li.ZodMap,...Pi(n)});class t5 extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Cs.set)return fs(r,{code:Gr.invalid_type,expected:Cs.set,received:r.parsedType}),ii;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(fs(r,{code:Gr.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(fs(r,{code:Gr.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return ii;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>a._parse(new dx(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(e,n){return new t5({...this._def,minSize:{value:e,message:Bs.toString(n)}})}max(e,n){return new t5({...this._def,maxSize:{value:e,message:Bs.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}t5.create=(t,e)=>new t5({valueType:t,minSize:null,maxSize:null,typeName:li.ZodSet,...Pi(e)});class P4 extends Ui{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.function)return fs(n,{code:Gr.invalid_type,expected:Cs.function,received:n.parsedType}),ii;function r(l,c){return XR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,YR(),SN].filter(u=>!!u),issueData:{code:Gr.invalid_arguments,argumentsError:c}})}function s(l,c){return XR({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,YR(),SN].filter(u=>!!u),issueData:{code:Gr.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof AN){const l=this;return Nd(async function(...c){const u=new th([]),d=await l._def.args.parseAsync(c,a).catch(g=>{throw u.addIssue(r(c,g)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,a).catch(g=>{throw u.addIssue(s(f,g)),u})})}else{const l=this;return Nd(function(...c){const u=l._def.args.safeParse(c,a);if(!u.success)throw new th([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,a);if(!f.success)throw new th([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new P4({...this._def,args:fx.create(e).rest(b3.create())})}returns(e){return new P4({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new P4({args:e||fx.create([]).rest(b3.create()),returns:n||b3.create(),typeName:li.ZodFunction,...Pi(r)})}}class f_ extends Ui{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}f_.create=(t,e)=>new f_({getter:t,typeName:li.ZodLazy,...Pi(e)});class h_ extends Ui{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return fs(n,{received:n.data,code:Gr.invalid_literal,expected:this._def.value}),ii}return{status:"valid",value:e.data}}get value(){return this._def.value}}h_.create=(t,e)=>new h_({value:t,typeName:li.ZodLiteral,...Pi(e)});function yMe(t,e){return new c2({values:t,typeName:li.ZodEnum,...Pi(e)})}class c2 extends Ui{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return fs(n,{expected:fa.joinValues(r),received:n.parsedType,code:Gr.invalid_type}),ii}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return fs(n,{received:n.data,code:Gr.invalid_enum_value,options:r}),ii}return Nd(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return c2.create(e,{...this._def,...n})}exclude(e,n=this._def){return c2.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}c2.create=yMe;class p_ extends Ui{_parse(e){const n=fa.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Cs.string&&r.parsedType!==Cs.number){const s=fa.objectValues(n);return fs(r,{expected:fa.joinValues(s),received:r.parsedType,code:Gr.invalid_type}),ii}if(this._cache||(this._cache=new Set(fa.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=fa.objectValues(n);return fs(r,{received:r.data,code:Gr.invalid_enum_value,options:s}),ii}return Nd(e.data)}get enum(){return this._def.values}}p_.create=(t,e)=>new p_({values:t,typeName:li.ZodNativeEnum,...Pi(e)});class AN extends Ui{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.promise&&n.common.async===!1)return fs(n,{code:Gr.invalid_type,expected:Cs.promise,received:n.parsedType}),ii;const r=n.parsedType===Cs.promise?n.data:Promise.resolve(n.data);return Nd(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}AN.create=(t,e)=>new AN({type:t,typeName:li.ZodPromise,...Pi(e)});class _m extends Ui{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===li.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{fs(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ii;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ii:c.status==="dirty"||n.value==="dirty"?s4(c.value):c});{if(n.value==="aborted")return ii;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ii:l.status==="dirty"||n.value==="dirty"?s4(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ii:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ii:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!J3(o))return ii;const l=s.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>J3(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:n.value,value:l})):ii);fa.assertNever(s)}}_m.create=(t,e,n)=>new _m({schema:t,typeName:li.ZodEffects,effect:e,...Pi(n)});_m.createWithPreprocess=(t,e,n)=>new _m({schema:e,effect:{type:"preprocess",transform:t},typeName:li.ZodEffects,...Pi(n)});class Y0 extends Ui{_parse(e){return this._getType(e)===Cs.undefined?Nd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Y0.create=(t,e)=>new Y0({innerType:t,typeName:li.ZodOptional,...Pi(e)});class u2 extends Ui{_parse(e){return this._getType(e)===Cs.null?Nd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}u2.create=(t,e)=>new u2({innerType:t,typeName:li.ZodNullable,...Pi(e)});class m_ extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Cs.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}m_.create=(t,e)=>new m_({innerType:t,typeName:li.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pi(e)});class x_ extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return i_(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new th(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new th(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}x_.create=(t,e)=>new x_({innerType:t,typeName:li.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pi(e)});class eL extends Ui{_parse(e){if(this._getType(e)!==Cs.nan){const r=this._getOrReturnCtx(e);return fs(r,{code:Gr.invalid_type,expected:Cs.nan,received:r.parsedType}),ii}return{status:"valid",value:e.data}}}eL.create=t=>new eL({typeName:li.ZodNaN,...Pi(t)});const K7t=Symbol("zod_brand");class Nle extends Ui{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class DT extends Ui{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ii:a.status==="dirty"?(n.dirty(),s4(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ii:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new DT({in:e,out:n,typeName:li.ZodPipeline})}}class g_ extends Ui{_parse(e){const n=this._def.innerType._parse(e),r=s=>(J3(s)&&(s.value=Object.freeze(s.value)),s);return i_(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}g_.create=(t,e)=>new g_({innerType:t,typeName:li.ZodReadonly,...Pi(e)});function R1e(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function vMe(t,e={},n){return t?NN.create().superRefine((r,s)=>{const a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){const l=R1e(e,r),c=l.fatal??n??!0;s.addIssue({code:"custom",...l,fatal:c})}});if(!a){const o=R1e(e,r),l=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:l})}}):NN.create()}const Y7t={object:Vo.lazycreate};var li;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(li||(li={}));const X7t=(t,e={message:`Input not instance of ${t.name}`})=>vMe(n=>n instanceof t,e),wMe=xm.create,CMe=o2.create,Q7t=eL.create,Z7t=l2.create,SMe=a_.create,J7t=e5.create,e9t=QR.create,t9t=o_.create,n9t=l_.create,Dte=NN.create,r9t=b3.create,s9t=N1.create,i9t=ZR.create,NMe=vm.create,oM=Vo.create,a9t=Vo.strictCreate,AMe=c_.create,o9t=Q$.create,l9t=u_.create,jMe=fx.create,c9t=d_.create,u9t=JR.create,d9t=t5.create,f9t=P4.create,h9t=f_.create,p9t=h_.create,m9t=c2.create,x9t=p_.create,g9t=AN.create,L1e=_m.create,b9t=Y0.create,y9t=u2.create,v9t=_m.createWithPreprocess,w9t=DT.create,C9t=()=>wMe().optional(),S9t=()=>CMe().optional(),N9t=()=>SMe().optional(),A9t={string:t=>xm.create({...t,coerce:!0}),number:t=>o2.create({...t,coerce:!0}),boolean:t=>a_.create({...t,coerce:!0}),bigint:t=>l2.create({...t,coerce:!0}),date:t=>e5.create({...t,coerce:!0})},j9t=ii,D1e=Object.freeze(Object.defineProperty({__proto__:null,BRAND:K7t,DIRTY:s4,EMPTY_PATH:j7t,INVALID:ii,NEVER:j9t,OK:Nd,ParseStatus:Hu,Schema:Ui,ZodAny:NN,ZodArray:vm,ZodBigInt:l2,ZodBoolean:a_,ZodBranded:Nle,ZodCatch:x_,ZodDate:e5,ZodDefault:m_,ZodDiscriminatedUnion:Q$,ZodEffects:_m,ZodEnum:c2,ZodError:th,get ZodFirstPartyTypeKind(){return li},ZodFunction:P4,ZodIntersection:u_,ZodIssueCode:Gr,ZodLazy:f_,ZodLiteral:h_,ZodMap:JR,ZodNaN:eL,ZodNativeEnum:p_,ZodNever:N1,ZodNull:l_,ZodNullable:u2,ZodNumber:o2,ZodObject:Vo,ZodOptional:Y0,ZodParsedType:Cs,ZodPipeline:DT,ZodPromise:AN,ZodReadonly:g_,ZodRecord:d_,ZodSchema:Ui,ZodSet:t5,ZodString:xm,ZodSymbol:QR,ZodTransformer:_m,ZodTuple:fx,ZodType:Ui,ZodUndefined:o_,ZodUnion:c_,ZodUnknown:b3,ZodVoid:ZR,addIssueToContext:fs,any:Dte,array:NMe,bigint:Z7t,boolean:SMe,coerce:A9t,custom:vMe,date:J7t,datetimeRegex:bMe,defaultErrorMap:SN,discriminatedUnion:o9t,effect:L1e,enum:m9t,function:f9t,getErrorMap:YR,getParsedType:wg,instanceof:X7t,intersection:l9t,isAborted:Mte,isAsync:i_,isDirty:Rte,isValid:J3,late:Y7t,lazy:h9t,literal:p9t,makeIssue:XR,map:u9t,nan:Q7t,nativeEnum:x9t,never:s9t,null:n9t,nullable:y9t,number:CMe,object:oM,get objectUtil(){return Ote},oboolean:N9t,onumber:S9t,optional:b9t,ostring:C9t,pipeline:w9t,preprocess:v9t,promise:g9t,quotelessJson:N7t,record:c9t,set:d9t,setErrorMap:A7t,strictObject:a9t,string:wMe,symbol:e9t,transformer:L1e,tuple:jMe,undefined:t9t,union:AMe,unknown:r9t,get util(){return fa},void:i9t},Symbol.toStringTag,{value:"Module"})),E9t=t=>t.message?t.message:"unspecified error";class jN extends hi{constructor(e){super(),this.code=Kjt,this.errors=e,super.message=`Web3 validator found ${e.length} error[s]:
${this._compileErrors().join(`
`)}`}_compileErrors(){return this.errors.map(E9t)}}const _9t=["bool","int","uint","bytes","string","address","tuple"],EMe=t=>typeof t=="object"&&"type"in t&&"name"in t,Ale=t=>typeof t=="string",ja=t=>typeof t=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(t);function _Me(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/))}const tL=t=>typeof t=="number"||typeof t=="bigint"||typeof t=="string"&&/^((-0x|0x|-)?[0-9a-f]+|(0x))$/i.test(t);function jle(t){if(typeof t!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof t}`);return t.startsWith("0x")}const Ele=function(t){for(const[e,n]of Object.entries(t))if(n!==void 0&&n.length>0&&n[0]===0)throw new Error(`${e} cannot have leading zeroes, received: ${n.toString()}`)},k9t=["hex","number","blockNumber","blockNumberOrTag","filter","bloom"],I5=t=>{let e=t.replace(/ /,""),n,r=!1,s=[];if(t.includes("[")&&(e=e.slice(0,e.indexOf("[")),s=[...t.matchAll(/(?:\[(\d*)\])/g)].map(a=>parseInt(a[1],10)).map(a=>Number.isNaN(a)?-1:a),r=s.length>0),_9t.includes(e))return{baseType:e,isArray:r,baseTypeSize:n,arraySizes:s};if(e.startsWith("int"))n=parseInt(e.substring(3),10),e="int";else if(e.startsWith("uint"))n=parseInt(t.substring(4),10),e="uint";else if(e.startsWith("bytes"))n=parseInt(e.substring(5),10),e="bytes";else return{baseType:void 0,isArray:!1,baseTypeSize:void 0,arraySizes:s};return{baseType:e,isArray:r,baseTypeSize:n,arraySizes:s}},hW=(t,e={})=>{if(Object.keys(e).includes("type"))throw new jN([{keyword:"eth",message:'Either "eth" or "type" can be presented in schema',params:{eth:t},instancePath:"",schemaPath:""}]);const{baseType:r,baseTypeSize:s}=I5(t);if(!r&&!k9t.includes(t))throw new jN([{keyword:"eth",message:`Eth data type "${t}" is not valid`,params:{eth:t},instancePath:"",schemaPath:""}]);if(r){if(r==="tuple")throw new Error('"tuple" type is not implemented directly.');return{format:`${r}${s??""}`,required:!0}}return t?{format:t,required:!0}:{}},nL=(t,e="/0")=>{const n={type:"array",items:[],maxItems:t.length,minItems:t.length};for(const[r,s]of t.entries()){let a,o,l=[];EMe(s)?(a=s.type,o=s.name||`${e}/${r}`,l=s.components):typeof s=="string"?(a=s,o=`${e}/${r}`):Array.isArray(s)&&(s[0]&&typeof s[0]=="string"&&s[0].startsWith("tuple")&&!Array.isArray(s[0])&&s[1]&&Array.isArray(s[1])?(a=s[0],o=`${e}/${r}`,l=s[1]):(a="tuple",o=`${e}/${r}`,l=s));const{baseType:c,isArray:u,arraySizes:d}=I5(a);let f,x=n;for(let g=d.length-1;g>0;g-=1)f={type:"array",$id:o,items:[],maxItems:d[g],minItems:d[g]},d[g]<0&&(delete f.maxItems,delete f.minItems),Array.isArray(x.items)?x.items.length===0?x.items=[f]:x.items.push(f):x.items=[x.items,f],x=f;if(c==="tuple"&&!u){const g=nL(l,o);g.$id=o,x.items.push(g)}else if(c==="tuple"&&u){const g=d[0],y=Object.assign({type:"array",$id:o,items:nL(l,o)},g>=0&&{minItems:g,maxItems:g});x.items.push(y)}else if(u){const g=d[0],y=Object.assign({type:"array",$id:o,items:hW(a)},g>=0&&{minItems:g,maxItems:g});x.items.push(y)}else Array.isArray(x.items)?x.items.push(Object.assign({$id:o},hW(a))):x.items.push(Object.assign({$id:o},hW(a)));x=n}return n},_le=t=>nL(t),kle=(t,e)=>e===1?t:kle(t[0],e-1),T9=(t,e,n)=>{const r=[];for(const[s,a]of t.entries()){let o,l,c=[];EMe(a)?(o=a.type,l=a.name,c=a.components):typeof a=="string"?o=a:Array.isArray(a)&&(a[1]&&Array.isArray(a[1])?(o=a[0],c=a[1]):(o="tuple",c=a));const{baseType:u,isArray:d,arraySizes:f}=I5(o),x=Array.isArray(e)?e[s]:e[l];if(u==="tuple"&&!d)r.push(T9(c,x,n));else if(u==="tuple"&&d){const g=[];for(const y of x)if(f.length>1){const v=kle(y,f.length-1),C=[];for(const N of v)C.push(T9(c,N,n));g.push(C)}else g.push(T9(c,y,n));r.push(g)}else r.push(x)}return n=n??[],n.push(...r),n},kMe=t=>{if(t>=48&&t<=57)return t-48;if(t>=65&&t<=70)return t-55;if(t>=97&&t<=102)return t-87;throw new Error(`Invalid code point: ${t}`)},Z$=t=>{if(!ja(t))throw new Error("Invalid hex string");const[e,n]=t.startsWith("-")?[!0,t.slice(1)]:[!1,t],r=BigInt(n);return r>Number.MAX_SAFE_INTEGER?e?-r:r:r<Number.MIN_SAFE_INTEGER?r:e?-1*Number(r):Number(r)},J$=t=>{if((typeof t=="number"||typeof t=="bigint")&&t<0)return`-0x${t.toString(16).slice(1)}`;if((typeof t=="number"||typeof t=="bigint")&&t>=0)return`0x${t.toString(16)}`;if(typeof t=="string"&&ja(t)){const[e,n]=t.startsWith("-")?[!0,t.slice(1)]:[!1,t],r=n.split(/^(-)?0(x|X)/).slice(-1)[0];return`${e?"-":""}0x${r.replace(/^0+/,"").toLowerCase()}`}if(typeof t=="string"&&!ja(t))return J$(BigInt(t));throw new gle(t)},rL=(t,e,n="0")=>{if(typeof t=="string"&&!ja(t))return t.padStart(e,n);const r=typeof t=="string"&&ja(t)?t:J$(t),[s,a]=r.startsWith("-")?["-0x",r.slice(3)]:["0x",r.slice(2)];return`${s}${a.padStart(e,n)}`};function L1(t){let e="0x";for(const n of t){const r=n.toString(16);e+=r.length===1?`0${r}`:r}return e}const Xx={zero:48,nine:57,A:65,F:70,a:97,f:102};function B1e(t){if(t>=Xx.zero&&t<=Xx.nine)return t-Xx.zero;if(t>=Xx.A&&t<=Xx.F)return t-(Xx.A-10);if(t>=Xx.a&&t<=Xx.f)return t-(Xx.a-10)}function F5(t){let e=0;if(t.startsWith("0")&&(t[1]==="x"||t[1]==="X")&&(e=2),t.length%2!==0)throw new T4(`hex string has odd length: ${t}`);const n=(t.length-e)/2,r=new Uint8Array(n);for(let s=0,a=e;s<n;s+=1){const o=B1e(t.charCodeAt(a++)),l=B1e(t.charCodeAt(a++));if(o===void 0||l===void 0)throw new T4(`Invalid byte sequence ("${t[a-2]}${t[a-1]}" in "${t}").`);r[s]=o*16+l}return r}function eU(t){var e;return!(t instanceof Uint8Array)&&((e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)==="Uint8Array"?Uint8Array.from(t):t}const TMe=Object.freeze(Object.defineProperty({__proto__:null,abiSchemaToJsonSchema:nL,codePointToInt:kMe,ensureIfUint8Array:eU,ethAbiToJsonSchema:_le,fetchArrayElement:kle,hexToNumber:Z$,hexToUint8Array:F5,numberToHex:J$,padLeft:rL,parseBaseType:I5,transformJsonDataToAbiFormat:T9,uint8ArrayToHexString:L1},Symbol.toStringTag,{value:"Module"})),Bte=t=>{var e,n;return t instanceof Uint8Array||((e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)==="Uint8Array"||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="Buffer"},E2=(t,e={abiType:"bytes"})=>{if(typeof t!="string"&&!Array.isArray(t)&&!Bte(t)||typeof t=="string"&&ja(t)&&t.startsWith("-")||typeof t=="string"&&!ja(t))return!1;let n;if(typeof t=="string"){if(t.length%2!==0)return!1;n=F5(t)}else if(Array.isArray(t)){if(t.some(r=>r<0||r>255||!Number.isInteger(r)))return!1;n=new Uint8Array(t)}else n=t;if(e!=null&&e.abiType){const{baseTypeSize:r}=I5(e.abiType);return r?n.length===r:!0}return e!=null&&e.size?n.length===(e==null?void 0:e.size):!0},PMe=t=>{if(!/^(0x)?[0-9a-f]{40}$/i.test(t))return!1;const e=t.slice(2),n=wN(e.toLowerCase()),r=L1(pd(eU(n))).slice(2);for(let s=0;s<40;s+=1)if(parseInt(r[s],16)>7&&e[s].toUpperCase()!==e[s]||parseInt(r[s],16)<=7&&e[s].toLowerCase()!==e[s])return!1;return!0},ih=(t,e=!0)=>{if(typeof t!="string"&&!Bte(t))return!1;let n;return Bte(t)?n=L1(t):typeof t=="string"&&!ja(t)?n=t.toLowerCase().startsWith("0x")?t:`0x${t}`:n=t,/^(0x)?[0-9a-f]{40}$/i.test(n)?/^(0x|0X)?[0-9a-f]{40}$/.test(n)||/^(0x|0X)?[0-9A-F]{40}$/.test(n)?!0:e?PMe(n):!0:!1},n5=(t,e)=>{if(e===BigInt(0))return BigInt(1);let n=t;for(let r=1;r<e;r+=1)n*=t;return n},A1=(t,e={abiType:"uint"})=>{if(!["number","string","bigint"].includes(typeof t)||typeof t=="string"&&t.length===0)return!1;let n;if(e!=null&&e.abiType){const{baseTypeSize:s}=I5(e.abiType);s&&(n=s)}else e.bitSize&&(n=e.bitSize);const r=n5(BigInt(2),BigInt(n??256))-BigInt(1);try{const s=typeof t=="string"&&ja(t)?BigInt(Z$(t)):BigInt(t);return s>=0&&s<=r}catch{return!1}},b_=(t,e={abiType:"int"})=>{if(!["number","string","bigint"].includes(typeof t)||typeof t=="number"&&t>Number.MAX_SAFE_INTEGER)return!1;let n;if(e!=null&&e.abiType){const{baseTypeSize:a,baseType:o}=I5(e.abiType);if(o!=="int")return!1;a&&(n=a)}else e.bitSize&&(n=e.bitSize);const r=n5(BigInt(2),BigInt((n??256)-1)),s=BigInt(-1)*n5(BigInt(2),BigInt((n??256)-1));try{const a=typeof t=="string"&&ja(t)?BigInt(Z$(t)):BigInt(t);return a>=s&&a<=r}catch{return!1}},IMe=t=>!!(b_(t)||typeof t=="string"&&/[0-9.]/.test(t)&&t.indexOf(".")===t.lastIndexOf(".")||typeof t=="number"),FMe=t=>A1(t),Bc=t=>Object.values($g).includes(t),$te=t=>Bc(t)||FMe(t),dj=t=>typeof t!="string"||!/^(0x)?[0-9a-f]{512}$/i.test(t)?!1:!!(/^(0x)?[0-9a-f]{512}$/.test(t)||/^(0x)?[0-9A-F]{512}$/.test(t)),tU=(t,e)=>{if(typeof e=="string"&&!ja(e)||!dj(t))return!1;const n=typeof e=="string"?F5(e):e,r=L1(pd(n)).slice(2);for(let s=0;s<12;s+=4){const a=(parseInt(r.slice(s,s+2),16)<<8)+parseInt(r.slice(s+2,s+4),16)&2047,o=kMe(t.charCodeAt(t.length-1-Math.floor(a/4))),l=1<<a%4;if((o&l)!==l)return!1}return!0},T9t=(t,e)=>{if(!dj(t)||!ih(e))return!1;const n=rL(e,64);return tU(t,n)},P9t=(t,e)=>!dj(t)||!ih(e)?!1:tU(t,e),I9t=t=>["number","string","boolean"].includes(typeof t)?typeof t=="boolean"?!0:typeof t=="string"&&!ja(t)?t==="1"||t==="0":typeof t=="string"&&ja(t)?t==="0x1"||t==="0x0":t===1||t===0:!1,gr=t=>t==null,EN=t=>typeof t=="object"&&!gr(t)&&!Array.isArray(t)&&!(t instanceof mle),sL=t=>typeof t!="string"||!/^(0x)?[0-9a-f]{64}$/i.test(t)?!1:!!(/^(0x)?[0-9a-f]{64}$/.test(t)||/^(0x)?[0-9A-F]{64}$/.test(t)),F9t=(t,e)=>!dj(t)||!sL(e)?!1:tU(t,e),O9t=t=>{const e=["fromBlock","toBlock","address","topics","blockHash"];if(gr(t)||typeof t!="object"||!Object.keys(t).every(n=>e.includes(n))||!gr(t.fromBlock)&&!$te(t.fromBlock)||!gr(t.toBlock)&&!$te(t.toBlock))return!1;if(!gr(t.address)){if(Array.isArray(t.address)){if(!t.address.every(n=>ih(n)))return!1}else if(!ih(t.address))return!1}return!(!gr(t.topics)&&!t.topics.every(n=>gr(n)?!0:Array.isArray(n)?n.every(r=>sL(r)):!!sL(n)))},r5={address:t=>ih(t),bloom:t=>dj(t),blockNumber:t=>FMe(t),blockTag:t=>Bc(t),blockNumberOrTag:t=>$te(t),bool:t=>I9t(t),bytes:t=>E2(t),filter:t=>O9t(t),hex:t=>ja(t),uint:t=>A1(t),int:t=>b_(t),number:t=>IMe(t),string:t=>Ale(t)};for(let t=8;t<=256;t+=8)r5[`int${t}`]=e=>b_(e,{bitSize:t}),r5[`uint${t}`]=e=>A1(e,{bitSize:t});for(let t=1;t<=32;t+=1)r5[`bytes${t}`]=e=>E2(e,{size:t});r5.bytes256=r5.bytes;const J7=t=>{if((!(t!=null&&t.type)||(t==null?void 0:t.type)==="object")&&(t!=null&&t.properties)){const e={};for(const n of Object.keys(t.properties)){const r=J7(t.properties[n]);r&&(e[n]=r)}return Array.isArray(t.required)?oM(e).partial().required(t.required.reduce((n,r)=>Object.assign(Object.assign({},n),{[r]:!0}),{})):oM(e).partial()}if((t==null?void 0:t.type)==="array"&&(t!=null&&t.items)){if(Array.isArray(t.items)&&t.items.length>1&&t.maxItems!==void 0&&new Set(t.items.map(r=>r.$id)).size===t.items.length){const r=[];for(const s of t.items){const a=J7(s);a&&r.push(a)}return jMe(r)}const e=Array.isArray(t.items)?t.items[0]:t.items;let n=NMe(J7(e));return n=t.minItems!==void 0?n.min(t.minItems):n,n=t.maxItems!==void 0?n.max(t.maxItems):n,n}if(t.oneOf&&Array.isArray(t.oneOf))return AMe(t.oneOf.map(e=>J7(e)));if(t!=null&&t.format){if(!r5[t.format])throw new n7t(t.format);return Dte().refine(r5[t.format],e=>({params:{value:e,format:t.format}}))}return t!=null&&t.type&&(t==null?void 0:t.type)!=="object"&&typeof D1e[String(t.type)]=="function"?D1e[String(t.type)]():oM({data:Dte()}).partial()};class i4{static factory(){return i4.validatorInstance||(i4.validatorInstance=new i4),i4.validatorInstance}validate(e,n,r){var s,a;const l=J7(e).safeParse(n);if(!l.success){const c=this.convertErrors((a=(s=l.error)===null||s===void 0?void 0:s.issues)!==null&&a!==void 0?a:[]);if(c){if(r!=null&&r.silent)return c;throw new jN(c)}}}convertErrors(e){if(e&&Array.isArray(e)&&e.length>0)return e.map(n=>{var r;let s,a,o,l;l=n.path.join("/");const c=String(n.path[n.path.length-1]),u=n.path.join("/");if(n.code===Gr.too_big)a="maxItems",l=`${u}/maxItems`,o={limit:n.maximum},s=`must NOT have more than ${n.maximum} items`;else if(n.code===Gr.too_small)a="minItems",l=`${u}/minItems`,o={limit:n.minimum},s=`must NOT have fewer than ${n.minimum} items`;else if(n.code===Gr.custom){const{value:d,format:f}=(r=n.params)!==null&&r!==void 0?r:{};typeof d>"u"?s=`value at "/${l}" is required`:s=`value "${typeof d=="object"?JSON.stringify(d):d}" at "/${l}" must pass "${f}" validation`,o={value:d}}return{keyword:a??c,instancePath:u?`/${u}`:"",schemaPath:l?`#${l}`:"#",params:o??{value:n.message},message:s??n.message}})}}class M9t{constructor(){this._validator=i4.factory()}validateJSONSchema(e,n,r){return this._validator.validate(e,n,r)}validate(e,n,r={silent:!1}){var s,a;const o=_le(e);if(!(Array.isArray(o.items)&&((s=o.items)===null||s===void 0?void 0:s.length)===0&&n.length===0)){if(Array.isArray(o.items)&&((a=o.items)===null||a===void 0?void 0:a.length)===0&&n.length!==0)throw new jN([{instancePath:"/0",schemaPath:"/",keyword:"required",message:"empty schema against data can not be validated",params:n}]);return this._validator.validate(o,n,r)}}}const Ks=new M9t;function _2(t){var e,n;return t instanceof Uint8Array||((e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)==="Uint8Array"||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="Buffer"}function Ad(...t){const e=t.reduce((s,a)=>s+a.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function nU(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n+=1)if(t[n]!==e[n])return!1;return!0}const rU={noether:BigInt(0),wei:BigInt(1),kwei:BigInt(1e3),Kwei:BigInt(1e3),babbage:BigInt(1e3),femtoether:BigInt(1e3),mwei:BigInt(1e6),Mwei:BigInt(1e6),lovelace:BigInt(1e6),picoether:BigInt(1e6),gwei:BigInt(1e9),Gwei:BigInt(1e9),shannon:BigInt(1e9),nanoether:BigInt(1e9),nano:BigInt(1e9),szabo:BigInt(1e12),microether:BigInt(1e12),micro:BigInt(1e12),finney:BigInt(1e15),milliether:BigInt(1e15),milli:BigInt(1e15),ether:BigInt("1000000000000000000"),kether:BigInt("1000000000000000000000"),grand:BigInt("1000000000000000000000"),mether:BigInt("1000000000000000000000000"),gether:BigInt("1000000000000000000000000000"),tether:BigInt("1000000000000000000000000000000")},Ute="Warning: Using type `number` with values that are large or contain many decimals may cause loss of precision, it is recommended to use type `string` or `BigInt` when using conversion methods",hx=t=>{if(Ks.validate(["bytes"],[t]),_2(t))return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="string")return F5(t);throw new T4(t)},{uint8ArrayToHexString:R9t}=TMe,Gi=t=>R9t(hx(t)),fo=t=>typeof t=="string"&&t.slice(0,2).toLowerCase()!=="0x"?hx(`0x${t}`):hx(t),BT=t=>(Ks.validate(["hex"],[t]),Z$(t)),L9t=BT,ac=(t,e)=>{typeof t!="bigint"&&Ks.validate(["int"],[t]);let n=J$(t);return e&&(!n.startsWith("-")&&n.length%2===1?n="0x0".concat(n.slice(2)):n.length%2===0&&n.startsWith("-")&&(n="-0x0".concat(n.slice(3)))),n},D9t=ac,B9t=t=>BT(t).toString(),km=t=>{Ks.validate(["string"],[t]);let e=t.replace(/^(?:\u0000)/,"");return e=e.replace(/(?:\u0000)$/,""),Gi(new TextEncoder().encode(e))},OMe=km,$9t=km,sU=t=>pMe(fo(t)),U9t=t=>typeof t=="string"?sU(t):(Ks.validate(["bytes"],[t]),pMe(t)),Tle=wN,z9t=sU,MMe=t=>{Ks.validate(["string"],[t]);let e="";for(let n=0;n<t.length;n+=1){const r=t.charCodeAt(n).toString(16);e+=r.length%2!==0?`0${r}`:r}return`0x${e}`},H9t=MMe,RMe=t=>new TextDecoder("ascii").decode(fo(t)),V9t=RMe,j1=(t,e)=>{if(typeof t=="string"&&ih(t))return e?"address":`0x${t.toLowerCase().replace(/^0x/i,"")}`;if(typeof t=="boolean")return e?"bool":t?"0x01":"0x00";if(typeof t=="number")return e?t<0?"int256":"uint256":ac(t);if(typeof t=="bigint")return e?"bigint":ac(t);if(_2(t))return e?"bytes":Gi(t);if(typeof t=="object"&&t)return e?"string":km(JSON.stringify(t));if(typeof t=="string"){if(t.startsWith("-0x")||t.startsWith("-0X"))return e?"int256":ac(t);if(ja(t))return e?"bytes":t;if(tL(t)&&!b_(t)&&!A1(t))return e?"bytes":`0x${t}`;if(tL(t)&&!b_(t)&&A1(t))return e?"uint":ac(t);if(!Number.isFinite(t))return e?"string":km(t)}throw new B8t(t)},sf=t=>{if(typeof t=="number")return t>1e20?(console.warn(Ute),BigInt(t)):t;if(typeof t=="bigint")return t>=Number.MIN_SAFE_INTEGER&&t<=Number.MAX_SAFE_INTEGER?Number(t):t;if(typeof t=="string"&&ja(t))return BT(t);try{return sf(BigInt(t))}catch{throw new gle(t)}},mw=t=>{if(typeof t=="number")return BigInt(t);if(typeof t=="bigint")return t;if(typeof t=="string"&&tL(t))return t.startsWith("-")?-BigInt(t.substring(1)):BigInt(t);throw new gle(t)},W9t=(t,e)=>{let n;if(typeof e=="string"){if(n=rU[e],!n)throw new rMe(e)}else{if(e<0||!Number.isInteger(e))throw new sMe(e);n=n5(BigInt(10),BigInt(e))}const r=String(sf(t)),s=n.toString().length-1;if(s<=0)return r.toString();const a=r.padStart(s,"0"),o=a.slice(0,-s),l=a.slice(-s).replace(/\.?0+$/,"");return o===""?l?`0.${l}`:"0":l===""?o:`${o}.${l}`.slice(0,o.length+s+1)},q9t=(t,e)=>{Ks.validate(["number"],[t]);let n;if(typeof e=="string"){if(n=rU[e],!n)throw new rMe(e)}else{if(e<0||!Number.isInteger(e))throw new sMe(e);n=n5(BigInt(10),BigInt(e))}let r=t;typeof r=="number"&&(r<1e-15&&console.warn(Ute),r>1e20?(console.warn(Ute),r=BigInt(r)):r=r.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}));const[s,a]=String(typeof r=="string"&&!ja(r)?r:sf(r)).split(".").concat(""),l=BigInt(`${s}${a}`)*n,c=a.length;return c===0?l.toString():l.toString().slice(0,-c)},wx=t=>{if(!ih(t,!1))throw new ble(t);const e=t.toLowerCase().replace(/^0x/i,""),n=L1(pd(eU(Tle(e))));if(gr(n)||n==="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")return"";let r="0x";const s=n.replace(/^0x/i,"");for(let a=0;a<e.length;a+=1)parseInt(s[a],16)>7?r+=e[a].toUpperCase():r+=e[a];return r},LMe=t=>{if(typeof t=="boolean")return t;if(typeof t=="number"&&(t===0||t===1)||typeof t=="bigint"&&(t===BigInt(0)||t===BigInt(1)))return!!t;if(typeof t=="string"&&!ja(t)&&(t==="1"||t==="0"||t==="false"||t==="true"))return t==="true"?!0:t==="false"?!1:!!Number(t);if(typeof t=="string"&&ja(t)&&(t==="0x1"||t==="0x0"))return!!sf(t);throw new yle(t)};let Ple=class extends boe{constructor(){super(...arguments),this.maxListeners=Number.MAX_SAFE_INTEGER}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}};const G9t=ja,K9t=tL,Y9t=PMe,X9t=ih,Q9t=dj,Z9t=tU,J9t=T9t,eEt=P9t,tEt=sL,nEt=F9t,rEt=(t,e)=>{const n=typeof t=="string"&&Bc(t),r=typeof e=="string"&&Bc(e);if(t===e||(t==="earliest"||t===0)&&(e==="earliest"||e===0))return 0;if(t==="earliest")return-1;if(e==="earliest")return 1;if(n&&r){const o={[$g.EARLIEST]:1,[$g.FINALIZED]:2,[$g.SAFE]:3,[$g.LATEST]:4,[$g.PENDING]:5};return o[t]<o[e]?-1:1}if(n&&!r||!n&&r)throw new U8t("Cannot compare blocktag with provided non-blocktag input.");const s=BigInt(t),a=BigInt(e);return s<a?-1:s===a?0:1},Ey=t=>typeof t=="object"&&!gr(t)&&Object.keys(t).length!==0&&["input","data","from","gas","gasPrice","gasLimit","address","jsonInterface","syncWithContext","dataInputFill"].some(e=>e in t),si=gr,$1e=t=>typeof t=="object"&&!gr(t)&&!Array.isArray(t)&&!(t instanceof mle),k2=(t,...e)=>{if(!$1e(t))return t;const n=Object.assign({},t);for(const r of e)for(const s in r)$1e(r[s])?(n[s]||(n[s]={}),n[s]=k2(n[s],r[s])):!gr(r[s])&&Object.hasOwnProperty.call(r,s)&&(Array.isArray(r[s])||r[s]instanceof mle?n[s]=r[s].slice(0):n[s]=r[s]);return n},_N=(t,e,n="0")=>typeof t=="string"?ja(t)?rL(t,e,n):t.padStart(e,n):(Ks.validate(["int"],[t]),rL(t,e,n)),DMe=(t,e,n="0")=>{if(typeof t=="string"&&!ja(t))return t.padEnd(e,n);const r=typeof t=="string"&&ja(t)?t:ac(t),s=r.startsWith("-")?3:2;return Ks.validate([r.startsWith("-")?"int":"uint"],[t]),r.padEnd(e+s,n)},BMe=DMe,y_=_N,$Me=(t,e=64)=>{Ks.validate(["int"],[t]);const n=sf(t);if(n>=0)return _N(j1(n),e);const r=n5(BigInt(2),BigInt(e*4));if(-n>=r)throw new iMe(`value: ${t}, nibbleWidth: ${e}`);const a=BigInt(n)+r;return _N(ac(a),e)},sEt=(t,e=64)=>{Ks.validate(["int"],[t]);const n=sf(t);if(n<0)return n;const r=Math.ceil(Math.log(Number(n))/Math.log(2));if(r>e*4)throw new iMe(`value: "${t}", nibbleWidth: "${e}"`);if(e*4!==r)return n;const s=n5(BigInt(2),BigInt(e)*BigInt(4));return sf(BigInt(n)-s)},{parseBaseType:iEt}=TMe,Cg=t=>typeof t=="object"&&!gr(t)&&"number"in t&&"bytes"in t,aEt=(t,e,n=[])=>{let r=Object.assign({},t),s;for(const a of e){if(r.oneOf&&s){const o=s,l=n.find(([c])=>c===o);l&&l[0]===s&&(r=r.oneOf[l[1]])}if(!r.properties&&!r.items)return;r.properties?r=r.properties[a]:r.items&&r.items.properties?r=r.items.properties[a]:r.items&&EN(r.items)?r=r.items:r.items&&Array.isArray(r.items)&&(r=r.items[parseInt(a,10)]),r&&a&&(s=a)}return r},v_=(t,e,n)=>{try{const{baseType:r,baseTypeSize:s}=iEt(e);if(r==="int"||r==="uint")switch(n.number){case ap.NUMBER:return Number(mw(t));case ap.HEX:return ac(mw(t));case ap.STR:return mw(t).toString();case ap.BIGINT:return mw(t);default:throw new Pte(`Invalid format: ${String(n.number)}`)}if(r==="bytes"){let a;switch(s?typeof t=="string"?a=_N(t,s*2):_2(t)&&(a=Ad(new Uint8Array(s-t.length),t)):a=t,n.bytes){case S1.HEX:return Gi(hx(a));case S1.UINT8ARRAY:return hx(a);default:throw new Pte(`Invalid format: ${String(n.bytes)}`)}}if(r==="string")return String(t)}catch{return t}return t},U1e=({value:t,schemaProp:e,schema:n,object:r,key:s,dataPath:a,format:o,oneOfPath:l=[]})=>{var c,u;if(Array.isArray(t)){let d=e;if((e==null?void 0:e.oneOf)!==void 0&&e.oneOf.forEach((f,x)=>{var g,y;!Array.isArray(e==null?void 0:e.items)&&(typeof t[0]=="object"&&((g=f==null?void 0:f.items)===null||g===void 0?void 0:g.type)==="object"||typeof t[0]=="string"&&((y=f==null?void 0:f.items)===null||y===void 0?void 0:y.type)!=="object")&&(d=f,l.push([s,x]))}),gr(d==null?void 0:d.items))return delete r[s],a.pop(),!0;if(EN(d.items)&&!gr(d.items.format)){for(let f=0;f<t.length;f+=1)r[s][f]=v_(t[f],(c=d==null?void 0:d.items)===null||c===void 0?void 0:c.format,o);return a.pop(),!0}if(!Array.isArray(d==null?void 0:d.items)&&((u=d==null?void 0:d.items)===null||u===void 0?void 0:u.type)==="object"){for(const f of t)iU(f,n,a,o,l);return a.pop(),!0}if(Array.isArray(d==null?void 0:d.items)){for(let f=0;f<t.length;f+=1)r[s][f]=v_(t[f],d.items[f].format,o);return a.pop(),!0}}return!1},iU=(t,e,n,r,s=[])=>{var a;if(!EN(t)&&!Array.isArray(t))return v_(t,e==null?void 0:e.format,r);const o=t;if(Array.isArray(o)&&(e==null?void 0:e.type)==="array"&&((a=e==null?void 0:e.items)===null||a===void 0?void 0:a.type)==="object")U1e({value:o,schemaProp:e,schema:e,object:o,key:"",dataPath:n,format:r,oneOfPath:s});else for(const[l,c]of Object.entries(o)){n.push(l);let u=aEt(e,n,s);if(gr(u)){delete o[l],n.pop();continue}if(EN(c)){iU(c,e,n,r,s),n.pop();continue}if(!U1e({value:c,schemaProp:u,schema:e,object:o,key:l,dataPath:n,format:r,oneOfPath:s})){if((u==null?void 0:u.format)===void 0&&(u==null?void 0:u.oneOf)!==void 0){for(const[d,f]of u.oneOf.entries())if((f==null?void 0:f.format)!==void 0){u=f;break}}o[l]=v_(c,u.format,r),n.pop()}}return o},qr=(t,e,n=bd)=>{let r;EN(e)?r=k2({},e):Array.isArray(e)?r=[...e]:r=e;const s=EN(t)?t:_le(t);if(!s.properties&&!s.items&&!s.format)throw new Pte("Invalid json schema for formatting");return iU(r,s,[],n)},UMe="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",kN=t=>{let e;return typeof t=="bigint"||typeof t=="number"?e=wN(t.toString()):Array.isArray(t)?e=new Uint8Array(t):typeof t=="string"&&!ja(t)?e=wN(t):e=hx(t),Gi(pd(eU(e)))},$T=t=>{let e;typeof t=="string"?t.startsWith("0x")&&ja(t)?e=fo(t):e=wN(t):e=t;const n=kN(e);return n===UMe?void 0:n},ah=t=>{const e=$T(t);return gr(e)?UMe:e},oEt=t=>{if(Array.isArray(t))throw new Error("Autodetection of array types is not supported.");let e,n;if(typeof t=="object"&&("t"in t||"type"in t)&&("v"in t||"value"in t))e="t"in t?t.t:t.type,n="v"in t?t.v:t.value,e=e.toLowerCase()==="bigint"?"int":e;else{if(typeof t=="bigint")return["int",t];e=j1(t,!0),n=j1(t),!e.startsWith("int")&&!e.startsWith("uint")&&(e="bytes")}return(e.startsWith("int")||e.startsWith("uint"))&&typeof n=="string"&&!/^(-)?0x/i.test(n)&&(n=mw(n)),[e,n]},lEt=t=>t.startsWith("int[")?`int256${t.slice(3)}`:t==="int"?"int256":t.startsWith("uint[")?`uint256'${t.slice(4)}`:t==="uint"?"uint256":t,pW=(t,e)=>{const n=/^(\d+).*$/.exec(t.slice(e));return n?parseInt(n[1],10):0},z1e=t=>t.toString(2).length,H1e=(t,e)=>{const n=e.toString();if(t==="string"){if(typeof e=="string")return km(e);throw new D8t(e)}if(t==="bool"||t==="boolean"){if(typeof e=="boolean")return e?"01":"00";throw new yle(e)}if(t==="address"){if(!ih(n))throw new ble(n);return n}const r=lEt(t);if(t.startsWith("uint")){const s=pW(r,4);if(s%8||s<8||s>256)throw new j1e(n);const a=sf(n);if(z1e(a)>s)throw new E1e(n);if(a<BigInt(0))throw new $8t(n);return s?y_(a.toString(16),s/8*2):a.toString(16)}if(t.startsWith("int")){const s=pW(r,3);if(s%8||s<8||s>256)throw new j1e(t);const a=sf(n);if(z1e(a)>s)throw new E1e(n);return a<BigInt(0)?$Me(a.toString(),s/8*2):s?y_(a.toString(16),s/4):a.toString(16)}if(r==="bytes"){if(n.replace(/^0x/i,"").length%2!==0)throw new T4(n);return n}if(t.startsWith("bytes")){if(n.replace(/^0x/i,"").length%2!==0)throw new T4(n);const s=pW(t,5);if(!s||s<1||s>64||s<n.replace(/^0x/i,"").length/2)throw new T4(n);return BMe(n,s*2)}return""},zMe=t=>{const[e,n]=oEt(t);return Array.isArray(n)?n.map(a=>H1e(e,a).replace("0x","")).join(""):H1e(e,n).replace("0x","")},Ile=(...t)=>`0x${t.map(zMe).join("").toLowerCase()}`,cEt=(...t)=>$T(Ile(...t)),uEt=(...t)=>ah(Ile(...t)),dEt=t=>$T(`0x${(typeof t=="number"?t.toString():t).padStart(64,"0")}`);function fEt(t){return uMe(t)}const w_=t=>fEt(t),hEt=t=>Gi(w_(t));var aU=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function HMe(t){return(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function VMe(t,e,n){return aU(this,void 0,void 0,function*(){let r;const s=yield Promise.race([t instanceof Promise?t:t(),new Promise((a,o)=>{r=setTimeout(()=>n?o(n):a(void 0),e)})]);if(r&&clearTimeout(r),s instanceof Error)throw s;return s})}function Fle(t,e){let n;return[new Promise((s,a)=>{n=setInterval(function o(){return aU(this,void 0,void 0,function*(){try{const l=yield VMe(t,e);gr(l)||(clearInterval(n),s(l))}catch(l){clearInterval(n),a(l)}}),o}(),e)}),n]}function pEt(t,e){return aU(this,void 0,void 0,function*(){return Fle(t,e)[0]})}function Ole(t,e){let n;const r=new Promise((s,a)=>{n=setTimeout(()=>{a(e)},t)});return[n,r]}function WMe(t,e){let n;const r=new Promise((s,a)=>{n=setInterval(()=>{aU(this,void 0,void 0,function*(){const o=yield t();o&&(clearInterval(n),a(o))})},e)});return[n,r]}const Mle=()=>{const t=w_(16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Gi(t);return[e.substring(2,10),e.substring(10,14),e.substring(14,18),e.substring(18,22),e.substring(22,34)].join("-")},Rle=t=>{const e=t.error.code;return Sd.has(e)||e>=-32099&&e<=-32e3},$y=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"result"in t&&gr(t.error)&&(typeof t.id=="number"||typeof t.id=="string"),Uy=t=>!Array.isArray(t)&&t.jsonrpc==="2.0"&&!!t&&gr(t.result)&&"error"in t&&(typeof t.id=="number"||typeof t.id=="string"),oU=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&!gr(t.params)&&!gr(t.method),qMe=t=>!Array.isArray(t)&&!!t&&t.jsonrpc==="2.0"&&"id"in t&&"result"in t,iL=t=>$y(t)||Uy(t),Lle=t=>Array.isArray(t)?t.every(iL):iL(t),C_=t=>Array.isArray(t)&&t.length>0&&Lle(t);let lM;const GMe=t=>{lM=t},s5=t=>{var e,n,r,s;return typeof lM<"u"&&(lM+=1),{jsonrpc:(e=t.jsonrpc)!==null&&e!==void 0?e:"2.0",id:(r=(n=t.id)!==null&&n!==void 0?n:lM)!==null&&r!==void 0?r:Mle(),method:t.method,params:(s=t.params)!==null&&s!==void 0?s:void 0}},Dle=t=>t.map(e=>s5(e)),h0=t=>Array.isArray(t)&&t.length>0,mEt=Object.freeze(Object.defineProperty({__proto__:null,isBatchRequest:h0,isBatchResponse:C_,isResponseRpcError:Rle,isResponseWithError:Uy,isResponseWithNotification:oU,isResponseWithResult:$y,isSubscriptionResult:qMe,isValidResponse:Lle,setRequestIdStart:GMe,toBatchPayload:Dle,toPayload:s5,validateResponse:iL},Symbol.toStringTag,{value:"Module"}));var mW=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},KMe;class aL{constructor({timeout:e,eagerStart:n,timeoutMessage:r}={timeout:0,eagerStart:!1,timeoutMessage:"DeferredPromise timed out"}){this[KMe]="Promise",this._state="pending",this._promise=new Promise((s,a)=>{this._resolve=s,this._reject=a}),this._timeoutMessage=r,this._timeoutInterval=e,n&&this.startTimer()}get state(){return this._state}then(e,n){return mW(this,void 0,void 0,function*(){return this._promise.then(e,n)})}catch(e){return mW(this,void 0,void 0,function*(){return this._promise.catch(e)})}finally(e){return mW(this,void 0,void 0,function*(){return this._promise.finally(e)})}resolve(e){this._resolve(e),this._state="fulfilled",this._clearTimeout()}reject(e){this._reject(e),this._state="rejected",this._clearTimeout()}startTimer(){this._timeoutInterval&&this._timeoutInterval>0&&(this._timeoutId=setTimeout(this._checkTimeout.bind(this),this._timeoutInterval))}_checkTimeout(){this._state==="pending"&&this._timeoutId&&this.reject(new YOe(this._timeoutMessage))}_clearTimeout(){this._timeoutId&&clearTimeout(this._timeoutId)}}KMe=Symbol.toStringTag;class YMe{constructor(e,n){this.eventEmitter=e,this.autoReconnect=n,this.chunkTimeout=1e3*15}clearQueues(){typeof this._clearQueues=="function"&&this._clearQueues()}onError(e){this._clearQueues=e}parseResponse(e){const n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(s=>{let a=s;this.lastChunk&&(a=this.lastChunk+a);let o;try{o=JSON.parse(a)}catch{this.lastChunk=a,this.lastChunkTimeout&&clearTimeout(this.lastChunkTimeout),this.lastChunkTimeout=setTimeout(()=>{this.autoReconnect||(this.clearQueues(),this.eventEmitter.emit("error",new X$({id:1,jsonrpc:"2.0",error:{code:2,message:"Chunk timeout"}})))},this.chunkTimeout);return}clearTimeout(this.lastChunkTimeout),this.lastChunk=void 0,o&&n.push(o)}),n}}var V1e=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class Ble extends RT{constructor(){super(...arguments),this._eventEmitter=new boe,this._chainId="",this._accounts=[]}_getChainId(){return V1e(this,void 0,void 0,function*(){var e;const n=yield this.request(s5({method:"eth_chainId",params:[]}));return(e=n==null?void 0:n.result)!==null&&e!==void 0?e:""})}_getAccounts(){return V1e(this,void 0,void 0,function*(){var e;const n=yield this.request(s5({method:"eth_accounts",params:[]}));return(e=n==null?void 0:n.result)!==null&&e!==void 0?e:[]})}_onConnect(){Promise.all([this._getChainId().then(e=>{e!==this._chainId&&(this._chainId=e,this._eventEmitter.emit("chainChanged",this._chainId))}).catch(e=>{console.error(e)}),this._getAccounts().then(e=>{this._accounts.length===e.length&&e.every(n=>e.includes(n))||(this._accounts=e,this._onAccountsChanged())}).catch(e=>{console.error(e)})]).then(()=>this._eventEmitter.emit("connect",{chainId:this._chainId})).catch(e=>{console.error(e)})}_onDisconnect(e,n){this._eventEmitter.emit("disconnect",new H8t(e,n))}_onAccountsChanged(){this._eventEmitter.emit("accountsChanged",this._accounts)}}var xW=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const xEt={autoReconnect:!0,delay:5e3,maxAttempts:5},gEt=1e3;class XMe extends Ble{get SocketConnection(){return this._socketConnection}constructor(e,n,r){if(super(),this._connectionStatus="connecting",this._onMessageHandler=this._onMessage.bind(this),this._onOpenHandler=this._onConnect.bind(this),this._onCloseHandler=this._onCloseEvent.bind(this),this._onErrorHandler=this._onError.bind(this),!this._validateProviderPath(e))throw new Ite(e);this._socketPath=e,this._socketOptions=n,this._reconnectOptions=Object.assign(Object.assign({},xEt),r??{}),this._pendingRequestsQueue=new Map,this._sentRequestsQueue=new Map,this._init(),this.connect(),this.chunkResponseParser=new YMe(this._eventEmitter,this._reconnectOptions.autoReconnect),this.chunkResponseParser.onError(()=>{this._clearQueues()}),this.isReconnecting=!1}_init(){this._reconnectAttempts=0}connect(){try{this._openSocketConnection(),this._connectionStatus="connecting",this._addSocketListeners()}catch(e){if(this.isReconnecting)setImmediate(()=>{this._reconnect()});else throw this._connectionStatus="disconnected",e&&e.message?new LT(`Error while connecting to ${this._socketPath}. Reason: ${e.message}`):new Ite(this._socketPath)}}_validateProviderPath(e){return!!e}getPendingRequestQueueSize(){return this._pendingRequestsQueue.size}getSentRequestsQueueSize(){return this._sentRequestsQueue.size}supportsSubscriptions(){return!0}on(e,n){this._eventEmitter.on(e,n)}once(e,n){this._eventEmitter.once(e,n)}removeListener(e,n){this._eventEmitter.removeListener(e,n)}_onDisconnect(e,n){this._connectionStatus="disconnected",super._onDisconnect(e,n)}disconnect(e,n){const r=e??gEt;this._removeSocketListeners(),this.getStatus()!=="disconnected"&&this._closeSocketConnection(r,n),this._onDisconnect(r,n)}safeDisconnect(e,n){return xW(this,arguments,void 0,function*(r,s,a=!1,o=1e3){let l=0;yield xW(this,void 0,void 0,function*(){return new Promise(u=>{const d=setInterval(()=>{a&&l>=5&&this.clearQueues(),this.getPendingRequestQueueSize()===0&&this.getSentRequestsQueueSize()===0&&(clearInterval(d),u(!0)),l+=1},o)})}),this.disconnect(r,s)})}removeAllListeners(e){this._eventEmitter.removeAllListeners(e)}_onError(e){this.isReconnecting?this._reconnect():this._eventEmitter.emit("error",e)}reset(){this._sentRequestsQueue.clear(),this._pendingRequestsQueue.clear(),this._init(),this._removeSocketListeners(),this._addSocketListeners()}_reconnect(){this.isReconnecting||(this.isReconnecting=!0,this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((e,n)=>{e.deferredPromise.reject(new s8t),this._sentRequestsQueue.delete(n)}),this._reconnectAttempts<this._reconnectOptions.maxAttempts?(this._reconnectAttempts+=1,setTimeout(()=>{this._removeSocketListeners(),this.connect(),this.isReconnecting=!1},this._reconnectOptions.delay)):(this.isReconnecting=!1,this._clearQueues(),this._removeSocketListeners(),this._eventEmitter.emit("error",new r8t(this._reconnectOptions.maxAttempts))))}request(e){return xW(this,void 0,void 0,function*(){if(si(this._socketConnection))throw new Error("Connection is undefined");this.getStatus()==="disconnected"&&this.connect();const n=h0(e)?e[0].id:e.id;if(!n)throw new d8t("Request Id not defined");if(this._sentRequestsQueue.has(n))throw new i8t(n);const r=new aL;r.catch(a=>{this._eventEmitter.emit("error",a)});const s={payload:e,deferredPromise:r};if(this.getStatus()==="connecting")return this._pendingRequestsQueue.set(n,s),s.deferredPromise;this._sentRequestsQueue.set(n,s);try{this._sendToSocket(s.payload)}catch(a){this._sentRequestsQueue.delete(n),this._eventEmitter.emit("error",a)}return r})}_onConnect(){this._connectionStatus="connected",this._reconnectAttempts=0,super._onConnect(),this._sendPendingRequests()}_sendPendingRequests(){for(const[e,n]of this._pendingRequestsQueue.entries())try{this._sendToSocket(n.payload),this._pendingRequestsQueue.delete(e),this._sentRequestsQueue.set(e,n)}catch(r){this._pendingRequestsQueue.delete(e),this._eventEmitter.emit("error",r)}}_onMessage(e){const n=this._parseResponses(e);if(!(si(n)||n.length===0))for(const r of n){if(oU(r)&&r.method.endsWith("_subscription")){this._eventEmitter.emit("message",r);return}const s=C_(r)?r[0].id:r.id,a=this._sentRequestsQueue.get(s);if(!a)return;(C_(r)||$y(r)||Uy(r))&&(this._eventEmitter.emit("message",r),a.deferredPromise.resolve(r)),this._sentRequestsQueue.delete(s)}}clearQueues(e){this._clearQueues(e)}_clearQueues(e){this._pendingRequestsQueue.size>0&&this._pendingRequestsQueue.forEach((n,r)=>{n.deferredPromise.reject(new Tte(e)),this._pendingRequestsQueue.delete(r)}),this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((n,r)=>{n.deferredPromise.reject(new Tte(e)),this._sentRequestsQueue.delete(r)}),this._removeSocketListeners()}}const QMe=Object.freeze(Object.defineProperty({__proto__:null,ChunkResponseParser:YMe,Eip1193Provider:Ble,EventEmitter:Ple,SocketProvider:XMe,Web3DeferredPromise:aL,asciiToHex:MMe,bytesToHex:Gi,bytesToUint8Array:hx,checkAddressCheckSum:Y9t,compareBlockNumbers:rEt,convert:iU,convertScalarValue:v_,encodePacked:Ile,ethUnitMap:rU,format:qr,fromAscii:H9t,fromDecimal:D9t,fromTwosComplement:sEt,fromUtf8:OMe,fromWei:W9t,getStorageSlotNumForLongString:dEt,hexToAscii:RMe,hexToBytes:fo,hexToNumber:BT,hexToNumberString:B9t,hexToString:z9t,hexToUtf8:sU,isAddress:X9t,isBatchRequest:h0,isBatchResponse:C_,isBloom:Q9t,isContractAddressInBloom:eEt,isContractInitOptions:Ey,isDataFormat:Cg,isHex:K9t,isHexStrict:G9t,isInBloom:Z9t,isNullish:si,isPromise:HMe,isResponseRpcError:Rle,isResponseWithError:Uy,isResponseWithNotification:oU,isResponseWithResult:$y,isSubscriptionResult:qMe,isTopic:tEt,isTopicInBloom:nEt,isUint8Array:_2,isUserEthereumAddressInBloom:J9t,isValidResponse:Lle,jsonRpc:mEt,keccak256:kN,keccak256Wrapper:kN,leftPad:y_,mergeDeep:k2,numberToHex:ac,padLeft:_N,padRight:DMe,pollTillDefined:pEt,pollTillDefinedAndReturnIntervalId:Fle,processSolidityEncodePackedArgs:zMe,randomBytes:w_,randomHex:hEt,rejectIfConditionAtInterval:WMe,rejectIfTimeout:Ole,rightPad:BMe,setRequestIdStart:GMe,sha3:$T,sha3Raw:ah,soliditySha3:cEt,soliditySha3Raw:uEt,stringToHex:$9t,toAscii:V9t,toBatchPayload:Dle,toBigInt:mw,toBool:LMe,toChecksumAddress:wx,toDecimal:L9t,toHex:j1,toNumber:sf,toPayload:s5,toTwosComplement:$Me,toUtf8:U9t,toWei:q9t,uint8ArrayConcat:Ad,uint8ArrayEquals:nU,utf8ToBytes:Tle,utf8ToHex:km,uuidV4:Mle,validateResponse:iL,waitWithTimeout:VMe},Symbol.toStringTag,{value:"Module"}));class lU{constructor(){this._emitter=new Ple}on(e,n){this._emitter.on(e,n)}once(e,n){this._emitter.once(e,n)}off(e,n){this._emitter.off(e,n)}emit(e,n){this._emitter.emit(e,n)}listenerCount(e){return this._emitter.listenerCount(e)}listeners(e){return this._emitter.listeners(e)}eventNames(){return this._emitter.eventNames()}removeAllListeners(){return this._emitter.removeAllListeners()}setMaxListenerWarningThreshold(e){this._emitter.setMaxListeners(e)}getMaxListeners(){return this._emitter.getMaxListeners()}}var i5;(function(t){t.CONFIG_CHANGE="CONFIG_CHANGE"})(i5||(i5={}));class bEt extends lU{constructor(e){super(),this.config={handleRevert:!1,defaultAccount:void 0,defaultBlock:"latest",transactionBlockTimeout:50,transactionConfirmationBlocks:24,transactionPollingInterval:1e3,transactionPollingTimeout:750*1e3,transactionReceiptPollingInterval:void 0,transactionSendTimeout:750*1e3,transactionConfirmationPollingInterval:void 0,blockHeaderTimeout:10,maxListenersWarningThreshold:100,contractDataInputFill:"data",defaultNetworkId:void 0,defaultChain:"mainnet",defaultHardfork:"london",defaultCommon:void 0,defaultTransactionType:"0x2",defaultMaxPriorityFeePerGas:j1(25e8),enableExperimentalFeatures:{useSubscriptionWhenCheckingBlockTimeout:!1,useRpcCallSpecification:!1},transactionBuilder:void 0,transactionTypeParser:void 0,customTransactionSchema:void 0,defaultReturnFormat:bd,ignoreGasPricing:!1},this.setConfig(e??{})}setConfig(e){const n=Object.keys(e);for(const r of n)this._triggerConfigChange(r,e[r]),!si(e[r])&&typeof e[r]=="number"&&r==="maxListenersWarningThreshold"&&this.setMaxListenerWarningThreshold(Number(e[r]));Object.assign(this.config,e)}get handleRevert(){return this.config.handleRevert}set handleRevert(e){this._triggerConfigChange("handleRevert",e),this.config.handleRevert=e}get contractDataInputFill(){return this.config.contractDataInputFill}set contractDataInputFill(e){this._triggerConfigChange("contractDataInputFill",e),this.config.contractDataInputFill=e}get defaultAccount(){return this.config.defaultAccount}set defaultAccount(e){this._triggerConfigChange("defaultAccount",e),this.config.defaultAccount=e}get defaultBlock(){return this.config.defaultBlock}set defaultBlock(e){this._triggerConfigChange("defaultBlock",e),this.config.defaultBlock=e}get transactionSendTimeout(){return this.config.transactionSendTimeout}set transactionSendTimeout(e){this._triggerConfigChange("transactionSendTimeout",e),this.config.transactionSendTimeout=e}get transactionBlockTimeout(){return this.config.transactionBlockTimeout}set transactionBlockTimeout(e){this._triggerConfigChange("transactionBlockTimeout",e),this.config.transactionBlockTimeout=e}get transactionConfirmationBlocks(){return this.config.transactionConfirmationBlocks}set transactionConfirmationBlocks(e){this._triggerConfigChange("transactionConfirmationBlocks",e),this.config.transactionConfirmationBlocks=e}get transactionPollingInterval(){return this.config.transactionPollingInterval}set transactionPollingInterval(e){this._triggerConfigChange("transactionPollingInterval",e),this.config.transactionPollingInterval=e,this.transactionReceiptPollingInterval=e,this.transactionConfirmationPollingInterval=e}get transactionPollingTimeout(){return this.config.transactionPollingTimeout}set transactionPollingTimeout(e){this._triggerConfigChange("transactionPollingTimeout",e),this.config.transactionPollingTimeout=e}get transactionReceiptPollingInterval(){return this.config.transactionReceiptPollingInterval}set transactionReceiptPollingInterval(e){this._triggerConfigChange("transactionReceiptPollingInterval",e),this.config.transactionReceiptPollingInterval=e}get transactionConfirmationPollingInterval(){return this.config.transactionConfirmationPollingInterval}set transactionConfirmationPollingInterval(e){this._triggerConfigChange("transactionConfirmationPollingInterval",e),this.config.transactionConfirmationPollingInterval=e}get blockHeaderTimeout(){return this.config.blockHeaderTimeout}set blockHeaderTimeout(e){this._triggerConfigChange("blockHeaderTimeout",e),this.config.blockHeaderTimeout=e}get enableExperimentalFeatures(){return this.config.enableExperimentalFeatures}set enableExperimentalFeatures(e){this._triggerConfigChange("enableExperimentalFeatures",e),this.config.enableExperimentalFeatures=e}get maxListenersWarningThreshold(){return this.config.maxListenersWarningThreshold}set maxListenersWarningThreshold(e){this._triggerConfigChange("maxListenersWarningThreshold",e),this.setMaxListenerWarningThreshold(e),this.config.maxListenersWarningThreshold=e}get defaultReturnFormat(){return this.config.defaultReturnFormat}set defaultReturnFormat(e){this._triggerConfigChange("defaultReturnFormat",e),this.config.defaultReturnFormat=e}get defaultNetworkId(){return this.config.defaultNetworkId}set defaultNetworkId(e){this._triggerConfigChange("defaultNetworkId",e),this.config.defaultNetworkId=e}get defaultChain(){return this.config.defaultChain}set defaultChain(e){if(!si(this.config.defaultCommon)&&!si(this.config.defaultCommon.baseChain)&&e!==this.config.defaultCommon.baseChain)throw new T1e(this.config.defaultChain,e);this._triggerConfigChange("defaultChain",e),this.config.defaultChain=e}get defaultHardfork(){return this.config.defaultHardfork}set defaultHardfork(e){if(!si(this.config.defaultCommon)&&!si(this.config.defaultCommon.hardfork)&&e!==this.config.defaultCommon.hardfork)throw new k1e(this.config.defaultCommon.hardfork,e);this._triggerConfigChange("defaultHardfork",e),this.config.defaultHardfork=e}get defaultCommon(){return this.config.defaultCommon}set defaultCommon(e){if(!si(this.config.defaultHardfork)&&!si(e)&&!si(e.hardfork)&&this.config.defaultHardfork!==e.hardfork)throw new k1e(this.config.defaultHardfork,e.hardfork);if(!si(this.config.defaultChain)&&!si(e)&&!si(e.baseChain)&&this.config.defaultChain!==e.baseChain)throw new T1e(this.config.defaultChain,e.baseChain);this._triggerConfigChange("defaultCommon",e),this.config.defaultCommon=e}get ignoreGasPricing(){return this.config.ignoreGasPricing}set ignoreGasPricing(e){this._triggerConfigChange("ignoreGasPricing",e),this.config.ignoreGasPricing=e}get defaultTransactionType(){return this.config.defaultTransactionType}set defaultTransactionType(e){this._triggerConfigChange("defaultTransactionType",e),this.config.defaultTransactionType=e}get defaultMaxPriorityFeePerGas(){return this.config.defaultMaxPriorityFeePerGas}set defaultMaxPriorityFeePerGas(e){this._triggerConfigChange("defaultMaxPriorityFeePerGas",e),this.config.defaultMaxPriorityFeePerGas=e}get transactionBuilder(){return this.config.transactionBuilder}set transactionBuilder(e){this._triggerConfigChange("transactionBuilder",e),this.config.transactionBuilder=e}get transactionTypeParser(){return this.config.transactionTypeParser}set transactionTypeParser(e){this._triggerConfigChange("transactionTypeParser",e),this.config.transactionTypeParser=e}get customTransactionSchema(){return this.config.customTransactionSchema}set customTransactionSchema(e){this._triggerConfigChange("customTransactionSchema",e),this.config.customTransactionSchema=e}_triggerConfigChange(e,n){this.emit(i5.CONFIG_CHANGE,{name:e,oldValue:this.config[e],newValue:n})}}var QI={exports:{}},W1e;function yEt(){return W1e||(W1e=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Ru<"u"&&Ru,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(o){var l=typeof a<"u"&&a||typeof self<"u"&&self||typeof l<"u"&&l,c={searchParams:"URLSearchParams"in l,iterable:"Symbol"in l&&"iterator"in Symbol,blob:"FileReader"in l&&"Blob"in l&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in l,arrayBuffer:"ArrayBuffer"in l};function u(q){return q&&DataView.prototype.isPrototypeOf(q)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(q){return q&&d.indexOf(Object.prototype.toString.call(q))>-1};function x(q){if(typeof q!="string"&&(q=String(q)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(q)||q==="")throw new TypeError('Invalid character in header field name: "'+q+'"');return q.toLowerCase()}function g(q){return typeof q!="string"&&(q=String(q)),q}function y(q){var se={next:function(){var ae=q.shift();return{done:ae===void 0,value:ae}}};return c.iterable&&(se[Symbol.iterator]=function(){return se}),se}function v(q){this.map={},q instanceof v?q.forEach(function(se,ae){this.append(ae,se)},this):Array.isArray(q)?q.forEach(function(se){this.append(se[0],se[1])},this):q&&Object.getOwnPropertyNames(q).forEach(function(se){this.append(se,q[se])},this)}v.prototype.append=function(q,se){q=x(q),se=g(se);var ae=this.map[q];this.map[q]=ae?ae+", "+se:se},v.prototype.delete=function(q){delete this.map[x(q)]},v.prototype.get=function(q){return q=x(q),this.has(q)?this.map[q]:null},v.prototype.has=function(q){return this.map.hasOwnProperty(x(q))},v.prototype.set=function(q,se){this.map[x(q)]=g(se)},v.prototype.forEach=function(q,se){for(var ae in this.map)this.map.hasOwnProperty(ae)&&q.call(se,this.map[ae],ae,this)},v.prototype.keys=function(){var q=[];return this.forEach(function(se,ae){q.push(ae)}),y(q)},v.prototype.values=function(){var q=[];return this.forEach(function(se){q.push(se)}),y(q)},v.prototype.entries=function(){var q=[];return this.forEach(function(se,ae){q.push([ae,se])}),y(q)},c.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function C(q){if(q.bodyUsed)return Promise.reject(new TypeError("Already read"));q.bodyUsed=!0}function N(q){return new Promise(function(se,ae){q.onload=function(){se(q.result)},q.onerror=function(){ae(q.error)}})}function P(q){var se=new FileReader,ae=N(se);return se.readAsArrayBuffer(q),ae}function T(q){var se=new FileReader,ae=N(se);return se.readAsText(q),ae}function M(q){for(var se=new Uint8Array(q),ae=new Array(se.length),W=0;W<se.length;W++)ae[W]=String.fromCharCode(se[W]);return ae.join("")}function F(q){if(q.slice)return q.slice(0);var se=new Uint8Array(q.byteLength);return se.set(new Uint8Array(q)),se.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(q){this.bodyUsed=this.bodyUsed,this._bodyInit=q,q?typeof q=="string"?this._bodyText=q:c.blob&&Blob.prototype.isPrototypeOf(q)?this._bodyBlob=q:c.formData&&FormData.prototype.isPrototypeOf(q)?this._bodyFormData=q:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(q)?this._bodyText=q.toString():c.arrayBuffer&&c.blob&&u(q)?(this._bodyArrayBuffer=F(q.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(q)||f(q))?this._bodyArrayBuffer=F(q):this._bodyText=q=Object.prototype.toString.call(q):this._bodyText="",this.headers.get("content-type")||(typeof q=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(q)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var q=C(this);if(q)return q;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var q=C(this);return q||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(P)}),this.text=function(){var q=C(this);if(q)return q;if(this._bodyBlob)return T(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(M(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(ne)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function z(q){var se=q.toUpperCase();return L.indexOf(se)>-1?se:q}function X(q,se){if(!(this instanceof X))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');se=se||{};var ae=se.body;if(q instanceof X){if(q.bodyUsed)throw new TypeError("Already read");this.url=q.url,this.credentials=q.credentials,se.headers||(this.headers=new v(q.headers)),this.method=q.method,this.mode=q.mode,this.signal=q.signal,!ae&&q._bodyInit!=null&&(ae=q._bodyInit,q.bodyUsed=!0)}else this.url=String(q);if(this.credentials=se.credentials||this.credentials||"same-origin",(se.headers||!this.headers)&&(this.headers=new v(se.headers)),this.method=z(se.method||this.method||"GET"),this.mode=se.mode||this.mode||null,this.signal=se.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&ae)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(ae),(this.method==="GET"||this.method==="HEAD")&&(se.cache==="no-store"||se.cache==="no-cache")){var W=/([?&])_=[^&]*/;if(W.test(this.url))this.url=this.url.replace(W,"$1_="+new Date().getTime());else{var V=/\?/;this.url+=(V.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}X.prototype.clone=function(){return new X(this,{body:this._bodyInit})};function ne(q){var se=new FormData;return q.trim().split("&").forEach(function(ae){if(ae){var W=ae.split("="),V=W.shift().replace(/\+/g," "),ee=W.join("=").replace(/\+/g," ");se.append(decodeURIComponent(V),decodeURIComponent(ee))}}),se}function J(q){var se=new v,ae=q.replace(/\r?\n[\t ]+/g," ");return ae.split("\r").map(function(W){return W.indexOf(`
`)===0?W.substr(1,W.length):W}).forEach(function(W){var V=W.split(":"),ee=V.shift().trim();if(ee){var oe=V.join(":").trim();se.append(ee,oe)}}),se}$.call(X.prototype);function K(q,se){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');se||(se={}),this.type="default",this.status=se.status===void 0?200:se.status,this.ok=this.status>=200&&this.status<300,this.statusText=se.statusText===void 0?"":""+se.statusText,this.headers=new v(se.headers),this.url=se.url||"",this._initBody(q)}$.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},K.error=function(){var q=new K(null,{status:0,statusText:""});return q.type="error",q};var te=[301,302,303,307,308];K.redirect=function(q,se){if(te.indexOf(se)===-1)throw new RangeError("Invalid status code");return new K(null,{status:se,headers:{location:q}})},o.DOMException=l.DOMException;try{new o.DOMException}catch{o.DOMException=function(se,ae){this.message=se,this.name=ae;var W=Error(se);this.stack=W.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function fe(q,se){return new Promise(function(ae,W){var V=new X(q,se);if(V.signal&&V.signal.aborted)return W(new o.DOMException("Aborted","AbortError"));var ee=new XMLHttpRequest;function oe(){ee.abort()}ee.onload=function(){var Ce={status:ee.status,statusText:ee.statusText,headers:J(ee.getAllResponseHeaders()||"")};Ce.url="responseURL"in ee?ee.responseURL:Ce.headers.get("X-Request-URL");var me="response"in ee?ee.response:ee.responseText;setTimeout(function(){ae(new K(me,Ce))},0)},ee.onerror=function(){setTimeout(function(){W(new TypeError("Network request failed"))},0)},ee.ontimeout=function(){setTimeout(function(){W(new TypeError("Network request failed"))},0)},ee.onabort=function(){setTimeout(function(){W(new o.DOMException("Aborted","AbortError"))},0)};function de(Ce){try{return Ce===""&&l.location.href?l.location.href:Ce}catch{return Ce}}ee.open(V.method,de(V.url),!0),V.credentials==="include"?ee.withCredentials=!0:V.credentials==="omit"&&(ee.withCredentials=!1),"responseType"in ee&&(c.blob?ee.responseType="blob":c.arrayBuffer&&V.headers.get("Content-Type")&&V.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ee.responseType="arraybuffer")),se&&typeof se.headers=="object"&&!(se.headers instanceof v)?Object.getOwnPropertyNames(se.headers).forEach(function(Ce){ee.setRequestHeader(Ce,g(se.headers[Ce]))}):V.headers.forEach(function(Ce,me){ee.setRequestHeader(me,Ce)}),V.signal&&(V.signal.addEventListener("abort",oe),ee.onreadystatechange=function(){ee.readyState===4&&V.signal.removeEventListener("abort",oe)}),ee.send(typeof V._bodyInit>"u"?null:V._bodyInit)})}return fe.polyfill=!0,l.fetch||(l.fetch=fe,l.Headers=v,l.Request=X,l.Response=K),o.Headers=v,o.Request=X,o.Response=K,o.fetch=fe,o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=n.fetch?n:r;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e}(QI,QI.exports)),QI.exports}var vEt=yEt();const wEt=Ii(vEt);var CEt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class cU extends RT{constructor(e,n){if(super(),!cU.validateClientUrl(e))throw new Ite(e);this.clientUrl=e,this.httpProviderOptions=n}static validateClientUrl(e){return typeof e=="string"?/^http(s)?:\/\//i.test(e):!1}getStatus(){throw new Yx}supportsSubscriptions(){return!1}request(e,n){var r;return CEt(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},(r=this.httpProviderOptions)===null||r===void 0?void 0:r.providerOptions),n),a=yield wEt(this.clientUrl,Object.assign(Object.assign({},s),{method:"POST",headers:Object.assign(Object.assign({},s.headers),{"Content-Type":"application/json"}),body:JSON.stringify(e)}));if(!a.ok)throw new I0(yield a.json(),void 0,void 0,a.status);return yield a.json()})}on(){throw new Yx}removeListener(){throw new Yx}once(){throw new Yx}removeAllListeners(){throw new Yx}connect(){throw new Yx}disconnect(){throw new Yx}reset(){throw new Yx}reconnect(){throw new Yx}}var WC=null;typeof WebSocket<"u"?WC=WebSocket:typeof MozWebSocket<"u"?WC=MozWebSocket:typeof global<"u"?WC=global.WebSocket||global.MozWebSocket:typeof window<"u"?WC=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(WC=self.WebSocket||self.MozWebSocket);const SEt=WC;class ZMe extends XMe{constructor(e,n,r){super(e,n,r)}_validateProviderPath(e){return typeof e=="string"?/^ws(s)?:\/\//i.test(e):!1}getStatus(){if(this._socketConnection&&!si(this._socketConnection))switch(this._socketConnection.readyState){case this._socketConnection.CONNECTING:return"connecting";case this._socketConnection.OPEN:return"connected";default:return"disconnected"}return"disconnected"}_openSocketConnection(){this._socketConnection=new SEt(this._socketPath,void 0,this._socketOptions&&Object.keys(this._socketOptions).length===0?void 0:this._socketOptions)}_closeSocketConnection(e,n){var r;(r=this._socketConnection)===null||r===void 0||r.close(e,n)}_sendToSocket(e){var n;if(this.getStatus()==="disconnected")throw new Tte;(n=this._socketConnection)===null||n===void 0||n.send(JSON.stringify(e))}_parseResponses(e){return this.chunkResponseParser.parseResponse(e.data)}_addSocketListeners(){var e,n,r,s;(e=this._socketConnection)===null||e===void 0||e.addEventListener("open",this._onOpenHandler),(n=this._socketConnection)===null||n===void 0||n.addEventListener("message",this._onMessageHandler),(r=this._socketConnection)===null||r===void 0||r.addEventListener("close",a=>this._onCloseHandler(a)),(s=this._socketConnection)===null||s===void 0||s.addEventListener("error",this._onErrorHandler)}_removeSocketListeners(){var e,n,r;(e=this._socketConnection)===null||e===void 0||e.removeEventListener("message",this._onMessageHandler),(n=this._socketConnection)===null||n===void 0||n.removeEventListener("open",this._onOpenHandler),(r=this._socketConnection)===null||r===void 0||r.removeEventListener("close",this._onCloseHandler)}_onCloseEvent(e){var n;if(this._reconnectOptions.autoReconnect&&(![1e3,1001].includes(e.code)||!e.wasClean)){this._reconnect();return}this._clearQueues(e),this._removeSocketListeners(),this._onDisconnect(e.code,e.reason),(n=this._socketConnection)===null||n===void 0||n.removeEventListener("error",this._onErrorHandler)}}const JMe=t=>RT.isWeb3Provider(t),eRe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="Function",tRe=t=>typeof t!="string"&&"request"in t&&t.request.constructor.name==="AsyncFunction",nRe=t=>typeof t!="string"&&"send"in t,rRe=t=>typeof t!="string"&&"sendAsync"in t,oL=t=>t&&(JMe(t)||tRe(t)||eRe(t)||rRe(t)||nRe(t)),NEt=t=>t&&"supportsSubscriptions"in t?t.supportsSubscriptions():!!(t&&typeof t!="string"&&"on"in t);var gW=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},TN;(function(t){t.PROVIDER_CHANGED="PROVIDER_CHANGED",t.BEFORE_PROVIDER_CHANGE="BEFORE_PROVIDER_CHANGE"})(TN||(TN={}));const q1e={HttpProvider:cU,WebsocketProvider:ZMe};class y3 extends lU{constructor(e,n,r){super(),si(e)||this.setProvider(e),this.useRpcCallSpecification=n,si(r)||(this.middleware=r)}static get providers(){return q1e}get provider(){return this._provider}get providers(){return q1e}setProvider(e){let n;if(e&&typeof e=="string"&&this.providers)if(/^http(s)?:\/\//i.test(e))n=new this.providers.HttpProvider(e);else if(/^ws(s)?:\/\//i.test(e))n=new this.providers.WebsocketProvider(e);else throw new rM(`Can't autodetect provider for "${e}"`);else si(e)?n=void 0:n=e;return this.emit(TN.BEFORE_PROVIDER_CHANGE,this._provider),this._provider=n,this.emit(TN.PROVIDER_CHANGED,this._provider),!0}setMiddleware(e){this.middleware=e}send(e){return gW(this,void 0,void 0,function*(){const n=Object.assign({},e);let r=yield this._sendRequest(n);if(si(this.middleware)||(r=yield this.middleware.processResponse(r)),$y(r))return r.result;throw new I0(r)})}sendBatch(e){return gW(this,void 0,void 0,function*(){return yield this._sendRequest(e)})}_sendRequest(e){return gW(this,void 0,void 0,function*(){const{provider:n}=this;if(si(n))throw new rM("Provider not available. Use `.setProvider` or `.provider=` to initialize the provider.");let r=h0(e)?Dle(e):s5(e);if(si(this.middleware)||(r=yield this.middleware.processRequest(r)),JMe(n)){let s;try{s=yield n.request(r)}catch(a){s=a}return this._processJsonRpcResponse(r,s,{legacy:!1,error:!1})}if(tRe(n))return n.request(r).then(s=>this._processJsonRpcResponse(r,s,{legacy:!0,error:!1})).catch(s=>this._processJsonRpcResponse(r,s,{legacy:!0,error:!0}));if(eRe(n))return new Promise((s,a)=>{const o=u=>{a(this._processJsonRpcResponse(r,u,{legacy:!0,error:!0}))},l=u=>s(this._processJsonRpcResponse(r,u,{legacy:!0,error:!1})),c=n.request(r,(u,d)=>u?o(u):l(d));HMe(c)&&c.then(l).catch(d=>{try{const f=this._processJsonRpcResponse(r,d,{legacy:!0,error:!0});a(f)}catch(f){a(f)}})});if(nRe(n))return new Promise((s,a)=>{n.send(r,(o,l)=>{if(o)return a(this._processJsonRpcResponse(r,o,{legacy:!0,error:!0}));if(si(l))throw new I0({},'Got a "nullish" response from provider.');return s(this._processJsonRpcResponse(r,l,{legacy:!0,error:!1}))})});if(rRe(n))return n.sendAsync(r).then(s=>this._processJsonRpcResponse(r,s,{legacy:!0,error:!1})).catch(s=>this._processJsonRpcResponse(r,s,{legacy:!0,error:!0}));throw new rM("Provider does not have a request or send method to use.")})}_processJsonRpcResponse(e,n,{legacy:r,error:s}){if(si(n))return this._buildResponse(e,null,s);if(Uy(n)){if(this.useRpcCallSpecification&&Rle(n)){const a=n;if(Sd.get(a.error.code)){const o=Sd.get(a.error.code).error;throw new o(a)}else throw new ch(a)}else if(!y3._isReverted(n))throw new X$(n,e)}if($y(n))return n;if(n instanceof Error)throw y3._isReverted(n),n;if(!r&&h0(e)&&C_(n)||r&&!s&&h0(e))return n;if(r&&s&&h0(e))throw n;if(r&&!Uy(n)&&!$y(n))return this._buildResponse(e,n,s);throw h0(e)&&!Array.isArray(n)?new I0(n,"Got normal response for a batch request."):!h0(e)&&Array.isArray(n)?new I0(n,"Got batch response for a normal request."):new I0(n,"Invalid response")}static _isReverted(e){let n;if(Uy(e)?n=e.error:e instanceof Error&&(n=e),n!=null&&n.message.includes("revert"))throw new g3(n);return!1}_buildResponse(e,n,r){const s={jsonrpc:"2.0",id:h0(e)?e[0].id:"id"in e?e.id:null};return r?Object.assign(Object.assign({},s),{error:n}):Object.assign(Object.assign({},s),{result:n})}}var n7=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class lL{constructor(e,n,r=!1){this.requestManager=e,this.registeredSubscriptions=n,this.tolerateUnlinkedSubscription=r,this._subscriptions=new Map,this.requestManager.on(TN.BEFORE_PROVIDER_CHANGE,()=>n7(this,void 0,void 0,function*(){yield this.unsubscribe()})),this.requestManager.on(TN.PROVIDER_CHANGED,()=>{this.clear(),this.listenToProviderEvents()}),this.listenToProviderEvents()}listenToProviderEvents(){const e=this.requestManager.provider;!this.requestManager.provider||typeof(e==null?void 0:e.supportsSubscriptions)=="function"&&!(e!=null&&e.supportsSubscriptions())||typeof this.requestManager.provider.on=="function"&&(typeof this.requestManager.provider.request=="function"?this.requestManager.provider.on("message",n=>this.messageListener(n)):e.on("data",n=>this.messageListener(n)))}messageListener(e){var n,r,s;if(!e)throw new gg("Should not call messageListener with no data. Type was");const a=((n=e.params)===null||n===void 0?void 0:n.subscription)||((r=e.data)===null||r===void 0?void 0:r.subscription)||((s=e.id)===null||s===void 0?void 0:s.toString(16));if(a){const o=this._subscriptions.get(a);o==null||o.processSubscriptionData(e)}}subscribe(e,n){return n7(this,arguments,void 0,function*(r,s,a=bd){const o=this.registeredSubscriptions[r];if(!o)throw new gg("Invalid subscription type");const l=new o(s??void 0,{subscriptionManager:this,returnFormat:a});return yield this.addSubscription(l),l})}get subscriptions(){return this._subscriptions}addSubscription(e){return n7(this,void 0,void 0,function*(){if(!this.requestManager.provider)throw new rM("Provider not available");if(!this.supportsSubscriptions())throw new gg("The current provider does not support subscriptions");if(e.id&&this._subscriptions.has(e.id))throw new gg(`Subscription with id "${e.id}" already exists`);if(yield e.sendSubscriptionRequest(),si(e.id))throw new gg("Subscription is not subscribed yet.");return this._subscriptions.set(e.id,e),e.id})}removeSubscription(e){return n7(this,void 0,void 0,function*(){const{id:n}=e;if(si(n))throw new gg("Subscription is not subscribed yet. Or, had already been unsubscribed but not through the Subscription Manager.");if(!this._subscriptions.has(n)&&!this.tolerateUnlinkedSubscription)throw new gg(`Subscription with id "${n.toString()}" does not exists`);return yield e.sendUnsubscribeRequest(),this._subscriptions.delete(n),n})}unsubscribe(e){return n7(this,void 0,void 0,function*(){const n=[];for(const[r,s]of this.subscriptions.entries())(!e||typeof e=="function"&&e({id:r,sub:s}))&&n.push(this.removeSubscription(s));return Promise.all(n)})}clear(){this._subscriptions.clear()}supportsSubscriptions(){return si(this.requestManager.provider)?!1:NEt(this.requestManager.provider)}}var r7=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class UT extends lU{constructor(e,n){var r;super(),this.args=e;const{requestManager:s}=n,{subscriptionManager:a}=n;s?this._subscriptionManager=new lL(s,{},!0):this._subscriptionManager=a,this._returnFormat=(r=n==null?void 0:n.returnFormat)!==null&&r!==void 0?r:bd}get id(){return this._id}get lastBlock(){return this._lastBlock}subscribe(){return r7(this,void 0,void 0,function*(){return this._subscriptionManager.addSubscription(this)})}processSubscriptionData(e){var n,r;e!=null&&e.data?this._processSubscriptionResult((r=(n=e==null?void 0:e.data)===null||n===void 0?void 0:n.result)!==null&&r!==void 0?r:e==null?void 0:e.data):e&&oU(e)&&this._processSubscriptionResult(e==null?void 0:e.params.result)}sendSubscriptionRequest(){return r7(this,void 0,void 0,function*(){return this._id=yield this._subscriptionManager.requestManager.send({method:"eth_subscribe",params:this._buildSubscriptionParams()}),this.emit("connected",this._id),this._id})}get returnFormat(){return this._returnFormat}get subscriptionManager(){return this._subscriptionManager}resubscribe(){return r7(this,void 0,void 0,function*(){yield this.unsubscribe(),yield this.subscribe()})}unsubscribe(){return r7(this,void 0,void 0,function*(){this.id&&(yield this._subscriptionManager.removeSubscription(this))})}sendUnsubscribeRequest(){return r7(this,void 0,void 0,function*(){yield this._subscriptionManager.requestManager.send({method:"eth_unsubscribe",params:[this.id]}),this._id=void 0})}formatSubscriptionResult(e){return e}_processSubscriptionResult(e){this.emit("data",this.formatSubscriptionResult(e))}_processSubscriptionError(e){this.emit("error",e)}_buildSubscriptionParams(){throw new Error("Implement in the child class")}}var cC=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class cL extends dAt{constructor(){super(...arguments),this._addressMap=new Map,this._defaultKeyName="web3js_wallet"}static getStorage(){let e;try{e=window.localStorage;const n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch(n){return n&&(n.code===22||n.code===1014||n.name==="QuotaExceededError"||n.name==="NS_ERROR_DOM_QUOTA_REACHED")&&!gr(e)&&e.length!==0?e:void 0}}create(e){for(let n=0;n<e;n+=1)this.add(this._accountProvider.create());return this}add(e){var n;if(typeof e=="string")return this.add(this._accountProvider.privateKeyToAccount(e));let r=this.length;return this.get(e.address)&&(console.warn(`Account ${e.address.toLowerCase()} already exists.`),r=(n=this._addressMap.get(e.address.toLowerCase()))!==null&&n!==void 0?n:r),this._addressMap.set(e.address.toLowerCase(),r),this[r]=e,this}get(e){if(typeof e=="string"){const n=this._addressMap.get(e.toLowerCase());return gr(n)?void 0:this[n]}return this[e]}remove(e){if(typeof e=="string"){const n=this._addressMap.get(e.toLowerCase());return gr(n)?!1:(this._addressMap.delete(e.toLowerCase()),this.splice(n,1),!0)}return this[e]?(this.splice(e,1),!0):!1}clear(){return this._addressMap.clear(),this.length=0,this}encrypt(e,n){return cC(this,void 0,void 0,function*(){return Promise.all(this.map(r=>cC(this,void 0,void 0,function*(){return r.encrypt(e,n)})))})}decrypt(e,n,r){return cC(this,void 0,void 0,function*(){const s=yield Promise.all(e.map(a=>cC(this,void 0,void 0,function*(){return this._accountProvider.decrypt(a,n,r)})));for(const a of s)this.add(a);return this})}save(e,n){return cC(this,void 0,void 0,function*(){const r=cL.getStorage();if(!r)throw new Error("Local storage not available.");return r.setItem(n??this._defaultKeyName,JSON.stringify(yield this.encrypt(e))),!0})}load(e,n){return cC(this,void 0,void 0,function*(){const r=cL.getStorage();if(!r)throw new Error("Local storage not available.");const s=r.getItem(n??this._defaultKeyName);return s&&(yield this.decrypt(JSON.parse(s)||[],e)),this})}}const D0={web:sM};function sRe(t,e,n){if(!n.startsWith("aes-"))throw new Error(`AES submodule doesn't support mode ${n}`);if(e.length!==16)throw new Error("AES: wrong IV length");if(n.startsWith("aes-128")&&t.length!==16||n.startsWith("aes-256")&&t.length!==32)throw new Error("AES: wrong key length")}async function iRe(t,e,n){if(!D0.web)throw new Error("Browser crypto not available.");let r;if(["aes-128-cbc","aes-256-cbc"].includes(t)&&(r="cbc"),["aes-128-ctr","aes-256-ctr"].includes(t)&&(r="ctr"),!r)throw new Error("AES: unsupported mode");return[await D0.web.subtle.importKey("raw",e,{name:`AES-${r.toUpperCase()}`,length:e.length*8},!0,["encrypt","decrypt"]),{name:`aes-${r}`,iv:n,counter:n,length:128}]}async function $le(t,e,n,r="aes-128-ctr",s=!0){if(sRe(e,n,r),D0.web){const[a,o]=await iRe(r,e,n),l=await D0.web.subtle.encrypt(o,a,t);let c=new Uint8Array(l);return!s&&o.name==="aes-cbc"&&!(t.length%16)&&(c=c.slice(0,-16)),c}else if(D0.node){const a=D0.node.createCipheriv(r,e,n);return a.setAutoPadding(s),GR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}async function AEt(t,e,n,r){const s=t.slice(-16);for(let o=0;o<16;o++)s[o]^=n[o]^16;return(await $le(s,e,n,r)).slice(0,16)}async function jEt(t,e,n,r="aes-128-ctr",s=!0){if(sRe(e,n,r),D0.web){const[a,o]=await iRe(r,e,n);if(!s&&o.name==="aes-cbc"){const u=await AEt(t,e,n,r);t=GR(t,u)}const l=await D0.web.subtle.decrypt(o,a,t),c=new Uint8Array(l);if(o.name==="aes-cbc"){const u=await $le(c,e,n,r);if(!C7t(u,t))throw new Error("AES: wrong padding")}return c}else if(D0.node){const a=D0.node.createDecipheriv(r,e,n);return a.setAutoPadding(s),GR(a.update(t),a.final())}else throw new Error("The environment doesn't have AES module")}class aRe extends Cle{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,vle(e);const r=CN(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<a.length;o++)a[o]^=54;this.iHash.update(a),this.oHash=e.create();for(let o=0;o<a.length;o++)a[o]^=106;this.oHash.update(a),a.fill(0)}update(e){return Z3(this),this.iHash.update(e),this}digestInto(e){Z3(this),uj(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:a,blockLen:o,outputLen:l}=this;return e=e,e.finished=s,e.destroyed=a,e.blockLen=o,e.outputLen=l,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ule=(t,e,n)=>new aRe(t,e).update(n).digest();Ule.create=(t,e)=>new aRe(t,e);function EEt(t,e,n,r){vle(t);const s=lMe({dkLen:32,asyncTick:10},r),{c:a,dkLen:o,asyncTick:l}=s;if(ef(a),ef(o),ef(l),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=CN(e),u=CN(n),d=new Uint8Array(o),f=Ule.create(t,c),x=f._cloneInto().update(u);return{c:a,dkLen:o,asyncTick:l,DK:d,PRF:f,PRFSalt:x}}function _Et(t,e,n,r,s){return t.destroy(),e.destroy(),r&&r.destroy(),s.fill(0),n}function zle(t,e,n,r){const{c:s,dkLen:a,DK:o,PRF:l,PRFSalt:c}=EEt(t,e,n,r);let u;const d=new Uint8Array(4),f=aM(d),x=new Uint8Array(l.outputLen);for(let g=1,y=0;y<a;g++,y+=l.outputLen){const v=o.subarray(y,y+l.outputLen);f.setInt32(0,g,!1),(u=c._cloneInto(u)).update(d).digestInto(x),v.set(x.subarray(0,v.length));for(let C=1;C<s;C++){l._cloneInto(u).update(x).digestInto(x);for(let N=0;N<v.length;N++)v[N]^=x[N]}}return _Et(l,c,o,u,x)}function kEt(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),a=BigInt(4294967295),o=Number(n>>s&a),l=Number(n&a),c=r?4:0,u=r?0:4;t.setUint32(e+c,o,r),t.setUint32(e+u,l,r)}const TEt=(t,e,n)=>t&e^~t&n,PEt=(t,e,n)=>t&e^t&n^e&n;class IEt extends Cle{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=aM(this.buffer)}update(e){Z3(this);const{view:n,buffer:r,blockLen:s}=this;e=CN(e);const a=e.length;for(let o=0;o<a;){const l=Math.min(s-this.pos,a-o);if(l===s){const c=aM(e);for(;s<=a-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+l),this.pos),this.pos+=l,o+=l,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Z3(this),wle(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:a}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;kEt(r,s-8,BigInt(this.length*8),a),this.process(r,0);const l=aM(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)l.setUint32(4*f,d[f],a)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:a,destroyed:o,pos:l}=this;return e.length=s,e.pos=l,e.finished=a,e.destroyed=o,s%n&&e.buffer.set(r),e}}const FEt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nb=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ab=new Uint32Array(64);class OEt extends IEt{constructor(){super(64,32,8,!1),this.A=Nb[0]|0,this.B=Nb[1]|0,this.C=Nb[2]|0,this.D=Nb[3]|0,this.E=Nb[4]|0,this.F=Nb[5]|0,this.G=Nb[6]|0,this.H=Nb[7]|0}get(){const{A:e,B:n,C:r,D:s,E:a,F:o,G:l,H:c}=this;return[e,n,r,s,a,o,l,c]}set(e,n,r,s,a,o,l,c){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=l|0,this.H=c|0}process(e,n){for(let f=0;f<16;f++,n+=4)Ab[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const x=Ab[f-15],g=Ab[f-2],y=a0(x,7)^a0(x,18)^x>>>3,v=a0(g,17)^a0(g,19)^g>>>10;Ab[f]=v+Ab[f-7]+y+Ab[f-16]|0}let{A:r,B:s,C:a,D:o,E:l,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const x=a0(l,6)^a0(l,11)^a0(l,25),g=d+x+TEt(l,c,u)+FEt[f]+Ab[f]|0,v=(a0(r,2)^a0(r,13)^a0(r,22))+PEt(r,s,a)|0;d=u,u=c,c=l,l=o+g|0,o=a,a=s,s=r,r=g+v|0}r=r+this.A|0,s=s+this.B|0,a=a+this.C|0,o=o+this.D|0,l=l+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,s,a,o,l,c,u,d)}roundClean(){Ab.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const uU=cMe(()=>new OEt);function oRe(t,e,n,r,s){if(!["sha256","sha512"].includes(s))throw new Error("Only sha256 and sha512 are supported");return KR(t),KR(e),zle(uU,t,e,{c:n,dkLen:r})}function G1e(t,e,n,r,s,a){let o=t[e++]^n[r++],l=t[e++]^n[r++],c=t[e++]^n[r++],u=t[e++]^n[r++],d=t[e++]^n[r++],f=t[e++]^n[r++],x=t[e++]^n[r++],g=t[e++]^n[r++],y=t[e++]^n[r++],v=t[e++]^n[r++],C=t[e++]^n[r++],N=t[e++]^n[r++],P=t[e++]^n[r++],T=t[e++]^n[r++],M=t[e++]^n[r++],F=t[e++]^n[r++],$=o,L=l,z=c,X=u,ne=d,J=f,K=x,te=g,fe=y,q=v,se=C,ae=N,W=P,V=T,ee=M,oe=F;for(let de=0;de<8;de+=2)ne^=ga($+W|0,7),fe^=ga(ne+$|0,9),W^=ga(fe+ne|0,13),$^=ga(W+fe|0,18),q^=ga(J+L|0,7),V^=ga(q+J|0,9),L^=ga(V+q|0,13),J^=ga(L+V|0,18),ee^=ga(se+K|0,7),z^=ga(ee+se|0,9),K^=ga(z+ee|0,13),se^=ga(K+z|0,18),X^=ga(oe+ae|0,7),te^=ga(X+oe|0,9),ae^=ga(te+X|0,13),oe^=ga(ae+te|0,18),L^=ga($+X|0,7),z^=ga(L+$|0,9),X^=ga(z+L|0,13),$^=ga(X+z|0,18),K^=ga(J+ne|0,7),te^=ga(K+J|0,9),ne^=ga(te+K|0,13),J^=ga(ne+te|0,18),ae^=ga(se+q|0,7),fe^=ga(ae+se|0,9),q^=ga(fe+ae|0,13),se^=ga(q+fe|0,18),W^=ga(oe+ee|0,7),V^=ga(W+oe|0,9),ee^=ga(V+W|0,13),oe^=ga(ee+V|0,18);s[a++]=o+$|0,s[a++]=l+L|0,s[a++]=c+z|0,s[a++]=u+X|0,s[a++]=d+ne|0,s[a++]=f+J|0,s[a++]=x+K|0,s[a++]=g+te|0,s[a++]=y+fe|0,s[a++]=v+q|0,s[a++]=C+se|0,s[a++]=N+ae|0,s[a++]=P+W|0,s[a++]=T+V|0,s[a++]=M+ee|0,s[a++]=F+oe|0}function bW(t,e,n,r,s){let a=r+0,o=r+16*s;for(let l=0;l<16;l++)n[o+l]=t[e+(2*s-1)*16+l];for(let l=0;l<s;l++,a+=16,e+=16)G1e(n,o,t,e,n,a),l>0&&(o+=16),G1e(n,a,t,e+=16,n,o)}function MEt(t,e,n){const r=lMe({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:s,r:a,p:o,dkLen:l,asyncTick:c,maxmem:u,onProgress:d}=r;if(ef(s),ef(a),ef(o),ef(l),ef(c),ef(u),d!==void 0&&typeof d!="function")throw new Error("progressCb should be function");const f=128*a,x=f/4;if(s<=1||s&s-1||s>=2**(f/8)||s>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(o<0||o>(2**32-1)*32/f)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(l<0||l>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const g=f*(s+o);if(g>u)throw new Error(`Scrypt: parameters too large, ${g} (128 * r * (N + p)) > ${u} (maxmem)`);const y=zle(uU,t,e,{c:1,dkLen:f*o}),v=iM(y),C=iM(new Uint8Array(f*s)),N=iM(new Uint8Array(f));let P=()=>{};if(d){const T=2*s*o,M=Math.max(Math.floor(T/1e4),1);let F=0;P=()=>{F++,d&&(!(F%M)||F===T)&&d(F/T)}}return{N:s,r:a,p:o,dkLen:l,blockSize32:x,V:C,B32:v,B:y,tmp:N,blockMixCb:P,asyncTick:c}}function REt(t,e,n,r,s){const a=zle(uU,t,n,{c:1,dkLen:e});return n.fill(0),r.fill(0),s.fill(0),a}function LEt(t,e,n){const{N:r,r:s,p:a,dkLen:o,blockSize32:l,V:c,B32:u,B:d,tmp:f,blockMixCb:x}=MEt(t,e,n);WR||qR(u);for(let g=0;g<a;g++){const y=l*g;for(let v=0;v<l;v++)c[v]=u[y+v];for(let v=0,C=0;v<r-1;v++)bW(c,C,c,C+=l,s),x();bW(c,(r-1)*l,u,y,s),x();for(let v=0;v<r;v++){const C=u[y+l-16]%r;for(let N=0;N<l;N++)f[N]=u[y+N]^c[C*l+N];bW(f,0,u,y,s),x()}}return WR||qR(u),REt(t,o,d,c,f)}function lRe(t,e,n,r,s,a,o){return KR(t),KR(e),LEt(t,e,{N:n,r:s,p:r,dkLen:a,onProgress:o})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const cRe=BigInt(0),dU=BigInt(1),DEt=BigInt(2);function a5(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function zT(t){if(!a5(t))throw new Error("Uint8Array expected")}const BEt=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function PN(t){zT(t);let e="";for(let n=0;n<t.length;n++)e+=BEt[t[n]];return e}function uRe(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function Hle(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Qx={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function K1e(t){if(t>=Qx._0&&t<=Qx._9)return t-Qx._0;if(t>=Qx._A&&t<=Qx._F)return t-(Qx._A-10);if(t>=Qx._a&&t<=Qx._f)return t-(Qx._a-10)}function IN(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let s=0,a=0;s<n;s++,a+=2){const o=K1e(t.charCodeAt(a)),l=K1e(t.charCodeAt(a+1));if(o===void 0||l===void 0){const c=t[a]+t[a+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+a)}r[s]=o*16+l}return r}function v3(t){return Hle(PN(t))}function Vle(t){return zT(t),Hle(PN(Uint8Array.from(t).reverse()))}function FN(t,e){return IN(t.toString(16).padStart(e*2,"0"))}function Wle(t,e){return FN(t,e).reverse()}function $Et(t){return IN(uRe(t))}function Yp(t,e,n){let r;if(typeof e=="string")try{r=IN(e)}catch(a){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${a}`)}else if(a5(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function S_(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];zT(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const a=t[r];n.set(a,s),s+=a.length}return n}function UEt(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return n===0}function zEt(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function HEt(t){let e;for(e=0;t>cRe;t>>=dU,e+=1);return e}function VEt(t,e){return t>>BigInt(e)&dU}function WEt(t,e,n){return t|(n?dU:cRe)<<BigInt(e)}const qle=t=>(DEt<<BigInt(t-1))-dU,yW=t=>new Uint8Array(t),Y1e=t=>Uint8Array.from(t);function dRe(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=yW(t),s=yW(t),a=0;const o=()=>{r.fill(1),s.fill(0),a=0},l=(...f)=>n(s,r,...f),c=(f=yW())=>{s=l(Y1e([0]),f),r=l(),f.length!==0&&(s=l(Y1e([1]),f),r=l())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const x=[];for(;f<e;){r=l();const g=r.slice();x.push(g),f+=r.length}return S_(...x)};return(f,x)=>{o(),c(f);let g;for(;!(g=x(u()));)c();return o(),g}}const qEt={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||a5(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function HT(t,e,n={}){const r=(s,a,o)=>{const l=qEt[a];if(typeof l!="function")throw new Error(`Invalid validator "${a}", expected function`);const c=t[s];if(!(o&&c===void 0)&&!l(c,t))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${a}`)};for(const[s,a]of Object.entries(e))r(s,a,!1);for(const[s,a]of Object.entries(n))r(s,a,!0);return t}const GEt=Object.freeze(Object.defineProperty({__proto__:null,abytes:zT,bitGet:VEt,bitLen:HEt,bitMask:qle,bitSet:WEt,bytesToHex:PN,bytesToNumberBE:v3,bytesToNumberLE:Vle,concatBytes:S_,createHmacDrbg:dRe,ensureBytes:Yp,equalBytes:UEt,hexToBytes:IN,hexToNumber:Hle,isBytes:a5,numberToBytesBE:FN,numberToBytesLE:Wle,numberToHexUnpadded:uRe,numberToVarBytesBE:$Et,utf8ToBytes:zEt,validateObject:HT},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Oc=BigInt(0),Nl=BigInt(1),nw=BigInt(2),KEt=BigInt(3),zte=BigInt(4),X1e=BigInt(5),Q1e=BigInt(8);BigInt(9);BigInt(16);function Qd(t,e){const n=t%e;return n>=Oc?n:e+n}function YEt(t,e,n){if(n<=Oc||e<Oc)throw new Error("Expected power/modulo > 0");if(n===Nl)return Oc;let r=Nl;for(;e>Oc;)e&Nl&&(r=r*t%n),t=t*t%n,e>>=Nl;return r}function kh(t,e,n){let r=t;for(;e-- >Oc;)r*=r,r%=n;return r}function Hte(t,e){if(t===Oc||e<=Oc)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=Qd(t,e),r=e,s=Oc,a=Nl;for(;n!==Oc;){const l=r/n,c=r%n,u=s-a*l;r=n,n=c,s=a,a=u}if(r!==Nl)throw new Error("invert: does not exist");return Qd(s,e)}function XEt(t){const e=(t-Nl)/nw;let n,r,s;for(n=t-Nl,r=0;n%nw===Oc;n/=nw,r++);for(s=nw;s<t&&YEt(s,e,t)!==t-Nl;s++);if(r===1){const o=(t+Nl)/zte;return function(c,u){const d=c.pow(u,o);if(!c.eql(c.sqr(d),u))throw new Error("Cannot find square root");return d}}const a=(n+Nl)/nw;return function(l,c){if(l.pow(c,e)===l.neg(l.ONE))throw new Error("Cannot find square root");let u=r,d=l.pow(l.mul(l.ONE,s),n),f=l.pow(c,a),x=l.pow(c,n);for(;!l.eql(x,l.ONE);){if(l.eql(x,l.ZERO))return l.ZERO;let g=1;for(let v=l.sqr(x);g<u&&!l.eql(v,l.ONE);g++)v=l.sqr(v);const y=l.pow(d,Nl<<BigInt(u-g-1));d=l.sqr(y),f=l.mul(f,y),x=l.mul(x,d),u=g}return f}}function QEt(t){if(t%zte===KEt){const e=(t+Nl)/zte;return function(r,s){const a=r.pow(s,e);if(!r.eql(r.sqr(a),s))throw new Error("Cannot find square root");return a}}if(t%Q1e===X1e){const e=(t-X1e)/Q1e;return function(r,s){const a=r.mul(s,nw),o=r.pow(a,e),l=r.mul(s,o),c=r.mul(r.mul(l,nw),o),u=r.mul(l,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return XEt(t)}const ZEt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function JEt(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=ZEt.reduce((r,s)=>(r[s]="function",r),e);return HT(t,n)}function e_t(t,e,n){if(n<Oc)throw new Error("Expected power > 0");if(n===Oc)return t.ONE;if(n===Nl)return e;let r=t.ONE,s=e;for(;n>Oc;)n&Nl&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Nl;return r}function t_t(t,e){const n=new Array(e.length),r=e.reduce((a,o,l)=>t.is0(o)?a:(n[l]=a,t.mul(a,o)),t.ONE),s=t.inv(r);return e.reduceRight((a,o,l)=>t.is0(o)?a:(n[l]=t.mul(a,n[l]),t.mul(a,o)),s),n}function fRe(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function n_t(t,e,n=!1,r={}){if(t<=Oc)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:a}=fRe(t,e);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=QEt(t),l=Object.freeze({ORDER:t,BITS:s,BYTES:a,MASK:qle(s),ZERO:Oc,ONE:Nl,create:c=>Qd(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Oc<=c&&c<t},is0:c=>c===Oc,isOdd:c=>(c&Nl)===Nl,neg:c=>Qd(-c,t),eql:(c,u)=>c===u,sqr:c=>Qd(c*c,t),add:(c,u)=>Qd(c+u,t),sub:(c,u)=>Qd(c-u,t),mul:(c,u)=>Qd(c*u,t),pow:(c,u)=>e_t(l,c,u),div:(c,u)=>Qd(c*Hte(u,t),t),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Hte(c,t),sqrt:r.sqrt||(c=>o(l,c)),invertBatch:c=>t_t(l,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?Wle(c,a):FN(c,a),fromBytes:c=>{if(c.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${c.length}`);return n?Vle(c):v3(c)}});return Object.freeze(l)}function hRe(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function pRe(t){const e=hRe(t);return e+Math.ceil(e/2)}function r_t(t,e,n=!1){const r=t.length,s=hRe(e),a=pRe(e);if(r<16||r<a||r>1024)throw new Error(`expected ${a}-1024 bytes of input, got ${r}`);const o=n?v3(t):Vle(t),l=Qd(o,e-Nl)+Nl;return n?Wle(l,s):FN(l,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s_t=BigInt(0),vW=BigInt(1);function i_t(t,e){const n=(s,a)=>{const o=a.negate();return s?o:a},r=s=>{const a=Math.ceil(e/s)+1,o=2**(s-1);return{windows:a,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,a){let o=t.ZERO,l=s;for(;a>s_t;)a&vW&&(o=o.add(l)),l=l.double(),a>>=vW;return o},precomputeWindow(s,a){const{windows:o,windowSize:l}=r(a),c=[];let u=s,d=u;for(let f=0;f<o;f++){d=u,c.push(d);for(let x=1;x<l;x++)d=d.add(u),c.push(d);u=d.double()}return c},wNAF(s,a,o){const{windows:l,windowSize:c}=r(s);let u=t.ZERO,d=t.BASE;const f=BigInt(2**s-1),x=2**s,g=BigInt(s);for(let y=0;y<l;y++){const v=y*c;let C=Number(o&f);o>>=g,C>c&&(C-=x,o+=vW);const N=v,P=v+Math.abs(C)-1,T=y%2!==0,M=C<0;C===0?d=d.add(n(T,a[N])):u=u.add(n(M,a[P]))}return{p:u,f:d}},wNAFCached(s,a,o,l){const c=s._WINDOW_SIZE||1;let u=a.get(s);return u||(u=this.precomputeWindow(s,c),c!==1&&a.set(s,l(u))),this.wNAF(c,u,o)}}}function mRe(t){return JEt(t.Fp),HT(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...fRe(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function a_t(t){const e=mRe(t);HT(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:o_t,hexToBytes:l_t}=GEt,xw={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=xw;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:o_t(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=xw,n=typeof t=="string"?l_t(t):t;zT(n);let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:a}=xw._parseInt(n.subarray(2)),{d:o,l}=xw._parseInt(a);if(l.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const d=u.toString(16);return d.length&1?`0${d}`:d},r=e(n(t.s)),s=e(n(t.r)),a=r.length/2,o=s.length/2,l=n(a),c=n(o);return`30${n(o+a+4)}02${c}${s}02${l}${r}`}},Ug=BigInt(0),Jh=BigInt(1);BigInt(2);const Z1e=BigInt(3);BigInt(4);function c_t(t){const e=a_t(t),{Fp:n}=e,r=e.toBytes||((y,v,C)=>{const N=v.toAffine();return S_(Uint8Array.from([4]),n.toBytes(N.x),n.toBytes(N.y))}),s=e.fromBytes||(y=>{const v=y.subarray(1),C=n.fromBytes(v.subarray(0,n.BYTES)),N=n.fromBytes(v.subarray(n.BYTES,2*n.BYTES));return{x:C,y:N}});function a(y){const{a:v,b:C}=e,N=n.sqr(y),P=n.mul(N,y);return n.add(n.add(P,n.mul(y,v)),C)}if(!n.eql(n.sqr(e.Gy),a(e.Gx)))throw new Error("bad generator point: equation left != right");function o(y){return typeof y=="bigint"&&Ug<y&&y<e.n}function l(y){if(!o(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(y){const{allowedPrivateKeyLengths:v,nByteLength:C,wrapPrivateKey:N,n:P}=e;if(v&&typeof y!="bigint"){if(a5(y)&&(y=PN(y)),typeof y!="string"||!v.includes(y.length))throw new Error("Invalid key");y=y.padStart(C*2,"0")}let T;try{T=typeof y=="bigint"?y:v3(Yp("private key",y,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof y}`)}return N&&(T=Qd(T,P)),l(T),T}const u=new Map;function d(y){if(!(y instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(v,C,N){if(this.px=v,this.py=C,this.pz=N,v==null||!n.isValid(v))throw new Error("x required");if(C==null||!n.isValid(C))throw new Error("y required");if(N==null||!n.isValid(N))throw new Error("z required")}static fromAffine(v){const{x:C,y:N}=v||{};if(!v||!n.isValid(C)||!n.isValid(N))throw new Error("invalid affine point");if(v instanceof f)throw new Error("projective point not allowed");const P=T=>n.eql(T,n.ZERO);return P(C)&&P(N)?f.ZERO:new f(C,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const C=n.invertBatch(v.map(N=>N.pz));return v.map((N,P)=>N.toAffine(C[P])).map(f.fromAffine)}static fromHex(v){const C=f.fromAffine(s(Yp("pointHex",v)));return C.assertValidity(),C}static fromPrivateKey(v){return f.BASE.multiply(c(v))}_setWindowSize(v){this._WINDOW_SIZE=v,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:C}=this.toAffine();if(!n.isValid(v)||!n.isValid(C))throw new Error("bad point: x or y not FE");const N=n.sqr(C),P=a(v);if(!n.eql(N,P))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(n.isOdd)return!n.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){d(v);const{px:C,py:N,pz:P}=this,{px:T,py:M,pz:F}=v,$=n.eql(n.mul(C,F),n.mul(T,P)),L=n.eql(n.mul(N,F),n.mul(M,P));return $&&L}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:v,b:C}=e,N=n.mul(C,Z1e),{px:P,py:T,pz:M}=this;let F=n.ZERO,$=n.ZERO,L=n.ZERO,z=n.mul(P,P),X=n.mul(T,T),ne=n.mul(M,M),J=n.mul(P,T);return J=n.add(J,J),L=n.mul(P,M),L=n.add(L,L),F=n.mul(v,L),$=n.mul(N,ne),$=n.add(F,$),F=n.sub(X,$),$=n.add(X,$),$=n.mul(F,$),F=n.mul(J,F),L=n.mul(N,L),ne=n.mul(v,ne),J=n.sub(z,ne),J=n.mul(v,J),J=n.add(J,L),L=n.add(z,z),z=n.add(L,z),z=n.add(z,ne),z=n.mul(z,J),$=n.add($,z),ne=n.mul(T,M),ne=n.add(ne,ne),z=n.mul(ne,J),F=n.sub(F,z),L=n.mul(ne,X),L=n.add(L,L),L=n.add(L,L),new f(F,$,L)}add(v){d(v);const{px:C,py:N,pz:P}=this,{px:T,py:M,pz:F}=v;let $=n.ZERO,L=n.ZERO,z=n.ZERO;const X=e.a,ne=n.mul(e.b,Z1e);let J=n.mul(C,T),K=n.mul(N,M),te=n.mul(P,F),fe=n.add(C,N),q=n.add(T,M);fe=n.mul(fe,q),q=n.add(J,K),fe=n.sub(fe,q),q=n.add(C,P);let se=n.add(T,F);return q=n.mul(q,se),se=n.add(J,te),q=n.sub(q,se),se=n.add(N,P),$=n.add(M,F),se=n.mul(se,$),$=n.add(K,te),se=n.sub(se,$),z=n.mul(X,q),$=n.mul(ne,te),z=n.add($,z),$=n.sub(K,z),z=n.add(K,z),L=n.mul($,z),K=n.add(J,J),K=n.add(K,J),te=n.mul(X,te),q=n.mul(ne,q),K=n.add(K,te),te=n.sub(J,te),te=n.mul(X,te),q=n.add(q,te),J=n.mul(K,q),L=n.add(L,J),J=n.mul(se,q),$=n.mul(fe,$),$=n.sub($,J),J=n.mul(fe,K),z=n.mul(se,z),z=n.add(z,J),new f($,L,z)}subtract(v){return this.add(v.negate())}is0(){return this.equals(f.ZERO)}wNAF(v){return g.wNAFCached(this,u,v,C=>{const N=n.invertBatch(C.map(P=>P.pz));return C.map((P,T)=>P.toAffine(N[T])).map(f.fromAffine)})}multiplyUnsafe(v){const C=f.ZERO;if(v===Ug)return C;if(l(v),v===Jh)return this;const{endo:N}=e;if(!N)return g.unsafeLadder(this,v);let{k1neg:P,k1:T,k2neg:M,k2:F}=N.splitScalar(v),$=C,L=C,z=this;for(;T>Ug||F>Ug;)T&Jh&&($=$.add(z)),F&Jh&&(L=L.add(z)),z=z.double(),T>>=Jh,F>>=Jh;return P&&($=$.negate()),M&&(L=L.negate()),L=new f(n.mul(L.px,N.beta),L.py,L.pz),$.add(L)}multiply(v){l(v);let C=v,N,P;const{endo:T}=e;if(T){const{k1neg:M,k1:F,k2neg:$,k2:L}=T.splitScalar(C);let{p:z,f:X}=this.wNAF(F),{p:ne,f:J}=this.wNAF(L);z=g.constTimeNegate(M,z),ne=g.constTimeNegate($,ne),ne=new f(n.mul(ne.px,T.beta),ne.py,ne.pz),N=z.add(ne),P=X.add(J)}else{const{p:M,f:F}=this.wNAF(C);N=M,P=F}return f.normalizeZ([N,P])[0]}multiplyAndAddUnsafe(v,C,N){const P=f.BASE,T=(F,$)=>$===Ug||$===Jh||!F.equals(P)?F.multiplyUnsafe($):F.multiply($),M=T(this,C).add(T(v,N));return M.is0()?void 0:M}toAffine(v){const{px:C,py:N,pz:P}=this,T=this.is0();v==null&&(v=T?n.ONE:n.inv(P));const M=n.mul(C,v),F=n.mul(N,v),$=n.mul(P,v);if(T)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:M,y:F}}isTorsionFree(){const{h:v,isTorsionFree:C}=e;if(v===Jh)return!0;if(C)return C(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:C}=e;return v===Jh?this:C?C(f,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),r(f,this,v)}toHex(v=!0){return PN(this.toRawBytes(v))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const x=e.nBitLength,g=i_t(f,e.endo?Math.ceil(x/2):x);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function u_t(t){const e=mRe(t);return HT(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function d_t(t){const e=u_t(t),{Fp:n,n:r}=e,s=n.BYTES+1,a=2*n.BYTES+1;function o(q){return Ug<q&&q<n.ORDER}function l(q){return Qd(q,r)}function c(q){return Hte(q,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:x}=c_t({...e,toBytes(q,se,ae){const W=se.toAffine(),V=n.toBytes(W.x),ee=S_;return ae?ee(Uint8Array.from([se.hasEvenY()?2:3]),V):ee(Uint8Array.from([4]),V,n.toBytes(W.y))},fromBytes(q){const se=q.length,ae=q[0],W=q.subarray(1);if(se===s&&(ae===2||ae===3)){const V=v3(W);if(!o(V))throw new Error("Point is not on curve");const ee=f(V);let oe;try{oe=n.sqrt(ee)}catch(me){const we=me instanceof Error?": "+me.message:"";throw new Error("Point is not on curve"+we)}const de=(oe&Jh)===Jh;return(ae&1)===1!==de&&(oe=n.neg(oe)),{x:V,y:oe}}else if(se===a&&ae===4){const V=n.fromBytes(W.subarray(0,n.BYTES)),ee=n.fromBytes(W.subarray(n.BYTES,2*n.BYTES));return{x:V,y:ee}}else throw new Error(`Point of length ${se} was invalid. Expected ${s} compressed bytes or ${a} uncompressed bytes`)}}),g=q=>PN(FN(q,e.nByteLength));function y(q){const se=r>>Jh;return q>se}function v(q){return y(q)?l(-q):q}const C=(q,se,ae)=>v3(q.slice(se,ae));class N{constructor(se,ae,W){this.r=se,this.s=ae,this.recovery=W,this.assertValidity()}static fromCompact(se){const ae=e.nByteLength;return se=Yp("compactSignature",se,ae*2),new N(C(se,0,ae),C(se,ae,2*ae))}static fromDER(se){const{r:ae,s:W}=xw.toSig(Yp("DER",se));return new N(ae,W)}assertValidity(){if(!x(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!x(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(se){return new N(this.r,this.s,se)}recoverPublicKey(se){const{r:ae,s:W,recovery:V}=this,ee=L(Yp("msgHash",se));if(V==null||![0,1,2,3].includes(V))throw new Error("recovery id invalid");const oe=V===2||V===3?ae+e.n:ae;if(oe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const de=V&1?"03":"02",Ce=u.fromHex(de+g(oe)),me=c(oe),we=l(-ee*me),xe=l(W*me),be=u.BASE.multiplyAndAddUnsafe(Ce,we,xe);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new N(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return IN(this.toDERHex())}toDERHex(){return xw.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return IN(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const P={isValidPrivateKey(q){try{return d(q),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const q=pRe(e.n);return r_t(e.randomBytes(q),e.n)},precompute(q=8,se=u.BASE){return se._setWindowSize(q),se.multiply(BigInt(3)),se}};function T(q,se=!0){return u.fromPrivateKey(q).toRawBytes(se)}function M(q){const se=a5(q),ae=typeof q=="string",W=(se||ae)&&q.length;return se?W===s||W===a:ae?W===2*s||W===2*a:q instanceof u}function F(q,se,ae=!0){if(M(q))throw new Error("first arg must be private key");if(!M(se))throw new Error("second arg must be public key");return u.fromHex(se).multiply(d(q)).toRawBytes(ae)}const $=e.bits2int||function(q){const se=v3(q),ae=q.length*8-e.nBitLength;return ae>0?se>>BigInt(ae):se},L=e.bits2int_modN||function(q){return l($(q))},z=qle(e.nBitLength);function X(q){if(typeof q!="bigint")throw new Error("bigint expected");if(!(Ug<=q&&q<z))throw new Error(`bigint expected < 2^${e.nBitLength}`);return FN(q,e.nByteLength)}function ne(q,se,ae=J){if(["recovered","canonical"].some(Ie=>Ie in ae))throw new Error("sign() legacy options not supported");const{hash:W,randomBytes:V}=e;let{lowS:ee,prehash:oe,extraEntropy:de}=ae;ee==null&&(ee=!0),q=Yp("msgHash",q),oe&&(q=Yp("prehashed msgHash",W(q)));const Ce=L(q),me=d(se),we=[X(me),X(Ce)];if(de!=null&&de!==!1){const Ie=de===!0?V(n.BYTES):de;we.push(Yp("extraEntropy",Ie))}const xe=S_(...we),be=Ce;function je(Ie){const Re=$(Ie);if(!x(Re))return;const Qe=c(Re),Ke=u.BASE.multiply(Re).toAffine(),dt=l(Ke.x);if(dt===Ug)return;const tt=l(Qe*l(be+dt*me));if(tt===Ug)return;let nt=(Ke.x===dt?0:2)|Number(Ke.y&Jh),Le=tt;return ee&&y(tt)&&(Le=v(tt),nt^=1),new N(dt,Le,nt)}return{seed:xe,k2sig:je}}const J={lowS:e.lowS,prehash:!1},K={lowS:e.lowS,prehash:!1};function te(q,se,ae=J){const{seed:W,k2sig:V}=ne(q,se,ae),ee=e;return dRe(ee.hash.outputLen,ee.nByteLength,ee.hmac)(W,V)}u.BASE._setWindowSize(8);function fe(q,se,ae,W=K){var Ke;const V=q;if(se=Yp("msgHash",se),ae=Yp("publicKey",ae),"strict"in W)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:oe}=W;let de,Ce;try{if(typeof V=="string"||a5(V))try{de=N.fromDER(V)}catch(dt){if(!(dt instanceof xw.Err))throw dt;de=N.fromCompact(V)}else if(typeof V=="object"&&typeof V.r=="bigint"&&typeof V.s=="bigint"){const{r:dt,s:tt}=V;de=new N(dt,tt)}else throw new Error("PARSE");Ce=u.fromHex(ae)}catch(dt){if(dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&de.hasHighS())return!1;oe&&(se=e.hash(se));const{r:me,s:we}=de,xe=L(se),be=c(we),je=l(xe*be),Ie=l(me*be),Re=(Ke=u.BASE.multiplyAndAddUnsafe(Ce,je,Ie))==null?void 0:Ke.toAffine();return Re?l(Re.x)===me:!1}return{CURVE:e,getPublicKey:T,getSharedSecret:F,sign:te,verify:fe,ProjectivePoint:u,Signature:N,utils:P}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function f_t(t){return{hash:t,hmac:(e,...n)=>Ule(t,e,GR(...n)),randomBytes:uMe}}function h_t(t,e){const n=r=>d_t({...t,...f_t(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xRe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),J1e=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),p_t=BigInt(1),Vte=BigInt(2),ebe=(t,e)=>(t+e/Vte)/e;function m_t(t){const e=xRe,n=BigInt(3),r=BigInt(6),s=BigInt(11),a=BigInt(22),o=BigInt(23),l=BigInt(44),c=BigInt(88),u=t*t*t%e,d=u*u*t%e,f=kh(d,n,e)*d%e,x=kh(f,n,e)*d%e,g=kh(x,Vte,e)*u%e,y=kh(g,s,e)*g%e,v=kh(y,a,e)*y%e,C=kh(v,l,e)*v%e,N=kh(C,c,e)*C%e,P=kh(N,l,e)*v%e,T=kh(P,n,e)*d%e,M=kh(T,o,e)*y%e,F=kh(M,r,e)*u%e,$=kh(F,Vte,e);if(!Wte.eql(Wte.sqr($),t))throw new Error("Cannot find square root");return $}const Wte=n_t(xRe,void 0,void 0,{sqrt:m_t}),Gle=h_t({a:BigInt(0),b:BigInt(7),Fp:Wte,n:J1e,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=J1e,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-p_t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,o=BigInt("0x100000000000000000000000000000000"),l=ebe(a*t,e),c=ebe(-r*t,e);let u=Qd(t-l*n-c*s,e),d=Qd(-l*r-c*a,e);const f=u>o,x=d>o;if(f&&(u=e-u),x&&(d=e-d),u>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:x,k2:d}}}},uU);BigInt(0);Gle.ProjectivePoint;const x_t=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Gle},Symbol.toStringTag,{value:"Module"}));var wW;const D1=(wW=Gle)!==null&&wW!==void 0?wW:x_t,tbe=BigInt("0xffffffffffffffff"),N_=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),g_t=D1.CURVE.n,b_t=g_t/BigInt(2),y_t={type:"object",required:["crypto","id","version","address"],properties:{crypto:{type:"object",required:["cipher","ciphertext","cipherparams","kdf","kdfparams","mac"],properties:{cipher:{type:"string"},ciphertext:{type:"string"},cipherparams:{type:"object"},kdf:{type:"string"},kdfparams:{type:"object"},salt:{type:"string"},mac:{type:"string"}}},id:{type:"string"},version:{type:"number"},address:{type:"string"}}};var uL;(function(t){t[t.Mainnet=1]="Mainnet",t[t.Goerli=5]="Goerli",t[t.Sepolia=11155111]="Sepolia"})(uL||(uL={}));var lo;(function(t){t.Chainstart="chainstart",t.Homestead="homestead",t.Dao="dao",t.TangerineWhistle="tangerineWhistle",t.SpuriousDragon="spuriousDragon",t.Byzantium="byzantium",t.Constantinople="constantinople",t.Petersburg="petersburg",t.Istanbul="istanbul",t.MuirGlacier="muirGlacier",t.Berlin="berlin",t.London="london",t.ArrowGlacier="arrowGlacier",t.GrayGlacier="grayGlacier",t.MergeForkIdTransition="mergeForkIdTransition",t.Merge="merge",t.Shanghai="shanghai",t.ShardingForkDev="shardingFork"})(lo||(lo={}));var nbe;(function(t){t.ProofOfStake="pos",t.ProofOfWork="pow",t.ProofOfAuthority="poa"})(nbe||(nbe={}));var rbe;(function(t){t.Ethash="ethash",t.Clique="clique",t.Casper="casper"})(rbe||(rbe={}));var wu;(function(t){t.PolygonMainnet="polygon-mainnet",t.PolygonMumbai="polygon-mumbai",t.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",t.ArbitrumOne="arbitrum-one",t.xDaiChain="x-dai-chain",t.OptimisticKovan="optimistic-kovan",t.OptimisticEthereum="optimistic-ethereum"})(wu||(wu={}));var rp;(function(t){t[t.Number=0]="Number",t[t.BigInt=1]="BigInt",t[t.Uint8Array=2]="Uint8Array",t[t.PrefixedHexString=3]="PrefixedHexString"})(rp||(rp={}));const gRe=t=>{if(typeof t!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof t}`);return jle(t)?t.slice(2):t};function v_t(t){return!t||t==="0x0"?"0x0000000000000000":jle(t)?`0x${gRe(t).padStart(16,"0")}`:`0x${t.padStart(16,"0")}`}const bRe=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Received an invalid integer type: ${t}`);return`0x${t.toString(16)}`};function w_t(t,e=!0){var n,r;const{name:s,config:a,difficulty:o,mixHash:l,gasLimit:c,coinbase:u,baseFeePerGas:d}=t;let{extraData:f,timestamp:x,nonce:g}=t;const y=Number(x),{chainId:v}=a;if(f===""&&(f="0x"),jle(x)||(x=bRe(parseInt(x))),g.length!==18&&(g=v_t(g)),a.eip155Block!==a.eip158Block)throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork");const C={name:s,chainId:v,networkId:v,genesis:{timestamp:x,gasLimit:parseInt(c),difficulty:parseInt(o),nonce:g,extraData:f,mixHash:l,coinbase:u,baseFeePerGas:d},hardfork:void 0,hardforks:[],bootstrapNodes:[],consensus:a.clique!==void 0?{type:"poa",algorithm:"clique",clique:{period:(n=a.clique.period)!==null&&n!==void 0?n:a.clique.blockperiodseconds,epoch:(r=a.clique.epoch)!==null&&r!==void 0?r:a.clique.epochlength}}:{type:"pow",algorithm:"ethash",ethash:{}}},N={[lo.Homestead]:{name:"homesteadBlock"},[lo.Dao]:{name:"daoForkBlock"},[lo.TangerineWhistle]:{name:"eip150Block"},[lo.SpuriousDragon]:{name:"eip155Block"},[lo.Byzantium]:{name:"byzantiumBlock"},[lo.Constantinople]:{name:"constantinopleBlock"},[lo.Petersburg]:{name:"petersburgBlock"},[lo.Istanbul]:{name:"istanbulBlock"},[lo.MuirGlacier]:{name:"muirGlacierBlock"},[lo.Berlin]:{name:"berlinBlock"},[lo.London]:{name:"londonBlock"},[lo.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:e},[lo.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[lo.ShardingForkDev]:{name:"shardingForkTime",postMerge:!0,isTimestamp:!0}},P=Object.keys(N).reduce((F,$)=>(F[N[$].name]=$,F),{}),T=Object.keys(a).filter(F=>P[F]!==void 0&&a[F]!==void 0&&a[F]!==null);if(C.hardforks=T.map(F=>({name:P[F],block:N[P[F]].isTimestamp===!0||typeof a[F]!="number"?null:a[F],timestamp:N[P[F]].isTimestamp===!0&&typeof a[F]=="number"?a[F]:void 0})).filter(F=>F.block!==null||F.timestamp!==void 0),C.hardforks.sort((F,$)=>{var L,z;return((L=F.block)!==null&&L!==void 0?L:1/0)-((z=$.block)!==null&&z!==void 0?z:1/0)}),C.hardforks.sort((F,$)=>{var L,z;return((L=F.timestamp)!==null&&L!==void 0?L:y)-((z=$.timestamp)!==null&&z!==void 0?z:y)}),a.terminalTotalDifficulty!==void 0){const F={name:lo.Merge,ttd:a.terminalTotalDifficulty,block:null},$=C.hardforks.findIndex(L=>{var z;return((z=N[L.name])===null||z===void 0?void 0:z.postMerge)===!0});$!==-1?C.hardforks.splice($,0,F):C.hardforks.push(F)}const M=C.hardforks.length>0?C.hardforks.slice(-1)[0]:void 0;return C.hardfork=M==null?void 0:M.name,C.hardforks.unshift({name:lo.Chainstart,block:0}),C}function C_t(t,e,n){try{if(["config","difficulty","gasLimit","alloc"].some(r=>!(r in t)))throw new Error("Invalid format, expected geth genesis fields missing");return e!==void 0&&(t.name=e),w_t(t,n)}catch(r){throw new Error(`Error parsing parameters file: ${r.message}`)}}function yRe(t){let e=t;if(typeof e!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof e}`);return e.length%2&&(e=`0${e}`),e}const S_t=function(t){const e=bRe(t);return fo(`0x${yRe(e.slice(2))}`)},Oo=function(t){var e;if(t==null)return new Uint8Array;if(t instanceof Uint8Array)return t;if(((e=t==null?void 0:t.constructor)===null||e===void 0?void 0:e.name)==="Uint8Array"||Array.isArray(t))return Uint8Array.from(t);if(typeof t=="string"){if(!_Me(t))throw new Error(`Cannot convert string to Uint8Array. only supports 0x-prefixed hex strings and this string was given: ${t}`);return fo(yRe(gRe(t)))}if(typeof t=="number")return Oo(ac(t));if(typeof t=="bigint"){if(t<BigInt(0))throw new Error(`Cannot convert negative bigint to Uint8Array. Given: ${t}`);let n=t.toString(16);return n.length%2&&(n=`0${n}`),Oo(`0x${n}`)}if(t.toArray)return Uint8Array.from(t.toArray());throw new Error("invalid type")};function Xa(t){const e=Gi(t);return BigInt(e==="0x"?0:e)}function N_t(t){return Oo(`0x${t.toString(16)}`)}const vRe=function(t){return new Uint8Array(t).fill(0)},A_t=function(t,e,n){const r=vRe(e);return t.length<e?(r.set(t,e-t.length),r):t.subarray(-e)};function Kle(t){if(!_2(t)){const e=`This method only supports Uint8Array but input was: ${t}`;throw new Error(e)}}const sbe=function(t,e){return Kle(t),A_t(t,e)};function j_t(t){let e=t[0];for(;t.length>0&&e.toString()==="0";)t=t.slice(1),e=t[0];return t}const dL=function(t){return Kle(t),j_t(t)},Mo=t=>`0x${t.toString(16)}`;function da(t){return dL(N_t(t))}function E_t(t,e){return t===BigInt(0)||t===BigInt(1)?t:e===void 0?t-BigInt(27):t-(e*BigInt(2)+BigInt(35))}function __t(t){return t===BigInt(0)||t===BigInt(1)}const Yle=function(t,e,n,r,s){const a=E_t(e,s);if(!__t(a))throw new Error("Invalid signature v value");return new D1.Signature(Xa(n),Xa(r)).addRecoveryBit(Number(a)).recoverPublicKey(t).toRawBytes(!1).slice(1)};function uC(t,e){if(t===null)return null;if(t===void 0)return;if(typeof t=="string"&&!_Me(t))throw new Error(`A string must be provided with a 0x-prefix, given: ${t}`);if(typeof t=="number"&&!Number.isSafeInteger(t))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const n=Oo(t);switch(e){case rp.Uint8Array:return n;case rp.BigInt:return Xa(n);case rp.Number:{const r=Xa(n);if(r>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(r)}case rp.PrefixedHexString:return Gi(n);default:throw new Error("unknown outputType")}}var Bp={},ibe;function k_t(){if(ibe)return Bp;ibe=1,Object.defineProperty(Bp,"__esModule",{value:!0}),Bp.RLP=Bp.utils=Bp.decode=Bp.encode=void 0;function t(N){if(Array.isArray(N)){const T=[];let M=0;for(let F=0;F<N.length;F++){const $=t(N[F]);T.push($),M+=$.length}return d(r(M,192),...T)}const P=C(N);return P.length===1&&P[0]<128?P:d(r(P.length,128),P)}Bp.encode=t;function e(N,P,T){if(T>N.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return N.slice(P,T)}function n(N){if(N[0]===0)throw new Error("invalid RLP: extra zeros");return c(l(N))}function r(N,P){if(N<56)return Uint8Array.from([N+P]);const T=x(N),M=T.length/2,F=x(P+55+M);return Uint8Array.from(u(F+T))}function s(N,P=!1){if(typeof N>"u"||N===null||N.length===0)return Uint8Array.from([]);const T=C(N),M=a(T);if(P)return M;if(M.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return M.data}Bp.decode=s;function a(N){let P,T,M,F,$;const L=[],z=N[0];if(z<=127)return{data:N.slice(0,1),remainder:N.slice(1)};if(z<=183){if(P=z-127,z===128?M=Uint8Array.from([]):M=e(N,1,P),P===2&&M[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:M,remainder:N.slice(P)}}else if(z<=191){if(T=z-182,N.length-1<T)throw new Error("invalid RLP: not enough bytes for string length");if(P=n(e(N,1,T)),P<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return M=e(N,T,P+T),{data:M,remainder:N.slice(P+T)}}else if(z<=247){for(P=z-191,F=e(N,1,P);F.length;)$=a(F),L.push($.data),F=$.remainder;return{data:L,remainder:N.slice(P)}}else{if(T=z-246,P=n(e(N,1,T)),P<56)throw new Error("invalid RLP: encoded list too short");const X=T+P;if(X>N.length)throw new Error("invalid RLP: total length is larger than the data");for(F=e(N,T,X);F.length;)$=a(F),L.push($.data),F=$.remainder;return{data:L,remainder:N.slice(X)}}}const o=Array.from({length:256},(N,P)=>P.toString(16).padStart(2,"0"));function l(N){let P="";for(let T=0;T<N.length;T++)P+=o[N[T]];return P}function c(N){const P=Number.parseInt(N,16);if(Number.isNaN(P))throw new Error("Invalid byte sequence");return P}function u(N){if(typeof N!="string")throw new TypeError("hexToBytes: expected string, got "+typeof N);if(N.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const P=new Uint8Array(N.length/2);for(let T=0;T<P.length;T++){const M=T*2;P[T]=c(N.slice(M,M+2))}return P}function d(...N){if(N.length===1)return N[0];const P=N.reduce((M,F)=>M+F.length,0),T=new Uint8Array(P);for(let M=0,F=0;M<N.length;M++){const $=N[M];T.set($,F),F+=$.length}return T}function f(N){return new TextEncoder().encode(N)}function x(N){if(N<0)throw new Error("Invalid integer as argument, must be unsigned!");const P=N.toString(16);return P.length%2?`0${P}`:P}function g(N){return N.length%2?`0${N}`:N}function y(N){return N.length>=2&&N[0]==="0"&&N[1]==="x"}function v(N){return typeof N!="string"?N:y(N)?N.slice(2):N}function C(N){if(N instanceof Uint8Array)return N;if(typeof N=="string")return y(N)?u(g(v(N))):f(N);if(typeof N=="number"||typeof N=="bigint")return N?u(x(N)):Uint8Array.from([]);if(N==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof N)}return Bp.utils={bytesToHex:l,concatBytes:d,hexToBytes:u,utf8ToBytes:f},Bp.RLP={encode:t,decode:s},Bp}var sp=k_t(),CW={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var abe;function T_t(){return abe||(abe=1,function(t){(function(e){e(typeof DO_NOT_EXPORT_CRC>"u"?t:{})})(function(e){e.version="1.2.2";function n(){for(var z=0,X=new Array(256),ne=0;ne!=256;++ne)z=ne,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,z=z&1?-306674912^z>>>1:z>>>1,X[ne]=z;return typeof Int32Array<"u"?new Int32Array(X):X}var r=n();function s(z){var X=0,ne=0,J=0,K=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(J=0;J!=256;++J)K[J]=z[J];for(J=0;J!=256;++J)for(ne=z[J],X=256+J;X<4096;X+=256)ne=K[X]=ne>>>8^z[ne&255];var te=[];for(J=1;J!=16;++J)te[J-1]=typeof Int32Array<"u"?K.subarray(J*256,J*256+256):K.slice(J*256,J*256+256);return te}var a=s(r),o=a[0],l=a[1],c=a[2],u=a[3],d=a[4],f=a[5],x=a[6],g=a[7],y=a[8],v=a[9],C=a[10],N=a[11],P=a[12],T=a[13],M=a[14];function F(z,X){for(var ne=X^-1,J=0,K=z.length;J<K;)ne=ne>>>8^r[(ne^z.charCodeAt(J++))&255];return~ne}function $(z,X){for(var ne=X^-1,J=z.length-15,K=0;K<J;)ne=M[z[K++]^ne&255]^T[z[K++]^ne>>8&255]^P[z[K++]^ne>>16&255]^N[z[K++]^ne>>>24]^C[z[K++]]^v[z[K++]]^y[z[K++]]^g[z[K++]]^x[z[K++]]^f[z[K++]]^d[z[K++]]^u[z[K++]]^c[z[K++]]^l[z[K++]]^o[z[K++]]^r[z[K++]];for(J+=15;K<J;)ne=ne>>>8^r[(ne^z[K++])&255];return~ne}function L(z,X){for(var ne=X^-1,J=0,K=z.length,te=0,fe=0;J<K;)te=z.charCodeAt(J++),te<128?ne=ne>>>8^r[(ne^te)&255]:te<2048?(ne=ne>>>8^r[(ne^(192|te>>6&31))&255],ne=ne>>>8^r[(ne^(128|te&63))&255]):te>=55296&&te<57344?(te=(te&1023)+64,fe=z.charCodeAt(J++)&1023,ne=ne>>>8^r[(ne^(240|te>>8&7))&255],ne=ne>>>8^r[(ne^(128|te>>2&63))&255],ne=ne>>>8^r[(ne^(128|fe>>6&15|(te&3)<<4))&255],ne=ne>>>8^r[(ne^(128|fe&63))&255]):(ne=ne>>>8^r[(ne^(224|te>>12&15))&255],ne=ne>>>8^r[(ne^(128|te>>6&63))&255],ne=ne>>>8^r[(ne^(128|te&63))&255]);return~ne}e.table=r,e.bstr=F,e.buf=$,e.str=L})}(CW)),CW}var P_t=T_t();const I_t=Ii(P_t),F_t={name:"goerli",chainId:5,networkId:5,defaultHardfork:"merge",consensus:{type:"poa",algorithm:"clique",clique:{period:15,epoch:3e4}},comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{timestamp:"0x5c51a607",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},hardforks:[{name:"chainstart",block:0,forkHash:"0xa3f5ab08"},{name:"homestead",block:0,forkHash:"0xa3f5ab08"},{name:"tangerineWhistle",block:0,forkHash:"0xa3f5ab08"},{name:"spuriousDragon",block:0,forkHash:"0xa3f5ab08"},{name:"byzantium",block:0,forkHash:"0xa3f5ab08"},{name:"constantinople",block:0,forkHash:"0xa3f5ab08"},{name:"petersburg",block:0,forkHash:"0xa3f5ab08"},{name:"istanbul",block:1561651,forkHash:"0xc25efa5c"},{name:"berlin",block:4460644,forkHash:"0x757a1c47"},{name:"london",block:5062605,forkHash:"0xb8c6299d"},{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://goerli.etherscan.io/block/7382818",name:"merge",ttd:"10790000",block:7382819,forkHash:"0xb8c6299d"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,forkHash:null}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.goerli.ethdisco.net"]},O_t={name:"mainnet",chainId:1,networkId:1,defaultHardfork:"merge",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfc64ec04"},{name:"homestead",block:115e4,forkHash:"0x97c2c34c"},{name:"dao",block:192e4,forkHash:"0x91d1f948"},{name:"tangerineWhistle",block:2463e3,forkHash:"0x7a64da13"},{name:"spuriousDragon",block:2675e3,forkHash:"0x3edd5b10"},{name:"byzantium",block:437e4,forkHash:"0xa00bc324"},{name:"constantinople",block:728e4,forkHash:"0x668db0af"},{name:"petersburg",block:728e4,forkHash:"0x668db0af"},{name:"istanbul",block:9069e3,forkHash:"0x879d6e30"},{name:"muirGlacier",block:92e5,forkHash:"0xe029e991"},{name:"berlin",block:12244e3,forkHash:"0x0eb440f6"},{name:"london",block:12965e3,forkHash:"0xb715077d"},{name:"arrowGlacier",block:13773e3,forkHash:"0x20c327fc"},{name:"grayGlacier",block:1505e4,forkHash:"0xf0afd0e3"},{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://etherscan.io/block/15537393",name:"merge",ttd:"58750000000000000000000",block:15537394,forkHash:"0xf0afd0e3"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,forkHash:null}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"]},M_t={name:"sepolia",chainId:11155111,networkId:11155111,defaultHardfork:"merge",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"PoW test network to replace Ropsten",url:"https://github.com/ethereum/go-ethereum/pull/23730",genesis:{timestamp:"0x6159af19",gasLimit:3e7,difficulty:131072,nonce:"0x0000000000000000",extraData:"0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfe3366e7"},{name:"homestead",block:0,forkHash:"0xfe3366e7"},{name:"tangerineWhistle",block:0,forkHash:"0xfe3366e7"},{name:"spuriousDragon",block:0,forkHash:"0xfe3366e7"},{name:"byzantium",block:0,forkHash:"0xfe3366e7"},{name:"constantinople",block:0,forkHash:"0xfe3366e7"},{name:"petersburg",block:0,forkHash:"0xfe3366e7"},{name:"istanbul",block:0,forkHash:"0xfe3366e7"},{name:"muirGlacier",block:0,forkHash:"0xfe3366e7"},{name:"berlin",block:0,forkHash:"0xfe3366e7"},{name:"london",block:0,forkHash:"0xfe3366e7"},{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://sepolia.etherscan.io/block/1450408",name:"merge",ttd:"17000000000000000",block:1450409,forkHash:"0xfe3366e7"},{name:"mergeForkIdTransition",block:1735371,forkHash:"0xb96cbd13"},{name:"shanghai",block:null,timestamp:"1677557088",forkHash:"0xf7f9bc08"}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net"]},R_t={name:"EIP-1153",number:1153,comment:"Transient Storage",url:"https://eips.ethereum.org/EIPS/eip-1153",status:"Review",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{tstore:{v:100,d:"Base fee of the TSTORE opcode"},tload:{v:100,d:"Base fee of the TLOAD opcode"}},vm:{},pow:{}},L_t={name:"EIP-1559",number:1559,comment:"Fee market change for ETH 1.0 chain",url:"https://eips.ethereum.org/EIPS/eip-1559",status:"Final",minimumHardfork:"berlin",requiredEIPs:[2930],gasConfig:{baseFeeMaxChangeDenominator:{v:8,d:"Maximum base fee change denominator"},elasticityMultiplier:{v:2,d:"Maximum block gas target elasticity"},initialBaseFee:{v:1e9,d:"Initial base fee on first EIP1559 block"}},gasPrices:{},vm:{},pow:{}},D_t={name:"EIP-2315",number:2315,comment:"Simple subroutines for the EVM",url:"https://eips.ethereum.org/EIPS/eip-2315",status:"Draft",minimumHardfork:"istanbul",gasConfig:{},gasPrices:{beginsub:{v:2,d:"Base fee of the BEGINSUB opcode"},returnsub:{v:5,d:"Base fee of the RETURNSUB opcode"},jumpsub:{v:10,d:"Base fee of the JUMPSUB opcode"}},vm:{},pow:{}},B_t={name:"EIP-2537",number:2537,comment:"BLS12-381 precompiles",url:"https://eips.ethereum.org/EIPS/eip-2537",status:"Draft",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{Bls12381G1AddGas:{v:600,d:"Gas cost of a single BLS12-381 G1 addition precompile-call"},Bls12381G1MulGas:{v:12e3,d:"Gas cost of a single BLS12-381 G1 multiplication precompile-call"},Bls12381G2AddGas:{v:4500,d:"Gas cost of a single BLS12-381 G2 addition precompile-call"},Bls12381G2MulGas:{v:55e3,d:"Gas cost of a single BLS12-381 G2 multiplication precompile-call"},Bls12381PairingBaseGas:{v:115e3,d:"Base gas cost of BLS12-381 pairing check"},Bls12381PairingPerPairGas:{v:23e3,d:"Per-pair gas cost of BLS12-381 pairing check"},Bls12381MapG1Gas:{v:5500,d:"Gas cost of BLS12-381 map field element to G1"},Bls12381MapG2Gas:{v:11e4,d:"Gas cost of BLS12-381 map field element to G2"},Bls12381MultiExpGasDiscount:{v:[[1,1200],[2,888],[3,764],[4,641],[5,594],[6,547],[7,500],[8,453],[9,438],[10,423],[11,408],[12,394],[13,379],[14,364],[15,349],[16,334],[17,330],[18,326],[19,322],[20,318],[21,314],[22,310],[23,306],[24,302],[25,298],[26,294],[27,289],[28,285],[29,281],[30,277],[31,273],[32,269],[33,268],[34,266],[35,265],[36,263],[37,262],[38,260],[39,259],[40,257],[41,256],[42,254],[43,253],[44,251],[45,250],[46,248],[47,247],[48,245],[49,244],[50,242],[51,241],[52,239],[53,238],[54,236],[55,235],[56,233],[57,232],[58,231],[59,229],[60,228],[61,226],[62,225],[63,223],[64,222],[65,221],[66,220],[67,219],[68,219],[69,218],[70,217],[71,216],[72,216],[73,215],[74,214],[75,213],[76,213],[77,212],[78,211],[79,211],[80,210],[81,209],[82,208],[83,208],[84,207],[85,206],[86,205],[87,205],[88,204],[89,203],[90,202],[91,202],[92,201],[93,200],[94,199],[95,199],[96,198],[97,197],[98,196],[99,196],[100,195],[101,194],[102,193],[103,193],[104,192],[105,191],[106,191],[107,190],[108,189],[109,188],[110,188],[111,187],[112,186],[113,185],[114,185],[115,184],[116,183],[117,182],[118,182],[119,181],[120,180],[121,179],[122,179],[123,178],[124,177],[125,176],[126,176],[127,175],[128,174]],d:"Discount gas costs of calls to the MultiExp precompiles with `k` (point, scalar) pair"}},vm:{},pow:{}},$_t={name:"EIP-2565",number:2565,comment:"ModExp gas cost",url:"https://eips.ethereum.org/EIPS/eip-2565",status:"Final",minimumHardfork:"byzantium",gasConfig:{},gasPrices:{modexpGquaddivisor:{v:3,d:"Gquaddivisor from modexp precompile for gas calculation"}},vm:{},pow:{}},U_t={name:"EIP-2718",comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{},vm:{},pow:{}},z_t={name:"EIP-2929",comment:"Gas cost increases for state access opcodes",url:"https://eips.ethereum.org/EIPS/eip-2929",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{coldsload:{v:2100,d:"Gas cost of the first read of storage from a given location (per transaction)"},coldaccountaccess:{v:2600,d:"Gas cost of the first read of a given address (per transaction)"},warmstorageread:{v:100,d:"Gas cost of reading storage locations which have already loaded 'cold'"},sstoreCleanGasEIP2200:{v:2900,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreNoopGasEIP2200:{v:100,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:100,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitRefundEIP2200:{v:19900,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanRefundEIP2200:{v:4900,d:"Once per SSTORE operation for resetting to the original non-zero value"},call:{v:0,d:"Base fee of the CALL opcode"},callcode:{v:0,d:"Base fee of the CALLCODE opcode"},delegatecall:{v:0,d:"Base fee of the DELEGATECALL opcode"},staticcall:{v:0,d:"Base fee of the STATICCALL opcode"},balance:{v:0,d:"Base fee of the BALANCE opcode"},extcodesize:{v:0,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:0,d:"Base fee of the EXTCODECOPY opcode"},extcodehash:{v:0,d:"Base fee of the EXTCODEHASH opcode"},sload:{v:0,d:"Base fee of the SLOAD opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"}},vm:{},pow:{}},H_t={name:"EIP-2930",comment:"Optional access lists",url:"https://eips.ethereum.org/EIPS/eip-2930",status:"Final",minimumHardfork:"istanbul",requiredEIPs:[2718,2929],gasConfig:{},gasPrices:{accessListStorageKeyCost:{v:1900,d:"Gas cost per storage key in an Access List transaction"},accessListAddressCost:{v:2400,d:"Gas cost per storage key in an Access List transaction"}},vm:{},pow:{}},V_t={name:"EIP-3198",number:3198,comment:"BASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-3198",status:"Final",minimumHardfork:"london",gasConfig:{},gasPrices:{basefee:{v:2,d:"Gas cost of the BASEFEE opcode"}},vm:{},pow:{}},W_t={name:"EIP-3529",comment:"Reduction in refunds",url:"https://eips.ethereum.org/EIPS/eip-3529",status:"Final",minimumHardfork:"berlin",requiredEIPs:[2929],gasConfig:{maxRefundQuotient:{v:5,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{selfdestructRefund:{v:0,d:"Refunded following a selfdestruct operation"},sstoreClearRefundEIP2200:{v:4800,d:"Once per SSTORE operation for clearing an originally existing storage slot"}},vm:{},pow:{}},q_t={name:"EIP-3540",number:3540,comment:"EVM Object Format (EOF) v1",url:"https://eips.ethereum.org/EIPS/eip-3540",status:"Review",minimumHardfork:"london",requiredEIPs:[3541],gasConfig:{},gasPrices:{},vm:{},pow:{}},G_t={name:"EIP-3541",comment:"Reject new contracts starting with the 0xEF byte",url:"https://eips.ethereum.org/EIPS/eip-3541",status:"Final",minimumHardfork:"berlin",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}},K_t={name:"EIP-3554",comment:"Reduction in refunds",url:"Difficulty Bomb Delay to December 1st 2021",status:"Final",minimumHardfork:"muirGlacier",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:95e5,d:"the amount of blocks to delay the difficulty bomb with"}}},Y_t={name:"EIP-3607",number:3607,comment:"Reject transactions from senders with deployed code",url:"https://eips.ethereum.org/EIPS/eip-3607",status:"Final",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}},X_t={name:"EIP-3651",number:3198,comment:"Warm COINBASE",url:"https://eips.ethereum.org/EIPS/eip-3651",status:"Review",minimumHardfork:"london",requiredEIPs:[2929],gasConfig:{},gasPrices:{},vm:{},pow:{}},Q_t={name:"EIP-3670",number:3670,comment:"EOF - Code Validation",url:"https://eips.ethereum.org/EIPS/eip-3670",status:"Review",minimumHardfork:"london",requiredEIPs:[3540],gasConfig:{},gasPrices:{},vm:{},pow:{}},Z_t={name:"EIP-3675",number:3675,comment:"Upgrade consensus to Proof-of-Stake",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Final",minimumHardfork:"london",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}},J_t={name:"EIP-3855",number:3855,comment:"PUSH0 instruction",url:"https://eips.ethereum.org/EIPS/eip-3855",status:"Review",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{push0:{v:2,d:"Base fee of the PUSH0 opcode"}},vm:{},pow:{}},ekt={name:"EIP-3860",number:3860,comment:"Limit and meter initcode",url:"https://eips.ethereum.org/EIPS/eip-3860",status:"Review",minimumHardfork:"spuriousDragon",requiredEIPs:[],gasConfig:{},gasPrices:{initCodeWordCost:{v:2,d:"Gas to pay for each word (32 bytes) of initcode when creating a contract"}},vm:{maxInitCodeSize:{v:49152,d:"Maximum length of initialization code when creating a contract"}},pow:{}},tkt={name:"EIP-4345",number:4345,comment:"Difficulty Bomb Delay to June 2022",url:"https://eips.ethereum.org/EIPS/eip-4345",status:"Final",minimumHardfork:"london",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:107e5,d:"the amount of blocks to delay the difficulty bomb with"}}},nkt={name:"EIP-4399",number:4399,comment:"Supplant DIFFICULTY opcode with PREVRANDAO",url:"https://eips.ethereum.org/EIPS/eip-4399",status:"Review",minimumHardfork:"london",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}},rkt={name:"EIP-5133",number:5133,comment:"Delaying Difficulty Bomb to mid-September 2022",url:"https://eips.ethereum.org/EIPS/eip-5133",status:"Draft",minimumHardfork:"grayGlacier",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:114e5,d:"the amount of blocks to delay the difficulty bomb with"}}},dC={1153:R_t,1559:L_t,2315:D_t,2537:B_t,2565:$_t,2718:U_t,2929:z_t,2930:H_t,3198:V_t,3529:W_t,3540:q_t,3541:G_t,3554:K_t,3607:Y_t,3651:X_t,3670:Q_t,3675:Z_t,3855:J_t,3860:ekt,4345:tkt,4399:nkt,5133:rkt},skt={name:"chainstart",comment:"Start of the Ethereum main chain",url:"",status:"",gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"},maxRefundQuotient:{v:2,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{base:{v:2,d:"Gas base cost, used e.g. for ChainID opcode (Istanbul)"},tierStep:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them"},exp:{v:10,d:"Base fee of the EXP opcode"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},sha3:{v:30,d:"Base fee of the SHA3 opcode"},sha3Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Base fee of the SLOAD opcode"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Base fee of the JUMPDEST opcode"},log:{v:375,d:"Base fee of the LOG opcode"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Base fee of the CREATE opcode"},call:{v:40,d:"Base fee of the CALL opcode"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""},stop:{v:0,d:"Base fee of the STOP opcode"},add:{v:3,d:"Base fee of the ADD opcode"},mul:{v:5,d:"Base fee of the MUL opcode"},sub:{v:3,d:"Base fee of the SUB opcode"},div:{v:5,d:"Base fee of the DIV opcode"},sdiv:{v:5,d:"Base fee of the SDIV opcode"},mod:{v:5,d:"Base fee of the MOD opcode"},smod:{v:5,d:"Base fee of the SMOD opcode"},addmod:{v:8,d:"Base fee of the ADDMOD opcode"},mulmod:{v:8,d:"Base fee of the MULMOD opcode"},signextend:{v:5,d:"Base fee of the SIGNEXTEND opcode"},lt:{v:3,d:"Base fee of the LT opcode"},gt:{v:3,d:"Base fee of the GT opcode"},slt:{v:3,d:"Base fee of the SLT opcode"},sgt:{v:3,d:"Base fee of the SGT opcode"},eq:{v:3,d:"Base fee of the EQ opcode"},iszero:{v:3,d:"Base fee of the ISZERO opcode"},and:{v:3,d:"Base fee of the AND opcode"},or:{v:3,d:"Base fee of the OR opcode"},xor:{v:3,d:"Base fee of the XOR opcode"},not:{v:3,d:"Base fee of the NOT opcode"},byte:{v:3,d:"Base fee of the BYTE opcode"},address:{v:2,d:"Base fee of the ADDRESS opcode"},balance:{v:20,d:"Base fee of the BALANCE opcode"},origin:{v:2,d:"Base fee of the ORIGIN opcode"},caller:{v:2,d:"Base fee of the CALLER opcode"},callvalue:{v:2,d:"Base fee of the CALLVALUE opcode"},calldataload:{v:3,d:"Base fee of the CALLDATALOAD opcode"},calldatasize:{v:2,d:"Base fee of the CALLDATASIZE opcode"},calldatacopy:{v:3,d:"Base fee of the CALLDATACOPY opcode"},codesize:{v:2,d:"Base fee of the CODESIZE opcode"},codecopy:{v:3,d:"Base fee of the CODECOPY opcode"},gasprice:{v:2,d:"Base fee of the GASPRICE opcode"},extcodesize:{v:20,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:20,d:"Base fee of the EXTCODECOPY opcode"},blockhash:{v:20,d:"Base fee of the BLOCKHASH opcode"},coinbase:{v:2,d:"Base fee of the COINBASE opcode"},timestamp:{v:2,d:"Base fee of the TIMESTAMP opcode"},number:{v:2,d:"Base fee of the NUMBER opcode"},difficulty:{v:2,d:"Base fee of the DIFFICULTY opcode"},gaslimit:{v:2,d:"Base fee of the GASLIMIT opcode"},pop:{v:2,d:"Base fee of the POP opcode"},mload:{v:3,d:"Base fee of the MLOAD opcode"},mstore:{v:3,d:"Base fee of the MSTORE opcode"},mstore8:{v:3,d:"Base fee of the MSTORE8 opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"},jump:{v:8,d:"Base fee of the JUMP opcode"},jumpi:{v:10,d:"Base fee of the JUMPI opcode"},pc:{v:2,d:"Base fee of the PC opcode"},msize:{v:2,d:"Base fee of the MSIZE opcode"},gas:{v:2,d:"Base fee of the GAS opcode"},push:{v:3,d:"Base fee of the PUSH opcode"},dup:{v:3,d:"Base fee of the DUP opcode"},swap:{v:3,d:"Base fee of the SWAP opcode"},callcode:{v:40,d:"Base fee of the CALLCODE opcode"},return:{v:0,d:"Base fee of the RETURN opcode"},invalid:{v:0,d:"Base fee of the INVALID opcode"},selfdestruct:{v:0,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:0,d:"the amount of blocks to delay the difficulty bomb with"}}},ikt={name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{}},akt={name:"homestead",comment:"Homestead hardfork with protocol and network changes",url:"https://eips.ethereum.org/EIPS/eip-606",status:"Final",gasConfig:{},gasPrices:{delegatecall:{v:40,d:"Base fee of the DELEGATECALL opcode"}},vm:{},pow:{}},okt={name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",url:"https://eips.ethereum.org/EIPS/eip-608",status:"Final",gasConfig:{},gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"},extcodesize:{v:700,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:700,d:"Base fee of the EXTCODECOPY opcode"},balance:{v:400,d:"Base fee of the BALANCE opcode"},delegatecall:{v:700,d:"Base fee of the DELEGATECALL opcode"},callcode:{v:700,d:"Base fee of the CALLCODE opcode"},selfdestruct:{v:5e3,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{},pow:{}},lkt={name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",url:"https://eips.ethereum.org/EIPS/eip-607",status:"Final",gasConfig:{},gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}},pow:{}},ckt={name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",url:"https://eips.ethereum.org/EIPS/eip-609",status:"Final",gasConfig:{},gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"},revert:{v:0,d:"Base fee of the REVERT opcode"},staticcall:{v:700,d:"Base fee of the STATICCALL opcode"},returndatasize:{v:2,d:"Base fee of the RETURNDATASIZE opcode"},returndatacopy:{v:3,d:"Base fee of the RETURNDATACOPY opcode"}},vm:{},pow:{minerReward:{v:"3000000000000000000",d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:3e6,d:"the amount of blocks to delay the difficulty bomb with"}}},ukt={name:"constantinople",comment:"Postponed hardfork including EIP-1283 (SSTORE gas metering changes)",url:"https://eips.ethereum.org/EIPS/eip-1013",status:"Final",gasConfig:{},gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"},shl:{v:3,d:"Base fee of the SHL opcode"},shr:{v:3,d:"Base fee of the SHR opcode"},sar:{v:3,d:"Base fee of the SAR opcode"},extcodehash:{v:400,d:"Base fee of the EXTCODEHASH opcode"},create2:{v:32e3,d:"Base fee of the CREATE2 opcode"}},vm:{},pow:{minerReward:{v:"2000000000000000000",d:"The amount a miner gets rewarded for mining a block"},difficultyBombDelay:{v:5e6,d:"the amount of blocks to delay the difficulty bomb with"}}},dkt={name:"petersburg",comment:"Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople",url:"https://eips.ethereum.org/EIPS/eip-1716",status:"Final",gasConfig:{},gasPrices:{netSstoreNoopGas:{v:null,d:"Removed along EIP-1283"},netSstoreInitGas:{v:null,d:"Removed along EIP-1283"},netSstoreCleanGas:{v:null,d:"Removed along EIP-1283"},netSstoreDirtyGas:{v:null,d:"Removed along EIP-1283"},netSstoreClearRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetClearRefund:{v:null,d:"Removed along EIP-1283"}},vm:{},pow:{}},fkt={name:"istanbul",comment:"HF targeted for December 2019 following the Constantinople/Petersburg HF",url:"https://eips.ethereum.org/EIPS/eip-1679",status:"Final",gasConfig:{},gasPrices:{blake2Round:{v:1,d:"Gas cost per round for the Blake2 F precompile"},ecAdd:{v:150,d:"Gas costs for curve addition precompile"},ecMul:{v:6e3,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:45e3,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:34e3,d:"Gas costs regarding curve pairing precompile input length"},txDataNonZero:{v:16,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},sstoreSentryGasEIP2200:{v:2300,d:"Minimum gas required to be present for an SSTORE call, not consumed"},sstoreNoopGasEIP2200:{v:800,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:800,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitGasEIP2200:{v:2e4,d:"Once per SSTORE operation from clean zero to non-zero"},sstoreInitRefundEIP2200:{v:19200,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanGasEIP2200:{v:5e3,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreCleanRefundEIP2200:{v:4200,d:"Once per SSTORE operation for resetting to the original non-zero value"},sstoreClearRefundEIP2200:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},balance:{v:700,d:"Base fee of the BALANCE opcode"},extcodehash:{v:700,d:"Base fee of the EXTCODEHASH opcode"},chainid:{v:2,d:"Base fee of the CHAINID opcode"},selfbalance:{v:5,d:"Base fee of the SELFBALANCE opcode"},sload:{v:800,d:"Base fee of the SLOAD opcode"}},vm:{},pow:{}},hkt={name:"muirGlacier",comment:"HF to delay the difficulty bomb",url:"https://eips.ethereum.org/EIPS/eip-2384",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:9e6,d:"the amount of blocks to delay the difficulty bomb with"}}},pkt={name:"berlin",comment:"HF targeted for July 2020 following the Muir Glacier HF",url:"https://eips.ethereum.org/EIPS/eip-2070",status:"Final",eips:[2565,2929,2718,2930]},mkt={name:"london",comment:"HF targeted for July 2021 following the Berlin fork",url:"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",status:"Final",eips:[1559,3198,3529,3541]},xkt={name:"shanghai",comment:"Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md",status:"Final",eips:[3651,3855,3860,4895]},gkt={name:"arrowGlacier",comment:"HF to delay the difficulty bomb",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md",status:"Final",eips:[4345],gasConfig:{},gasPrices:{},vm:{},pow:{}},bkt={name:"grayGlacier",comment:"Delaying the difficulty bomb to Mid September 2022",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md",status:"Draft",eips:[5133],gasConfig:{},gasPrices:{},vm:{},pow:{}},ykt={name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Draft",eips:[]},vkt={name:"merge",comment:"Hardfork to upgrade the consensus mechanism to Proof-of-Stake",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md",status:"Final",consensus:{type:"pos",algorithm:"casper",casper:{}},eips:[3675,4399]},wkt={chainstart:skt,homestead:akt,dao:ikt,tangerineWhistle:okt,spuriousDragon:lkt,byzantium:ckt,constantinople:ukt,petersburg:dkt,istanbul:fkt,muirGlacier:hkt,berlin:pkt,london:mkt,shanghai:xkt,arrowGlacier:gkt,grayGlacier:bkt,mergeForkIdTransition:ykt,merge:vkt},{buf:Ckt}=I_t;class nc extends Ple{static custom(e,n={}){var r;const s=(r=n.baseChain)!==null&&r!==void 0?r:"mainnet",a=Object.assign({},nc._getChainParams(s));if(a.name="custom-chain",typeof e!="string")return new nc(Object.assign({chain:Object.assign(Object.assign({},a),e)},n));if(e===wu.PolygonMainnet)return nc.custom({name:wu.PolygonMainnet,chainId:137,networkId:137},n);if(e===wu.PolygonMumbai)return nc.custom({name:wu.PolygonMumbai,chainId:80001,networkId:80001},n);if(e===wu.ArbitrumRinkebyTestnet)return nc.custom({name:wu.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},n);if(e===wu.ArbitrumOne)return nc.custom({name:wu.ArbitrumOne,chainId:42161,networkId:42161},n);if(e===wu.xDaiChain)return nc.custom({name:wu.xDaiChain,chainId:100,networkId:100},n);if(e===wu.OptimisticKovan)return nc.custom({name:wu.OptimisticKovan,chainId:69,networkId:69},Object.assign({hardfork:lo.Berlin},n));if(e===wu.OptimisticEthereum)return nc.custom({name:wu.OptimisticEthereum,chainId:10,networkId:10},Object.assign({hardfork:lo.Berlin},n));throw new Error(`Custom chain ${e} not supported`)}static fromGethGenesis(e,{chain:n,eips:r,genesisHash:s,hardfork:a,mergeForkIdPostMerge:o}){var l;const c=C_t(e,n,o),u=new nc({chain:(l=c.name)!==null&&l!==void 0?l:"custom",customChains:[c],eips:r,hardfork:a??c.hardfork});return s!==void 0&&u.setForkHashes(s),u}static isSupportedChainId(e){return!!this._getInitializedChains().names[e.toString()]}static _getChainParams(e,n){let r=e;const s=this._getInitializedChains(n);if(typeof r=="number"||typeof r=="bigint"){if(r=r.toString(),s.names[r]){const a=s.names[r];return s[a]}throw new Error(`Chain with ID ${r} not supported`)}if(s[r]!==void 0)return s[r];throw new Error(`Chain with name ${r} not supported`)}constructor(e){var n,r;super(),this._eips=[],this._customChains=(n=e.customChains)!==null&&n!==void 0?n:[],this._chainParams=this.setChain(e.chain),this.DEFAULT_HARDFORK=(r=this._chainParams.defaultHardfork)!==null&&r!==void 0?r:lo.Merge,this.HARDFORK_CHANGES=this.hardforks().map(s=>[s.name,wkt[s.name]]),this._hardfork=this.DEFAULT_HARDFORK,e.hardfork!==void 0&&this.setHardfork(e.hardfork),e.eips&&this.setEIPs(e.eips)}setChain(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")this._chainParams=nc._getChainParams(e,this._customChains);else if(typeof e=="object"){if(this._customChains.length>0)throw new Error("Chain must be a string, number, or bigint when initialized with customChains passed in");const n=["networkId","genesis","hardforks","bootstrapNodes"];for(const r of n)if(!(r in e))throw new Error(`Missing required chain parameter: ${r}`);this._chainParams=e}else throw new Error("Wrong input format");for(const n of this.hardforks())if(n.block===void 0)throw new Error("Hardfork cannot have undefined block number");return this._chainParams}setHardfork(e){let n=!1;for(const r of this.HARDFORK_CHANGES)r[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this.emit("hardforkChanged",e)),n=!0);if(!n)throw new Error(`Hardfork with name ${e} not supported`)}getHardforkByBlockNumber(e,n,r){const s=uC(e,rp.BigInt),a=uC(n,rp.BigInt),o=uC(r,rp.Number),l=this.hardforks().filter(g=>g.block!==null||g.ttd!==null&&g.ttd!==void 0||g.timestamp!==void 0),c=l.findIndex(g=>g.ttd!==null&&g.ttd!==void 0);if(l.slice(c+1).findIndex(g=>g.ttd!==null&&g.ttd!==void 0)>=0)throw Error("More than one merge hardforks found with ttd specified");let d=l.findIndex(g=>g.block!==null&&g.block>s||o!==void 0&&Number(g.timestamp)>o);if(d===-1)d=l.length;else if(d===0)throw Error("Must have at least one hardfork at block 0");if(o===void 0){const g=l.slice(0,d).reverse().findIndex(y=>y.block!==null||y.ttd!==void 0);d-=g}if(d-=1,l[d].block===null&&l[d].timestamp===void 0)(a==null||BigInt(l[d].ttd)>a)&&(d-=1);else if(c>=0&&a!==void 0&&a!==null){if(d>=c&&BigInt(l[c].ttd)>a)throw Error("Maximum HF determined by total difficulty is lower than the block number HF");if(d<c&&BigInt(l[c].ttd)<=a)throw Error("HF determined by block number is lower than the minimum total difficulty HF")}const f=d;for(;d<l.length-1&&!(l[d].block!==l[d+1].block||l[d].timestamp!==l[d+1].timestamp);d+=1);if(o){if(l.slice(0,f).reduce((v,C)=>{var N;return Math.max(Number((N=C.timestamp)!==null&&N!==void 0?N:"0"),v)},0)>o)throw Error("Maximum HF determined by timestamp is lower than the block number/ttd HF");if(l.slice(d+1).reduce((v,C)=>{var N;return Math.min(Number((N=C.timestamp)!==null&&N!==void 0?N:o),v)},o)<o)throw Error("Maximum HF determined by block number/ttd is lower than timestamp HF")}return l[d].name}setHardforkByBlockNumber(e,n,r){const s=this.getHardforkByBlockNumber(e,n,r);return this.setHardfork(s),s}_getHardfork(e){const n=this.hardforks();for(const r of n)if(r.name===e)return r;return null}setEIPs(e=[]){for(const n of e){if(!(n in dC))throw new Error(`${n} not supported`);const r=this.gteHardfork(dC[n].minimumHardfork);if(!r)throw new Error(`${n} cannot be activated on hardfork ${this.hardfork()}, minimumHardfork: ${r}`);if(dC[n].requiredEIPs!==void 0){for(const s of dC[n].requiredEIPs)if(!(e.includes(s)||this.isActivatedEIP(s)))throw new Error(`${n} requires EIP ${s}, but is not included in the EIP list`)}}this._eips=e}param(e,n){let r;for(const s of this._eips)if(r=this.paramByEIP(e,n,s),r!==void 0)return r;return this.paramByHardfork(e,n,this._hardfork)}paramByHardfork(e,n,r){let s=null;for(const a of this.HARDFORK_CHANGES){if("eips"in a[1]){const o=a[1].eips;for(const l of o){const c=this.paramByEIP(e,n,l);s=typeof c=="bigint"?c:s}}else{if(a[1][e]===void 0)throw new Error(`Topic ${e} not defined`);a[1][e][n]!==void 0&&(s=a[1][e][n].v)}if(a[0]===r)break}return BigInt(s??0)}paramByEIP(e,n,r){if(!(r in dC))throw new Error(`${r} not supported`);const s=dC[r];if(!(e in s))throw new Error(`Topic ${e} not defined`);if(s[e][n]===void 0)return;const a=s[e][n].v;return BigInt(a)}paramByBlock(e,n,r,s,a){const o=this.getHardforkByBlockNumber(r,s,a);return this.paramByHardfork(e,n,o)}isActivatedEIP(e){if(this.eips().includes(e))return!0;for(const n of this.HARDFORK_CHANGES){const r=n[1];if(this.gteHardfork(r.name)&&"eips"in r&&r.eips.includes(e))return!0}return!1}hardforkIsActiveOnBlock(e,n){const r=uC(n,rp.BigInt),s=e??this._hardfork,a=this.hardforkBlock(s);return typeof a=="bigint"&&a!==BigInt(0)&&r>=a}activeOnBlock(e){return this.hardforkIsActiveOnBlock(null,e)}hardforkGteHardfork(e,n){const r=e??this._hardfork,s=this.hardforks();let a=-1,o=-1,l=0;for(const c of s)c.name===r&&(a=l),c.name===n&&(o=l),l+=1;return a>=o&&o!==-1}gteHardfork(e){return this.hardforkGteHardfork(null,e)}hardforkBlock(e){var n;const r=e??this._hardfork,s=(n=this._getHardfork(r))===null||n===void 0?void 0:n.block;return s==null?null:BigInt(s)}hardforkTimestamp(e){var n;const r=e??this._hardfork,s=(n=this._getHardfork(r))===null||n===void 0?void 0:n.timestamp;return s==null?null:BigInt(s)}eipBlock(e){for(const n of this.HARDFORK_CHANGES){const r=n[1];if("eips"in r&&r.eips.includes(e))return this.hardforkBlock(typeof n[0]=="number"?String(n[0]):n[0])}return null}hardforkTTD(e){var n;const r=e??this._hardfork,s=(n=this._getHardfork(r))===null||n===void 0?void 0:n.ttd;return s==null?null:BigInt(s)}isHardforkBlock(e,n){const r=uC(e,rp.BigInt),s=n??this._hardfork,a=this.hardforkBlock(s);return typeof a=="bigint"&&a!==BigInt(0)?a===r:!1}nextHardforkBlockOrTimestamp(e){var n,r,s;const a=(n=e)!==null&&n!==void 0?n:this._hardfork,o=this.hardforks();let l=o.findIndex(f=>f.name===a);if(a===lo.Merge&&(l-=1),l<0)return null;let c=(r=o[l].timestamp)!==null&&r!==void 0?r:o[l].block;c=c!=null?Number(c):null;const u=o.slice(l+1).find(f=>{var x;let g=(x=f.timestamp)!==null&&x!==void 0?x:f.block;return g=g!=null?Number(g):null,f.name!==lo.Merge&&g!==null&&g!==void 0&&g!==c});if(u===void 0)return null;const d=(s=u.timestamp)!==null&&s!==void 0?s:u.block;return d==null?null:BigInt(d)}nextHardforkBlock(e){var n;const r=(n=e)!==null&&n!==void 0?n:this._hardfork;let s=this.hardforkBlock(r);if(s===null&&r===lo.Merge){const o=this.hardforks(),l=o.findIndex(c=>c.ttd!==null&&c.ttd!==void 0);if(l<0)throw Error("Merge hardfork should have been found");s=this.hardforkBlock(o[l-1].name)}return s===null?null:this.hardforks().reduce((o,l)=>{const c=BigInt(l.block===null||l.ttd!==void 0&&l.ttd!==null?0:l.block);return c>s&&o===null?c:o},null)}isNextHardforkBlock(e,n){const r=uC(e,rp.BigInt),s=n??this._hardfork,a=this.nextHardforkBlock(s);return a===null?!1:a===r}_calcForkHash(e,n){let r=new Uint8Array,s=0;for(const l of this.hardforks()){const{block:c,timestamp:u,name:d}=l;let f=u??c;if(f=f!==null?Number(f):null,typeof f=="number"&&f!==0&&f!==s&&d!==lo.Merge){const x=fo(f.toString(16).padStart(16,"0"));r=Ad(r,x),s=f}if(l.name===e)break}const a=Ad(n,r);return Gi(S_t(Ckt(a)>>>0))}forkHash(e,n){const r=e??this._hardfork,s=this._getHardfork(r);if(s===null||(s==null?void 0:s.block)===null&&(s==null?void 0:s.timestamp)===void 0&&(s==null?void 0:s.ttd)===void 0){const a="No fork hash calculation possible for future hardfork";throw new Error(a)}if((s==null?void 0:s.forkHash)!==null&&(s==null?void 0:s.forkHash)!==void 0)return s.forkHash;if(!n)throw new Error("genesisHash required for forkHash calculation");return this._calcForkHash(r,n)}hardforkForForkHash(e){const n=this.hardforks().filter(r=>r.forkHash===e);return n.length>=1?n[n.length-1]:null}setForkHashes(e){var n;for(const r of this.hardforks()){const s=(n=r.timestamp)!==null&&n!==void 0?n:r.block;(r.forkHash===null||r.forkHash===void 0)&&(s!=null||typeof r.ttd<"u")&&(r.forkHash=this.forkHash(r.name,e))}}genesis(){return this._chainParams.genesis}hardforks(){return this._chainParams.hardforks}bootstrapNodes(){return this._chainParams.bootstrapNodes}dnsNetworks(){return this._chainParams.dnsNetworks}hardfork(){return this._hardfork}chainId(){return BigInt(this._chainParams.chainId)}chainName(){return this._chainParams.name}networkId(){return BigInt(this._chainParams.networkId)}eips(){return this._eips}consensusType(){const e=this.hardfork();let n;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(n=r[1].consensus.type),r[0]===e)break;return n??this._chainParams.consensus.type}consensusAlgorithm(){const e=this.hardfork();let n;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(n=r[1].consensus.algorithm),r[0]===e)break;return n??this._chainParams.consensus.algorithm}consensusConfig(){var e;const n=this.hardfork();let r;for(const s of this.HARDFORK_CHANGES)if("consensus"in s[1]&&(r=s[1].consensus[s[1].consensus.algorithm]),s[0]===n)break;return(e=r??this._chainParams.consensus[this.consensusAlgorithm()])!==null&&e!==void 0?e:{}}copy(){const e=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return e.removeAllListeners(),e}static _getInitializedChains(e){const n={};for(const[s,a]of Object.entries(uL))n[a]=s.toLowerCase();const r={mainnet:O_t,goerli:F_t,sepolia:M_t};if(e)for(const s of e){const{name:a}=s;n[s.chainId.toString()]=a,r[a]=s}return r.names=n,r}}var F0;(function(t){t[t.EIP155ReplayProtection=155]="EIP155ReplayProtection",t[t.EIP1559FeeMarket=1559]="EIP1559FeeMarket",t[t.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",t[t.EIP2930AccessLists=2930]="EIP2930AccessLists"})(F0||(F0={}));function Skt(t){if(t.length===0)return!0;const e=t[0];return!!Array.isArray(e)}function Nkt(t){return!Skt(t)}class I4{constructor(e){if(e.length!==20)throw new Error("Invalid address length");this.buf=e}static zero(){return new I4(vRe(20))}equals(e){return nU(this.buf,e.buf)}isZero(){return this.equals(I4.zero())}toString(){return Gi(this.buf)}toArray(){return this.buf}static publicToAddress(e,n=!1){let r=e;if(Kle(r),n&&r.length!==64&&(r=D1.ProjectivePoint.fromHex(r).toRawBytes(!1).slice(1)),r.length!==64)throw new Error("Expected pubKey to be of length 64");return pd(r).slice(-20)}}const Akt=(t,e)=>{const n=t.param("vm","maxInitCodeSize");if(n&&BigInt(e)>n)throw new Error(`the initcode size of this transaction is too large: it is ${e} while the max is ${t.param("vm","maxInitCodeSize")}`)},wRe=t=>{let e,n;if(Nkt(t)){e=t;const r=[];for(let s=0;s<t.length;s+=1){const a=t[s],o=Oo(a.address),l=[];for(let c=0;c<a.storageKeys.length;c+=1)l.push(Oo(a.storageKeys[c]));r.push([o,l])}n=r}else{n=t??[];const r=[];for(let s=0;s<n.length;s+=1){const a=n[s],o=Gi(a[0]),l=[];for(let u=0;u<a[1].length;u+=1)l.push(Gi(a[1][u]));const c={address:o,storageKeys:l};r.push(c)}e=r}return{AccessListJSON:e,accessList:n}},CRe=t=>{for(let e=0;e<t.length;e+=1){const n=t[e],r=n[0],s=n[1];if(n[2]!==void 0)throw new Error("Access list item cannot have 3 elements. It can only have an address, and an array of storage slots.");if(r.length!==20)throw new Error("Invalid EIP-2930 transaction: address length should be 20 bytes");for(let a=0;a<s.length;a+=1)if(s[a].length!==32)throw new Error("Invalid EIP-2930 transaction: storage slot length should be 32 bytes")}},SRe=t=>{const e=[];for(let n=0;n<t.length;n+=1){const r=t[n],s={address:Gi(sbe(r[0],20)),storageKeys:[]},a=r&&r[1];for(let o=0;o<a.length;o+=1){const l=a[o];s.storageKeys.push(Gi(sbe(l,32)))}e.push(s)}return e},NRe=(t,e)=>{const n=e.param("gasPrices","accessListStorageKeyCost"),r=e.param("gasPrices","accessListAddressCost");let s=0;for(let o=0;o<t.length;o+=1){const c=t[o][1];s+=c.length}return t.length*Number(r)+s*Number(n)};class ON{constructor(e,n){var r,s;this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=uL.Mainnet,this.DEFAULT_HARDFORK=lo.Merge;const{nonce:a,gasLimit:o,to:l,value:c,data:u,v:d,r:f,s:x,type:g}=e;this._type=Number(Xa(Oo(g))),this.txOptions=n;const y=Oo(l===""?"0x":l),v=Oo(d===""?"0x":d),C=Oo(f===""?"0x":f),N=Oo(x===""?"0x":x);this.nonce=Xa(Oo(a===""?"0x":a)),this.gasLimit=Xa(Oo(o===""?"0x":o)),this.to=y.length>0?new I4(y):void 0,this.value=Xa(Oo(c===""?"0x":c)),this.data=Oo(u===""?"0x":u),this.v=v.length>0?Xa(v):void 0,this.r=C.length>0?Xa(C):void 0,this.s=N.length>0?Xa(N):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0);const P=this.to===void 0||this.to===null,T=(r=n.allowUnlimitedInitCodeSize)!==null&&r!==void 0?r:!1,M=(s=n.common)!==null&&s!==void 0?s:this._getCommon();P&&M.isActivatedEIP(3860)&&!T&&Akt(M,this.data.length)}get type(){return this._type}supports(e){return this.activeCapabilities.includes(e)}validate(e=!1){const n=[];return this.getBaseFee()>this.gasLimit&&n.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`),this.isSigned()&&!this.verifySignature()&&n.push("Invalid Signature"),e?n:n.length===0}_validateYParity(){const{v:e}=this;if(e!==void 0&&e!==BigInt(0)&&e!==BigInt(1)){const n=this._errorMsg("The y-parity of the transaction should either be 0 or 1");throw new Error(n)}}_validateHighS(){const{s:e}=this;if(this.common.gteHardfork("homestead")&&e!==void 0&&e>b_t){const n=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");throw new Error(n)}}getBaseFee(){const e=this.common.param("gasPrices","tx");let n=this.getDataFee();if(e&&(n+=e),this.common.gteHardfork("homestead")&&this.toCreationAddress()){const r=this.common.param("gasPrices","txCreation");r&&(n+=r)}return n}getDataFee(){const e=this.common.param("gasPrices","txDataZero"),n=this.common.param("gasPrices","txDataNonZero");let r=BigInt(0);for(let s=0;s<this.data.length;s+=1)this.data[s]===0?r+=e:r+=n;if((this.to===void 0||this.to===null)&&this.common.isActivatedEIP(3860)){const s=BigInt(Math.ceil(this.data.length/32)),a=this.common.param("gasPrices","initCodeWordCost")*s;r+=a}return r}toCreationAddress(){return this.to===void 0||this.to.buf.length===0}isSigned(){const{v:e,r:n,s:r}=this;return!(e===void 0||n===void 0||r===void 0)}verifySignature(){try{const e=this.getSenderPublicKey();return dL(e).length!==0}catch{return!1}}getSenderAddress(){return new I4(I4.publicToAddress(this.getSenderPublicKey()))}sign(e){if(e.length!==32){const c=this._errorMsg("Private key must be 32 bytes in length.");throw new Error(c)}let n=!1;this.type===0&&this.common.gteHardfork("spuriousDragon")&&!this.supports(F0.EIP155ReplayProtection)&&(this.activeCapabilities.push(F0.EIP155ReplayProtection),n=!0);const r=this.getMessageToSign(!0),{v:s,r:a,s:o}=this._ecsign(r,e),l=this._processSignature(s,a,o);if(n){const c=this.activeCapabilities.indexOf(F0.EIP155ReplayProtection);c>-1&&this.activeCapabilities.splice(c,1)}return l}_getCommon(e,n){var r,s,a,o;if(n!==void 0){const l=Xa(Oo(n));if(e){if(e.chainId()!==l){const c=this._errorMsg("The chain ID does not match the chain ID of Common");throw new Error(c)}return e.copy()}return nc.isSupportedChainId(l)?new nc({chain:l,hardfork:this.DEFAULT_HARDFORK}):nc.custom({name:"custom-chain",networkId:l,chainId:l},{baseChain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})}if(e!=null&&e.copy&&typeof(e==null?void 0:e.copy)=="function")return e.copy();if(e){const l=typeof e.hardfork=="function"?e.hardfork():e.hardfork;return nc.custom({name:"custom-chain",networkId:e.networkId?e.networkId():(s=BigInt((r=e.customChain)===null||r===void 0?void 0:r.networkId))!==null&&s!==void 0?s:void 0,chainId:e.chainId?e.chainId():(o=BigInt((a=e.customChain)===null||a===void 0?void 0:a.chainId))!==null&&o!==void 0?o:void 0},{baseChain:this.DEFAULT_CHAIN,hardfork:l||this.DEFAULT_HARDFORK})}return new nc({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})}_validateCannotExceedMaxInteger(e,n=256,r=!1){for(const[s,a]of Object.entries(e))switch(n){case 64:if(r){if(a!==void 0&&a>=tbe){const o=this._errorMsg(`${s} cannot equal or exceed MAX_UINT64 (2^64-1), given ${a}`);throw new Error(o)}}else if(a!==void 0&&a>tbe){const o=this._errorMsg(`${s} cannot exceed MAX_UINT64 (2^64-1), given ${a}`);throw new Error(o)}break;case 256:if(r){if(a!==void 0&&a>=N_){const o=this._errorMsg(`${s} cannot equal or exceed MAX_INTEGER (2^256-1), given ${a}`);throw new Error(o)}}else if(a!==void 0&&a>N_){const o=this._errorMsg(`${s} cannot exceed MAX_INTEGER (2^256-1), given ${a}`);throw new Error(o)}break;default:{const o=this._errorMsg("unimplemented bits value");throw new Error(o)}}}static _validateNotArray(e){const n=["nonce","gasPrice","gasLimit","to","value","data","v","r","s","type","baseFee","maxFeePerGas","chainId"];for(const[r,s]of Object.entries(e))if(n.includes(r)&&Array.isArray(s))throw new Error(`${r} cannot be an array`)}_getSharedErrorPostfix(){let e="";try{e=this.isSigned()?Gi(this.hash()):"not available (unsigned)"}catch{e="error"}let n="";try{n=this.isSigned().toString()}catch{e="error"}let r="";try{r=this.common.hardfork()}catch{r="error"}let s=`tx type=${this.type} hash=${e} nonce=${this.nonce} value=${this.value} `;return s+=`signed=${n} hf=${r}`,s}_ecsign(e,n,r){const s=D1.sign(e,n),a=s.toCompactRawBytes(),o=a.subarray(0,32),l=a.subarray(32,64),c=r===void 0?BigInt(s.recovery+27):BigInt(s.recovery+35)+BigInt(r)*BigInt(2);return{r:o,s:l,v:c}}static fromSerializedTx(e,n={}){}static fromTxData(e,n={}){}}const qte=2,SW=fo(qte.toString(16).padStart(2,"0"));class gw extends ON{static fromTxData(e,n={}){return new gw(e,n)}static fromSerializedTx(e,n={}){if(!nU(e.subarray(0,1),SW))throw new Error(`Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ${qte}, received: ${Gi(e.subarray(0,1))}`);const r=sp.RLP.decode(e.subarray(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return gw.fromValuesArray(r,n)}static fromValuesArray(e,n={}){if(e.length!==9&&e.length!==12)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");const[r,s,a,o,l,c,u,d,f,x,g,y]=e;return this._validateNotArray({chainId:r,v:x}),Ele({nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,value:u,v:x,r:g,s:y}),new gw({chainId:Xa(r),nonce:s,maxPriorityFeePerGas:a,maxFeePerGas:o,gasLimit:l,to:c,value:u,data:d,accessList:f??[],v:x!==void 0?Xa(x):void 0,r:g,s:y},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:qte}),n),this.DEFAULT_HARDFORK="london";const{chainId:s,accessList:a,maxFeePerGas:o,maxPriorityFeePerGas:l}=e;if(this.common=this._getCommon(n.common,s),this.chainId=this.common.chainId(),!this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);const c=wRe(a??[]);if(this.accessList=c.accessList,this.AccessListJSON=c.AccessListJSON,CRe(this.accessList),this.maxFeePerGas=Xa(Oo(o===""?"0x":o)),this.maxPriorityFeePerGas=Xa(Oo(l===""?"0x":l)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),ON._validateNotArray(e),this.gasLimit*this.maxFeePerGas>N_){const d=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(d)}if(this.maxFeePerGas<this.maxPriorityFeePerGas){const d=this._errorMsg("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)");throw new Error(d)}this._validateYParity(),this._validateHighS(),((r=n==null?void 0:n.freeze)!==null&&r!==void 0?r:!0)&&Object.freeze(this)}getDataFee(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;let e=super.getDataFee();return e+=BigInt(NRe(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:e,hardfork:this.common.hardfork()}),e}getUpfrontCost(e=BigInt(0)){const n=this.maxPriorityFeePerGas,r=this.maxFeePerGas-e,a=(n<r?n:r)+e;return this.gasLimit*a+this.value}raw(){return[da(this.chainId),da(this.nonce),da(this.maxPriorityFeePerGas),da(this.maxFeePerGas),da(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),da(this.value),this.data,this.accessList,this.v!==void 0?da(this.v):Uint8Array.from([]),this.r!==void 0?da(this.r):Uint8Array.from([]),this.s!==void 0?da(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(SW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,9),r=Ad(SW,sp.RLP.encode(n));return e?pd(r):r}hash(){if(!this.isSigned()){const e=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(e)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=pd(this.serialize())),this.cache.hash):pd(this.serialize())}getMessageToVerifySignature(){return this.getMessageToSign()}getSenderPublicKey(){if(!this.isSigned()){const a=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(a)}const e=this.getMessageToVerifySignature(),{v:n,r,s}=this;this._validateHighS();try{return Yle(e,n+BigInt(27),da(r),da(s))}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){const s=Object.assign(Object.assign({},this.txOptions),{common:this.common});return gw.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:e-BigInt(27),r:Xa(n),s:Xa(r)},s)}toJSON(){const e=SRe(this.accessList);return{chainId:Mo(this.chainId),nonce:Mo(this.nonce),maxPriorityFeePerGas:Mo(this.maxPriorityFeePerGas),maxFeePerGas:Mo(this.maxFeePerGas),gasLimit:Mo(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Mo(this.value),data:Gi(this.data),accessList:e,v:this.v!==void 0?Mo(this.v):void 0,r:this.r!==void 0?Mo(this.r):void 0,s:this.s!==void 0?Mo(this.s):void 0}}errorStr(){let e=this._getSharedErrorPostfix();return e+=` maxFeePerGas=${this.maxFeePerGas} maxPriorityFeePerGas=${this.maxPriorityFeePerGas}`,e}_errorMsg(e){return`${e} (${this.errorStr()})`}}const Gte=1,NW=fo(Gte.toString(16).padStart(2,"0"));class bw extends ON{static fromTxData(e,n={}){return new bw(e,n)}static fromSerializedTx(e,n={}){if(!nU(e.subarray(0,1),NW))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${Gte}, received: ${Gi(e.subarray(0,1))}`);const r=sp.RLP.decode(Uint8Array.from(e.subarray(1)));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return bw.fromValuesArray(r,n)}static fromValuesArray(e,n={}){if(e.length!==8&&e.length!==11)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");const[r,s,a,o,l,c,u,d,f,x,g]=e;this._validateNotArray({chainId:r,v:f}),Ele({nonce:s,gasPrice:a,gasLimit:o,value:c,v:f,r:x,s:g});const y=[];return new bw({chainId:Xa(r),nonce:s,gasPrice:a,gasLimit:o,to:l,value:c,data:u,accessList:d??y,v:f!==void 0?Xa(f):void 0,r:x,s:g},n)}constructor(e,n={}){var r;super(Object.assign(Object.assign({},e),{type:Gte}),n),this.DEFAULT_HARDFORK="berlin";const{chainId:s,accessList:a,gasPrice:o}=e;if(this.common=this._getCommon(n.common,s),this.chainId=this.common.chainId(),!this.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([2718,2930]);const l=wRe(a??[]);if(this.accessList=l.accessList,this.AccessListJSON=l.AccessListJSON,CRe(this.accessList),this.gasPrice=Xa(Oo(o===""?"0x":o)),this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),ON._validateNotArray(e),this.gasPrice*this.gasLimit>N_){const u=this._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(u)}this._validateYParity(),this._validateHighS(),((r=n==null?void 0:n.freeze)!==null&&r!==void 0?r:!0)&&Object.freeze(this)}getDataFee(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;let e=super.getDataFee();return e+=BigInt(NRe(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:e,hardfork:this.common.hardfork()}),e}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}raw(){return[da(this.chainId),da(this.nonce),da(this.gasPrice),da(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),da(this.value),this.data,this.accessList,this.v!==void 0?da(this.v):Uint8Array.from([]),this.r!==void 0?da(this.r):Uint8Array.from([]),this.s!==void 0?da(this.s):Uint8Array.from([])]}serialize(){const e=this.raw();return Ad(NW,sp.RLP.encode(e))}getMessageToSign(e=!0){const n=this.raw().slice(0,8),r=Ad(NW,sp.RLP.encode(n));return e?pd(r):r}hash(){if(!this.isSigned()){const e=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(e)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=pd(this.serialize())),this.cache.hash):pd(this.serialize())}getMessageToVerifySignature(){return this.getMessageToSign()}getSenderPublicKey(){if(!this.isSigned()){const a=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(a)}const e=this.getMessageToVerifySignature(),{v:n,r,s}=this;this._validateHighS();try{return Yle(e,n+BigInt(27),da(r),da(s))}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){const s=Object.assign(Object.assign({},this.txOptions),{common:this.common});return bw.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:e-BigInt(27),r:Xa(n),s:Xa(r)},s)}toJSON(){const e=SRe(this.accessList);return{chainId:Mo(this.chainId),nonce:Mo(this.nonce),gasPrice:Mo(this.gasPrice),gasLimit:Mo(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Mo(this.value),data:Gi(this.data),accessList:e,v:this.v!==void 0?Mo(this.v):void 0,r:this.r!==void 0?Mo(this.r):void 0,s:this.s!==void 0?Mo(this.s):void 0}}errorStr(){var e,n;let r=this._getSharedErrorPostfix();return r+=` gasPrice=${this.gasPrice} accessListCount=${(n=(e=this.accessList)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}`,r}_errorMsg(e){return`${e} (${this.errorStr()})`}}const jkt=0;function obe(t,e){const n=Number(t),r=Number(e)*2;return n===r+35||n===r+36}class _y extends ON{static fromTxData(e,n={}){return new _y(e,n)}static fromSerializedTx(e,n={}){const r=sp.RLP.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,n)}static fromValuesArray(e,n={}){if(e.length!==6&&e.length!==9)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");const[r,s,a,o,l,c,u,d,f]=e;return Ele({nonce:r,gasPrice:s,gasLimit:a,value:l,v:u,r:d,s:f}),new _y({nonce:r,gasPrice:s,gasLimit:a,to:o,value:l,data:c,v:u,r:d,s:f},n)}constructor(e,n={}){var r;if(super(Object.assign(Object.assign({},e),{type:jkt}),n),this.common=this._validateTxV(this.v,n.common),this.gasPrice=Xa(Oo(e.gasPrice===""?"0x":e.gasPrice)),this.gasPrice*this.gasLimit>N_){const a=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(a)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),ON._validateNotArray(e),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?obe(this.v,this.common.chainId())&&this.activeCapabilities.push(F0.EIP155ReplayProtection):this.activeCapabilities.push(F0.EIP155ReplayProtection)),((r=n==null?void 0:n.freeze)!==null&&r!==void 0?r:!0)&&Object.freeze(this)}raw(){return[da(this.nonce),da(this.gasPrice),da(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),da(this.value),this.data,this.v!==void 0?da(this.v):Uint8Array.from([]),this.r!==void 0?da(this.r):Uint8Array.from([]),this.s!==void 0?da(this.s):Uint8Array.from([])]}serialize(){return sp.RLP.encode(this.raw())}_getMessageToSign(){const e=[da(this.nonce),da(this.gasPrice),da(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),da(this.value),this.data];return this.supports(F0.EIP155ReplayProtection)&&(e.push(Oo(this.common.chainId())),e.push(dL(Oo(0))),e.push(dL(Oo(0)))),e}getMessageToSign(e=!0){const n=this._getMessageToSign();return e?pd(sp.RLP.encode(n)):n}getDataFee(){return this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork()?this.cache.dataFee.value:(Object.isFrozen(this)&&(this.cache.dataFee={value:super.getDataFee(),hardfork:this.common.hardfork()}),super.getDataFee())}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}hash(){if(!this.isSigned()){const e=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(e)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=pd(sp.RLP.encode(this.raw()))),this.cache.hash):pd(sp.RLP.encode(this.raw()))}getMessageToVerifySignature(){if(!this.isSigned()){const n=this._errorMsg("This transaction is not signed");throw new Error(n)}const e=this._getMessageToSign();return pd(sp.RLP.encode(e))}getSenderPublicKey(){const e=this.getMessageToVerifySignature(),{v:n,r,s}=this;this._validateHighS();try{return Yle(e,n,da(r),da(s),this.supports(F0.EIP155ReplayProtection)?this.common.chainId():void 0)}catch{const o=this._errorMsg("Invalid Signature");throw new Error(o)}}_processSignature(e,n,r){let s=e;this.supports(F0.EIP155ReplayProtection)&&(s+=this.common.chainId()*BigInt(2)+BigInt(8));const a=Object.assign(Object.assign({},this.txOptions),{common:this.common});return _y.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:s,r:Xa(n),s:Xa(r)},a)}toJSON(){return{nonce:Mo(this.nonce),gasPrice:Mo(this.gasPrice),gasLimit:Mo(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Mo(this.value),data:Gi(this.data),v:this.v!==void 0?Mo(this.v):void 0,r:this.r!==void 0?Mo(this.r):void 0,s:this.s!==void 0?Mo(this.s):void 0}}_validateTxV(e,n){let r;const s=e!==void 0?Number(e):void 0;if(s!==void 0&&s<37&&s!==27&&s!==28)throw new Error(`Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ${s}`);if(s!==void 0&&s!==0&&(!n||n.gteHardfork("spuriousDragon"))&&s!==27&&s!==28)if(n){if(!obe(BigInt(s),n.chainId()))throw new Error(`Incompatible EIP155-based V ${s} and chain id ${n.chainId()}. See the Common parameter of the Transaction constructor to set the chain id.`)}else{let a;(s-35)%2===0?a=35:a=36,r=BigInt(s-a)/BigInt(2)}return this._getCommon(n,r)}errorStr(){let e=this._getSharedErrorPostfix();return e+=` gasPrice=${this.gasPrice}`,e}_errorMsg(e){return`${e} (${this.errorStr()})`}}const AW=new Map;class o5{constructor(){}static typeToInt(e){return Number(Xa(Oo(e)))}static registerTransactionType(e,n){const r=o5.typeToInt(e);AW.set(r,n)}static fromTxData(e,n={}){if(!("type"in e)||e.type===void 0)return _y.fromTxData(e,n);const r=o5.typeToInt(e.type);if(r===0)return _y.fromTxData(e,n);if(r===1)return bw.fromTxData(e,n);if(r===2)return gw.fromTxData(e,n);const s=AW.get(r);if(s!=null&&s.fromTxData)return s.fromTxData(e,n);throw new Error(`Tx instantiation with type ${r} not supported`)}static fromSerializedData(e,n={}){if(e[0]<=127)switch(e[0]){case 1:return bw.fromSerializedTx(e,n);case 2:return gw.fromSerializedTx(e,n);default:{const r=AW.get(Number(e[0]));if(r!=null&&r.fromSerializedTx)return r.fromSerializedTx(e,n);throw new Error(`TypedTransaction with ID ${e[0]} unknown`)}}else return _y.fromSerializedTx(e,n)}static fromBlockBodyData(e,n={}){if(_2(e))return this.fromSerializedData(e,n);if(Array.isArray(e))return _y.fromValuesArray(e,n);throw new Error("Cannot decode transaction: unknown type input")}}var fU=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const fj=(t,e)=>{let n;if(!e&&typeof t=="string"&&ja(t)&&t.length!==66)throw new v1e;try{n=_2(t)?t:hx(t)}catch{throw new Xjt}if(!e&&n.byteLength!==32)throw new v1e;return n},Xle=(t,e=!1)=>{const n=ja(t)?t:km(t),r=fo(n),s=fo(OMe(`Ethereum Signed Message:
${r.byteLength}`)),a=e?r:Ad(s,r);return ah(a)},Ekt=(t,e)=>{const n=fj(e),r=D1.sign(t.substring(2),n),s=r.toCompactRawBytes(),a=r.r.toString(16).padStart(64,"0"),o=r.s.toString(16).padStart(64,"0"),l=r.recovery+27;return{messageHash:t,v:ac(l),r:`0x${a}`,s:`0x${o}`,signature:`${Gi(s)}${l.toString(16)}`}},ARe=(t,e)=>{const n=Xle(t),{messageHash:r,v:s,r:a,s:o,signature:l}=Ekt(n,e);return{message:t,messageHash:r,v:s,r:a,s:o,signature:l}},_kt=(t,e)=>fU(void 0,void 0,void 0,function*(){const n=t.sign(fo(e));if(gr(n.v)||gr(n.r)||gr(n.s))throw new Fte("Signer Error");const r=n.validate(!0);if(r.length>0){let o="Signer Error ";for(const l of r)o+=`${o} ${l}.`;throw new Fte(o)}const s=Gi(n.serialize()),a=ah(s);return{messageHash:Gi(n.getMessageToSign(!0)),v:`0x${n.v.toString(16)}`,r:`0x${n.r.toString(16).padStart(64,"0")}`,s:`0x${n.s.toString(16).padStart(64,"0")}`,rawTransaction:s,transactionHash:Gi(a)}}),kkt=t=>{if(gr(t))throw new h8t;const e=o5.fromSerializedData(fo(t));return wx(e.getSenderAddress().toString())},Kte=(t,e,n,r,s)=>{if(typeof t=="object"){const f=`${t.r}${t.s.slice(2)}${t.v.slice(2)}`;return Kte(t.messageHash,f,n)}if(typeof e=="string"&&typeof n=="string"&&!gr(r)){const f=`${n}${r.slice(2)}${e.slice(2)}`;return Kte(t,f,s)}if(gr(e))throw new Qjt("signature string undefined");const a=130,o=n?t:Xle(t);let l=parseInt(e.substring(a),16);l>26&&(l-=27);const c=D1.Signature.fromCompact(e.slice(2,a)).addRecoveryBit(l).recoverPublicKey(o.replace("0x","")).toRawBytes(!1),u=ah(c.subarray(1));return wx(`0x${u.slice(-40)}`)},hU=t=>{const e=fj(t),n=D1.getPublicKey(e,!1),s=ah(n.slice(1)).slice(-40);return wx(`0x${s}`)},Tkt=(t,e)=>{const n=fj(t);return`0x${Gi(D1.getPublicKey(n,e)).slice(4)}`},jRe=(t,e,n)=>fU(void 0,void 0,void 0,function*(){var r,s,a,o,l,c,u;const d=fj(t);let f;if(n!=null&&n.salt?f=typeof n.salt=="string"?fo(n.salt):n.salt:f=w_(32),!(Ale(e)||_2(e)))throw new e8t;const x=typeof e=="string"?fo(km(e)):e;let g;if(n!=null&&n.iv){if(g=typeof n.iv=="string"?fo(n.iv):n.iv,g.length!==16)throw new t8t}else g=w_(16);const y=(r=n==null?void 0:n.kdf)!==null&&r!==void 0?r:"scrypt";let v,C;if(y==="pbkdf2"){if(C={dklen:(s=n==null?void 0:n.dklen)!==null&&s!==void 0?s:32,salt:Gi(f).replace("0x",""),c:(a=n==null?void 0:n.c)!==null&&a!==void 0?a:262144,prf:"hmac-sha256"},C.c<1e3)throw new n8t;v=oRe(x,f,C.c,C.dklen,"sha256")}else if(y==="scrypt")C={n:(o=n==null?void 0:n.n)!==null&&o!==void 0?o:8192,r:(l=n==null?void 0:n.r)!==null&&l!==void 0?l:8,p:(c=n==null?void 0:n.p)!==null&&c!==void 0?c:1,dklen:(u=n==null?void 0:n.dklen)!==null&&u!==void 0?u:32,salt:Gi(f).replace("0x","")},v=lRe(x,f,C.n,C.p,C.r,C.dklen);else throw new KOe;const N=yield $le(d,v.slice(0,16),g,"aes-128-ctr"),P=Gi(N).slice(2),T=ah(Ad(v.slice(16,32),N)).replace("0x","");return{version:3,id:Mle(),address:hU(d).toLowerCase().replace("0x",""),crypto:{ciphertext:P,cipherparams:{iv:Gi(g).replace("0x","")},cipher:"aes-128-ctr",kdf:y,kdfparams:C,mac:T}}}),Qle=(t,e)=>{const n=fj(t,e);return{address:hU(n),privateKey:Gi(n),signTransaction:r=>{throw new Fte("Do not have network access to sign the transaction")},sign:r=>ARe(typeof r=="string"?r:JSON.stringify(r),n),encrypt:(r,s)=>fU(void 0,void 0,void 0,function*(){return jRe(n,r,s)})}},Pkt=()=>{const t=D1.utils.randomPrivateKey();return Qle(`${Gi(t)}`)},Ikt=(t,e,n)=>fU(void 0,void 0,void 0,function*(){const r=typeof t=="object"?t:JSON.parse(n?t.toLowerCase():t);if(Ks.validateJSONSchema(y_t,r),r.version!==3)throw new Jjt;const s=typeof e=="string"?fo(km(e)):e;Ks.validate(["bytes"],[s]);let a;if(r.crypto.kdf==="scrypt"){const u=r.crypto.kdfparams,d=typeof u.salt=="string"?fo(u.salt):u.salt;a=lRe(s,d,u.n,u.p,u.r,u.dklen)}else if(r.crypto.kdf==="pbkdf2"){const u=r.crypto.kdfparams,d=typeof u.salt=="string"?fo(u.salt):u.salt;a=oRe(s,d,u.c,u.dklen,"sha256")}else throw new KOe;const o=fo(r.crypto.ciphertext);if(ah(Ad(a.slice(16,32),o)).replace("0x","")!==r.crypto.mac)throw new Zjt;const c=yield jEt(fo(r.crypto.ciphertext),a.slice(0,16),fo(r.crypto.cipherparams.iv));return Qle(c)});var lbe=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const Fkt=1e3;class Okt{constructor(e){this._requestManager=e,this._requests=new Map}get requests(){return[...this._requests.values()].map(e=>e.payload)}add(e){const n=s5(e),r=new aL;return this._requests.set(n.id,{payload:n,promise:r}),r}execute(e){return lbe(this,void 0,void 0,function*(){var n;if(this.requests.length===0)return Promise.resolve([]);const r=new aL({timeout:(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Fkt,eagerStart:!0,timeoutMessage:"Batch request timeout"});return this._processBatchRequest(r).catch(s=>r.reject(s)),r.catch(s=>{s instanceof YOe&&this._abortAllRequests("Batch request timeout"),r.reject(s)}),r})}_processBatchRequest(e){return lbe(this,void 0,void 0,function*(){var n,r;const s=yield this._requestManager.sendBatch([...this._requests.values()].map(l=>l.payload));if(s.length!==this._requests.size)throw this._abortAllRequests("Invalid batch response"),new I0(s,`Batch request size mismatch the results size. Requests: ${this._requests.size}, Responses: ${s.length}`);const a=this.requests.map(l=>l.id).map(Number).sort((l,c)=>l-c),o=s.map(l=>l.id).map(Number).sort((l,c)=>l-c);if(JSON.stringify(a)!==JSON.stringify(o))throw this._abortAllRequests("Invalid batch response"),new I0(s,`Batch request mismatch the results. Requests: [${a.join()}], Responses: [${o.join()}]`);for(const l of s)$y(l)?(n=this._requests.get(l.id))===null||n===void 0||n.promise.resolve(l.result):Uy(l)&&((r=this._requests.get(l.id))===null||r===void 0||r.promise.reject(l.error));e.resolve(s)})}_abortAllRequests(e){for(const{promise:n}of this._requests.values())n.reject(new c8t(e))}}var Mkt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class af extends bEt{constructor(e){var n;if(super(),this.providers=y3.providers,si(e)||typeof e=="string"&&e.trim()!==""||oL(e)){this._requestManager=new y3(e),this._subscriptionManager=new lL(this._requestManager,{});return}const{config:r,provider:s,requestManager:a,subscriptionManager:o,registeredSubscriptions:l,accountProvider:c,wallet:u,requestManagerMiddleware:d}=e;this.setConfig(r??{}),this._requestManager=a??new y3(s,(n=r==null?void 0:r.enableExperimentalFeatures)===null||n===void 0?void 0:n.useSubscriptionWhenCheckingBlockTimeout,d),o?this._subscriptionManager=o:this._subscriptionManager=new lL(this.requestManager,l??{}),c&&(this._accountProvider=c),u&&(this._wallet=u)}get requestManager(){return this._requestManager}get subscriptionManager(){return this._subscriptionManager}get wallet(){return this._wallet}get accountProvider(){return this._accountProvider}static fromContextObject(...e){return new this(...e.reverse())}getContextObject(){var e;return{config:this.config,provider:this.provider,requestManager:this.requestManager,subscriptionManager:this.subscriptionManager,registeredSubscriptions:(e=this.subscriptionManager)===null||e===void 0?void 0:e.registeredSubscriptions,providers:this.providers,wallet:this.wallet,accountProvider:this.accountProvider}}use(e,...n){const r=new e(...n,this.getContextObject());return this.on(i5.CONFIG_CHANGE,s=>{r.setConfig({[s.name]:s.newValue})}),this[e.name]=r,r}link(e){this.setConfig(e.config),this._requestManager=e.requestManager,this.provider=e.provider,this._subscriptionManager=e.subscriptionManager,this._wallet=e.wallet,this._accountProvider=e._accountProvider,e.on(i5.CONFIG_CHANGE,n=>{this.setConfig({[n.name]:n.newValue})})}registerPlugin(e){if(this[e.pluginNamespace]!==void 0)throw new u8t(e.pluginNamespace);const n={[e.pluginNamespace]:e};n[e.pluginNamespace].link(this),Object.assign(this,n)}get provider(){return this.currentProvider}set provider(e){this.requestManager.setProvider(e)}get currentProvider(){return this.requestManager.provider}set currentProvider(e){this.requestManager.setProvider(e)}get givenProvider(){return af.givenProvider}setProvider(e){return this.provider=e,!0}setRequestManagerMiddleware(e){this.requestManager.setMiddleware(e)}get BatchRequest(){return Okt.bind(void 0,this._requestManager)}extend(e){var n;return e.property&&!this[e.property]&&(this[e.property]={}),(n=e.methods)===null||n===void 0||n.forEach(r=>{const s=(...a)=>Mkt(this,void 0,void 0,function*(){return this.requestManager.send({method:r.call,params:a})});e.property?this[e.property][r.name]=s:this[r.name]=s}),this}}af.providers=y3.providers;class Dl{constructor(e){if(this.toAddress=()=>{if(this.isDirect()){const n=this._iban.slice(4),r=Dl._parseInt(n,36),s=y_(r,40);return wx(s)}throw new Error("Iban is indirect and cannot be converted. Must be length of 34 or 35")},Dl.isIndirect(e)||Dl.isDirect(e))this._iban=e;else throw new Error("Invalid IBAN was provided")}static isDirect(e){return e.length===34||e.length===35}isDirect(){return Dl.isDirect(this._iban)}static isIndirect(e){return e.length===20}isIndirect(){return Dl.isIndirect(this._iban)}static isValid(e){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(e)&&Dl._mod9710(Dl._iso13616Prepare(e))===1}isValid(){return Dl.isValid(this._iban)}static fromBban(e){const n="XE",s=`0${(98-this._mod9710(this._iso13616Prepare(`${n}00${e}`))).toString()}`.slice(-2);return new Dl(`${n}${s}${e}`)}static createIndirect(e){return Dl.fromBban(`ETH${e.institution}${e.identifier}`)}static fromAddress(e){if(!ih(e))throw new ble(e);const r=BigInt(BT(e)).toString(36),s=y_(r,15);return Dl.fromBban(s.toUpperCase())}static toIban(e){return Dl.fromAddress(e).toString()}client(){return this.isIndirect()?this._iban.slice(11):""}checksum(){return this._iban.slice(2,4)}institution(){return this.isIndirect()?this._iban.slice(7,11):""}toString(){return this._iban}}Dl._iso13616Prepare=t=>{const r=t.toUpperCase();return`${r.slice(4)}${r.slice(0,4)}`.split("").map(a=>{const o=a.charCodeAt(0);return o>=65&&o<=90?o-65+10:a}).join("")};Dl._parseInt=(t,e)=>[...t].reduce((n,r)=>BigInt(parseInt(r,e))+BigInt(e)*n,BigInt(0));Dl._mod9710=t=>{let e=t,n;for(;e.length>2;)n=e.slice(0,9),e=`${(parseInt(n,10)%97).toString()}${e.slice(n.length)}`;return parseInt(e,10)%97};Dl.toAddress=t=>new Dl(t).toAddress();var jW=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},ERe;class _Re extends lU{constructor(e){super(),this[ERe]="Promise",this._promise=new Promise(e)}then(e,n){return jW(this,void 0,void 0,function*(){return this._promise.then(e,n)})}catch(e){return jW(this,void 0,void 0,function*(){return this._promise.catch(e)})}finally(e){return jW(this,void 0,void 0,function*(){return this._promise.finally(e)})}on(e,n){return super.on(e,n),this}once(e,n){return super.once(e,n),this}}ERe=Symbol.toStringTag;var EW={},cbe;function Rkt(){return cbe||(cbe=1,function(t,e){if(t.setImmediate)return;var n=1,r={},s=!1,a=t.document,o;function l(P){typeof P!="function"&&(P=new Function(""+P));for(var T=new Array(arguments.length-1),M=0;M<T.length;M++)T[M]=arguments[M+1];var F={callback:P,args:T};return r[n]=F,o(n),n++}function c(P){delete r[P]}function u(P){var T=P.callback,M=P.args;switch(M.length){case 0:T();break;case 1:T(M[0]);break;case 2:T(M[0],M[1]);break;case 3:T(M[0],M[1],M[2]);break;default:T.apply(e,M);break}}function d(P){if(s)setTimeout(d,0,P);else{var T=r[P];if(T){s=!0;try{u(T)}finally{c(P),s=!1}}}}function f(){o=function(P){process.nextTick(function(){d(P)})}}function x(){if(t.postMessage&&!t.importScripts){var P=!0,T=t.onmessage;return t.onmessage=function(){P=!1},t.postMessage("","*"),t.onmessage=T,P}}function g(){var P="setImmediate$"+Math.random()+"$",T=function(M){M.source===t&&typeof M.data=="string"&&M.data.indexOf(P)===0&&d(+M.data.slice(P.length))};t.addEventListener?t.addEventListener("message",T,!1):t.attachEvent("onmessage",T),o=function(M){t.postMessage(P+M,"*")}}function y(){var P=new MessageChannel;P.port1.onmessage=function(T){var M=T.data;d(M)},o=function(T){P.port2.postMessage(T)}}function v(){var P=a.documentElement;o=function(T){var M=a.createElement("script");M.onreadystatechange=function(){d(T),M.onreadystatechange=null,P.removeChild(M),M=null},P.appendChild(M)}}function C(){o=function(P){setTimeout(d,0,P)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf(t);N=N&&N.setTimeout?N:t,{}.toString.call(t.process)==="[object process]"?f():x()?g():t.MessageChannel?y():a&&"onreadystatechange"in a.createElement("script")?v():C(),N.setImmediate=l,N.clearImmediate=c}(typeof self>"u"?typeof Ru>"u"?EW:Ru:self)),EW}Rkt();var pi=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function Lkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_protocolVersion",params:[]})})}function kRe(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_syncing",params:[]})})}function Dkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_coinbase",params:[]})})}function Bkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_mining",params:[]})})}function $kt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_hashrate",params:[]})})}function Ukt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_gasPrice",params:[]})})}function zkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_maxPriorityFeePerGas",params:[]})})}function Hkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_accounts",params:[]})})}function Vkt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_blockNumber",params:[]})})}function Wkt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getBalance",params:[e,n]})})}function qkt(t,e,n,r){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","hex","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getStorageAt",params:[e,n,r]})})}function Gkt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getTransactionCount",params:[e,n]})})}function Kkt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32"],[e]),t.send({method:"eth_getBlockTransactionCountByHash",params:[e]})})}function Ykt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getBlockTransactionCountByNumber",params:[e]})})}function Xkt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32"],[e]),t.send({method:"eth_getUncleCountByBlockHash",params:[e]})})}function Qkt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag"],[e]),t.send({method:"eth_getUncleCountByBlockNumber",params:[e]})})}function Zkt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","blockNumberOrTag"],[e,n]),t.send({method:"eth_getCode",params:[e,n]})})}function Jkt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","hex"],[e,n]),t.send({method:"eth_sign",params:[e,n]})})}function eTt(t,e){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_signTransaction",params:[e]})})}function tTt(t,e){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_sendTransaction",params:[e]})})}function TRe(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["hex"],[e]),t.send({method:"eth_sendRawTransaction",params:[e]})})}function nTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_call",params:[e,n]})})}function rTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_estimateGas",params:[e,n]})})}function sTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32","bool"],[e,n]),t.send({method:"eth_getBlockByHash",params:[e,n]})})}function PRe(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag","bool"],[e,n]),t.send({method:"eth_getBlockByNumber",params:[e,n]})})}function iTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionByHash",params:[e]})})}function aTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockHashAndIndex",params:[e,n]})})}function oTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getTransactionByBlockNumberAndIndex",params:[e,n]})})}function lTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32"],[e]),t.send({method:"eth_getTransactionReceipt",params:[e]})})}function cTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes32","hex"],[e,n]),t.send({method:"eth_getUncleByBlockHashAndIndex",params:[e,n]})})}function uTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag","hex"],[e,n]),t.send({method:"eth_getUncleByBlockNumberAndIndex",params:[e,n]})})}function dTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["filter"],[e]),t.send({method:"eth_newFilter",params:[e]})})}function fTt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_newBlockFilter",params:[]})})}function hTt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_newPendingTransactionFilter",params:[]})})}function pTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["hex"],[e]),t.send({method:"eth_uninstallFilter",params:[e]})})}function mTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["hex"],[e]),t.send({method:"eth_getFilterChanges",params:[e]})})}function xTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["hex"],[e]),t.send({method:"eth_getFilterLogs",params:[e]})})}function gTt(t,e){return pi(this,void 0,void 0,function*(){return Ks.validate(["filter"],[e]),t.send({method:"eth_getLogs",params:[e]})})}function bTt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_getWork",params:[]})})}function yTt(t,e,n,r){return pi(this,void 0,void 0,function*(){return Ks.validate(["bytes8","bytes32","bytes32"],[e,n,r]),t.send({method:"eth_submitWork",params:[e,n,r]})})}function vTt(t,e,n,r){return pi(this,void 0,void 0,function*(){Ks.validate(["hex","blockNumberOrTag"],[e,n]);for(const s of r)Ks.validate(["number"],[s]);return t.send({method:"eth_feeHistory",params:[e,n,r]})})}function wTt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_pendingTransactions",params:[]})})}function CTt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_requestAccounts",params:[]})})}function STt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"eth_chainId",params:[]})})}function NTt(t,e,n,r){return pi(this,void 0,void 0,function*(){return Ks.validate(["address","bytes32[]","blockNumberOrTag"],[e,n,r]),t.send({method:"eth_getProof",params:[e,n,r]})})}function ATt(t){return pi(this,void 0,void 0,function*(){return t.send({method:"web3_clientVersion",params:[]})})}function jTt(t,e,n){return pi(this,void 0,void 0,function*(){return Ks.validate(["blockNumberOrTag"],[n]),t.send({method:"eth_createAccessList",params:[e,n]})})}function ETt(t,e,n,r=!1){return pi(this,void 0,void 0,function*(){return Ks.validate(["address"],[e]),t.send({method:`eth_signTypedData${r?"":"_v4"}`,params:[e,n]})})}var Zle=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function _Tt(t){return Zle(this,void 0,void 0,function*(){return t.send({method:"net_version",params:[]})})}function kTt(t){return Zle(this,void 0,void 0,function*(){return t.send({method:"net_peerCount",params:[]})})}function TTt(t){return Zle(this,void 0,void 0,function*(){return t.send({method:"net_listening",params:[]})})}var B1=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const PTt=t=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_listAccounts",params:[]})}),ITt=(t,e)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_newAccount",params:[e]})}),FTt=(t,e,n,r)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_unlockAccount",params:[e,n,r]})}),OTt=(t,e)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_lockAccount",params:[e]})}),MTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_importRawKey",params:[e,n]})}),RTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sendTransaction",params:[e,n]})}),LTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_signTransaction",params:[e,n]})}),DTt=(t,e,n,r)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_sign",params:[e,n,r]})}),BTt=(t,e,n)=>B1(void 0,void 0,void 0,function*(){return t.send({method:"personal_ecRecover",params:[e,n]})}),ube={type:"object",properties:{accessList:{type:"null"},maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},dbe={type:"object",properties:{maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},fbe={type:"object",properties:{gasPrice:{type:"null"}}},ZI=(t,e,n)=>{try{Ks.validateJSONSchema(t,e)}catch(r){throw r instanceof jN?new L8t(r.errors,n):r}},$Tt=t=>{var e,n;const r=t;if(!gr(r.type)){let a;switch(r.type){case"0x0":a=ube;break;case"0x1":a=dbe;break;case"0x2":a=fbe;break;default:return qr({format:"uint"},r.type,xi)}return ZI(a,r,r.type),qr({format:"uint"},r.type,xi)}if(!gr(r.maxFeePerGas)||!gr(r.maxPriorityFeePerGas))return ZI(fbe,r,"0x2"),"0x2";if(!gr(r.accessList))return ZI(dbe,r,"0x1"),"0x1";const s=(e=r.hardfork)!==null&&e!==void 0?e:(n=r.common)===null||n===void 0?void 0:n.hardfork;if(!gr(s)){const a=Object.keys(_9).indexOf(s);if(a>=Object.keys(_9).indexOf("london"))return gr(r.gasPrice)?"0x2":"0x0";if(a===Object.keys(_9).indexOf("berlin"))return"0x0"}if(!gr(r.gasPrice))return ZI(ube,r,"0x0"),"0x0"},UTt=(t,e)=>{var n;return((n=e==null?void 0:e.transactionTypeParser)!==null&&n!==void 0?n:$Tt)(t)},zTt=t=>t[0]>127?"0x0":j1(t[0]),HTt={type:"object",properties:{address:{format:"address"},storageKeys:{type:"array",items:{format:"bytes32"}}}},Jle={type:"array",items:Object.assign({},HTt)},VTt={type:"object",properties:{accessList:Object.assign({},Jle),gasUsed:{type:"string"}}},hbe={type:"string",enum:["goerli","kovan","mainnet","rinkeby","ropsten","sepolia"]},pbe={type:"string",enum:["arrowGlacier","berlin","byzantium","chainstart","constantinople","dao","homestead","istanbul","london","merge","muirGlacier","petersburg","shanghai","spuriousDragon","tangerineWhistle"]},WTt={type:"object",properties:{name:{format:"string"},networkId:{format:"uint"},chainId:{format:"uint"}}},IRe={type:"object",properties:{from:{format:"address"},to:{oneOf:[{format:"address"},{type:"null"}]},value:{format:"uint"},gas:{format:"uint"},gasPrice:{format:"uint"},effectiveGasPrice:{format:"uint"},type:{format:"uint"},maxFeePerGas:{format:"uint"},maxPriorityFeePerGas:{format:"uint"},accessList:Object.assign({},Jle),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},chain:Object.assign({},hbe),hardfork:Object.assign({},pbe),chainId:{format:"uint"},networkId:{format:"uint"},common:{type:"object",properties:{customChain:Object.assign({},WTt),baseChain:Object.assign({},hbe),hardfork:Object.assign({},pbe)}},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}}},Yte={type:"object",properties:Object.assign(Object.assign({},IRe.properties),{blockHash:{format:"bytes32"},blockNumber:{format:"uint"},hash:{format:"bytes32"},transactionIndex:{format:"uint"},from:{format:"address"},to:{oneOf:[{format:"address"},{type:"null"}]},value:{format:"uint"},gas:{format:"uint"},gasPrice:{format:"uint"},effectiveGasPrice:{format:"uint"},type:{format:"uint"},maxFeePerGas:{format:"uint"},maxPriorityFeePerGas:{format:"uint"},accessList:Object.assign({},Jle),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}})},FRe={type:"object",properties:{index:{format:"uint"},validatorIndex:{format:"uint"},address:{format:"address"},amount:{format:"uint"}}},fL={type:"object",properties:{baseFeePerGas:{format:"uint"},blobGasUsed:{format:"uint"},difficulty:{format:"uint"},excessBlobGas:{format:"uint"},extraData:{format:"bytes"},gasLimit:{format:"uint"},gasUsed:{format:"uint"},hash:{format:"bytes32"},logsBloom:{format:"bytes256"},miner:{format:"bytes"},mixHash:{format:"bytes32"},nonce:{format:"uint"},number:{format:"uint"},parentBeaconBlockRoot:{format:"bytes32"},parentHash:{format:"bytes32"},receiptsRoot:{format:"bytes32"},sha3Uncles:{format:"bytes32"},size:{format:"uint"},stateRoot:{format:"bytes32"},timestamp:{format:"uint"},totalDifficulty:{format:"uint"},transactions:{oneOf:[{type:"array",items:Object.assign({},Yte)},{type:"array",items:{format:"bytes32"}}]},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},FRe)},withdrawalsRoot:{format:"bytes32"}}},qTt={type:"object",properties:{author:{format:"bytes32"},excessDataGas:{format:"uint"},baseFeePerGas:{format:"uint"},blobGasUsed:{format:"uint"},difficulty:{format:"uint"},excessBlobGas:{format:"uint"},extraData:{format:"bytes"},gasLimit:{format:"uint"},gasUsed:{format:"uint"},hash:{format:"bytes32"},logsBloom:{format:"bytes256"},miner:{format:"bytes"},mixHash:{format:"bytes32"},nonce:{format:"uint"},number:{format:"uint"},parentBeaconBlockRoot:{format:"bytes32"},parentHash:{format:"bytes32"},receiptsRoot:{format:"bytes32"},sha3Uncles:{format:"bytes32"},size:{format:"uint"},stateRoot:{format:"bytes32"},timestamp:{format:"uint"},totalDifficulty:{format:"uint"},transactions:{type:"array",items:{format:"bytes32"}},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},FRe)},withdrawalsRoot:{format:"bytes32"}}},hj={type:"object",properties:{removed:{format:"bool"},logIndex:{format:"uint"},transactionIndex:{format:"uint"},transactionHash:{format:"bytes32"},blockHash:{format:"bytes32"},blockNumber:{format:"uint"},address:{format:"address"},data:{format:"bytes"},topics:{type:"array",items:{format:"bytes32"}}}},GTt={type:"object",properties:{startingBlock:{format:"string"},currentBlock:{format:"string"},highestBlock:{format:"string"},knownStates:{format:"string"},pulledStates:{format:"string"}}},pj={type:"object",properties:{transactionHash:{format:"bytes32"},transactionIndex:{format:"uint"},blockHash:{format:"bytes32"},blockNumber:{format:"uint"},from:{format:"address"},to:{format:"address"},cumulativeGasUsed:{format:"uint"},gasUsed:{format:"uint"},effectiveGasPrice:{format:"uint"},contractAddress:{format:"address"},logs:{type:"array",items:Object.assign({},hj)},logsBloom:{format:"bytes"},root:{format:"bytes"},status:{format:"uint"},type:{format:"uint"}}},KTt={type:"object",properties:{messageHash:{format:"bytes"},r:{format:"bytes32"},s:{format:"bytes32"},v:{format:"bytes"},message:{format:"bytes"},signature:{format:"bytes"}}},YTt={type:"object",properties:{oldestBlock:{format:"uint"},baseFeePerGas:{type:"array",items:{format:"uint"}},reward:{type:"array",items:{type:"array",items:{format:"uint"}}},gasUsedRatio:{type:"array",items:{type:"number"}}}},XTt={type:"object",properties:{key:{format:"bytes32"},value:{format:"uint"},proof:{type:"array",items:{format:"bytes32"}}}},QTt={type:"object",properties:{balance:{format:"uint"},codeHash:{format:"bytes32"},nonce:{format:"uint"},storageHash:{format:"bytes32"},accountProof:{type:"array",items:{format:"bytes32"}},storageProof:{type:"array",items:Object.assign({},XTt)}}};function gf(t,e=bd,n={transactionSchema:Yte,fillInputAndData:!1}){var r,s;let a=k2({},t);if(gr(t==null?void 0:t.common)||(a.common=Object.assign({},t.common),gr((r=t.common)===null||r===void 0?void 0:r.customChain)||(a.common.customChain=Object.assign({},t.common.customChain))),a=qr((s=n.transactionSchema)!==null&&s!==void 0?s:Yte,a,e),!gr(a.data)&&!gr(a.input)&&j1(a.data)!==j1(a.input))throw new JOe({data:Gi(a.data),input:Gi(a.input)});return n.fillInputAndData&&(gr(a.data)?gr(a.input)||(a.data=a.input):a.input=a.data),gr(a.gasLimit)||(a.gas=a.gasLimit,delete a.gasLimit),a}function ZTt(t,e,n={fillInputAndData:!1}){return{raw:qr({format:"bytes"},t,e),tx:gf(Object.assign(Object.assign({},o5.fromSerializedData(fo(t)).toJSON()),{hash:Gi(kN(fo(t))),type:zTt(fo(t))}),e,{fillInputAndData:n.fillInputAndData,transactionSchema:n.transactionSchema})}}var ece=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function tce(t,e){return ece(this,void 0,void 0,function*(){const n=yield _Tt(t.requestManager);return qr({format:"uint"},n,e)})}function JTt(t,e){return ece(this,void 0,void 0,function*(){const n=yield kTt(t.requestManager);return qr({format:"uint"},n,e)})}const ePt=t=>ece(void 0,void 0,void 0,function*(){return TTt(t.requestManager)});var _W=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class ORe extends af{getId(e=this.defaultReturnFormat){return _W(this,void 0,void 0,function*(){return tce(this,e)})}getPeerCount(e=this.defaultReturnFormat){return _W(this,void 0,void 0,function*(){return JTt(this,e)})}isListening(){return _W(this,void 0,void 0,function*(){return ePt(this)})}}const MN="ALLEVENTS",Xte={name:MN,signature:"",type:"event",inputs:[]},pU={bytes:S1.HEX,number:ap.NUMBER};var MRe=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function tPt(t,e,n){return MRe(this,void 0,void 0,function*(){var r,s,a,o;const l=yield uLe(e,e.defaultBlock,!1,xi);if(gr(l.baseFeePerGas))throw new F8t;let c;if(gr(t.gasPrice)&&BigInt(l.baseFeePerGas)===BigInt(0)&&(c=yield uce(e,n)),!gr(t.gasPrice)||!gr(c)){const u=qr({format:"uint"},(r=t.gasPrice)!==null&&r!==void 0?r:c,n);return{maxPriorityFeePerGas:u,maxFeePerGas:u}}return{maxPriorityFeePerGas:qr({format:"uint"},(s=t.maxPriorityFeePerGas)!==null&&s!==void 0?s:e.defaultMaxPriorityFeePerGas,n),maxFeePerGas:qr({format:"uint"},(a=t.maxFeePerGas)!==null&&a!==void 0?a:BigInt(l.baseFeePerGas)*BigInt(2)+BigInt((o=t.maxPriorityFeePerGas)!==null&&o!==void 0?o:e.defaultMaxPriorityFeePerGas),n)}})}function RRe(t,e,n){return MRe(this,void 0,void 0,function*(){const r=LRe(t,e);if(!gr(r)){if(r.startsWith("-"))throw new N1e(r);if(Number(r)<0||Number(r)>127)throw new N1e(r);if(gr(t.gasPrice)&&(r==="0x0"||r==="0x1"))return{gasPrice:yield uce(e,n),maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};if(r==="0x2")return Object.assign({gasPrice:void 0},yield tPt(t,e,n))}})}var nce=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const Qte=(t,e,n,r)=>{if(n!==void 0&&t in n&&n[t]!==void 0){if(typeof n[t]=="string"&&ih(n[t]))return n[t];if(!ja(n[t])&&IMe(n[t])){if(e.wallet){const s=e.wallet.get(qr({format:"uint"},n[t],pU));if(!gr(s))return s.address;throw new A1e}throw new A1e}else throw t==="from"?new p8t(n.from):new m8t(n.to)}if(t==="from"){if(!gr(r))return hU(r);if(!gr(e.defaultAccount))return e.defaultAccount}},nPt=(t,e,...n)=>nce(void 0,[t,e,...n],void 0,function*(r,s,a=r.defaultReturnFormat){if(gr(s))throw new I8t;return fLe(r,s,r.defaultBlock,a)}),LRe=(t,e)=>{const n=UTt(t,e);if(!gr(n))return n;if(!gr(e.defaultTransactionType))return qr({format:"uint"},e.defaultTransactionType,xi)};function rPt(t){return nce(this,void 0,void 0,function*(){var e,n;let r=qr(IRe,t.transaction,t.web3Context.defaultReturnFormat);if(gr(r.from)&&(r.from=Qte("from",t.web3Context,void 0,t.privateKey)),gr(r.nonce)&&(r.nonce=yield nPt(t.web3Context,r.from,xi)),gr(r.value)&&(r.value="0x0"),gr(r.data))gr(r.input)?r.input="0x":r.input.startsWith("0x")||(r.input=`0x${r.input}`);else{if(!gr(r.input)&&r.data!==r.input)throw new JOe({data:Gi(r.data),input:Gi(r.input)});r.data.startsWith("0x")||(r.data=`0x${r.data}`)}if(gr(r.common)){if(t.web3Context.defaultCommon){const s=t.web3Context.defaultCommon,a=s.customChain.chainId,o=s.customChain.networkId,l=s.customChain.name;r.common=Object.assign(Object.assign({},s),{customChain:{chainId:a,networkId:o,name:l}})}gr(r.chain)&&(r.chain=t.web3Context.defaultChain),gr(r.hardfork)&&(r.hardfork=t.web3Context.defaultHardfork)}if(gr(r.chainId)&&gr((e=r.common)===null||e===void 0?void 0:e.customChain.chainId)&&(r.chainId=yield pLe(t.web3Context,xi)),gr(r.networkId)&&(r.networkId=(n=t.web3Context.defaultNetworkId)!==null&&n!==void 0?n:yield tce(t.web3Context,xi)),gr(r.gasLimit)&&!gr(r.gas)&&(r.gasLimit=r.gas),r.type=LRe(r,t.web3Context),gr(r.accessList)&&(r.type==="0x1"||r.type==="0x2")&&(r.accessList=[]),t.fillGasPrice&&(r=Object.assign(Object.assign({},r),yield RRe(r,t.web3Context,xi))),gr(r.gas)&&gr(r.gasLimit)&&t.fillGasLimit){const s=yield hce(t.web3Context,r,"latest",xi);r=Object.assign(Object.assign({},r),{gas:qr({format:"uint"},s,xi)})}return r})}const sPt=t=>nce(void 0,void 0,void 0,function*(){var e;return((e=t.web3Context.transactionBuilder)!==null&&e!==void 0?e:rPt)(Object.assign(Object.assign({},t),{transaction:t.transaction}))});var rce=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function Zte(t,e,n){const r=t.transactionPollingInterval,[s,a]=WMe(()=>rce(this,void 0,void 0,function*(){let l;try{l=yield dce(t,pU)}catch(u){console.warn("An error happen while trying to get the block number",u);return}const c=l-e;if(c>=t.transactionBlockTimeout)return new nMe({starterBlockNumber:e,numberOfBlocks:c,transactionHash:n})}),r);return[a,{clean:()=>{clearInterval(s)}}]}function iPt(t,e,n){return rce(this,void 0,void 0,function*(){var r;let s=!0,a,o;function l(u,d){d&&console.warn("error happened at subscription. So revert to polling...",d),o.clean(),s=!1;const[f,x]=Zte(t,e,n);o.clean=x.clean,f.catch(g=>u(g))}try{a=yield(r=t.subscriptionManager)===null||r===void 0?void 0:r.subscribe("newHeads"),o={clean:()=>{var u;a.id&&((u=t.subscriptionManager)===null||u===void 0||u.removeSubscription(a).then(()=>{}).catch(()=>{}))}}}catch{return Zte(t,e,n)}return[new Promise((u,d)=>{try{a.on("data",f=>{if(s=!1,!(f!=null&&f.number))return;const x=Number(BigInt(f.number)-BigInt(e));x>=t.transactionBlockTimeout&&d(new nMe({starterBlockNumber:e,numberOfBlocks:x,transactionHash:n}))}),a.on("error",f=>{l(d,f)})}catch(f){l(d,f)}setTimeout(()=>{s&&l(d)},t.blockHeaderTimeout*1e3)}),o]})}function DRe(t,e){return rce(this,void 0,void 0,function*(){var n,r;const{provider:s}=t.requestManager;let a;const o=yield dce(t,pU);return!((r=(n=s).supportsSubscriptions)===null||r===void 0)&&r.call(n)&&t.enableExperimentalFeatures.useSubscriptionWhenCheckingBlockTimeout?a=yield iPt(t,o,e):a=Zte(t,o,e),a})}var aPt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function Jte(t,e,n){return aPt(this,void 0,void 0,function*(){const[r,s]=Ole(t.transactionSendTimeout,new O8t({numberOfSeconds:t.transactionSendTimeout/1e3,transactionHash:n})),[a,o]=yield DRe(t,n);try{return yield Promise.race([e(),s,a])}finally{clearTimeout(r),o.clean()}})}var mbe=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function BRe(t,e,n,r){return mbe(this,void 0,void 0,function*(){var s;const a=(s=t.transactionReceiptPollingInterval)!==null&&s!==void 0?s:t.transactionPollingInterval,[o,l]=Fle(()=>mbe(this,void 0,void 0,function*(){try{return(r??dLe)(t,e,n)}catch(x){console.warn("An error happen while trying to get the transaction receipt",x);return}}),a),[c,u]=Ole(t.transactionPollingTimeout,new tMe({numberOfSeconds:t.transactionPollingTimeout/1e3,transactionHash:e})),[d,f]=yield DRe(t,e);try{return yield Promise.race([o,u,d])}finally{c&&clearTimeout(c),l&&clearInterval(l),f.clean()}})}var oPt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const cM=({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})=>{var a;let o=1;const l=setInterval(()=>{oPt(void 0,void 0,void 0,function*(){if(o>=t.transactionConfirmationBlocks){clearInterval(l);return}const c=yield PRe(t.requestManager,ac(BigInt(e.blockNumber)+BigInt(o)),!1);c!=null&&c.hash&&(o+=1,n.emit("confirmation",{confirmations:qr({format:"uint"},o,s),receipt:qr(r??pj,e,s),latestBlockHash:qr({format:"bytes32"},c.hash,s)}))})},(a=t.transactionReceiptPollingInterval)!==null&&a!==void 0?a:t.transactionPollingInterval)};var xbe=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const lPt=({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})=>{let a=!0,o;setImmediate(()=>{var l;(l=t.subscriptionManager)===null||l===void 0||l.subscribe("newHeads").then(c=>{c.on("data",u=>xbe(void 0,void 0,void 0,function*(){var d;if(a=!1,!(u!=null&&u.number)||o===(u==null?void 0:u.parentHash))return;o=u==null?void 0:u.parentHash;const f=BigInt(u.number)-BigInt(e.blockNumber)+BigInt(1);n.emit("confirmation",{confirmations:qr({format:"uint"},f,s),receipt:qr(r??pj,e,s),latestBlockHash:qr({format:"bytes32"},u.parentHash,s)}),f>=t.transactionConfirmationBlocks&&(yield(d=t.subscriptionManager)===null||d===void 0?void 0:d.removeSubscription(c))})),c.on("error",()=>xbe(void 0,void 0,void 0,function*(){var u;yield(u=t.subscriptionManager)===null||u===void 0?void 0:u.removeSubscription(c),a=!1,cM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,customTransactionReceiptSchema:r,returnFormat:s})}))}).catch(()=>{a=!1,cM({web3Context:t,transactionReceipt:e,customTransactionReceiptSchema:r,transactionPromiEvent:n,returnFormat:s})})}),setTimeout(()=>{a&&cM({web3Context:t,transactionReceipt:e,transactionPromiEvent:n,returnFormat:s})},t.blockHeaderTimeout*1e3)};function cPt(t,e,n,r,s,a){if(gr(n)||gr(n.blockHash))throw new M8t({receipt:n,blockHash:qr({format:"bytes32"},n==null?void 0:n.blockHash,s),transactionHash:qr({format:"bytes32"},r,s)});if(!n.blockNumber)throw new R8t({receipt:n});e.emit("confirmation",{confirmations:qr({format:"uint"},1,s),receipt:qr(a??pj,n,s),latestBlockHash:qr({format:"bytes32"},n.blockHash,s)});const o=t.requestManager.provider;o&&"supportsSubscriptions"in o&&o.supportsSubscriptions()?lPt({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s}):cM({web3Context:t,transactionReceipt:n,transactionPromiEvent:e,customTransactionReceiptSchema:a,returnFormat:s})}const mU=t=>!si(t)&&typeof t=="object"&&!si(t.type)&&t.type==="error",sce=t=>!si(t)&&typeof t=="object"&&!si(t.type)&&t.type==="event",xU=t=>!si(t)&&typeof t=="object"&&!si(t.type)&&t.type==="function",uPt=t=>!si(t)&&typeof t=="object"&&!si(t.type)&&t.type==="constructor",dPt=t=>typeof t=="object"&&typeof t.components>"u"&&typeof t.name>"u",$Re=t=>t.includes("[]")?{type:"tuple[]",name:t.slice(0,-2)}:{type:"tuple",name:t},URe=t=>{const e=[];for(const n of Object.keys(t)){const r=t[n];typeof r=="object"?e.push(Object.assign(Object.assign({},$Re(n)),{components:URe(r)})):e.push({name:n,type:t[n]})}return e},ene=(t,e)=>{const n=[];return e.forEach(r=>{if(typeof r.components=="object"){if(!r.type.startsWith("tuple"))throw new Xi(`Invalid value given "${r.type}". Error: components found but type is not tuple.`);const s=r.type.indexOf("["),a=s>=0?r.type.substring(s):"",o=ene(t,r.components);n.push(`(${o.join(",")})${a}`)}else n.push(r.type)}),n},s1=t=>{var e,n,r,s;return mU(t)||sce(t)||xU(t)?!((e=t.name)===null||e===void 0)&&e.includes("(")?t.name:`${(n=t.name)!==null&&n!==void 0?n:""}(${ene(!1,(r=t.inputs)!==null&&r!==void 0?r:[]).join(",")})`:`(${ene(!1,(s=t.inputs)!==null&&s!==void 0?s:[]).join(",")})`},fPt=t=>{if(typeof t!="string"&&!mU(t))throw new Xi("Invalid parameter value in encodeErrorSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e)},ice=t=>{if(typeof t!="string"&&!sce(t))throw new Xi("Invalid parameter value in encodeEventSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e)};function ace(t,e){const n=t.exec(e);return n==null?void 0:n.groups}var zRe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,HRe=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,VRe=/^\(.+?\).*?$/,hPt=Object.defineProperty,pPt=(t,e,n)=>e in t?hPt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,s7=(t,e,n)=>(pPt(t,typeof e!="symbol"?e+"":e,n),n),mPt="abitype",xPt="0.7.1",nf=class extends Error{constructor(t,e={}){var a;const n=e.cause instanceof nf?e.cause.details:(a=e.cause)!=null&&a.message?e.cause.message:e.details,r=e.cause instanceof nf&&e.cause.docsPath||e.docsPath,s=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],`Version: ${mPt}@${xPt}`].join(`
`);super(s),s7(this,"details"),s7(this,"docsPath"),s7(this,"metaMessages"),s7(this,"shortMessage"),s7(this,"name","AbiTypeError"),e.cause&&(this.cause=e.cause),this.details=n,this.docsPath=r,this.metaMessages=e.metaMessages,this.shortMessage=t}},WRe=/^struct (?<name>[a-zA-Z0-9_]+) \{(?<properties>.*?)\}$/;function qRe(t){return WRe.test(t)}function gPt(t){return ace(WRe,t)}var gbe=new Set(["memory","indexed","storage","calldata"]),bPt=new Set(["calldata","memory","storage"]);function yPt(t,e){return e?`${e}:${t}`:t}var kW=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),vPt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,wPt=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,CPt=/^u?int$/;function hL(t,e){var f,x;const n=yPt(t,e==null?void 0:e.type);if(kW.has(n))return kW.get(n);const r=VRe.test(t),s=ace(r?wPt:vPt,t);if(!s)throw new nf("Invalid ABI parameter.",{details:t});if(s.name&&NPt(s.name))throw new nf("Invalid ABI parameter.",{details:t,metaMessages:[`"${s.name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},l=(e==null?void 0:e.structs)??{};let c,u={};if(r){c="tuple";const g=qC(s.type),y=[],v=g.length;for(let C=0;C<v;C++)y.push(hL(g[C],{structs:l}));u={components:y}}else if(s.type in l)c="tuple",u={components:l[s.type]};else if(CPt.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!GRe(c))throw new nf("Unknown type.",{metaMessages:[`Type "${c}" is not a valid ABI type.`]});if(s.modifier){if(!((x=(f=e==null?void 0:e.modifiers)==null?void 0:f.has)!=null&&x.call(f,s.modifier)))throw new nf("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s.modifier}" not allowed${e!=null&&e.type?` in "${e.type}" type`:""}.`]});if(bPt.has(s.modifier)&&!APt(c,!!s.array))throw new nf("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${s.modifier}" not allowed${e!=null&&e.type?` in "${e.type}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${s.modifier}" was given.`]})}const d={type:`${c}${s.array??""}`,...a,...o,...u};return kW.set(n,d),d}function qC(t,e=[],n="",r=0){if(t===""){if(n==="")return e;if(r!==0)throw new nf("Unbalanced parentheses.",{metaMessages:[`"${n.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`});return[...e,n.trim()]}const s=t.length;for(let a=0;a<s;a++){const o=t[a],l=t.slice(a+1);switch(o){case",":return r===0?qC(l,[...e,n.trim()]):qC(l,e,`${n}${o}`,r);case"(":return qC(l,e,`${n}${o}`,r+1);case")":return qC(l,e,`${n}${o}`,r-1);default:return qC(l,e,`${n}${o}`,r)}}return[]}function GRe(t){return t==="address"||t==="bool"||t==="function"||t==="string"||zRe.test(t)||HRe.test(t)}var SPt=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function NPt(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||zRe.test(t)||HRe.test(t)||SPt.test(t)}function APt(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function jPt(t){const e={},n=t.length;for(let o=0;o<n;o++){const l=t[o];if(!qRe(l))continue;const c=gPt(l);if(!c)throw new nf("Invalid struct signature.",{details:l});const u=c.properties.split(";"),d=[],f=u.length;for(let x=0;x<f;x++){const y=u[x].trim();if(!y)continue;const v=hL(y,{type:"struct"});d.push(v)}if(!d.length)throw new nf("Invalid struct signature.",{details:l,metaMessages:["No properties exist."]});e[c.name]=d}const r={},s=Object.entries(e),a=s.length;for(let o=0;o<a;o++){const[l,c]=s[o];r[l]=KRe(c,e)}return r}var EPt=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?$/;function KRe(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const o=t[a];if(VRe.test(o.type))r.push(o);else{const c=ace(EPt,o.type);if(!(c!=null&&c.type))throw new nf("Invalid ABI parameter.",{details:JSON.stringify(o,null,2),metaMessages:["ABI parameter type is invalid."]});const{array:u,type:d}=c;if(d in e){if(n.has(d))throw new nf("Circular reference detected.",{metaMessages:[`Struct "${d}" is a circular reference.`]});r.push({...o,type:`tuple${u??""}`,components:KRe(e[d]??[],e,new Set([...n,d]))})}else if(GRe(d))r.push(o);else throw new nf("Unknown type.",{metaMessages:[`Type "${d}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]})}}return r}function _Pt(t){let e;if(typeof t=="string")e=hL(t,{modifiers:gbe});else{const n=jPt(t),r=t.length;for(let s=0;s<r;s++){const a=t[s];if(!qRe(a)){e=hL(a,{modifiers:gbe,structs:n});break}}}if(!e)throw new nf("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(t,null,2)})`,docsPath:"/api/human.html#parseabiparameter-1"});return e}const ol=32;function tne(t=0){var e;if(((e=globalThis.Buffer)===null||e===void 0?void 0:e.alloc)!==void 0){const n=globalThis.Buffer.alloc(t);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}return new Uint8Array(t)}function YRe(t){var e,n;return Object.assign(Object.assign({},t),{name:(e=t.name)!==null&&e!==void 0?e:"",components:(n=t.components)===null||n===void 0?void 0:n.map(r=>YRe(r))})}function kPt(t){return!si(t)&&typeof t=="object"&&!si(t.type)&&typeof t.type=="string"}function XRe(t){return t.map(e=>{var n;if(kPt(e))return e;if(typeof e=="string")return YRe(_Pt(e.replace(/tuple/,"")));if(dPt(e)){const r=Object.keys(e)[0],s=$Re(r);return s.name=(n=s.name)!==null&&n!==void 0?n:"",Object.assign(Object.assign({},s),{components:URe(e[r])})}throw new Xi("Invalid abi")})}function oce(t){const e=t.type.lastIndexOf("["),n=t.type.substring(0,e),r=t.type.substring(e);let s=-1;if(r!=="[]"&&(s=Number(r.slice(1,-1)),isNaN(s)))throw new Xi("Invalid fixed array size",{size:r});return{param:{type:n,name:"",components:t.components},size:s}}function pL(t){var e,n;return t.type==="string"||t.type==="bytes"||t.type.endsWith("[]")?!0:t.type==="tuple"?(n=(e=t.components)===null||e===void 0?void 0:e.some(pL))!==null&&n!==void 0?n:!1:t.type.endsWith("]")?pL(oce(t).param):!1}const QRe=20,ZRe=ol-QRe;function TPt(t,e){if(typeof e!="string")throw new Xi("address type expects string as input type",{value:e,name:t.name,type:t.type});let n=e.toLowerCase();if(n.startsWith("0x")||(n=`0x${n}`),!ih(n))throw new Xi("provided input is not valid address",{value:e,name:t.name,type:t.type});const r=F5(n),s=tne(ol);return s.set(r,ZRe),{dynamic:!1,encoded:s}}function PPt(t,e){const n=e.subarray(ZRe,ol);if(n.length!==QRe)throw new Xi("Invalid decoding input, not enough bytes to decode address",{bytes:e});const r=L1(n);return{result:wx(r),encoded:e.subarray(ol),consumed:ol}}const d2=new Map;let JI=BigInt(256);for(let t=8;t<=256;t+=8)d2.set(`uint${t}`,{min:BigInt(0),max:JI-BigInt(1)}),d2.set(`int${t}`,{min:-JI/BigInt(2),max:JI/BigInt(2)-BigInt(1)}),JI*=BigInt(256);d2.set("int",d2.get("int256"));d2.set("uint",d2.get("uint256"));const JRe=BigInt(1)<<BigInt(256);function IPt(t,e=ol){let n;return t<0?n=(JRe+t).toString(16):n=t.toString(16),n=_N(n,e*2),F5(n)}function FPt(t,e){const n=L1(t),r=BigInt(n);return r<=e?r:r-JRe}function VT(t,e){let n;try{n=mw(e)}catch{throw new Xi("provided input is not number value",{type:t.type,value:e,name:t.name})}const r=d2.get(t.type);if(!r)throw new Xi("provided abi contains invalid number datatype",{type:t.type});if(n<r.min)throw new Xi("provided input is less then minimum for given type",{type:t.type,value:e,name:t.name,minimum:r.min.toString()});if(n>r.max)throw new Xi("provided input is greater then maximum for given type",{type:t.type,value:e,name:t.name,maximum:r.max.toString()});return{dynamic:!1,encoded:IPt(n)}}function RN(t,e){if(e.length<ol)throw new Xi("Not enough bytes left to decode",{param:t,bytesLeft:e.length});const n=e.subarray(0,ol),r=d2.get(t.type);if(!r)throw new Xi("provided abi contains invalid number datatype",{type:t.type});const s=FPt(n,r.max);if(s<r.min)throw new Xi("decoded value is less then minimum for given type",{type:t.type,value:s,name:t.name,minimum:r.min.toString()});if(s>r.max)throw new Xi("decoded value is greater then maximum for given type",{type:t.type,value:s,name:t.name,maximum:r.max.toString()});return{result:s,encoded:e.subarray(ol),consumed:ol}}function OPt(t,e){let n;try{n=LMe(e)}catch(r){if(r instanceof yle)throw new Xi("provided input is not valid boolean value",{type:t.type,value:e,name:t.name})}return VT({type:"uint8",name:""},Number(n))}function MPt(t,e){const n=RN({type:"uint8",name:""},e);if(n.result>1||n.result<0)throw new Xi("Invalid boolean value encoded",{boolBytes:e.subarray(0,ol),numberResult:n});return{result:n.result===BigInt(1),encoded:n.encoded,consumed:ol}}const RPt=32;function eLe(t,e){if(typeof e=="string"&&e.length%2!==0&&(e+="0"),!E2(e))throw new Xi("provided input is not valid bytes value",{type:t.type,value:e,name:t.name});const n=hx(e),[,r]=t.type.split("bytes");if(r){if(Number(r)>RPt||Number(r)<1)throw new Xi("invalid bytes type. Static byte type can have between 1 and 32 bytes",{type:t.type});if(Number(r)<n.length)throw new Xi("provided input size is different than type size",{type:t.type,value:e,name:t.name});const o=tne(ol);return o.set(n),{dynamic:!1,encoded:o}}const s=Math.ceil(n.length/ol),a=tne(ol+s*ol);return a.set(VT({type:"uint32",name:""},n.length).encoded),a.set(n,ol),{dynamic:!0,encoded:a}}function tLe(t,e){const[,n]=t.type.split("bytes");let r=Number(n),s=e,a=1,o=0;if(!r){const l=RN({type:"uint32",name:""},s);r=Number(l.result),o+=l.consumed,s=l.encoded,a=Math.ceil(r/ol)}if(r>e.length)throw new Xi("there is not enough data to decode",{type:t.type,encoded:e,size:r});return{result:Gi(s.subarray(0,r)),encoded:s.subarray(a*ol),consumed:o+a*ol}}function LPt(t,e){if(typeof e!="string")throw new Xi("invalid input, should be string",{input:e});const n=Tle(e);return eLe({type:"bytes",name:""},n)}function DPt(t,e){const n=tLe({type:"bytes",name:""},e);return{result:sU(n.result),encoded:n.encoded,consumed:n.consumed}}function nLe(t){let e=0,n=0;const r=[],s=[];for(const a of t)a.dynamic?e+=ol:e+=a.encoded.length;for(const a of t)a.dynamic?(r.push(VT({type:"uint256",name:""},e+n)),s.push(a),n+=a.encoded.length):r.push(a);return Ad(...r.map(a=>a.encoded),...s.map(a=>a.encoded))}function BPt(t,e){if(!Array.isArray(e))throw new Xi("Expected value to be array",{abi:t,values:e});const{size:n,param:r}=oce(t),s=e.map(l=>nne(r,l)),a=n===-1,o=s.length>0&&s[0].dynamic;if(!a&&e.length!==n)throw new Xi("Given arguments count doesn't match array length",{arrayLength:n,argumentsLength:e.length});if(a||o){const l=nLe(s);if(a){const c=VT({type:"uint256",name:""},s.length).encoded;return{dynamic:!0,encoded:s.length>0?Ad(c,l):c}}return{dynamic:!0,encoded:l}}return{dynamic:!1,encoded:Ad(...s.map(l=>l.encoded))}}function $Pt(t,e){let{size:n,param:r}=oce(t);const s=n===-1;let a=0;const o=[];let l=e;if(s){const u=RN({type:"uint32",name:""},e);n=Number(u.result),a=u.consumed,l=u.encoded}if(pL(r)){for(let u=0;u<n;u+=1){const d=RN({type:"uint32",name:""},l.subarray(u*ol));a+=d.consumed;const f=mL(r,l.subarray(Number(d.result)));a+=f.consumed,o.push(f.result)}return{result:o,encoded:l.subarray(a),consumed:a}}for(let u=0;u<n;u+=1){const d=mL(r,e.subarray(a));a+=d.consumed,o.push(d.result)}return{result:o,encoded:e.subarray(a),consumed:a}}function nne(t,e){if(t.type==="string")return LPt(t,e);if(t.type==="bool")return OPt(t,e);if(t.type==="address")return TPt(t,e);if(t.type==="tuple")return lce(t,e);if(t.type.endsWith("]"))return BPt(t,e);if(t.type.startsWith("bytes"))return eLe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return VT(t,e);throw new Xi("Unsupported",{param:t,value:e})}function mL(t,e){if(t.type==="string")return DPt(t,e);if(t.type==="bool")return MPt(t,e);if(t.type==="address")return PPt(t,e);if(t.type==="tuple")return rLe(t,e);if(t.type.endsWith("]"))return $Pt(t,e);if(t.type.startsWith("bytes"))return tLe(t,e);if(t.type.startsWith("uint")||t.type.startsWith("int"))return RN(t,e);throw new Xi("Unsupported",{param:t,bytes:e})}function lce(t,e){var n,r,s;let a=!1;if(!Array.isArray(e)&&typeof e!="object")throw new Xi("param must be either Array or Object",{param:t,input:e});const o=e,l=[];for(let c=0;c<((r=(n=t.components)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0);c+=1){const u=t.components[c];let d;if(Array.isArray(o)){if(c>=o.length)throw new Xi("input param length missmatch",{param:t,input:e});d=nne(u,o[c])}else{const f=o[(s=u.name)!==null&&s!==void 0?s:""];if(f==null)throw new Xi("missing input defined in abi",{param:t,input:e,paramName:u.name});d=nne(u,f)}d.dynamic&&(a=!0),l.push(d)}return a?{dynamic:!0,encoded:nLe(l)}:{dynamic:!1,encoded:Ad(...l.map(c=>c.encoded))}}function rLe(t,e){const n={__length__:0};let r=0;if(!t.components)return{result:n,encoded:e,consumed:r};let s=0;for(const[a,o]of t.components.entries()){let l;if(pL(o)){const c=RN({type:"uint32",name:""},e.subarray(r));l=mL(o,e.subarray(Number(c.result))),r+=c.consumed,s+=l.consumed}else l=mL(o,e.subarray(r)),r+=l.consumed;n.__length__+=1,n[a]=l.result,o.name&&o.name!==""&&(n[o.name]=l.result)}return{encoded:e.subarray(r+s),result:n,consumed:r+s}}function UPt(t,e,n){const r=XRe(t),s=F5(e);return rLe({type:"tuple",name:"",components:r},s).result}function sLe(t){const e=[];return t.forEach(n=>{if(Array.isArray(n)){const r=sLe(n);e.push({type:"tuple",components:r,name:""})}else e.push({type:j1(n,!0)})}),e}function gU(t,e){if((t==null?void 0:t.length)!==e.length)throw new Xi("Invalid number of values received for given ABI",{expected:t==null?void 0:t.length,received:e.length});const n=XRe(t);return L1(lce({type:"tuple",name:"",components:n},e).encoded)}function zPt(t){try{const e=sLe(t);return L1(lce({type:"tuple",name:"",components:e},t).encoded)}catch{throw new Xi("Could not infer types from given params",{params:t})}}const rne=(t,e)=>gU([t],[e]),iLe=(t,e,n)=>{try{if(t.length>0&&(!e||e==="0x"||e==="0X"))throw new Xi("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.");return UPt(t,`0x${e.replace(/0x/i,"")}`,n)}catch(r){throw new Xi(`Parameter decoding error: ${r.message}`,{internalErr:r})}},w3=(t,e)=>iLe(t,e,!1),aLe=(t,e)=>w3([t],e)[0],A_=t=>{if(typeof t!="string"&&!xU(t))throw new Xi("Invalid parameter value in encodeFunctionSignature");let e;return t&&(typeof t=="function"||typeof t=="object")?e=s1(t):e=t,ah(e).slice(0,10)},HPt=(t,e)=>{var n;if(!xU(t))throw new Xi("Invalid parameter value in encodeFunctionCall");return`${A_(t)}${gU((n=t.inputs)!==null&&n!==void 0?n:[],e??[]).replace("0x","")}`},sne=(t,e,n=!0)=>{const r=n&&e&&e.length>=10&&e.startsWith("0x")?e.slice(10):e;if(!t.inputs)throw new yd("No inputs found in the ABI");const s=w3([...t.inputs],r);return Object.assign(Object.assign({},s),{__method__:s1(t)})},VPt=(t,e)=>{if(t.type==="constructor")return e;if(!e)return null;const n=e.length>=2?e.slice(2):e;if(!t.outputs)return null;const r=w3([...t.outputs],n);return r.__length__===1?r[0]:r},WPt=["bool","string","int","uint","address","fixed","ufixed"],qPt=(t,e)=>t==="string"?e:aLe(t,e),oLe=(t,e,n)=>{const r=Array.isArray(n)?n:[n],s={},a={};for(const[x,g]of t.entries())g.indexed?s[x]=g:a[x]=g;const o=e?iLe(Object.values(a),e,!0):{__length__:0},l=r.length-Object.keys(s).length,c=Object.values(s).map((x,g)=>WPt.some(y=>x.type.startsWith(y))?qPt(x.type,r[g+l]):r[g+l]),u={__length__:0};let d=0,f=0;for(const[x,g]of t.entries())u[x]=g.type==="string"?"":void 0,s[x]&&(u[x]=c[d],d+=1),a[x]&&(u[x]=o[String(f)],f+=1),g.name&&(u[g.name]=u[x]),u.__length__+=1;return u},uM=(t,e)=>{if(e!=null&&e.data){let n,r,s;try{const a=e.data.slice(0,10),o=t.find(l=>fPt(l).startsWith(a));o!=null&&o.inputs?(n=o.name,r=s1(o),s=w3([...o.inputs],e.data.substring(10))):e.data.startsWith("0x08c379a0")?(n="Error",r="Error(string)",s=w3([{name:"message",type:"string"}],e.data.substring(10))):e.data.startsWith("0x4e487b71")?(n="Panic",r="Panic(uint256)",s=w3([{name:"code",type:"uint256"}],e.data.substring(10))):console.error("No matching error abi found for error data",e.data)}catch(a){console.error(a)}n&&e.setDecodedProperties(n,r,s)}};var GPt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const KPt=(t,e)=>{var n,r,s,a,o;if(t instanceof g3&&t.cause instanceof Y$){if(e!==void 0){const l=e.filter(c=>mU(c));return uM(l,t.cause),{reason:t.cause.message,signature:(n=t.cause.data)===null||n===void 0?void 0:n.slice(0,10),data:(r=t.cause.data)===null||r===void 0?void 0:r.substring(10),customErrorName:t.cause.errorName,customErrorDecodedSignature:t.cause.errorSignature,customErrorArguments:t.cause.errorArgs}}return{reason:t.cause.message,signature:(s=t.cause.data)===null||s===void 0?void 0:s.slice(0,10),data:(a=t.cause.data)===null||a===void 0?void 0:a.substring(10)}}if(t instanceof X$&&!Array.isArray((o=t.cause)===null||o===void 0?void 0:o.errors)&&t.cause!==void 0)return t.cause.message;throw t};function lLe(t,e,n){return GPt(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){try{yield fce(r,s,r.defaultBlock,o);return}catch(l){return KPt(l,a)}})}var YPt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function TW(t,e,n,r,s,a){return YPt(this,void 0,void 0,function*(){let o=a;o===void 0&&t.handleRevert&&e!==void 0&&(o=yield lLe(t,e,s));let l;if(o===void 0)l=new QOe(n);else if(typeof o=="string")l=new VR(o,void 0,n);else if(o.customErrorName!==void 0&&o.customErrorDecodedSignature!==void 0&&o.customErrorArguments!==void 0){const c=o;l=new XOe(c.reason,c.customErrorName,c.customErrorDecodedSignature,c.customErrorArguments,c.signature,n,c.data)}else l=new VR(o.reason,o.signature,n,o.data);return l})}const cce=(t,e,n,r=bd)=>{var s,a,o,l,c,u;let d=Object.assign({},t);const f=qr(hj,e,r);if([MN,"allEvents"].includes(d.name)){const g=n.find(y=>y.signature===e.topics[0]);g?d=g:d={anonymous:!0}}if(d.inputs=(a=(s=d.inputs)!==null&&s!==void 0?s:t.inputs)!==null&&a!==void 0?a:[],!d.anonymous){let g=0;((o=d.inputs)!==null&&o!==void 0?o:[]).forEach(y=>{y.indexed&&(g+=1)}),g>0&&(e!=null&&e.topics)&&(e==null?void 0:e.topics.length)!==g+1&&(d=Object.assign(Object.assign({},d),{anonymous:!0,inputs:[]}))}const x=d.anonymous?e.topics:((l=e.topics)!==null&&l!==void 0?l:[]).slice(1);return Object.assign(Object.assign({},f),{returnValues:oLe([...(c=d.inputs)!==null&&c!==void 0?c:[]],e.data,x),event:d.name,signature:!d.anonymous&&((u=e.topics)===null||u===void 0?void 0:u.length)>0&&e.topics[0]?e.topics[0]:void 0,raw:{data:e.data,topics:e.topics}})};var jv=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class cLe{constructor({options:e,web3Context:n,promiEvent:r,returnFormat:s}){this.options={checkRevertBeforeSending:!0},this.options=e,this.web3Context=n,this.promiEvent=r,this.returnFormat=s}getReceiptWithEvents(e){var n,r;const s=Object.assign({},e??{});if(!((n=this.options)===null||n===void 0)&&n.contractAbi&&s.logs&&s.logs.length>0){s.events={};for(const a of s.logs){const o=cce(Xte,a,(r=this.options)===null||r===void 0?void 0:r.contractAbi,this.returnFormat);o.event&&(s.events[o.event]=o)}}return s}checkRevertBeforeSending(e){return jv(this,void 0,void 0,function*(){if(this.options.checkRevertBeforeSending!==!1){let n=e;gr(e.data)&&gr(e.input)&&gr(e.gas)&&(n=Object.assign(Object.assign({},e),{gas:21e3}));const r=yield lLe(this.web3Context,n,this.options.contractAbi);if(r!==void 0)throw yield TW(this.web3Context,e,void 0,void 0,this.options.contractAbi,r)}})}emitSending(e){this.promiEvent.listenerCount("sending")>0&&this.promiEvent.emit("sending",e)}populateGasPrice(e){return jv(this,arguments,void 0,function*({transactionFormatted:n,transaction:r}){var s;let a=n;return!this.web3Context.config.ignoreGasPricing&&!(!((s=this.options)===null||s===void 0)&&s.ignoreGasPricing)&&gr(n.gasPrice)&&(gr(r.maxPriorityFeePerGas)||gr(r.maxFeePerGas))&&(a=Object.assign(Object.assign({},n),yield RRe(n,this.web3Context,xi))),a})}signAndSend(e){return jv(this,arguments,void 0,function*({wallet:n,tx:r}){if(n){const s=yield n.signTransaction(r);return Jte(this.web3Context,()=>jv(this,void 0,void 0,function*(){return TRe(this.web3Context.requestManager,s.rawTransaction)}),s.transactionHash)}return Jte(this.web3Context,()=>jv(this,void 0,void 0,function*(){return tTt(this.web3Context.requestManager,r)}))})}emitSent(e){this.promiEvent.listenerCount("sent")>0&&this.promiEvent.emit("sent",e)}emitTransactionHash(e){this.promiEvent.listenerCount("transactionHash")>0&&this.promiEvent.emit("transactionHash",e)}emitReceipt(e){this.promiEvent.listenerCount("receipt")>0&&this.promiEvent.emit("receipt",e)}handleError(e){return jv(this,arguments,void 0,function*({error:n,tx:r}){var s;let a=n;return a instanceof g3&&this.web3Context.handleRevert&&(a=yield TW(this.web3Context,r,void 0,void 0,(s=this.options)===null||s===void 0?void 0:s.contractAbi)),(a instanceof X$||a instanceof g3||a instanceof XOe||a instanceof QOe||a instanceof VR||a instanceof tMe)&&this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",a),a})}emitConfirmation({receipt:e,transactionHash:n,customTransactionReceiptSchema:r}){this.promiEvent.listenerCount("confirmation")>0&&cPt(this.web3Context,this.promiEvent,e,n,this.returnFormat,r)}handleResolve(e){return jv(this,arguments,void 0,function*({receipt:n,tx:r}){var s,a,o;if(!((s=this.options)===null||s===void 0)&&s.transactionResolver)return(a=this.options)===null||a===void 0?void 0:a.transactionResolver(n);if(n.status===BigInt(0)){const l=yield TW(this.web3Context,r,n,void 0,(o=this.options)===null||o===void 0?void 0:o.contractAbi);throw this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",l),l}else return n})}}var Ba=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},XPt=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const QPt=t=>Ba(void 0,void 0,void 0,function*(){return kRe(t.requestManager)});function ZPt(t,e){return Ba(this,void 0,void 0,function*(){const n=yield $kt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function uce(t,e){return Ba(this,void 0,void 0,function*(){const n=yield Ukt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function JPt(t,e){return Ba(this,void 0,void 0,function*(){const n=yield zkt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function dce(t,e){return Ba(this,void 0,void 0,function*(){const n=yield Vkt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function eIt(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Bc(s)?s:qr({format:"uint"},s,xi),l=yield Wkt(n.requestManager,r,o);return qr({format:"uint"},l,a??n.defaultReturnFormat)})}function tIt(t,e,n){return Ba(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=qr({format:"uint"},a,xi),u=Bc(o)?o:qr({format:"uint"},o,xi),d=yield qkt(r.requestManager,s,c,u);return qr({format:"bytes"},d,l??r.defaultReturnFormat)})}function nIt(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Bc(s)?s:qr({format:"uint"},s,xi),l=yield Zkt(n.requestManager,r,o);return qr({format:"bytes"},l,a??n.defaultReturnFormat)})}function uLe(t){return Ba(this,arguments,void 0,function*(e,n=e.defaultBlock,r=!1,s){var a;let o;if(E2(n)){const c=qr({format:"bytes32"},n,xi);o=yield sTt(e.requestManager,c,r)}else{const c=Bc(n)?n:qr({format:"uint"},n,xi);o=yield PRe(e.requestManager,c,r)}const l=qr(fL,o,s??e.defaultReturnFormat);return gr(l)?l:Object.assign(Object.assign({},l),{transactions:(a=l.transactions)!==null&&a!==void 0?a:[]})})}function rIt(t){return Ba(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(E2(n)){const a=qr({format:"bytes32"},n,xi);s=yield Kkt(e.requestManager,a)}else{const a=Bc(n)?n:qr({format:"uint"},n,xi);s=yield Ykt(e.requestManager,a)}return qr({format:"uint"},s,r??e.defaultReturnFormat)})}function sIt(t){return Ba(this,arguments,void 0,function*(e,n=e.defaultBlock,r){let s;if(E2(n)){const a=qr({format:"bytes32"},n,xi);s=yield Xkt(e.requestManager,a)}else{const a=Bc(n)?n:qr({format:"uint"},n,xi);s=yield Qkt(e.requestManager,a)}return qr({format:"uint"},s,r??e.defaultReturnFormat)})}function iIt(t){return Ba(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=qr({format:"uint"},r,xi);let o;if(E2(n)){const l=qr({format:"bytes32"},n,xi);o=yield cTt(e.requestManager,l,a)}else{const l=Bc(n)?n:qr({format:"uint"},n,xi);o=yield uTt(e.requestManager,l,a)}return qr(fL,o,s??e.defaultReturnFormat)})}function aIt(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=qr({format:"bytes32"},r,bd),o=yield iTt(n.requestManager,a);return gr(o)?o:gf(o,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})})}function oIt(t,e){return Ba(this,void 0,void 0,function*(){return(yield wTt(t.requestManager)).map(r=>gf(r,e??t.defaultReturnFormat,{transactionSchema:t.config.customTransactionSchema,fillInputAndData:!0}))})}function lIt(t){return Ba(this,arguments,void 0,function*(e,n=e.defaultBlock,r,s){const a=qr({format:"uint"},r,xi);let o;if(E2(n)){const l=qr({format:"bytes32"},n,xi);o=yield aTt(e.requestManager,l,a)}else{const l=Bc(n)?n:qr({format:"uint"},n,xi);o=yield oTt(e.requestManager,l,a)}return gr(o)?o:gf(o,s??e.defaultReturnFormat,{transactionSchema:e.config.customTransactionSchema,fillInputAndData:!0})})}function dLe(t,e,n){return Ba(this,void 0,void 0,function*(){const r=qr({format:"bytes32"},e,bd);let s;try{s=yield lTt(t.requestManager,r)}catch(a){if(typeof a=="object"&&!gr(a)&&"message"in a&&a.message==="transaction indexing is in progress")console.warn("Transaction indexing is in progress.");else throw a}return gr(s)?s:qr(pj,s,n??t.defaultReturnFormat)})}function fLe(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Bc(s)?s:qr({format:"uint"},s,xi),l=yield Gkt(n.requestManager,r,o);return qr({format:"uint"},l,a??n.defaultReturnFormat)})}function j_(t,e,n,r={checkRevertBeforeSending:!0},s){const a=new _Re((o,l)=>{setImmediate(()=>{Ba(this,void 0,void 0,function*(){const c=new cLe({web3Context:t,promiEvent:a,options:r,returnFormat:n});let u=Object.assign({},e);gr(s)||(u=yield s.processTransaction(u));let d=gf(Object.assign(Object.assign({},u),{from:Qte("from",t,u),to:Qte("to",t,u)}),xi,{transactionSchema:t.config.customTransactionSchema});try{d=yield c.populateGasPrice({transaction:u,transactionFormatted:d}),yield c.checkRevertBeforeSending(d),c.emitSending(d);let f;t.wallet&&!gr(d.from)&&(f=t.wallet.get(d.from));const x=yield c.signAndSend({wallet:f,tx:d}),g=qr({format:"bytes32"},x,n??t.defaultReturnFormat);c.emitSent(d),c.emitTransactionHash(g);const y=yield BRe(t,x,n??t.defaultReturnFormat),v=c.getReceiptWithEvents(qr(pj,y,n??t.defaultReturnFormat));c.emitReceipt(v),o(yield c.handleResolve({receipt:v,tx:d})),c.emitConfirmation({receipt:v,transactionHash:x})}catch(f){l(yield c.handleError({error:f,tx:d}))}})})});return a}function cIt(t,e,n,r={checkRevertBeforeSending:!0}){const s=new _Re((a,o)=>{setImmediate(()=>{Ba(this,void 0,void 0,function*(){const l=new cLe({web3Context:t,promiEvent:s,options:r,returnFormat:n}),c=qr({format:"bytes"},e,xi),u=o5.fromSerializedData(hx(fo(c))),d=Object.assign(Object.assign({},u.toJSON()),{from:u.getSenderAddress().toString()});try{const{v:f,r:x,s:g}=d,y=XPt(d,["v","r","s"]);yield l.checkRevertBeforeSending(y),l.emitSending(c);const v=yield Jte(t,()=>Ba(this,void 0,void 0,function*(){return TRe(t.requestManager,c)}));l.emitSent(c);const C=qr({format:"bytes32"},v,n??t.defaultReturnFormat);l.emitTransactionHash(C);const N=yield BRe(t,v,n??t.defaultReturnFormat),P=l.getReceiptWithEvents(qr(pj,N,n??t.defaultReturnFormat));l.emitReceipt(P),a(yield l.handleResolve({receipt:P,tx:d})),l.emitConfirmation({receipt:P,transactionHash:v})}catch(f){o(yield l.handleError({error:f,tx:d}))}})})});return s}function uIt(t,e,n){return Ba(this,arguments,void 0,function*(r,s,a,o=r.defaultReturnFormat){var l;const c=qr({format:"bytes"},s,bd);if(!((l=r.wallet)===null||l===void 0)&&l.get(a)){const f=r.wallet.get(a).sign(c);return qr(KTt,f,o)}if(typeof a=="number")throw new f8t(s,'RPC method "eth_sign" does not support index signatures');const u=yield Jkt(r.requestManager,a,c);return qr({format:"bytes"},u,o)})}function dIt(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultReturnFormat){const a=yield eTt(n.requestManager,gf(r,xi,{transactionSchema:n.config.customTransactionSchema}));return Ale(a)?ZTt(a,s,{fillInputAndData:!0}):{raw:qr({format:"bytes"},a.raw,s),tx:gf(a.tx,s,{transactionSchema:n.config.customTransactionSchema,fillInputAndData:!0})}})}function fce(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a=n.defaultReturnFormat){const o=Bc(s)?s:qr({format:"uint"},s,xi),l=yield nTt(n.requestManager,gf(r,xi,{transactionSchema:n.config.customTransactionSchema}),o);return qr({format:"bytes"},l,a)})}function hce(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=gf(r,xi,{transactionSchema:n.config.customTransactionSchema}),l=Bc(s)?s:qr({format:"uint"},s,xi),c=yield rTt(n.requestManager,o,l);return qr({format:"uint"},c,a??n.defaultReturnFormat)})}function hLe(t,e,n){return Ba(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;gr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=ac(r)),gr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=ac(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r});return(yield gTt(t.requestManager,a)).map(c=>typeof c=="string"?c:qr(hj,c,n??t.defaultReturnFormat))})}function pLe(t,e){return Ba(this,void 0,void 0,function*(){const n=yield STt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function fIt(t,e,n){return Ba(this,arguments,void 0,function*(r,s,a,o=r.defaultBlock,l){const c=a.map(f=>qr({format:"bytes"},f,xi)),u=Bc(o)?o:qr({format:"uint"},o,xi),d=yield NTt(r.requestManager,s,c,u);return qr(QTt,d,l??r.defaultReturnFormat)})}function hIt(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a,o){const l=qr({format:"uint"},r,xi),c=Bc(s)?s:qr({format:"uint"},s,xi),u=qr({type:"array",items:{format:"uint"}},a,pU),d=yield vTt(n.requestManager,l,c,u);return qr(YTt,d,o??n.defaultReturnFormat)})}function mLe(t,e){return Ba(this,arguments,void 0,function*(n,r,s=n.defaultBlock,a){const o=Bc(s)?s:qr({format:"uint"},s,xi),l=yield jTt(n.requestManager,gf(r,xi,{transactionSchema:n.config.customTransactionSchema}),o);return qr(VTt,l,a??n.defaultReturnFormat)})}function pIt(t,e,n,r,s){return Ba(this,void 0,void 0,function*(){const a=yield ETt(t.requestManager,e,n,r);return qr({format:"bytes"},a,s??t.defaultReturnFormat)})}var mj=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};function mIt(t,e){return mj(this,void 0,void 0,function*(){const n=yield hTt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function xIt(t,e,n){return mj(this,void 0,void 0,function*(){let{toBlock:r,fromBlock:s}=e;gr(r)||(typeof r=="number"||typeof r=="bigint")&&(r=ac(r)),gr(s)||(typeof s=="number"||typeof s=="bigint")&&(s=ac(s));const a=Object.assign(Object.assign({},e),{fromBlock:s,toBlock:r}),o=yield dTt(t.requestManager,a);return qr({format:"uint"},o,n??t.defaultReturnFormat)})}function gIt(t,e){return mj(this,void 0,void 0,function*(){const n=yield fTt(t.requestManager);return qr({format:"uint"},n,e??t.defaultReturnFormat)})}function bIt(t,e){return mj(this,void 0,void 0,function*(){return yield pTt(t.requestManager,ac(e))})}function yIt(t,e,n){return mj(this,void 0,void 0,function*(){return(yield mTt(t.requestManager,ac(e))).map(a=>typeof a=="string"?a:qr(hj,a,n??t.defaultReturnFormat))})}function vIt(t,e,n){return mj(this,void 0,void 0,function*(){return(yield xTt(t.requestManager,ac(e))).map(a=>typeof a=="string"?a:qr(hj,a,n??t.defaultReturnFormat))})}class xLe extends UT{_buildSubscriptionParams(){return["logs",this.args]}formatSubscriptionResult(e){return qr(hj,e,super.returnFormat)}}class bbe extends UT{_buildSubscriptionParams(){return["newPendingTransactions"]}formatSubscriptionResult(e){return qr({format:"string"},e,super.returnFormat)}}class xL extends UT{_buildSubscriptionParams(){return["newHeads"]}formatSubscriptionResult(e){return qr(qTt,e,super.returnFormat)}}class gLe extends UT{_buildSubscriptionParams(){return["syncing"]}_processSubscriptionResult(e){if(typeof e=="boolean")this.emit("changed",e);else{const n=Object.fromEntries(Object.entries((e==null?void 0:e.status)||e).map(([r,s])=>[r.charAt(0).toLowerCase()+r.substring(1),s]));this.emit("changed",e.syncing),this.emit("data",qr(GTt,n,super.returnFormat))}}}var vi=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const ine={logs:xLe,newPendingTransactions:bbe,newHeads:xL,syncing:gLe,pendingTransactions:bbe,newBlockHeaders:xL};class bU extends af{constructor(e){if(typeof e=="string"||oL(e)){super({provider:e,registeredSubscriptions:ine});return}if(e.registeredSubscriptions){super(e);return}super(Object.assign(Object.assign({},e),{registeredSubscriptions:ine})),this.getFeeData=this.calculateFeeData}setTransactionMiddleware(e){this.transactionMiddleware=e}getTransactionMiddleware(){return this.transactionMiddleware}getProtocolVersion(){return vi(this,void 0,void 0,function*(){return Lkt(this.requestManager)})}isSyncing(){return vi(this,void 0,void 0,function*(){return kRe(this.requestManager)})}getCoinbase(){return vi(this,void 0,void 0,function*(){return Dkt(this.requestManager)})}isMining(){return vi(this,void 0,void 0,function*(){return Bkt(this.requestManager)})}getHashrate(e){return vi(this,void 0,void 0,function*(){var n;return e===void 0&&(e=(n=this.defaultReturnFormat)!==null&&n!==void 0?n:bd),this.getHashRate(e)})}getHashRate(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return ZPt(this,e)})}getGasPrice(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return uce(this,e)})}getMaxPriorityFeePerGas(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return JPt(this,e)})}calculateFeeData(){return vi(this,arguments,void 0,function*(e=BigInt(2),n=rU.Gwei){var r;const s=yield this.getBlock(void 0,!1),a=(r=s==null?void 0:s.baseFeePerGas)!==null&&r!==void 0?r:void 0;let o;try{o=yield this.getGasPrice()}catch{}let l;try{l=yield this.getMaxPriorityFeePerGas()}catch{}let c;if(a){l=l??n;let u;typeof e=="number"?u=BigInt(Math.floor(e*1e3))/BigInt(1e3):u=e,c=a*u+l}return{gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:l,baseFeePerGas:a}})}getAccounts(){return vi(this,void 0,void 0,function*(){var e;return((e=yield Hkt(this.requestManager))!==null&&e!==void 0?e:[]).map(r=>wx(r))})}getBlockNumber(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return dce(this,e)})}getBalance(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return eIt(this,n,r,s)})}getStorageAt(e,n){return vi(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return tIt(this,r,s,a,o)})}getCode(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return nIt(this,n,r,s)})}getBlock(){return vi(this,arguments,void 0,function*(e=this.defaultBlock,n=!1,r=this.defaultReturnFormat){return uLe(this,e,n,r)})}getBlockTransactionCount(){return vi(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return rIt(this,e,n)})}getBlockUncleCount(){return vi(this,arguments,void 0,function*(e=this.defaultBlock,n=this.defaultReturnFormat){return sIt(this,e,n)})}getUncle(){return vi(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return iIt(this,e,n,r)})}getTransaction(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield aIt(this,n,r);if(!s)throw new S1e;return s})}getPendingTransactions(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return oIt(this,e)})}getTransactionFromBlock(){return vi(this,arguments,void 0,function*(e=this.defaultBlock,n,r=this.defaultReturnFormat){return lIt(this,e,n,r)})}getTransactionReceipt(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){const s=yield dLe(this,n,r);if(!s)throw new S1e;return s})}getTransactionCount(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return fLe(this,n,r,s)})}sendTransaction(e,n=this.defaultReturnFormat,r){return j_(this,e,n,r,this.transactionMiddleware)}sendSignedTransaction(e,n=this.defaultReturnFormat,r){return cIt(this,e,n,r)}sign(e,n){return vi(this,arguments,void 0,function*(r,s,a=this.defaultReturnFormat){return uIt(this,r,s,a)})}signTransaction(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return dIt(this,n,r)})}call(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return fce(this,n,r,s)})}estimateGas(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return hce(this,n,r,s)})}getPastLogs(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return hLe(this,n,r)})}getWork(){return vi(this,void 0,void 0,function*(){return bTt(this.requestManager)})}submitWork(e,n,r){return vi(this,void 0,void 0,function*(){return yTt(this.requestManager,e,n,r)})}requestAccounts(){return vi(this,void 0,void 0,function*(){return CTt(this.requestManager)})}getChainId(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return pLe(this,e)})}getNodeInfo(){return vi(this,void 0,void 0,function*(){return ATt(this.requestManager)})}getProof(e,n){return vi(this,arguments,void 0,function*(r,s,a=this.defaultBlock,o=this.defaultReturnFormat){return fIt(this,r,s,a,o)})}getFeeHistory(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s,a=this.defaultReturnFormat){return hIt(this,n,r,s,a)})}createAccessList(e){return vi(this,arguments,void 0,function*(n,r=this.defaultBlock,s=this.defaultReturnFormat){return mLe(this,n,r,s)})}signTypedData(e,n,r,s){return vi(this,void 0,void 0,function*(){var a;return r===void 0&&(r=!1),s===void 0&&(s=(a=this.defaultReturnFormat)!==null&&a!==void 0?a:bd),pIt(this,e,n,r,s)})}subscribe(e,n,r){return vi(this,void 0,void 0,function*(){var s,a;r===void 0&&(r=(s=this.defaultReturnFormat)!==null&&s!==void 0?s:bd);const o=yield(a=this.subscriptionManager)===null||a===void 0?void 0:a.subscribe(e,n,r);return o instanceof xLe&&e==="logs"&&typeof n=="object"&&!si(n.fromBlock)&&Number.isFinite(Number(n.fromBlock))&&setImmediate(()=>{this.getPastLogs(n).then(l=>{for(const c of l)o._processSubscriptionResult(c)}).catch(l=>{o._processSubscriptionError(l)})}),o})}static shouldClearSubscription({sub:e}){return!(e instanceof gLe)}clearSubscriptions(e=!1){var n;return(n=this.subscriptionManager)===null||n===void 0?void 0:n.unsubscribe(e?bU.shouldClearSubscription:void 0)}createNewPendingTransactionFilter(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return mIt(this,e)})}createNewFilter(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return xIt(this,n,r)})}createNewBlockFilter(){return vi(this,arguments,void 0,function*(e=this.defaultReturnFormat){return gIt(this,e)})}uninstallFilter(e){return vi(this,void 0,void 0,function*(){return bIt(this,e)})}getFilterChanges(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return yIt(this,n,r)})}getFilterLogs(e){return vi(this,arguments,void 0,function*(n,r=this.defaultReturnFormat){return vIt(this,n,r)})}}const wIt=t=>{if(!gr(t.common)){if(gr(t.common.customChain))throw new x8t;if(gr(t.common.customChain.chainId))throw new g8t;if(!gr(t.chainId)&&t.chainId!==t.common.customChain.chainId)throw new b8t({txChainId:t.chainId,customChainId:t.common.customChain.chainId})}},CIt=t=>{if(!gr(t.common)&&!gr(t.chain)&&!gr(t.hardfork))throw new w8t;if(!gr(t.chain)&&gr(t.hardfork)||!gr(t.hardfork)&&gr(t.chain))throw new C8t({chain:t.chain,hardfork:t.hardfork})},SIt=t=>{if(!gr(t.common)&&!gr(t.common.baseChain)&&!gr(t.chain)&&t.chain!==t.common.baseChain)throw new y8t({txChain:t.chain,baseChain:t.common.baseChain})},NIt=t=>{if(!gr(t.common)&&!gr(t.common.hardfork)&&!gr(t.hardfork)&&t.hardfork!==t.common.hardfork)throw new v8t({txHardfork:t.hardfork,commonHardfork:t.common.hardfork})},ybe=t=>{if(gr(t.gas)||!A1(t.gas)||gr(t.gasPrice)||!A1(t.gasPrice))throw new E8t({gas:t.gas,gasPrice:t.gasPrice});if(!gr(t.maxFeePerGas)||!gr(t.maxPriorityFeePerGas))throw new ZOe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas})},vbe=t=>{if(!gr(t.gasPrice)&&t.type==="0x2")throw new k8t(t.gasPrice);if(t.type==="0x0"||t.type==="0x1")throw new ZOe({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});if(gr(t.maxFeePerGas)||!A1(t.maxFeePerGas)||gr(t.maxPriorityFeePerGas)||!A1(t.maxPriorityFeePerGas))throw new _8t({maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas})},AIt=t=>{const e=!gr(t.gas)||!gr(t.gasLimit),n=e&&!gr(t.gasPrice),r=e&&!gr(t.maxPriorityFeePerGas)&&!gr(t.maxFeePerGas);if(!n&&!r)throw new N8t({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});if(n&&r)throw new j8t({gas:t.gas,gasPrice:t.gasPrice,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas});(n?ybe:vbe)(t),(!gr(t.type)&&t.type>"0x1"?vbe:ybe)(t)},jIt=(t,e,n={transactionSchema:void 0})=>{if(!gr(e)){e(t);return}if(typeof t!="object"||gr(t))throw new T8t(t);wIt(t),CIt(t),SIt(t),NIt(t);const r=gf(t,xi,{transactionSchema:n.transactionSchema});if(AIt(r),gr(r.nonce)||gr(r.chainId)||r.nonce.startsWith("-")||r.chainId.startsWith("-"))throw new P8t({nonce:t.nonce,chainId:t.chainId})};var EIt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const _It=t=>{var e,n;return Object.assign(Object.assign({},t),{nonce:t.nonce,gasPrice:t.gasPrice,gasLimit:(e=t.gasLimit)!==null&&e!==void 0?e:t.gas,to:t.to,value:t.value,data:(n=t.data)!==null&&n!==void 0?n:t.input,type:t.type,chainId:t.chainId,accessList:t.accessList,maxPriorityFeePerGas:t.maxPriorityFeePerGas,maxFeePerGas:t.maxFeePerGas})},kIt=(t,e)=>{var n,r,s,a,o,l,c,u,d,f,x,g,y,v,C,N,P,T;const M=!gr(t.chain)&&!gr(t.hardfork)||!gr(t.common);let F;if(!M)e.defaultCommon?(F=Object.assign({},e.defaultCommon),gr(F.hardfork)&&(F.hardfork=(n=t.hardfork)!==null&&n!==void 0?n:e.defaultHardfork),gr(F.baseChain)&&(F.baseChain=e.defaultChain)):F=nc.custom({name:"custom-network",chainId:sf(t.chainId),networkId:gr(t.networkId)?void 0:sf(t.networkId),defaultHardfork:(r=t.hardfork)!==null&&r!==void 0?r:e.defaultHardfork},{baseChain:e.defaultChain});else{const $=(l=(o=(a=(s=t==null?void 0:t.common)===null||s===void 0?void 0:s.customChain)===null||a===void 0?void 0:a.name)!==null&&o!==void 0?o:t.chain)!==null&&l!==void 0?l:"custom-network",L=sf((d=(u=(c=t==null?void 0:t.common)===null||c===void 0?void 0:c.customChain)===null||u===void 0?void 0:u.chainId)!==null&&d!==void 0?d:t==null?void 0:t.chainId),z=sf((g=(x=(f=t==null?void 0:t.common)===null||f===void 0?void 0:f.customChain)===null||x===void 0?void 0:x.networkId)!==null&&g!==void 0?g:t==null?void 0:t.networkId),X=(C=(v=(y=t==null?void 0:t.common)===null||y===void 0?void 0:y.hardfork)!==null&&v!==void 0?v:t==null?void 0:t.hardfork)!==null&&C!==void 0?C:e.defaultHardfork,ne=(T=(P=(N=t.common)===null||N===void 0?void 0:N.baseChain)!==null&&P!==void 0?P:t.chain)!==null&&T!==void 0?T:e.defaultChain;L&&z&&$&&(F=nc.custom({name:$,chainId:L,networkId:z,defaultHardfork:X},{baseChain:ne}))}return{common:F}},TIt=(t,e,n,...r)=>EIt(void 0,[t,e,n,...r],void 0,function*(s,a,o,l=!1,c=!0){const u=yield sPt({transaction:s,web3Context:a,privateKey:o,fillGasPrice:l,fillGasLimit:c}),d=gf(u,xi,{transactionSchema:a.config.customTransactionSchema});return jIt(d,void 0,{transactionSchema:a.config.customTransactionSchema}),o5.fromTxData(_It(d),kIt(d,a))}),wbe=({address:t},e,n)=>{var r,s;const a=n==null?void 0:n.topics,o=(r=n==null?void 0:n.filter)!==null&&r!==void 0?r:{},l={};if(si(n==null?void 0:n.fromBlock)||(l.fromBlock=qr(fL.properties.number,n==null?void 0:n.fromBlock,{number:ap.HEX,bytes:S1.HEX})),si(n==null?void 0:n.toBlock)||(l.toBlock=qr(fL.properties.number,n==null?void 0:n.toBlock,{number:ap.HEX,bytes:S1.HEX})),a&&Array.isArray(a))l.topics=[...a];else if(l.topics=[],e&&!e.anonymous&&![MN,"allEvents"].includes(e.name)&&l.topics.push((s=e.signature)!==null&&s!==void 0?s:ice(s1(e))),![MN,"allEvents"].includes(e.name)&&e.inputs)for(const c of e.inputs){if(!c.indexed)continue;const u=o[c.name];if(!u){l.topics.push(null);continue}Array.isArray(u)?l.topics.push(u.map(d=>rne(c.type,d))):c.type==="string"?l.topics.push(kN(u)):l.topics.push(rne(c.type,u))}return l.topics.length||delete l.topics,t&&(l.address=t.toLowerCase()),l},P9=(t,e,n)=>{const r=Array.isArray(t.inputs)?t.inputs.length:0;if(t.inputs&&r!==e.length)throw new yd(`The number of arguments is not matching the methods required number. You need to pass ${r} arguments.`);let s;if(t.inputs?s=gU(Array.isArray(t.inputs)?t.inputs:[],e).replace("0x",""):s=zPt(e).replace("0x",""),uPt(t)){if(!n)throw new yd("The contract has no contract data option set. This is necessary to append the constructor parameters.");return n.startsWith("0x")?`${n}${s}`:`0x${n}${s}`}return`${A_(t)}${s}`};class bLe extends UT{constructor(e,n){super(e,n),this.address=e.address,this.topics=e.topics,this.abi=e.abi,this.jsonInterface=e.jsonInterface}_buildSubscriptionParams(){return["logs",{address:this.address,topics:this.topics}]}formatSubscriptionResult(e){return cce(this.abi,e,this.jsonInterface,super.returnFormat)}}Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));const yU=(t,e,n,r)=>{var s,a;const o={};return(!si(t.data)||r==="both")&&(o.data=P9(e,n,(s=t.data)!==null&&s!==void 0?s:t.input)),(!si(t.input)||r==="both")&&(o.input=P9(e,n,(a=t.input)!==null&&a!==void 0?a:t.data)),si(o.input)&&si(o.data)&&(o[r]=P9(e,n)),{data:o.data,input:o.input}},ane=({abi:t,params:e,options:n,contractOptions:r})=>{var s,a,o;if(!((o=(a=(s=n==null?void 0:n.input)!==null&&s!==void 0?s:n==null?void 0:n.data)!==null&&a!==void 0?a:r.input)!==null&&o!==void 0?o:r.data)&&!(n!=null&&n.to)&&!r.address)throw new yd("Contract address not specified");if(!(n!=null&&n.from)&&!r.from)throw new yd('Contract "from" address not specified');let c=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const u=yU(c,t,e,n==null?void 0:n.dataInputFill);return c=Object.assign(Object.assign({},c),{data:u.data,input:u.input}),c},PIt=({abi:t,params:e,options:n,contractOptions:r})=>{if(!(n!=null&&n.to)&&!r.address)throw new yd("Contract address not specified");let s=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const a=yU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},IIt=({abi:t,params:e,options:n,contractOptions:r})=>{let s=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,data:r.data},n);const a=yU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s},Cbe=t=>typeof t=="object"&&!si(t)&&Object.keys(t).length!==0&&!Ey(t),FIt=({abi:t,params:e,options:n,contractOptions:r})=>{if(!(n!=null&&n.to)&&!r.address)throw new yd("Contract address not specified");if(!(n!=null&&n.from)&&!r.from)throw new yd('Contract "from" address not specified');let s=k2({to:r.address,gas:r.gas,gasPrice:r.gasPrice,from:r.from,input:r.input,maxPriorityFeePerGas:r.maxPriorityFeePerGas,maxFeePerGas:r.maxFeePerGas,data:r.data},n);const a=yU(s,t,e,n==null?void 0:n.dataInputFill);return s=Object.assign(Object.assign({},s),{data:a.data,input:a.input}),s};var OIt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class MIt{_contractMethodDeploySend(e){const n={transactionResolver:r=>{if(r.status===BigInt(0))throw new yd("code couldn't be stored",r);const s=this.parent.clone();return s.options.address=r.contractAddress,s},contractAbi:this.parent.options.jsonInterface,checkRevertBeforeSending:!1};return gr(this.parent.getTransactionMiddleware())?j_(this.parent,e,this.parent.defaultReturnFormat,n):j_(this.parent,e,this.parent.defaultReturnFormat,n,this.parent.getTransactionMiddleware())}constructor(e,n){this.parent=e,this.deployOptions=n;const{args:r,abi:s,contractOptions:a,deployData:o}=this.calculateDeployParams();this.args=r,this.constructorAbi=s,this.contractOptions=a,this.deployData=o}send(e){const n=Object.assign({},e),r=this.populateTransaction(n);return this._contractMethodDeploySend(r)}populateTransaction(e){var n,r;const s=Object.assign(Object.assign({},this.contractOptions),{from:(r=(n=this.contractOptions.from)!==null&&n!==void 0?n:this.parent.defaultAccount)!==null&&r!==void 0?r:void 0}),a=ane({abi:this.constructorAbi,params:this.args,options:Object.assign(Object.assign({},e),{dataInputFill:this.parent.contractDataInputFill}),contractOptions:s});return a.dataInputFill&&delete a.dataInputFill,a}calculateDeployParams(){var e,n,r,s,a,o;let l=this.parent.options.jsonInterface.find(g=>g.type==="constructor");l||(l={type:"constructor",stateMutability:""});const c=qr({format:"bytes"},(n=(e=this.deployOptions)===null||e===void 0?void 0:e.input)!==null&&n!==void 0?n:this.parent.options.input,bd),u=qr({format:"bytes"},(s=(r=this.deployOptions)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:this.parent.options.data,bd);if((!c||c.trim()==="0x")&&(!u||u.trim()==="0x"))throw new yd("contract creation without any data provided.");const d=(o=(a=this.deployOptions)===null||a===void 0?void 0:a.arguments)!==null&&o!==void 0?o:[],f=Object.assign(Object.assign({},this.parent.options),{input:c,data:u});return{args:d,abi:l,contractOptions:f,deployData:c??u}}estimateGas(e){return OIt(this,arguments,void 0,function*(n,r=this.parent.defaultReturnFormat){const s=Object.assign({},n);return this.parent.contractMethodEstimateGas({abi:this.constructorAbi,params:this.args,returnFormat:r,options:s,contractOptions:this.contractOptions})})}encodeABI(){return P9(this.constructorAbi,this.args,qr({format:"bytes"},this.deployData,this.parent.defaultReturnFormat))}decodeData(e){return Object.assign(Object.assign({},sne(this.constructorAbi,e.replace(this.deployData,""),!1)),{__method__:this.constructorAbi.type})}}var RIt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class LIt extends lL{constructor(e,n){super(e.requestManager,e.registeredSubscriptions),this.parentContract=n}subscribe(e,n){const r=Object.create(null,{subscribe:{get:()=>super.subscribe}});return RIt(this,arguments,void 0,function*(s,a,o=bd){return r.subscribe.call(this,s,a??this.parentContract.options,o)})}}var Ev=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const DIt={logs:bLe,newHeads:xL,newBlockHeaders:xL};class C3 extends af{get subscriptionManager(){return this._subscriptionManager}constructor(e,n,r,s,a){var o,l,c;const u=Ey(n)?n:Ey(r)?r:void 0;let d;Cbe(n)?d=n:Cbe(r)?d=r:d=s;let f;if(typeof n=="object"&&"provider"in n?f=n.provider:typeof r=="object"&&"provider"in r?f=r.provider:typeof s=="object"&&"provider"in s?f=s.provider:f=C3.givenProvider,super(Object.assign(Object.assign({},d),{provider:f,registeredSubscriptions:DIt})),this.syncWithContext=!1,this._functions={},this._subscriptionManager=new LIt(super.subscriptionManager,this),d!=null&&d.wallet&&(this._wallet=d.wallet),d!=null&&d.accountProvider&&(this._accountProvider=d.accountProvider),!gr(u)&&!gr(u.data)&&!gr(u.input)&&this.config.contractDataInputFill!=="both")throw new a8t({data:u.data,input:u.input});this._overloadedMethodAbis=new Map;const x=Cg(s)?s:Cg(r)?r:a??this.defaultReturnFormat,g=typeof n=="string"?n:void 0;this.config.contractDataInputFill=(o=u==null?void 0:u.dataInputFill)!==null&&o!==void 0?o:this.config.contractDataInputFill,this._parseAndSetJsonInterface(e,x),this.defaultReturnFormat!==x&&(this.defaultReturnFormat=x),gr(g)||this._parseAndSetAddress(g,x),this.options={address:g,jsonInterface:this._jsonInterface,gas:(l=u==null?void 0:u.gas)!==null&&l!==void 0?l:u==null?void 0:u.gasLimit,gasPrice:u==null?void 0:u.gasPrice,from:u==null?void 0:u.from,input:u==null?void 0:u.input,data:u==null?void 0:u.data},this.syncWithContext=(c=u==null?void 0:u.syncWithContext)!==null&&c!==void 0?c:!1,d instanceof af&&this.subscribeToContextEvents(d),Object.defineProperty(this.options,"address",{set:y=>this._parseAndSetAddress(y,x),get:()=>this._address}),Object.defineProperty(this.options,"jsonInterface",{set:y=>this._parseAndSetJsonInterface(y,x),get:()=>this._jsonInterface}),d instanceof af&&d.on(i5.CONFIG_CHANGE,y=>{this.setConfig({[y.name]:y.newValue})})}setTransactionMiddleware(e){this.transactionMiddleware=e}getTransactionMiddleware(){return this.transactionMiddleware}get events(){return this._events}get methods(){return this._methods}clone(){let e;return this.options.address?e=new C3([...this._jsonInterface,...this._errorsInterface],this.options.address,{gas:this.options.gas,gasPrice:this.options.gasPrice,from:this.options.from,input:this.options.input,data:this.options.data,provider:this.currentProvider,syncWithContext:this.syncWithContext,dataInputFill:this.config.contractDataInputFill},this.getContextObject()):e=new C3([...this._jsonInterface,...this._errorsInterface],{gas:this.options.gas,gasPrice:this.options.gasPrice,from:this.options.from,input:this.options.input,data:this.options.data,provider:this.currentProvider,syncWithContext:this.syncWithContext,dataInputFill:this.config.contractDataInputFill},this.getContextObject()),this.context&&e.subscribeToContextEvents(this.context),e}deploy(e){return new MIt(this,e)}getPastEvents(e,n,r){return Ev(this,void 0,void 0,function*(){var s;const a=typeof e=="string"?e:MN,o=typeof e!="string"&&!Cg(e)?e:Cg(n)?{}:n,l=Cg(e)?e:Cg(n)?n:r??this.defaultReturnFormat,c=a==="allEvents"||a===MN?Xte:this._jsonInterface.find(N=>"name"in N&&N.name===a);if(!c)throw new yd(`Event ${String(a)} not found.`);const{fromBlock:u,toBlock:d,topics:f,address:x}=wbe(this.options,c,o??{}),g=yield hLe(this,{fromBlock:u,toBlock:d,topics:f,address:x},l),y=g?g.map(N=>typeof N=="string"?N:cce(c,N,this._jsonInterface,l)):[],v=(s=o==null?void 0:o.filter)!==null&&s!==void 0?s:{},C=Object.keys(v);return C.length>0?y.filter(N=>typeof N=="string"?!0:C.every(P=>{var T;if(Array.isArray(v[P]))return v[P].some(F=>String(N.returnValues[P]).toUpperCase()===String(F).toUpperCase());const M=(T=c.inputs)===null||T===void 0?void 0:T.filter(F=>F.name===P)[0];return M!=null&&M.indexed&&M.type==="string"&&kN(v[P])===String(N.returnValues[P])?!0:String(N.returnValues[P]).toUpperCase()===String(v[P]).toUpperCase()})):y})}_parseAndSetAddress(e,n=this.defaultReturnFormat){this._address=e&&wx(qr({format:"address"},e,n))}decodeMethodData(e){const n=e.slice(0,10),s=this._jsonInterface.filter(a=>a.type!=="error").find(a=>n===A_(s1(a)));if(!s)throw new yd(`The ABI for the provided method signature ${n} was not found.`);return sne(s,e)}_parseAndSetJsonInterface(e,n=this.defaultReturnFormat){var r,s;this._functions={},this._methods={},this._events={};let a=[];const o=e.filter(c=>c.type!=="error"),l=e.filter(c=>mU(c));for(const c of o){const u=Object.assign(Object.assign({},c),{signature:""});if(xU(u)){const d=s1(u),f=A_(d);u.methodNameWithInputs=d,u.signature=f,u.constant=u.stateMutability==="view"||u.stateMutability==="pure"||u.constant,u.payable=u.stateMutability==="payable"||u.payable,this._overloadedMethodAbis.set(u.name,[...(r=this._overloadedMethodAbis.get(u.name))!==null&&r!==void 0?r:[],u]);const x=(s=this._overloadedMethodAbis.get(u.name))!==null&&s!==void 0?s:[],g=this._createContractMethod(x,l),y=this._createContractMethod(x,l,!0);this._functions[d]={signature:f,method:y},this._methods[u.name]=g,this._methods[d]=y,this._methods[f]=y}else if(sce(u)){const d=s1(u),f=ice(d),x=this._createContractEvent(u,n);u.signature=f,(!(d in this._events)||u.name==="bound")&&(this._events[d]=x),this._events[u.name]=x,this._events[f]=x}a=[...a,u]}this._events.allEvents=this._createContractEvent(Xte,n),this._jsonInterface=[...a],this._errorsInterface=l}_getAbiParams(e,n){var r;try{return T9((r=e.inputs)!==null&&r!==void 0?r:[],n)}catch(s){throw new yd(`Invalid parameters for method ${e.name}: ${s.message}`)}}_createContractMethod(e,n,r=!1){const s=e[e.length-1];return(...a)=>{var o,l,c;let u;const d=(l=r?(o=this._overloadedMethodAbis.get(s.name))===null||o===void 0?void 0:o.filter(v=>v.signature===s.signature):this._overloadedMethodAbis.get(s.name))!==null&&l!==void 0?l:[];let f=d[0];const x=n,g=d.filter(v=>{var C;return((C=v.inputs)!==null&&C!==void 0?C:[]).length===a.length});if(d.length===1||g.length===0)u=this._getAbiParams(f,a),Ks.validate((c=s.inputs)!==null&&c!==void 0?c:[],u);else{const v=[],C=[];for(const N of g)try{u=this._getAbiParams(N,a),Ks.validate(N.inputs,u),C.push(N)}catch(P){v.push(P)}if(C.length===1?[f]=C:C.length>1&&([f]=C,console.warn(`Multiple methods found that is compatible with the given inputs.
Found ${C.length} compatible methods: ${JSON.stringify(C.map(N=>`${N.methodNameWithInputs} (signature: ${N.signature})`))}
The first one will be used: ${f.methodNameWithInputs}`)),v.length===g.length)throw new jN(v)}const y={arguments:u,call:(v,C)=>Ev(this,void 0,void 0,function*(){return this._contractMethodCall(f,u,x,v,C)}),send:v=>this._contractMethodSend(f,u,x,v),populateTransaction:(v,C)=>{var N,P;let T=C??this.options;T=Object.assign(Object.assign({},T),{input:void 0,from:(P=(N=T==null?void 0:T.from)!==null&&N!==void 0?N:this.defaultAccount)!==null&&P!==void 0?P:void 0});const M=ane({abi:s,params:a,options:Object.assign(Object.assign({},v),{dataInputFill:this.config.contractDataInputFill}),contractOptions:T});return M.dataInputFill&&delete M.dataInputFill,M},estimateGas:(v,...C)=>Ev(this,[v,...C],void 0,function*(N,P=this.defaultReturnFormat){return this.contractMethodEstimateGas({abi:f,params:u,returnFormat:P,options:N})}),encodeABI:()=>P9(f,u),decodeData:v=>sne(f,v),createAccessList:(v,C)=>Ev(this,void 0,void 0,function*(){return this._contractMethodCreateAccessList(f,u,x,v,C)})};return f.stateMutability==="payable",y}}_contractMethodCall(e,n,r,s,a){return Ev(this,void 0,void 0,function*(){var o;const l=PIt({abi:e,params:n,options:Object.assign(Object.assign({},s),{dataInputFill:this.config.contractDataInputFill}),contractOptions:Object.assign(Object.assign({},this.options),{from:(o=this.options.from)!==null&&o!==void 0?o:this.config.defaultAccount})});try{const c=yield fce(this,l,a,this.defaultReturnFormat);return VPt(e,c)}catch(c){throw c instanceof g3&&uM(r,c.cause),c}})}_contractMethodCreateAccessList(e,n,r,s,a){return Ev(this,void 0,void 0,function*(){var o;const l=FIt({abi:e,params:n,options:Object.assign(Object.assign({},s),{dataInputFill:this.config.contractDataInputFill}),contractOptions:Object.assign(Object.assign({},this.options),{from:(o=this.options.from)!==null&&o!==void 0?o:this.config.defaultAccount})});try{return mLe(this,l,a,this.defaultReturnFormat)}catch(c){throw c instanceof g3&&uM(r,c.cause),c}})}_contractMethodSend(e,n,r,s,a){var o,l;let c=a??this.options;c=Object.assign(Object.assign({},c),{input:void 0,from:(l=(o=c.from)!==null&&o!==void 0?o:this.defaultAccount)!==null&&l!==void 0?l:void 0});const u=ane({abi:e,params:n,options:Object.assign(Object.assign({},s),{dataInputFill:this.config.contractDataInputFill}),contractOptions:c}),d=gr(this.transactionMiddleware)?j_(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface}):j_(this,u,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface},this.transactionMiddleware);return d.on("error",f=>{f instanceof g3&&uM(r,f.cause)}),d}contractMethodEstimateGas(e){return Ev(this,arguments,void 0,function*({abi:n,params:r,returnFormat:s,options:a,contractOptions:o}){const l=IIt({abi:n,params:r,options:Object.assign(Object.assign({},a),{dataInputFill:this.config.contractDataInputFill}),contractOptions:o??this.options});return hce(this,l,$g.LATEST,s??this.defaultReturnFormat)})}_createContractEvent(e,n=this.defaultReturnFormat){return(...r)=>{var s;const{topics:a,fromBlock:o}=wbe(this.options,e,r[0]),l=new bLe({address:this.options.address,topics:a,abi:e,jsonInterface:this._jsonInterface},{subscriptionManager:this.subscriptionManager,returnFormat:n});return gr(o)||this.getPastEvents(e.name,{fromBlock:o,topics:a},n).then(c=>{c&&c.forEach(u=>l.emit("data",u))}).catch(c=>{l.emit("error",new gg("Failed to get past events.",c))}),(s=this.subscriptionManager)===null||s===void 0||s.addSubscription(l).catch(c=>{l.emit("error",new gg("Failed to subscribe.",c))}),l}}subscribeToContextEvents(e){const n=this;this.context=e,n.syncWithContext&&e.on(i5.CONFIG_CHANGE,r=>{n.setConfig({[r.name]:r.newValue})})}}const Sbe={addr:"0x3b3b57de",name:"0x691f3431",abi:"0x2203ab56",pubkey:"0xc8690233",text:"0x59d1d43c",contenthash:"0xbc1c58d1"},fC={setAddr:"addr",addr:"addr",setPubkey:"pubkey",pubkey:"pubkey",setContenthash:"contenthash",contenthash:"contenthash",text:"text",name:"name"},gL={main:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",goerli:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},BIt={"0x1":"main","0x5":"goerli"},$It=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"label",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"recordExists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"ttl",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"}],UIt=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"}],name:"DNSZoneCleared",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"}],name:"TextChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"}];var zIt="AEkVMQnvDV0B0wKWAQYBQgDpATQAoQDcAIUApwBsAOMAcACTAEUAigBRAHkAPgA/ACwANwAoAGIAHgAvACsAJQAXAC8AHAAhACIALwAVACsAEQAiAAsAGwARABgAFwA7ACoAKwAsADQAFgAtABIAHAAhAA4AHQAdABUAFgAZAA0ADgAXABAAGQAUABIEtAYQASIUOjfDBdMAsQCuPwFnAKUBA10jAK5/Ly8vLwE/pwUJ6/0HPwbkMQVXBVgAPSs5APa2EQbIwQuUCkEDyJ4zAsUKLwKOoQKG2D+Ob4kCxcsCg/IBH98JAPKtAUECLY0KP48A4wDiChUAF9S5yAwLPZ0EG3cA/QI5GL0P6wkGKekFBIFnDRsHLQCrAGmR76WcfwBbBpMjBukAGwA7DJMAWxVbqft7uycM2yDPCLspA7EUOwD3LWujAKF9GAAXBCXXFgEdALkZzQT6CSBMNwmXCYgeG1ZZTOODQgATAAwAFQAOa1QAIQAOAEfuFdg98zlYypXmLgoQHV9NWD3sABMADAAVAA5rIFxAlwDD6wAbADkMxQAbFVup+3EB224cHQVbBeIC0J8CxLAKTBykZRRzGm1M9QC7DWcC4QALLTSJF8mRAoF7ARMbAL0NZwLhAAstAUhQJZFMCgMt+wUyCddpF60B10MASSsSdwIxFiEC6ye5N2sAOeEB9SUAxw7LtQEbY4EAsQUABQCK00kFG8MfBxcAqCfRAaErLQObAGcBChk+7Td0BBgXAKoBxwIhANMrEnM681CwBZA6dyc1SAX6JwVZBVivuAVpO11CEjpYQZd7k2ZfofgLEwPFByXxdyMEo0sCU1MCdRurJwGPo6U1WwNFFwSDYQkA0QarPy8jBykCOV0AawFhH3EAgx0ZAJUBSbcAJ2kXAa/FAzctIUNTAW9ZBmUCZQDxSRcDKQEFAElBAKsAXQBzACu1Bgfz7xmNfwAJIQApALMbRwHRAdsHCzGXeIHoAAoAEQA0AD0AODN3edPAEF8QXAFNCUxsOhULAqwPpgvlERUM0SrL09gANKkH6wNTB+sDUwNTB+sH6wNTB+sDUwNTA1MDUxwK8BrTwBBfD0gEbQWOBYsE1giDJkkRgQcoCNJUDXQeHEcDRQD8IyVJHDuTMwslQkwMTQMH/DZCbKd9OANHMatU9ZCiA8syTzlsAR5xEqAAKg9zHDW1Tn56R3GgCktPrrV/SWJOZwK+Oqg/+AohCZNvu3dOBj0QFyehEPMMLwGxATcN6UvUBO0GNwTFH3kZFQ/JlZgIoS3ZDOkm3y6dgFYj8Sp/BelL8DzZC0lRZA9VC2EJ3zpfgUoDHQEJIocK2Q01CGkQ7wrFZw3hEUEHNQPRSZYAoQb9Cw0dMRWxJgxiqAsFOXMG9xryC4smqxMlevgFzxodBkkBJRr7AMsu44WsWi1cGE9bBf8LISPDFKRQHA0hQLN4RBoXBxElpQKNQ2xKg1EyHo8h8jw5DWIuD1F4B/E8ARlLC308mkanRQoRzj6JPUQiRUwoBDF7LCsnhwnLD4EMtXxuAVUJHQmtDG0TLRETN8EINQcVKZcgJxEIHUaRYJYE85sD7xPNAwcFOwk9Bw8DsRwpEyoVJQUJgSDTAu820S6vAotWfAETBccPIR/bEExH3A7lCJcCYQN/JecAKRUdABMilwg/XwBbj9RTAS7HCMNqaCNwA2MU410RbweNDlMHoxwvFbsc3XDEXgeGBCifqwlXAXEJlQFbBN8IBTVXjJwgPWdPi1QYlyBdQTtd+AItDGEVm0S5h3QChw9nEhcBMQFvBzUM/QJzEekRZxCRCOeGADWxM/Q6IQRLIX8gDQojA0tsygsjJvUM9GUBnxJeAwg0OXfqZ6dgsiAX+QcVMsFBXCHtC45PyQyYGr0YPlQqGeAHuwPvGu8n5kFTBfsDnw86STPqBLkLZQiHCTsARQ6fEwfTGGYKbYzMAS2HAbOVA1ONfwJriwYzBwcAYweDBXXhABkCowifAAEAywNTADUCqQeZABUAgT0BOQMjKwEd4QKLA48ILccBkSsB7yUEF78MEQDzM25GAsOtAoBmZp4F2VQCigJFMQFJIQQBSkNNA6tt3QDXAEcGD9tDARGnRscW3z8B22snAMMA9wABMQcBPQHJAe9pALMBWwstCZ6vsQFJ5SUAfwARZwHTAoUA2QAxAHvtAU8ASQVV9QXPAktFAQ0tFCdTXQG3AxsBLwEJAHUGx4mhxQMbBGkHzwIQFxXdAu8qB7EDItsTyULBAr3aUQAyEgo0CrUKtB9f81wvAi1uPUwACh+kPsM/SgVNO087VDtPO1Q7TztUO087VDtPO1QDk7veu94KaF9BYecMog3QRMQ6RRPXYE1gLhPELbMUvRXKJVIZORq4JwEl4FUFDwAtz2YsCCg0cRe4ADspZIM9Y4IeLApHHONTjVT0LRcArUueM6sNqBsRRDwFQ3XpYiYWCgoeAmR9AmI+V0mrVzccAqHzAmiUAmYFAp+AOBcHAmY3AmYiBGoEewN/DwN+jjkCOXMTOX46Hx8CbBkCMjI4BgJtwwJtquuGL2NBJwFjANoA3QBGAQeUDIkA+ge+AAmxAncrAnaeOwJ5Rz8CeLYZWNdFqkbTAnw7AnrEAn0FAnzsBVUFHEf8SHlfIAAnEUlUSlcRE0rIAtD9AtDISyMDiEsDh+JEwZEuAvKdXP8DA6pLykwpIctNSE2rAos7AorUvRcDGT9jAbMCjjMCjlg8k30CjtUCjlh0UbBTMQZS0FSBApP3ApMIAOUAGFUaVatVzAIsFymRgjLdeGJFNzUCl5sC765YHaQAVSEClosClniYAKVZqFoFfUkANwKWsQKWSlxAXM0CmccCmWBcxl0DFQKclzm+OpkCnBICn5cCnrSGABkLLSYLAp3tAp6OALE5YTBh6wKezwKgagGlAp6bGwKeSqFjxGQjIScCJ6sCJnoCoPcCoEgCotkCocACpisCpcoCp/sAeQKn7mh4aK3/RWoYas0CrN8CrKoCrWMCrP4CVxkCVdgCsd3TAx9KbJMCsrkJArLkE2zcbV9tRFsDJckCtlg3O26MAylBArhaArlDEQK5JnNwMnDdAr0VArvWcJIDMg0CvoRx/gMzbQK+FnMec0sCw8cCwwBzfnRHMUF03AM8owM8lgM9uwLFeALGQwLGDIUCyGVNAshAAslLAskqAmSZAt3OeHVdeKp5IUvMAxifZv4CYfAZ75Ugewdejl63DQLPZwLPaCtHT87vD5sAwqkCz28BJeYDTg5+RwEC3CMC24YC0ksDUlgDU1sA/QNViICFO8cS6VxBghiCz4LKg4kC2sMC2dqEDIRFpzgDhqEAKwNkCoZtVfUAUQLfYQLetG9zAuIr7RAB8ywjAfSXAfLOgwLr7wLpbHUC6vUC6uAA9UMBtQLuhQLrmJamlv8C7jsDhdyYdXDccZ0C8v8AZQOOEpmPAvcPA5FqA5KDAveUAvnVAvhimhiap7czmxoDnX8C/vYBFwA1nxifrwMFiQOmZgOm1QDNwQMGZqGEogEFAwxFAQsBGwdpBl21YwEAtwRnuw2HHq8JABNxNQAfAy8SSQOFewFfIx0AjOsAHQDmnwObjQizBhufwQCnBRG76R09PhZ4BWg3PkArQiFCtF9xEV+8AJbFBTIAkEwZm7k7JmAyEbrPDi8YxhiJyfYFVwVYBVcFWAVjBVgFVwVYBVcFWAVXBVgFVwVYRhUI14VnAgICCmRe6SsEyQOxBi+7uwC7BKe7AOdAKRayBUY+aT5wQj9Ctl91N1/oAFgRM6sAjP7Ma8v8pudGej0mIwQrFic2NX5t32rB8RnCLGkBa9duMBcFXwVqycHJuAjPSVsAAAAKfF59i74AMz+BAAMW0QblrSMFAIzDCwMBDQDlZR09JB9KQrFCvEE4I18nYDYnOCMJwT0KRD9DPng+gT5wPnECiUK8SUI7X8tOT2pNCixrVC9qC24fX+AzOhsJZ5sKYiMrPB0mQqtCvCvMAcv8X8kOHy4JCAkifp3fajotShfJq8msCWXBy8wKYEFfD+UQoxEAk40dRUIlG6ltOc44CjM/Qz5wQj8cBwodTEdsWywtWuG8Egp97R0rQj8cXQhKCQ4zVENCNwQ7Q5wsCoEbLUI/G/UIUyIjGDAxAAWPYfBeCnFkyWALYC0jbkNgGTkCGx5gswYCaxBlTmBNEQFk52AVYJVgfWCzYEtgkWgWFwa1DtxVqbxaC0MWqwG7K83BAh8VABwDHgF5AmwvMJVSgAGKCrhHGgDkI3SOCsoNpk3qAZsCh5xPBUBfAPf3BwA0FlcMC6UMJB+6r0eAgQw0ABUTnyuCCHoC0gtLZREbANhOBnUECh5aADEAtritAJQnCxZvqyQ4nxkBWwGGCfwD2e0PBqoGSga5AB3LValaCbthE4kLLT8OuwG7ASICR1ooKCggHh8hLBImBiEMjQBUAm5XkEmVAW4fD3FHAdN1D85RIBmpsE3qBxEFTF8A9/cHAHoGJGwKKwulODAtx69WDQsAX7wLAGNAlQh6AOpN7yIbvwAxALa4rQCUJy07Ds4CkBh7ULtYyHRyjsOlmw/ZFUkb7AEpEFwSBh/lAccJOhCTBQ8rDDYLABEAs+AiAQIApADhAJiCCrJrOS8AFABbG8YubHYqDcEQAjskHNPhHB4LG30CewTBCqrxbAAnLQ6mLs6hHAe7CQAQOg+7GkcczaF3HgE9Kl8cLs4RGQB9q9ocAuugCAHCAULz5B9lAb4Jtwz6CDwKPgAFwAs9AksNuwi8DTwKvAk8DrsFmAEbawouzqEqD4sa4QHDAREWOwCgCzsLuxC7BBiqe9wAO2sMPAACpgm8BRvQ9QUBvgH6bsoGewG7D00RErwBAQDqAQAAdBVbBhbLFPxvF7sYOxjbL7ZtvgNIqLsAB7sALrsC6w5WAAq7BAAeuwJVICp/FTwVuwG+J+QAsloBvSjgo7vIAAFbAAG7AAJbAALjAAg7AA67AgAbu6VbDr/EAPQAaPuoOwMBu5UnSwDn3Rm7CBp7CKEFCv9wAN+7p7sau6OLeXIG+6mbgwASuwYbCwG8AACGAG27BgALu6c7ARo7ugihnMoBuwvtB8CpOwDhewG/AADlABW7AAb7AAm7AGmLABq7GLuOaRX7AA5rAC5LHgAGuwAXuwghAA1KAcIAt68mAcAAALQADpsAHBsBv/7hCqEABcYLFRXbAAebAEK7AQIAabsAC3sAHbsACLsJoQAFygBunxnVAJEIIQAFygABOwAH2wAdmwghAAaaAAl7ABsrAG0bAOa7gAAIWwAUuwkhAAbKAOOLAAk7C6EOxPtfAAc7AG6cQEgARwADOwAJrQM3AAcbABl7Abv/Aab7AAobAAo7AAn7p+sGuwAJGwADCwAQOwAIPAAUOwARawAPiwAN6wANuwAZCwYWGwAVOwBumxm7ALobLgATOwMAaSsKAOFLAAI7AARSABd7BRsABtAAGLsAC/sAX7sAa/sA5IsBuwAXdgG8AAFyC6EABUoAbXYAB/sA5XsAHGseAXsoUgA5RQD+Bw0McgAoKnABpAUIXgG8XiMMCQdvS2xfKokfPBRiLTYDoQq0AdgAFgLRA24BdnJHUhQhA08CFT4BLAYDc0a8e1J6QAApADEB+wBTCtsAe5AsASsAduUNETJGAUoAVwUAAVABB4rMAHg7BCClAFoA1hUAlWg3H4sAzWuxAM/UFgjCdXMbGFYdCdEBiJCrIlNTTUgSPMKJ+QB/HDdAKSvgEZdPAHIBKSwwKUIZDwMwVQT3xe4AS2XcAGoCcQI/EXo6x3guNdUGBQAQGx0KCAwqBB8dKU5TTgi5ugAKEs0AJgABGgCGAIkAjjUA7gC0AOAAnTwAuwCrAKYAoQDyAJ8A0wCcAOsBDAEHAMAAeQBaAMsAzQEHANcA6wCIAKIBNQDjANgA1QMBByoz1NTU1LbA3M3QzkMyFwFNAVcvRwFVAWQBYwFWAUdLQ0VoDQFOFQcIAzI2DAcAIg0kJiksODo6PT09Pj8OQB5RUVFRU1NSUylUVVdWVhxdYWFgYmEjZmhwb3JycnJycnR0dHR0dHR0dHR0dnZ3dnVbAEDsAEUAlgB0AC4AYvIAigBTAFMAMwJz6QCH//LyAGAAj+wAmwBLAF4AYPn5qgCBAIEAZQBSAK0AHgCyAH8CPAI/APgA4wD6APoA5AD7AOUA5QDkAOIAKQJ3AU0BPAE6AVABOgE6AToBNQE0ATQBNAEYAVQPACsIAABNFwoWAxUWDgCKAJIAogBLAGQYAi0AcABpAJEDEgMkKgMeQT5HKQCLAksAwwJTAqAAugKSApICkgKSApICkgKHApICkgKSApICkgKSApECkQKUApwCkwKSApICkAKQApACkAKOApECcQHQApMCmwKSApICkRZ5CwD6BQOnAl0CNhcBUBA1At4RCisTAUo3E02RAXekPAFlWQD/Az1HAQAAkykeGI9qAClgAGkALgCJA5TMi/CuhFoFuisOwhEBndV0KgsEIzFsATNabAGyAN5+gH9+gH6BgoJ+g4aEfoWIhoCHgoiCiX6Kfot+jIqNfo5+j4KQfpF+kn6TfpSDlYiWgpd+2gLabOEC2GwAgmwkbKAAg2xsBEkERgRIBEsESQRPBEwERwRNBE8ETgRKBEwETwCWZmwAowOIbAC0ZgEFbADJUWxsAM9sAgxsAPZabAD2ARkA9gD0APQA9QD0A31ebNSEI2XAAPYA9AD0APUA9BxsbACJWmwA9gCJARkA9gCJAL4A6AAIAPYAiQN9XmzUhCNlwBxsAPdabAEZAPYA9gD0APQA9QD0APcA9AD0APUA9AN9XmzUhCNlwBxsbACJWmwBGQD2AIkA9gCJAu0A9gCJAL4CNwD3AIkDfV5s1IQjZcAcbAJDATZsAkoBOWwCS8FsbAJXbGwDnwLtA58DnwOgA6ADoAOg1IQjZcAGA31ebBxsbACJWmwBGQOfAIkDnwCJAu0DnwCJAL4CNwOfAInUhCNlwAYDfV5sHGwEPmwAiQQ/AIkGjTFtIDFs1m4DKGwDrAJsbABVWv4VMgJsbACJAmwAVAEAul5sAmxebGwAiV5sAmxebD3YAEls1gJsbEbCxxP/x5BApA0KYFA89AsjTx97EHmJQPyocItC2JnNFRCEnFU6SFTDoI0PxeRNRoNRWkpzVnWW8pTagkNmgf+jGupqZ3eu50LAFnc+OzfJwdub1AdpOy76VnijWNR/CMEevikQkFyQuLuPajxWi9chqOoMJ7qpCN4sx3LJG4Myu8kD68wC6+iAwt+pU1JEeY13rpCVkXSZfinVKn4xZpxsI3Lp8bJLrJ9ujkrIalMRBAcv/GSKEtowzcEn5XmJw2BagB8V2UWJoJHZ14SXhM7p0XeGFOuw6mlvyq99WYp5XxrO6ru9nn4RHcOkJ7hx5UqWtman7yVMLzYXQefQRUdIY70RYQE8+aAzCNSGQkXiHfnHYRMi+xczKDdZLk3AV1gzxkkSHLjBwuq8shIJ+/RAbqjqQbugFhe0rqklu432EERkM5k9y1DXzds46oLqKAx6OhPT2WiqEfhaITn7OF9Y694AmKmUvbpWp0xJqDaf3jeNJXnK6NpnGcFOmbclbARC+5+5U52ufw5b0Hh+2LrrNimvZe4eYmApRsZnJE310SqB+1xB6rSJfnV1f2D0awB18Oc0sXAFqIlgHgWiaZGdvP5CJUSsCTCQUC335+iSkwPlLJJ5lwjTSn9Lw22NbK1Tu8w+bUpHtDRDPho7Gun8aw2Jzu9i+N0Ot/kPMbLAb/rUQ82kfpk85qLDkfxLl39QPDngo72GYh/Xigbpcm1pA23D2ywt3D8GgMOao040wDqkHxOEx0OhC+ZmHiIdjK7yRbfJD2ouZbAedhD3p7s8WDmCJfNforgDYPGAXSI08fTjPZ5B37lc5VXGzc1vJmibDwBNVzXuaUzg7N5H4BxqjhJ+kz9HLUJys7bpBDYAPvbut13AwJCWd059tS8YTYgC8HwrkewBfa1LSSpmMr9uR2EekTiAMH+Mx4AGzgbquccwBDlLmRhgXL/YiLPCEb6d2k5qJ6o800qddABkpqt7NG+sc2uvHZwZs57W1AHTFM1KkMShasADAh2FvzbzJOzVDMS3ZlT2BSFKdnkZFB6JyqJbhm6XANis9TrtzJdlPVp+rl8v3nIke6Jou7m2TKu53Vounupgkz2LzrQPhhatLIG7rfF/gUKWp15X3LKt+ZvuCDSqPUigF9yJntimC1HJR7Yj/dUrLAXWrT+1tnwPJJLGKAlQ5VeNDWRKCTt2vz3rJuo4+gIt75/Mkfl/gSZblZ9r/SEeeosZXneli/xNh1WVCvkRt2RnyyjtMkMqhzXh1PVOCbILqv0r7rGYm0CHIyKdhHL90cl9E1I6eEtQTCt6RXj8M0HHrHCHLVRpNM6WIbT5BCMGVnL0o5895qSRbCJz+5I8PGMhAN/Xrj4BgIdlKqlHtBHqTJwmK169toZ2IWxNzrAbIG7zh85Q/LG2A4yBcaBel52zdunokB0lv3A7kXnTI7M6ZnfZ7nwuj5lkGhqSpW+w5CI/FmRlplBEbnZy1ZxS3DL8rf1YWhO5XivWZBSRh1gFsjjyj3qRG1cm/6ors7WsEif6WRxns1MKDZa6KrbfMQ/swIb+2nb0tqxHeii6FcgVeAjE/Xwac1owx04dJKG8R5YQgHNnEfHf0qb8WOnU0eQSjazq+IK7cSuCqYzPEUB/x+QgGZqM3dBoYvNvZVOHDkbgdilWdagqO5bkybXfLpyMPuGq8mvAAEZGbR6RwXGlW9ErOWTfnjfx6dXFJqBj0OBSGFz4lWQasNOmVJeN4SFWSLfOGB/7ehV5YuoNNROHZEG9ElVuMnqbDMMuDleOt/cN/gsWxGw128mwU8/HxkOKqdTZnI7dHka67WCTf/FmBrxpNCaKJ1GxBTCSS7MNfhNj8S4Gtotg6Z3AM9cAeVROnppUMaiV5jjudLnNqoVrKO1/FijLlAc74kxydxKX1RQuMqHR63eecYr5o6MJ+B78VsLlCrpelWh6GOrCOBIoQmIcdpJL1pwE2zzZqBkecGTdK8KMOB6r1eNRURyrz6M899TZaoS/vNOxHf+5gORU+OyYIcIW6diP25GHF6u8TNjuL/GJzCnLLXd01KrsjRa51v4+O/VIAWXESJxfxWjv628J+cWUQpoD+Yytzs3jSMRJ23/XT+vUdtUMLDQq1vnIoeg/GjWh88MT6k9dRqDaQ+vodilFgvjuNw5pJpId9mfwyYeLCGb3BmHXdfQfhfPRQaupe/f8TG4Bk3eDKlYBaEK3kZYNN2Sdxz47m/vYBxvIOKtnqplB1pebzuXmAr/MuzQCknKe653dzaWQQ7MUhWYWvzIZwLe1v0rXxImLaz+AkAu+sYikhouNF3EW6w4crZ6MuUiDbIAx8XhAfegcvW6x9BPb3/sCxGWu9YyatqExB+TSm69qIkI9IwhjrcnzME+jWBx4mNQm5WwLzUjSyY4FZ0aMF5YFlXUD4hL4XfOeYv5rDe2s2D/Cn+28fZ9UCnOQvXFMnQqfc0G+ZqOWWD9l/liqUPaNQzZjxCHpUAD8Rcc90MniQ02ugHWsUupFUvhC9usY7zNPt5F2jO7qgzhafsQSd50jgLrC6Qx6bpHbXR3WNAu1BzGmwbz+ebGmwTjdy006Y6zipP7n/OJlvSmbq+SY+nefAVKK6EBMPbce5n3IdRI8+vbxCpN53rw3TvgNds1SuMiuLGxt89L71mxPDeanGhyHvOjmO56tnVpoHalQnL6TqNuqKsHjHCIKB4pCgj4WyYPvRvYvqi5EMr7lN3MotPR/KH7JUD1lZbU0QzfbrEBJnuQiVAyAC9vwXWp2TRU1/0aapyAH2cbglEHVAdl+1rb1u147uV0td1eNoQZsqHrIMIYVPXtLk2TIU3cJE08PjoYNDpfF/IcJnYQHl6nsplczX3Rgah4NbJJHl//5scUufqsSd//kbIS406ZWoMP//+jhGUswX/5nVNz/jAj9KmXPtAmMiK+khhbn1w/mELzZMT/WxcW//y/jsHaOM/61oAW/CjYhJtY622/TtMYuP7bilBvbiT3vB9n8IcFPnwM78H0KfhYDRdY5PhWJ4jWRQzB+HT5NVZV56LG82hcQms+jOTT/c9Y9sx5rPi1/wB7f/+c5UfUCKk3iwwCuywUc2MGnAwsXf1E5hoI55x1Q/Qby+sWH8NRjavZ8VaDsdi1NUVhH86BJHX1yaFt1w1OYeL5LVmdN+5Q+KuTvXEPDzUCg6xp0HhsUhTWSe7MZMM/6rsTUb0/nbUE3YQlGGt48kT1/6cnf6yHnvHtQx9EosOXN077yyEq/jE3YTiG/5SEJmXFeocJJ1EAd6vKeK6VEdJLOZ1km/EwOnZWCQpzCLKPHxrfh4yJhGq//2dos2E/3+MOcdW5EsgIdmTQUQetzRy5fQHhDBl37XbWzsqO/cASEDjyst1/8NEROqVAxWnddQV+umJ8IrKVgKvGaTc0GsQ4s8h0Osql5QKwlddPDjJhKInyWqYUKmmlIts+FIcXZ6yM6cljbsjUG2ksSOkuIw4sYHffRNgBOLApvD6XrR6Rt0rV2Uf8IpnIUVnb9Twt91QjAaD/dStSWDxg7aYY+VXIgnuowYdOkjywa2hlgrnI6PjaU3e3UjQ5Yk5mdIJGyHnv3/P+1EkMav1yFyF+FeJE/RXnWBw+Nh0aOo6TGlKX7d+dkP9+brvr79SdtXJtcD/aXBGiMNfG6/NQniQHYQlK78FEHDqOh+bDI0o+2Ub0h53EL/vlzjrBczVEZz2bOtvIL+DIzDkk9nCWt7tlqsq3l9JMtJk3r5HG2iJ9b/X11TG6wwMAjHLQ2oasaMEsydh88QPvI+hmqIHhvalpKoKOueJR0eZ9J8G2alNOIOy98jwvbc87Ewk9d+5G/tUijTmlbjFlDKXV05HalKxaRTrucc73On7yzAPS6f2v4ogiaWyWeV73dv/MsQT5HjRrsYV9dLAcI3T+zC2qEVINyNpEhoKV+xVSuWtT4AhBfpnZ7unIM+HX3msI0HiI+P+z2PFgkjGi5PqEbG/wNIWeRUjPtDEgbbubN+I4JaDLrW9borRBDob7ZFx+JdKeFVUKVeWqb/c88Ol7DhM0suLtuEd8tkDSMTD3DFx8UphPINHMHi51hAPttXL4Ektt/lKEUG/R4qZKohHjVpAcPIMiHyWr6xR8/EWnNJvBFET76yCdk5er7ADB/1bgoImhpSiZ/omZjPKPCEeZsOwvPmXL+1vlJNeGO3TzySmGA1X6e58gLrazDM71jywM1XL8zKHN6G3kB31Y8vLtP982N975SZXk2JwDvmv7AY/aDsFFk1v+nE7/hbvuOWhBH4kuemeYozPk2K22Vx/YGiDTLU7YilpOt29u3RZMBh4UJjlTP5ItxTzWv6ebL9b+GSU1Vsm2S8LMfVfJczaBSqE8J1A4YUjpsALL7++bwCPXFhaufdpDFtBlHb9makeYbqdg9ltvK/HwF/rNE6KrtWUkEcxmTB7Iyu5TiVaIgW/YxzQhpArliIMkOoK5L7ShVtF+DYqV01mk7fwop04hQRwg4KFmr5z9nYf05VVqkSe7gfnx5bxxlQ0qEV0jiwzf064qG11iEqjHcUgDWWsDs/LEGlzX31T5KVL+7D4EoKim7HBagiqRo5JI3WfDBgpKIruWz9j/J6Hp5Q/EJbMWB8NeSMuFarNw3AEYPBJtYQO/4oD/ZgPTSQ06di0EeumX5EbrdThO+fvYEVSxLtZ3AJkee0Xn0sDwNtiiZhJjJRDuG1YRKB1vOulfd9JjHeyu+UHTmrtra/pm+8Rixh4WKiLaLOCxIbZNoWRZSyyUGLPjAaAo+SQBpfO2uruWrzFxLlpvrXJNMCWtlJDKGAnlWK5xpU2tcxXbeD+sbdfwYXt/qTwDk6UqXR/aUt099DhSNl4Nk8mXwpw+b0nvjKOG6Mg1PRXjrMUMANvNgEArv8nMJs3vj1aHi8MHz/UfJWWzkcrSpZTNBhduXlGR7i+ip/THDp5R9KRNcDKECgtwgXg4EFN5HHfikP/XvsoCkHTg+NbsD8Gl6eknk4Arwn/BWGJ0hgW0/gUKrzuGZhub7igRP3abetpIm+24xEOlWl3YKpm2qTBFvX8ddDRvm1LcwnCJuEfZx12qPY9TrntMIQsv316zvpyWnyStX8VU4j6tQk+CWlLBUCJR6MdH9Cp7g2qdn2WM9qFbREmejH09dlWEPm8hPF0L7RxwRRdiCs0DP8ewk6ApoELkKU9hckSdbnXm8UHJmaNXjxv/q0fTTpu8rnl9lN0vQCpDRbCtcz12rGRFEA7Cfg7FhZn5QFkNmv1ZURKEsiZce1nS9K7HrwpC7yJV4Xt3eAVbLJfoXHrtwG60Z8gwaSnmxoL3s2ZlRqggZN/MHo1oUS4L+GwObFI596Ld4Mvi8l+cQmF1gJpkpnDio7TuO35npaMHiWzFqPSX3qNgkIPGuX0qGYnPIVsM901Yu8oZnOZOY1TbtIdFUNKNq2dP8SJ4F/VCEzIjF0/Rh+7UrZj80tC6rognVH3mqa8eCs/lcQU1Pjj98kBmAKDbZUTwosv02UunRR3n0X6c+f73mtwB7/WbQ16gO431EtwZbNG1SM4TZPBnsQSESlsfG2JLQXx5xWf4bmQ/xcVCPISAX5897JxHKLD/Xkgu57+ABR2+MMtEbX64+MNlBHpKC7sjlWVEShf5qA+dGc59LFVlZrX/Enq9z/v+wnZ1HErmxmjJjxOA+hAjVUWgtq6ygAi/8ewJDjUMFw3zhQFtbyTLDPFd21Ji5S5QPZo9nMSxdg1+DGFSN0wlWt7XeYPbHqLfliV0J1kOhQNp0VbUPy0MS2Ms66OxtSWvaULaWHnfAA+sieVVgtjDwN3nKonWapkSKRN8BKKJQpCfqo8RQI5udhfu5s5+7vwsppmAJDgz2GNA7d43VdbV2l/SrvEu4RYslmNJmfSOVbssxAhSYy6WxpIQdDB0FVBpZ6IM8yr81QN+XLZ3n/wed/R+s6LslkxKbzzst/GkRbe6rFmtvJCwr1T44ETM+IMgOnjUO0eG6a1n2w7lwM1oFBvzMUWRkNFOvKcx3oSb5XdenZ5dXsute6nkRypBiSdAtA2fxAd8UdLOZW/MB7fZoEuFheQXijdaF8kuaRZoSeWdKOkKsGYEGaXfaDKTu0WMTcLniQs7KRCz9iK3SP+Y2xIjkfVGqFLSQ6vh+A1u6FdfwXsv1VPMfi2cxmdM+/xTgMXEyo2ZGcQ2YmPsghnYdv2+z48JpGZA4tUK1p1q2VdVxyfypXEXcrxKKtmt8UdW7sHWmKMqDuBBM3J/JUQx8eUYN4pJ5oRqvdiPHU1o/WPjiKvnlCqOdyxlxF54L9PrtLD1NejZ9aZDivVr6ZfMFK1/psVygoPIAnphcJWWb9+5IKMKmgRQULsTPZi6Bw4wP32zVEoKcHpP73CkFAqS98nSaGoWDjDJiaACJn4p5o1jq9R4Q4VcibhXF//LHP0bdf63kRVZdRbbhGe7sDQcyWS5tpkfeYHnff25WK+4FpzLlAcbaKmHdIBqOw3fImx1uqQIADH0TyHzFlqTG6nMoY81svP0T6BIyELMS8tMe+E1p6TFP6sVpZa6VNaTumufD5aj9goRa9SAmdJT4HhI2r0egj8UrgFb8L59wGLnYlzkLAiUd3m/WWIIEU61kPoEjd3gIVy/fiBcgqQqHnoXpL0SqLGdGGgn7DQeVMSYWHfjno1FngIKP9cjYaTlcRP6bZunjHP13/lbVm4awti894pTf/ZNNqr4OR+tDVie/m+rC8QpVnRbsCMPukOH87B2jM4AG6pHuXl1x9SiKdhYJVOhfo/+SCaGjUW2CoogL1FFhFGN9o+acoVLl0SXs/3vrSccmZeAF3NewFuOg/P12QYKQF+SH+KYcNnsAhIAELPBUgre/KRUJEA+KPD0MHRjv+3J/j2Z23MuJmkfy7leWcMsti8wXLSHgXFJTaksx1Woi6oljwxFVIJG12SBSZLNJDbXMYPekmiXT4FclKI35BFgqnYpKfcsr+f8HUXQoHJ9UYZ4J5YMiHHyAxg6eidhodgqJ2Htf/xYEx+G0zXchuzlt8hcAl+AT8NCQ4orFc4DerabF1enA7NTLnvtZh3FUwqIOvY7Q4DYmoDHwXTSw5UNNh6r7j0B/ezMYJMDcw4+6gCTZX4YQ+7Xs8de72vsR3cmfpxIX64/6KR1p3VX4F6vfHEzxzarh8aDH4G1DFoBBM6npXFpK+Rh+WrcFclAeAxi0PoaR9CpOxxGLSdvxKVSw8oOOanG/soKImRopN38AdcUhhM2GT/PgQeSQrG12njuJJD5Z7vWfAZmFybYLdSA91kB4aoBhoj1Z//KNIVVujqaLLRwCkbyn4vh0739C9V9iSjybeOIeSOvNs7LW1a7EUtNoKAnOGML4U8KBXpfrw73WjAszJG4Qscq+Xr3kZWR4Omm0xT6qE9y6FNSpstV4onMZSqCEJ+3VX9qjvdx5QVrM0WXxmPZxejdfnihcFAjzv5PjlTl6ickDbHe6+Lch52pjOPqk+m3RZ+bh2JSMGtFBuODbMchrpRVlt16NTQ05Ps0IDtWlUmWfP2vX8M4YDynIuOZ4Ck91+591B98Gw9fw+yQogTR8CSg0zaJu+rlBo/mr3A+1NziF+kdubz+whc857AZt6DwIBIF5+5yiaaf3ByQp1Fm3sOkZDAzwsYSQTM/Kv6idkugF63FDobDdUY3huruU+sCaBuRR+HmOowvmZoBjZHNh77SXFtmY/oOUE7ifN7nBHAo83S/xvcS6H4Ci2u/9Id62Wv6Ui+zMNLAzhfkTkVcW2BwrnYvpur0ZDlzs+ZLsmGTWvd1892t78gx1YjEJusGcxphjLkV0UfAKlekfSBVWHE2ahk4AbbRmHyL7GYdtKfdlINwrcdJuf3Cee1nfUojDQn/YmItESOFhtLzrkEv4k2XpMU9oaJQ3VUC+1INh6BE68pkHameGJm4Gvdb24Q0fXWxd9Tp3A9mzFSe4qXDGGDIV4AAGV1jIDfveknH1TwWpUT6HiQxKP3AAHJNkJeRlj/mXBmS4S1j8FK6YmpK7jyyAiRbsMCCLoJcx01fvgpMvKQRxu9IOwymconQjD56g7ksOrcOeoTbius4JnGesAS1DtgdaophYsw1wGIsMS3P7K6doE3K5czznqPQLSRRF/Ylzb5NtSKsL33SgskFNCF4khn5LWaDxI23ZRi2hzqN8uW8UzZEBYy68+VtGLSymQrXGUlr2nO2BbBIT5Vh1RmGAyDXaW0FPrpx3wv2UYdFk9tSl+906bMxCuXQaKDQP/U19UEcVGK4gmksL8lAorxQSAOwpeYX9xrZsh6yoGaL/X5O3tgQC8OM+/GvxnW9XvAtu/JxAigydfSmZfqZfg1XOcHNOpLlN8j64OZ36l5qawDBJ62YaTvxeNmm5gowCdBosgcpHOgNgwA+sknN8XmsR2IYChcafl9bGNMZ/nB5guWuvEziv6QI2bP2DtyKWG/qUjZMaxy+wASkkVGtuwGtywkTYG6MYrZBo18vYcww48G/+f+eITA/qMwbLlJC0S3+/ai2pPvkOhRRVmGTuSupaxhIk0xoXLtixCxSAn4Z3OnUS3wBqVscLI4P3GP7i/6gxYsswsVmkvDXFLhO/OKcur8flegCSKiqmVpIRvCzgbjEA0mXPn+RExXY/2OE1f/BYuWpRQY8gCDpMOYBx9Gn4tL3hihSIR1ixh2PIIT7cr2gUJbfs76EKYG52Jk0UZF/PQkBxGuFCEWXnG6ue/hTIqjTRq1sotVrKrwIGHDrITyuanUzbIYdgdEeV88K1VD82TYB2B61Ft+tB1KqHPmT9+hWoaV+iF3SuvtJqvnoLaA8wxrD56AUMULEgzO9SvBcBAfqz/dzMYzwMt/YLszDbmGe1bcHHfFMcvGql9bf/tp+Hrj4q18aNnftGjmXTfws39emn7/5IBxog9MrmftAA5Oq4awenm8HimWO72dwVlHcHmutVMdrMHw+p2vzpzT+B0iIZ+IEpplwWhClcXlxhxAsF3CHRnnaUEqq3ByQ+cqhe5SvR4SFxh/LZoQwtj8QZQGT1BzY2EMpYnUcZWQEPlwFZw+7UryK9qV8KgruYsvyMoK16KI2sN4SOblrVwhyiL8+IBZ8cpUhsJQSU7TFHAi+L2F0sn0y+FtDODlnuif2Mba8QddPZYYxjTsIgkMe3M6+7kXxUfZvbCUlyq71J1eNczGk6Vqw6rSx2K3vM+DjLxDRGzWepTO2qTT/W8S7u0QXcyFUahcB4vq8xCYTpy8iswtnyz7Kx6lgTEQJ9RqkgEIN6DOUqB0uRdeYuDa7AP7Zy9z+ZlTsmVR5vtV71m3dmdtNeWghbr5PnPJtjXAzcvZjxyV96VEx/B1TA0IEQSI50ywGuIbmAYdQg/l/rxhQLX+6uOLyFsaUt6mtjpAJkLfehnB6MlOHnNOrWLvCBqVBS07jcM+4RzLEed3f3/0Xwp92U+nataNHyEgnnuYR6PXEjRLETz0xrt3UglfK7Bn4aNlXG7cZco4lMziLv5+Mh2JCww3mz69Z9ZMRR/xv5EKJ38IFxKd9dw5CgPIXja/gzAshMbF14/qBIgNkdUQeP8YE7SrICGtiTnAKTyA9cXa3OauDHxZOdTP7yuYBzD1UcHstIO16FxF1bRUAlSkszI83YufTchU8OPnnozDl9bS0y6CnnjGwgj9M61cXcZsljjhLeT/Vq+30ScN2PcT/dOoxUDqDS38+OpCCzLDdnwHQc3ECQVIkaxmdPaZTSdfp2jjGzSdNLM5yPQsgJDl+ZnhclDQi8ltUnkqWJ323IvTZPN8rn0+EshL1cx9PiaLTzUsryn9Zp2Nt/detUAh4N/2I3dlMQqjHFxSihv0uykzflq5clMy2ZBaxoEb0/QMp03IQQus3vnZd/NOmSsmgqXqKFP3ozyDgY7RQS+npabe/hNG+5sa5FtvL8v0uYuag2NewYkcol3TOTadpuncCnDgOGpmLnTQ1PEPUN2cNsrW8LYfIv+hzfb7vod+ipXHzmbgj5Fzc6RcT/5PD7VQ8nTJBNj1urkVUx9uJvTWmqY08OC80rGDLaWXv243VB16gjt4Xtwp5H2UDR0LiKW24Ed/sOO8jl1yEU/XAb3h7ScKnCFy/V3sICrkY1D0K9fSokHIL0s5/7DLShLAPXRbV7fbv4qj6OwHC9d5PlEOX3LRpQ3P7hcSAKlIKPDM83ypz56U5+rJeo0cyUtC7wltL8wqEiNSgZsDWzACc7RFoZqhlD0+sihIBQlkQTXmvUyIOZhkQX2zqME5VRC7ms1sa3CY+odMn3mMBiTvCMKnnCxg5ZPLq4GUDB4jF8Br2K4x4sxfWjGXQatJ25I1JyrIv2Z4bP1jKw5C+B2/s0v4dGUOsaS6IPIQV3ETQ+F2fSl2BPBXHzyYN8VmwWIrKeMX9pyGWuAOVXwkxJsRBaBVzLhZDP8ONGncknL5DpTxHN32GgFWMwsc0GmL0oRDmRT8u2lvjAKUIi0MmXhIHSlFeh3Qh5pP6ap4YUd6b569ZIaHgya2AyD12cPxY0In/PBjzDctTaKJCU+xc6m9RkNLDEE8guvxtJP8sl8N9bLqw0F/qejaBlcHYqw31zYpsutQp07hsP1vhGdl4hJ1wA7OCsAHnKj9879uSHILEmuZ6vI1lT4tvnWCVKZhhYrWHW9oPKPKpbOC6FTjf/OtUvwmiXr2ykvyLzHGQeyS7BenZpL3N/CaF5T7Gkml7JXN5cj0PKaDpZVImD61FuMgFHPqSHvt4Ej4KBdAfdcoO3AjQPLwwtKsgGM+ty4lNZMBEItJSRLunG5ckrM/BeoXWoPZVvEoIzLgFQYPupMwZCXis4W2SCJ2zsefZqCj+aTfSq1FYdUj2UeJALvVTf7vuuikOE1Hit3UIAGUi/sqgMum9vw218y1FlY/9XnOji9nqhGAcMYICc7BiqLZj5N+cKEuSAuiyWbMg81ZD1lHovy/we2eaCcCv4MzEW3O0mVA/t2xdA0cxTVbXmFhn+tARDpvDz5ftLr15OAAmvo2QiAky+feVO4bGibv2nlBmBzqx0lEDfEm4UnEs11pbnwZlJ/0Y73/wBPYfTNZiJKR73TzdCW1BffiJq9bLjQmaKnU0+gN8sfe25IKSUCooQwxePDrFn3a/zUgWxvPoTYVXfobY/GV2qqTkeVDV9D8657fhY0/wiaJ5NfLxhXbE/naxs34N0hd6vxNfdm1TCnozm/NKSCThchoYgMF7Z2tzXFovRfsNVkf86JjrM60r7UIuV3bsmfrMOqzjXjN6HPBG25zCJ3QLueySbj9oFvX/HxWBqh31PBPxduCVAxMqC9HK+YL3oBZqBruoh6LKvdMqoz0PYXUBrwbiioyE8Tj5ImjJmiOOWLbAZvIZ/l9rIPljx3T5glJ2ewlfuIT5GlodQsAf/IEtmYkML5SRQGxxwW+rlZkD8belJNu09Itwx9xDULTnemVDeojdbgcd2gKGM9aO00Jivtbs7ZyOSE8IPh98GfvatD8Ud5uHcZfAfMiPSlIxd4UqeSDzuNfbKDuFepkyC/s3j9fawmhY1b9NqDi0ZS5eP35l7rL2eK5QlWLlyCmxx8AFaFiTuD2pMUxZV5mBSJuJduOaq2ZrWpu28DE8jl/hisBz7bGWH6qLF0ayWNq1Sejtcs8KQrQqJk5P9QHDYHOIolgNsMDmEaWcTelghbfFCDqWrq6YLwDWy+m68ec5nShgq2fduUBpQUuKKKgnttaUX9PRfMmxqJyU7e0RLr1bev+ge1KK0bZyhHKKDE8gQX9Vf7rNHWOxBtZcxwwGusyMpH77qWZxXsQmbgIGhtiO+gSSRCyu/ek+OFsz1HMiQH0IHV7PjJi3dszYfFp8ue9h4+AfKte4MTiehPvxNcm/T1t9vsFZx8rHN5ie77r2jzZOq/Em4Q+H9sNcZakf9HnzCc1fJixppxP8FQABmVnqa6GbJhwaka7WH7Wdoz1WxOjSNV8N9sgW5S3Ppgkut+TTCkjA+AodUOk1KIR+8G8S3WrSZG4nyqfJ6FEjXl6a/LEoRMHZUqfPRWvwqrtXYy9IUsmUGzkqi76ib4NANCe5DnyOxnFRZ9d8FdBVBjra3iNuZhJuWW5Omi/hBigqDsg0mu2AhfJDXdwyMIJ33HHHPfS2JtjegRejX11m41TbNL+Qp7mR0g9CPKTj9PIjuSycGN/YPozXI4zarXuAeLv5CHKtKcJKRbd6R2oLNiEt0T8+QIVJH7zt9ncKMgd49vV2P1AyScZ9Qzbu3m3LBnuu6dw7aE0b6r4kzVkI/GUS88mA53L/rLtntkFlZXGtIoqNP2mD3eVv08AVVPT3wJn81zpbJV9SuqZ6Pd1ge0Zz2RFHeCdV5CLPftH9V5o9+VzFu4R0QeumqDwUhXn3IyYotdJnxr1l3BqWnQVAeDBEOtPyJQx1q5+mODiClXtYeBLTWtsJ42AMBcf/IFIhpfhYO08hsg0Ik+DpQFNOKReK3o3cudkxWX0soPtI5eSFOA6yNylS+IQjrQtYQ/5s4UcixJfokumBUjpH9ofSjUTwPCapGFndfqqG5IHeMMvfg+88SXm7bNyjk6pGKzL+WxDAdqKtQ72WWVbOk3I+ueGuammmB2pvFZvqIcU/lvW3n9+r2lycnQLE4OX9R1jIgW4cDjJ3v8dAa66mVcfC7ptCr5io6mCaA9qI9T9FFWqo1ZAaMxgxAu8aXqmaOYryMND2sTUfoHvxcYK7hEiJhCLYFDx3PBhE97c2a0ub1/ePJcyJOqr7UaTAPTJ+xvZtjb/40sloY1ltRnTkWILmIP2b7S3AdXCR+YiArMUHwdncpjpyDGfzqGOUoAuaamWzAMacQtb34/M32FEgR5lUEf8fRzFrZUhzQj0fR7/6gdzdnVVvcSneLmtqJ930VCCDORY8CVdQWdo/S3PNkX3pQsPVKWIYGAMrFZoq8bQ/OJBDSXP7KSBdL3QN0Zqd393p6VFc7DnlnFiN00SY5Nux7yadeIM0Upl2rVsu8/VAI";const Nbe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Abe=4;function HIt(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],P=0,T=x;for(;;){let F=Math.floor(((C-P+1)*s-1)/T),$=0,L=r;for(;L-$>1;){let ne=$+L>>>1;F<a[ne]?L=ne:$=ne}if($==0)break;N.push($);let z=P+Math.floor(T*a[$]/s),X=P+Math.floor(T*a[$+1]/s)-1;for(;!((z^X)&g);)C=C<<1&v|d(),z=z<<1&v,X=X<<1&v|1;for(;z&~X&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,X=(X^g)<<1|g|1;P=z,T=1+X-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function VIt(t){let e=0;return()=>t[e++]}function yLe(t){return VIt(HIt(WIt(t)))}function WIt(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,a)=>e[s.charCodeAt(0)]=a);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,a=0,o=0,l=0;s<n;s++)l=l<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[a++]=l>>(o-=8));return r}function qIt(t){return t&1?~t>>1:t>>1}function GIt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=qIt(e());return n}function E_(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let a=0;a<s;a++)n.push(e+a);e+=s+1}return n}function vLe(t){return __(()=>{let e=E_(t);if(e.length)return e})}function wLe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(KIt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(YIt(n,t))}return e.flat()}function __(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function CLe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)GIt(t,n).forEach((a,o)=>r[o].push(a));return r}function KIt(t,e){let n=1+e(),r=e(),s=__(e);return CLe(s.length,1+t,e).flatMap((o,l)=>{let[c,...u]=o;return Array(s[l]).fill().map((d,f)=>{let x=f*r;return[c+f*n,u.map(g=>g+x)]})})}function YIt(t,e){let n=1+e();return CLe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function XIt(t){let e=[],n=E_(t);return s(r([]),[]),e;function r(a){let o=t(),l=__(()=>{let c=E_(t).map(u=>n[u]);if(c.length)return r(c)});return{S:o,B:l,Q:a}}function s({S:a,B:o},l,c){if(!(a&4&&c===l[l.length-1])){a&2&&(c=l[l.length-1]),a&1&&e.push(l);for(let u of o)for(let d of u.Q)s(u,[...l,d],c)}}}function QIt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function SLe(t){return`{${QIt(t)}}`}function ZIt(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function LN(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function JIt(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var eFt="AEUDWAHSCGYATwDVADIAdgAiADQAFAAtABQAIQAPACcADQASAAsAGQAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAecDNACxCmIB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgPi89uj00MsvBXxEPAGPCDwBnQKoEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJEMAJpIBpob5AERSMAKNoAXqaQLRBMCzEiC+AZ4EWRJJFbEu7QDQLARtEbgECxDwAb/RyAk1AV4nD2cEQQKTAzsAGpobPgAahAGPCrysdy0OAKwAfFIcBAQFUmoA/PtZADkBIadVj2UMUgx5Il4ANQC9vLIBDAHUGVsQ8wCzfQIbGVcCHBZHAZ8CBAgXOhG7AqMZ4M7+1M0UAPDNAWsC+mcJDe8AAQA99zkEXLICyQozAo6lAobcP5JvjQLFzwKD9gU/OD8FEQCtEQL6bW+nAKUEvzjDHsuRyUvOFHcacUz5AqIFRSE2kzsBEQCuaQL5DQTlcgO6twSpTiUgCwIFCAUXBHQEqQV6swAVxUlmTmsCwjqsP/wKJQmXb793UgZBEBsnpRD3DDMBtQE7De1L2ATxBjsEyR99GRkPzZWcCKUt3QztJuMuoYBaI/UqgwXtS/Q83QtNUWgPWQtlCeM6Y4FOAyEBDSKLCt0NOQhtEPMKyWsN5RFFBzkD1UmaAKUHAQsRHTUVtSYQYqwLCTl3Bvsa9guPJq8TKXr8BdMaIQZNASka/wDPLueFsFoxXBxPXwYDCyUjxxSoUCANJUC3eEgaGwcVJakCkUNwSodRNh6TIfY8PQ1mLhNRfAf1PAUZTwuBPJ5Gq0UOEdI+jT1IIklMLAQ1fywvJ4sJzw+FDLl8cgFZCSEJsQxxEzERFzfFCDkHGS2XJCcVCCFGlWCaBPefA/MT0QMLBT8JQQcTA7UcLRMuFSkFDYEk1wLzNtUuswKPVoABFwXLDyUf3xBQR+AO6QibAmUDgyXrAC0VIQAXIpsIQ2MAX4/YUwUuywjHamwjdANnFOdhEXMHkQ5XB6ccMxW/HOFwyF4Lhggoo68JWwF1CZkBXwTjCAk1W4ygIEFnU4tYGJsgYUE/XfwCMQxlFZ9EvYd4AosPaxIbATUBcwc5DQECdxHtEWsQlQjrhgQ1tTP4OiUETyGDIBEKJwNPbM4LJyb5DPhpAaMSYgMMND137merYLYkF/0HGTLFQWAh8QuST80MnBrBGEJULhnkB78D8xrzJ+pBVwX/A6MDEzpNM+4EvQtpCIsJPwBJDqMXB9cYagpxjNABMYsBt5kDV5GDAm+PBjcHCwBnC4cFeeUAHQKnCKMABQDPA1cAOQKtB50AGQCFQQE9AycvASHlAo8DkwgxywGVLwHzKQQbwwwVAPc3bkoCw7ECgGpmogXdWAKOAkk1AU0lBAVOR1EDr3HhANsASwYT30cBFatKyxrjQwHfbysAxwD7AAU1BwVBAc0B820AtwFfCzEJorO1AU3pKQCDABVrAdcCiQDdADUAf/EBUwBNBVn5BdMCT0kBETEYK1dhAbsDHwEzAQ0AeQbLjaXJBx8EbQfTAhAbFeEC7y4HtQEDIt8TzULFAr3eVaFgAmSBAmJCW02vWzcgAqH3AmiYAmYJAp+EOBsLAmY7AmYmBG4EfwN/EwN+kjkGOXcXOYI6IyMCbB0CMjY4CgJtxwJtru+KM2dFKwFnAN4A4QBKBQeYDI0A/gvCAA21AncvAnaiPwJ5S0MCeLodXNtFrkbXAnw/AnrIAn0JAnzwBVkFIEgASH1jJAKBbQKAAAKABQJ/rklYSlsVF0rMAtEBAtDMSycDiE8Dh+ZExZEyAvKhXQMDA65LzkwtJQPPTUxNrwKLPwKK2MEbBx1DZwW3Ao43Ao5cQJeBAo7ZAo5ceFG0UzUKUtRUhQKT+wKTDADpABxVHlWvVdAGLBsplYYy4XhmRTs5ApefAu+yWCGoAFklApaPApZ8nACpWaxaCYFNADsClrUClk5cRFzRApnLAplkXMpdBxkCnJs5wjqdApwWAp+bAp64igAdDzEqDwKd8QKekgC1PWE0Ye8CntMCoG4BqQKenx8Cnk6lY8hkJyUrAievAiZ+AqD7AqBMAqLdAqHEAqYvAqXOAqf/AH0Cp/JofGixAANJahxq0QKs4wKsrgKtZwKtAgJXHQJV3AKx4dcDH05slwKyvQ0CsugXbOBtY21IXwMlzQK2XDs/bpADKUUCuF4CuUcVArkqd3A2cOECvRkCu9pwlgMyEQK+iHICAzNxAr4acyJzTwLDywLDBHOCdEs1RXTgAzynAzyaAz2/AsV8AsZHAsYQiQLIaVECyEQCyU8CyS4CZJ0C3dJ4eWF4rnklS9ADGKNnAgJh9BnzlSR7C16SXrsRAs9rAs9sL0tT0vMTnwDGrQLPcwEp6gNOEn5LBQLcJwLbigLSTwNSXANTXwEBA1WMgIk/AMsW7WBFghyC04LOg40C2scC2d6EEIRJpzwDhqUALwNkDoZxWfkAVQLfZQLeuHN3AuIv7RQB8zAnAfSbAfLShwLr8wLpcHkC6vkC6uQA+UcBuQLuiQLrnJaqlwMC7j8DheCYeXDgcaEC8wMAaQOOFpmTAvcTA5FuA5KHAveYAvnZAvhmmhyaq7s3mx4DnYMC/voBGwA5nxyfswMFjQOmagOm2QDRxQMGaqGIogUJAwxJAtQAPwMA4UEXUwER8wNrB5dnBQCTLSu3r73bAYmZFH8RBDkB+ykFIQ6dCZ8Akv0TtRQrxQL3LScApQC3BbmOkRc/xqdtQS4UJo0uAUMBgPwBtSYAdQMOBG0ALAIWDKEAAAoCPQJqA90DfgSRASBFBSF8CgAFAEQAEwA2EgJ3AQAF1QNr7wrFAgD3Cp8nv7G35QGRIUFCAekUfxE0wIkABAAbAFoCRQKEiwAGOlM6lI1tALg6jzrQAI04wTrcAKUA6ADLATqBOjs5/Dn5O3aJOls7nok6bzkYAVYBMwFsBS81XTWeNa01ZjV1NbY1xTWCNZE10jXhNZ41rTXuNf01sjXBNgI2ETXGNdU2FjYnNd417TYuNj02LjUtITY6Nj02PDbJNwgEkDxXNjg23TcgNw82yiA3iTcwCgSwPGc2JDcZN2w6jTchQtRDB0LgQwscDw8JmyhtKFFVBgDpfwDpsAD+mxQ91wLpNSMArQC9BbeOkRdLxptzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgELgEaJZkC7aMAoQCjBcGOmxdNxrsBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUHqSvAj5Gqwr7YrMUACT9AN3rpF27H7fsd/twPt4l+UW1yQYKBt2Cgy7qJpGiLcdE2P1cQSImUbqJ6ICH27H4knQMIRMrFkHu3sx6tC35Y+eLIh4e4CMKJ4DfyV+8mfta499RCAJ0xfeZR8PsoYOApva9pjGn4PhvyZS7/h5JLuhaucfjuU+Z584wwqNO4hWYmaBCcjgQPale1bjoHzMUbut/zTgxHxBnAyrdKpF4IRMASLBtD/jviyLeCgj8twWjAd3HchN/uqaeRYeHJgl7JEY9/cTrvtfybx/r3Y/NtxJ9dp+MTVmiS9bwBH73s8Di56/Ma+mTPMHq4T1yEG1fWcqr0u+hrGnJEvU1JJAm/maQSrKrazIyvSkDFkj8UUlfBq8baniTGPng6YZRL661rDNw4w/1g2figG0IhXnL7wosd/sVNo5dYSmMBTP5c7rYLjRdCwg8quwljOMPf63D8ICAL0r71XRiyFHdgwHbwfgnPOf4Lzjf2v+j+IiDHG2isp5yUnzSDyDRb4i/Vs0qHSHq8PiEQ/JnBP7PxnjN0j6gT4AVAeRx/1o9VnEUlUwvFrzJqHk9jxAw4sYxCnrxaeBdCFFKbnE7z+x54F5W7ZZsU6kx8Qocul6FoAHHy01FGL/nne61mn4+uYXfQ1Uccn+HMLKE+cZzT8BB1E3FRskOgJrRsq25rauLm8+uamXpkS/bTy6y1wDbCrW4eD532kTWrtNUmVVZOIn/C+/JR9KVR5iG9TY8iaT67ubm/whL1xbKZoqtY+a6fNxMJrg211bGYJDUkYMNWA0BMB++9zOm6Eik4roqs9CCEFW0lyAK0PbvlzvoxrZuY/OEhNW/l/63U15Od/RSvmDvXpGLiVmeGi5PDSH2bYz5o2g6wFDQ2FbZgYgTF8rPlvA1ifjZD3NLtFdXdpSIJvgKR7GpjJWG7GZGawPomIH8B5tUmtHH9LpM+/KQKunEPa1GiQkCXv4Cnm9DLORo2joicHdPDZ64obQrPZ5bgqckkj0G6/NEiPYBY4bCkL7W8G5YzsUb6GakFjykSPkT7JGeLeB6uJOGMm+x7N381BCDfbJFx0dtLgV9Q477BfL1fvitX5anV/oYfxeYl+eF5x5bB8+Ep/L2nsmd56aKF4aAD4GbJWsdKyBW22xEmAD3XdbtsMyAFoR5mOla0gEd9U/YVB7zvHGpHbQonay9Sv0bQ8iZ8piaXVrKc5AG1AmqqgaEvzHSP2Wux7aZTWh6quVDVU01JtMIVRdCFwlSbbqqhoFlyzsotQzRexFvZ/MqUSFu3OhRIuNBbufvBpdVgb8XdGJ48/lJPCZ7dsOujTTbKPSEvGXkOnG2Xdi8/nM3EMRqITd5QeU7iOjKqC7URJY6TnLsHij22xAHKnVRD5MDtBYnoGFqZGMDmXCW6Oj+BAWw14hESY/xLF6bLku06AHkiXTHPCFZ0f9YSqqo27eAhhS67OrA2Het4M9JM3jm/yRX6bYxnfmzYl5qQdHxN08FsNuWDrWd4vMUY2QD3hr8vS73SCTkFoXZR3xNzOQt8d/6HfjBmXqvrE6EGkLzK6YK2U2/ksU/iUH+LvVIsJI+ri2AL/klo+ShdDyfs5A83i2prkMs51IKR7ZcqjZJi5X3+bd8GlyWvtddxKEoEqSgEO7A8jIgf2nH0h8FjM7oB6yte3X5mpL0i/E4Rx0CotKnILJj/vJqo4VkPQ93jRtRVfaitQPqldl5xRYPq8387Z0DcnZvOeION0Ht1+P27kFLGQIcLBX4FG3sffccNHh5cPfzp9INoRtqVtdViJfg8RjnXiIz/MNqEN6zvzX3hMzyWC7oSoXIT14ubc0abPX8Rp9GVa5NI/8iv+6ela1oTncbdimRKnrbRffDR/X4nH+bgqAuHWl7hOaeXPWVzIeRl7ga+JzD4Sx3mlj/q6Ra/E2HhDf21eEzTLNGfCZsY+/yxZzQzIAuijG65ii4O/waAJCrEJaWd/DRAKMQ5678Dw5AT7RCKzdadIwd8LsD+DgPBASmWsUlf8R0k1w/2k4lO2Wpb4zMI6EJVJs0xk/wn8/fRUPqrDKhbjHR41SqgFMx5RGMPuduFwlu5lK89tW11sTqiX/5EfGs5nO+y9FKvgXKPOEmgE05EKNL6Sjb3xS40H3BVPhm0ESOZgAjZoymc8be0inDVo4JdJVf+NKd3tN/CaB7GShhH27qf95NoFZVX/6ZkR2lX+CgWrQ2INgkh+bbMz68+uJ3Clsh8HSMPEQtAt+BBE6fXDab7KIlsKxU1lIXW/KWVstpdPanJ0pdXpQinDyUQjtY7ZVcfiecRxRDMAUhHFU2cEaciQ+htiPMPx1kdvtWG9T44w3r037ljHBFJdYR0r55qvMRixtAEFJAqA4T1ES87FAx7UozXasytg8MftZYt0rjYgLe6EJ5aWvy2qscBSBQ7yehoJIA3wIIZ9ukfkyBb6qnue5ko8W50rpV4kXqWjI5nbGRXrNW0tBZHXlY48nSgcUXBHWT4GcgLZJoLlKJnV96kCYpq9eWHh7xJzkCAyrQuQ5AJ0qq/uZ3toJglNterev+Qm0KXxPg/+YbFRJdfhbp1wOnVOEYdVHTya6CtO0afhEaBhx3oHwCb5Kq6RwHDzFMl2vfjL8GwzcCoTj7wZe+UFnYDV2yKpPU9dba29gYBdNqJg/KXozO+CJTlKmlKhnqTf5doeS35DZFV+cYJQVjd+oVY/Gtc/6XPzUxb1gMqf6cEjNNoRC8AObrp+fx0cVtGu4ffC2TgXRC8zPl8moUHCB5HZ25d87mlsiiK0aNwBtcEQjRNBT/QrXbw/8aVXdKMHn9EqYEKEyxSGTpYQOaes1G1Qq8pDgqkZtlO2HRyCXpmeM7TSrRPkAh004BfisVpF6zP44n2Jvxz/gOVocNCyy9V6lkod28QM4pbaMvVJigD/w3BrsjSJrXlqc4ulBYOCceiBN4b/gHajYyupbhEt63a619Ay4wsL6a6w6B+A7TnoyE7BliWHJfzVxxIKM/W3M/J8Bx99Op863Q8eNuIMGRx++VbYfjm+VGYBA3Ap/KEu/wxBNBpJJncwHPG45V8Gh98ZIrGCc20MwijGowZbcS7d1nEgcOW5cddZpHL2XPAIRbColiheZzXTvBxZOY3iMSDSKDrICyJ/iQs1vdplVdH/JrLJsQ2jtTnfCrITIghq3KFX3qAgLWAIp8IffNSdTYptnbGfc8s+qcr3zyzyHp1aJg+jxTF4kD1ry5Wauv5V3xnOGwTFecNzXSLHBW20/pCQjk4uorD0plIhMSTc79+/r4RKPClRYTBYex1Ob5crtfvRQBBv6re/6FhtCqtduag67glqRA77/3ulblh9YRtMdDxkCyJDeNnAuCLPQFmdRRWJtH20Z8DstfJf+5oj5SSB64d0iF5/Ya4KfTWxfivj9Ap2/zbYaTo/1gO3tM6RYsCZharMBFr7Fm61mLSrQnEI4OF1gbVS4k/JE9UotOrnLJZuswoWodCSV8zbybkJSVIP7n8UaE9xCR39rJZmf27HOAPVOGc9pdkQUcRrI0qyVF9Z3j1RHDbxIfwbWzmPVjwIdPJvtmBYwEQIUsIW1S939hcVikK00ozPRI02cqhzVUNzpOxVdrwRPvlh1aIOf0xFEqD3YkGnCnFah/cFN3J2gB7N+bZSGawwkKFu1tpQMrp1W+27YNkyT0TpcFpTqgOqqLabrgcCUPxh97mREOGy4xItzQ9xSl6rq+8BZsHcrQFReS+QeMxJ3P6CnL9EP/eOLDjumLhvrcQrpPiknsofbzBv9gTP0lU+TIVwE6E7CcKfT36q+ZiEOHJ9ayf0dyUJLezAb2M8aNHwd0+OJmsVgTzRWA";const k_=44032,bL=4352,yL=4449,vL=4519,NLe=19,ALe=21,DN=28,wL=ALe*DN,tFt=NLe*wL,nFt=k_+tFt,rFt=bL+NLe,sFt=yL+ALe,iFt=vL+DN;function e9(t){return t>>24&255}function jLe(t){return t&16777215}let one,jbe,lne,dM;function aFt(){let t=yLe(eFt);one=new Map(vLe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),jbe=new Set(E_(t)),lne=new Map,dM=new Map;for(let[e,n]of wLe(t)){if(!jbe.has(e)&&n.length==2){let[r,s]=n,a=dM.get(r);a||(a=new Map,dM.set(r,a)),a.set(s,e)}lne.set(e,n.reverse())}}function ELe(t){return t>=k_&&t<nFt}function oFt(t,e){if(t>=bL&&t<rFt&&e>=yL&&e<sFt)return k_+(t-bL)*wL+(e-yL)*DN;if(ELe(t)&&e>vL&&e<iFt&&(t-k_)%DN==0)return t+(e-vL);{let n=dM.get(t);return n&&(n=n.get(e),n)?n:-1}}function _Le(t){one||aFt();let e=[],n=[],r=!1;function s(a){let o=one.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(ELe(a)){let o=a-k_,l=o/wL|0,c=o%wL/DN|0,u=o%DN;s(bL+l),s(yL+c),u>0&&s(vL+u)}else{let o=lne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=e9(e[0]);for(let o=1;o<e.length;o++){let l=e9(e[o]);if(l==0||a<=l){a=l;continue}let c=o-1;for(;;){let u=e[c+1];if(e[c+1]=e[c],e[c]=u,!c||(a=e9(e[--c]),a<=l))break}a=e9(e[o])}}return e}function lFt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=e9(a),l=jLe(a);if(r==-1)o==0?r=l:e.push(l);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=l):n.push(l),s=o;else{let c=oFt(r,l);c>=0?r=c:s==0&&o==0?(e.push(r),r=l):(n.push(l),s=o)}}return r>=0&&e.push(r,...n),e}function kLe(t){return _Le(t).map(jLe)}function cFt(t){return lFt(_Le(t))}const Ebe=45,TLe=".",PLe=65039,ILe=1,CL=t=>Array.from(t);function T_(t,e){return t.P.has(e)||t.Q.has(e)}let uFt=class extends Array{get is_emoji(){return!0}},cne,FLe,yw,une,OLe,F4,PW,GC,qv,_be,dne;function pce(){if(cne)return;let t=yLe(zIt);const e=()=>E_(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));cne=new Map(wLe(t)),FLe=n(),yw=e(),une=new Set(e().map(d=>yw[d])),yw=new Set(yw),OLe=n(),n();let s=vLe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};F4=__(d=>{let f=__(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=LN(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),PW=n(),GC=new Map;let l=e().concat(CL(PW)).sort((d,f)=>d-f);l.forEach((d,f)=>{let x=t(),g=l[f]=x?l[f-x]:{V:[],M:new Map};g.V.push(d),PW.has(d)||GC.set(d,g)});for(let{V:d,M:f}of new Set(GC.values())){let x=[];for(let y of d){let v=F4.filter(N=>T_(N,y)),C=x.find(({G:N})=>v.some(P=>N.has(P)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>CL(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}qv=new Set;let c=new Set;const u=d=>qv.has(d)?c.add(d):qv.add(d);for(let d of F4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of qv)!GC.has(d)&&!c.has(d)&&GC.set(d,ILe);r(qv,kLe(qv)),_be=XIt(t).map(d=>uFt.from(d)).sort(JIt),dne=new Map;for(let d of _be){let f=[dne];for(let x of d){let g=f.map(y=>{let v=y.get(x);return v||(v=new Map,y.set(x,v)),v});x===PLe?f.push(...g):f=g}for(let x of f)x.V=d}}function mce(t){return(MLe(t)?"":`${xce(vU([t]))} `)+SLe(t)}function xce(t){return`"${t}"`}function dFt(t){if(t.length>=4&&t[2]==Ebe&&t[3]==Ebe)throw new Error(`invalid label extension: "${LN(t.slice(0,4))}"`)}function fFt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function hFt(t){let e=t[0],n=Nbe.get(e);if(n)throw I9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=Nbe.get(e);if(o){if(s==a)throw I9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw I9(`trailing ${n}`)}function vU(t,e=1/0,n=SLe){let r=[];pFt(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,a=t.length;for(let o=0;o<a;o++){let l=t[o];MLe(l)&&(r.push(LN(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(LN(t.slice(s,a))),r.join("")}function pFt(t,e){return pce(),yw.has(t)}function MLe(t){return pce(),OLe.has(t)}function mFt(t){return yFt(xFt(t,cFt,CFt))}function xFt(t,e,n){if(!t)return[];pce();let r=0;return t.split(TLe).map(s=>{let a=ZIt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=wFt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(fFt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))dFt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(yw.has(d[0]))throw I9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&yw.has(C[0]))throw I9(`emoji + combining mark: "${LN(l[v-1])} + ${vU([C[0]])}"`)}hFt(d);let g=CL(new Set(x)),[y]=bFt(g);vFt(y,x),gFt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function gFt(t,e){let n,r=[];for(let s of e){let a=GC.get(s);if(a===ILe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):CL(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>T_(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function bFt(t){let e=F4;for(let n of t){let r=e.filter(s=>T_(s,n));if(!r.length)throw F4.some(s=>T_(s,n))?LLe(e[0],n):RLe(n);if(e=r,r.length==1)break}return e}function yFt(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${xce(vU(e,63))}: ${s}`)}return LN(r)}).join(TLe)}function RLe(t){return new Error(`disallowed character: ${mce(t)}`)}function LLe(t,e){let n=mce(e),r=F4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function I9(t){return new Error(`illegal placement: ${t}`)}function vFt(t,e){for(let n of e)if(!T_(t,n))throw LLe(t,n);if(t.M){let n=kLe(e);for(let r=1,s=n.length;r<s;r++)if(une.has(n[r])){let a=r+1;for(let o;a<s&&une.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${mce(o)}`);if(a-r>Abe)throw new Error(`excessive non-spacing marks: ${xce(vU(n.slice(r-1,a)))} (${a-r}/${Abe})`);r=a}}}function wFt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=SFt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(qv.has(o))s.push(o);else{let l=cne.get(o);if(l)s.push(...l);else if(!FLe.has(o))throw RLe(o)}}}return s.length&&r.push(e(s)),r}function CFt(t){return t.filter(e=>e!=PLe)}function SFt(t,e){let n=dne,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:a}=n;a&&(r=a,t.length=s)}return r}const NFt=t=>mFt(t),k0=t=>{let e="";for(let n=0;n<32;n+=1)e+="00";if(t){const r=NFt(t).split(".");for(let s=r.length-1;s>=0;s-=1){const a=ah(r[s]).slice(2);e=ah(`0x${e}${a}`).slice(2)}}return`0x${e}`};var eF=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class AFt{constructor(e,n){this.contract=new C3($It,n??gL.main,e),this.context=e}getOwner(e){return eF(this,void 0,void 0,function*(){try{return this.contract.methods.owner(k0(e)).call()}catch{throw new Error}})}getTTL(e){return eF(this,void 0,void 0,function*(){try{return this.contract.methods.ttl(k0(e)).call()}catch{throw new Error}})}recordExists(e){return eF(this,void 0,void 0,function*(){try{return this.contract.methods.recordExists(k0(e)).call()}catch{throw new Error}})}getResolver(e){return eF(this,void 0,void 0,function*(){try{return this.contract.methods.resolver(k0(e)).call().then(n=>{if(typeof n=="string")return new C3(UIt,n,this.context);throw new Error})}catch{throw new Error}})}get events(){return this.contract.events}}var Zx=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class jFt{constructor(e){this.registry=e}getResolverContractAdapter(e){return Zx(this,void 0,void 0,function*(){return this.registry.getResolver(e)})}checkInterfaceSupport(e,n){var r,s;return Zx(this,void 0,void 0,function*(){if(si(Sbe[n]))throw new w1e((r=e.options.address)!==null&&r!==void 0?r:"",n);if(!(yield e.methods.supportsInterface(Sbe[n]).call()))throw new w1e((s=e.options.address)!==null&&s!==void 0?s:"",n)})}supportsInterface(e,n){var r;return Zx(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);let a=n;if(!ja(a)){if(a=(r=$T(n))!==null&&r!==void 0?r:"",n==="")throw new Error("Invalid interface Id");a=a.slice(0,10)}return s.methods.supportsInterface(a).call()})}getAddress(e,n=60){return Zx(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,fC.addr),r.methods.addr(k0(e),n).call()})}getPubkey(e){return Zx(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,fC.pubkey),n.methods.pubkey(k0(e)).call()})}getContenthash(e){return Zx(this,void 0,void 0,function*(){const n=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(n,fC.contenthash),n.methods.contenthash(k0(e)).call()})}setAddress(e,n,r){return Zx(this,void 0,void 0,function*(){const s=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(s,fC.setAddr),s.methods.setAddr(k0(e),n).send(r)})}getText(e,n){return Zx(this,void 0,void 0,function*(){const r=yield this.getResolverContractAdapter(e);return yield this.checkInterfaceSupport(r,fC.text),r.methods.text(k0(e),n).call()})}getName(e,n=!0){return Zx(this,void 0,void 0,function*(){const r=`${e.toLowerCase().substring(2)}.addr.reverse`,s=yield this.getResolverContractAdapter(r);return n&&(yield this.checkInterfaceSupport(s,fC.name)),s.methods.name(k0(r)).call()})}}var Th=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class DLe extends af{constructor(e,n){super(n??""),this.registryAddress=e??gL.main,this._registry=new AFt(this.getContextObject(),e),this._resolver=new jFt(this._registry)}getResolver(e){return Th(this,void 0,void 0,function*(){return this._registry.getResolver(e)})}recordExists(e){return Th(this,void 0,void 0,function*(){return this._registry.recordExists(e)})}getTTL(e){return Th(this,void 0,void 0,function*(){return this._registry.getTTL(e)})}getOwner(e){return Th(this,void 0,void 0,function*(){return this._registry.getOwner(e)})}getAddress(e,n=60){return Th(this,void 0,void 0,function*(){return this._resolver.getAddress(e,n)})}getText(e,n){return Th(this,void 0,void 0,function*(){return ih(e)?this._resolver.getText(yield this._resolver.getName(e,!1),n):this._resolver.getText(e,n)})}getName(e,n=!0){return Th(this,void 0,void 0,function*(){return this._resolver.getName(e,n)})}getPubkey(e){return Th(this,void 0,void 0,function*(){return this._resolver.getPubkey(e)})}getContenthash(e){return Th(this,void 0,void 0,function*(){return this._resolver.getContenthash(e)})}checkNetwork(){return Th(this,void 0,void 0,function*(){const e=Date.now()/1e3;if(!this._lastSyncCheck||e-this._lastSyncCheck>3600){const s=yield QPt(this);if(!(typeof s=="boolean"&&!s))throw new l8t;this._lastSyncCheck=e}if(this._detectedAddress)return this._detectedAddress;const n=yield tce(this,Object.assign(Object.assign({},this.defaultReturnFormat),{number:ap.HEX})),r=gL[BIt[n]];if(typeof r>"u")throw new o8t(n);return this._detectedAddress=r,this._detectedAddress})}supportsInterface(e,n){return Th(this,void 0,void 0,function*(){return this._resolver.supportsInterface(e,n)})}get events(){return this._registry.events}setAddress(e,n,r){return Th(this,void 0,void 0,function*(){return this._resolver.setAddress(e,n,r)})}}var $1=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const EFt=t=>$1(void 0,void 0,void 0,function*(){return(yield PTt(t)).map(wx)}),_Ft=(t,e)=>$1(void 0,void 0,void 0,function*(){Ks.validate(["string"],[e]);const n=yield ITt(t,e);return wx(n)}),kFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){return Ks.validate(["address","string","uint"],[e,n,r]),FTt(t,e,n,r)}),TFt=(t,e)=>$1(void 0,void 0,void 0,function*(){return Ks.validate(["address"],[e]),OTt(t,e)}),PFt=(t,e,n)=>$1(void 0,void 0,void 0,function*(){return Ks.validate(["string","string"],[e,n]),MTt(t,e,n)}),IFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){const s=gf(e,xi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return RTt(t,s,n)}),FFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){const s=gf(e,xi,{transactionSchema:r==null?void 0:r.customTransactionSchema});return LTt(t,s,n)}),OFt=(t,e,n,r)=>$1(void 0,void 0,void 0,function*(){Ks.validate(["string","address","string"],[e,n,r]);const s=ja(e)?e:km(e);return DTt(t,s,n,r)}),MFt=(t,e,n)=>$1(void 0,void 0,void 0,function*(){Ks.validate(["string","string"],[e,n]);const r=ja(e)?e:km(e);return BTt(t,r,n)});var Jx=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class BLe extends af{getAccounts(){return Jx(this,void 0,void 0,function*(){return EFt(this.requestManager)})}newAccount(e){return Jx(this,void 0,void 0,function*(){return _Ft(this.requestManager,e)})}unlockAccount(e,n,r){return Jx(this,void 0,void 0,function*(){return kFt(this.requestManager,e,n,r)})}lockAccount(e){return Jx(this,void 0,void 0,function*(){return TFt(this.requestManager,e)})}importRawKey(e,n){return Jx(this,void 0,void 0,function*(){return PFt(this.requestManager,e,n)})}sendTransaction(e,n){return Jx(this,void 0,void 0,function*(){return IFt(this.requestManager,e,n,this.config)})}signTransaction(e,n){return Jx(this,void 0,void 0,function*(){return FFt(this.requestManager,e,n,this.config)})}sign(e,n,r){return Jx(this,void 0,void 0,function*(){return OFt(this.requestManager,e,n,r)})}ecRecover(e,n){return Jx(this,void 0,void 0,function*(){return MFt(this.requestManager,e,n)})}}var O0;(function(t){t.HTTPS="https",t.WebSocket="wss"})(O0||(O0={}));var ws;(function(t){t.ETH_MAINNET="eth_mainnet",t.ETH_SEPOLIA="eth_sepolia",t.ETH_HOLESKY="eth_holesky",t.POLYGON_MAINNET="polygon_mainnet",t.POLYGON_AMOY="polygon_amoy",t.AVALANCHE_C_MAINNET="avalanche_c_mainnet",t.AVALANCHE_P_MAINNET="avalanche_p_mainnet",t.AVALANCHE_X_MAINNET="avalanche_x_mainnet",t.ARBITRUM_MAINNET="arbitrum_mainnet",t.ARBITRUM_SEPOLIA="arbitrum_sepolia",t.BASE_MAINNET="base_mainnet",t.BASE_SEPOLIA="base_sepolia",t.OPTIMISM_MAINNET="optimism_mainnet",t.OPTIMISM_SEPOLIA="optimism_sepolia",t.FANTOM_MAINNET="fantom_mainnet",t.FANTOM_TESTNET="fantom_testnet",t.DYMENSION_MAINNET="dymension_mainnet",t.DYMENSION_TESTNET="dymension_testnet",t.BNB_MAINNET="bnb_mainnet",t.BNB_TESTNET="bnb_testnet",t.BSC_MAINNET="bsc_mainnet",t.BSC_TESTNET="bsc_testnet",t.ARBITRUM_ONE="arbitrum_one",t.ARBITRUM_NOVA="arbitrum_nova",t.AVALANCHE_FUJI_C="avalanche_fuji_c",t.AVALANCHE_FUJI_P="avalanche_fuji_p",t.AVALANCHE_FUJI_X="avalanche_fuji_x",t.BLAST_MAINNET="blast_mainnet",t.OPBNB_MAINNET="opbnb_mainnet",t.OPBNB_TESTNET="opbnb_testnet",t.GNOSIS_MAINNET="gnosis_mainnet",t.GNOSIS_CHIADO="gnosis_chiado",t.PULSECHAIN_MAINNET="pulsechain_mainnet",t.PULSECHAIN_TESTNET="pulsechain_testnet",t.KAVA_MAINNET="kava_mainnet",t.CRONOS_MAINNET="cronos_mainnet",t.MANTLE_MAINNET="mantle_mainnet",t.CHILIZ_MAINNET="chiliz_mainnet",t.CHILIZ_SPICY="chiliz_spicy",t.MOONBEAM_MAINNET="moonbeam_mainnet",t.TAIKO_MAINNET="taiko_mainnet",t.TAIKO_HEKLA="taiko_hekla",t.LINEA_MAINNET="linea_mainnet",t.LINEA_SEPOLIA="linea_sepolia",t.BAHAMUT_MAINNET="bahamut_mainnet",t.SCROLL_MAINNET="scroll_mainnet",t.SCROLL_SEPOLIA="scroll_sepolia",t.TRON_MAINNET="tron_mainnet",t.SYSCOIN_MAINNET="syscoin_mainnet",t.SYSCOIN_TANENBAUM="syscoin_tanenbaum",t.MOONRIVER_MAINNET="moonriver_mainnet",t.HAQQ_MAINNET="haqq_mainnet",t.EVMOS_MAINNET="evmos_mainnet",t.EVMOS_TESTNET="evmos_testnet",t.BERACHAIN_TESTNET="berachain_testnet"})(ws||(ws={}));const RFt=1300;class LFt extends hi{constructor(e){super("You've reach the rate limit of free RPC calls from our Partner Quick Nodes. There are two options you can either create a paid Quick Nodes account and get 20% off for 2 months using WEB3JS referral code, or use Free public RPC endpoint.",e),this.code=RFt}}const DFt=1301;class kbe extends hi{constructor(e){super(`Invalid provider config options given for ${e}`),this.code=DFt}}var BFt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};class $Le extends Ble{constructor(e,n,r,s,a){if(super(),a!==void 0&&n===O0.HTTPS&&!("providerOptions"in a))throw new kbe("HTTP Provider");if(a!==void 0&&n===O0.WebSocket&&!("socketOptions"in a||"reconnectOptions"in a))throw new kbe("Websocket Provider");this.transport=n,n===O0.HTTPS?this.provider=new cU(this.getRPCURL(e,n,r,s),a):n===O0.WebSocket&&(this.provider=new ZMe(this.getRPCURL(e,n,r,s),a==null?void 0:a.socketOptions,a==null?void 0:a.reconnectOptions))}request(e,n){return BFt(this,void 0,void 0,function*(){return this.transport===O0.HTTPS?yield this.provider.request(e,n):this.provider.request(e)})}getStatus(){return this.provider.getStatus()}supportsSubscriptions(){return this.provider.supportsSubscriptions()}once(e,n){var r;!((r=this.provider)===null||r===void 0)&&r.once&&this.provider.once(e,n)}removeAllListeners(e){var n;!((n=this.provider)===null||n===void 0)&&n.removeAllListeners&&this.provider.removeAllListeners(e)}connect(){var e;!((e=this.provider)===null||e===void 0)&&e.connect&&this.provider.connect()}disconnect(e,n){var r;!((r=this.provider)===null||r===void 0)&&r.disconnect&&this.provider.disconnect(e,n)}reset(){var e;!((e=this.provider)===null||e===void 0)&&e.reset&&this.provider.reset()}on(e,n){this.provider&&this.provider.on(e,n)}removeListener(e,n){this.provider&&this.provider.removeListener(e,n)}}var $Ft=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const Nc=t=>t!==void 0&&t.trim().length>0;class UFt extends $Le{constructor(e=ws.ETH_MAINNET,n=O0.HTTPS,r="",s="",a){super(e,n,r,s,a)}request(e,n){const r=Object.create(null,{request:{get:()=>super.request}});return $Ft(this,void 0,void 0,function*(){try{return yield r.request.call(this,e,n)}catch(s){throw s instanceof I0&&s.statusCode===429?new LFt(s):s}})}getRPCURL(e,n,r,s){let a="",o="";switch(e){case ws.ETH_MAINNET:a=Nc(s)?s:"powerful-holy-bush.quiknode.pro",o=Nc(r)?r:"3240624a343867035925ff7561eb60dfdba2a668";break;case ws.ETH_SEPOLIA:a=Nc(s)?s:"dimensional-fabled-glitter.ethereum-sepolia.quiknode.pro",o=Nc(r)?r:"382a3b5a4b938f2d6e8686c19af4b22921fde2cd";break;case ws.ETH_HOLESKY:a=Nc(s)?s:"yolo-morning-card.ethereum-holesky.quiknode.pro",o=Nc(r)?r:"481ebe70638c4dcf176af617a16d02ab866b9af9";break;case ws.ARBITRUM_MAINNET:a=Nc(s)?s:"autumn-divine-dinghy.arbitrum-mainnet.quiknode.pro",o=Nc(r)?r:"a5d7bfbf60b5ae9ce3628e53d69ef50d529e9a8c";break;case ws.ARBITRUM_SEPOLIA:a=Nc(s)?s:"few-patient-pond.arbitrum-sepolia.quiknode.pro",o=Nc(r)?r:"3be985450970628c860b959c65cd2642dcafe53c";break;case ws.BNB_MAINNET:a=Nc(s)?s:"purple-empty-reel.bsc.quiknode.pro",o=Nc(r)?r:"ebf6c532961e21f092ff2facce1ec4c89c540158";break;case ws.BNB_TESTNET:a=Nc(s)?s:"floral-rough-scion.bsc-testnet.quiknode.pro",o=Nc(r)?r:"5b297e5acff5f81f4c37ebf6f235f7299b6f9d28";break;case ws.POLYGON_MAINNET:a=Nc(s)?s:"small-chaotic-moon.matic.quiknode.pro",o=Nc(r)?r:"847569f8a017e84d985e10d0f44365d965a951f1";break;case ws.POLYGON_AMOY:a=Nc(s)?s:"prettiest-side-shape.matic-amoy.quiknode.pro",o=Nc(r)?r:"79a9476eea661d4f82de614db1d8a895b14b881c";break;default:throw new Error("Network info not avalible.")}return`${n}://${a}/${o}`}}const zFt=t=>t!==void 0&&t.trim().length>0,HFt=[ws.DYMENSION_MAINNET,ws.DYMENSION_TESTNET,ws.KAVA_MAINNET,ws.CRONOS_MAINNET,ws.POLYGON_MAINNET];class SL extends $Le{constructor(e=ws.ETH_MAINNET,n=O0.HTTPS,r="",s){super(e,n,"",r,s)}getRPCURL(e,n,r,s){if(!SL.networkHostMap[e])throw new Error("Network info not avalible.");const a=`${SL.networkHostMap[e]}.publicnode.com`,o=zFt(s)?s:a;return HFt.includes(e)&&n===O0.WebSocket?`${n}://${o}/websocket`:`${n}://${o}`}}SL.networkHostMap={[ws.POLYGON_AMOY]:"polygon-amoy-bor-rpc",[ws.DYMENSION_MAINNET]:"dymension-evm-rpc",[ws.DYMENSION_TESTNET]:"dymension-testnet-evm-rpc",[ws.BLAST_MAINNET]:"blast-rpc",[ws.GNOSIS_MAINNET]:"gnosis-rpc",[ws.PULSECHAIN_MAINNET]:"pulsechain-rpc",[ws.PULSECHAIN_TESTNET]:"pulsechain-testnet-rpc",[ws.KAVA_MAINNET]:"kava-evm-rpc",[ws.CRONOS_MAINNET]:"cronos-evm-rpc",[ws.MANTLE_MAINNET]:"mantle-rpc",[ws.TAIKO_MAINNET]:"taiko-rpc",[ws.TAIKO_HEKLA]:"taiko-hekla-rpc",[ws.LINEA_MAINNET]:"linea-rpc",[ws.LINEA_SEPOLIA]:"linea-sepolia-rpc",[ws.SCROLL_MAINNET]:"scroll-rpc",[ws.SCROLL_SEPOLIA]:"scroll-sepolia-rpc",[ws.SYSCOIN_MAINNET]:"syscoin-evm-rpc",[ws.SYSCOIN_TANENBAUM]:"syscoin-tanenbaum-evm-rpc",[ws.HAQQ_MAINNET]:"haqq-evm-rpc",[ws.EVMOS_MAINNET]:"evmos-evm-rpc",[ws.EVMOS_TESTNET]:"evmos-testnet-evm-rpc",[ws.BERACHAIN_TESTNET]:"berachain-testnet-evm-rpc",[ws.ETH_MAINNET]:"ethereum-rpc",[ws.ETH_SEPOLIA]:"ethereum-sepolia-rpc",[ws.ETH_HOLESKY]:"ethereum-holesky-rpc",[ws.BSC_MAINNET]:"bsc-rpc",[ws.BSC_TESTNET]:"bsc-testnet-rpc",[ws.POLYGON_MAINNET]:"polygon-bor-rpc",[ws.BASE_MAINNET]:"base-rpc",[ws.BASE_SEPOLIA]:"base-sepolia-rpc",[ws.ARBITRUM_ONE]:"arbitrum-one-rpc",[ws.ARBITRUM_NOVA]:"arbitrum-nova-rpc",[ws.ARBITRUM_SEPOLIA]:"arbitrum-sepolia-rpc",[ws.AVALANCHE_C_MAINNET]:"avalanche-c-chain-rpc",[ws.AVALANCHE_P_MAINNET]:"avalanche-p-chain-rpc",[ws.AVALANCHE_X_MAINNET]:"avalanche-x-chain-rpc",[ws.AVALANCHE_FUJI_C]:"avalanche-fuji-c-chain-rpc",[ws.AVALANCHE_FUJI_P]:"avalanche-fuji-p-chain-rpc",[ws.AVALANCHE_FUJI_X]:"avalanche-fuji-x-chain-rpc",[ws.OPTIMISM_MAINNET]:"optimism-rpc",[ws.OPTIMISM_SEPOLIA]:"optimism-sepolia-rpc",[ws.FANTOM_MAINNET]:"fantom-rpc",[ws.FANTOM_TESTNET]:"fantom-testnet-rpc",[ws.OPBNB_MAINNET]:"opbnb-rpc",[ws.OPBNB_TESTNET]:"opbnb-testnet-rpc",[ws.GNOSIS_CHIADO]:"gnosis-chiado-rpc",[ws.CHILIZ_MAINNET]:"chiliz-rpc",[ws.CHILIZ_SPICY]:"chiliz-spicy-rpc",[ws.MOONBEAM_MAINNET]:"moonbeam-rpc",[ws.BAHAMUT_MAINNET]:"bahamut-rpc",[ws.TRON_MAINNET]:"tron-evm-rpc",[ws.MOONRIVER_MAINNET]:"moonriver-rpc"};const VFt=new UFt,WFt={encodeEventSignature:ice,encodeFunctionCall:HPt,encodeFunctionSignature:A_,encodeParameter:rne,encodeParameters:gU,decodeParameter:aLe,decodeParameters:w3,decodeLog:oLe};var i7=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})};const qFt=t=>{const e=(o,l)=>i7(void 0,void 0,void 0,function*(){const c=yield TIt(o,t),u=qr({format:"bytes"},l,xi);return _kt(c,u)}),n=o=>{const l=Qle(o);return Object.assign(Object.assign({},l),{signTransaction:c=>i7(void 0,void 0,void 0,function*(){return e(c,l.privateKey)})})},r=(o,l,c)=>i7(void 0,void 0,void 0,function*(){var u;const d=yield Ikt(o,l,(u=c==null?void 0:c.nonStrict)!==null&&u!==void 0?u:!0);return Object.assign(Object.assign({},d),{signTransaction:f=>i7(void 0,void 0,void 0,function*(){return e(f,d.privateKey)})})}),s=()=>{const o=Pkt();return Object.assign(Object.assign({},o),{signTransaction:l=>i7(void 0,void 0,void 0,function*(){return e(l,o.privateKey)})})},a=new cL({create:s,privateKeyToAccount:n,decrypt:r});return{signTransaction:e,create:s,privateKeyToAccount:n,decrypt:r,recoverTransaction:kkt,hashMessage:Xle,sign:ARe,recover:Kte,encrypt:jRe,wallet:a,privateKeyToAddress:hU,parseAndValidatePrivateKey:fj,privateKeyToPublicKey:Tkt}},GFt={version:"4.16.0"};var KFt=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},NL;(function(t){t.eip6963announceProvider="eip6963:announceProvider",t.eip6963requestProvider="eip6963:requestProvider"})(NL||(NL={}));const IW=new Map,ULe="web3:providersMapUpdated",YFt=()=>KFt(void 0,void 0,void 0,function*(){return new Promise((t,e)=>{typeof window>"u"&&e(new Error("window object not available, EIP-6963 is intended to be used within a browser")),window.addEventListener(NL.eip6963announceProvider,n=>{IW.set(n.detail.info.uuid,n.detail);const r=new CustomEvent(ULe,{detail:IW});window.dispatchEvent(r),t(IW)}),window.dispatchEvent(new Event(NL.eip6963requestProvider))})}),XFt=t=>{if(typeof window>"u")throw new Error("window object not available, EIP-6963 is intended to be used within a browser");window.addEventListener(ULe,t)};class _l extends af{constructor(e=VFt){var n;(si(e)||typeof e=="string"&&e.trim()===""||typeof e!="string"&&!oL(e)&&!e.provider)&&console.warn("NOTE: web3.js is running without provider. You need to pass a provider in order to interact with the network!");let r={};typeof e=="string"||oL(e)?r.provider=e:e?r=e:r={},r.registeredSubscriptions=Object.assign(Object.assign({},ine),(n=r.registeredSubscriptions)!==null&&n!==void 0?n:{}),super(r);const s=qFt(this);this._wallet=s.wallet,this._accountProvider=s,this.utils=QMe;const a=this;class o extends C3{constructor(u,d,f,x,g){if(Ey(d)&&Ey(f))throw new C1e("Should not provide options at both 2nd and 3rd parameters");let y,v={},C,N;if(!si(d)&&typeof d!="object"&&typeof d!="string")throw new C1e;if(typeof d=="string"&&(y=d),Ey(d)?v=d:Ey(f)?v=f:v={},d instanceof af?C=d:f instanceof af?C=f:x instanceof af?C=x:C=a.getContextObject(),g?N=g:Cg(f)?N=f:Cg(x)&&(N=x),super(u,y,v,C,N),super.subscribeToContextEvents(a),!si(l)){const P=l.getTransactionMiddleware();si(P)||super.setTransactionMiddleware(P)}}}const l=a.use(bU);this.eth=Object.assign(l,{ens:a.use(DLe,gL.main),Iban:Dl,net:a.use(ORe),personal:a.use(BLe),Contract:o,abi:WFt,accounts:s})}}_l.version=GFt.version;_l.utils=QMe;_l.requestEIP6963Providers=YFt;_l.onNewProviderDiscovered=XFt;_l.modules={Web3Eth:bU,Iban:Dl,Net:ORe,ENS:DLe,Personal:BLe};const jd=({open:t,setOpen:e,transactionHash:n,transactionLoading:r,paymentPresaleRole:s,errorFunds:a,activeMethod:o})=>{const[l,c]=m.useState(!1);m.useEffect(()=>{const d=f=>{r&&t&&(f.preventDefault(),f.returnValue="Please do not leave, your purchase is in progress.")};return window.addEventListener("beforeunload",d),()=>window.removeEventListener("beforeunload",d)},[r,t]);const u=async d=>{try{await navigator.clipboard.writeText(d),tn.success("TX Hash copied to clipboard!")}catch(f){console.error("Failed to copy: ",f),tn.error("Failed to copy TX Hash")}};return m.useEffect(()=>{let d;return t&&r?d=setTimeout(()=>c(!0),24e4):(c(!1),d&&clearTimeout(d)),()=>d&&clearTimeout(d)},[t,r]),i.jsxs(_a,{open:t,onClose:()=>{r||e(!1)},className:"relative z-[9001] font-inter",children:[i.jsx(Ea,{style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,style:{maxWidth:"448px"},className:`relative transform overflow-hidden rounded-lg bg-[#161616] border border-[#404040] pt-5 pb-4 text-left shadow-xl transition-all
data-[closed]:translate-y-4 data-[closed]:opacity-0
data-[enter]:duration-300 data-[leave]:duration-200
data-[enter]:ease-out data-[leave]:ease-in
sm:my-8 sm:align-middle sm:w-full sm:max-w-lg`,children:i.jsxs("div",{className:"mt-3 text-center sm:mt-5 text-white",children:[(!r&&s||l)&&i.jsx("svg",{onClick:()=>e(!1),xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 fixed right-0 mr-4 top-4 cursor-pointer text-gray-400 hover:text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),r?i.jsxs("div",{className:"mt-2",children:[!a&&i.jsx("div",{className:"flex justify-center items-center",children:i.jsx($a,{})}),i.jsxs("p",{className:"mt-4 text-center flex flex-col items-center text-sm font-medium text-gray-200",children:[i.jsx("span",{children:"Your subscription order is created, please confirm"}),i.jsx("span",{children:"transaction on your wallet to complete purchase."})]}),l?i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-red-400 mt-4 flex justify-start items-center min-h-20 sm:h-20 bg-[#2a1a1a] w-full border-l-2 border-red-600 gap-4 pl-2.5 rounded",children:[i.jsx("img",{src:rc,alt:"",className:"w-8 h-8"}),i.jsx("span",{className:"text-sm font-medium text-red-400 max-w-[354px] text-left",children:"There was an error, you can contact us via discord."})]}),i.jsx("div",{className:"w-full flex justify-center items-center mt-6",children:i.jsxs("a",{href:"https://discord.gg/dextrabot",target:"_blank",className:"inline-flex relative items-center px-2.5 py-1.5 text-sm font-bold text-white hover:text-white bg-[#5865F2] hover:bg-[#626ef1] rounded-md h-9 min-w-max gap-2",children:[i.jsx("img",{src:CEe,className:"w-6 h-6"}),"Join Discord"]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:`${a?"text-red-400 bg-[#2a1a1a] border-red-600":"text-yellow-400 bg-[#2a2418] border-yellow-600"} mt-4 flex justify-start items-center min-h-20 sm:h-20 w-full border-l-2 gap-4 pl-2.5 rounded`,children:a?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:rc,alt:"",className:"w-8 h-8"}),i.jsx("span",{className:"text-sm font-medium text-red-400 max-w-[354px] text-left",children:"Insufficient funds.Please add funds to your wallet on Ethereum Mainnet."})]}):i.jsxs(i.Fragment,{children:[i.jsx(ER,{className:"w-8 h-8 text-yellow-400"}),i.jsx("span",{className:"text-sm font-medium text-yellow-400 max-w-[354px] text-left",children:"If you have confirmed the transaction from wallet extension, do not exit back and wait, otherwise your transaction may be incorrect."})]})}),i.jsx("div",{className:"w-full flex justify-center items-center mt-6",children:i.jsx("div",{onClick:()=>e(!1),className:"w-26 h-8 px-4 py-1 bg-[#2a2a2a] rounded-full flex justify-center items-center cursor-pointer hover:bg-[#3a3a3a]",children:i.jsx("div",{className:"text-sm font-medium text-gray-300",children:"Cancel"})})})]})]}):o===2&&s?i.jsxs("div",{className:"mt-2",children:[i.jsx("div",{className:"flex justify-center items-center",children:i.jsx("div",{className:"mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100",children:i.jsx(Crt,{className:"h-6 w-6 text-green-600","aria-hidden":"true"})})}),i.jsx("p",{className:"text-gray-100 text-lg mt-4 font-medium",children:"Payment Successful"}),i.jsxs("p",{className:"text-sm text-left text-gray-300 mt-4 px-2",children:["Transaction Hash"," ",i.jsxs("span",{className:"flex items-center justify-center text-xs break-all",children:[n,i.jsx("span",{onClick:()=>u(n),className:"inline-block mx-1 w-4 cursor-pointer",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-300 hover:text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})})]})]})]}):i.jsxs("div",{className:"my-2",children:[i.jsx("div",{className:"flex justify-center items-center",children:i.jsx($a,{})}),i.jsx("p",{className:"mt-4 text-center flex flex-col items-center text-sm font-medium text-gray-200 font-manrope",children:i.jsx("span",{children:"If your role has not been assigned yet, please refresh the page."})})]})]})})})})]})},zLe=[{id:"extended",label:"Extended",hash:"#extended-farming"},{id:"variational",label:"Variational",hash:"#variational-farming"},{id:"paradex",label:"Paradex",hash:"#paradex-farming"},{id:"lighter",label:"Lighter",hash:"#lighter-farming"},{id:"pacifica",label:"Pacifica",hash:"#pacifica-farming"},{id:"apex",label:"Apex",hash:"#apex-farming"},{id:"aster",label:"Aster",hash:"#aster-farming"}],QFt=zLe.reduce((t,e)=>(t[e.hash]=e.id,t),{}),T2=({current:t="",onCloseCurrent:e})=>{const n=Kl(),r=jo(),s=t||QFt[n.hash]||"",a=o=>{!o||o.id===s||(e&&e(),r(`${n.pathname}${n.search}${o.hash}`,{replace:!0}))};return i.jsxs("div",{className:"hidden lg:flex flex-col gap-4 w-[220px] p-4 rounded-2xl border border-[#242424] bg-[rgba(16,16,16,0.9)] shadow-lg shadow-black/30",children:[i.jsxs("div",{className:"flex items-center gap-2 px-2",children:[i.jsx("div",{className:"h-1 w-6 bg-gradient-to-r from-[#5ce0a5] to-[#4aba85] rounded-full"}),i.jsx("h3",{className:"text-[11px] text-[#b0b0b0] font-bold uppercase tracking-[0.15em]",children:"Farming Modules"})]}),i.jsx("div",{className:"flex flex-col gap-1.5",children:zLe.map(o=>{const l=o.id===s;return i.jsxs("button",{onClick:()=>a(o),className:`group relative h-12 w-full rounded-lg text-left px-3 text-[13px] font-medium transition-all duration-200 overflow-hidden ${l?"bg-[#293e33] text-white":"bg-transparent text-[#a8a8a8] hover:bg-[#1a1a1a] hover:text-white"}`,disabled:l,children:[i.jsx("div",{className:`absolute left-0 top-1/2 -translate-y-1/2 h-6 w-[3px] rounded-r-full transition-all duration-200 ${l?"bg-gradient-to-b from-[#5ce0a5] to-[#4aba85] opacity-100":"bg-[#3a3a3a] opacity-0 group-hover:opacity-100"}`}),i.jsxs("div",{className:"flex items-center gap-3 pl-2",children:[i.jsx("div",{className:`flex-shrink-0 w-5 h-5 rounded-md flex items-center justify-center transition-all duration-200 ${l?"bg-[#5ce0a5]/10 ring-1 ring-[#5ce0a5]/30":"bg-[#1f1f1f] group-hover:bg-[#252525]"}`,children:o.id==="aster"?i.jsx($A,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":""}`}):o.id==="basedapp"?i.jsx("img",{src:oct,alt:"BasedApp",className:"w-3.5 h-3.5"}):o.id==="lighter"?i.jsx(M0,{className:`w-3.5 h-3.5 ${l?"text-[#5ce0a5]":"text-white"}`}):o.id==="apex"?i.jsx("img",{src:xae,alt:"Apex",className:"w-3.5 h-3.5"}):o.id==="extended"?i.jsx("img",{src:"https://app.extended.exchange/assets/logo/extended.svg",alt:"Extended",className:"w-3.5 h-3.5"}):o.id==="variational"?i.jsx("img",{src:lT,alt:"Variational",className:"w-3.5 h-3.5"}):o.id==="paradex"?i.jsx("img",{src:cT,alt:"Paradex",className:"w-3.5 h-3.5"}):o.id==="pacifica"?i.jsx("img",{src:"https://app.pacifica.fi/imgs/icon.svg",alt:"Pacifica",className:"w-3.5 h-3.5"}):null}),i.jsxs("span",{className:`transition-colors duration-200 ${l?"text-[#e8e8e8]":""}`,children:[o.label," Farming"]})]}),l&&i.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[1px] bg-gradient-to-r from-transparent via-[#5ce0a5]/50 to-transparent"})]},o.id)})})]})};function gce({open:t=!1,setOpen:e=()=>{}}){const[n,r]=m.useState([]),[s,a]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState("11"),[d,f]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(""),[C,N]=m.useState(""),[P,T]=m.useState(2),[M,F]=m.useState(!1),[$,L]=m.useState(!1),[z,X]=m.useState(!1),[ne,J]=m.useState(!1),[K,te]=m.useState(!1),[fe,q]=m.useState(""),[se,ae]=m.useState(""),[W,V]=m.useState(!1),[ee,oe]=m.useState(!1),[de,Ce]=m.useState(null),[me,we]=m.useState(""),[xe,be]=m.useState(!1),[je,Ie]=m.useState(!1),[Re,Qe]=m.useState(null),[Ke,dt]=m.useState(!1),[tt,nt]=m.useState([]),[Le,Be]=m.useState(!1),[ht,pt]=m.useState(!1),[Gt,wt]=m.useState(""),[nn,cn]=m.useState(!0),{setSignModalOpen:Un,setTelegramChatId:Xt,setSubscriberRole:an,setSubsExpireDay:Jt,setMushboomerETH:Ye,setMushboomerSOL:Je,setIsReferralCode:It,setIsReferralCodeName:hn,setIsWhitelist:Yt,setHyperToken:Rt,setHyperAddress:ot}=m.useContext(Qr),De="https://dextrabothypev2.nftinit.io",At="https://api.hyperliquid.xyz/info",ze="0x1924b8561eef20e70ede628a296175d358be80e5",rt=["HYPE","ETH","BTC","SOL","USDT0","PUP"],mt="0.01",Lt=Ee=>{switch(Ee){case"BTC":return"UBTC";case"ETH":return"UETH";case"SOL":return"USOL";case"USDT0":return"USDT0";case"HYPE":default:return Ee}},kt=Ee=>{if(Ee==null||Ee==="")return"0.00";const h=Number(Ee);return Number.isNaN(h)?"0.00":h.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},dn=Ee=>/^\d*\.?\d{0,6}$/.test(Ee),rn=Ee=>/^\d*$/.test(Ee),gn=Ee=>{["e","E","+","-"].includes(Ee.key)&&Ee.preventDefault()},An=m.useMemo(()=>{if(c==="")return!1;const Ee=Number(c);return!Number.isNaN(Ee)&&Ee>=11},[c]);m.useMemo(()=>{if(d==="")return!1;const Ee=Number(d);return!Number.isNaN(Ee)&&Ee>0},[d]);const kn=m.useMemo(()=>{if(x==="")return!1;const Ee=Number(x);return!Number.isNaN(Ee)&&Ee>=0&&Ee<=100},[x]),yn=m.useMemo(()=>{if(y==="")return!1;const Ee=Number(y);return!Number.isNaN(Ee)&&Ee>=0&&Ee<=100},[y]),Vn=m.useMemo(()=>{if(C==="")return!1;const Ee=Number(C);return Number.isInteger(Ee)&&Ee>0&&Ee<=180},[C]),Kn=m.useMemo(()=>n.map(Ee=>{const h=(Ee==null?void 0:Ee.wallet_name)??(Ee==null?void 0:Ee.name)??(Ee==null?void 0:Ee.label)??String(Ee==null?void 0:Ee.wallet_id),p=(Ee==null?void 0:Ee.version)===3?`${h} - (API-AGENT) Wallet`:h;return{value:(Ee==null?void 0:Ee.wallet_id)??(Ee==null?void 0:Ee.id)??(Ee==null?void 0:Ee.value)??"",label:p,raw:Ee}}),[n]),Dn=m.useMemo(()=>{var Ee;return(Ee=Kn.find(h=>String(h.value)===String(s)))==null?void 0:Ee.raw},[Kn,s]),Xn=m.useMemo(()=>{const Ee=Dn||{};return Ee.address||Ee.evm_address||Ee.wallet_address||Ee.public_address||Ee.eth_address||Ee.addr||null},[Dn]),Nn=(Dn==null?void 0:Dn.version)===3,on=!Nn||Re>0,Oe=m.useMemo(()=>{if(!o)return{coin:Lt(o),total:"0",entryNtl:"0"};const Ee=Lt(o);return(tt||[]).find(p=>(p==null?void 0:p.coin)===Ee)??{coin:Ee,total:"0",entryNtl:"0"}},[o,tt]),Zt=s!==""&&o!==""&&(P===1?Vn&&yn:An&&kn)&&xe&&on&&nn;m.useEffect(()=>{if(!t)return;const Ee=localStorage.getItem("hyperToken"),h=localStorage.getItem("hyperAddress");be(!!(Ee&&h));const p=setInterval(()=>{const S=localStorage.getItem("hyperToken"),_=localStorage.getItem("hyperAddress");be(!!(S&&_))},800);return()=>clearInterval(p)},[t]),m.useEffect(()=>{t&&(q(""),xe&&Dt())},[t,xe]),m.useEffect(()=>{t&&(Xn?Qn(Xn):(Ce(null),we(""),nt([])))},[t,Xn]),m.useEffect(()=>{!t||!xe||(jt(),Zn())},[t,xe]),m.useEffect(()=>{t&&P===1&&!y&&v(mt)},[t,P]),m.useEffect(()=>{if(!t||!xe)return;const Ee=Dn||{},h=Ee.address||Ee.evm_address||Ee.wallet_address||Ee.public_address||Ee.eth_address||Ee.addr||null;(Ee==null?void 0:Ee.version)===3&&h&&sn(h)},[t,xe,s,Dn]);async function sn(Ee){try{Ie(!0),Qe(null);const p=await(await fetch(At,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"maxBuilderFee",user:Ee,builder:ze})})).json();Qe(Number(p))}catch{Qe(null)}finally{Ie(!1)}}async function jt(){var Ee,h,p;try{L(!0);const S=window.localStorage.getItem("hyperToken"),_=window.localStorage.getItem("hyperAddress");if(!S||!_){V(!1);return}const I=await(await fetch(`${De}/api/hyper/farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:_.toLowerCase(),token:S})})).json();if(I!=null&&I.success&&((Ee=I==null?void 0:I.data)!=null&&Ee.farming_params)){V(!0),((h=I==null?void 0:I.data)==null?void 0:h.wallet_id)!==void 0&&((p=I==null?void 0:I.data)==null?void 0:p.wallet_id)!==null&&a(String(I.data.wallet_id));const B=I.data.farming_params||{};B.coin&&l(B.coin),B.margin!==void 0&&B.margin!==null&&u(String(B.margin)),B.budget!==void 0&&B.budget!==null&&f(String(B.budget));const G=Number(B.methodType);G===1?(T(2),B.spread!==void 0&&B.spread!==null&&g(String(B.spread))):G===2?(T(1),B.spread!==void 0&&B.spread!==null?v(String(B.spread)):v(mt),B.orderPerHour!==void 0&&B.orderPerHour!==null&&N(String(B.orderPerHour))):T(2)}else V(!1)}catch{V(!1)}finally{L(!1)}}async function Qn(Ee){try{we(""),oe(!0),Ce(null);const p=await(await fetch(At,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:Ee})})).json(),S=Array.isArray(p==null?void 0:p.balances)?p.balances:[];nt(S);const _=S.find(k=>(k==null?void 0:k.coin)==="USDC");Ce(_?_.total:"0")}catch(h){we(h.message||"Failed to load USDC balance.")}finally{oe(!1)}}function bn(){const Ee=Xn||window.localStorage.getItem("hyperAddress");Ee&&Qn(Ee)}async function Dt(){try{F(!0);const Ee=window.localStorage.getItem("hyperToken"),h=window.localStorage.getItem("hyperAddress");if(!Ee||!h){be(!1),Un(!0);return}const S=await(await fetch(`${De}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:h.toLowerCase(),token:Ee})})).json();S!=null&&S.success?r((S==null?void 0:S.data)||[]):q((S==null?void 0:S.error_message)||"Failed to load wallets.")}catch(Ee){q(Ee.message||"Wallet list error.")}finally{F(!1)}}async function en(){if(!xe){Un(!0);return}if(Zt)try{J(!0),q("");const Ee=window.localStorage.getItem("hyperToken"),h=window.localStorage.getItem("hyperAddress");if(!Ee||!h){be(!1),Un(!0);return}const S=P===1?{margin:100,budget:1,coin:o,orderPerHour:Number(C),spread:Number(y),methodType:2}:{margin:Number(c),coin:o,spread:Number(x),methodType:1,budget:1},_={address:h.toLowerCase(),token:Ee,wallet_id:Number(s),farming_params:S},I=await(await fetch(`${De}/api/hyper/farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)})).json();I!=null&&I.success?V(!0):q((I==null?void 0:I.message)||"Start failed.")}catch(Ee){q(Ee.message||"An error occurred while saving.")}finally{J(!1)}}async function Pn(){if(!xe)return Un(!0);if(s)try{te(!0),q("");const Ee=window.localStorage.getItem("hyperToken"),h=window.localStorage.getItem("hyperAddress");if(!Ee||!h){be(!1),Un(!0);return}const S=await(await fetch(`${De}/api/hyper/farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:h.toLowerCase(),token:Ee,wallet_id:Number(s)})})).json();S!=null&&S.success?V(!1):q((S==null?void 0:S.error_message)||"Stop failed.")}catch(Ee){q(Ee.message||"An error occurred while stopping.")}finally{te(!1)}}const tr=32,ar={control:(Ee,h)=>({...Ee,backgroundColor:"#242424",borderColor:h.isFocused?"#67FFBD":"#353535",minHeight:tr,height:tr,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:Ee=>({...Ee,height:tr,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Ee=>({...Ee,height:tr}),input:Ee=>({...Ee,color:"#FFFFFF",margin:0,padding:0}),singleValue:Ee=>({...Ee,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Ee=>({...Ee,color:"#7F7F7F",fontSize:"12px"}),menu:Ee=>({...Ee,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Ee=>({...Ee,paddingTop:0,paddingBottom:0}),option:(Ee,h)=>({...Ee,backgroundColor:h.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:tr,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Ee=>({...Ee,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Ee=>({...Ee,backgroundColor:"#353535"})},hr=Ee=>{var h;return i.jsx(Sa.Option,{...Ee,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((h=Ee.data)==null?void 0:h.icon)&&i.jsx("img",{src:Ee.data.icon,alt:Ee.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:Ee.data.label})]})})},qt=Ee=>{var h;return i.jsx(Sa.SingleValue,{...Ee,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((h=Ee.data)==null?void 0:h.icon)&&i.jsx("img",{src:Ee.data.icon,alt:Ee.data.label,className:"w-4 h-4",onError:p=>{p.currentTarget.style.display="none"}}),i.jsx("span",{className:"text-white text-[13px]",children:Ee.data.label})]})})},zn=m.useMemo(()=>rt.map(Ee=>{let p=`https://app.hyperliquid.xyz/coins/${Ee==="USDT0"?"USDT":Ee}.svg`;return Ee==="PUP"&&(p="https://www.basedapp.io/_next/image?url=%2Ftokens%2Fpng%2FPUP_USDC.png&w=32&q=75"),{value:Ee,label:Ee,icon:p}}),[]),Zn=async()=>{var p,S;const Ee=window.localStorage.getItem("hyperToken"),h=window.localStorage.getItem("hyperAddress");if(!(!Ee||!h))try{X(!0);const _=await ki(h.toLowerCase(),Ee);_!=null&&_.success?(Xt(_==null?void 0:_.telegram_chat_id),an(_==null?void 0:_.subscriber_role),Jt(_==null?void 0:_.subs_expire_day),Ye((p=_==null?void 0:_.mushboomer_counts)==null?void 0:p.eth),Je((S=_==null?void 0:_.mushboomer_counts)==null?void 0:S.sol),It(_==null?void 0:_.referral_code),hn(_==null?void 0:_.refcode),Yt(_==null?void 0:_.whitelist),Rt(Ee),ot(h),cn(!0),X(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Rt(""),ot(""),X(!1))}catch(_){console.error("Token verification error:",_),console.error(_.message||"An unknown error occurred."),X(!1)}},Ft=M||$||ne||K||z,En=W&&!K;return t?i.jsxs(i.Fragment,{children:[Ke&&Aa.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:Ke,setOpen:dt,handleListRequest:Dt,handlePageChange:()=>{}})}),document.body),i.jsx(jd,{open:ht,setOpen:pt,transactionHash:Gt,transactionLoading:Le,paymentPresaleRole:nn,errorFunds:se,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Ft&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"basedapp",onCloseCurrent:()=>!Ft&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#ff6940] max-h-[90dvh] overflow-y-auto",children:[i.jsxs("div",{className:"p-5 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-baseline gap-2",children:[i.jsx("img",{src:jEe,alt:"BasedApp",className:"h-6"}),i.jsx("span",{className:"text-[34px] font-semibold text-[#ff6940]",children:"farming"})]}),i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2 pr-[148px]",children:"BasedApp farming module lets you configure automated trading by selecting a wallet, coin, margin, and spread or orders per hour."}),i.jsxs("div",{onClick:Ee=>{window.localStorage.getItem("hyperToken")?dt(!0):Un(!0)},className:"absolute top-[70px] sm:top-8 right-5 h-6 sm:h-8 pl-2 sm:pl-3 pr-4 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] !w-30",children:"Add Account"})]}),i.jsxs("div",{onClick:()=>{window.open("https://www.youtube.com/watch?v=2kBqpY09aDM","_blank")},className:"absolute top-[110px] sm:top-[84px] right-5 h-6 sm:h-8 pl-[26px] sm:pl-[32px] pr-7 py-3 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] justify-center items-center gap-1 inline-flex cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(IT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"YouTube"})]})]}),W&&i.jsx("div",{className:"px-5 pt-3",children:i.jsxs("div",{className:"flex items-center justify-between rounded-[12px] border border-[#2A2A2A] bg-[#1f1f1f] px-3 py-2",children:[i.jsx("span",{className:"text-[12px] text-[#CECECE]",children:"Your farm process is currently running. You can follow it here."}),i.jsx("a",{href:"https://www.basedapp.io/leaderboard",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center h-8 px-4 rounded-[10px] text-[12px] font-semibold border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] text-white",children:"Leaderboard"})]})}),P===2&&i.jsx("div",{className:"px-5 pt-3",children:i.jsx("div",{className:"text-[12px] text-[#FFD166] bg-[#2a2413] border border-[#6b5c2d] rounded-md px-3 py-2",children:"Use a lower margin compared to your spot balance. Margin should be less than 50% of the Spot balance in order for system to keep farming. Example: For 10.000$ Spot equity use 2.000$ in margin."})}),xe&&Nn&&i.jsx("div",{className:"px-5 pt-3",children:je?i.jsx("div",{className:"text-[12px] text-[#FFD166] bg-[#2a2413] border border-[#6b5c2d] rounded-md px-3 py-2",children:"Checking builder approval..."}):on?null:i.jsxs("div",{className:"flex flex-col gap-2 text-[12px] text-[#FFD166] bg-[#2a2413] border border-[#6b5c2d] rounded-md px-3 py-2",children:[i.jsx("span",{children:"Action required: Please log in via BasedApp and approve the Builder fee for this wallet to continue."}),i.jsx("a",{href:"https://app.based.one/register?ref=ANABOLIC",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-center text-[#1B1B1B] bg-[#ff6940] rounded-md px-3 py-1 font-bold transition",children:"BasedApp Login"})]})}),i.jsxs("div",{className:"p-5 space-y-6",children:[fe&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:fe}),i.jsxs("div",{className:"w-full rounded-full border border-[#2A2A2A] bg-transparent p-1 flex gap-2",children:[i.jsx("div",{className:`flex-1 h-9 rounded-full text-[13px] transition cursor-pointer flex justify-center items-center font-semibold ${P===2?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${En?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!En&&T(2),children:"Econo Mode"}),i.jsx("div",{className:`flex-1 h-9 rounded-full text-[13px] transition cursor-pointer flex justify-center items-center font-semibold ${P===1?"bg-[#242424] text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]":"text-[#B3B3B3]"} ${En?"opacity-60 cursor-not-allowed":""}`,onClick:()=>!En&&T(1),children:"Farmer Mode"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Select Wallet"}),i.jsxs("div",{className:"relative",children:[i.jsx(jl,{styles:ar,isDisabled:Ft||M||En,isLoading:M,options:Kn,value:Kn.find(Ee=>String(Ee.value)===String(s))||null,onChange:Ee=>{if(En)return;a((Ee==null?void 0:Ee.value)??""),Qe(null);const h=(Ee==null?void 0:Ee.raw)||{},p=h.address||h.evm_address||h.wallet_address||h.public_address||h.eth_address||h.addr||null;xe&&(h==null?void 0:h.version)===3&&p&&sn(p)},placeholder:xe?M?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{xe||Un(!0)},menuIsOpen:xe?void 0:!1}),!xe&&i.jsx("button",{type:"button",onClick:()=>Un(!0),className:"absolute inset-0 rounded-md cursor-pointer bg-transparent","aria-label":"Connect to select",title:"Connect"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Select Coin"}),i.jsx(jl,{styles:ar,components:{Option:hr,SingleValue:qt},isDisabled:Ft||En,options:zn,value:zn.find(Ee=>Ee.value===o)||null,onChange:Ee=>{En||l((Ee==null?void 0:Ee.value)??"")},placeholder:"Select",isSearchable:!0})]})]}),P===1?i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Trade Per Hour"}),i.jsx("input",{value:C,onChange:Ee=>{const h=Ee.target.value.trim();if(h==="")return N("");rn(h)&&N(h)},onKeyDown:gn,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 6 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[14px] font-inter outline-none placeholder:text-[#7F7F7F] ${C===""?"border-[#353535]":Vn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ft||En}),C!==""&&!Vn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]}),i.jsxs("div",{className:"space-y-2 hidden",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Spread %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:y,onChange:Ee=>{const h=Ee.target.value.trim();if(h==="")return v("");dn(h)&&v(h)},onKeyDown:gn,inputMode:"decimal",autoComplete:"off",placeholder:"Default 0.01",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[14px] font-inter outline-none placeholder:text-[#7F7F7F] ${y===""?"border-[#353535]":yn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ft||En})]}),y!==""&&!yn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."}),o==="PUP"&&i.jsxs("div",{className:"mt-2 text-[12px] text-[#FFD166] bg-[#2a2413] border border-[#6b5c2d] rounded-md px-3 py-2",children:[i.jsx("div",{children:"⚠️ PUP Spread Warning"}),i.jsx("div",{children:"Due to high price volatility, we recommend setting your spread to at least %0.03 for PUP."})]})]})]}):i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:i.jsx(gi,{content:"The portion of your budget used per trade. A higher margin means larger trade size, while a lower margin spreads your budget across more trades.",children:i.jsx("span",{children:"Margin (Amount)"})})}),i.jsx("input",{value:c,onChange:Ee=>{const h=Ee.target.value.trim();if(h==="")return u("");dn(h)&&u(h)},onKeyDown:gn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 2000",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[14px] font-inter outline-none placeholder:text-[#7F7F7F] ${c===""?"border-[#353535]":An?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ft||En}),c!==""&&!An&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a value greater than or equal to 11."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Spread %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:x,onChange:Ee=>{const h=Ee.target.value.trim();if(h==="")return g("");dn(h)&&g(h)},onKeyDown:gn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 0.5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[14px] font-inter outline-none placeholder:text-[#7F7F7F] ${x===""?"border-[#353535]":kn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Ft||En})]}),x!==""&&!kn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."}),o==="PUP"&&i.jsxs("div",{className:"mt-2 text-[12px] text-[#FFD166] bg-[#2a2413] border border-[#6b5c2d] rounded-md px-3 py-2",children:[i.jsx("div",{children:"⚠️ PUP Spread Warning"}),i.jsx("div",{children:"Due to high price volatility, we recommend setting your spread to at least 0.03 for PUP."})]})]})]})]}),i.jsxs("div",{className:"flex items-start gap-3 p-3 border-t border-[#353535] bg[rgba(27,27,27,0.32)] rounded-b-3xl",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[xe&&i.jsxs("div",{className:"text-[12px] text-[#9B9B9B] flex items-center gap-2",children:["Available Spot Balance (USDC):",i.jsx("span",{className:"text-white",children:ee?"Loading...":me?"—":kt(de??"0")}),i.jsx("div",{onClick:bn,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(XS,{className:`w-4 h-4 ${ee?"animate-spin":""}`})})]}),xe&&o&&i.jsxs("div",{className:"text-[12px] text-[#9B9B9B] flex items-center gap-2",children:["Available ",o," Balance:",i.jsx("span",{className:"text-white",children:kt(Oe==null?void 0:Oe.total)}),i.jsxs("span",{className:"text-[#9B9B9B]",children:["(~",kt(Oe==null?void 0:Oe.entryNtl)," USDC)"]}),i.jsx("div",{onClick:bn,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(XS,{className:`w-4 h-4 ${ee?"animate-spin":""}`})})]})]}),i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Ft&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] font-inter hover:border-white disabled:opacity-60",disabled:Ft,children:"Cancel"}),xe?W?i.jsx("button",{onClick:Pn,disabled:!s||Ft,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:K?"Stopping...":"Stop"}):i.jsx("button",{onClick:en,disabled:!Zt||Ft,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border ${!Zt||Ft?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:ne?"Starting...":"Start"}):i.jsx("button",{onClick:()=>Un(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] font-inter border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})]}),(M||$)&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]}):null}const bce=({open:t=!1,setOpen:e=()=>{},defaultMethod:n=2})=>{const{setSignModalOpen:r,setTelegramChatId:s,setSubscriberRole:a,setSubsExpireDay:o,setMushboomerETH:l,setMushboomerSOL:c,setIsReferralCode:u,setIsReferralCodeName:d,setIsWhitelist:f,setHyperToken:x,setHyperAddress:g}=m.useContext(Qr);ns();const[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState(""),[M,F]=m.useState(""),[$,L]=m.useState(""),[z,X]=m.useState(""),[ne,J]=m.useState(""),[K,te]=m.useState("OFF"),[fe,q]=m.useState(""),[se,ae]=m.useState(""),[W,V]=m.useState("LONG"),[ee,oe]=m.useState("MARKET"),[de,Ce]=m.useState(""),[me,we]=m.useState(""),[xe,be]=m.useState(""),[je,Ie]=m.useState(!1),[Re,Qe]=m.useState(!1),[Ke,dt]=m.useState(!1),[tt,nt]=m.useState(!1),[Le,Be]=m.useState(""),[ht,pt]=m.useState(""),[Gt,wt]=m.useState(!0),[nn,cn]=m.useState(!1),[Un,Xt]=m.useState(!1),[an,Jt]=m.useState(!1),[Ye,Je]=m.useState(!1),[It,hn]=m.useState(!1),[Yt,Rt]=m.useState(!1),[ot,De]=m.useState(""),[At,ze]=m.useState(!0),[rt,mt]=m.useState(2),Lt="https://dextrabothypev2.nftinit.io",kt="",dn={ASTERUSDT:[[50,0,2500],[25,2500,5e3],[20,5e3,1e4],[10,1e4,1e5],[5,1e5,2e5],[2,2e5,6e5],[1,6e5,1e6]],BTCUSDT:[[100,0,5e5],[75,5e5,1e6],[50,1e6,25e5],[25,25e5,5e6],[20,5e6,125e5],[10,125e5,25e6],[5,25e6,75e6],[4,75e6,125e6],[3,125e6,2e8],[2,2e8,25e7],[1,25e7,375e6]],ETHUSDT:[[100,0,3e5],[75,3e5,6e5],[50,6e5,375e4],[20,375e4,12e6],[10,12e6,15e6],[5,15e6,45e6],[4,45e6,75e6],[3,75e6,12e7],[2,12e7,15e7],[1,15e7,225e6]],BNBUSDT:[[100,0,1e4],[75,1e4,5e4],[50,5e4,625e3],[20,625e3,2e6],[10,2e6,25e5],[5,25e5,75e5],[4,75e5,125e5],[3,125e5,2e7],[2,2e7,25e6],[1,25e6,375e5]],SOLUSDT:[[25,0,2e5],[15,2e5,4e5],[10,4e5,4e6],[8,4e6,8e6],[6,8e6,2e7],[5,2e7,4e7],[4,4e7,8e7],[3,8e7,12e7],[2,12e7,16e7],[1,16e7,2e8]]},rn={ASTERUSDT:{market:5e3,unit:"ASTER"},BTCUSDT:{market:20,unit:"BTC"},ETHUSDT:{market:100,unit:"ETH"},BNBUSDT:{market:300,unit:"BNB"},SOLUSDT:{market:3e3,unit:"SOL"}},gn=k=>{if(k==null||isNaN(k))return"";const I=Math.abs(k),B=G=>G.toFixed(1).replace(/\.0$/,"");return I>=1e9?`${B(k/1e9)}B`:I>=1e6?`${B(k/1e6)}M`:I>=1e3?`${B(k/1e3)}K`:`${k}`},An=(k,I)=>{const B=dn[k]||[];if(!B.length||!I)return null;let G=null;for(const[re,ce,ue]of B)I<=re&&(!G||re<G.maxLev)&&(G={min:ce,max:ue,maxLev:re});return G},kn=m.useMemo(()=>[{value:"ASTERUSDT",label:"ASTERUSDT",icon:"https://static.astherus.finance/image/admin_mgs_image_upload/20250916/6dba1412-ddfb-4314-bfdf-87fa11f2daa6.png",maxLeverage:50},{value:"BTCUSDT",label:"BTCUSDT",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:100},{value:"ETHUSDT",label:"ETHUSDT",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:100},{value:"BNBUSDT",label:"BNBUSDT",icon:"https://app.hyperliquid.xyz/coins/BNB.svg",maxLeverage:100},{value:"SOLUSDT",label:"SOLUSDT",icon:"https://app.hyperliquid.xyz/coins/SOL.svg",maxLeverage:25}],[]),yn=k=>{var I;return((I=kn.find(B=>B.value===k))==null?void 0:I.maxLeverage)??100},Vn=k=>{["e","E","+","-"].includes(k.key)&&k.preventDefault()},Kn=k=>/^\d*\.?\d{0,6}$/.test(k),Dn=k=>/^\d*$/.test(k),Xn=m.useMemo(()=>{if(fe==="")return!1;const k=Number(fe);return Number.isInteger(k)&&k>=1&&k<=180},[fe]),Nn=m.useMemo(()=>{if(se==="")return!1;const k=Number(se),I=yn(ne);return Number.isInteger(k)&&k>=1&&k<=I},[se,ne]),on=m.useMemo(()=>{if(de==="")return!1;const k=Number(de);return!Number.isNaN(k)&&k>=0&&k<=100},[de]),Oe=m.useMemo(()=>{if(me==="")return!1;const k=Number(me);return!Number.isNaN(k)&&k>=0&&k<=100},[me]),Zt=m.useMemo(()=>{if(xe==="")return!1;const k=Number(xe);return!Number.isNaN(k)&&k>=0&&k<=100},[xe]),sn=Number(se||0),jt=Nn&&ne?An(ne,sn):null,Qn=y&&P.trim()!==""&&M.trim()!==""&&(K!=="ON"||$.trim()!==""&&z.trim()!=="")&&ne!==""&&Xn&&Nn&&(W==="LONG"||W==="SHORT")&&(ee==="LIMIT"||ee==="MARKET")&&At,bn=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Dt=()=>`asterCreds:${bn()}`,en=()=>{try{const k=localStorage.getItem(Dt());if(!k)return;const I=JSON.parse(k);I.apiKey&&T(I.apiKey),I.apiSecret&&F(I.apiSecret),I.apiKeyTwo&&L(I.apiKeyTwo),I.apiSecretTwo&&X(I.apiSecretTwo),typeof I.remember=="boolean"&&wt(I.remember)}catch{}},Pn=()=>{if(Gt)try{localStorage.setItem(Dt(),JSON.stringify({apiKey:P,apiSecret:M,apiKeyTwo:$,apiSecretTwo:z,remember:!0}))}catch{}},tr=()=>{try{localStorage.removeItem(Dt())}catch{}};m.useEffect(()=>{if(!t)return;const k=localStorage.getItem("hyperToken"),I=localStorage.getItem("hyperAddress");v(!!(k&&I));const B=setInterval(()=>{const G=localStorage.getItem("hyperToken"),re=localStorage.getItem("hyperAddress");v(!!(G&&re))},800);return()=>clearInterval(B)},[t]),m.useEffect(()=>{!t||!y||(ar(),Ee())},[t,y]),m.useEffect(()=>{t&&(me===""&&we(kt),de===""&&Ce(kt),xe===""&&be(kt))},[t]),m.useEffect(()=>{if(!ne)return;const k=yn(ne),I=Number(se);!Number.isNaN(I)&&I>k&&ae(String(k)),!Number.isNaN(I)&&I<1&&se!==""&&ae("1")},[ne]),m.useEffect(()=>{t&&(Gt&&Pn(),Gt||tr())},[P,M,$,z,Gt,t]);async function ar(){var k,I,B,G,re;try{Qe(!0),Be("");const ce=window.localStorage.getItem("hyperToken"),ue=window.localStorage.getItem("hyperAddress");if(!ce||!ue){N(!1),en();return}const Ae=await(await fetch(`${Lt}/api/hyper/ast_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ue.toLowerCase(),token:ce})})).json(),ke=(k=Ae==null?void 0:Ae.data)==null?void 0:k.farming_params;if(Ae!=null&&Ae.success&&ke){N(!0);const Me=((I=Ae==null?void 0:Ae.data)==null?void 0:I.aster_apikey)??"",qe=((B=Ae==null?void 0:Ae.data)==null?void 0:B.aster_apisecret)??"",Fe=(ke==null?void 0:ke.api_key_2)??"",at=(ke==null?void 0:ke.api_secret_2)??"";Me&&T(String(Me)),qe&&F(String(qe)),Fe&&L(String(Fe)),at&&X(String(at)),((G=Ae==null?void 0:Ae.data)==null?void 0:G.delta_neutral)!==void 0&&te((re=Ae==null?void 0:Ae.data)!=null&&re.delta_neutral?"ON":"OFF"),ke!=null&&ke.coin&&J(String(ke.coin)),(ke==null?void 0:ke.orderPerHour)!=null&&q(String(ke.orderPerHour)),(ke==null?void 0:ke.leverage)!=null&&ae(String(ke.leverage)),ke!=null&&ke.direction&&V(String(ke.direction).toUpperCase()==="SHORT"?"SHORT":"LONG"),ke!=null&&ke.order_type&&oe(String(ke.order_type)==="limit"?"LIMIT":"MARKET"),(ke==null?void 0:ke.upspread)!=null&&Ce(String(ke.upspread)),(ke==null?void 0:ke.downspread)!=null&&we(String(ke.downspread)),(ke==null?void 0:ke.upspread)!=null&&be(String(ke.upspread))}else N(!1),te("OFF");(!P&&!M||K==="ON"&&!$&&!z)&&en()}catch{N(!1),en(),te("OFF")}finally{Qe(!1)}}async function hr(){if(!y){r(!0);return}if(Qn)try{dt(!0),Be("");const k=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!k||!I){r(!0);return}const B={methodType:K==="ON"?2:1,coin:ne,orderPerHour:Number(fe),leverage:Number(se),...K==="ON"?{api_key_2:$,api_secret_2:z}:ee==="LIMIT"?{upspread:Number(xe),direction:W,order_type:ee==="LIMIT"?"limit":"market"}:{upspread:Number(de),downspread:Number(me),direction:W,order_type:ee==="LIMIT"?"limit":"market"}},G={address:I.toLowerCase(),token:k,apikey:P,apisecret:M,farming_params:B,delta_neutral:K==="ON"},ce=await(await fetch(`${Lt}/api/hyper/ast_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)})).json();ce!=null&&ce.success?(N(!0),Gt&&Pn()):Be((ce==null?void 0:ce.error_message)||"Start failed.")}catch(k){Be(k.message||"An error occurred while saving.")}finally{dt(!1)}}async function qt(){if(!y){r(!0);return}try{nt(!0),Be("");const k=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!k||!I){r(!0);return}const G=await(await fetch(`${Lt}/api/hyper/ast_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:I.toLowerCase(),token:k})})).json();G!=null&&G.success?N(!1):Be((G==null?void 0:G.error_message)||"Stop failed.")}catch(k){Be(k.message||"An error occurred while stopping.")}finally{nt(!1)}}const zn={control:(k,I)=>({...k,backgroundColor:"#242424",borderColor:I.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:k=>({...k,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:k=>({...k,height:32}),input:k=>({...k,color:"#FFFFFF",margin:0,padding:0}),singleValue:k=>({...k,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:k=>({...k,color:"#7F7F7F",fontSize:"12px"}),menu:k=>({...k,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:k=>({...k,paddingTop:0,paddingBottom:0}),option:(k,I)=>({...k,backgroundColor:I.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:k=>({...k,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:k=>({...k,backgroundColor:"#353535"})},Zn=({max:k})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[k,"x"]}),Ft=k=>{var I;return i.jsx(Sa.Option,{...k,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((I=k.data)==null?void 0:I.icon)&&i.jsx("img",{src:k.data.icon,alt:k.data.label,className:"w-4 h-4 rounded-[4px]",onError:B=>B.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:k.data.label}),i.jsx(Zn,{max:k.data.maxLeverage})]})})},En=k=>{var I;return i.jsx(Sa.SingleValue,{...k,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((I=k.data)==null?void 0:I.icon)&&i.jsx("img",{src:k.data.icon,alt:k.data.label,className:"w-4 h-4 rounded-[4px]",onError:B=>B.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:k.data.label}),i.jsx(Zn,{max:k.data.maxLeverage})]})})},Ee=async()=>{var B,G;const k=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!(!k||!I))try{Ie(!0);const re=await ki(I.toLowerCase(),k);re!=null&&re.success?(s(re==null?void 0:re.telegram_chat_id),a(re==null?void 0:re.subscriber_role),o(re==null?void 0:re.subs_expire_day),l((B=re==null?void 0:re.mushboomer_counts)==null?void 0:B.eth),c((G=re==null?void 0:re.mushboomer_counts)==null?void 0:G.sol),u(re==null?void 0:re.referral_code),d(re==null?void 0:re.refcode),f(re==null?void 0:re.whitelist),x(k),g(I),ze(!0),Ie(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),x(""),g(""),Ie(!1))}catch(re){console.error("Token verification error:",re),console.error(re.message||"An unknown error occurred."),Ie(!1)}},h=kn;if(!t)return null;const p=Re||Ke||tt||je,S=C&&!tt,_=yn(ne);return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:Yt,setOpen:Rt,transactionHash:ot,transactionLoading:It,paymentPresaleRole:At,errorFunds:ht,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!p&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"aster",onCloseCurrent:()=>!p&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:`${K==="ON"?"pb-3.5":"pb-2"} px-5 pt-5 border-b border-[#353535] rounded-t-3xl relative`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://static.asterdex.com/cloud-futures/static/images/aster/logo.svg",alt:"Dextrabot - Aster Farming"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#F8D4AB] mt-[1px]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Aster Farming module lets you set up automated farming by providing your API Key and Secret, selecting a pair, defining orders per hour, leverage, direction, and TP/SL percentages."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1",children:i.jsxs("div",{onClick:()=>window.open("https://www.youtube.com/watch?v=qFJxq-vzctE","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(IT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]})})]}),C&&rt===2&&i.jsx("div",{className:"pt-4",children:i.jsxs("div",{className:"flex items-center justify-between rounded-[12px] border border-[#2A2A2A] bg-[#1f1f1f] px-3 py-2",children:[i.jsx("span",{className:"text-[12px] text-[#CECECE]",children:"Your farm process is currently running. You can follow it here."}),i.jsx("a",{href:"https://www.asterdex.com/en/stage3/statistics",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center h-8 px-4 rounded-[10px] text-[12px] font-semibold border bg-[#F8D4AB] border-[#f7c080] hover:bg-[#f6e7d5] text-black hover:text-black",children:"Points"})]})})]}),i.jsxs("div",{className:`${K==="ON"?"space-y-3 pt-3.5 pb-3":"space-y-2 pt-2 pb-2"} px-5`,children:[Le&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Le}),i.jsx("div",{className:"px-1 sm:px-4",children:i.jsx("div",{className:"w-full flex gap-2",children:i.jsx("div",{className:"flex-1 h-9 rounded-full text-[13px] transition flex justify-center items-center font-semibold",children:i.jsx("div",{className:"airdrop-btn",children:i.jsx("span",{className:"label",children:i.jsxs("span",{className:"text-[#F6D5B1] font-medium text-[11px] sm:text-sm flex items-center gap-2 min-w-max",children:[i.jsx($A,{className:"w-4 h-4"}),"Stage 3"]})})})})})}),y&&!C&&rt===2&&At&&i.jsxs("div",{className:"flex flex-col items-center gap-2 px-2 sm:px-5 ",children:[i.jsxs("div",{className:"flex justify-between items-center rounded-[12px] border border-[#2A2A2A] bg-[#1f1f1f] px-3 py-2 w-full gap-2",children:[i.jsx("div",{className:"text-white font-semibold text-[11px] sm:text-[14px] leading-4 font-manrope",children:"1) Enable Trading on Asterdex"}),i.jsx("div",{onClick:()=>{window.open("https://www.asterdex.com/en/futures/v1/BTCUSDT?ref=9876D8","_blank")},className:"flex items-center justify-center h-6 px-6 rounded-[10px] text-[13px] border bg-[#F8D4AB] border-[#F8D4AB] hover:bg-[#dbb689] cursor-pointer min-w-max text-black hover:text-black/90",children:"Enable Trading"})]}),i.jsxs("div",{className:"flex justify-between items-center rounded-[12px] border border-[#2A2A2A] bg-[#1f1f1f] px-3 py-2 w-full gap-2",children:[i.jsx("div",{className:"text-white font-semibold text-[11px] sm:text-[14px] leading-4 font-manrope",children:"2) Create Your API Keys"}),i.jsx("div",{onClick:()=>{window.open("https://www.asterdex.com/en/api-management","_blank")},className:"flex items-center justify-center h-6 px-6 rounded-[10px] text-[13px] border bg-[#F8D4AB] border-[#F8D4AB] hover:bg-[#dbb689] cursor-pointer min-w-max text-black hover:text-black/90",children:"Go to Asterdex"})]})]}),rt===2&&i.jsxs("div",{className:`${K==="ON"?"space-y-6":"space-y-3"} px-3 sm:px-5 py-2 `,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[K==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://www.asterdex.com/en/api-management",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:P,onChange:k=>T(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",type:nn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${P===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>cn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:nn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:M,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Un?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${M===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>Xt(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:Un?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://www.asterdex.com/en/api-management",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:P,onChange:k=>T(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY",type:nn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${P===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>cn(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:nn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:M,onChange:k=>F(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET",type:Un?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${M===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>Xt(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:Un?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),K==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key 2"}),i.jsx("a",{href:"https://www.asterdex.com/en/api-management",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:$,onChange:k=>L(k.target.value),autoComplete:"off",placeholder:"ASTER_API_KEY_2",type:an?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${$===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>Jt(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:an?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Secret 2"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:z,onChange:k=>X(k.target.value),autoComplete:"off",placeholder:"ASTER_API_SECRET_2",type:Ye?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${z===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:p||S}),i.jsx("button",{type:"button",onClick:()=>Je(k=>!k),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:p||S,children:Ye?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:zn,components:{Option:Ft,SingleValue:En},isDisabled:p||S,options:h,value:h.find(k=>k.value===ne)||null,onChange:k=>J((k==null?void 0:k.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:fe,onChange:k=>{const I=k.target.value.trim();if(I==="")return q("");Dn(I)&&q(I)},onKeyDown:Vn,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${fe===""?"border-[#353535]":Xn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S}),fe!==""&&!Xn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:K==="ON"?"On":"Off"}),i.jsx(Io,{checked:K==="ON",onChange:k=>te(k?"ON":"OFF"),disabled:p||S,className:`${K==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${p||S?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${K==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:se,onChange:k=>{const I=k.target.value.trim();if(I==="")return ae("");Dn(I)&&ae(I)},onKeyDown:Vn,inputMode:"numeric",autoComplete:"off",placeholder:ne?`1–${_}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${se===""?"border-[#353535]":Nn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S}),se!==""&&!Nn&&i.jsxs("div",{className:"text-[#FF797C] text-[12px]",children:["Allowed: 1–",_,"x"]}),jt&&i.jsxs("div",{className:"mt-2 space-y-1 text-[10px] text-[#CECECE]",children:[i.jsxs("div",{children:["Tier range at ",i.jsxs("b",{children:[sn,"x"]}),":"," ",i.jsxs("b",{children:[gn(jt.min)," – ",gn(jt.max)," USDT"]})," ",i.jsx("a",{href:"https://www.asterdex.com/en/futures/trading-rules/leverage-and-margin",target:"_blank",rel:"noopener noreferrer",className:"underline text-[#F8D4AB] hover:text-white",children:"More Details"})]}),rn[ne]&&i.jsxs("div",{children:["Trading Limit is"," ",i.jsxs("b",{children:[gn(rn[ne].market)," ",rn[ne].unit]})," ","for ",i.jsx("b",{children:ne})," ",i.jsx("a",{href:"https://www.asterdex.com/en/futures/trading-rules/trading-rules",target:"_blank",rel:"noopener noreferrer",className:"underline text-[#F8D4AB] hover:text-white",children:"More Details"})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${K==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":ee==="MARKET",onClick:()=>!S&&oe("MARKET"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",ee==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",ee==="MARKET"?" ✓":""]})}),i.jsx("button",{"aria-pressed":ee==="LIMIT",onClick:()=>!S&&oe("LIMIT"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",ee==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",ee==="LIMIT"?" ✓":""]})})]})]}),i.jsxs("div",{className:`${K==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{"aria-pressed":W==="LONG",onClick:()=>!S&&V("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",W==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{children:["LONG",se?` - ${se}x`:""]})}),i.jsx("div",{"aria-pressed":W==="SHORT",onClick:()=>!S&&V("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-8 px-3 rounded-[10px] uppercase tracking-wide text-[12px] font-semibold transition-all border w-1/2",p||S?"opacity-60 cursor-not-allowed":"cursor-pointer",W==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{children:["SHORT",se?` - ${se}x`:""]})})]})]})]}),i.jsxs("div",{className:`${K==="ON"||ee==="LIMIT"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:de,onChange:k=>{const I=k.target.value.trim();if(I==="")return Ce("");Kn(I)&&Ce(I)},onKeyDown:Vn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 0.5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${de===""?"border-[#353535]":on?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),de!==""&&!on&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:me,onChange:k=>{const I=k.target.value.trim();if(I==="")return we("");Kn(I)&&we(I)},onKeyDown:Vn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 0.2",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${me===""?"border-[#353535]":Oe?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),me!==""&&!Oe&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]})]}),i.jsx("div",{className:`${K==="OFF"&&ee==="LIMIT"?"":"hidden"} grid grid-cols-1 md:grid-cols-2 gap-4`,children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Spread %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:xe,onChange:k=>{const I=k.target.value.trim();if(I==="")return be("");Kn(I)&&be(I)},onKeyDown:Vn,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 0.5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${xe===""?"border-[#353535]":Zt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:p||S})]}),xe!==""&&!Zt&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter a percentage between 0 and 100."})]})})]}),rt===2&&i.jsx("div",{className:"flex items-center gap-3 px-5 py-3 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl",children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!p&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:p,children:"Cancel"}),y?C?i.jsx("button",{onClick:qt,disabled:p,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:tt?"Stopping...":"Stop"}):i.jsx("button",{onClick:hr,disabled:!Qn||p,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Qn||p?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Ke?"Starting...":"Start"}):i.jsx("button",{onClick:()=>r(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),Re&&rt===2&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},ZFt=({linkTo:t,title:e,icon:n,activePaths:r=[]})=>{const{pathname:s}=Kl(),a=(r.length?r:[t]).some(o=>s.startsWith(o));return i.jsx("a",{href:t,target:"_self",children:i.jsxs("div",{className:`${a?"bg-[#353535] rounded-[256px]":""} h-8 px-2.5 py-2 justify-start items-center inline-flex text-white min-w-max cursor-pointer ${t==="/tracked-wallets"||t==="/tracker"||t==="/referral"||t==="/wallet-management"||t==="/copy-trade"||t==="/leaderboard"?"hidden sm:block":""}`,children:[n&&i.jsx("img",{src:n,alt:e,className:"h-4"}),i.jsx("div",{className:"text-[13px] font-semibold font-manrope leading-[16px] min-w-max",children:e})]})})},bf=({className:t})=>i.jsxs("svg",{viewBox:"0 0 53 96",fill:"currentColor",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:`size-full ${t}`,children:[i.jsx("path",{d:"M23 76.3751L0 96V20.687L23 0V76.3751Z"}),i.jsx("path",{d:"M53 76.4219L30 96V66.6279L53 46V76.4219Z"})]}),oo=({content:t,positionTop:e,alignRight:n,tooltipCss:r})=>i.jsxs("span",{className:`tooltip ${n?"left-5 top-1/2 -translate-y-1/2 ":e?"-top-6 -translate-x-1/2 left-1/2":"-bottom-6 -translate-x-1/2 left-1/2"} transform bg-[#353535] text-white font-manrope font-semibold text-xs leading-3 py-1 px-1.5 rounded-sm relative whitespace-normal ${r} h-auto overflow-hidden break-normal`,children:[t==="Sharpe_tooltip"?i.jsxs("div",{className:"flex flex-col items-start pl-4 gap-1 min-w-max",children:[i.jsxs("span",{className:"flex justify-start items-center gap-1 text-xs font-semibold",children:[i.jsx("div",{className:"rounded-full bg-[#FF7173] w-2 h-2"}),i.jsx("span",{children:"< 1"})]}),i.jsxs("span",{className:"flex justify-start items-center gap-1 text-xs font-semibold",children:[i.jsx("div",{className:"rounded-full bg-[#E5BB18] w-2 h-2"}),i.jsx("span",{children:"1 - 2"})]}),i.jsxs("span",{className:"flex justify-start items-center gap-1 text-xs font-semibold",children:[i.jsx("div",{className:"rounded-full bg-[#1DE6A3] w-2 h-2"}),i.jsx("span",{children:"> 2"})]})]}):t,i.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`absolute transform -z-1 ${n?"-rotate-90 left-1 -translate-x-full -translate-y-1/2 top-1/2 ":e?"-bottom-1 rotate-180 -translate-x-1/2 left-1/2":"-top-1 -translate-x-1/2 left-1/2"}`,children:i.jsx("path",{d:"M3.70096 1.25C4.27831 0.25 5.72169 0.25 6.29904 1.25L8.89711 5.75C9.47446 6.75 8.75278 8 7.59808 8H2.40192C1.24722 8 0.525536 6.75 1.10289 5.75L3.70096 1.25Z",fill:"#353535"})})]}),ji=({className:t})=>i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M8.00016 14.6666C11.6668 14.6666 14.6668 11.6666 14.6668 7.99992C14.6668 4.33325 11.6668 1.33325 8.00016 1.33325C4.3335 1.33325 1.3335 4.33325 1.3335 7.99992C1.3335 11.6666 4.3335 14.6666 8.00016 14.6666Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M8 5.33325V8.66659",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M7.99609 10.6667H8.00208",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),O5=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountLighter:r,tradeMarket:s,product:a})=>{const{address:o}=ns(),{setSignModalOpen:l,setTelegramChatId:c,setSubscriberRole:u,setSubsExpireDay:d,setMushboomerETH:f,setMushboomerSOL:x,setIsReferralCode:g,setIsReferralCodeName:y,setIsWhitelist:v,setHyperToken:C,setHyperAddress:N}=m.useContext(Qr),[P,T]=m.useState(1),[M,F]=m.useState(!1),[$,L]=m.useState(!1),[z,X]=m.useState(""),[ne,J]=m.useState(""),[K,te]=m.useState(""),fe=de=>/^\d*$/.test(de),q=de=>{["e","E","+","-"].includes(de.key)&&de.preventDefault()};m.useEffect(()=>{t||T(1)},[t]);const se=m.useRef(K);m.useEffect(()=>{se.current=K},[K]);const ae=m.useMemo(()=>{if(P==="")return!1;const de=Number(P);return Number.isInteger(de)&&de>=1},[P]),W=async()=>{var me,we,xe,be;const de=window.localStorage.getItem("hyperToken"),Ce=window.localStorage.getItem("hyperAddress");if(!(!de||!Ce))try{const je=await ki(Ce.toLowerCase(),de);je!=null&&je.success?(c(je==null?void 0:je.telegram_chat_id),u(je==null?void 0:je.subscriber_role),d(je==null?void 0:je.subs_expire_day),f((me=je==null?void 0:je.mushboomer_counts)==null?void 0:me.eth),x((we=je==null?void 0:je.mushboomer_counts)==null?void 0:we.sol),g(je==null?void 0:je.referral_code),y(je==null?void 0:je.refcode),v(je==null?void 0:je.whitelist),C(de),N(Ce),te((be=(xe=je==null?void 0:je.slots_info)==null?void 0:xe[s])==null?void 0:be.total_qty)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),C(""),N(""))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred.")}},V=async()=>new _l(window.ethereum).eth.getAccounts(Ce=>Ce),ee=async(de="slot",Ce=24,me=5e3)=>{Ce<=0||(await new Promise(we=>setTimeout(we,me)),await W(),de==="slot"&&se.current<=n?ee(de,Ce-1,me):r())},oe=async de=>{J("");const Ce=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!Ce||!o){l(!0);return}L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(be){console.error("Failed to switch network",be),F(!1);return}const we=new _l(window.ethereum);var xe=await V();if(xe.length>0?xe=xe[0]:xe=void 0,xe){const je=de*.012,Ie=we.utils.toWei(je.toString(),"ether"),Re={from:xe,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Ie};await we.eth.sendTransaction(Re).then(Qe=>{console.log("txHash :>> ",Qe),F(!1),X(Qe.transactionHash);const Ke=a==="grid_bot"?"bots_extra_slot":s==="lighter"?"lighter_season_2":s==="variational"?"variational":s==="extended"?"extended":s==="pacifica"?"pacifica":s==="paradex"?"paradex":"";fetch("https://dextrabothypev2.nftinit.io/api/hyper/slots_payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:o?o.toLowerCase():me,token:Ce,payment_tx:Qe.transactionHash,slot_role:Ke,slot_qty:Number(P)})}),W(),ee("slot")}).catch(Qe=>{console.log(Qe),Qe.code===-32003||Qe.message.includes("insufficient funds")?J("Insufficient funds."):Qe.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await we.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:!(K<=n),errorFunds:ne,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[9001] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>e(!1)}),i.jsx("div",{className:"relative w-[380px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#404040] max-h-[97dvh] overflow-y-auto p-5",children:i.jsxs("div",{className:"flex flex-col w-full gap-4",children:[i.jsx("div",{className:"text-white/90 font-manrope text-[18px] font-semibold leading-4 mx-auto",children:"Get more slots"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Slot Count"}),i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>T(de=>{const Ce=Number(de||0);return Ce>1?String(Ce-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:P,onChange:de=>{const Ce=de.target.value.trim();if(Ce==="")return T("");fe(Ce)&&T(Ce)},onKeyDown:q,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>T(de=>{const Ce=Number(de||0);return String(Ce+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),P!==""&&!ae&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),i.jsxs("div",{className:"text-[13px] text-[#7C7C7C] font-semibold flex items-center gap-1",children:["Total Price:",i.jsxs("span",{className:"bg-[#1E1E1E] text-[#F8D4AB] font-bold px-2 py-[2px] rounded-md border border-[#3A3A3A]",children:[(P*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:de=>{de.preventDefault(),ae&&oe(P)},className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] min-w-max font-semibold ${ae?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},yce=({open:t=!1,setOpen:e=()=>{}})=>{var es,Ys,_s,br;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr);ns();const[g,y]=m.useState(1),[v,C]=m.useState(0),[N,P]=m.useState(0),[T,M]=m.useState(0),[F,$]=m.useState(0),[L,z]=m.useState({}),[X,ne]=m.useState(null),[J,K]=m.useState(!1),[te,fe]=m.useState(!1),[q,se]=m.useState(!1),[ae,W]=m.useState("OFF"),[V,ee]=m.useState(""),[oe,de]=m.useState(""),[Ce,me]=m.useState(""),[we,xe]=m.useState(""),[be,je]=m.useState(""),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState(""),[dt,tt]=m.useState(""),[nt,Le]=m.useState([]),[Be,ht]=m.useState(""),[pt,Gt]=m.useState(""),[wt,nn]=m.useState(""),[cn,Un]=m.useState("LONG"),[Xt,an]=m.useState("STANDARD"),[Jt,Ye]=m.useState("STANDARD"),[Je,It]=m.useState("MARKET"),[hn,Yt]=m.useState(""),[Rt,ot]=m.useState(""),[De,At]=m.useState(""),[ze,rt]=m.useState(!1),[mt,Lt]=m.useState(!1),[kt,dn]=m.useState(!1),[rn,gn]=m.useState(!1),[An,kn]=m.useState(""),[yn,Vn]=m.useState(""),[Kn,Dn]=m.useState(!0),[Xn,Nn]=m.useState(!1),[on,Oe]=m.useState(!1),[Zt,sn]=m.useState(!1),[jt,Qn]=m.useState(!1),[bn,Dt]=m.useState(""),[en,Pn]=m.useState(!0),[tr,ar]=m.useState(!1),[hr,qt]=m.useState("Hour"),[zn,Zn]=m.useState(1),[Ft,En]=m.useState("lighter"),[Ee,h]=m.useState(!1),p=m.useRef(null),[S,_]=m.useState(""),[k,I]=m.useState(null),[B,G]=m.useState(""),[re,ce]=m.useState(!1),ue=k?(k==null?void 0:k.getTime())<=Date.now():!1,ge="https://dextrabothypev2.nftinit.io",Ae="",ke={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"},Me=["BTC","ETH","SOL"];m.useEffect(()=>{async function zt(){if(t)try{const it=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_lighter_coins/")).json();if(it!=null&&it.coins){let Ct=it.coins.map(vt=>{const ln=(vt==null?void 0:vt.label)||"",xn=ke[ln]||ln,dr=xn==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":xn==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":xn==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":xn==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":xn==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":xn==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":xn==="kTOSHI"?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAKx0lEQVR4XtVae3BUVxnfzYO8aHFKsptNeOWxm0JpyANoSi1V+0etIiQpHVoSa5niDOp0xsFa/6DTkIBSq9XWjm3zkqL9Q8eZ6h8ELY5TaaSGEUsgVDrkwWAgaKcBCUIhye7n951z7957v3PvPpLNBr6Z39zd8/x+v/Od75y7icuVLHsE3nXVA8SMW944oeniljHueOJxhk85+1YPTTaOzjxuCuNOJRuzZtyR2UZSjU8eA9oH4wPvHxNm3PiEUcBJTRV83KiYEeOTOIA7n2jw+RyRUOOD24A7OtPg89siIcYHtQF3LlngfthiWsYHswF3Ktng/thiysYHsiHurg1CibcCXj0xpjiXTHD/GJo4teimDqKQJ7hrDbg2AATyKhTnkgXupwVxGe/sQP6lngtIPATPtR8GVx3WkwgE/OzPq1QcTAa4v1MTgXfUMH+rdbL7H9wsCLfh52df+zMs8VXISDDh85u+rjg5k8jdqvodnwi8gwl8srLCak2AkBDhzVPXYGfbe2Hy+tbIKtyo9DWjbSCET4Jap9f7PVUQ8FbCQu8acNX0ILoRf4Pblr+otOd+xy4AvWryDg7kCUsLqsUWaB8MCgEIHb1jQoSsLx6zREIqtRsIQsBTAa57/iIIpDwSEgJ1DE2G+xNo7M4BFNhbhe1we9WgqDWHILWmL7zF3PUT4Bfzq35NXQTeMAJ5QmDhSkgRAsgI0NHU/p4Qocy7whIN9JyXW6qVhSwCtQ8Z/XVQGzeSLc67S+YVTzU0tXWH2+Ys2CISL/crqgiOxhtGEWDrnn22AhBIAGM7hCD1oQsKaQ4a0xiD2hrtSYgmHM8cJan39eC2qFL8iiqArQi8QRTyOpwEeGNQOkwipH7hpCQhIMNeJ2c+Qum7WQBqu7b5ktYnBCnYphkjgOpL7wg4hn9MIijGG8QqAK5Mx6CVvIgA2gbt3eC+96/KSkuYVpeIDMjv7ef0fCCFasdc4Fqvt5NlnTQv5oVi752KPxycj70AvFLDnqPqgByU3Dot+zeEq96Nq38I3JS8FOIcknjnsOZwnXzKLYDiogB1nTcsfdJqDop2racnFX84nu9Weaki8AoNfDA7kCOlvgATAInfcyic+CJD7nU9nNuGJHFDgKBY+XD7DSExZ7GvXPHFCZxXQgWgdwF37YQR+q2HxBEnQh9Dd+tvrsB3eiInP7MYe88FRT7Y/qcxzC8AP/lo0lIvREFxynyrFF+cwHnFJEDZd9WB7CDO6lrtO26FAF5YKAIoMb5yImhD0h7maHHXGQmSt9NF2HvG+eLEUfk8KPwMAerhklJRrw7ihJVVtcIp2qu7Ot8X5Pdi2Mp3g0grH6nOCdp2WRfEyxPdC5yPQA7OzxCBF8QpAIFWamHxKmj8xo9FdqYQ7sBs7v6S7rT5qUOSMUM/7ozvMvNbx9A+Yy5oG1J9cQLnl1AByKFSTxEUPtwFz/7soFbGCXNwYrzeCSaBMMeU5ceWCzi/hArgx5eUxd67xdHn+jJ32Ar90lP2rVGRNPUx0jdcM+rDbQ1hqDyrbgxeH56EN86Na+1CMGf9fxV/7GAkPG425OMV4PFvvyiPPnHux7aaBU9eEX31o1MXw0Jeux3KIzIkLlzyUmSdw++J/iMMp22YDfl4BQh4KgX5tHVXFaI6AX3FeB2H3pYwODIaLuPtzO3p+erxy4pfZnDahtmQj1cA1730bo7h70CQnLy9qhUW4TYpzavEfFEFpV56IvAYLcmvhBIvlSEKysXKD41cgoGRi9B/YVR892Nbf75s6y+ogju95XgBq4Bl+eVSBDx1lhZ9VvEt7KOj2ZCPR4BSzwqx+nTt5StlvcHhip6/iKRGYZFnGfarEDj7nzFBVMfRw32Qgu/65jL3o9eh/5zs68f5KOSHP/4fHDlMvw9Y8wTVcx9nTIC2/klt9UkAigDDEXoOofODJiL0mZzXyVPyNBPtef9DOD1y2VKmY/iTq+G+Z7DNIEbIvLVvQ/oDJzQfJPwOr8ectmE25GMVgMJZ/lqDAqyXtz66vq770RWFgBnk/L/HPoVCfIdY4FsOT2/ZDgPnZcib0dr5W5ty+m6Ukag0HvlQ+8QOxcewADYcBZSCGAUIeKvD5MX+ryMBQuLnLk5kSrhwSa54XoVaZ4PBkcjHIednFiDuq3BrfxDy89cZq49IXfMuPrstIZ9s0B9ouK/RBXDYBrG8DNGLj9j7mhABX5XiVDw4LZKkCedHlTaRQOJzHwmRX4YcBCDwgZzw2ofXxBHGHTr10VmlLBKIwBIMe31fi/BHUYZIGCaOPFFU0KnE/eO8Ei4AgWd0HV37uuD8x5GTIke/6bP9lhrFcQ+IsQ/g01w3NPyJ4hvnFbMAzxxUiTqBVkx19KJYubd/8XvhbNebXWqYx41ROIDjiPFM0Ov5Nnjh7yovVYAIInCidmjDpMgd/V2HRtoEus0Z3/c7i2YHzAenTo9A11t/hPLiz8Gj25qhNFfeJPUx+7WLltk3zsee/DQFoD+E0koTId2ZA1p4drz8K3E5KcH9XIIClJguQp0vvaW1swpl/r4fV7uiuEbsbRKazx32AY/l1h+0C7HKCoxXZM7HWQAy3ihGEQb/dRnDcj/QvizxlIsLku5sb0MmHGuYY0GveGZIMVCYLtFXJ38AfvnKr2HTUi9MtmTBxK4sZb5IKM1FofNkIuQ8ZkwAurD8/ORVpfzBr2wThI83pIfJT+zKFBhHYuM/nA/HHs+B41uyRES8s+8PYgWL8QXnys50uNGcBhMtKFSe/fU2GjiPyOTJIvxHNx88FtBvdnK1DeJBJB7aNQfGkdinTSnQ91gqnECBiu5YAb2b06G88C7cUith8vsZEMhfAfeXqsdaLOD+xyYAGW88TRFKfNXwAQnQMgd++sBcFCRDCHJjTwZMClGyoLcxA1Le2QhHHkuHsztuE2XXd2ZD5u6HAVrSlDGjgfsdO3ndeCcN859SJ4uGviczoNizSpA+sikbjjakGVugBQVAHGucIwSA3anhSCEEvKuh2LcKLmyfq4zrhNynVL8TJgCBTxgN9U+3iG0gVzsTfL77wgLQStPnY43p4D6IArwgv0tkQFF+NSzJLId/bs4Av69GGdsO3N/4yevGO09RhJNPYNZvzIRDG28PEw7uJgGMle5FAVwYAeNI2hwBi/F2mXJkM6xdnIvfs5WxObifUyevGx8kThFe/uCiCP1/NEhiHiREz21L54fFIAx9Mx3SvrfcUkY4jn0DuSsxOaaIuqIIpwH3j2EnpxabqQMp4I6YUeS923ICEIm+r9E+z8HVzrGUF3lIHKsAhNSeBgg2ybxhdyfg/thiWsYHswF3SofI+I20+llwA5PdM2vy8XKTJkQZb7aGOw9/K7JEHqHngvnLkkheNz6oDTh5ug3SbS+0OwsTIBLYTIlQywG4n09uSkExsrVkmCPKCCHtOdlCEULIFv2KCyrw0kTRI3MBn98WCTU+uAN0AUq85UKAJfmrYXjHPEGcToJe7Rgk+D0rxarSUUg3vkmHKCjCC9EJPAlCe+Yq8zliRoxPEgF9X5WhzkNZPjNgsWc1Hnsuhezl5+Za3hv0fnz8iJhx4xNGgU6antfxBWcR/QEEr8nBJjXpmcHHiYqkGp98tjFrxh1JNmrhM9yl5BtdNLhjycBNadzJxOMMn/LmNNXx6eGWtwg/ttgiSfZ/z360yWKNq4wAAAAASUVORK5CYII=":xn==="EDEN"?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADjElEQVR4Xu2Zy0prMRiFq1ZrFUFwKkJHDi0WZ04E5/o2YhXfRF/AkU4E30AcdCoUiiCCIxXxhpfmsDbksFnpbnP547lkf7CoJ+z8+bNOspOdVFTiVLggNUoDuCA1SgO4IDVKA7ggNUoDuCA1/rgB39/fXPSj/LgBnU5Hra2tqYmJCVWpVNTY2Jianp5WBwcH6uXlhR+PTnQD2u22mpmZUbVaLessOl0kmIJn8Ds5OcmhoiBuAIb05+en2tzcNDroo7m5OW5CFFED+v2+urm5UePj40ZHQoRRMTU1lcWXRsQA/I+D1dVVI3lpgbe3t3zzQYgYADBn6/W6kbC0MBq2t7e5eW+CDMCQxJzHS44TjSmYgJVEgiADACf3U8KI293d5XScCTKg2Ww6v/Cq1Wr2i6UOf+eXRvwbyyXXKRJivL6+clpOeBmAYY8NDSc0TOiozUan1WplJrgYG7Kb9DLg4+MjG4KcSJEeHh6yek9PTxTJRHdmdnY2W/o41iBtbGxQFHu8DFhZWTGSKBKGKAzzodfrGfGK5DsKvAzgxoskwdHRkdVIaDQaXNUK5yy3traMxvPSHzmS7O3tGe2w0K4PzpmOmvtI5P7+nqsFw+0MUrfb5WojcTaAG2VhKXt/f+dqwWC7rUfXMLniXIMbzAtz9e7ujquIofcQRfL5hLY2ANve8/PzkUnEAm/5w8NDoz2WK041lpeXjQZZseH2WK5Y18ActPnai82wUyWflcA6Y0wBbE/RSJEwPWKjOzpIMMcVawP+V0oDuCA1SgO4IDVKA7ggFH1E/q8gboBmZ2eHi7zRx2MxEI2KzRKusvRX2+LiIj9ijb4Fmp+fz2LBBJwVXlxc0JNhiBqAW17eni4sLDh/HuvjLY6lBVOkCDIgf1c3bI8OXV9fF97t5a+6YBbXLZIEwVFw6GnzkaS1tLTEITJOT09/PzPKTP0MpsXz8zOHciLIAJz2cmK20u8JdMLlDiAvmPD4+MhpORFkAObqycmJ1amttGBa0ZRyIcgAzfHxsZFgTEl+dosYAG5vb72Hso0QW68ykohF029yTlxK6Pz+/n7Whu9N0yDEDNBgK3x5eWn1JreVHvK+11/DEDcgz9nZWdYB/ca3lTYPv19fX5liEdUAgOSxuVlfXzeuvfUtE8p0p2HW1dUVh4lGdAP+dkoDuCA1SgO4IDVKA7ggNUoDuCA1SgO4IDWSN+AXxfi0jU1sI9sAAAAASUVORK5CYII=":xn==="AERO"?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAGo0lEQVR4XuWbeWwUVRzHF8Ha0oOi4Sw0RoP6HyCUQ0MQEqOBkNQY/4AEY4z/STwS8EqM/5giIkaDicihUI5EoGgQGg0YFFHBSAQ5Qists0dnd2Z2etCWskDn5/u9YY/5vWmb7ry94Jd8spOdmffe9/eu33v71ufLkkUiV+YZqv+IFlZiRsQPbvB77BlTU+bT9wvOolqglgpMi7Afomqglqafl2aElaWCAMnoYWUJzTfnpqv+OlrQTKNH/GtpObJuhhqYTQuWdVgZaLmyYkJBcgwtX8YsGg1W0czzBSwbLa9UY5lsopnmIZtouaWYHhYyymto+T0ZTbxQoDrSMt0l4UKC6hmWGYXR54civTHBDIWmuCRWkKAWqm9Io4kUOlTfoIYLEJrAnQDV6WrRcKCGvningNqoXsHoS/lCVBO/Sweq12FsVbeWvpArTD0I6z5aD+UV1VBaNgXKyqdy8Hv67HBg03od1Z0w+nA2MfUANOzbx0WmCqbQ99KB6uaWjc0MSrsRgvXrPoHiksmCUA46oqwKiqvrYNTMPqhcYIGUkJxppfqzWvs7tm+HktEDiy56pBFGzgIY5UJTs7cuEIfqz4oDWpovuNd22WQomfQKE20JguOMfBzgnpnABkNFSDcdHOI1VXmOPiCTSNsVUTgTfd9DmwesaRRc8STA6g0AX38HsLUBYMt+YOnJcQBqTjhAD8tJ1I0JEx91CC+tnO5a0yj43tkA73wGsO2ALdgNTRXzSAdc5CUcQG/KIBxqdYzmo+9fINR2vJa//FYUGgdrfefBW3CxuR2ihirk44WMOeDM6VOOQY0KL54D8NVeW5yb4O+PxqCzIwy93W0M1QHNywtcvKYp8+kNL+ysr0+IL3rsuEN4zQpRsC3aguYW01VwnJ4e5hCGzO6Kv1b5DFU5Qm94gTd7UuvVz7qL1vWIu+irbdBzTYPrOzaCNaEIoNIHMNZG9xgJOmDafYP9Vjdc/K2X+OgeF4/TVuqAhs376B+9rqKxhvt+awRr3CiHYIohsQVoESUmtf/jPB8XP/UZZx///XS3IJzXcv1GgHJRaAJ278biWWD+fQJ0FjnSPL0i1QHtusLFP/FiUvjuQ7ccwnsYfT/uHVh0hQ+uL1/Kazob+5FSHfDvhRAsfzvZ3O2RPCn85ool7s2bie5s2AW6FhDSzDRSHYBRWrzmTdMp3q3G+6srwDz5S1ZqeiCkOkBjKzWs+audSeHWww84hbMW0P15XU5FpyLVAcFAELq7klOZo7mz60Xl4+2osLQKamoW8VkjmoNmn4rUaRCDFC6+9Yyj1k9NnAPLVvWCqdtT2KpX3+TL4XiojJ+48/PWmvfgctN5vk9A084EqF1qIIT7dn2H9jjEHz3cBL4ZyaAIr+sP6AlnIO1GEE4cPwZvvL4Gpk2bxZ2DYEspLpnEnbPwqSVCfp7BQIgfXqI30gR3a1Kb/ZaGfj4gHvz5Gp8iv9gVZQsgiy+C4oHS6LkWfPqNeXudP3CQI2tTNBVcBshdDCmXEuJjGz4Avz/sCIa2HbAg3IZ9XuEOOXm6DVZ92AWl8ywYMeP2pgcDr6e/EIOPt5pw9lwITOYcRMjPI9JXg9GmswkH9AYu2DMBGwxRcMNP1xPOsD8tOHdRgyiv9VRxtnNwRjl/MQj7GjVYvb4TVr7bLeTnlYQD9EGa3nDAqS3RBcb4nGEvcwQOkij4v8sq7PrhJmzenwyX8XrP4RvwzzmDi7edIqdcbjg2RKRuiSlNSSewT0Nt5eJTndHVESLLWoWPH5dbVDj2ZxfsZs5Bx8QdhJ/YfYS8PODYEkOjD3gBvWuNK0p0h/6qUraMtae27i5xJXi1M8QHOZlr/aFwiJftgDjXXnvZ0RpiyxbyFV1caGd7UGgdCDqp3bADJHw2E46h+jP2wwi2BvOvX8EaOyIZH7DFz42n54IRanEsgFLF4i9FHWaQtw50kj2YiumnhdsPI2jCg5Lh8T8T3bey1l4cpQyYuPPTve59PobEu0umoLoTlqMjr3ybq6NxP/S99Dz0P1hpO2fMbdi1Nb4IYrWLhXfTYcgjtvSFfIA7yeX7dKB6BbvrD0igZWLUzTWoieoc1GgChQ7VN6Td9cfk0LQ74KAkaqC6hmUFfWQunEbTdzMh4QKB6vBkNPG8RlbNUyuEMcFznx/KosE8/stMMMN/mUm1fAqWhh3kyLK7+m9zqZaLI7aDHnnNlWVqU8XBQJsZ+WaaeqVWxjiBO9aYFk2/4IwfxlKVwf8+H8F7yhF+eClL9j+y7eB1y657sQAAAABJRU5ErkJggg==":xn==="MYX"?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAL5ElEQVR4nO3db2xV9R3H8ffvtgnX0Qc/266osU0hdPOJGRoTupEpo2aSJUUhEnyAkYypLItLfGR8NJ9sxj1zmRMFjPzZhGAitJP5YE7GEgOLMSwsUYFJLYTwp2U/lxJr0vLbg/ZCqe3pvb3nnt85535ej1ruued+H/DO75zbc881BGRt821QuA9YBr4LQyeeNoxpBZqAYsj5JCl+DIwDHPjzeAYw5gSeT8EfdW54KNRkJskXs7bVYliJpxfDSmBJkq8vmXUa748A70DhsHOXR5J64ZoHYq1thIbVGB4HswatClIVPwocwrPNueH3av1qNQvE2lYLfguGzWCW1up1pJ75AeBl/PhW59xoLV4h9kCstUVofB7DLwEb9/5FvslfAF6qRSixBmJt80ZM4UXgzjj3K1IefwHvn3Xuyt649hhLILa5tZNrfgfGrIpjfyJV8f4IBfOEuzI0UO2uCtXuwNrmTXhOKA5JDWPux/tPrG3ZVPWu5vtEa20R0/AKmJ9WO4RI7fhd+PGn53tuMq9ArG25DXgXY+6dz/NFEuX9h2A2ODd0rtKnVhyIta2dwAcYOit9rkhAAxh+VOl5SUXnILb523dh+IfikAzqxPOBbW65q5Inlb2CaOWQnDiH4YflriRlBWJt851Q0MoheTGA9993bvjCXBvOeYg18Zdxs09xSI50gnl34v92tLnPQUzDaxjzgzimEkkNw72Yxlfm2qwh6kFrmzdhCr+KbyqRVLmnWLzli9HRr47PtsGs5yDWtnZi/CdgdHm65NkIhrtnO2mPOMTyOxWH1IEmrrFjtgdnDMTa5scw5v7azSSSIoZV1rZsnPmhaSavsfoCTFvtJxNJjXP4sa7p12x9cwUxDVsUh9ShO6Hx+en/eNMKotVD6pzDs9i5IVf6h5tXEK0eUt8m7qMwxc0ryK0tX4DpSHYmkVT5HD/2XefcGExZQaxtWa04RFgCjatLv0w9xHoywDAi6WP849d/BLDWNmEaLusPgyIAfhRvbnduyE2uIA0rFYdIiSlO3hr3+iHW2nDDiKSQ971QCmSyFhGZNNmEsbalFWMuBx5HJH38tdsLQHfoOUTSqXBfAWMqusuDSP3wywp4f3foMURSqqsAuhmDyIwMnQXgjtBziKSSp62AMfqSG5GZGFoL4BWIyMyaCmAaQ08hkk6mWPUX6IjkmQIRiaBARCIoEJEICkQkggIRiaBARCIoEJEICkQkggIRiaBARCIoEJEICkQkggIRiaBARCIE/yxIR3s7/f0H6OjI1o3lR0ausn79Bo4eOxZ6lDlt2fIUL/7m16HHqNhf33+fjRuf4Ouvvw42Q/AVZPDsWXp7H2FwcDD0KBVpalrI/v376F6+PPQokRRHdYIHAoqkVhRH9Yy9tdWHHqJEh1vxWbduLTu2vx56jIqlKQ5IyQpSopUkHmvW9PLa1j+EHqNiaYsDUhYIZD+SZcu+F3SONWt62bH9dRobg7//UpE0xgEpDASyHcnet/5EV9fSIK+vOOKXykAgu5EsWtRGf9/BxCNRHLWR2kBAkZRLcdROqgMBRTIXxVFbqQ8EFMlsFEftZSIQUCTTKY5kZCYQUCQlWY3j6NGjbNq0OTNxQMYCAUWS5TgeXf8YV69eDT1KRTIXCExE8sjaR7l48VLoUSpSbSSKI3mZDATgzJkz9K55uG4iURxhZDYQgFOnTtdFJIojnEwHAtmOZN26tXNupzjCStXl7tXo6lpKf99BFi1qCz1KWQ4e7GPzz55ifHx81m16elaxZ/dOisVigpNVLy9xQA5WkJIsrSSKIztyEwhkIxLFkS25CgTSHYniyJ7cBQLpjERxZFMuA4F0RaI4sis372LNpqtraVlvp9bK1ZGrvLr1NcWRUbkPJO0UR7rl9hArC7Iax4kTJ+oiDlAgwWQ1jpMnT9VNHKBAgshyHL1rHuHSpfBvfCRFgSRMcWSLAkmQ4sgeBZIQxZFNCiQBiiO7FEiNKY5sUyA1pDiyT4HUiOLIBwVSA4ojPxRIzBRHviiQGCmO/FEgMVEc+aRAYqA48kuBVCmrcQwODiqOMiiQKmQ6jl7FUQ4FMk9Zj2Pw7NnQo2SCApkHxVE/FEiFFEd9USAVUBz1R4GUacWKFYqjDimQMnQvX87et/6oOOqQAplD9/Ll7N+/j6amhaFHqYjiiIcCiaA4RIHMQnEIKJAZKQ4pUSDTKA6ZSoFMoThkOgUySXHITBQIikNmV/eBKA6JUteBKA6ZS90GojikHHUZiOKQctVdIIpDKlFXgXR1LWXPnp2KQ8pWN4F0dS2lv+8gLS0toUepiOIIqzH0AEkoxbFoUVvoUSpSThxtbW309KxKcKob+vr6c/9lnrn/nvS8x9Hfd4DvfKcrwcluqIfvSs/1IZbiqK3u7m7e3r+XhQuzdU5XidwGojiSkfdIchmI4khWniPJXSCKI4y8RpKrQPIcx8KFC1MbR0keI8lNIFmN4+LFSzy6fsOccby9f1+q4yjJWyS5CCTLcfSueZhTp05Hbrdn9y66u5cnNFX18hRJ5gPJexwA27ZvZ2xsLIGp4pOXSDIdSD3EAXDo0F/YvPkpRRJAZgOplzhK+vr7FUkAmQxk8eLFdRVHiSJJXuYCaW9v58A7b9ddHCWKJFmZCqS9vZ0/9x+go6Mj9CgViSuOEkWSnMwEojhuluVI3nzzDRYsWBB6lLJkIhDFMbOsRvJgzyr27NmViUhSH4jiiKZIaivVgSiO8iiS2kltIIqjMoqkNlIZiOKYH0USv9QFktU4RkZGgsZRokjilapAshzH+vUbgsdRokjik5pAsh7H0WP/DD3KTRRJPBqKt3zrhdBDKI7a+OzkSYYuD/HQQz8OPUpFlixZzLJ7ltHX18/4+HjQWYIHojhq6/jxf/Hll1/yYE9P6FEqkpZIcn/jOJFqpOYcRCSNFIhIBAUiEkGBiERQICIRFIhIBAUiEkGBiERQICIRFIhIBAUiEkGBiERQICIRFIhIBAUiEqEAjIYeQiSlxgrASOgpRNLJuwLeXwk9hkgqefO/AnAh9BwiqWT8uQIwEHoOkVTyDBTAnAo9h0gqGXOiAP546DlEUsnzaQH8R6HnEEknf7Tg3JULeD4PPYpIqnh/2rnhodJf0g+HnEUkhY7AjUtN+gMOIpJC5h24EchhdMmJyCQ/CuYwTAbi3JDD+76gM4mkxyHnLo/AzVfz7g40jEi6eLaVfjSlH6y1jdDwGcYsCTOVSAp4P+Dc8OLSr9dXEOfcGNwoR6ROvTz1FzP1F2tbLXAGg010JJE08P4CjC92zl1/w+qmTxQ6N+SA3yU+mEg6vDQ1Dpi2ggBYa4vQ8B+MuSO5uUQCm2H1gBk+kz6xgX8uuclE0sA/Oz0OmGEFKbG25X2MWVXboURSwPsjzg0/MNNDEXc1MZvR59Ul9/woBfPEbI/OGohzQwP4a8/UZiiRlPD83F0ZGpjt4Yao546OfnW8WLylA2PuiX0wkeD8LueGX4jaoowbx43/Au8/jmkikXTw/kP8+NNzbTbrSfpU1rbcBuYYho7qJxMJbhDPCueGzs21YVm3HnVu+ALwAN6fr3o0kbAGMTxQThxQwb15nRsaoFDowTM4/9lEQvLnMeahqJPy6co6xJrK2tZO4O863JKMmVg5KogD5nF3d+eGBuDaCrz/sNLnigTh/cd4v7zSOGCeX3/g3JVzMN6D97vm83yR5Pg3YHzF5Hl0xSo+xJrO2uZNGPMqmGK1+xKJ0QjeP+Pc8JvV7KTqQKB0XuJ3Ysz9cexPpCre/w3M5onTgerEEkiJtc2PgXkZY9ri3K9Iefx5PM85N7wnrj1GXmpSqdHRr/5dLC74PZhh4F6MWRjn/kVm5HHAb2F8vXP/jfWqj1hXkKkmP3i1BXgWY/SWsMTP+8+BbWC2Tn4aNnY1C2Qqa1tWA09i+IlO5qVKo5P3cNsN4+9N3mykZhIJpMRa2wQNK4G1wErdYkjKMnFz9cNM3CL3cK1Wi5kkGsh01ra0At1g7gJ/N9AJ3AHGYrwF0xhyPknMKJ4R8EPAJWBg4oud/HHwHzl3JdjXBP4fQFHoFHnhJJwAAAAASUVORK5CYII=":xn==="CC"?"https://app.lighter.xyz/assets/cc-D4WHZ-w6.png":`https://app.hyperliquid.xyz/coins/${xn}.svg`;return{...vt,icon:dr}});Ft==="variational"&&ae==="ON"&&(Ct=Ct.filter(vt=>Me.includes(vt.label))),Le(Ct)}}catch(he){console.error("Failed to fetch coin list:",he)}}zt()},[t,Ft,ae]);const qe=zt=>{var he;return((he=nt==null?void 0:nt.find(it=>it.value===zt))==null?void 0:he.maxLeverage)??100},Fe=zt=>{["e","E","+","-"].includes(zt.key)&&zt.preventDefault()},at=zt=>/^\d*\.?\d{0,6}$/.test(zt),ie=zt=>/^\d*$/.test(zt),Se=m.useMemo(()=>{if(pt==="")return!1;const zt=Number(pt);return Number.isInteger(zt)&&zt>=1&&zt<=180},[pt]),$e=m.useMemo(()=>{if(wt==="")return!1;const zt=Number(wt),he=qe(dt);return Number.isInteger(zt)&&zt>=1&&zt<=he},[wt,dt,nt]),Ue=m.useMemo(()=>{if(hn==="")return!1;const zt=Number(hn);return Number.isNaN(zt)?!1:zt===0?!0:zt>=1&&zt<=1e7},[hn]),_e=m.useMemo(()=>{if(Rt==="")return!1;const zt=Number(Rt);if(Number.isNaN(zt))return!1;const he=wt===""?null:Number(wt),it=he?he*100-1:4999;return zt===0?!0:zt>0&&zt<1?!1:zt>=1&&zt<=it},[Rt,wt]);m.useMemo(()=>{if(De==="")return!1;const zt=Number(De);return!Number.isNaN(zt)&&zt>0&&zt<=100},[De]);const st=te&&be.trim()!==""&&V.trim()!==""&&Ce.trim()!==""&&dt!==""&&Se&&$e&&Be&&(!hn||Ue)&&(!Rt||_e)&&(cn==="LONG"||cn==="SHORT"||cn==="RANDOM")&&(Je==="LIMIT"||Je==="MARKET"||Je==="RANDOM")&&en,ut=te&&V.trim()!==""&&Ce.trim()!==""&&be.trim()!==""&&(Ft!=="lighter"||oe.trim()!=="")&&(Ft!=="lighter"||we.trim()!=="")&&(Ft!=="lighter"||Ie.trim()!=="")&&(Ft!=="lighter"||V.trim()!==oe.trim())&&(Ft!=="lighter"||Ce.trim()!==we.trim())&&(Ft!=="lighter"||be.trim().toLowerCase()!==Ie.trim().toLowerCase())&&dt!==""&&Se&&$e&&Be&&(Ft!=="variational"||S.trim()!=="")&&(Ft!=="variational"||!B)&&(Ft!=="variational"||!ue)&&en;m.useEffect(()=>{if(ae==="ON"&&Ft==="lighter"){if(Ce&&we&&Ce.trim()===we.trim()){kn("Make sure the wallet API indexes are unique for each Slot.");return}if(be&&Ie&&be.trim().toLowerCase()===Ie.trim().toLowerCase()){kn("Make sure both the Lighter wallet addresses are unique for each Slot.");return}if(V&&oe&&V.trim()===oe.trim()){kn("Please create an API key for each wallet.");return}kn("")}else kn("")},[ae,Ce,we,V,oe,be,Ie]);const yt=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),Mt=()=>`lighterCreds:${yt()}`,Kt=()=>{try{const zt=localStorage.getItem(Mt());if(!zt)return;const he=JSON.parse(zt);he.apiKey&&ee(he.apiKey),he.apiKeyTwo&&de(he.apiKeyTwo),he.apiKeyIndex&&me(he.apiKeyIndex),he.apiKeyIndexTwo&&xe(he.apiKeyIndexTwo),he.lighterLoginAddress&&je(he.lighterLoginAddress),he.lighterLoginAddressTwo&&Re(he.lighterLoginAddressTwo),typeof he.remember=="boolean"&&Dn(he.remember)}catch{}},un=()=>{if(Kn)try{localStorage.setItem(Mt(),JSON.stringify({apiKey:V,apiKeyIndex:Ce,lighterLoginAddress:be,remember:!0}))}catch{}},Xe=()=>{try{localStorage.removeItem(Mt())}catch{}};m.useEffect(()=>{if(!t)return;const zt=localStorage.getItem("hyperToken"),he=localStorage.getItem("hyperAddress");fe(!!(zt&&he));const it=setInterval(()=>{const Ct=localStorage.getItem("hyperToken"),vt=localStorage.getItem("hyperAddress");fe(!!(Ct&&vt))},800);return()=>clearInterval(it)},[t]),m.useEffect(()=>{!t||!te||(Pt(),Tr())},[t,te]),m.useEffect(()=>{t&&(Rt===""&&ot(Ae),hn===""&&Yt(Ae),De===""&&At(Ae))},[t]),m.useEffect(()=>{if(!dt)return;const zt=qe(dt),he=Number(wt);!Number.isNaN(he)&&he>zt&&nn(String(zt)),!Number.isNaN(he)&&he<1&&wt!==""&&nn("1")},[dt]),m.useEffect(()=>{t&&(Kn&&un(),Kn||Xe())},[V,Ce,be,Qe,Kn,t]);async function Pt(){var zt,he,it,Ct,vt,ln,xn,dr,Er,pr,fr,Yr,is,Ir,yr,Jn;try{Lt(!0),kn("");const gs=window.localStorage.getItem("hyperToken"),Zs=window.localStorage.getItem("hyperAddress");if(!gs||!Zs){se(!1),Kt();return}const Fr=await(await fetch(`${ge}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Zs.toLowerCase(),token:gs})})).json();if(!(Fr!=null&&Fr.success)){if(console.warn("INFO API RESPONSE:",Fr==null?void 0:Fr.error_message),(Fr==null?void 0:Fr.error_message)==="You have not a running process"){const wn=Be?Be.toLowerCase().replace("-","_"):null,On=L==null?void 0:L[wn];if(wn&&On){const lt={...L,[wn]:{...On,isStop:!0}};z(lt);const nr=Object.keys(lt).filter(Wn=>Wn.startsWith("lighter"));if(nr.length>0&&!Be){const Pr=nr.sort((ts,Ls)=>{var Hn,Vr;const Et=parseInt(((Hn=ts.match(/\d+/))==null?void 0:Hn[0])||0,10),or=parseInt(((Vr=Ls.match(/\d+/))==null?void 0:Vr[0])||0,10);return Et-or})[0].match(/\d+/);Pr&&ht(`Lighter-${Pr[0]}`)}}else ht("Lighter-1")}Fr!=null&&Fr.slots_info&&(P((he=(zt=Fr==null?void 0:Fr.slots_info)==null?void 0:zt.lighter)==null?void 0:he.total_qty),C((Ct=(it=Fr==null?void 0:Fr.slots_info)==null?void 0:it.lighter)==null?void 0:Ct.active_qty),$((ln=(vt=Fr==null?void 0:Fr.slots_info)==null?void 0:vt.variational)==null?void 0:ln.total_qty),M((dr=(xn=Fr==null?void 0:Fr.slots_info)==null?void 0:xn.variational)==null?void 0:dr.active_qty));return}if(Fr!=null&&Fr.success&&(Fr!=null&&Fr.data)){const wn=Be?Be.toLowerCase().replace("-","_"):null,On=L==null?void 0:L[wn],lt=Fr.data||{};wn&&!lt[wn]&&On&&(lt[wn]={...On,isStop:!0}),z(lt);const nr=Object.keys(lt).filter(Wn=>Wn.startsWith("lighter"));if(nr.length>0&&!Be){const Pr=nr.sort((ts,Ls)=>{var Hn,Vr;const Et=parseInt(((Hn=ts.match(/\d+/))==null?void 0:Hn[0])||0,10),or=parseInt(((Vr=Ls.match(/\d+/))==null?void 0:Vr[0])||0,10);return Et-or})[0].match(/\d+/);Pr&&ht(`Lighter-${Pr[0]}`)}Fr!=null&&Fr.slots_info&&(P((pr=(Er=Fr==null?void 0:Fr.slots_info)==null?void 0:Er.lighter)==null?void 0:pr.total_qty),C((Yr=(fr=Fr==null?void 0:Fr.slots_info)==null?void 0:fr.lighter)==null?void 0:Yr.active_qty),$((Ir=(is=Fr==null?void 0:Fr.slots_info)==null?void 0:is.variational)==null?void 0:Ir.total_qty),M((Jn=(yr=Fr==null?void 0:Fr.slots_info)==null?void 0:yr.variational)==null?void 0:Jn.active_qty))}}catch{se(!1),Kt(),W("OFF"),K(!1)}finally{Lt(!1)}}const Wt=m.useMemo(()=>Be?Be.toLowerCase().replace("-","_"):"",[Be]),ct=!!((es=L==null?void 0:L[Wt])!=null&&es.delta)&&!!((Ys=L==null?void 0:L[Wt])!=null&&Ys.from_slot),Ge=ct?`lighter_${(_s=L==null?void 0:L[Wt])==null?void 0:_s.from_slot}`:Wt;m.useEffect(()=>{var it,Ct,vt,ln,xn,dr,Er,pr,fr,Yr,is,Ir,yr,Jn,gs,Zs,oi,Fr,wn,On;if(!Be||!L)return;const zt=Ge,he=L==null?void 0:L[zt];if(!he){ee(""),de(""),me(""),xe(""),je(""),Re(""),tt(""),Gt(""),nn(""),Un("LONG"),It("MARKET"),se(!1),W("OFF"),K(!1),qt("Hour"),Yt(""),ot(""),_(""),En("lighter"),I(null);return}if(he!=null&&he.farming_params){he!=null&&he.isStop?se(!1):se(!0),W("OFF"),K(!1);const lt=he.farming_params,Bt=(he==null?void 0:he.lighter_api_pkey)??"",nr=(he==null?void 0:he.lighter_login_address)??"",Wn=(he==null?void 0:he.lighter_api_index)??"",Or=(he==null?void 0:he.slot_number)??"";Bt&&ee(String(Bt)),nr&&je(String(nr)),Wn&&me(String(Wn)),Or&&!ct&&ht(`Lighter-${Or}`),lt!=null&<.cycleSeconds&&qt((lt==null?void 0:lt.cycleSeconds)===86400?"Day":"Hour"),lt!=null&<.coin&&tt(String(lt.coin)),(lt==null?void 0:lt.orderPerHour)!=null&&Gt(String(lt.orderPerHour)),(lt==null?void 0:lt.leverage)!=null&&nn(String(lt.leverage)),lt!=null&<.direction&&Un(String(lt.direction).toUpperCase()==="SHORT"?"SHORT":String(lt.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),lt!=null&<.orderType&&It(String(lt.orderType).toUpperCase()==="MARKET"?"MARKET":String(lt.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),lt!=null&<.accountType&&Zn(lt.accountType==="standart"?1:2),lt!=null&<.accountType&&an(lt.accountType==="standart"?"STANDARD":"PREMIUM"),(lt==null?void 0:lt.tp)!=null&&Yt(String(lt.tp)),(lt==null?void 0:lt.sl)!=null&&ot(String(lt.sl)),(lt==null?void 0:lt.spread)!=null&&At(String(lt.spread))}else if(he!=null&&he.source_params){he!=null&&he.isStop?se(!1):se(!0),W("ON"),K(!1);const lt=((it=he==null?void 0:he.source_params)==null?void 0:it.api_pkey)??"",Bt=((Ct=he==null?void 0:he.source_params)==null?void 0:Ct.login_wallet)??"",nr=((vt=he==null?void 0:he.source_params)==null?void 0:vt.api_index)??"",Wn=((ln=he==null?void 0:he.target_params)==null?void 0:ln.api_pkey)??"",Or=((xn=he==null?void 0:he.target_params)==null?void 0:xn.login_wallet)??"",Pr=((dr=he==null?void 0:he.target_params)==null?void 0:dr.api_index)??"",ts=(he==null?void 0:he.slot_number)??"";ts&&!ct&&ht(`Lighter-${ts}`),lt&&ee(String(lt)),Wn&&de(String(Wn)),Bt&&je(String(Bt)),Or&&Re(String(Or)),nr&&me(String(nr)),Pr&&xe(String(Pr)),(Er=he==null?void 0:he.source_params)!=null&&Er.coin&&tt(String((pr=he==null?void 0:he.source_params)==null?void 0:pr.coin)),((fr=he==null?void 0:he.source_params)==null?void 0:fr.orderPerHour)!=null&&Gt(String((Yr=he==null?void 0:he.source_params)==null?void 0:Yr.orderPerHour)),((is=he==null?void 0:he.source_params)==null?void 0:is.leverage)!=null&&nn(String((Ir=he==null?void 0:he.source_params)==null?void 0:Ir.leverage)),(yr=he==null?void 0:he.source_params)!=null&&yr.accountType&&Zn(((Jn=he==null?void 0:he.source_params)==null?void 0:Jn.accountType)==="standart"?1:2),(gs=he==null?void 0:he.source_params)!=null&&gs.accountType&&an(((Zs=he==null?void 0:he.source_params)==null?void 0:Zs.accountType)==="standart"?"STANDARD":"PREMIUM"),(oi=he==null?void 0:he.target_params)!=null&&oi.accountType&&Ye(((Fr=he==null?void 0:he.target_params)==null?void 0:Fr.accountType)==="standart"?"STANDARD":"PREMIUM"),he!=null&&he.target_app&&En((he==null?void 0:he.target_app)==="lighter"?"lighter":"variational"),(wn=he==null?void 0:he.target_params)!=null&&wn.vr_token&&_((On=he==null?void 0:he.target_params)==null?void 0:On.vr_token)}else se(!1),W("OFF"),K(!1)},[Be,L,ct,Ge]);const Tt=zt=>{var he;return Number(((he=String(zt||"").match(/\d+/))==null?void 0:he[0])||0)},fn=zt=>(zt||"").toLowerCase().replace("-","_"),Yn=m.useMemo(()=>{const zt=L==null?void 0:L[fn(Be)];if(zt!=null&&zt.delta&&(zt!=null&&zt.from_slot))return Number(zt.from_slot);const he=Number(zt==null?void 0:zt.slot_number);return Number.isFinite(he)?he:Tt(Be)},[Be,L]),Fn=m.useMemo(()=>{const zt=Number(g)||0,he=Array.from({length:zt},()=>({used:!1,kind:null})),it=L||{};for(const[Ct,vt]of Object.entries(it)){if(!Ct.startsWith("lighter_"))continue;const ln=Tt(Ct)-1;ln<0||ln>=zt||((vt==null?void 0:vt.isStop)===!0?he[ln]={used:!1,kind:null}:vt!=null&&vt.source_params?he[ln]={used:!0,kind:"delta-src"}:vt!=null&&vt.target_params||vt!=null&&vt.delta?he[ln]={used:!0,kind:"delta-shadow"}:vt!=null&&vt.farming_params?he[ln]={used:!0,kind:"single"}:he[ln]={used:!0,kind:"unknown"})}return he},[L,g]),Gn=m.useMemo(()=>Fn.map((zt,he)=>zt.used&&zt.kind!=="delta-src-inferred"?`Lighter-${he+1}`:null).filter(Boolean),[Fn]);m.useMemo(()=>Fn.filter(zt=>!zt.used).length,[Fn]);async function Sr(){if(!te){n(!0);return}if(st)try{dn(!0),kn("");const zt=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!zt||!he){n(!0);return}const it={coin:dt,orderPerHour:Number(pt),leverage:Number(wt),direction:cn,orderType:Je,tp:Number(hn),sl:Number(Rt),cycleSeconds:hr==="Hour"?3600:86400},Ct={address:he.toLowerCase(),token:zt,api_pkey:V,api_index:Number(Ce),login_wallet:be,slot_number:Number(Be==null?void 0:Be.replace("Lighter-","")),farming_params:it},ln=await(await fetch(`${ge}/api/hyper/lighter_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ct)})).json();ln!=null&&ln.success?(se(!0),Pt(),Kn&&un()):kn((ln==null?void 0:ln.error_message)||"Start failed.")}catch(zt){kn(zt.message||"An error occurred while saving.")}finally{dn(!1)}}async function ur(){var he;const zt=Tt(Be)-1;if(zt<0){kn("Please select a slot."),dn(!1);return}if((he=Fn[zt])!=null&&he.used){kn("Selected slot is already in use."),dn(!1);return}if(!te){n(!0);return}if(ut)try{dn(!0),kn("");const it=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!it||!Ct){n(!0);return}const vt={api_pkey:V,api_index:Ce,login_wallet:be,coin:dt,orderPerHour:Number(pt),leverage:Number(wt)},ln={...Ft==="lighter"&&{api_pkey:oe,api_index:we,login_wallet:Ie},coin:dt==null?void 0:dt.replace("USDT",""),orderPerHour:Number(pt),leverage:Number(wt),...Ft==="variational"&&{vr_token:S}},xn={address:Ct.toLowerCase(),token:it,slot_number:Number(Be==null?void 0:Be.replace("Lighter-","")),source_app:"lighter",source_params:vt,target_app:Ft==="lighter"?"lighter":"variational_delta",target_params:ln},Er=await(await fetch(`${ge}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xn)})).json();Er!=null&&Er.success?(se(!0),Pt(),Kn&&un()):kn((Er==null?void 0:Er.error_message)||fallback)}catch(it){kn(it.message||"An error occurred while saving.")}finally{dn(!1)}}async function kr(){if(!te){n(!0);return}try{gn(!0),kn("");const zt=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!zt||!he){n(!0);return}const Ct=await(await fetch(`${ge}/api/hyper/lighter_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:he.toLowerCase(),token:zt,slot_number:Yn})})).json();Ct!=null&&Ct.success?(se(!1),Pt()):kn((Ct==null?void 0:Ct.error_message)||"Stop failed.")}catch(zt){kn(zt.message||"An error occurred while stopping.")}finally{gn(!1)}}async function Bn(){if(!te){n(!0);return}try{gn(!0),kn("");const zt=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!zt||!he){n(!0);return}const Ct=await(await fetch(`${ge}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:he.toLowerCase(),token:zt,source_app:"lighter",target_app:Ft==="lighter"?"lighter":"variational_delta",slot_number:Yn})})).json();Ct!=null&&Ct.success?(se(!1),Pt()):kn((Ct==null?void 0:Ct.error_message)||"Stop failed.")}catch(zt){kn(zt.message||"An error occurred while stopping.")}finally{gn(!1)}}const Sn=zt=>{En(zt??"lighter"),h(!1)},Mn=[{value:"lighter",label:"Lighter"},{value:"variational",label:"Variational"}];function rr(zt){try{const he=zt.split(".");if(he.length!==3)throw new Error("Invalid JWT format");const Ct=he[1].replace(/-/g,"+").replace(/_/g,"/"),vt=decodeURIComponent(atob(Ct).split("").map(ln=>"%"+("00"+ln.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(vt)}catch{return null}}const ls={control:(zt,he)=>({...zt,backgroundColor:"#242424",borderColor:he.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:zt=>({...zt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:zt=>({...zt,height:32}),input:zt=>({...zt,color:"#FFFFFF",margin:0,padding:0}),singleValue:zt=>({...zt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:zt=>({...zt,color:"#7F7F7F",fontSize:"12px"}),menu:zt=>({...zt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:zt=>({...zt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(zt,he)=>({...zt,backgroundColor:he.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:zt=>({...zt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:zt=>({...zt,backgroundColor:"#353535"})},cs=({max:zt})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[zt,"x"]}),et=zt=>{var he,it,Ct;return i.jsx(Sa.Option,{...zt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(he=zt.data)!=null&&he.icon?i.jsx("img",{src:zt.data.icon,alt:zt.data.label,className:`${((it=zt.data)==null?void 0:it.label)==="XRP"||((Ct=zt.data)==null?void 0:Ct.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:vt=>vt.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:zt.data.label}),i.jsx(cs,{max:zt.data.maxLeverage})]})})},gt=zt=>{var he,it,Ct;return i.jsx(Sa.SingleValue,{...zt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(he=zt.data)!=null&&he.icon?i.jsx("img",{src:zt.data.icon,alt:zt.data.label,className:`${((it=zt.data)==null?void 0:it.label)==="XRP"||((Ct=zt.data)==null?void 0:Ct.label)==="MEGA"?"bg-[#4F4F4F] rounded-full":""} w-4 h-4 rounded-[4px]`,onError:vt=>vt.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:zt.data.label}),i.jsx(cs,{max:zt.data.maxLeverage})]})})},Tn=zt=>{const he=Gn.includes(zt.data.value);return i.jsx(Sa.Option,{...zt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:zt.data.label}),he&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},sr=zt=>i.jsx(Sa.SingleValue,{...zt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:zt.data.label})})}),Tr=async()=>{var it,Ct,vt,ln,xn,dr,Er,pr;const zt=window.localStorage.getItem("hyperToken"),he=window.localStorage.getItem("hyperAddress");if(!(!zt||!he))try{rt(!0);const fr=await ki(he.toLowerCase(),zt);fr!=null&&fr.success?(r(fr==null?void 0:fr.telegram_chat_id),s(fr==null?void 0:fr.subscriber_role),a(fr==null?void 0:fr.subs_expire_day),o((it=fr==null?void 0:fr.mushboomer_counts)==null?void 0:it.eth),l((Ct=fr==null?void 0:fr.mushboomer_counts)==null?void 0:Ct.sol),c(fr==null?void 0:fr.referral_code),u(fr==null?void 0:fr.refcode),d(fr==null?void 0:fr.whitelist),f(zt),x(he),Pn(!0),y((ln=(vt=fr==null?void 0:fr.slots_info)==null?void 0:vt.lighter)==null?void 0:ln.total_qty),P((dr=(xn=fr==null?void 0:fr.slots_info)==null?void 0:xn.lighter)==null?void 0:dr.total_qty),C((pr=(Er=fr==null?void 0:fr.slots_info)==null?void 0:Er.lighter)==null?void 0:pr.active_qty),rt(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),rt(!1))}catch(fr){console.error("Token verification error:",fr),console.error(fr.message||"An unknown error occurred."),rt(!1)}},Lr=nt,$r=m.useMemo(()=>Array.from({length:g},(zt,he)=>({value:`Lighter-${he+1}`,label:`Lighter-${he+1}`})),[g]);if(!t)return null;const lr=mt||kt||rn||ze,wr=q&&!rn,ss=qe(dt),mr=T===F;return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:jt,setOpen:Qn,transactionHash:bn,transactionLoading:Zt,paymentPresaleRole:en,errorFunds:yn,activeMethod:2}),i.jsx(O5,{open:tr,setOpen:ar,paymentLighterRole:en,oldSlotCount:X,checkAccountLighter:Tr,tradeMarket:"lighter"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!lr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"lighter",onCloseCurrent:()=>!lr&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx(bf,{className:"w-6 h-6 text-[#fff]"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#fff]",children:"Lighter"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] mt-[1px]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Lighter Farming module lets you set up automated farming by providing your API Key, selecting a pair, defining orders per hour, leverage, direction, and TP/SL/Spread percentages."}),i.jsxs("div",{className:"flex flex-col items- justify-start gap-1 relative",children:[i.jsx("div",{className:"absolute -top-12 right-0 text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/lighter-farming-module","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})}),i.jsxs("div",{onClick:()=>window.open("https://youtu.be/_TxVAzKU5LE","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(IT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]})]})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[An&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:An==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:An}),i.jsx("button",{onClick:()=>{window.open("#variational-farming","_self")},className:"bg-[#67FFBD]/10 text-[#67FFBD] border border-[#67FFBD]/30 hover:bg-[#67FFBD]/20 text-[11px] px-2 py-[3px] rounded-md transition-colors ml-4",children:"Variational Farming"})]}):i.jsx("span",{children:An})}),te&&en&&N===v&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`No free Lighter slots. All ${($r==null?void 0:$r.length)||N} in use.`}),te&&mr&&Ft==="variational"&&!q&&ae==="ON"&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:'"No Variational slots available. Purchase Variational slot."'}),i.jsx("button",{onClick:()=>{window.open("#variational-farming","_self"),e(!1)},className:"bg-[#67FFBD]/10 text-[#67FFBD] border border-[#67FFBD]/30 hover:bg-[#67FFBD]/20 text-[11px] px-2 py-[3px] rounded-md transition-colors ml-4",children:"Variational Farming"})]})}),J&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:"You cannot use this area because the delta socket is active in another slot."}),te&&en&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-4 sm:px-5",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[v||0,"/",$r.length]})]})]}),i.jsx(jl,{styles:ls,components:{Option:Tn,SingleValue:sr},options:$r,value:$r.find(zt=>zt.value===Be)||null,onChange:zt=>ht((zt==null?void 0:zt.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:"py-1 space-y-3 px-3 sm:px-5",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"}),i.jsx("span",{className:"rounded-md w-max text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] bg-[#353535] px-2 h-6 flex items-center",children:"Lighter"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Lighter Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:zt=>je(zt.target.value),autoComplete:"off",placeholder:"1st Lighter Wallet Address ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:zt=>ee(zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:Xn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr}),i.jsx("button",{type:"button",onClick:()=>Nn(zt=>!zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:lr||wr,children:Xn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return me("");ie(he)&&me(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Lighter Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:zt=>je(zt.target.value),autoComplete:"off",placeholder:"Lighter Wallet Address ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:zt=>ee(zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:Xn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr}),i.jsx("button",{type:"button",onClick:()=>Nn(zt=>!zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:lr||wr,children:Xn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"}),i.jsx("div",{children:i.jsxs("div",{ref:p,className:"relative w-[120px]",children:[i.jsxs("div",{className:`${lr||wr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:zt=>{zt.preventDefault(),lr||wr||h(!Ee)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(br=Mn==null?void 0:Mn.find(zt=>(zt==null?void 0:zt.value)===Ft))==null?void 0:br.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${Ee?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),Ee&&i.jsx("div",{className:"absolute z-10 mt-1 w-full bg-[#353535] rounded-md shadow-lg overflow-hidden p-1",children:i.jsx("div",{className:"flex flex-col gap-[2px] max-h-[170px] overflow-y-auto",children:Mn==null?void 0:Mn.map((zt,he)=>i.jsxs("div",{onClick:it=>{it.preventDefault(),lr||wr||Sn(zt==null?void 0:zt.value)},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] min-w-max gap-1 ${(zt==null?void 0:zt.value)===Ft?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${lr||wr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:zt==null?void 0:zt.label}),(zt==null?void 0:zt.value)===Ft&&i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-[#1de674]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},he))})})]})})]}),Ft==="lighter"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Lighter Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ie,onChange:zt=>Re(zt.target.value),autoComplete:"off",placeholder:"2nd Lighter Wallet Address",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ie===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/lighter-farming-module",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:zt=>de(zt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:on?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr}),i.jsx("button",{type:"button",onClick:()=>Oe(zt=>!zt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:lr||wr,children:on?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index 2"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:we,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return xe("");ie(he)&&xe(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX_2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]})]}),Ft==="variational"&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Variational Token"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Variational Token?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:S,onChange:zt=>{const he=zt.target.value;if(_(he),!he.trim()){I(null),G("");return}const it=rr(he);if(it&&(it!=null&&it.exp)){const Ct=new Date((it==null?void 0:it.exp)*1e3);I(Ct),G("")}else it?(I(null),G("The token's expiration date could not be found.")):(I(null),G("Invalid token format."))},type:re?"text":"password",autoComplete:"off",placeholder:"Variational_Token",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${S===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr}),k&&i.jsxs("div",{className:"text-[12px] mt-1 pl-[3px] flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-[#CECECE] font-medium",children:"Valid Until:"})," ",i.jsx("span",{className:"text-[11px] font-semibold "+(ue?"text-[#FF797C]":"text-[#F8D4AB]"),children:k==null?void 0:k.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),ue&&i.jsx("span",{children:i.jsx("img",{src:rc,alt:"",className:"w-3.5 h-3.5"})})]}),B&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:B}),i.jsx("button",{type:"button",onClick:()=>ce(zt=>!zt),className:"absolute right-1 top-4 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:lr||wr,children:re?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return me("");ie(he)&&me(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:lr||wr})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:ls,components:{Option:et,SingleValue:gt},isDisabled:lr||wr,options:Lr,value:Lr.find(zt=>zt.value===dt)||null,onChange:zt=>tt((zt==null?void 0:zt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:pt,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return Gt("");ie(he)&&Gt(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${pt===""?"border-[#353535]":Se?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:lr||wr}),pt!==""&&!Se&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:hr,onChange:zt=>qt(zt.target.value),className:`${lr||wr?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:lr||wr,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:pt,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return Gt("");ie(he)&&Gt(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${pt===""?"border-[#353535]":Se?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:lr||wr}),pt!==""&&!Se&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]}),i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral (Requires 2 slots to work)"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Io,{checked:ae==="ON",onChange:zt=>W(zt?"ON":"OFF"),disabled:lr||wr,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${lr||wr?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:wt,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return nn("");ie(he)&&nn(he)},onKeyDown:Fe,inputMode:"numeric",autoComplete:"off",placeholder:dt?`1–${ss}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${wt===""?"border-[#353535]":$e?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:lr||wr})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":cn==="LONG",onClick:()=>!wr&&Un("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",lr||wr?"cursor-not-allowed":"cursor-pointer",cn==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",wt?` - ${wt}x`:""]})}),i.jsx("div",{"aria-pressed":cn==="SHORT",onClick:()=>!wr&&Un("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",lr||wr?"cursor-not-allowed":"cursor-pointer",cn==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",wt?` - ${wt}x`:""]})}),i.jsx("div",{"aria-pressed":cn==="RANDOM",onClick:()=>!wr&&Un("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",lr||wr?"cursor-not-allowed":"cursor-pointer",cn==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",wt?` - ${wt}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":Je==="MARKET",onClick:()=>!wr&&It("MARKET"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",lr||wr?"cursor-not-allowed":"cursor-pointer",Je==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",Je==="MARKET"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Je==="LIMIT",onClick:()=>!wr&&It("LIMIT"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",lr||wr?"cursor-not-allowed":"cursor-pointer",Je==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",Je==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":Je==="RANDOM",onClick:()=>!wr&&It("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",lr||wr?"cursor-not-allowed":"cursor-pointer",Je==="RANDOM"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["RANDOM ",Je==="RANDOM"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:hn,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return Yt("");at(he)&&Yt(he)},onKeyDown:Fe,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${hn===""?"border-[#353535]":Ue?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:lr||wr})]}),hn!==""&&!Ue&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:Rt,onChange:zt=>{const he=zt.target.value.trim();if(he==="")return ot("");at(he)&&ot(he)},onKeyDown:Fe,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Rt===""?"border-[#353535]":_e?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:lr||wr})]}),Rt!==""&&!_e&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",wt?Math.max(wt*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),i.jsx("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Io,{checked:ae==="ON",onChange:zt=>W(zt?"ON":"OFF"),disabled:lr||wr,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${lr||wr?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]})}),!1]}),i.jsx("div",{className:"py-3 flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl",children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!lr&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:lr,children:"Cancel"}),te?ae==="ON"?q?i.jsx("button",{onClick:Bn,disabled:lr,className:`${J?"hidden":""} inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60`,children:rn?"Stopping...":"Stop"}):i.jsx("button",{onClick:ur,disabled:!ut||lr||Ft==="variational"&&mr&&ae==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!ut||lr||Ft==="variational"&&mr&&ae==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${J?"hidden":""}`,children:kt?"Starting...":"Start"}):q?i.jsx("button",{onClick:kr,disabled:lr,className:`${J?"hidden":""} inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60`,children:rn?"Stopping...":"Stop"}):i.jsx("button",{onClick:Sr,disabled:!st||lr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!st||lr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"} ${J?"hidden":""}`,children:kt?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),mt&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},vce=({open:t=!1,setOpen:e=()=>{}})=>{const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr);ns();const[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(""),[T,M]=m.useState(""),[F,$]=m.useState(""),[L,z]=m.useState(""),[X,ne]=m.useState(""),[J,K]=m.useState(""),[te,fe]=m.useState(""),[q,se]=m.useState("LONG"),[ae,W]=m.useState(!1),[V,ee]=m.useState(!1),[oe,de]=m.useState(!1),[Ce,me]=m.useState(!1),[we,xe]=m.useState(""),[be,je]=m.useState(""),[Ie,Re]=m.useState(!0),[Qe,Ke]=m.useState(!1),[dt,tt]=m.useState(!1),[nt,Le]=m.useState(!1),[Be,ht]=m.useState(!1),[pt,Gt]=m.useState(!1),[wt,nn]=m.useState(!1),[cn,Un]=m.useState(""),[Xt,an]=m.useState(!0);m.useState(1);const Jt="https://dextrabothypev2.nftinit.io",Ye=m.useMemo(()=>[{value:"BTC-USDT",label:"BTCUSDT",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:100},{value:"ETH-USDT",label:"ETHUSDT",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:100},{value:"APEX-USDT",label:"APEXUSDT",icon:"https://app.hyperliquid.xyz/coins/APEX.svg",maxLeverage:50},{value:"ASTER-USDT",label:"ASTERUSDT",icon:"https://static.astherus.finance/image/admin_mgs_image_upload/20250916/6dba1412-ddfb-4314-bfdf-87fa11f2daa6.png",maxLeverage:50},{value:"SOL-USDT",label:"SOLUSDT",icon:"https://app.hyperliquid.xyz/coins/SOL.svg",maxLeverage:50},{value:"HYPE-USDT",label:"HYPEUSDT",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",maxLeverage:50}],[]),Je=Nn=>{var on;return((on=Ye.find(Oe=>Oe.value===Nn))==null?void 0:on.maxLeverage)??100},It=Nn=>{["e","E","+","-"].includes(Nn.key)&&Nn.preventDefault()},hn=Nn=>/^\d*$/.test(Nn),Yt=m.useMemo(()=>{if(J==="")return!1;const Nn=Number(J);return Number.isInteger(Nn)&&Nn>=1&&Nn<=100},[J]),Rt=m.useMemo(()=>{if(te==="")return!1;const Nn=Number(te),on=Je(X);return Number.isInteger(Nn)&&Nn>=1&&Nn<=on},[te,X]),ot=g&&N.trim()!==""&&F.trim()!==""&&T.trim()!==""&&L.trim()!==""&&X!==""&&Yt&&Rt&&(q==="LONG"||q==="SHORT"||q==="RANDOM"),De=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),At=()=>`apexCreds:${De()}`,ze=()=>{try{const Nn=localStorage.getItem(At());if(!Nn)return;const on=JSON.parse(Nn);on.apiKey&&P(on.apiKey),on.apiKeySecret&&M(on.apiKeySecret),on.omniKeySeed&&z(on.omniKeySeed),on.apiKeyPass&&$(on.apiKeyPass),typeof on.remember=="boolean"&&Re(on.remember)}catch{}},rt=()=>{if(Ie)try{localStorage.setItem(At(),JSON.stringify({apiKey:N,apiKeyPass:F,apiKeySecret:T,omniKeySeed:L,remember:!0}))}catch{}},mt=()=>{try{localStorage.removeItem(At())}catch{}};m.useEffect(()=>{if(!t)return;const Nn=localStorage.getItem("hyperToken"),on=localStorage.getItem("hyperAddress");y(!!(Nn&&on));const Oe=setInterval(()=>{const Zt=localStorage.getItem("hyperToken"),sn=localStorage.getItem("hyperAddress");y(!!(Zt&&sn))},800);return()=>clearInterval(Oe)},[t]),m.useEffect(()=>{!t||!g||(Lt(),yn())},[t,g]),m.useEffect(()=>{if(!X)return;const Nn=Je(X),on=Number(te);!Number.isNaN(on)&&on>Nn&&fe(String(Nn)),!Number.isNaN(on)&&on<1&&te!==""&&fe("1")},[X]),m.useEffect(()=>{t&&(Ie&&rt(),Ie||mt())},[N,F,T,L,Ie,t]);async function Lt(){var Nn,on,Oe,Zt,sn;try{ee(!0),xe("");const jt=window.localStorage.getItem("hyperToken"),Qn=window.localStorage.getItem("hyperAddress");if(!jt||!Qn){C(!1),ze();return}const Dt=await(await fetch(`${Jt}/api/hyper/apex_farming/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Qn.toLowerCase(),token:jt})})).json(),en=(Nn=Dt==null?void 0:Dt.data)==null?void 0:Nn.farming_params;if(Dt!=null&&Dt.success&&en){C(!0);const Pn=((on=Dt==null?void 0:Dt.data)==null?void 0:on.apex_api_pkey)??"",tr=((Oe=Dt==null?void 0:Dt.data)==null?void 0:Oe.apex_api_pass)??"",ar=((Zt=Dt==null?void 0:Dt.data)==null?void 0:Zt.apex_api_secret)??"",hr=((sn=Dt==null?void 0:Dt.data)==null?void 0:sn.apex_key_seed)??"";Pn&&P(String(Pn)),tr&&$(String(tr)),ar&&M(String(ar)),hr&&z(String(hr)),en!=null&&en.symbol&&ne(String(en.symbol)),(en==null?void 0:en.orderPerHour)!=null&&K(String(en.orderPerHour)),(en==null?void 0:en.leverage)!=null&&fe(String(en.leverage)),en!=null&&en.direction&&se(String(en.direction).toUpperCase()==="SHORT"?"SHORT":String(en.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG")}else C(!1);!N&&!F&&!T&&!L&&ze()}catch{C(!1),ze()}finally{ee(!1)}}async function kt(){if(!g){n(!0);return}if(ot)try{de(!0),xe("");const Nn=window.localStorage.getItem("hyperToken"),on=window.localStorage.getItem("hyperAddress");if(!Nn||!on){n(!0);return}const Oe={symbol:X,orderPerHour:Number(J),leverage:Number(te),direction:q},Zt={address:on.toLowerCase(),token:Nn,apex_api_pkey:N,apex_api_secret:T,apex_api_pass:F,apex_key_seed:L,farming_params:Oe},jt=await(await fetch(`${Jt}/api/hyper/apex_farming/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Zt)})).json();jt!=null&&jt.success?(C(!0),Ie&&rt()):xe((jt==null?void 0:jt.error_message)||"Start failed.")}catch(Nn){xe(Nn.message||"An error occurred while saving.")}finally{de(!1)}}async function dn(){if(!g){n(!0);return}try{me(!0),xe("");const Nn=window.localStorage.getItem("hyperToken"),on=window.localStorage.getItem("hyperAddress");if(!Nn||!on){n(!0);return}const Zt=await(await fetch(`${Jt}/api/hyper/apex_farming/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:on.toLowerCase(),token:Nn})})).json();Zt!=null&&Zt.success?C(!1):xe((Zt==null?void 0:Zt.error_message)||"Stop failed.")}catch(Nn){xe(Nn.message||"An error occurred while stopping.")}finally{me(!1)}}const rn={control:(Nn,on)=>({...Nn,backgroundColor:"#242424",borderColor:on.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:Nn=>({...Nn,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Nn=>({...Nn,height:32}),input:Nn=>({...Nn,color:"#FFFFFF",margin:0,padding:0}),singleValue:Nn=>({...Nn,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Nn=>({...Nn,color:"#7F7F7F",fontSize:"12px"}),menu:Nn=>({...Nn,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Nn=>({...Nn,paddingTop:0,paddingBottom:0}),option:(Nn,on)=>({...Nn,backgroundColor:on.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Nn=>({...Nn,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Nn=>({...Nn,backgroundColor:"#353535"})},gn=({max:Nn})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[Nn,"x"]}),An=Nn=>{var on;return i.jsx(Sa.Option,{...Nn,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[((on=Nn.data)==null?void 0:on.icon)&&i.jsx("img",{src:Nn.data.icon,alt:Nn.data.label,className:"w-4 h-4 rounded-[4px]",onError:Oe=>Oe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:Nn.data.label}),i.jsx(gn,{max:Nn.data.maxLeverage})]})})},kn=Nn=>{var on;return i.jsx(Sa.SingleValue,{...Nn,children:i.jsxs("div",{className:"flex items-center gap-2",children:[((on=Nn.data)==null?void 0:on.icon)&&i.jsx("img",{src:Nn.data.icon,alt:Nn.data.label,className:"w-4 h-4 rounded-[4px]",onError:Oe=>Oe.currentTarget.style.display="none"}),i.jsx("span",{className:"text-white text-[13px]",children:Nn.data.label}),i.jsx(gn,{max:Nn.data.maxLeverage})]})})},yn=async()=>{var Oe,Zt;const Nn=window.localStorage.getItem("hyperToken"),on=window.localStorage.getItem("hyperAddress");if(!(!Nn||!on))try{W(!0);const sn=await ki(on.toLowerCase(),Nn);sn!=null&&sn.success?(r(sn==null?void 0:sn.telegram_chat_id),s(sn==null?void 0:sn.subscriber_role),a(sn==null?void 0:sn.subs_expire_day),o((Oe=sn==null?void 0:sn.mushboomer_counts)==null?void 0:Oe.eth),l((Zt=sn==null?void 0:sn.mushboomer_counts)==null?void 0:Zt.sol),c(sn==null?void 0:sn.referral_code),u(sn==null?void 0:sn.refcode),d(sn==null?void 0:sn.whitelist),f(Nn),x(on),an(!0),W(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),W(!1))}catch(sn){console.error("Token verification error:",sn),console.error(sn.message||"An unknown error occurred."),W(!1)}},Vn=Ye;if(!t)return null;const Kn=V||oe||Ce||ae,Dn=v&&!Ce,Xn=Je(X);return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:wt,setOpen:nn,transactionHash:cn,transactionLoading:pt,paymentPresaleRole:Xt,errorFunds:be,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Kn&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"apex",onCloseCurrent:()=>!Kn&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-5 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://omni.apex.exchange/assets/logo_content-CY9uyFbz.svg",alt:""}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] -mt-1",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Apex Farming module lets you set up automated farming by providing your API Key, API Key Passphrase, API Key Secret, Omni Key Seed, selecting a pair, defining orders per hour, leverage and direction."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsxs("div",{onClick:()=>window.open("https://youtu.be/VczH7nAH0Gc","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(IT,{})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]})})]})]}),i.jsxs("div",{className:"space-y-2 pt-2 pb-2 px-5",children:[we&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:we}),i.jsxs("div",{className:"space-y-3 px-3 sm:px-5 py-2",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://omni.apex.exchange/keyManagement",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:N,onChange:Nn=>P(Nn.target.value),autoComplete:"off",placeholder:"API_KEY",type:Qe?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${N===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kn||Dn}),i.jsx("button",{type:"button",onClick:()=>Ke(Nn=>!Nn),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kn||Dn,children:Qe?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Passphrase"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:F,onChange:Nn=>$(Nn.target.value),autoComplete:"off",placeholder:"API_KEY_PAASSPHRASE",type:nt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${F===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kn||Dn}),i.jsx("button",{type:"button",onClick:()=>Le(Nn=>!Nn),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kn||Dn,children:nt?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Secret"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:T,onChange:Nn=>M(Nn.target.value),autoComplete:"off",placeholder:"API_KEY_SECRET",type:dt?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${T===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kn||Dn}),i.jsx("button",{type:"button",onClick:()=>tt(Nn=>!Nn),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kn||Dn,children:dt?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Omni Key Seed"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:L,onChange:Nn=>z(Nn.target.value),autoComplete:"off",placeholder:"OMNI_KEY_SEED",type:Be?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${L===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kn||Dn}),i.jsx("button",{type:"button",onClick:()=>ht(Nn=>!Nn),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kn||Dn,children:Be?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:rn,components:{Option:An,SingleValue:kn},isDisabled:Kn||Dn,options:Vn,value:Vn.find(Nn=>Nn.value===X)||null,onChange:Nn=>ne((Nn==null?void 0:Nn.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:J,onChange:Nn=>{const on=Nn.target.value.trim();if(on==="")return K("");hn(on)&&K(on)},onKeyDown:It,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 100)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${J===""?"border-[#353535]":Yt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kn||Dn}),J!==""&&!Yt&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 100."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:te,onChange:Nn=>{const on=Nn.target.value.trim();if(on==="")return fe("");hn(on)&&fe(on)},onKeyDown:It,inputMode:"numeric",autoComplete:"off",placeholder:X?`1–${Xn}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${te===""?"border-[#353535]":Rt?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kn||Dn})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{"aria-pressed":q==="LONG",onClick:()=>!Dn&&se("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-8 rounded-[10px] uppercase tracking-wide font-semibold transition-all border w-1/2",te?"text-[10px] px-1.5":"text-[11px] px-2",Kn||Dn?"opacity-60 cursor-not-allowed":"cursor-pointer",q==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",te?` - ${te}x`:""]})}),i.jsx("div",{"aria-pressed":q==="SHORT",onClick:()=>!Dn&&se("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-8 rounded-[10px] uppercase tracking-wide font-semibold transition-all border w-1/2",te?"text-[10px] px-1.5":"text-[11px] px-2",Kn||Dn?"opacity-60 cursor-not-allowed":"cursor-pointer",q==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",te?` - ${te}x`:""]})}),i.jsx("div",{"aria-pressed":q==="RANDOM",onClick:()=>!Dn&&se("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-8 rounded-[10px] uppercase tracking-wide font-semibold transition-all border w-1/2",te?"text-[10px] px-1.5":"text-[11px] px-2",Kn||Dn?"opacity-60 cursor-not-allowed":"cursor-pointer",q==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",te?` - ${te}x`:""]})})]})]})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4 px-5 py-2 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl",children:[i.jsxs("div",{onClick:()=>window.open("https://join.omni.apex.exchange/AFF-7530","_blank"),className:"cursor-pointer text-[12px] text-zinc-400 text-start transition-colors duration-300 hover:text-zinc-200 flex-1",children:[i.jsxs("p",{children:["Be part of the"," ",i.jsx("span",{className:"text-white font-semibold",children:"Dextrabot x Apex squad!"})," ","Trade under our referral — unlock bonuses instantly"]}),i.jsx("div",{className:"mt-1 inline-flex items-center gap-1 text-emerald-400 font-medium hover:text-emerald-300 transition-colors duration-300",children:"🔗 Join Now"})]}),i.jsxs("div",{className:"ml-auto flex-1 flex justify-end items-center gap-2",children:[i.jsx("button",{onClick:()=>!Kn&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:Kn,children:"Cancel"}),g?v?i.jsx("button",{onClick:dn,disabled:Kn,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:Ce?"Stopping...":"Stop"}):i.jsx("button",{onClick:kt,disabled:!ot||Kn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!ot||Kn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:oe?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})]}),V&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},wce=({open:t=!1,setOpen:e=()=>{}})=>{var ls,cs;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr);ns();const[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(1),[T,M]=m.useState(0),[F,$]=m.useState(0),[L,z]=m.useState({}),[X,ne]=m.useState(null),[J,K]=m.useState(!1),[te,fe]=m.useState("variational");m.useState(!1),m.useRef(null);const[q,se]=m.useState(!1),[ae,W]=m.useState(!1),[V,ee]=m.useState(0),[oe,de]=m.useState("OFF"),[Ce,me]=m.useState(""),[we,xe]=m.useState(""),[be,je]=m.useState(""),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState(null),[dt,tt]=m.useState(""),[nt,Le]=m.useState(""),[Be,ht]=m.useState(""),[pt,Gt]=m.useState("");m.useState("");const[wt,nn]=m.useState("");m.useState([]);const[cn,Un]=m.useState(""),[Xt,an]=m.useState(""),[Jt,Ye]=m.useState(""),[Je,It]=m.useState("LONG"),[hn,Yt]=m.useState("STANDARD"),[Rt,ot]=m.useState("STANDARD"),[De,At]=m.useState("MARKET"),[ze,rt]=m.useState(""),[mt,Lt]=m.useState(""),[kt,dn]=m.useState(""),[rn,gn]=m.useState("Hour"),[An,kn]=m.useState(!1),[yn,Vn]=m.useState(!1),[Kn,Dn]=m.useState(!1),[Xn,Nn]=m.useState(!1),[on,Oe]=m.useState(""),[Zt,sn]=m.useState(""),[jt,Qn]=m.useState(!0),[bn,Dt]=m.useState(!1),[en,Pn]=m.useState(!1),[tr,ar]=m.useState(!1),[hr,qt]=m.useState(!1),[zn,Zn]=m.useState(!1),[Ft,En]=m.useState(""),[Ee,h]=m.useState(!0),[p,S]=m.useState(""),_=Qe?(Qe==null?void 0:Qe.getTime())<=Date.now():!1;m.useState(1);const k="https://dextrabothypev2.nftinit.io",I="",B=m.useMemo(()=>[{value:"BTC",label:"BTC",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:50},{value:"ETH",label:"ETH",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:50},{value:"SOL",label:"SOL",icon:"https://app.hyperliquid.xyz/coins/SOL.svg",maxLeverage:50},{value:"HYPE",label:"HYPE",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",maxLeverage:50},{value:"XAUT",label:"XAUT",icon:"https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",maxLeverage:50},{value:"BNB",label:"BNB",icon:"https://app.hyperliquid.xyz/coins/BNB.svg",maxLeverage:50},{value:"PUMPFUN",label:"PUMPFUN",icon:"https://coin-images.coingecko.com/coins/images/67164/large/pump.jpg",maxLeverage:50},{value:"KAITO",label:"KAITO",icon:"https://app.hyperliquid.xyz/coins/KAITO.svg",maxLeverage:50},{value:"ZEC",label:"ZEC",icon:"https://app.hyperliquid.xyz/coins/ZEC.svg",maxLeverage:50},{value:"SUI",label:"SUI",icon:"https://app.hyperliquid.xyz/coins/SUI.svg",maxLeverage:50},{value:"VIRTUAL",label:"VIRTUAL",icon:"https://app.hyperliquid.xyz/coins/VIRTUAL.svg",maxLeverage:50},{value:"TAO",label:"TAO",icon:"https://app.hyperliquid.xyz/coins/TAO.svg",maxLeverage:50},{value:"XRP",label:"XRP",icon:"https://app.hyperliquid.xyz/coins/XRP.svg",maxLeverage:50},{value:"TRUMP",label:"TRUMP",icon:"https://app.hyperliquid.xyz/coins/TRUMP.svg",maxLeverage:50},{value:"CRO",label:"CRO",icon:"https://coin-images.coingecko.com/coins/images/7310/large/cro_token_logo.png",maxLeverage:50},{value:"XPL",label:"XPL",icon:"https://app.hyperliquid.xyz/coins/XPL.svg",maxLeverage:50},{value:"IP",label:"IP",icon:"https://app.hyperliquid.xyz/coins/IP.svg",maxLeverage:50},{value:"PAXG",label:"PAXG",icon:"https://app.hyperliquid.xyz/coins/PAXG.svg",maxLeverage:50},{value:"ASTER",label:"ASTER",icon:"https://app.hyperliquid.xyz/coins/ASTER.svg",maxLeverage:50},{value:"DOLO",label:"DOLO",icon:"https://coin-images.coingecko.com/coins/images/54710/large/DOLO-small.png",maxLeverage:50},{value:"RESOLV",label:"RESOLV",icon:"https://app.hyperliquid.xyz/coins/RESOLV.svg",maxLeverage:50},{value:"GRASS",label:"GRASS",icon:"https://app.hyperliquid.xyz/coins/GRASS.svg",maxLeverage:50},{value:"YZY",label:"YZY",icon:"https://app.hyperliquid.xyz/coins/YZY.svg",maxLeverage:50},{value:"PROVE",label:"PROVE",icon:"https://app.hyperliquid.xyz/coins/PROVE.svg",maxLeverage:50},{value:"SYRUP",label:"SYRUP",icon:"https://app.hyperliquid.xyz/coins/SYRUP.svg",maxLeverage:50},{value:"NMR",label:"NMR",icon:"https://coin-images.coingecko.com/coins/images/752/large/numeraire.png",maxLeverage:50},{value:"GMX",label:"GMX",icon:"https://app.hyperliquid.xyz/coins/GMX.svg",maxLeverage:50}],[]),G=et=>{var gt;return((gt=B.find(Tn=>Tn.value===et))==null?void 0:gt.maxLeverage)??100},re=et=>{["e","E","+","-"].includes(et.key)&&et.preventDefault()},ce=et=>/^\d*\.?\d{0,6}$/.test(et),ue=et=>/^\d*$/.test(et),ge=m.useMemo(()=>{if(Xt==="")return!1;const et=Number(Xt);return Number.isInteger(et)&&et>=1&&et<=120},[Xt]),Ae=m.useMemo(()=>{if(Jt==="")return!1;const et=Number(Jt),gt=G(wt);return Number.isInteger(et)&&et>=1&&et<=gt},[Jt,wt]),ke=m.useMemo(()=>{if(ze==="")return!1;const et=Number(ze);return Number.isNaN(et)?!1:et===0?!0:et>=1&&et<=1e7},[ze]),Me=m.useMemo(()=>{if(mt==="")return!1;const et=Number(mt);if(Number.isNaN(et))return!1;const gt=Jt===""?null:Number(Jt),Tn=gt?gt*100-1:4999;return et===0?!0:et>0&&et<1?!1:et>=1&&et<=Tn},[mt,Jt]);m.useMemo(()=>{if(kt==="")return!1;const et=Number(kt);return!Number.isNaN(et)&&et>0&&et<=100},[kt]);const qe=g&&Ie.trim()!==""&&wt!==""&&ge&&Ae&&(!ze||ke)&&(!mt||Me)&&!_&&!dt&&cn&&(Je==="LONG"||Je==="SHORT"||Je==="RANDOM")&&(De==="LIMIT"||De==="MARKET"||De==="RANDOM")&&Ee,Fe=g&&Ie.trim()!==""&&wt!==""&&ge&&cn&&Ae&&cn&&Ee,at=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),ie=()=>`variationalCreds:${at()}`,Se=()=>{try{const et=localStorage.getItem(ie());if(!et)return;const gt=JSON.parse(et);gt.variationalToken&&Re(gt.variationalToken),typeof gt.remember=="boolean"&&Qn(gt.remember)}catch{}},$e=()=>{if(jt)try{localStorage.setItem(ie(),JSON.stringify({variationalToken:Ie,remember:!0}))}catch{}},Ue=()=>{try{localStorage.removeItem(ie())}catch{}};m.useEffect(()=>{if(!t)return;const et=localStorage.getItem("hyperToken"),gt=localStorage.getItem("hyperAddress");y(!!(et&>));const Tn=setInterval(()=>{const sr=localStorage.getItem("hyperToken"),Tr=localStorage.getItem("hyperAddress");y(!!(sr&&Tr))},800);return()=>clearInterval(Tn)},[t]),m.useEffect(()=>{!t||!g||(_e(),Sr())},[t,g]),m.useEffect(()=>{t&&(mt===""&&Lt(I),ze===""&&rt(I),kt===""&&dn(I))},[t]),m.useEffect(()=>{if(!wt)return;const et=G(wt),gt=Number(Jt);!Number.isNaN(gt)&>>et&&Ye(String(et)),!Number.isNaN(gt)&><1&&Jt!==""&&Ye("1")},[wt]),m.useEffect(()=>{t&&(jt&&$e(),jt||Ue())},[Ie,jt,t]);async function _e(){var et,gt,Tn,sr,Tr,Lr,$r,lr;try{Vn(!0),Oe("");const wr=window.localStorage.getItem("hyperToken"),ss=window.localStorage.getItem("hyperAddress");if(!wr||!ss){C(!1),Se();return}const es=await(await fetch(`${k}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ss.toLowerCase(),token:wr})})).json();if(!(es!=null&&es.success)){if(console.warn("INFO API RESPONSE:",es==null?void 0:es.error_message),(es==null?void 0:es.error_message)==="You have not a running process"){const Ys=cn?cn.toLowerCase().replace("-","_farming_"):null,_s=L==null?void 0:L[Ys];if(Ys&&_s){const br={...L,[Ys]:{..._s,isStop:!0}};z(br);const he=Object.keys(br).filter(it=>it.startsWith("variational"));if(he.length>0&&!cn){const vt=he.sort((ln,xn)=>{var pr,fr;const dr=parseInt(((pr=ln.match(/\d+/))==null?void 0:pr[0])||0,10),Er=parseInt(((fr=xn.match(/\d+/))==null?void 0:fr[0])||0,10);return dr-Er})[0].match(/\d+/);vt&&Un(`Variational-${vt[0]}`)}}else Un("Variational-1")}es!=null&&es.slots_info&&($((gt=(et=es==null?void 0:es.slots_info)==null?void 0:et.variational)==null?void 0:gt.total_qty),M((sr=(Tn=es==null?void 0:es.slots_info)==null?void 0:Tn.variational)==null?void 0:sr.active_qty));return}if(es!=null&&es.success&&(es!=null&&es.data)){const Ys=cn?cn.toLowerCase().replace("-","_farming_"):null,_s=L==null?void 0:L[Ys],br=es.data||{};Ys&&!br[Ys]&&_s&&(br[Ys]={..._s,isStop:!0}),z(br);const he=Object.keys(br).filter(it=>it.startsWith("variational"));if(he.length>0&&!cn){const vt=he.sort((ln,xn)=>{var pr,fr;const dr=parseInt(((pr=ln.match(/\d+/))==null?void 0:pr[0])||0,10),Er=parseInt(((fr=xn.match(/\d+/))==null?void 0:fr[0])||0,10);return dr-Er})[0].match(/\d+/);vt&&Un(`Variational-${vt[0]}`)}es!=null&&es.slots_info&&($((Lr=(Tr=es==null?void 0:es.slots_info)==null?void 0:Tr.variational)==null?void 0:Lr.total_qty),M((lr=($r=es==null?void 0:es.slots_info)==null?void 0:$r.variational)==null?void 0:lr.active_qty))}}catch{C(!1),Se(),de("OFF"),K(!1)}finally{Vn(!1)}}const st=m.useMemo(()=>cn?cn.toLowerCase().replace("-","_farming_"):"",[cn]),ut=!!((ls=L==null?void 0:L[st])!=null&&ls.delta)&&!!((cs=L==null?void 0:L[st])!=null&&cs.from_slot),yt=st;m.useEffect(()=>{var Tn,sr,Tr,Lr,$r,lr,wr,ss,mr,es,Ys,_s,br,zt,he,it;if(!cn||!L)return;const et=yt,gt=L==null?void 0:L[et];if(!gt){me(""),xe(""),je(""),Le(""),ht(""),Gt(""),nn(""),an(""),S(""),Ye(""),It("LONG"),At("MARKET"),C(!1),de("OFF"),K(!1),gn("Hour"),rt(""),Lt(""),Re(""),Ke(null),fe("variational"),W(!1),ee(0);return}if((gt==null?void 0:gt.target_params)==null&>.source_params){gt!=null&>.isStop?C(!1):C(!0),de("OFF"),K(!1),W(!1);const Ct=gt.source_params,vt=(gt==null?void 0:gt.slot_number)??"";vt&&!ut&&Un(`Variational-${vt}`),Ct!=null&&Ct.cycleSeconds&&gn((Ct==null?void 0:Ct.cycleSeconds)===86400?"Day":"Hour"),Ct!=null&&Ct.vr_token&&Re(String(Ct.vr_token)),Ct!=null&&Ct.coin&&nn(String(Ct.coin)),(Ct==null?void 0:Ct.orderPerHour)!=null&&an(String(Ct.orderPerHour)),(Ct==null?void 0:Ct.leverage)!=null&&Ye(String(Ct.leverage)),Ct!=null&&Ct.direction&&It(String(Ct.direction).toUpperCase()==="SHORT"?"SHORT":String(Ct.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),Ct!=null&&Ct.orderType&&At(String(Ct.orderType).toUpperCase()==="MARKET"?"MARKET":String(Ct.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(Ct==null?void 0:Ct.tp)!=null&&rt(String(Ct.tp)),(Ct==null?void 0:Ct.sl)!=null&&Lt(String(Ct.sl))}else if((gt==null?void 0:gt.target_params)!==null){gt!=null&>.isStop?(C(!1),W(!1)):(C(!0),W(!0)),de("OFF"),K(!1);const Ct=(gt==null?void 0:gt.slot_number)??"";ee(Ct),Ct&&!ut&&Un(`Variational-${Ct}`),(Tn=gt==null?void 0:gt.source_params)!=null&&Tn.vr_token&&Re(String((sr=gt==null?void 0:gt.source_params)==null?void 0:sr.vr_token)),(Tr=gt==null?void 0:gt.target_params)!=null&&Tr.coin&&nn(String((Lr=gt==null?void 0:gt.target_params)==null?void 0:Lr.coin)),(($r=gt==null?void 0:gt.source_params)==null?void 0:$r.orderPerHour)!=null&&an(String((lr=gt==null?void 0:gt.source_params)==null?void 0:lr.orderPerHour)),gt!=null&>.source_app&&S(gt==null?void 0:gt.source_app),((wr=gt==null?void 0:gt.source_params)==null?void 0:wr.leverage)!=null&&Ye(String((ss=gt==null?void 0:gt.source_params)==null?void 0:ss.leverage)),(mr=gt==null?void 0:gt.source_params)!=null&&mr.accountType&&Yt(((es=gt==null?void 0:gt.source_params)==null?void 0:es.accountType)==="standart"?"STANDARD":"PREMIUM"),(Ys=gt==null?void 0:gt.target_params)!=null&&Ys.accountType&&ot(((_s=gt==null?void 0:gt.target_params)==null?void 0:_s.accountType)==="standart"?"STANDARD":"PREMIUM"),gt!=null&>.target_app&&fe(((gt==null?void 0:gt.target_app)==="variational","variational")),(br=gt==null?void 0:gt.target_params)!=null&&br.vr_token&&Re((zt=gt==null?void 0:gt.target_params)==null?void 0:zt.vr_token),(he=gt==null?void 0:gt.target_params)!=null&&he.cycleSeconds&&gn(((it=gt==null?void 0:gt.target_params)==null?void 0:it.cycleSeconds)===86400?"Day":"Hour")}else C(!1),de("OFF"),K(!1)},[cn,L,ut,yt]);const Mt=et=>{var gt;return Number(((gt=String(et||"").match(/\d+/))==null?void 0:gt[0])||0)},Kt=et=>(et||"").toLowerCase().replace("-","_"),un=m.useMemo(()=>{const et=L==null?void 0:L[Kt(cn)];if(et!=null&&et.delta&&(et!=null&&et.from_slot))return Number(et.from_slot);const gt=Number(et==null?void 0:et.slot_number);return Number.isFinite(gt)?gt:Mt(cn)},[cn,L]),Xe=m.useMemo(()=>{const et=Number(N)||0,gt=Array.from({length:et},()=>({used:!1,kind:null})),Tn=L||{};for(const[sr,Tr]of Object.entries(Tn)){if(!sr.startsWith("variational_farming"))continue;const Lr=Mt(sr)-1;Lr<0||Lr>=et||((Tr==null?void 0:Tr.isStop)===!0?gt[Lr]={used:!1,kind:null}:Tr!=null&&Tr.source_params?gt[Lr]={used:!0,kind:"delta-src"}:Tr!=null&&Tr.target_params||Tr!=null&&Tr.delta?gt[Lr]={used:!0,kind:"delta-shadow"}:Tr!=null&&Tr.farming_params?gt[Lr]={used:!0,kind:"single"}:gt[Lr]={used:!0,kind:"unknown"})}return gt},[L,N]),Pt=m.useMemo(()=>Xe.map((et,gt)=>et.used&&et.kind!=="delta-src-inferred"?`Variational-${gt+1}`:null).filter(Boolean),[Xe]);m.useMemo(()=>Xe.filter(et=>!et.used).length,[Xe]);async function Wt(){if(!g){n(!0);return}if(qe)try{Dn(!0),Oe("");const et=window.localStorage.getItem("hyperToken"),gt=window.localStorage.getItem("hyperAddress");if(!et||!gt){n(!0);return}const Tn={vr_token:Ie,coin:wt,orderPerHour:Number(Xt),leverage:Number(Jt),direction:Je,orderType:"MARKET",tp:Number(ze),sl:Number(mt),cycleSeconds:rn==="Hour"?3600:86400},sr={api_pkey:we,api_index:nt,login_wallet:pt,coin:wt==null?void 0:wt.replace("USDT",""),orderPerHour:Number(Xt),leverage:Number(Jt)},Tr={address:gt.toLowerCase(),token:et,source_app:"variational_farming",source_params:Tn,slot_number:Number(cn==null?void 0:cn.replace("Variational-",""))},$r=await(await fetch(`${k}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Tr)})).json();$r!=null&&$r.success?(C(!0),_e(),jt&&$e()):Oe(($r==null?void 0:$r.error_message)||"Start failed.")}catch(et){Oe(et.message||"An error occurred while saving.")}finally{Dn(!1)}}async function ct(){if(!g){n(!0);return}try{Nn(!0),Oe("");const et=window.localStorage.getItem("hyperToken"),gt=window.localStorage.getItem("hyperAddress");if(!et||!gt){n(!0);return}const sr=await(await fetch(`${k}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:gt.toLowerCase(),token:et,...ae?{slot_number:V,target_app:"variational_delta",source_app:p}:{source_app:"variational_farming",slot_number:un}})})).json();sr!=null&&sr.success?(C(!1),_e()):Oe((sr==null?void 0:sr.error_message)||"Stop failed.")}catch(et){Oe(et.message||"An error occurred while stopping.")}finally{Nn(!1)}}const Ge={control:(et,gt)=>({...et,backgroundColor:"#242424",borderColor:gt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:et=>({...et,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:et=>({...et,height:32}),input:et=>({...et,color:"#FFFFFF",margin:0,padding:0}),singleValue:et=>({...et,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:et=>({...et,color:"#7F7F7F",fontSize:"12px"}),menu:et=>({...et,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:et=>({...et,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(et,gt)=>({...et,backgroundColor:gt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:et=>({...et,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:et=>({...et,backgroundColor:"#353535"})};m.useEffect(()=>{if(!Ie){Ke(null),tt("");return}const et=ur(Ie);if(et&&(et!=null&&et.exp)){const gt=new Date(et.exp*1e3);Ke(gt),tt("")}else et?(Ke(null),tt("The token's expiration date could not be found.")):(Ke(null),tt("Invalid token format."))},[Ie]);const Tt=({max:et})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[et,"x"]}),fn=et=>{var gt,Tn;return i.jsx(Sa.Option,{...et,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(gt=et.data)!=null&>.icon?i.jsx("img",{src:et.data.icon,alt:et.data.label,className:`w-4 h-4 ${((Tn=et==null?void 0:et.data)==null?void 0:Tn.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:sr=>sr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:et.data.label}),i.jsx(Tt,{max:et.data.maxLeverage})]})})},Yn=et=>{var gt,Tn;return i.jsx(Sa.SingleValue,{...et,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(gt=et.data)!=null&>.icon?i.jsx("img",{src:et.data.icon,alt:et.data.label,className:`w-4 h-4 ${((Tn=et==null?void 0:et.data)==null?void 0:Tn.label)==="XRP"?"bg-gray-600 rounded-full":"rounded-[4px]"}`,onError:sr=>sr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:et.data.label}),i.jsx(Tt,{max:et.data.maxLeverage})]})})},Fn=et=>{const gt=Pt.includes(et.data.value);return i.jsx(Sa.Option,{...et,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:et.data.label}),gt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},Gn=et=>i.jsx(Sa.SingleValue,{...et,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:et.data.label})})}),Sr=async()=>{var Tn,sr,Tr,Lr,$r,lr,wr,ss;const et=window.localStorage.getItem("hyperToken"),gt=window.localStorage.getItem("hyperAddress");if(!(!et||!gt))try{kn(!0);const mr=await ki(gt.toLowerCase(),et);mr!=null&&mr.success?(r(mr==null?void 0:mr.telegram_chat_id),s(mr==null?void 0:mr.subscriber_role),a(mr==null?void 0:mr.subs_expire_day),o((Tn=mr==null?void 0:mr.mushboomer_counts)==null?void 0:Tn.eth),l((sr=mr==null?void 0:mr.mushboomer_counts)==null?void 0:sr.sol),c(mr==null?void 0:mr.referral_code),u(mr==null?void 0:mr.refcode),d(mr==null?void 0:mr.whitelist),f(et),x(gt),h(!0),P((Lr=(Tr=mr==null?void 0:mr.slots_info)==null?void 0:Tr.variational)==null?void 0:Lr.total_qty),$((lr=($r=mr==null?void 0:mr.slots_info)==null?void 0:$r.variational)==null?void 0:lr.total_qty),M((ss=(wr=mr==null?void 0:mr.slots_info)==null?void 0:wr.variational)==null?void 0:ss.active_qty),kn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),kn(!1))}catch(mr){console.error("Token verification error:",mr),console.error(mr.message||"An unknown error occurred."),kn(!1)}};function ur(et){try{const gt=et.split(".");if(gt.length!==3)throw new Error("Invalid JWT format");const sr=gt[1].replace(/-/g,"+").replace(/_/g,"/"),Tr=decodeURIComponent(atob(sr).split("").map(Lr=>"%"+("00"+Lr.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Tr)}catch{return null}}const kr=B,Bn=m.useMemo(()=>Array.from({length:N},(et,gt)=>({value:`Variational-${gt+1}`,label:`Variational-${gt+1}`})),[N]);if(!t)return null;const Sn=yn||Kn||Xn||An,Mn=v&&!Xn,rr=G(wt);return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:zn,setOpen:Zn,transactionHash:Ft,transactionLoading:hr,paymentPresaleRole:Ee,errorFunds:Zt,activeMethod:2}),i.jsx(O5,{open:q,setOpen:se,paymentLighterRole:Ee,oldSlotCount:X,checkAccountLighter:Sr,tradeMarket:"variational"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Sn&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"variational",onCloseCurrent:()=>!Sn&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://omni.variational.io/_app/immutable/assets/full_omni_wordmark.DwlcSpMk.svg",alt:"Variational",className:"h-[18px] text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] mt-[1px]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Variational Farming module lets you set up automated farming by providing your Variational Token, selecting a pair, defining orders per hour, leverage, direction and order type ."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[on&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:on}),g&&Ee&&F===T&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:"No free Variational slots. Currently running on Delta Neutral."}),g&&ae&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`Currently used for Delta Neutral in ${p.charAt(0).toUpperCase()+p.slice(1)} Farming (Slot-${V})`}),g&&Ee&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-4 sm:px-5",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[T||0,"/",Bn.length]})]})]}),i.jsx(jl,{styles:Ge,components:{Option:Fn,SingleValue:Gn},options:Bn,value:Bn.find(et=>et.value===cn)||null,onChange:et=>Un((et==null?void 0:et.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:"py-1 space-y-3 px-3 sm:px-5",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[oe==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Variational Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Be,onChange:et=>ht(et.target.value),autoComplete:"off",placeholder:"1st Variational Wallet Address ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Ce,onChange:et=>me(et.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:bn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn}),i.jsx("button",{type:"button",onClick:()=>Dt(et=>!et),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Sn||Mn,children:bn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return je("");ue(gt)&&je(gt)},onKeyDown:re,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn})})]})]}):i.jsx(i.Fragment,{}),oe==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Variational Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:pt,onChange:et=>Gt(et.target.value),autoComplete:"off",placeholder:"2nd Variational Wallet Address",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${pt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:we,onChange:et=>xe(et.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:tr?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn}),i.jsx("button",{type:"button",onClick:()=>ar(et=>!et),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Sn||Mn,children:tr?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index 2"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:nt,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return Le("");ue(gt)&&Le(gt)},onKeyDown:re,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX_2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${oe==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Variational Token"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Variational Token?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Ie,onChange:et=>{const gt=et.target.value;if(Re(gt),!gt.trim()){Ke(null),tt("");return}const Tn=ur(gt);if(Tn&&(Tn!=null&&Tn.exp)){const sr=new Date((Tn==null?void 0:Tn.exp)*1e3);Ke(sr),tt("")}else Tn?(Ke(null),tt("The token's expiration date could not be found.")):(Ke(null),tt("Invalid token format."))},type:en?"text":"password",autoComplete:"off",placeholder:"Variational_Token",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ie===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Sn||Mn}),Qe&&i.jsxs("div",{className:"text-[12px] mt-1 pl-[3px] flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-[#CECECE] font-medium",children:"Valid Until:"})," ",i.jsx("span",{className:"text-[11px] font-semibold "+(_?"text-[#FF797C]":"text-[#F8D4AB]"),children:Qe==null?void 0:Qe.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),_&&i.jsx("span",{children:i.jsx("img",{src:rc,alt:"",className:"w-3.5 h-3.5"})})]}),dt&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:dt}),i.jsx("button",{type:"button",onClick:()=>Pn(et=>!et),className:"absolute right-1 top-4 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Sn||Mn,children:en?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:Ge,components:{Option:fn,SingleValue:Yn},isDisabled:Sn||Mn,options:kr,value:kr.find(et=>et.value===wt)||null,onChange:et=>nn((et==null?void 0:et.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${oe==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:Xt,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return an("");ue(gt)&&an(gt)},onKeyDown:re,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Xt===""?"border-[#353535]":ge?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Sn||Mn}),Xt!==""&&!ge&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 120."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${oe==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:rn,onChange:et=>gn(et.target.value),className:`${Sn||Mn?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Sn||Mn,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:Xt,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return an("");ue(gt)&&an(gt)},onKeyDown:re,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 120)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Xt===""?"border-[#353535]":ge?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Sn||Mn}),Xt!==""&&!ge&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 120."})]}),i.jsxs("div",{className:`${oe==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:oe==="ON"?"On":"Off"}),i.jsx(Io,{checked:oe==="ON",onChange:et=>de(et?"ON":"OFF"),disabled:Sn||Mn,className:`${oe==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${Sn||Mn?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${oe==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Jt,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return Ye("");ue(gt)&&Ye(gt)},onKeyDown:re,inputMode:"numeric",autoComplete:"off",placeholder:wt?`1–${rr}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Jt===""?"border-[#353535]":Ae?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Sn||Mn})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":Je==="LONG",onClick:()=>!Mn&&It("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Sn||Mn?"cursor-not-allowed":"cursor-pointer",Je==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",Jt?` - ${Jt}x`:""]})}),i.jsx("div",{"aria-pressed":Je==="SHORT",onClick:()=>!Mn&&It("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Sn||Mn?"cursor-not-allowed":"cursor-pointer",Je==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",Jt?` - ${Jt}x`:""]})}),i.jsx("div",{"aria-pressed":Je==="RANDOM",onClick:()=>!Mn&&It("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Sn||Mn?"cursor-not-allowed":"cursor-pointer",Je==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",Jt?` - ${Jt}x`:""]})})]})]}),i.jsxs("div",{className:`${ae?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{"aria-pressed":De==="MARKET",onClick:()=>!Mn&&At("MARKET"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2 min-w-max",Sn||Mn?"cursor-not-allowed":"cursor-pointer",De==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",De==="MARKET"?" ✓":""]})}),i.jsxs("button",{"aria-pressed":De==="LIMIT",className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2","cursor-not-allowed",De==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:[i.jsxs("span",{children:["LIMIT ",De==="LIMIT"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]}),i.jsxs("button",{"aria-pressed":De==="RANDOM",className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2","cursor-not-allowed",De==="RANDOM"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:[i.jsxs("span",{children:["RANDOM ",De==="RANDOM"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]})]})]})]}),!1,i.jsxs("div",{className:`${ae?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:ze,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return rt("");ce(gt)&&rt(gt)},onKeyDown:re,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${ze===""?"border-[#353535]":ke?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Sn||Mn})]}),ze!==""&&!ke&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:mt,onChange:et=>{const gt=et.target.value.trim();if(gt==="")return Lt("");ce(gt)&&Lt(gt)},onKeyDown:re,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${mt===""?"border-[#353535]":Me?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Sn||Mn})]}),mt!==""&&!Me&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Jt?Math.max(Jt*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]})]}),i.jsx("div",{className:`${oe==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Sn&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:Sn,children:"Cancel"}),g?oe==="ON"?v?i.jsx("button",{onClick:stopLighterFarming,disabled:Sn,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:Xn?"Stopping...":"Stop"}):i.jsx("button",{onClick:saveLighterFarming,disabled:!Fe||Sn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Fe||Sn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Kn?"Starting...":"Start"}):v?i.jsx("button",{onClick:ct,disabled:Sn,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:Xn?"Stopping...":"Stop"}):i.jsx("button",{onClick:Wt,disabled:!qe||Sn,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!qe||Sn?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Kn?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),yn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},wU=({open:t=!1,setOpen:e=()=>{}})=>{var oi,Fr,wn,On;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr),{address:g}=ns(),[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState(1),[M,F]=m.useState(0),[$,L]=m.useState(0),[z,X]=m.useState(0),[ne,J]=m.useState(0),[K,te]=m.useState({}),[fe,q]=m.useState(null),[se,ae]=m.useState("variational"),[W,V]=m.useState(!1),ee=m.useRef(null),[oe,de]=m.useState(!1),[Ce,me]=m.useState("Extended-1"),[we,xe]=m.useState("ON"),[be,je]=m.useState(""),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState(""),[dt,tt]=m.useState(""),[nt,Le]=m.useState(""),[Be,ht]=m.useState(""),[pt,Gt]=m.useState(""),[wt,nn]=m.useState(""),[cn,Un]=m.useState([]),[Xt,an]=m.useState(""),[Jt,Ye]=m.useState(""),[Je,It]=m.useState("LONG"),[hn,Yt]=m.useState("STANDARD"),[Rt,ot]=m.useState("STANDARD"),[De,At]=m.useState("LIMIT"),[ze,rt]=m.useState("LIMIT"),[mt,Lt]=m.useState("MARKET"),[kt,dn]=m.useState(""),[rn,gn]=m.useState(""),[An,kn]=m.useState(""),[yn,Vn]=m.useState(!1),[Kn,Dn]=m.useState(!1),[Xn,Nn]=m.useState(!1),[on,Oe]=m.useState(!1),[Zt,sn]=m.useState(""),[jt,Qn]=m.useState(""),[bn,Dt]=m.useState(!0),[en,Pn]=m.useState(!1),[tr,ar]=m.useState(!1),[hr,qt]=m.useState(!1),[zn,Zn]=m.useState(!1),[Ft,En]=m.useState(!1),[Ee,h]=m.useState(!1),[p,S]=m.useState(!1),[_,k]=m.useState(""),[I,B]=m.useState(!0),[G,re]=m.useState(""),[ce,ue]=m.useState(null),[ge,Ae]=m.useState(""),[ke,Me]=m.useState(!1),qe=ce?(ce==null?void 0:ce.getTime())<=Date.now():!1,[Fe,at]=m.useState("Hour"),[ie,Se]=m.useState([]),[$e,Ue]=m.useState(""),[_e,st]=m.useState(!1),[ut,yt]=m.useState(!1);m.useState(1);const Mt="https://dextrabothypev2.nftinit.io",Kt="",un=m.useMemo(()=>[{value:"BTC",label:"BTC",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:50},{value:"ETH",label:"ETH",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:50},{value:"SOL",label:"SOL",icon:"https://app.hyperliquid.xyz/coins/SOL.svg",maxLeverage:50},{value:"HYPE",label:"HYPE",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",maxLeverage:50},{value:"ZEC",label:"ZEC",icon:"https://app.hyperliquid.xyz/coins/ZEC.svg",maxLeverage:10},{value:"BNB",label:"BNB",icon:"https://app.hyperliquid.xyz/coins/BNB.svg",maxLeverage:20},{value:"RESOLV",label:"RESOLV",icon:"https://app.hyperliquid.xyz/coins/RESOLV.svg",maxLeverage:5},{value:"XPL",label:"XPL",icon:"https://app.hyperliquid.xyz/coins/XPL.svg",maxLeverage:20},{value:"GOAT",label:"GOAT",icon:"https://app.hyperliquid.xyz/coins/GOAT.svg",maxLeverage:10},{value:"PUMP",label:"PUMP",icon:"https://app.hyperliquid.xyz/coins/PUMP.svg",maxLeverage:25},{value:"ASTER",label:"ASTER",icon:"https://static.astherus.finance/image/admin_mgs_image_upload/20250916/6dba1412-ddfb-4314-bfdf-87fa11f2daa6.png",maxLeverage:10}],[]),Xe=m.useMemo(()=>[{value:"BTC",label:"BTC",icon:"https://app.hyperliquid.xyz/coins/BTC.svg",maxLeverage:50},{value:"ETH",label:"ETH",icon:"https://app.hyperliquid.xyz/coins/ETH.svg",maxLeverage:50},{value:"SOL",label:"SOL",icon:"https://app.hyperliquid.xyz/coins/SOL.svg",maxLeverage:50},{value:"HYPE",label:"HYPE",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",maxLeverage:50},{value:"XMR",label:"XMR",icon:"https://cdn.extended.exchange/crypto/XMR.svg",maxLeverage:25},{value:"XRP",label:"XRP",icon:"https://app.hyperliquid.xyz/coins/XRP.svg",maxLeverage:50},{value:"PUMP",label:"PUMP",icon:"https://app.hyperliquid.xyz/coins/PUMP.svg",maxLeverage:50},{value:"BNB",label:"BNB",icon:"https://app.hyperliquid.xyz/coins/BNB.svg",maxLeverage:25},{value:"ZEC",label:"ZEC",icon:"https://app.hyperliquid.xyz/coins/ZEC.svg",maxLeverage:10},{value:"LTC",label:"LTC",icon:"https://app.hyperliquid.xyz/coins/LTC.svg",maxLeverage:25},{value:"IP",label:"IP",icon:"https://app.hyperliquid.xyz/coins/IP.svg",maxLeverage:10},{value:"SUI",label:"SUI",icon:"https://app.hyperliquid.xyz/coins/SUI.svg",maxLeverage:50},{value:"AAVE",label:"AAVE",icon:"https://app.hyperliquid.xyz/coins/AAVE.svg",maxLeverage:50},{value:"FARTCOIN",label:"FARTCOIN",icon:"https://app.hyperliquid.xyz/coins/FARTCOIN.svg",maxLeverage:25},{value:"BERA",label:"BERA",icon:"https://app.hyperliquid.xyz/coins/BERA.svg",maxLeverage:10},{value:"ASTER",label:"ASTER",icon:"https://app.hyperliquid.xyz/coins/ASTER.svg",maxLeverage:25},{value:"ENA",label:"ENA",icon:"https://app.hyperliquid.xyz/coins/ENA.svg",maxLeverage:50},{value:"ADA",label:"ADA",icon:"https://app.hyperliquid.xyz/coins/ADA.svg",maxLeverage:50},{value:"TIA",label:"TIA",icon:"https://app.hyperliquid.xyz/coins/TIA.svg",maxLeverage:25},{value:"LINK",label:"LINK",icon:"https://app.hyperliquid.xyz/coins/LINK.svg",maxLeverage:25}],[]),Pt={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI"};m.useEffect(()=>{async function lt(){if(t)try{const nr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended")).json();if(nr!=null&&nr.coins){let Wn=nr.coins.map(Or=>{const Pr=(Or==null?void 0:Or.label)||"",ts=Pt[Pr]||Pr,Ls=ts==="XMR"?"https://app.lighter.xyz/assets/xmr-CV8khZ54.png":ts==="NMR"?"https://app.lighter.xyz/assets/nmr-2YIHMk6g.png":ts==="USELESS"?"https://app.lighter.xyz/assets/useless-BTmgr78l.png":ts==="DOLO"?"https://app.lighter.xyz/assets/dolo-DuOVl-Vo.png":ts==="CRO"?"https://app.lighter.xyz/assets/cro-C7lstwu3.png":ts==="FF"?"https://app.lighter.xyz/assets/ff-CvnDhHny.png":ts==="4"||ts=="EUR"||ts=="EDEN"||ts=="XAU"?"":`https://app.hyperliquid.xyz/coins/${ts}.svg`;return{...Or,icon:Ls}});Un(Wn)}}catch(Bt){console.error("Failed to fetch coin list:",Bt)}}lt()},[t]);async function Wt(){try{st(!0);const lt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!lt||!Bt){n(!0);return}const nr=`${Mt}/api/wallet/list-extended`,Or=await(await fetch(`${nr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Bt.toLowerCase(),token:lt})})).json();Or!=null&&Or.success?Se((Or==null?void 0:Or.data)||[]):sn((Or==null?void 0:Or.error_message)||"Failed to load wallets.")}catch(lt){sn(lt.message||"Wallet list error.")}finally{st(!1)}}const ct=lt=>{var Bt;return((Bt=(we==="ON"?Xe:un).find(nr=>nr.value===lt))==null?void 0:Bt.maxLeverage)??100},Ge=lt=>{["e","E","+","-"].includes(lt.key)&<.preventDefault()},Tt=lt=>/^\d*\.?\d{0,6}$/.test(lt),fn=lt=>/^\d*$/.test(lt),Yn=m.useMemo(()=>{if(Xt==="")return!1;const lt=Number(Xt);return Number.isInteger(lt)&<>=1&<<=120},[Xt]),Fn=m.useMemo(()=>{if(Jt==="")return!1;const lt=Number(Jt),Bt=ct(wt);return Number.isInteger(lt)&<>=1&<<=Bt},[Jt,wt]),Gn=m.useMemo(()=>{if(kt==="")return!1;const lt=Number(kt);return Number.isNaN(lt)?!1:lt===0?!0:lt>=1&<<=1e7},[kt]),Sr=m.useMemo(()=>{if(rn==="")return!1;const lt=Number(rn);if(Number.isNaN(lt))return!1;const Bt=Jt===""?null:Number(Jt),nr=Bt?Bt*100-1:4999;return lt===0?!0:lt>0&<<1?!1:lt>=1&<<=nr},[rn,Jt]);m.useMemo(()=>{if(An==="")return!1;const lt=Number(An);return!Number.isNaN(lt)&<>0&<<=100},[An]);const ur=we=="ON"?Xe:un,kr=m.useMemo(()=>wt?ur.some(lt=>lt.value===wt):!1,[wt,ur]),Bn=y&&be.trim()!==""&&Be.trim()!==""&&Qe.trim()!==""&&dt.trim()!==""&&wt!==""&&Yn&&Fn&&Ce&&(!kt||Gn)&&(!rn||Sr)&&(Je==="LONG"||Je==="SHORT"||Je==="RANDOM")&&(De==="LIMIT"||De==="MARKET"||De==="RANDOM")&&I,Sn=y&&$e&&Ce&&wt!==""&&kr&&Yn&&Fn&&(se!=="variational"||G.trim()!=="")&&(se!=="variational"||!ge)&&(se!=="variational"||!qe)&&I,Mn=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),rr=()=>`extendedCreds:${Mn()}`,ls=()=>{try{const lt=localStorage.getItem(rr());if(!lt)return;const Bt=JSON.parse(lt);Bt.apiKey&&je(Bt.apiKey),Bt.apiPrivateKey&&Ke(Bt.apiPrivateKey),Bt.vaultNumber&&tt(Bt.vaultNumber),Bt.apiPublicKey&&ht(Bt.apiPublicKey),typeof Bt.remember=="boolean"&&Dt(Bt.remember)}catch{}},cs=()=>{if(bn)try{localStorage.setItem(rr(),JSON.stringify({apiKey:be,apiPrivateKey:Qe,apiPublicKey:Be,vaultNumber:dt,remember:!0}))}catch{}},et=()=>{try{localStorage.removeItem(rr())}catch{}};m.useEffect(()=>{if(!t)return;const lt=localStorage.getItem("hyperToken"),Bt=localStorage.getItem("hyperAddress");v(!!(lt&&Bt));const nr=setInterval(()=>{const Wn=localStorage.getItem("hyperToken"),Or=localStorage.getItem("hyperAddress");v(!!(Wn&&Or))},800);return()=>clearInterval(nr)},[t]),m.useEffect(()=>{!t||!y||(gt(),Wt(),pr())},[t,y]),m.useEffect(()=>{t&&(rn===""&&gn(Kt),kt===""&&dn(Kt),An===""&&kn(Kt))},[t]),m.useEffect(()=>{if(!wt)return;const lt=ct(wt),Bt=Number(Jt);!Number.isNaN(Bt)&&Bt>lt&&Ye(String(lt)),!Number.isNaN(Bt)&&Bt<1&&Jt!==""&&Ye("1")},[wt]),m.useEffect(()=>{t&&(bn&&cs(),bn||et())},[be,Qe,dt,Be,bn,t]);async function gt(){var lt,Bt,nr,Wn,Or,Pr,ts,Ls,Et,or,Hn,Vr,us,as,xs,bs;try{Dn(!0),sn("");const zi=window.localStorage.getItem("hyperToken"),Us=window.localStorage.getItem("hyperAddress");if(!zi||!Us){N(!1),ls();return}const Ss=await(await fetch(`${Mt}/api/test_app/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Us.toLowerCase(),token:zi})})).json();if(!(Ss!=null&&Ss.success)){if(console.warn("INFO API RESPONSE:",Ss==null?void 0:Ss.error_message),(Ss==null?void 0:Ss.error_message)==="You have not a running process"){const pc=Ce?Ce.toLowerCase().replace("-","_"):null,ks=K==null?void 0:K[pc];if(pc&&ks){const ka={...K,[pc]:{...ks,isStop:!0}};te(ka);const va=Object.keys(ka).filter(Yo=>Yo.startsWith("extended"));if(va.length>0&&!Ce){const Yl=va.sort((yi,Ed)=>{var E,O;const ft=parseInt(((E=yi.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((O=Ed.match(/\d+/))==null?void 0:O[0])||0,10);return ft-w})[0].match(/\d+/);Yl&&me(`Extended-${Yl[0]}`)}}else me("Extended-1")}Ss!=null&&Ss.slots_info&&(L((Bt=(lt=Ss==null?void 0:Ss.slots_info)==null?void 0:lt.extended)==null?void 0:Bt.total_qty),F((Wn=(nr=Ss==null?void 0:Ss.slots_info)==null?void 0:nr.extended)==null?void 0:Wn.active_qty),J((Pr=(Or=Ss==null?void 0:Ss.slots_info)==null?void 0:Or.variational)==null?void 0:Pr.total_qty),X((Ls=(ts=Ss==null?void 0:Ss.slots_info)==null?void 0:ts.variational)==null?void 0:Ls.active_qty));return}if(Ss!=null&&Ss.success&&(Ss!=null&&Ss.data)){const pc=Ce?Ce.toLowerCase().replace("-","_"):null,ks=K==null?void 0:K[pc],ka=Ss.data||{};pc&&!ka[pc]&&ks&&(ka[pc]={...ks,isStop:!0}),te(ka);const va=Object.keys(ka).filter(Yo=>Yo.startsWith("extended"));if(va.length>0&&!Ce){const Yl=va.sort((yi,Ed)=>{var E,O;const ft=parseInt(((E=yi.match(/\d+/))==null?void 0:E[0])||0,10),w=parseInt(((O=Ed.match(/\d+/))==null?void 0:O[0])||0,10);return ft-w})[0].match(/\d+/);Yl&&me(`Extended-${Yl[0]}`)}Ss!=null&&Ss.slots_info&&(L((or=(Et=Ss==null?void 0:Ss.slots_info)==null?void 0:Et.extended)==null?void 0:or.total_qty),F((Vr=(Hn=Ss==null?void 0:Ss.slots_info)==null?void 0:Hn.extended)==null?void 0:Vr.active_qty),J((as=(us=Ss==null?void 0:Ss.slots_info)==null?void 0:us.variational)==null?void 0:as.total_qty),X((bs=(xs=Ss==null?void 0:Ss.slots_info)==null?void 0:xs.variational)==null?void 0:bs.active_qty))}}catch{N(!1),ls(),xe("ON")}finally{Dn(!1)}}const Tn=m.useMemo(()=>Ce?Ce.toLowerCase().replace("-","_"):"",[Ce]),sr=!!((oi=K==null?void 0:K[Tn])!=null&&oi.delta)&&!!((Fr=K==null?void 0:K[Tn])!=null&&Fr.from_slot),Tr=sr?`extended_${(wn=K==null?void 0:K[Tn])==null?void 0:wn.from_slot}`:Tn;m.useEffect(()=>{var nr,Wn,Or,Pr,ts,Ls,Et,or,Hn,Vr,us,as,xs,bs,zi,Us,ys,Ss,pc;if(!Ce||!K)return;const lt=Tr,Bt=K==null?void 0:K[lt];if(!Bt){je(""),Ke(""),ht(""),Le(""),tt(""),nn(""),an(""),Ye(""),It("LONG"),At("LIMIT"),N(!1),xe("ON"),at("Hour"),dn(""),gn(""),re(""),rt("LIMIT"),Lt("MARKET"),ae("variational"),ue(null);return}if((Bt==null?void 0:Bt.target_params)==null&&Bt.source_params){Bt!=null&&Bt.isStop?N(!1):N(!0),xe("OFF");const ks=Bt.source_params,ka=(Bt==null?void 0:Bt.slot_number)??"";ka&&!sr&&me(`Extended-${ka}`),ks!=null&&ks.cycleSeconds&&at((ks==null?void 0:ks.cycleSeconds)===86400?"Day":"Hour");const Wu=(ks==null?void 0:ks.extendedapikey)??"",va=(ks==null?void 0:ks.x10privatekey)??"",Yo=(ks==null?void 0:ks.x10publickey)??"",qu=(ks==null?void 0:ks.x10vault)??"";if(Wu&&je(String(Wu)),va&&Ke(String(va)),Yo&&ht(String(Yo)),qu&&tt(String(qu)),ks!=null&&ks.coin){const Yl=String(ks.coin).replace(/-USD$/,"");nn(Yl)}(ks==null?void 0:ks.orderPerHour)!=null&&an(String(ks.orderPerHour)),(ks==null?void 0:ks.leverage)!=null&&Ye(String(ks.leverage)),ks!=null&&ks.direction&&It(String(ks.direction).toUpperCase()==="SHORT"?"SHORT":String(ks.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),ks!=null&&ks.orderType&&At(String(ks.orderType).toUpperCase()==="MARKET"?"MARKET":String(ks.orderType).toUpperCase()==="LIMIT"?"LIMIT":"RANDOM"),(ks==null?void 0:ks.tp)!=null&&dn(String(ks.tp)),(ks==null?void 0:ks.sl)!=null&&gn(String(ks.sl))}else if((Bt==null?void 0:Bt.target_params)!==null){Bt!=null&&Bt.isStop?N(!1):N(!0),xe("ON");const ks=(Bt==null?void 0:Bt.slot_number)??"";ks&&!sr&&me(`Extended-${ks}`);const ka=Bt.source_params,Wu=(ka==null?void 0:ka.extendedapikey)??"",va=(ka==null?void 0:ka.x10privatekey)??"",Yo=(ka==null?void 0:ka.x10publickey)??"",qu=(ka==null?void 0:ka.x10vault)??"";if(Wu&&je(String(Wu)),va&&Ke(String(va)),Yo&&ht(String(Yo)),qu&&tt(String(qu)),(nr=Bt==null?void 0:Bt.source_params)!=null&&nr.wallet_id&&Ue(String((Wn=Bt==null?void 0:Bt.source_params)==null?void 0:Wn.wallet_id)),(Or=Bt==null?void 0:Bt.source_params)!=null&&Or.coin){const Yl=String((Pr=Bt==null?void 0:Bt.source_params)==null?void 0:Pr.coin).replace(/-USD$/,"");nn(Yl)}((ts=Bt==null?void 0:Bt.source_params)==null?void 0:ts.orderPerHour)!=null&&an(String((Ls=Bt==null?void 0:Bt.source_params)==null?void 0:Ls.orderPerHour)),((Et=Bt==null?void 0:Bt.source_params)==null?void 0:Et.leverage)!=null&&Ye(String((or=Bt==null?void 0:Bt.source_params)==null?void 0:or.leverage)),(Hn=Bt==null?void 0:Bt.source_params)!=null&&Hn.accountType&&Yt(((Vr=Bt==null?void 0:Bt.source_params)==null?void 0:Vr.accountType)==="standart"?"STANDARD":"PREMIUM"),(us=Bt==null?void 0:Bt.target_params)!=null&&us.accountType&&ot(((as=Bt==null?void 0:Bt.target_params)==null?void 0:as.accountType)==="standart"?"STANDARD":"PREMIUM"),Bt!=null&&Bt.target_app&&ae(((Bt==null?void 0:Bt.target_app)==="variational","variational")),(xs=Bt==null?void 0:Bt.target_params)!=null&&xs.vr_token&&re((bs=Bt==null?void 0:Bt.target_params)==null?void 0:bs.vr_token),(zi=Bt==null?void 0:Bt.source_params)!=null&&zi.source_orderType&&rt(String((Us=Bt==null?void 0:Bt.source_params)==null?void 0:Us.source_orderType).toUpperCase()==="MARKET"?"MARKET":String((ys=Bt==null?void 0:Bt.source_params)==null?void 0:ys.source_orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(Ss=Bt==null?void 0:Bt.source_params)!=null&&Ss.cycleSeconds&&at(((pc=Bt==null?void 0:Bt.source_params)==null?void 0:pc.cycleSeconds)===86400?"Day":"Hour")}else N(!1),xe("OFF")},[Ce,K,sr,Tr]);const Lr=lt=>{var Bt;return Number(((Bt=String(lt||"").match(/\d+/))==null?void 0:Bt[0])||0)},$r=lt=>(lt||"").toLowerCase().replace("-","_"),lr=m.useMemo(()=>{const lt=K==null?void 0:K[$r(Ce)];if(lt!=null&<.delta&&(lt!=null&<.from_slot))return Number(lt.from_slot);const Bt=Number(lt==null?void 0:lt.slot_number);return Number.isFinite(Bt)?Bt:Lr(Ce)},[Ce,K]),wr=m.useMemo(()=>{const lt=Number(P)||0,Bt=Array.from({length:lt},()=>({used:!1,kind:null})),nr=K||{};for(const[Wn,Or]of Object.entries(nr)){if(!Wn.startsWith("extended"))continue;const Pr=Lr(Wn)-1;Pr<0||Pr>=lt||((Or==null?void 0:Or.isStop)===!0?Bt[Pr]={used:!1,kind:null}:Or!=null&&Or.source_params?Bt[Pr]={used:!0,kind:"delta-src"}:Or!=null&&Or.target_params||Or!=null&&Or.delta?Bt[Pr]={used:!0,kind:"delta-shadow"}:Or!=null&&Or.farming_params?Bt[Pr]={used:!0,kind:"single"}:Bt[Pr]={used:!0,kind:"unknown"})}return Bt},[K,P]),ss=m.useMemo(()=>wr.map((lt,Bt)=>lt.used&<.kind!=="delta-src-inferred"?`Extended-${Bt+1}`:null).filter(Boolean),[wr]);m.useMemo(()=>wr.filter(lt=>!lt.used).length,[wr]);async function mr(){var Bt;const lt=Lr(Ce)-1;if(lt<0){sn("Please select a slot."),Nn(!1);return}if((Bt=wr[lt])!=null&&Bt.used){sn("Selected slot is already in use."),Nn(!1);return}if(!y){n(!0);return}if(we==="OFF"){if(!Bn)return}else if(!Sn)return;try{Nn(!0),sn("");const nr=window.localStorage.getItem("hyperToken"),Wn=window.localStorage.getItem("hyperAddress");if(!nr||!Wn){n(!0);return}const Or={coin:`${wt}-USD`,leverage:Number(Jt),orderPerHour:Number(Xt),cycleSeconds:Fe==="Hour"?3600:86400,...we==="ON"?{source_orderType:ze,wallet_id:$e}:{extendedapikey:be,x10publickey:Be,x10privatekey:Qe,x10vault:dt,orderType:De,tp:Number(kt),sl:Number(rn),direction:Je}},Pr={...se==="variational"&&{vr_token:G},coin:`${wt}`,orderPerHour:Number(Xt),leverage:Number(Jt),target_orderType:mt,cycleSeconds:Fe==="Hour"?3600:86400},ts={address:Wn.toLowerCase(),token:nr,slot_number:Number(Ce==null?void 0:Ce.replace("Extended-","")),source_app:"extended",source_params:Or,...we==="ON"?{target_app:se==="extended"?"extended":"variational_delta",target_params:Pr}:{}},Et=await(await fetch(`${Mt}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ts)})).json();Et!=null&&Et.success?(N(!0),gt(),bn&&cs()):sn((Et==null?void 0:Et.error_message)||"Start failed.")}catch(nr){sn(nr.message||"An error occurred while saving.")}finally{Nn(!1)}}async function es(){if(!y){n(!0);return}try{Oe(!0),sn("");const lt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!lt||!Bt){n(!0);return}const Wn=await(await fetch(`${Mt}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Bt.toLowerCase(),token:lt,source_app:"extended",slot_number:lr,...we==="ON"?{target_app:se==="extended"?"extended":"variational_delta"}:{}})})).json();Wn!=null&&Wn.success?(N(!1),gt()):sn((Wn==null?void 0:Wn.error_message)||"Stop failed.")}catch(lt){sn(lt.message||"An error occurred while stopping.")}finally{Oe(!1)}}const Ys=lt=>{ae(lt??"variational"),V(!1)},_s=[{value:"variational",label:"Variational"}];function br(lt){try{const Bt=lt.split(".");if(Bt.length!==3)throw new Error("Invalid JWT format");const Wn=Bt[1].replace(/-/g,"+").replace(/_/g,"/"),Or=decodeURIComponent(atob(Wn).split("").map(Pr=>"%"+("00"+Pr.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(Or)}catch{return null}}const zt={control:(lt,Bt)=>({...lt,backgroundColor:"#242424",borderColor:Bt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:lt=>({...lt,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:lt=>({...lt,height:32}),input:lt=>({...lt,color:"#FFFFFF",margin:0,padding:0}),singleValue:lt=>({...lt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:lt=>({...lt,color:"#7F7F7F",fontSize:"12px"}),menu:lt=>({...lt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:lt=>({...lt,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(lt,Bt)=>({...lt,backgroundColor:Bt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:lt=>({...lt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:lt=>({...lt,backgroundColor:"#353535"})},he=({max:lt})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[lt,"x"]}),it=lt=>{var Bt;return i.jsx(Sa.Option,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Bt=lt.data)!=null&&Bt.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:"w-4 h-4 rounded-[4px]",onError:nr=>nr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:lt.data.label}),i.jsx(he,{max:lt.data.maxLeverage})]})})},Ct=lt=>{var Bt;return i.jsx(Sa.SingleValue,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Bt=lt.data)!=null&&Bt.icon?i.jsx("img",{src:lt.data.icon,alt:lt.data.label,className:"w-4 h-4 rounded-[4px]",onError:nr=>nr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:lt.data.label}),i.jsx(he,{max:lt.data.maxLeverage})]})})},vt=lt=>{const Bt=ss.includes(lt.data.value);return i.jsx(Sa.Option,{...lt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:lt.data.label}),Bt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},ln=lt=>i.jsx(Sa.SingleValue,{...lt,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:lt.data.label})})}),xn=m.useMemo(()=>ie.map(lt=>{const Bt=(lt==null?void 0:lt.wallet_name)??(lt==null?void 0:lt.name)??(lt==null?void 0:lt.label)??String(lt==null?void 0:lt.wallet_id),nr=(lt==null?void 0:lt.version)===3?`${Bt} - (API-AGENT) Wallet`:Bt;return{value:(lt==null?void 0:lt.wallet_id)??(lt==null?void 0:lt.id)??(lt==null?void 0:lt.value)??"",label:nr,raw:lt}}),[ie]),dr=m.useMemo(()=>{var lt;return(lt=xn.find(Bt=>String(Bt.value)===String($e)))==null?void 0:lt.raw},[xn,$e]);m.useMemo(()=>{const lt=dr||{};return lt.address||lt.evm_address||lt.wallet_address||lt.public_address||lt.eth_address||lt.addr||null},[dr]);const Er=lt=>i.jsxs(Sa.MenuList,{...lt,children:[i.jsxs("div",{onClick:()=>{lt.selectProps.setIsGenWalletModal(!0)},className:"mx-2 mt-2 mb-1 px-3 py-2 bg-[#7445ff] hover:bg-[#5834C3] rounded-md text-white text-[13px] font-medium cursor-pointer flex items-center gap-2",children:[i.jsx("span",{className:"text-[18px] leading-none",children:"+"}),"Add Account"]}),i.jsx("div",{className:"h-px bg-[#353535] my-1 mx-2"}),lt.children]}),pr=async()=>{var nr,Wn,Or,Pr,ts,Ls,Et,or;const lt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!(!lt||!Bt))try{Vn(!0);const Hn=await ki(Bt.toLowerCase(),lt);Hn!=null&&Hn.success?(r(Hn==null?void 0:Hn.telegram_chat_id),s(Hn==null?void 0:Hn.subscriber_role),a(Hn==null?void 0:Hn.subs_expire_day),o((nr=Hn==null?void 0:Hn.mushboomer_counts)==null?void 0:nr.eth),l((Wn=Hn==null?void 0:Hn.mushboomer_counts)==null?void 0:Wn.sol),c(Hn==null?void 0:Hn.referral_code),u(Hn==null?void 0:Hn.refcode),d(Hn==null?void 0:Hn.whitelist),f(lt),x(Bt),B(!0),T((Pr=(Or=Hn==null?void 0:Hn.slots_info)==null?void 0:Or.extended)==null?void 0:Pr.total_qty),L((Ls=(ts=Hn==null?void 0:Hn.slots_info)==null?void 0:ts.extended)==null?void 0:Ls.total_qty),F((or=(Et=Hn==null?void 0:Hn.slots_info)==null?void 0:Et.extended)==null?void 0:or.active_qty),Vn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),Vn(!1))}catch(Hn){console.error("Token verification error:",Hn),console.error(Hn.message||"An unknown error occurred."),Vn(!1)}},fr=async()=>new _l(window.ethereum).eth.getAccounts(Bt=>Bt),Yr=async(lt="extended",Bt=24,nr=5e3)=>{Bt<=0||(await new Promise(Wn=>setTimeout(Wn,nr)),await pr(),lt==="extended"&&!I&&Yr(lt,Bt-1,nr))},is=async()=>{Qn("");const lt=window.localStorage.getItem("hyperToken"),Bt=window.localStorage.getItem("hyperAddress");if(!lt||!g){n(!0);return}S(!0),h(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Or){console.error("Failed to switch network",Or),h(!1);return}const nr=new _l(window.ethereum);var Wn=await fr();if(Wn.length>0?Wn=Wn[0]:Wn=void 0,Wn){const Pr={from:Wn,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await nr.eth.sendTransaction(Pr).then(ts=>{console.log("txHash :>> ",ts),h(!1),k(ts.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:g?g.toLowerCase():Bt,token:lt,payment_tx:ts.transactionHash,payment_role:"farming_tools"})}),pr(),Yr("extended")}).catch(ts=>{console.log(ts),ts.code===-32003||ts.message.includes("insufficient funds")?Qn("Insufficient funds."):ts.message==="MetaMask Tx Signature: User denied transaction signature."&&S(!1)})}else await nr.eth.requestAccounts()},Ir=m.useMemo(()=>Array.from({length:P},(lt,Bt)=>({value:`Extended-${Bt+1}`,label:`Extended-${Bt+1}`})),[P]);if(!t)return null;const yr=Kn||Xn||on||yn,Jn=C&&!on,gs=ct(wt),Zs=z===ne;return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:p,setOpen:S,transactionHash:_,transactionLoading:Ee,paymentPresaleRole:I,errorFunds:jt,activeMethod:2}),i.jsx(O5,{open:oe,setOpen:de,paymentLighterRole:I,oldSlotCount:fe,checkAccountLighter:pr,tradeMarket:"extended"}),ut&&Aa.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:ut,setOpen:yt,handleListRequest:Wt,handlePageChange:()=>{},source:"EXTENDED"})}),document.body),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!yr&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"extended",onCloseCurrent:()=>!yr&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:"https://app.extended.exchange/assets/logo/extended-long.svg",alt:"Extended",className:"h-[20px] text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859]",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Extended Farming module lets you set up automated farming by providing your Extended Token, selecting a pair, defining orders per hour, leverage, direction and order type ."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/extended-farming-module#getting-your-api-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[Zt&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:Zt==="Get more slots to run Delta Neutral with Variational"?i.jsxs(i.Fragment,{children:[i.jsx("span",{children:Zt}),i.jsx("button",{onClick:()=>{window.open("#variational-farming","_self")},className:"bg-[#67FFBD]/10 text-[#67FFBD] border border-[#67FFBD]/30 hover:bg-[#67FFBD]/20 text-[11px] px-2 py-[3px] rounded-md transition-colors ml-4",children:"Variational Farming"})]}):i.jsx("span",{children:Zt})}),y&&I&&$===M&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:`No free Extended slots. All ${(Ir==null?void 0:Ir.length)||$} in use.`}),y&&Zs&&se==="variational"&&!C&&we==="ON"&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:i.jsxs(i.Fragment,{children:[i.jsx("span",{children:'"No Variational slots available. Purchase Variational slot."'}),i.jsx("button",{onClick:()=>{window.open("#variational-farming","_self"),e(!1)},className:"bg-[#67FFBD]/10 text-[#67FFBD] border border-[#67FFBD]/30 hover:bg-[#67FFBD]/20 text-[11px] px-2 py-[3px] rounded-md transition-colors ml-4",children:"Variational Farming"})]})}),y&&!I&&i.jsx("div",{className:"px-5",children:i.jsxs("div",{className:"flex flex-col items-center justify-start sm:flex-row sm:items-center sm:justify-between gap-2.5 rounded-[12px] border border-[#2A2A2A] bg-[#1f1f1f] px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("img",{src:rc,alt:"",className:""}),i.jsx("span",{className:"text-[#FF797C] text-[12px] leading-4 font-manrope -mb-0.5",children:"You need an active subscription to start farming. Please complete your subscription first to unlock bot. Make sure you have sufficient Ethereum funds on the Ethereum Mainnet."})]}),i.jsx("div",{onClick:()=>{is()},className:"flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Subscribe / 0.12 ETH"})]})}),y&&I&&i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-4 sm:px-5",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[M||0,"/",Ir.length]})]})]}),i.jsx(jl,{styles:zt,components:{Option:vt,SingleValue:ln},options:Ir,value:Ir.find(lt=>lt.value===Ce)||null,onChange:lt=>me((lt==null?void 0:lt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsx("div",{className:"flex justify-end items-end w-full ",children:i.jsxs("div",{onClick:lt=>{lt.preventDefault(),y?yt(!0):n(!0)},className:"h-6 sm:h-8 pl-2 sm:pl-3 pr-4 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] inline-flex justify-center items-center gap-1.5 cursor-pointer w-max",children:[i.jsx("span",{className:"text-[18px] leading-none",children:"+"}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] min-w-max",children:"Add Account"})]})})]}),i.jsxs("div",{className:"py-1 space-y-3 px-3 sm:px-5",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[we==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"}),i.jsx("span",{className:"rounded-md w-max text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] bg-[#353535] px-2 h-6 flex items-center",children:"Extended"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Wallet"}),i.jsxs("div",{className:"relative",children:[i.jsx(jl,{styles:zt,isDisabled:yr||_e||Jn,isLoading:_e,options:xn,components:{MenuList:Er},setIsGenWalletModal:yt,value:xn.find(lt=>String(lt.value)===String($e))||null,onChange:lt=>{Jn||Ue((lt==null?void 0:lt.value)??"")},placeholder:y?_e?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{y||n(!0)},menuIsOpen:y?void 0:!1}),!y&&i.jsx("button",{type:"button",onClick:()=>n(!0),className:"absolute inset-0 rounded-md cursor-pointer bg-transparent","aria-label":"Connect to select",title:"Connect"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Order Type"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":ze==="LIMIT",onClick:()=>!Jn&&rt("LIMIT"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",yr||Jn?"cursor-not-allowed":"cursor-pointer",ze==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",ze==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":ze==="HYBRID",onClick:()=>!Jn&&rt("HYBRID"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",yr||Jn?"cursor-not-allowed":"cursor-pointer",ze==="HYBRID"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["HYBRID ",ze==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":ze==="MARKET",onClick:()=>!Jn&&rt("MARKET"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",yr||Jn?"cursor-not-allowed":"cursor-pointer",ze==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",ze==="MARKET"?" ✓":""]})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/extended-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:be,onChange:lt=>je(lt.target.value),autoComplete:"off",placeholder:"API_KEY",type:en?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),i.jsx("button",{type:"button",onClick:()=>Pn(lt=>!lt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:en?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stark Key Public"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Be,onChange:lt=>ht(lt.target.value),autoComplete:"off",placeholder:"STARK_KEY_PUBLIC",type:tr?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),i.jsx("button",{type:"button",onClick:()=>ar(lt=>!lt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:tr?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),we==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:[i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"}),i.jsx("div",{children:i.jsxs("div",{ref:ee,className:"relative w-[120px]",children:[i.jsxs("div",{className:`${yr||Jn?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-6 flex items-center justify-between`,onClick:lt=>{lt.preventDefault(),yr||Jn||V(!W)},children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:(On=_s==null?void 0:_s.find(lt=>(lt==null?void 0:lt.value)===se))==null?void 0:On.label}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${W?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),W&&i.jsx("div",{className:"absolute z-10 mt-1 w-full bg-[#353535] rounded-md shadow-lg overflow-hidden p-1",children:i.jsx("div",{className:"flex flex-col gap-[2px] max-h-[170px] overflow-y-auto",children:_s==null?void 0:_s.map((lt,Bt)=>i.jsxs("div",{onClick:nr=>{nr.preventDefault(),yr||Jn||Ys(lt==null?void 0:lt.value)},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] min-w-max gap-1 ${(lt==null?void 0:lt.value)===se?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${yr||Jn?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsx("span",{className:"text-white",children:lt==null?void 0:lt.label}),(lt==null?void 0:lt.value)===se&&i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-[#1de674]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},Bt))})})]})})]}),se==="extended"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:pt,onChange:lt=>Gt(lt.target.value),autoComplete:"off",placeholder:"2nd Stark key Public",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${pt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/extended-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Ie,onChange:lt=>Re(lt.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:Ft?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ie===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),i.jsx("button",{type:"button",onClick:()=>En(lt=>!lt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:Ft?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index 2"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:nt,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return Le("");fn(Bt)&&Le(Bt)},onKeyDown:Ge,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX_2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn})})]})]}),se==="variational"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Variational Token"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/variational-omni-farming-module#getting-your-variational-token",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Variational Token?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:G,onChange:lt=>{const Bt=lt.target.value;if(re(Bt),!Bt.trim()){ue(null),Ae("");return}const nr=br(Bt);if(nr&&(nr!=null&&nr.exp)){const Wn=new Date((nr==null?void 0:nr.exp)*1e3);ue(Wn),Ae("")}else nr?(ue(null),Ae("The token's expiration date could not be found.")):(ue(null),Ae("Invalid token format."))},type:ke?"text":"password",autoComplete:"off",placeholder:"Variational_Token",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${G===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),ce&&i.jsxs("div",{className:"text-[12px] mt-1 pl-[3px] flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-[#CECECE] font-medium",children:"Valid Until:"})," ",i.jsx("span",{className:"text-[11px] font-semibold "+(qe?"text-[#FF797C]":"text-[#F8D4AB]"),children:ce==null?void 0:ce.toLocaleString("en-US",{dateStyle:"medium",timeStyle:"short"})}),qe&&i.jsx("span",{children:i.jsx("img",{src:rc,alt:"",className:"w-3.5 h-3.5"})})]}),ge&&i.jsx("div",{className:"text-[10px] text-[#FF797C] mt-[2px] pl-[3px]",children:ge}),i.jsx("button",{type:"button",onClick:()=>Me(lt=>!lt),className:"absolute right-1 top-4 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:ke?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Order Type"}),i.jsx("div",{className:"flex items-center gap-3",children:i.jsx("button",{"aria-pressed":mt==="MARKET",className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2","cursor-not-allowed",mt==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",mt==="MARKET"?" ✓":""]})})})]})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stark Key Private"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:Qe,onChange:lt=>Ke(lt.target.value),autoComplete:"off",placeholder:"STARK_KEY_PRIVATE",type:hr?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Qe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),i.jsx("button",{type:"button",onClick:()=>qt(lt=>!lt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:hr?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Vault Number"}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:dt,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return tt("");fn(Bt)&&tt(Bt)},onKeyDown:Ge,inputMode:"numeric",autoComplete:"off",placeholder:"VAULT_NUMBER",type:zn?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${dt===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:yr||Jn}),i.jsx("button",{type:"button",onClick:()=>Zn(lt=>!lt),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:yr||Jn,children:zn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:zt,components:{Option:it,SingleValue:Ct},isDisabled:yr||Jn,options:ur,value:ur.find(lt=>lt.value===wt)||null,onChange:lt=>nn((lt==null?void 0:lt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:" space-y-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:Fe,onChange:lt=>at(lt.target.value),className:`${yr||Jn?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:yr||Jn,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:Xt,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return an("");fn(Bt)&&an(Bt)},onKeyDown:Ge,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 120)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Xt===""?"border-[#353535]":Yn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||Jn}),Xt!==""&&!Yn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${we==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:we==="ON"?"On":"Off"}),i.jsx(Io,{checked:we==="ON",onChange:lt=>xe(lt?"ON":"OFF"),disabled:yr||Jn,className:`${we==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${yr||Jn?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${we==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Jt,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return Ye("");fn(Bt)&&Ye(Bt)},onKeyDown:Ge,inputMode:"numeric",autoComplete:"off",placeholder:wt?`1–${gs}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Jt===""?"border-[#353535]":Fn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||Jn})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":Je==="LONG",onClick:()=>!Jn&&It("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",yr||Jn?"cursor-not-allowed":"cursor-pointer",Je==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",Jt?` - ${Jt}x`:""]})}),i.jsx("div",{"aria-pressed":Je==="SHORT",onClick:()=>!Jn&&It("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",yr||Jn?"cursor-not-allowed":"cursor-pointer",Je==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",Jt?` - ${Jt}x`:""]})}),i.jsx("div",{"aria-pressed":Je==="RANDOM",onClick:()=>!Jn&&It("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",yr||Jn?"cursor-not-allowed":"cursor-pointer",Je==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",Jt?` - ${Jt}x`:""]})})]})]}),i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("button",{"aria-pressed":De==="MARKET",className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2","cursor-not-allowed",De==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:[i.jsxs("span",{children:["MARKET ",De==="MARKET"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]}),i.jsx("button",{"aria-pressed":De==="LIMIT",onClick:()=>!Jn&&At("LIMIT"),className:["inline-flex flex-col justify-center items-center h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",yr||Jn?"cursor-not-allowed":"cursor-pointer",De==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",De==="LIMIT"?" ✓":""]})}),i.jsxs("button",{"aria-pressed":De==="RANDOM",className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2","cursor-not-allowed",De==="RANDOM"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:[i.jsxs("span",{children:["RANDOM ",De==="RANDOM"?" ✓":""]}),i.jsx("span",{className:"min-w-max text-[6px] -mt-[1px] text-[#FF9A3C]",children:"Coming Soon"})]})]})]})]}),i.jsxs("div",{className:`${we==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:kt,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return dn("");Tt(Bt)&&dn(Bt)},onKeyDown:Ge,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${kt===""?"border-[#353535]":Gn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||Jn})]}),kt!==""&&!Gn&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:rn,onChange:lt=>{const Bt=lt.target.value.trim();if(Bt==="")return gn("");Tt(Bt)&&gn(Bt)},onKeyDown:Ge,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${rn===""?"border-[#353535]":Sr?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:yr||Jn})]}),rn!==""&&!Sr&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Jt?Math.max(Jt*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),i.jsx("div",{className:`${we==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:i.jsxs("div",{className:`${we==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:we==="ON"?"On":"Off"}),i.jsx(Io,{checked:we==="ON",onChange:lt=>xe(lt?"ON":"OFF"),disabled:yr||Jn,className:`${we==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${yr||Jn?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${we==="ON"?"translate-x-3":"translate-x-0"}`})})]})]})})]}),i.jsx("div",{className:`${we==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!yr&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:yr,children:"Cancel"}),y?we==="ON"?C?i.jsx("button",{onClick:es,disabled:yr,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:on?"Stopping...":"Stop"}):i.jsx("button",{onClick:mr,disabled:!Sn||yr||se==="variational"&&Zs&&we==="ON",className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Sn||yr||se==="variational"&&Zs&&we==="ON"?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Xn?"Starting...":"Start"}):C?i.jsx("button",{onClick:es,disabled:yr,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:on?"Stopping...":"Stop"}):i.jsx("button",{onClick:mr,disabled:!Bn||yr,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!Bn||yr?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Xn?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),Kn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},HLe=({className:t})=>i.jsx("svg",{width:"128",viewBox:"0 0 836 114",version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("g",{id:"New-Logos",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:i.jsx("g",{id:"Dark_1080x1080",transform:"translate(-122, -183)",fill:"white",children:i.jsxs("g",{id:"paradex-white",transform:"translate(122.2947, 183)",fill:"white",children:[i.jsx("path",{d:"M94.6678094,15.1179294 C93.2804251,13.1247857 91.6650668,11.27494 89.8477888,9.60095989 C83.3993829,3.66712376 74.5149126,0.00651354131 64.6729517,0.00651354131 L0,0.00651354131 L7.88789853,13.7370586 C9.6335276,16.7723689 12.8642441,18.6417552 16.3620158,18.6417552 L35.2903668,18.6417552 L64.6794652,18.6091875 C68.9393212,18.6091875 72.7823106,20.1919781 75.5570792,22.7648269 C78.3448749,25.3181351 80.0709633,28.8615015 80.0709633,32.7631128 C80.0709633,40.5858759 73.1861502,46.9300651 64.6794652,46.9300651 L55.3651011,46.8974974 L12.1347275,46.8974974 L20.022626,60.6280425 C21.7682551,63.6633528 24.9989715,65.5327391 28.4967432,65.5327391 L32.3267055,65.5327391 C33.9681179,65.5327391 35.2968804,66.8615015 35.2968804,68.502914 L35.2968804,114 L50.4669181,102.288653 C52.8639013,100.438807 54.2643126,97.5793624 54.2643126,94.5570792 L54.2643126,68.5094275 C54.2643126,66.8680151 55.5930751,65.5392527 57.2344875,65.5392527 L64.6794652,65.5392527 C78.8268769,65.5392527 91.0397669,57.9444635 96.7781968,46.9365787 C99.018855,42.6506685 100.275968,37.843675 100.275968,32.7696263 C100.275968,26.2691121 98.2176894,20.2245458 94.6743229,15.1309565 L94.6678094,15.1179294 Z",id:"Path"}),i.jsx("polygon",{id:"Vector",fillRule:"nonzero",points:"835.410613 0.00651354131 811.890215 0.00651354131 789.933067 32.958519 767.975919 0.00651354131 744.455522 0.00651354131 778.176125 50.6037024 744.455522 101.207405 767.975919 101.207405 789.933067 68.2488858 811.890215 101.207405 835.410613 101.207405 801.690009 50.6037024"}),i.jsx("path",{d:"M633.673211,101.207405 L703.719834,101.207405 L703.719834,82.5786767 L633.673211,82.5786767 L633.673211,101.207405 Z M633.673211,18.6352417 L703.576536,18.6352417 L703.576536,0.00651354131 L633.673211,0.00651354131 L633.673211,18.6352417 L633.673211,18.6352417 Z M633.608076,59.9180665 L677.072937,59.9180665 L677.072937,41.2893384 L633.608076,41.2893384 L633.608076,59.9180665 Z",id:"Vector1"}),i.jsx("path",{d:"M595.712292,50.6037024 C595.712292,64.5882756 589.817537,77.2310593 580.281713,86.3825848 C570.745889,95.5471375 557.575508,101.207405 543.037284,101.207405 L515.185381,101.207405 L515.185381,82.5786767 L543.037284,82.5786767 C561.425011,82.5786767 576.32148,68.2619129 576.32148,50.6037024 C576.32148,41.7713404 572.595734,33.7857388 566.570709,27.9952005 C560.545683,22.2111759 552.227891,18.6287281 543.037284,18.6287281 L515.185381,18.6287281 L515.185381,0 L543.037284,0 C572.120246,0 595.712292,22.6475831 595.712292,50.6037024 Z",id:"Vector2",fillRule:"nonzero"}),i.jsx("polygon",{id:"Vector3",fillRule:"nonzero",points:"475.394157 101.200891 437.394157 0.00651354131 413.945409 0.00651354131 413.951922 0.00651354131 413.919354 0.00651354131 375.919354 101.207405 399.36159 101.207405 425.656756 31.1868358 451.951922 101.200891"}),i.jsx("path",{d:"M312.868275,63.943435 L338.017058,101.207405 L314.197037,101.207405 L290.136015,65.5262256 L257.483633,65.5262256 L257.483633,46.9300651 L301.684524,46.9300651 C310.360561,46.9300651 317.388672,40.5793624 317.388672,32.7565992 C317.388672,28.854988 315.643043,25.3181351 312.796626,22.7713404 C309.963235,20.1919781 306.042083,18.6091875 301.691038,18.6091875 L257.490146,18.6091875 L257.490146,0.0130270826 L301.691038,0.0130270826 C311.741432,0.0130270826 320.801768,3.68015084 327.386958,9.61398697 C329.23029,11.2814535 330.878216,13.1378128 332.298168,15.1244429 C335.919697,20.2245458 338.023571,26.2691121 338.023571,32.7565992 C338.023571,37.8371615 336.73389,42.6311279 334.447637,46.9300651 C330.181267,54.9482345 322.397585,61.17518 312.874788,63.943435 L312.868275,63.943435 Z",id:"Vector4",fillRule:"nonzero"}),i.jsx("polygon",{id:"Vector5",fillRule:"nonzero",points:"217.698922 101.200891 179.698922 0.00651354131 156.256687 0.00651354131 156.256687 0.00651354131 156.22412 0.00651354131 118.22412 101.207405 141.666355 101.207405 167.961521 31.1868358 194.256687 101.200891"})]})})})}),Cce=({open:t=!1,setOpen:e=()=>{}})=>{var Pt,Wt,ct;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr);ns();const[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(1),[T,M]=m.useState(0),[F,$]=m.useState(0),[L,z]=m.useState({}),[X,ne]=m.useState(null),[J,K]=m.useState("paradex");m.useState(!1),m.useRef(null);const[te,fe]=m.useState(!1),[q,se]=m.useState(""),[ae,W]=m.useState("OFF"),[V,ee]=m.useState(""),[oe,de]=m.useState(""),[Ce,me]=m.useState("");m.useState("");const[we,xe]=m.useState(""),[be,je]=m.useState(""),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState(""),[dt,tt]=m.useState([]),[nt,Le]=m.useState(""),[Be,ht]=m.useState(""),[pt,Gt]=m.useState("LONG"),[wt,nn]=m.useState("MARKET"),[cn,Un]=m.useState(""),[Xt,an]=m.useState(""),[Jt,Ye]=m.useState(""),[Je,It]=m.useState(!1),[hn,Yt]=m.useState(!1),[Rt,ot]=m.useState(!1),[De,At]=m.useState(!1),[ze,rt]=m.useState(""),[mt,Lt]=m.useState(""),[kt,dn]=m.useState(!0),[rn,gn]=m.useState(!1),[An,kn]=m.useState(!1),[yn,Vn]=m.useState(!1),[Kn,Dn]=m.useState(!1),[Xn,Nn]=m.useState(!1),[on,Oe]=m.useState(""),[Zt,sn]=m.useState(!0),[jt,Qn]=m.useState("Hour"),[bn,Dt]=m.useState("Limit"),[en,Pn]=m.useState("Limit"),tr="https://dextrabothypev2.nftinit.io",ar="";m.useEffect(()=>{async function Ge(){if(t)try{const fn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=paradex")).json();if(fn!=null&&fn.coins){const Yn=[...fn.coins].sort((Gn,Sr)=>(Sr.maxLeverage||0)-(Gn.maxLeverage||0)),Fn=Yn==null?void 0:Yn.map(Gn=>{const kr=`https://app.paradex.trade/static/market/${(Gn==null?void 0:Gn.label)||""}.svg`;return{...Gn,icon:kr}});tt(Fn)}}catch(Tt){console.error("Failed to fetch coin list:",Tt)}}Ge()},[t]);const hr=Ge=>{var Tt;return((Tt=dt.find(fn=>fn.value===Ge))==null?void 0:Tt.maxLeverage)??100},qt=Ge=>{["e","E","+","-"].includes(Ge.key)&&Ge.preventDefault()},zn=Ge=>/^\d*\.?\d{0,6}$/.test(Ge),Zn=Ge=>/^\d*$/.test(Ge),Ft=m.useMemo(()=>{if(nt==="")return!1;const Ge=Number(nt);return Number.isInteger(Ge)&&Ge>=1&&Ge<=180},[nt]),En=m.useMemo(()=>{if(Be==="")return!1;const Ge=Number(Be),Tt=hr(Qe);return Number.isInteger(Ge)&&Ge>=1&&Ge<=Tt},[Be,Qe,dt]),Ee=m.useMemo(()=>{if(cn==="")return!1;const Ge=Number(cn);return Number.isNaN(Ge)?!1:Ge===0?!0:Ge>=1&&Ge<=1e7},[cn]),h=m.useMemo(()=>{if(Xt==="")return!1;const Ge=Number(Xt);if(Number.isNaN(Ge))return!1;const Tt=Be===""?null:Number(Be),fn=Tt?Tt*100-1:4999;return Ge===0?!0:Ge>0&&Ge<1?!1:Ge>=1&&Ge<=fn},[Xt,Be]);m.useMemo(()=>{if(Jt==="")return!1;const Ge=Number(Jt);return!Number.isNaN(Ge)&&Ge>0&&Ge<=100},[Jt]);const p=g&&V.trim()!==""&&be.trim()!==""&&Qe!==""&&Ft&&En&&(!cn||Ee)&&(!Xt||h)&&(pt==="LONG"||pt==="SHORT"||pt==="RANDOM")&&(wt==="LIMIT"||wt==="MARKET"||wt==="HYBRID")&&Zt,S=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),_=()=>`paradexCreds:${S()}`,k=()=>{try{const Ge=localStorage.getItem(_());if(!Ge)return;const Tt=JSON.parse(Ge);Tt.privateKey&&ee(Tt.privateKey),Tt.paradexAddress&&je(Tt.paradexAddress),typeof Tt.remember=="boolean"&&dn(Tt.remember)}catch{}},I=()=>{if(kt)try{localStorage.setItem(_(),JSON.stringify({privateKey:V,paradexAddress:be,remember:!0}))}catch{}},B=()=>{try{localStorage.removeItem(_())}catch{}};m.useEffect(()=>{if(!t)return;const Ge=localStorage.getItem("hyperToken"),Tt=localStorage.getItem("hyperAddress");y(!!(Ge&&Tt));const fn=setInterval(()=>{const Yn=localStorage.getItem("hyperToken"),Fn=localStorage.getItem("hyperAddress");y(!!(Yn&&Fn))},800);return()=>clearInterval(fn)},[t]),m.useEffect(()=>{!t||!g||(G(),ut())},[t,g]),m.useEffect(()=>{t&&(Xt===""&&an(ar),cn===""&&Un(ar),Jt===""&&Ye(ar))},[t]),m.useEffect(()=>{if(!Qe)return;const Ge=hr(Qe),Tt=Number(Be);!Number.isNaN(Tt)&&Tt>Ge&&ht(String(Ge)),!Number.isNaN(Tt)&&Tt<1&&Be!==""&&ht("1")},[Qe]),m.useEffect(()=>{t&&(kt&&I(),kt||B())},[V,be,kt,t]);async function G(){var Ge,Tt,fn,Yn,Fn,Gn,Sr,ur;try{Yt(!0),rt("");const kr=window.localStorage.getItem("hyperToken"),Bn=window.localStorage.getItem("hyperAddress");if(!kr||!Bn){C(!1),k();return}const Mn=await(await fetch(`${tr}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Bn.toLowerCase(),token:kr})})).json();if(!(Mn!=null&&Mn.success)){if(console.warn("INFO API RESPONSE:",Mn==null?void 0:Mn.error_message),(Mn==null?void 0:Mn.error_message)==="You have not a running process"){const rr=q?q.toLowerCase().replace("-","_"):null,ls=L==null?void 0:L[rr];if(rr&&ls){const cs={...L,[rr]:{...ls,isStop:!0}};z(cs);const gt=Object.keys(cs).filter(Tn=>Tn.startsWith("paradex"));if(gt.length>0&&!q){const Tr=gt.sort((Lr,$r)=>{var ss,mr;const lr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10),wr=parseInt(((mr=$r.match(/\d+/))==null?void 0:mr[0])||0,10);return lr-wr})[0].match(/\d+/);Tr&&se(`Paradex-${Tr[0]}`)}}else se("Paradex-1")}Mn!=null&&Mn.slots_info&&($((Tt=(Ge=Mn==null?void 0:Mn.slots_info)==null?void 0:Ge.paradex)==null?void 0:Tt.total_qty),M((Yn=(fn=Mn==null?void 0:Mn.slots_info)==null?void 0:fn.paradex)==null?void 0:Yn.active_qty));return}if(Mn!=null&&Mn.success&&(Mn!=null&&Mn.data)){const rr=q?q.toLowerCase().replace("-","_"):null,ls=L==null?void 0:L[rr],cs=Mn.data||{};rr&&!cs[rr]&&ls&&(cs[rr]={...ls,isStop:!0}),z(cs);const gt=Object.keys(cs).filter(Tn=>Tn.startsWith("paradex"));if(gt.length>0&&!q){const Tr=gt.sort((Lr,$r)=>{var ss,mr;const lr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10),wr=parseInt(((mr=$r.match(/\d+/))==null?void 0:mr[0])||0,10);return lr-wr})[0].match(/\d+/);Tr&&se(`Paradex-${Tr[0]}`)}Mn!=null&&Mn.slots_info&&($((Gn=(Fn=Mn==null?void 0:Mn.slots_info)==null?void 0:Fn.paradex)==null?void 0:Gn.total_qty),M((ur=(Sr=Mn==null?void 0:Mn.slots_info)==null?void 0:Sr.paradex)==null?void 0:ur.active_qty))}}catch{C(!1),k(),W("OFF")}finally{Yt(!1)}}const re=m.useMemo(()=>q?q.toLowerCase().replace("-","_"):"",[q]),ce=!!((Pt=L==null?void 0:L[re])!=null&&Pt.delta)&&!!((Wt=L==null?void 0:L[re])!=null&&Wt.from_slot),ue=ce?`paradex_${(ct=L==null?void 0:L[re])==null?void 0:ct.from_slot}`:re;m.useEffect(()=>{var fn,Yn,Fn,Gn,Sr,ur,kr,Bn,Sn,Mn;if(!q||!L)return;const Ge=ue,Tt=L==null?void 0:L[Ge];if(!Tt){ee(""),je(""),Ke(""),Le(""),ht(""),Gt("LONG"),nn("LIMIT"),Dt("Limit"),Pn("Limit"),C(!1),W("OFF"),Qn("Hour"),Un(""),an(""),K("paradex");return}if((Tt==null?void 0:Tt.target_params)==null&&Tt.source_params){Tt!=null&&Tt.isStop?C(!1):C(!0),W("OFF");const rr=Tt.source_params,ls=(Tt==null?void 0:Tt.slot_number)??"";ls&&!ce&&se(`Paradex-${ls}`),rr!=null&&rr.cycleSeconds&&Qn((rr==null?void 0:rr.cycleSeconds)===86400?"Day":"Hour"),rr!=null&&rr.tp_type&&Dt(String(rr==null?void 0:rr.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),rr!=null&&rr.sl_type&&Pn(String(rr==null?void 0:rr.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const cs=(rr==null?void 0:rr.paradex_pkey)??"",et=(rr==null?void 0:rr.paradex_address)??"";if(cs&&ee(String(cs)),et&&je(String(et)),rr!=null&&rr.coin){const gt=String(rr.coin).replace(/-USD$/,"");Ke(gt)}(rr==null?void 0:rr.orderPerHour)!=null&&Le(String(rr.orderPerHour)),(rr==null?void 0:rr.leverage)!=null&&ht(String(rr.leverage)),rr!=null&&rr.direction&&Gt(String(rr.direction).toUpperCase()==="SHORT"?"SHORT":String(rr.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),rr!=null&&rr.orderType&&nn(String(rr.orderType).toUpperCase()==="MARKET"?"MARKET":String(rr.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(rr==null?void 0:rr.tp)!=null&&Un(String(rr.tp)),(rr==null?void 0:rr.sl)!=null&&an(String(rr.sl))}else if((Tt==null?void 0:Tt.target_params)!==null){Tt!=null&&Tt.isStop?C(!1):C(!0),W("OFF");const rr=(Tt==null?void 0:Tt.slot_number)??"";rr&&!ce&&se(`Paradex-${rr}`),(fn=Tt==null?void 0:Tt.source_params)!=null&&fn.coin&&Ke(String((Yn=Tt==null?void 0:Tt.source_params)==null?void 0:Yn.coin)),((Fn=Tt==null?void 0:Tt.source_params)==null?void 0:Fn.orderPerHour)!=null&&Le(String((Gn=Tt==null?void 0:Tt.source_params)==null?void 0:Gn.orderPerHour)),((Sr=Tt==null?void 0:Tt.source_params)==null?void 0:Sr.leverage)!=null&&ht(String((ur=Tt==null?void 0:Tt.source_params)==null?void 0:ur.leverage)),(kr=Tt==null?void 0:Tt.source_params)!=null&&kr.accountType&&setStatusType(((Bn=Tt==null?void 0:Tt.source_params)==null?void 0:Bn.accountType)==="standart"?"STANDARD":"PREMIUM"),(Sn=Tt==null?void 0:Tt.target_params)!=null&&Sn.accountType&&setStatusTypeTwo(((Mn=Tt==null?void 0:Tt.target_params)==null?void 0:Mn.accountType)==="standart"?"STANDARD":"PREMIUM"),Tt!=null&&Tt.target_app&&K(((Tt==null?void 0:Tt.target_app)==="paradex","paradex"))}else C(!1),W("OFF")},[q,L,ce,ue]);const ge=Ge=>{var Tt;return Number(((Tt=String(Ge||"").match(/\d+/))==null?void 0:Tt[0])||0)},Ae=Ge=>(Ge||"").toLowerCase().replace("-","_"),ke=m.useMemo(()=>{const Ge=L==null?void 0:L[Ae(q)];if(Ge!=null&&Ge.delta&&(Ge!=null&&Ge.from_slot))return Number(Ge.from_slot);const Tt=Number(Ge==null?void 0:Ge.slot_number);return Number.isFinite(Tt)?Tt:ge(q)},[q,L]),Me=m.useMemo(()=>{const Ge=Number(N)||0,Tt=Array.from({length:Ge},()=>({used:!1,kind:null})),fn=L||{};for(const[Yn,Fn]of Object.entries(fn)){if(!Yn.startsWith("paradex"))continue;const Gn=ge(Yn)-1;Gn<0||Gn>=Ge||((Fn==null?void 0:Fn.isStop)===!0?Tt[Gn]={used:!1,kind:null}:Fn!=null&&Fn.source_params?Tt[Gn]={used:!0,kind:"delta-src"}:Fn!=null&&Fn.target_params||Fn!=null&&Fn.delta?Tt[Gn]={used:!0,kind:"delta-shadow"}:Fn!=null&&Fn.farming_params?Tt[Gn]={used:!0,kind:"single"}:Tt[Gn]={used:!0,kind:"unknown"})}return Tt},[L,N]),qe=m.useMemo(()=>Me.map((Ge,Tt)=>Ge.used&&Ge.kind!=="delta-src-inferred"?`Paradex-${Tt+1}`:null).filter(Boolean),[Me]);m.useMemo(()=>Me.filter(Ge=>!Ge.used).length,[Me]);async function Fe(){if(!g){n(!0);return}if(p)try{ot(!0),rt("");const Ge=window.localStorage.getItem("hyperToken"),Tt=window.localStorage.getItem("hyperAddress");if(!Ge||!Tt){n(!0);return}const fn={paradex_address:be,paradex_pkey:V,cycleSeconds:jt==="Hour"?3600:86400,tp_type:bn.toUpperCase(),sl_type:en.toUpperCase(),tp:Number(cn),sl:Number(Xt),coin:`${Qe}`,orderPerHour:Number(nt),leverage:Number(Be),direction:pt,orderType:wt},Yn={api_pkey:oe,login_wallet:Ie,coin:Qe==null?void 0:Qe.replace("USDT",""),orderPerHour:Number(nt),leverage:Number(Be)},Fn={address:Tt.toLowerCase(),token:Ge,slot_number:Number(q==null?void 0:q.replace("Paradex-","")),source_app:"paradex",source_params:fn},Sr=await(await fetch(`${tr}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fn)})).json();Sr!=null&&Sr.success?(C(!0),G(),kt&&I()):rt((Sr==null?void 0:Sr.error_message)||"Start failed.")}catch(Ge){rt(Ge.message||"An error occurred while saving.")}finally{ot(!1)}}async function at(){if(!g){n(!0);return}try{At(!0),rt("");const Ge=window.localStorage.getItem("hyperToken"),Tt=window.localStorage.getItem("hyperAddress");if(!Ge||!Tt){n(!0);return}const Yn=await(await fetch(`${tr}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Tt.toLowerCase(),token:Ge,source_app:"paradex",slot_number:ke})})).json();Yn!=null&&Yn.success?(C(!1),G()):rt((Yn==null?void 0:Yn.error_message)||"Stop failed.")}catch(Ge){rt(Ge.message||"An error occurred while stopping.")}finally{At(!1)}}const ie={control:(Ge,Tt)=>({...Ge,backgroundColor:"#242424",borderColor:Tt.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:Ge=>({...Ge,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Ge=>({...Ge,height:32}),input:Ge=>({...Ge,color:"#FFFFFF",margin:0,padding:0}),singleValue:Ge=>({...Ge,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Ge=>({...Ge,color:"#7F7F7F",fontSize:"12px"}),menu:Ge=>({...Ge,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Ge=>({...Ge,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(Ge,Tt)=>({...Ge,backgroundColor:Tt.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Ge=>({...Ge,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Ge=>({...Ge,backgroundColor:"#353535"})},Se=({max:Ge})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[Ge,"x"]}),$e=Ge=>{var Tt;return i.jsx(Sa.Option,{...Ge,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Tt=Ge.data)!=null&&Tt.icon?i.jsx("img",{src:Ge.data.icon,alt:Ge.data.label,className:"w-4 h-4 rounded-[4px]",onError:fn=>fn.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:Ge.data.label}),i.jsx(Se,{max:Ge.data.maxLeverage})]})})},Ue=Ge=>{var Tt;return i.jsx(Sa.SingleValue,{...Ge,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Tt=Ge.data)!=null&&Tt.icon?i.jsx("img",{src:Ge.data.icon,alt:Ge.data.label,className:"w-4 h-4 rounded-[4px]",onError:fn=>fn.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:Ge.data.label}),i.jsx(Se,{max:Ge.data.maxLeverage})]})})},_e=Ge=>{const Tt=qe.includes(Ge.data.value);return i.jsx(Sa.Option,{...Ge,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:Ge.data.label}),Tt&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},st=Ge=>i.jsx(Sa.SingleValue,{...Ge,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:Ge.data.label})})}),ut=async()=>{var fn,Yn,Fn,Gn,Sr,ur,kr,Bn;const Ge=window.localStorage.getItem("hyperToken"),Tt=window.localStorage.getItem("hyperAddress");if(!(!Ge||!Tt))try{It(!0);const Sn=await ki(Tt.toLowerCase(),Ge);Sn!=null&&Sn.success?(r(Sn==null?void 0:Sn.telegram_chat_id),s(Sn==null?void 0:Sn.subscriber_role),a(Sn==null?void 0:Sn.subs_expire_day),o((fn=Sn==null?void 0:Sn.mushboomer_counts)==null?void 0:fn.eth),l((Yn=Sn==null?void 0:Sn.mushboomer_counts)==null?void 0:Yn.sol),c(Sn==null?void 0:Sn.referral_code),u(Sn==null?void 0:Sn.refcode),d(Sn==null?void 0:Sn.whitelist),f(Ge),x(Tt),sn(!0),P((Gn=(Fn=Sn==null?void 0:Sn.slots_info)==null?void 0:Fn.paradex)==null?void 0:Gn.total_qty),$((ur=(Sr=Sn==null?void 0:Sn.slots_info)==null?void 0:Sr.paradex)==null?void 0:ur.total_qty),M((Bn=(kr=Sn==null?void 0:Sn.slots_info)==null?void 0:kr.paradex)==null?void 0:Bn.active_qty),It(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),It(!1))}catch(Sn){console.error("Token verification error:",Sn),console.error(Sn.message||"An unknown error occurred."),It(!1)}},yt=dt,Mt=m.useMemo(()=>Array.from({length:N},(Ge,Tt)=>({value:`Paradex-${Tt+1}`,label:`Paradex-${Tt+1}`})),[N]);if(!t)return null;const Kt=hn||Rt||De||Je,un=v&&!De,Xe=hr(Qe);return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:Xn,setOpen:Nn,transactionHash:on,transactionLoading:Kn,paymentPresaleRole:Zt,errorFunds:mt,activeMethod:2}),i.jsx(O5,{open:te,setOpen:fe,paymentLighterRole:Zt,oldSlotCount:X,checkAccountLighter:ut,tradeMarket:"paradex"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Kt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"paradex",onCloseCurrent:()=>!Kt&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-3",children:[i.jsx(HLe,{className:"text-white"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] -mt-1",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Paradex Farming module lets you set up automated farming by providing your Paradex Address, Paradex Private Key, selecting a pair, defining trade per hour, leverage, direction, order type, take profit and stop loss."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[ze&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:ze}),g&&Zt&&F===T&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:"No free Paradex slots."}),g&&Zt&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-4 sm:px-5",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[T||0,"/",Mt.length]})]})]}),i.jsx(jl,{styles:ie,components:{Option:_e,SingleValue:st},options:Mt,value:Mt.find(Ge=>Ge.value===q)||null,onChange:Ge=>se((Ge==null?void 0:Ge.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${ae==="ON"?"py-1":"py-5"} space-y-3 px-3 sm:px-5`,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:Ge=>je(Ge.target.value),autoComplete:"off",placeholder:"1st Stark Key Public ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:Ge=>ee(Ge.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:rn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un}),i.jsx("button",{type:"button",onClick:()=>gn(Ge=>!Ge),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kt||un,children:rn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return me("");Zn(Tt)&&me(Tt)},onKeyDown:qt,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Paradex Adress"})}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:be,onChange:Ge=>je(Ge.target.value),autoComplete:"off",placeholder:"PARADEX_ADDRESS",type:An?"text":"password",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un}),i.jsx("button",{type:"button",onClick:()=>kn(Ge=>!Ge),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kt||un,children:An?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-col gap-2 relative",children:[i.jsxs("div",{onClick:()=>window.open("https://app.paradex.trade/r/dextrabot","_blank"),className:"absolute -top-6 left-0 w-max inline-flex items-center gap-2 px-2 py-0.5 rounded-full text-xs font-medium text-zinc-300 bg-[#242424] border border-[#353535] cursor-pointer hover:bg-[#2e2e2e] hover:text-white transition",children:[i.jsx("span",{children:"Open Paradex Account"}),i.jsx(AOe,{className:"w-3.5 h-3.5"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Paradex Private Key?"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:Ge=>ee(Ge.target.value),autoComplete:"off",placeholder:"PARADEX_PRIVATE_KEY",type:rn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un}),i.jsx("button",{type:"button",onClick:()=>gn(Ge=>!Ge),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kt||un,children:rn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ie,onChange:Ge=>Re(Ge.target.value),autoComplete:"off",placeholder:"2nd Stark key Public",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ie===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/paradex-farming-module#getting-your-paradex-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:Ge=>de(Ge.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:yn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un}),i.jsx("button",{type:"button",onClick:()=>Vn(Ge=>!Ge),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Kt||un,children:yn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index 2"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:we,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return xe("");Zn(Tt)&&xe(Tt)},onKeyDown:qt,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX_2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Kt||un})})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:nt,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return Le("");Zn(Tt)&&Le(Tt)},onKeyDown:qt,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":Ft?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kt||un}),nt!==""&&!Ft&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:ie,components:{Option:$e,SingleValue:Ue},isDisabled:Kt||un,options:yt,value:yt.find(Ge=>Ge.value===Qe)||null,onChange:Ge=>Ke((Ge==null?void 0:Ge.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:jt,onChange:Ge=>Qn(Ge.target.value),className:`${Kt||un?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Kt||un,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:nt,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return Le("");Zn(Tt)&&Le(Tt)},onKeyDown:qt,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":Ft?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kt||un}),nt!==""&&!Ft&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Io,{checked:ae==="ON",onChange:Ge=>W(Ge?"ON":"OFF"),disabled:Kt||un,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${Kt||un?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Be,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return ht("");Zn(Tt)&&ht(Tt)},onKeyDown:qt,inputMode:"numeric",autoComplete:"off",placeholder:Qe?`1–${Xe}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Be===""?"border-[#353535]":En?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kt||un})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":pt==="LONG",onClick:()=>!un&&Gt("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Kt||un?"cursor-not-allowed":"cursor-pointer",pt==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",Be?` - ${Be}x`:""]})}),i.jsx("div",{"aria-pressed":pt==="SHORT",onClick:()=>!un&&Gt("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Kt||un?"cursor-not-allowed":"cursor-pointer",pt==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",Be?` - ${Be}x`:""]})}),i.jsx("div",{"aria-pressed":pt==="RANDOM",onClick:()=>!un&&Gt("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Kt||un?"cursor-not-allowed":"cursor-pointer",pt==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",Be?` - ${Be}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":wt==="LIMIT",onClick:()=>!un&&nn("LIMIT"),className:["inline-flex flex-col justify-center items-center h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Kt||un?"cursor-not-allowed":"cursor-pointer",wt==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",wt==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":wt==="HYBRID",onClick:()=>!un&&nn("HYBRID"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Kt||un?"cursor-not-allowed":"cursor-pointer",wt==="HYBRID"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["HYBRID ",wt==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":wt==="MARKET",onClick:()=>!un&&nn("MARKET"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Kt||un?"cursor-not-allowed":"cursor-pointer",wt==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",wt==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("select",{value:bn,onChange:Ge=>Dt(Ge.target.value),className:`${Kt||un?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Kt||un,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:cn,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return Un("");zn(Tt)&&Un(Tt)},onKeyDown:qt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${cn===""?"border-[#353535]":Ee?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kt||un})]}),cn!==""&&!Ee&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("select",{value:en,onChange:Ge=>Pn(Ge.target.value),className:`${Kt||un?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Kt||un,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:Xt,onChange:Ge=>{const Tt=Ge.target.value.trim();if(Tt==="")return an("");zn(Tt)&&an(Tt)},onKeyDown:qt,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Xt===""?"border-[#353535]":h?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Kt||un})]}),Xt!==""&&!h&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Be?Math.max(Be*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),i.jsx("div",{className:`${ae==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Kt&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:Kt,children:"Cancel"}),g?ae==="ON"?v?i.jsx("button",{onClick:at,disabled:Kt,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:Fe,disabled:!p||Kt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Kt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Rt?"Starting...":"Start"}):v?i.jsx("button",{onClick:at,disabled:Kt,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:Fe,disabled:!p||Kt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!p||Kt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Rt?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),hn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},Sce=({open:t=!1,setOpen:e=()=>{}})=>{var Xe,Pt,Wt;const{setSignModalOpen:n,setTelegramChatId:r,setSubscriberRole:s,setSubsExpireDay:a,setMushboomerETH:o,setMushboomerSOL:l,setIsReferralCode:c,setIsReferralCodeName:u,setIsWhitelist:d,setHyperToken:f,setHyperAddress:x}=m.useContext(Qr);ns();const[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(1),[T,M]=m.useState(0),[F,$]=m.useState(0),[L,z]=m.useState({}),[X,ne]=m.useState(null),[J,K]=m.useState("pacifica");m.useState(!1),m.useRef(null);const[te,fe]=m.useState(!1),[q,se]=m.useState(""),[ae,W]=m.useState("OFF"),[V,ee]=m.useState(""),[oe,de]=m.useState(""),[Ce,me]=m.useState("");m.useState("");const[we,xe]=m.useState(""),[be,je]=m.useState(""),[Ie,Re]=m.useState(""),[Qe,Ke]=m.useState(""),[dt,tt]=m.useState([]),[nt,Le]=m.useState(""),[Be,ht]=m.useState(""),[pt,Gt]=m.useState("LONG"),[wt,nn]=m.useState("LIMIT"),[cn,Un]=m.useState(""),[Xt,an]=m.useState(""),[Jt,Ye]=m.useState(""),[Je,It]=m.useState(!1),[hn,Yt]=m.useState(!1),[Rt,ot]=m.useState(!1),[De,At]=m.useState(!1),[ze,rt]=m.useState(""),[mt,Lt]=m.useState(""),[kt,dn]=m.useState(!0),[rn,gn]=m.useState(!1),[An,kn]=m.useState(!1),[yn,Vn]=m.useState(!1),[Kn,Dn]=m.useState(!1),[Xn,Nn]=m.useState(""),[on,Oe]=m.useState(!0),[Zt,sn]=m.useState("Hour"),[jt,Qn]=m.useState("Limit"),[bn,Dt]=m.useState("Limit"),en="https://dextrabothypev2.nftinit.io",Pn="";m.useEffect(()=>{async function ct(){if(t)try{const Tt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=pacifica")).json();if(Tt!=null&&Tt.coins){let fn=Tt.coins.map(Yn=>{const Sr=`https://app.pacifica.fi/imgs/tokens/${(Yn==null?void 0:Yn.label)||""}.svg`;return{...Yn,icon:Sr}});tt(fn)}}catch(Ge){console.error("Failed to fetch coin list:",Ge)}}ct()},[t]);const tr=ct=>{var Ge;return((Ge=dt.find(Tt=>Tt.value===ct))==null?void 0:Ge.maxLeverage)??100},ar=ct=>{["e","E","+","-"].includes(ct.key)&&ct.preventDefault()},hr=ct=>/^\d*\.?\d{0,6}$/.test(ct),qt=ct=>/^\d*$/.test(ct),zn=m.useMemo(()=>{if(nt==="")return!1;const ct=Number(nt);return Number.isInteger(ct)&&ct>=1&&ct<=180},[nt]),Zn=m.useMemo(()=>{if(Be==="")return!1;const ct=Number(Be),Ge=tr(Qe);return Number.isInteger(ct)&&ct>=1&&ct<=Ge},[Be,Qe,dt]),Ft=m.useMemo(()=>{const ct=V.trim();return ct?ct.length>86:!1},[V]),En=m.useMemo(()=>{if(cn==="")return!1;const ct=Number(cn);return Number.isNaN(ct)?!1:ct===0?!0:ct>=1&&ct<=1e7},[cn]),Ee=m.useMemo(()=>{if(Xt==="")return!1;const ct=Number(Xt);if(Number.isNaN(ct))return!1;const Ge=Be===""?null:Number(Be),Tt=Ge?Ge*100-1:4999;return ct===0?!0:ct>0&&ct<1?!1:ct>=1&&ct<=Tt},[Xt,Be]);m.useMemo(()=>{if(Jt==="")return!1;const ct=Number(Jt);return!Number.isNaN(ct)&&ct>0&&ct<=100},[Jt]);const h=g&&V.trim()!==""&&be.trim()!==""&&Qe!==""&&zn&&Zn&&q&&(!cn||En)&&(!Xt||Ee)&&(pt==="LONG"||pt==="SHORT"||pt==="RANDOM")&&(wt==="LIMIT"||wt==="MARKET"||wt==="HYBRID")&&Ft&&on,p=()=>(localStorage.getItem("hyperAddress")||"dextra").toLowerCase(),S=()=>`pacificaCreds:${p()}`,_=()=>{try{const ct=localStorage.getItem(S());if(!ct)return;const Ge=JSON.parse(ct);Ge.privateKey&&ee(Ge.privateKey),Ge.loginAddress&&je(Ge.loginAddress),typeof Ge.remember=="boolean"&&dn(Ge.remember)}catch{}},k=()=>{if(kt)try{localStorage.setItem(S(),JSON.stringify({privateKey:V,loginAddress:be,remember:!0}))}catch{}},I=()=>{try{localStorage.removeItem(S())}catch{}};m.useEffect(()=>{if(!t)return;const ct=localStorage.getItem("hyperToken"),Ge=localStorage.getItem("hyperAddress");y(!!(ct&&Ge));const Tt=setInterval(()=>{const fn=localStorage.getItem("hyperToken"),Yn=localStorage.getItem("hyperAddress");y(!!(fn&&Yn))},800);return()=>clearInterval(Tt)},[t]),m.useEffect(()=>{!t||!g||(B(),st())},[t,g]),m.useEffect(()=>{t&&(Xt===""&&an(Pn),cn===""&&Un(Pn),Jt===""&&Ye(Pn))},[t]),m.useEffect(()=>{if(!Qe)return;const ct=tr(Qe),Ge=Number(Be);!Number.isNaN(Ge)&&Ge>ct&&ht(String(ct)),!Number.isNaN(Ge)&&Ge<1&&Be!==""&&ht("1")},[Qe]),m.useEffect(()=>{t&&(kt&&k(),kt||I())},[V,be,kt,t]);async function B(){var ct,Ge,Tt,fn,Yn,Fn,Gn,Sr;try{Yt(!0),rt("");const ur=window.localStorage.getItem("hyperToken"),kr=window.localStorage.getItem("hyperAddress");if(!ur||!kr){C(!1),_();return}const Sn=await(await fetch(`${en}/api/hyper/new_farming_app/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:kr.toLowerCase(),token:ur})})).json();if(!(Sn!=null&&Sn.success)){if(console.warn("INFO API RESPONSE:",Sn==null?void 0:Sn.error_message),(Sn==null?void 0:Sn.error_message)==="You have not a running process"){const Mn=q?q.toLowerCase().replace("-","_"):null,rr=L==null?void 0:L[Mn];if(Mn&&rr){const ls={...L,[Mn]:{...rr,isStop:!0}};z(ls);const et=Object.keys(ls).filter(gt=>gt.startsWith("pacifica"));if(et.length>0&&!q){const sr=et.sort((Tr,Lr)=>{var wr,ss;const $r=parseInt(((wr=Tr.match(/\d+/))==null?void 0:wr[0])||0,10),lr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10);return $r-lr})[0].match(/\d+/);sr&&se(`Pacifica-${sr[0]}`)}}else se("Pacifica-1")}Sn!=null&&Sn.slots_info&&($((Ge=(ct=Sn==null?void 0:Sn.slots_info)==null?void 0:ct.pacifica)==null?void 0:Ge.total_qty),M((fn=(Tt=Sn==null?void 0:Sn.slots_info)==null?void 0:Tt.pacifica)==null?void 0:fn.active_qty));return}if(Sn!=null&&Sn.success&&(Sn!=null&&Sn.data)){const Mn=q?q.toLowerCase().replace("-","_"):null,rr=L==null?void 0:L[Mn],ls=Sn.data||{};Mn&&!ls[Mn]&&rr&&(ls[Mn]={...rr,isStop:!0}),z(ls);const et=Object.keys(ls).filter(gt=>gt.startsWith("pacifica"));if(et.length>0&&!q){const sr=et.sort((Tr,Lr)=>{var wr,ss;const $r=parseInt(((wr=Tr.match(/\d+/))==null?void 0:wr[0])||0,10),lr=parseInt(((ss=Lr.match(/\d+/))==null?void 0:ss[0])||0,10);return $r-lr})[0].match(/\d+/);sr&&se(`Pacifica-${sr[0]}`)}Sn!=null&&Sn.slots_info&&($((Fn=(Yn=Sn==null?void 0:Sn.slots_info)==null?void 0:Yn.pacifica)==null?void 0:Fn.total_qty),M((Sr=(Gn=Sn==null?void 0:Sn.slots_info)==null?void 0:Gn.pacifica)==null?void 0:Sr.active_qty))}}catch{C(!1),_(),W("OFF")}finally{Yt(!1)}}const G=m.useMemo(()=>q?q.toLowerCase().replace("-","_"):"",[q]),re=!!((Xe=L==null?void 0:L[G])!=null&&Xe.delta)&&!!((Pt=L==null?void 0:L[G])!=null&&Pt.from_slot),ce=re?`pacifica_${(Wt=L==null?void 0:L[G])==null?void 0:Wt.from_slot}`:G;m.useEffect(()=>{var Tt,fn,Yn,Fn,Gn,Sr,ur,kr,Bn,Sn;if(!q||!L)return;const ct=ce,Ge=L==null?void 0:L[ct];if(!Ge){ee(""),je(""),Ke(""),Le(""),ht(""),Gt("LONG"),nn("LIMIT"),C(!1),W("OFF"),sn("Hour"),Qn("Limit"),Dt("Limit"),Un(""),an(""),K("pacifica");return}if((Ge==null?void 0:Ge.target_params)==null&&Ge.source_params){Ge!=null&&Ge.isStop?C(!1):C(!0),W("OFF");const Mn=Ge.source_params,rr=(Ge==null?void 0:Ge.slot_number)??"";rr&&!re&&se(`Pacifica-${rr}`),Mn!=null&&Mn.cycleSeconds&&sn((Mn==null?void 0:Mn.cycleSeconds)===86400?"Day":"Hour"),Mn!=null&&Mn.tp_type&&Qn(String(Mn==null?void 0:Mn.tp_type).toUpperCase()==="MARKET"?"Market":"Limit"),Mn!=null&&Mn.sl_type&&Dt(String(Mn==null?void 0:Mn.sl_type).toUpperCase()==="MARKET"?"Market":"Limit");const ls=(Mn==null?void 0:Mn.agent_pkey)??"",cs=(Mn==null?void 0:Mn.login_address)??"";if(ls&&ee(String(ls)),cs&&je(String(cs)),Mn!=null&&Mn.coin){const et=String(Mn.coin);Ke(et)}(Mn==null?void 0:Mn.orderPerHour)!=null&&Le(String(Mn.orderPerHour)),(Mn==null?void 0:Mn.leverage)!=null&&ht(String(Mn.leverage)),Mn!=null&&Mn.direction&&Gt(String(Mn.direction).toUpperCase()==="SHORT"?"SHORT":String(Mn.direction).toUpperCase()==="RANDOM"?"RANDOM":"LONG"),Mn!=null&&Mn.orderType&&nn(String(Mn.orderType).toUpperCase()==="MARKET"?"MARKET":String(Mn.orderType).toUpperCase()==="LIMIT"?"LIMIT":"HYBRID"),(Mn==null?void 0:Mn.tp)!=null&&Un(String(Mn.tp)),(Mn==null?void 0:Mn.sl)!=null&&an(String(Mn.sl))}else if((Ge==null?void 0:Ge.target_params)!==null){Ge!=null&&Ge.isStop?C(!1):C(!0),W("OFF");const Mn=(Ge==null?void 0:Ge.slot_number)??"";Mn&&!re&&se(`Pacifica-${Mn}`),(Tt=Ge==null?void 0:Ge.source_params)!=null&&Tt.coin&&Ke(String((fn=Ge==null?void 0:Ge.source_params)==null?void 0:fn.coin)),((Yn=Ge==null?void 0:Ge.source_params)==null?void 0:Yn.orderPerHour)!=null&&Le(String((Fn=Ge==null?void 0:Ge.source_params)==null?void 0:Fn.orderPerHour)),((Gn=Ge==null?void 0:Ge.source_params)==null?void 0:Gn.leverage)!=null&&ht(String((Sr=Ge==null?void 0:Ge.source_params)==null?void 0:Sr.leverage)),(ur=Ge==null?void 0:Ge.source_params)!=null&&ur.accountType&&setStatusType(((kr=Ge==null?void 0:Ge.source_params)==null?void 0:kr.accountType)==="standart"?"STANDARD":"PREMIUM"),(Bn=Ge==null?void 0:Ge.target_params)!=null&&Bn.accountType&&setStatusTypeTwo(((Sn=Ge==null?void 0:Ge.target_params)==null?void 0:Sn.accountType)==="standart"?"STANDARD":"PREMIUM"),Ge!=null&&Ge.target_app&&K(((Ge==null?void 0:Ge.target_app)==="pacifica","pacifica"))}else C(!1),W("OFF")},[q,L,re,ce]);const ue=ct=>{var Ge;return Number(((Ge=String(ct||"").match(/\d+/))==null?void 0:Ge[0])||0)},ge=ct=>(ct||"").toLowerCase().replace("-","_"),Ae=m.useMemo(()=>{const ct=L==null?void 0:L[ge(q)];if(ct!=null&&ct.delta&&(ct!=null&&ct.from_slot))return Number(ct.from_slot);const Ge=Number(ct==null?void 0:ct.slot_number);return Number.isFinite(Ge)?Ge:ue(q)},[q,L]),ke=m.useMemo(()=>{const ct=Number(N)||0,Ge=Array.from({length:ct},()=>({used:!1,kind:null})),Tt=L||{};for(const[fn,Yn]of Object.entries(Tt)){if(!fn.startsWith("pacifica"))continue;const Fn=ue(fn)-1;Fn<0||Fn>=ct||((Yn==null?void 0:Yn.isStop)===!0?Ge[Fn]={used:!1,kind:null}:Yn!=null&&Yn.source_params?Ge[Fn]={used:!0,kind:"delta-src"}:Yn!=null&&Yn.target_params||Yn!=null&&Yn.delta?Ge[Fn]={used:!0,kind:"delta-shadow"}:Yn!=null&&Yn.farming_params?Ge[Fn]={used:!0,kind:"single"}:Ge[Fn]={used:!0,kind:"unknown"})}return Ge},[L,N]),Me=m.useMemo(()=>ke.map((ct,Ge)=>ct.used&&ct.kind!=="delta-src-inferred"?`Pacifica-${Ge+1}`:null).filter(Boolean),[ke]);m.useMemo(()=>ke.filter(ct=>!ct.used).length,[ke]);async function qe(){if(!g){n(!0);return}if(h)try{ot(!0),rt("");const ct=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress");if(!ct||!Ge){n(!0);return}const Tt={login_address:be,agent_pkey:V,cycleSeconds:Zt==="Hour"?3600:86400,tp_type:jt.toUpperCase(),sl_type:bn.toUpperCase(),tp:Number(cn),sl:Number(Xt),coin:`${Qe}`,orderPerHour:Number(nt),leverage:Number(Be),direction:pt,orderType:wt},fn={api_pkey:oe,login_wallet:Ie,coin:Qe==null?void 0:Qe.replace("USDT",""),orderPerHour:Number(nt),leverage:Number(Be)},Yn={address:Ge.toLowerCase(),token:ct,slot_number:Number(q==null?void 0:q.replace("Pacifica-","")),source_app:"pacifica",source_params:Tt},Gn=await(await fetch(`${en}/api/hyper/farming_app/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yn)})).json();Gn!=null&&Gn.success?(C(!0),B(),kt&&k()):rt((Gn==null?void 0:Gn.error_message)||"Start failed.")}catch(ct){rt(ct.message||"An error occurred while saving.")}finally{ot(!1)}}async function Fe(){if(!g){n(!0);return}try{At(!0),rt("");const ct=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress");if(!ct||!Ge){n(!0);return}const fn=await(await fetch(`${en}/api/hyper/farming_app/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Ge.toLowerCase(),token:ct,source_app:"pacifica",slot_number:Ae})})).json();fn!=null&&fn.success?(C(!1),B()):rt((fn==null?void 0:fn.error_message)||"Stop failed.")}catch(ct){rt(ct.message||"An error occurred while stopping.")}finally{At(!1)}}const at={control:(ct,Ge)=>({...ct,backgroundColor:"#242424",borderColor:Ge.isFocused?"#67FFBD":"#353535",minHeight:32,height:32,boxShadow:"none",cursor:"pointer",alignItems:"center"}),valueContainer:ct=>({...ct,height:32,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:ct=>({...ct,height:32}),input:ct=>({...ct,color:"#FFFFFF",margin:0,padding:0}),singleValue:ct=>({...ct,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:ct=>({...ct,color:"#7F7F7F",fontSize:"12px"}),menu:ct=>({...ct,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:ct=>({...ct,paddingTop:0,paddingBottom:0,maxHeight:200}),option:(ct,Ge)=>({...ct,backgroundColor:Ge.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:32,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:ct=>({...ct,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:ct=>({...ct,backgroundColor:"#353535"})},ie=({max:ct})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[ct,"x"]}),Se=ct=>{var Ge;return i.jsx(Sa.Option,{...ct,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Ge=ct.data)!=null&&Ge.icon?i.jsx("img",{src:ct.data.icon,alt:ct.data.label,className:"w-4 h-4 rounded-[4px]",onError:Tt=>Tt.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:ct.data.label}),i.jsx(ie,{max:ct.data.maxLeverage})]})})},$e=ct=>{var Ge;return i.jsx(Sa.SingleValue,{...ct,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Ge=ct.data)!=null&&Ge.icon?i.jsx("img",{src:ct.data.icon,alt:ct.data.label,className:"w-4 h-4 rounded-[4px]",onError:Tt=>Tt.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}),i.jsx("span",{className:"text-white text-[13px]",children:ct.data.label}),i.jsx(ie,{max:ct.data.maxLeverage})]})})},Ue=ct=>{const Ge=Me.includes(ct.data.value);return i.jsx(Sa.Option,{...ct,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[i.jsx("span",{className:"text-white text-[13px]",children:ct.data.label}),Ge&&i.jsx("span",{className:"ml-auto w-2 h-2 rounded-full bg-[#67FFBD]",title:"Active"})]})})},_e=ct=>i.jsx(Sa.SingleValue,{...ct,children:i.jsx("div",{className:"flex items-center gap-2 px-3",children:i.jsx("span",{className:"text-white text-[13px]",children:ct.data.label})})}),st=async()=>{var Tt,fn,Yn,Fn,Gn,Sr,ur,kr;const ct=window.localStorage.getItem("hyperToken"),Ge=window.localStorage.getItem("hyperAddress");if(!(!ct||!Ge))try{It(!0);const Bn=await ki(Ge.toLowerCase(),ct);Bn!=null&&Bn.success?(r(Bn==null?void 0:Bn.telegram_chat_id),s(Bn==null?void 0:Bn.subscriber_role),a(Bn==null?void 0:Bn.subs_expire_day),o((Tt=Bn==null?void 0:Bn.mushboomer_counts)==null?void 0:Tt.eth),l((fn=Bn==null?void 0:Bn.mushboomer_counts)==null?void 0:fn.sol),c(Bn==null?void 0:Bn.referral_code),u(Bn==null?void 0:Bn.refcode),d(Bn==null?void 0:Bn.whitelist),f(ct),x(Ge),Oe(!0),P((Fn=(Yn=Bn==null?void 0:Bn.slots_info)==null?void 0:Yn.pacifica)==null?void 0:Fn.total_qty),$((Sr=(Gn=Bn==null?void 0:Bn.slots_info)==null?void 0:Gn.pacifica)==null?void 0:Sr.total_qty),M((kr=(ur=Bn==null?void 0:Bn.slots_info)==null?void 0:ur.pacifica)==null?void 0:kr.active_qty),It(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),f(""),x(""),It(!1))}catch(Bn){console.error("Token verification error:",Bn),console.error(Bn.message||"An unknown error occurred."),It(!1)}},ut=dt,yt=m.useMemo(()=>Array.from({length:N},(ct,Ge)=>({value:`Pacifica-${Ge+1}`,label:`Pacifica-${Ge+1}`})),[N]);if(!t)return null;const Mt=hn||Rt||De||Je,Kt=v&&!De,un=tr(Qe);return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:Kn,setOpen:Dn,transactionHash:Xn,transactionLoading:yn,paymentPresaleRole:on,errorFunds:mt,activeMethod:2}),i.jsx(O5,{open:te,setOpen:fe,paymentLighterRole:on,oldSlotCount:X,checkAccountLighter:st,tradeMarket:"pacifica"}),i.jsxs("div",{className:"fixed inset-0 z-[9000] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>!Mt&&e(!1)}),i.jsxs("div",{className:"relative flex items-start gap-4 px-3 w-full max-w-[1000px]",children:[i.jsx(T2,{current:"pacifica",onCloseCurrent:()=>!Mt&&e(!1)}),i.jsxs("div",{className:"relative w-[680px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#F8D4AB] max-h-[97dvh] overflow-y-auto",children:[i.jsxs("div",{className:"pb-2 px-5 pt-3 border-b border-[#353535] rounded-t-3xl relative",children:[i.jsxs("div",{className:"flex justify-start items-center gap-3",children:[i.jsx("img",{src:"https://app.pacifica.fi/imgs/logo.svg",alt:"",className:"h-9"}),i.jsx("span",{className:"text-[24px] font-semibold text-[#e87859] mt-1",children:"farming"})]}),i.jsxs("div",{className:"flex justify-between items-center gap-4",children:[i.jsx("div",{className:"text-xs font-normal text-[#7C7C7C] mt-2",children:"Pacifica Farming module lets you set up automated farming by providing your Pacifica Address, Pacifica Private Key, selecting a pair, defining trade per hour, leverage, direction, order type, take profit and stop loss."}),i.jsx("div",{className:"flex flex-col items- justify-start gap-1 relative",children:i.jsx("div",{className:"text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})})})]})]}),i.jsxs("div",{className:"pb-2 space-y-3 pt-2 px-5",children:[ze&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:ze}),g&&on&&F===T&&i.jsx("div",{className:"text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-2",children:"No free Pacifica slots."}),g&&on&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-4 sm:px-5",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[T||0,"/",yt.length]})]})]}),i.jsx(jl,{styles:at,components:{Option:Ue,SingleValue:_e},options:yt,value:yt.find(ct=>ct.value===q)||null,onChange:ct=>se((ct==null?void 0:ct.value)??""),placeholder:"Select",isSearchable:!0})]})}),i.jsxs("div",{className:`${ae==="ON"?"py-1":"py-5"} space-y-3 px-3 sm:px-5`,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ae==="ON"?i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 1"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"1st Stark Key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:ct=>je(ct.target.value),autoComplete:"off",placeholder:"1st Stark Key Public ",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:ct=>ee(ct.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY",type:rn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt}),i.jsx("button",{type:"button",onClick:()=>gn(ct=>!ct),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Mt||Kt,children:rn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ce,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return me("");qt(Ge)&&me(Ge)},onKeyDown:ar,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ce===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt})})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Login Wallet Address"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:be,onChange:ct=>je(ct.target.value),autoComplete:"off",placeholder:"LOGIN_WALLET_ADDRESS",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${be===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get Pacifica Private Key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:V,onChange:ct=>ee(ct.target.value),autoComplete:"off",placeholder:"PACIFICA_PRIVATE_KEY",type:rn?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${V===""?"border-[#353535]":Ft?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt}),i.jsx("button",{type:"button",onClick:()=>gn(ct=>!ct),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Mt||Kt,children:rn?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]}),V!==""&&!Ft&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Please enter a valid private key."})]})]}),ae==="ON"&&i.jsxs("div",{className:"col-span-1 space-y-4 border border-[#6f604d] hover:border-[#F8D4AB]/70 rounded-lg p-2.5",children:[i.jsx("div",{className:"flex items-center justify-between border-b border-[#353535] pb-2 mb-3",children:i.jsx("span",{className:"text-[13px] font-semibold text-[#F8D4AB]",children:"API - 2"})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"2nd Stark key Public"})}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:Ie,onChange:ct=>Re(ct.target.value),autoComplete:"off",placeholder:"2nd Stark key Public",type:"text",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Ie===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Private Key 2"}),i.jsx("a",{href:"https://docs.dextrabot.com/farm/pacifica-farming-module#getting-your-api-credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline text-[#F8D4AB] hover:text-[#eee0d0]",children:"How to get API Private key?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:oe,onChange:ct=>de(ct.target.value),autoComplete:"off",placeholder:"API_PRIVATE_KEY_2",type:An?"text":"password",className:`w-full h-8 pl-3 pr-16 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${oe===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt}),i.jsx("button",{type:"button",onClick:()=>kn(ct=>!ct),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[11px] text-[#9B9B9B] hover:text-white h-6 flex justify-center items-center hover:border-none hover:ring-0 focus:outline-none focus:border-none bg-transparent",disabled:Mt||Kt,children:An?i.jsx(sa,{size:14}):i.jsx(ia,{size:14})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"API Key Index 2"}),i.jsx("div",{className:"relative",children:i.jsx("input",{value:we,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return xe("");qt(Ge)&&xe(Ge)},onKeyDown:ar,inputMode:"numeric",autoComplete:"off",placeholder:"API_KEY_INDEX_2",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${we===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:Mt||Kt})})]})]})]}),V!==""&&!Ft&&i.jsx("div",{children:i.jsx("img",{src:lct,alt:"",className:"mt-4 rounded-md w-full"})}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per Hour"}),i.jsx("input",{value:nt,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return Le("");qt(Ge)&&Le(Ge)},onKeyDown:ar,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":zn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt}),nt!==""&&!zn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Select Pair"}),i.jsx(jl,{styles:at,components:{Option:Se,SingleValue:$e},isDisabled:Mt||Kt,options:ut,value:ut.find(ct=>ct.value===Qe)||null,onChange:ct=>Ke((ct==null?void 0:ct.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Trade Per"}),i.jsxs("select",{value:Zt,onChange:ct=>sn(ct.target.value),className:`${Mt||Kt?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Mt||Kt,children:[i.jsx("option",{value:"Hour",children:"Hour"}),i.jsx("option",{value:"Day",children:"Day"})]})]}),i.jsx("input",{value:nt,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return Le("");qt(Ge)&&Le(Ge)},onKeyDown:ar,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10 (max 180)",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${nt===""?"border-[#353535]":zn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt}),nt!==""&&!zn&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer between 1 and 180."})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"":"hidden"} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Delta Neutral"}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 border border-[#353535] bg-[#242424] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ae==="ON"?"On":"Off"}),i.jsx(Io,{checked:ae==="ON",onChange:ct=>W(ct?"ON":"OFF"),disabled:Mt||Kt,className:`${ae==="ON"?"bg-[#1DE674]":"bg-white/10"} relative inline-flex h-5 w-9 items-center rounded-full p-1 transition-colors duration-200 ease-in-out ${Mt||Kt?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:i.jsx("span",{"aria-hidden":"true",className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-lg transition duration-200 ease-in-out ${ae==="ON"?"translate-x-3":"translate-x-0"}`})})]})]}),i.jsxs("div",{className:" space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Leverage"}),i.jsx("input",{value:Be,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return ht("");qt(Ge)&&ht(Ge)},onKeyDown:ar,inputMode:"numeric",autoComplete:"off",placeholder:Qe?`1–${un}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Be===""?"border-[#353535]":Zn?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Direction"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6",children:[i.jsx("div",{"aria-pressed":pt==="LONG",onClick:()=>!Kt&&Gt("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Mt||Kt?"cursor-not-allowed":"cursor-pointer",pt==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["LONG",Be?` - ${Be}x`:""]})}),i.jsx("div",{"aria-pressed":pt==="SHORT",onClick:()=>!Kt&&Gt("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Mt||Kt?"cursor-not-allowed":"cursor-pointer",pt==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["SHORT",Be?` - ${Be}x`:""]})}),i.jsx("div",{"aria-pressed":pt==="RANDOM",onClick:()=>!Kt&&Gt("RANDOM"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",Mt||Kt?"cursor-not-allowed":"cursor-pointer",pt==="RANDOM"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsxs("span",{className:"min-w-max",children:["RANDOM",Be?` - ${Be}x`:""]})})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-2`,children:[i.jsx("div",{className:"flex items-center gap-2 text-[13px] text-[#7C7C7C] font-semibold",children:i.jsx("span",{children:"Order Type"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{"aria-pressed":wt==="LIMIT",onClick:()=>!Kt&&nn("LIMIT"),className:["inline-flex flex-col justify-center items-center h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Mt||Kt?"cursor-not-allowed":"cursor-pointer",wt==="LIMIT"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["LIMIT ",wt==="LIMIT"?" ✓":""]})}),i.jsx("button",{"aria-pressed":wt==="HYBRID",onClick:()=>!Kt&&nn("HYBRID"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Mt||Kt?"cursor-not-allowed":"cursor-pointer",wt==="HYBRID"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["HYBRID ",wt==="HYBRID"?" ✓":""]})}),i.jsx("button",{"aria-pressed":wt==="MARKET",onClick:()=>!Kt&&nn("MARKET"),className:["inline-flex flex-col justify-center items-center h-6 px-1 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",Mt||Kt?"cursor-not-allowed":"cursor-pointer",wt==="MARKET"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["MARKET ",wt==="MARKET"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} grid grid-cols-1 md:grid-cols-2 gap-4`,children:[i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Take Profit %"}),i.jsxs("select",{value:jt,onChange:ct=>Qn(ct.target.value),className:`${Mt||Kt?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Mt||Kt,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:cn,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return Un("");hr(Ge)&&Un(Ge)},onKeyDown:ar,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${cn===""?"border-[#353535]":En?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt})]}),cn!==""&&!En&&i.jsx("div",{className:"text-[#FF797C] text-[11px]",children:"Value must be 0, or between 1 and 10000000. Numbers between 0 and 1 are not allowed."})]}),i.jsxs("div",{className:`${ae==="ON"?"hidden":""} space-y-1`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Stop Loss %"}),i.jsxs("select",{value:bn,onChange:ct=>Dt(ct.target.value),className:`${Mt||Kt?"cursor-not-allowed":"cursor-pointer"} h-6 text-[12px] bg-[#242424] border border-[#353535] rounded-md px-2 text-white outline-none font-bold font-manrope`,disabled:Mt||Kt,children:[i.jsx("option",{value:"Limit",children:"Limit"}),i.jsx("option",{value:"Market",children:"Market"})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"%"}),i.jsx("input",{value:Xt,onChange:ct=>{const Ge=ct.target.value.trim();if(Ge==="")return an("");hr(Ge)&&an(Ge)},onKeyDown:ar,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${Xt===""?"border-[#353535]":Ee?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:Mt||Kt})]}),Xt!==""&&!Ee&&i.jsxs("div",{className:"text-[#FF797C] text-[11px]",children:["Value must be 0, or between 1 and"," ",Be?Math.max(Be*100-1,0):4999,". Numbers between 0 and 1 are not allowed."]})]})]}),!1]}),i.jsx("div",{className:`${ae==="ON"?"py-3":"py-6"} flex items-center gap-3 px-5 border-t border-[#353535] bg-[rgba(27,27,27,0.32)] rounded-b-3xl`,children:i.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[i.jsx("button",{onClick:()=>!Mt&&e(!1),className:"inline-flex items-center justify-center h-8 px-5 rounded-[10px] border bg-black/5 border-[#353535] text-white text-[13px] hover:border-white disabled:opacity-60",disabled:Mt,children:"Cancel"}),g?ae==="ON"?v?i.jsx("button",{onClick:Fe,disabled:Mt,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:qe,disabled:!h||Mt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!h||Mt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Rt?"Starting...":"Start"}):v?i.jsx("button",{onClick:Fe,disabled:Mt,className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border border-[#353535] hover:border-[#FF797C] text-[#FF797C] bg-[rgba(27,27,27,0.32)] disabled:opacity-60",children:De?"Stopping...":"Stop"}):i.jsx("button",{onClick:qe,disabled:!h||Mt,className:`inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!h||Mt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3]"}`,children:Rt?"Starting...":"Start"}):i.jsx("button",{onClick:()=>n(!0),className:"inline-flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#67FFBD] border-[#67FFBD] text-black hover:opacity-90",children:"Connect"})]})}),hn&&i.jsx("div",{className:"absolute inset-0 rounded-3xl bg-black/40 flex items-center justify-center text-sm",children:"Loading..."})]})]})]})]})]})},JFt=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState(!1),[s,a]=m.useState(2),[o,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(!1),[x,g]=m.useState(!1),[y,v]=m.useState(!1),[C,N]=m.useState(!1),P=(T=[])=>T==null?void 0:T.map(M=>M.submenu?{...M,submenu:P(M.submenu)}:M.action==="openAster"?{...M,onClick:()=>{a(2),r(!0)}}:M.action==="openFarm"?{...M,onClick:()=>e(!0)}:M.action==="openLighter"?{...M,onClick:()=>l(!0)}:M.action==="openApex"?{...M,onClick:()=>u(!0)}:M.action==="openVariational"?{...M,onClick:()=>f(!0)}:M.action==="openExtended"?{...M,onClick:()=>g(!0)}:M.action==="openParadex"?{...M,onClick:()=>v(!0)}:M.action==="openPacifica"?{...M,onClick:()=>N(!0)}:M);return i.jsxs(i.Fragment,{children:[i.jsx(Ho,{to:"https://dextrabot.com/",className:"cursor-pointer",children:i.jsx("div",{className:"flex items-center gap-2 font-manrope",children:i.jsx("img",{src:WA,alt:"Dextrabot",loading:"eager",decoding:"async",width:32,height:32,className:"w-8 h-8 object-contain"})})}),i.jsx("div",{className:"flex items-center gap-1",children:cct.map(T=>T.type==="link"?i.jsx(ZFt,{linkTo:T.to,title:T.label,activePaths:T.activePaths},T.to):T.type==="dropdown"?i.jsx(dlt,{label:T.label,items:P(T.items),activePaths:T.activePaths,badgeLabel:T.badgeLabel,badgeTone:T.badgeTone,border_color:T.border_color},T.label):null)}),i.jsx(gce,{open:t,setOpen:e}),i.jsx(bce,{open:n,setOpen:r,defaultMethod:s}),i.jsx(yce,{open:o,setOpen:l}),i.jsx(vce,{open:c,setOpen:u}),i.jsx(wce,{open:d,setOpen:f}),i.jsx(wU,{open:x,setOpen:g}),i.jsx(Cce,{open:y,setOpen:v}),i.jsx(Sce,{open:C,setOpen:N})]})},zy=({className:t})=>i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M8.625 15.75C12.56 15.75 15.75 12.56 15.75 8.625C15.75 4.68997 12.56 1.5 8.625 1.5C4.68997 1.5 1.5 4.68997 1.5 8.625C1.5 12.56 4.68997 15.75 8.625 15.75Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M16.5 16.5L15 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),wm=(t,e=null)=>{e&&t.target.src===e?t.target.src=VH:e&&t.target.src!==e?t.target.src=e:t.target.src!==VH&&(t.target.src=VH)},eOt=m.forwardRef(({setOpen:t},e)=>{const{searchTerminalCoin:n,isSearchTerminalError:r}=m.useContext(Qr),[s,a]=m.useState(""),[o,l]=m.useState([]),[c,u]=m.useState([]),[d,f]=m.useState([]),x={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};m.useEffect(()=>{const C=JSON.parse(localStorage.getItem("recentWallets")||"[]");l(C);const N=JSON.parse(localStorage.getItem("recentCoins")||"[]");u(N)},[]);const g=C=>{a(C.target.value.toLowerCase())},y=C=>{C.key==="Enter"&&v()},v=()=>{if(s)if(s.match(/^0x[a-fA-F0-9]{40}$/)){const C=s==null?void 0:s.toLowerCase(),N=[C,...o.filter(P=>(P==null?void 0:P.toLowerCase())!==C)];N.length>12&&N.pop(),l(N),localStorage.setItem("recentWallets",JSON.stringify(N)),window.open(`/wallet-details/${s}`,"_blank"),t(!1)}else tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Please enter a valid Ethereum address"})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"380px",minWidth:"380px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})};return m.useEffect(()=>{if(s.length>0){const C=s==null?void 0:s.toLowerCase(),N=n.filter(P=>Array.isArray(P)&&P.some(T=>{var M;return(M=T==null?void 0:T.toLowerCase())==null?void 0:M.includes(C)})).map(P=>P[0]);f(N)}else f([])},[s,n]),i.jsxs("div",{children:[i.jsx("div",{className:"sm:w-[416px] h-12 font-manrope z-[999]",children:i.jsxs("div",{className:"flex justify-between items-center bg-[#303030] h-full px-4 gap-1 sm:gap-2.5",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1 sm:gap-2.5 w-full",children:[i.jsx(zy,{className:"text-white"}),i.jsx("input",{type:"text",ref:e,placeholder:"Search coin or wallet",value:s,onChange:g,onKeyDown:y,className:"w-full bg-transparent text-white placeholder-[#989898] text-sm font-medium font-manrope leading-[8px] placeholder:leading-[8px] tracking-tight focus:outline-none h-12"})]}),i.jsx("div",{onClick:()=>a(""),className:`${(s==null?void 0:s.length)>0?"":"hidden"} text-[#aaa] hover:text-white outline-none focus:outline-none focus:ring-0 border-none w-6 min-w-6 h-[24px] bg-[#353535] hover:bg-[#585858] rounded-md flex justify-center items-center cursor-pointer`,children:i.jsx("img",{src:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})}),i.jsx("div",{className:`${s.match(/^0x[a-fA-F0-9]{40}$/)?"":"hidden"}`,children:i.jsx("div",{onClick:v,className:"w-16 h-7 px-4 py-3 rounded-[256px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#989898] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-xs font-medium font-inter leading-[8px]",children:"Search"})})})]})}),i.jsxs("div",{className:"recent-wallets",children:[i.jsx("div",{className:`${(d==null?void 0:d.length)===0&&"hidden"} text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2 pt-4`,children:"SEARCH RESULTS"}),i.jsx("ul",{className:`${(c==null?void 0:c.length)===0&&(o==null?void 0:o.length)===0?"h-full max-h-[320px]":"max-h-[120px]"} overflow-y-scroll overflow-x-hidden h-full pl-4 pb-4 flex flex-wrap gap-1 sm:gap-2`,children:(d==null?void 0:d.length)===0?i.jsx("div",{className:`${!s.match(/^0x[a-fA-F0-9]{40}$/)&&(s==null?void 0:s.length)>0?"min-h-10":""} w-full h-full flex justify-center items-center`,children:i.jsx("div",{className:`${!s.match(/^0x[a-fA-F0-9]{40}$/)&&(s==null?void 0:s.length)>0?"":"hidden"} text-[#989898] text-[13px] font-semibold font-manrope leading-none pt-4`,children:"No results for your search."})}):d==null?void 0:d.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] max-w-max",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/terminal/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>{t(!1);const P=JSON.parse(localStorage.getItem("recentCoins")||"[]");P!=null&&P.includes(C)||(P.unshift(C),P.length>14&&P.pop(),localStorage.setItem("recentCoins",JSON.stringify(P)))},children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${x[C]||(C==null?void 0:C.split("/")[0])}.svg`,alt:C,className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-gray-700",loading:"lazy",onError:P=>wm(P)}),C]})})})},N))})]}),i.jsxs("div",{className:`${(c==null?void 0:c.length)===0?"hidden":""} recent-wallets pt-4`,children:[i.jsx("div",{className:"text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2",children:"RECENT COINS"}),i.jsx("ul",{className:"overflow-y-scroll overflow-x-hidden h-full max-h-[142px] sm:max-h-[132px] pl-4 pb-4 flex flex-wrap gap-1 sm:gap-2",children:Array.isArray(c)&&(c==null?void 0:c.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] max-w-max",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/terminal/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>t(!1),children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${x[C]||(C==null?void 0:C.split("/")[0])}.svg`,alt:C,className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-gray-700",loading:"lazy",onError:P=>wm(P)}),C]})})})},N)))})]}),i.jsxs("div",{className:`${(o==null?void 0:o.length)===0?"hidden":""} recent-wallets pt-4`,children:[i.jsx("div",{className:"text-white text-[11px] font-bold font-manrope leading-none tracking-wider bg-[#1f1f1f] pl-4 pb-2",children:"RECENT WALLETS"}),i.jsx("ul",{className:"overflow-y-scroll overflow-x-hidden h-full max-h-[120px] sm:max-h-[190px] pl-4 pb-4 sm:pb-8 flex flex-wrap gap-2",children:o==null?void 0:o.map((C,N)=>i.jsx("li",{className:"mt-1 sm:mt-2",children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-6 px-1 rounded-md border border-[#3a3a3a] w-[120px]",children:i.jsx("div",{className:"flex justify-start items-center gap-2.5",children:i.jsxs("a",{href:`/wallet-details/${C}`,target:"_blank",className:"text-[#989898] text-[13px] font-semibold font-manrope leading-none hover:text-white flex gap-1.5 items-center",onClick:()=>t(!1),children:[i.jsx("img",{src:mlt,alt:"",className:"w-4 h-4"}),C&&C.slice(0,6)+"..."+C.slice(-4)]})})})},N))})]})]})}),tOt=({open:t,setOpen:e})=>{const n=m.useRef(null);return m.useEffect(()=>{t&&setTimeout(()=>{var r;(r=n.current)==null||r.focus()},0)},[t]),i.jsxs(_a,{open:t,onClose:e,className:"relative z-50",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden rounded-lg text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in sm:my-8 max-w-max data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95",children:i.jsx("div",{className:"max-w-[320px] sm:max-w-[416px] min-h-[200px] max-h-[600px] relative bg-[#1f1f1f] border-[#404040] rounded-lg shadow backdrop-blur-[32px]",children:i.jsx(eOt,{ref:n,setOpen:e})})})})})]})},VLe=()=>{const[t,e]=m.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(tOt,{open:t,setOpen:e}),i.jsx("div",{onClick:()=>{e(!0)},className:"flex-shrink w-full min-w-[80px] lg:max-w-[250px] h-8 bg-[#353535] rounded-[256px] flex justify-between items-center px-4 cursor-pointer font-manrope group",children:i.jsxs("div",{className:"flex justify-start items-center gap-[11px]",children:[i.jsx("div",{children:i.jsx(zy,{className:"text-[#646464] group-hover:text-[#e2e2e2]"})}),i.jsx("div",{className:"font-manrope leading-none text-[#666666] group-hover:text-[#e2e2e2] text-sm font-medium min-w-max",children:"Search..."})]})})]})};var Tbe='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',nOt={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${Tbe}`,system:Tbe},a7={large:{actionButton:"9999px",connectButton:"12px",modal:"24px",modalMobile:"28px"},medium:{actionButton:"10px",connectButton:"8px",modal:"16px",modalMobile:"18px"},none:{actionButton:"0px",connectButton:"0px",modal:"0px",modalMobile:"0px"},small:{actionButton:"4px",connectButton:"4px",modal:"8px",modalMobile:"8px"}},rOt={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},WLe=({borderRadius:t="large",fontStack:e="rounded",overlayBlur:n="none"})=>({blurs:{modalOverlay:rOt[n].modalOverlay},fonts:{body:nOt[e]},radii:{actionButton:a7[t].actionButton,connectButton:a7[t].connectButton,menuButton:a7[t].connectButton,modal:a7[t].modal,modalMobile:a7[t].modalMobile}}),qLe={blue:{accentColor:"#0E76FD",accentColorForeground:"#FFF"},green:{accentColor:"#1DB847",accentColorForeground:"#FFF"},orange:{accentColor:"#FF801F",accentColorForeground:"#FFF"},pink:{accentColor:"#FF5CA0",accentColorForeground:"#FFF"},purple:{accentColor:"#5F5AFA",accentColorForeground:"#FFF"},red:{accentColor:"#FA423C",accentColorForeground:"#FFF"}},Pbe=qLe.blue,GLe=({accentColor:t=Pbe.accentColor,accentColorForeground:e=Pbe.accentColorForeground,...n}={})=>({...WLe(n),colors:{accentColor:t,accentColorForeground:e,actionButtonBorder:"rgba(0, 0, 0, 0.04)",actionButtonBorderMobile:"rgba(0, 0, 0, 0.06)",actionButtonSecondaryBackground:"rgba(0, 0, 0, 0.06)",closeButton:"rgba(60, 66, 66, 0.8)",closeButtonBackground:"rgba(0, 0, 0, 0.06)",connectButtonBackground:"#FFF",connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06))",connectButtonText:"#25292E",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(255, 255, 255, 0) 9.49%, rgba(171, 171, 171, 0.04) 71.04%), #FFFFFF",downloadTopCardBackground:"linear-gradient(126deg, rgba(171, 171, 171, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%), #FFFFFF",error:"#FF494A",generalBorder:"rgba(0, 0, 0, 0.06)",generalBorderDim:"rgba(0, 0, 0, 0.03)",menuItemBackground:"rgba(60, 66, 66, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.3)",modalBackground:"#FFF",modalBorder:"transparent",modalText:"#25292E",modalTextDim:"rgba(60, 66, 66, 0.3)",modalTextSecondary:"rgba(60, 66, 66, 0.6)",profileAction:"#FFF",profileActionHover:"rgba(255, 255, 255, 0.5)",profileForeground:"rgba(60, 66, 66, 0.06)",selectedOptionBorder:"rgba(60, 66, 66, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.12)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});GLe.accentColors=qLe;var fM="#1A1B1F",KLe={blue:{accentColor:"#3898FF",accentColorForeground:"#FFF"},green:{accentColor:"#4BD166",accentColorForeground:fM},orange:{accentColor:"#FF983D",accentColorForeground:fM},pink:{accentColor:"#FF7AB8",accentColorForeground:fM},purple:{accentColor:"#7A70FF",accentColorForeground:"#FFF"},red:{accentColor:"#FF6257",accentColorForeground:"#FFF"}},Ibe=KLe.blue,YLe=({accentColor:t=Ibe.accentColor,accentColorForeground:e=Ibe.accentColorForeground,...n}={})=>({...WLe(n),colors:{accentColor:t,accentColorForeground:e,actionButtonBorder:"rgba(255, 255, 255, 0.04)",actionButtonBorderMobile:"rgba(255, 255, 255, 0.08)",actionButtonSecondaryBackground:"rgba(255, 255, 255, 0.08)",closeButton:"rgba(224, 232, 255, 0.6)",closeButtonBackground:"rgba(255, 255, 255, 0.08)",connectButtonBackground:fM,connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.15))",connectButtonText:"#FFF",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(0, 0, 0, 0) 9.49%, rgba(120, 120, 120, 0.2) 71.04%), #1A1B1F",downloadTopCardBackground:"linear-gradient(126deg, rgba(120, 120, 120, 0.2) 9.49%, rgba(0, 0, 0, 0) 71.04%), #1A1B1F",error:"#FF494A",generalBorder:"rgba(255, 255, 255, 0.08)",generalBorderDim:"rgba(255, 255, 255, 0.04)",menuItemBackground:"rgba(224, 232, 255, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.5)",modalBackground:"#1A1B1F",modalBorder:"rgba(255, 255, 255, 0.08)",modalText:"#FFF",modalTextDim:"rgba(224, 232, 255, 0.3)",modalTextSecondary:"rgba(255, 255, 255, 0.6)",profileAction:"rgba(224, 232, 255, 0.1)",profileActionHover:"rgba(224, 232, 255, 0.2)",profileForeground:"rgba(224, 232, 255, 0.05)",selectedOptionBorder:"rgba(224, 232, 255, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.24)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});YLe.accentColors=KLe;var fne=`{
"connect_wallet": {
"label": "Connect Wallet",
"wrong_network": {
"label": "Wrong network"
}
},
"intro": {
"title": "What is a Wallet?",
"description": "A wallet is used to send, receive, store, and display digital assets. It's also a new way to log in, without needing to create new accounts and passwords on every website.",
"digital_asset": {
"title": "A Home for your Digital Assets",
"description": "Wallets are used to send, receive, store, and display digital assets like Ethereum and NFTs."
},
"login": {
"title": "A New Way to Log In",
"description": "Instead of creating new accounts and passwords on every website, just connect your wallet."
},
"get": {
"label": "Get a Wallet"
},
"learn_more": {
"label": "Learn More"
}
},
"sign_in": {
"label": "Verify your account",
"description": "To finish connecting, you must sign a message in your wallet to verify that you are the owner of this account.",
"message": {
"send": "Sign message",
"preparing": "Preparing message...",
"cancel": "Cancel",
"preparing_error": "Error preparing message, please retry!"
},
"signature": {
"waiting": "Waiting for signature...",
"verifying": "Verifying signature...",
"signing_error": "Error signing message, please retry!",
"verifying_error": "Error verifying signature, please retry!",
"oops_error": "Oops, something went wrong!"
}
},
"connect": {
"label": "Connect",
"title": "Connect a Wallet",
"new_to_ethereum": {
"description": "New to Ethereum wallets?",
"learn_more": {
"label": "Learn More"
}
},
"learn_more": {
"label": "Learn more"
},
"recent": "Recent",
"status": {
"opening": "Opening %{wallet}...",
"connecting": "Connecting",
"connect_mobile": "Continue in %{wallet}",
"not_installed": "%{wallet} is not installed",
"not_available": "%{wallet} is not available",
"confirm": "Confirm connection in the extension",
"confirm_mobile": "Accept connection request in the wallet"
},
"secondary_action": {
"get": {
"description": "Don't have %{wallet}?",
"label": "GET"
},
"install": {
"label": "INSTALL"
},
"retry": {
"label": "RETRY"
}
},
"walletconnect": {
"description": {
"full": "Need the official WalletConnect modal?",
"compact": "Need the WalletConnect modal?"
},
"open": {
"label": "OPEN"
}
}
},
"connect_scan": {
"title": "Scan with %{wallet}",
"fallback_title": "Scan with your phone"
},
"connector_group": {
"installed": "Installed",
"recommended": "Recommended",
"other": "Other",
"popular": "Popular",
"more": "More",
"others": "Others"
},
"get": {
"title": "Get a Wallet",
"action": {
"label": "GET"
},
"mobile": {
"description": "Mobile Wallet"
},
"extension": {
"description": "Browser Extension"
},
"mobile_and_extension": {
"description": "Mobile Wallet and Extension"
},
"mobile_and_desktop": {
"description": "Mobile and Desktop Wallet"
},
"looking_for": {
"title": "Not what you're looking for?",
"mobile": {
"description": "Select a wallet on the main screen to get started with a different wallet provider."
},
"desktop": {
"compact_description": "Select a wallet on the main screen to get started with a different wallet provider.",
"wide_description": "Select a wallet on the left to get started with a different wallet provider."
}
}
},
"get_options": {
"title": "Get started with %{wallet}",
"short_title": "Get %{wallet}",
"mobile": {
"title": "%{wallet} for Mobile",
"description": "Use the mobile wallet to explore the world of Ethereum.",
"download": {
"label": "Get the app"
}
},
"extension": {
"title": "%{wallet} for %{browser}",
"description": "Access your wallet right from your favorite web browser.",
"download": {
"label": "Add to %{browser}"
}
},
"desktop": {
"title": "%{wallet} for %{platform}",
"description": "Access your wallet natively from your powerful desktop.",
"download": {
"label": "Add to %{platform}"
}
}
},
"get_mobile": {
"title": "Install %{wallet}",
"description": "Scan with your phone to download on iOS or Android",
"continue": {
"label": "Continue"
}
},
"get_instructions": {
"mobile": {
"connect": {
"label": "Connect"
},
"learn_more": {
"label": "Learn More"
}
},
"extension": {
"refresh": {
"label": "Refresh"
},
"learn_more": {
"label": "Learn More"
}
},
"desktop": {
"connect": {
"label": "Connect"
},
"learn_more": {
"label": "Learn More"
}
}
},
"chains": {
"title": "Switch Networks",
"wrong_network": "Wrong network detected, switch or disconnect to continue.",
"confirm": "Confirm in Wallet",
"switching_not_supported": "Your wallet does not support switching networks from %{appName}. Try switching networks from within your wallet instead.",
"switching_not_supported_fallback": "Your wallet does not support switching networks from this app. Try switching networks from within your wallet instead.",
"disconnect": "Disconnect",
"connected": "Connected"
},
"profile": {
"disconnect": {
"label": "Disconnect"
},
"copy_address": {
"label": "Copy Address",
"copied": "Copied!"
},
"explorer": {
"label": "View more on explorer"
},
"transactions": {
"description": "%{appName} transactions will appear here...",
"description_fallback": "Your transactions will appear here...",
"recent": {
"title": "Recent Transactions"
},
"clear": {
"label": "Clear All"
}
}
},
"wallet_connectors": {
"argent": {
"qr_code": {
"step1": {
"description": "Put Argent on your home screen for faster access to your wallet.",
"title": "Open the Argent app"
},
"step2": {
"description": "Create a wallet and username, or import an existing wallet.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the Scan QR button"
}
}
},
"berasig": {
"extension": {
"step1": {
"title": "Install the BeraSig extension",
"description": "We recommend pinning BeraSig to your taskbar for easier access to your wallet."
},
"step2": {
"title": "Create a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"best": {
"qr_code": {
"step1": {
"title": "Open the Best Wallet app",
"description": "Add Best Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"bifrost": {
"qr_code": {
"step1": {
"description": "We recommend putting Bifrost Wallet on your home screen for quicker access.",
"title": "Open the Bifrost Wallet app"
},
"step2": {
"description": "Create or import a wallet using your recovery phrase.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
}
},
"bitget": {
"qr_code": {
"step1": {
"description": "We recommend putting Bitget Wallet on your home screen for quicker access.",
"title": "Open the Bitget Wallet app"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
},
"extension": {
"step1": {
"description": "We recommend pinning Bitget Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Bitget Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"bitski": {
"extension": {
"step1": {
"description": "We recommend pinning Bitski to your taskbar for quicker access to your wallet.",
"title": "Install the Bitski extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"bitverse": {
"qr_code": {
"step1": {
"title": "Open the Bitverse Wallet app",
"description": "Add Bitverse Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"bloom": {
"desktop": {
"step1": {
"title": "Open the Bloom Wallet app",
"description": "We recommend putting Bloom Wallet on your home screen for quicker access."
},
"step2": {
"description": "Create or import a wallet using your recovery phrase.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you have a wallet, click on Connect to connect via Bloom. A connection prompt in the app will appear for you to confirm the connection.",
"title": "Click on Connect"
}
}
},
"bybit": {
"qr_code": {
"step1": {
"description": "We recommend putting Bybit on your home screen for faster access to your wallet.",
"title": "Open the Bybit app"
},
"step2": {
"description": "You can easily backup your wallet using our backup feature on your phone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
},
"extension": {
"step1": {
"description": "Click at the top right of your browser and pin Bybit Wallet for easy access.",
"title": "Install the Bybit Wallet extension"
},
"step2": {
"description": "Create a new wallet or import an existing one.",
"title": "Create or Import a wallet"
},
"step3": {
"description": "Once you set up Bybit Wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"binance": {
"qr_code": {
"step1": {
"description": "We recommend putting Binance on your home screen for faster access to your wallet.",
"title": "Open the Binance app"
},
"step2": {
"description": "You can easily backup your wallet using our backup feature on your phone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the WalletConnect button"
}
}
},
"coin98": {
"qr_code": {
"step1": {
"description": "We recommend putting Coin98 Wallet on your home screen for faster access to your wallet.",
"title": "Open the Coin98 Wallet app"
},
"step2": {
"description": "You can easily backup your wallet using our backup feature on your phone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the WalletConnect button"
}
},
"extension": {
"step1": {
"description": "Click at the top right of your browser and pin Coin98 Wallet for easy access.",
"title": "Install the Coin98 Wallet extension"
},
"step2": {
"description": "Create a new wallet or import an existing one.",
"title": "Create or Import a wallet"
},
"step3": {
"description": "Once you set up Coin98 Wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"coinbase": {
"qr_code": {
"step1": {
"description": "We recommend putting Coinbase Wallet on your home screen for quicker access.",
"title": "Open the Coinbase Wallet app"
},
"step2": {
"description": "You can easily backup your wallet using the cloud backup feature.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
},
"extension": {
"step1": {
"description": "We recommend pinning Coinbase Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Coinbase Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"compass": {
"extension": {
"step1": {
"description": "We recommend pinning Compass Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Compass Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"core": {
"qr_code": {
"step1": {
"description": "We recommend putting Core on your home screen for faster access to your wallet.",
"title": "Open the Core app"
},
"step2": {
"description": "You can easily backup your wallet using our backup feature on your phone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the WalletConnect button"
}
},
"extension": {
"step1": {
"description": "We recommend pinning Core to your taskbar for quicker access to your wallet.",
"title": "Install the Core extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"fox": {
"qr_code": {
"step1": {
"description": "We recommend putting FoxWallet on your home screen for quicker access.",
"title": "Open the FoxWallet app"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
}
},
"frontier": {
"qr_code": {
"step1": {
"description": "We recommend putting Frontier Wallet on your home screen for quicker access.",
"title": "Open the Frontier Wallet app"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
},
"extension": {
"step1": {
"description": "We recommend pinning Frontier Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Frontier Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"im_token": {
"qr_code": {
"step1": {
"title": "Open the imToken app",
"description": "Put imToken app on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap Scanner Icon in top right corner",
"description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."
}
}
},
"iopay": {
"qr_code": {
"step1": {
"description": "We recommend putting ioPay on your home screen for faster access to your wallet.",
"title": "Open the ioPay app"
},
"step2": {
"description": "You can easily backup your wallet using our backup feature on your phone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the WalletConnect button"
}
}
},
"kaikas": {
"extension": {
"step1": {
"description": "We recommend pinning Kaikas to your taskbar for quicker access to your wallet.",
"title": "Install the Kaikas extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
},
"qr_code": {
"step1": {
"title": "Open the Kaikas app",
"description": "Put Kaikas app on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap Scanner Icon in top right corner",
"description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."
}
}
},
"kaia": {
"extension": {
"step1": {
"description": "We recommend pinning Kaia to your taskbar for quicker access to your wallet.",
"title": "Install the Kaia extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
},
"qr_code": {
"step1": {
"title": "Open the Kaia app",
"description": "Put Kaia app on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap Scanner Icon in top right corner",
"description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."
}
}
},
"kraken": {
"qr_code": {
"step1": {
"title": "Open the Kraken Wallet app",
"description": "Add Kraken Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"kresus": {
"qr_code": {
"step1": {
"title": "Open the Kresus Wallet app",
"description": "Add Kresus Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"magicEden": {
"extension": {
"step1": {
"title": "Install the Magic Eden extension",
"description": "We recommend pinning Magic Eden to your taskbar for easier access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"metamask": {
"qr_code": {
"step1": {
"title": "Open the MetaMask app",
"description": "We recommend putting MetaMask on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
},
"extension": {
"step1": {
"title": "Install the MetaMask extension",
"description": "We recommend pinning MetaMask to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"nestwallet": {
"extension": {
"step1": {
"title": "Install the NestWallet extension",
"description": "We recommend pinning NestWallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"okx": {
"qr_code": {
"step1": {
"title": "Open the OKX Wallet app",
"description": "We recommend putting OKX Wallet on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
},
"extension": {
"step1": {
"title": "Install the OKX Wallet extension",
"description": "We recommend pinning OKX Wallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"omni": {
"qr_code": {
"step1": {
"title": "Open the Omni app",
"description": "Add Omni to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your home screen, scan the code and confirm the prompt to connect."
}
}
},
"1inch": {
"qr_code": {
"step1": {
"description": "Put 1inch Wallet on your home screen for faster access to your wallet.",
"title": "Open the 1inch Wallet app"
},
"step2": {
"description": "Create a wallet and username, or import an existing wallet.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the Scan QR button"
}
}
},
"token_pocket": {
"qr_code": {
"step1": {
"title": "Open the TokenPocket app",
"description": "We recommend putting TokenPocket on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
},
"extension": {
"step1": {
"title": "Install the TokenPocket extension",
"description": "We recommend pinning TokenPocket to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"trust": {
"qr_code": {
"step1": {
"title": "Open the Trust Wallet app",
"description": "Put Trust Wallet on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap WalletConnect in Settings",
"description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."
}
},
"extension": {
"step1": {
"title": "Install the Trust Wallet extension",
"description": "Click at the top right of your browser and pin Trust Wallet for easy access."
},
"step2": {
"title": "Create or Import a wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up Trust Wallet, click below to refresh the browser and load up the extension."
}
}
},
"uniswap": {
"qr_code": {
"step1": {
"title": "Open the Uniswap app",
"description": "Add Uniswap Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"zerion": {
"qr_code": {
"step1": {
"title": "Open the Zerion app",
"description": "We recommend putting Zerion on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
},
"extension": {
"step1": {
"title": "Install the Zerion extension",
"description": "We recommend pinning Zerion to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"rainbow": {
"qr_code": {
"step1": {
"title": "Open the Rainbow app",
"description": "We recommend putting Rainbow on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "You can easily backup your wallet using our backup feature on your phone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
}
},
"enkrypt": {
"extension": {
"step1": {
"description": "We recommend pinning Enkrypt Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Enkrypt Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"frame": {
"extension": {
"step1": {
"description": "We recommend pinning Frame to your taskbar for quicker access to your wallet.",
"title": "Install Frame & the companion extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"one_key": {
"extension": {
"step1": {
"title": "Install the OneKey Wallet extension",
"description": "We recommend pinning OneKey Wallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"paraswap": {
"qr_code": {
"step1": {
"title": "Open the ParaSwap app",
"description": "Add ParaSwap Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
}
},
"phantom": {
"extension": {
"step1": {
"title": "Install the Phantom extension",
"description": "We recommend pinning Phantom to your taskbar for easier access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"rabby": {
"extension": {
"step1": {
"title": "Install the Rabby extension",
"description": "We recommend pinning Rabby to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"ronin": {
"qr_code": {
"step1": {
"description": "We recommend putting Ronin Wallet on your home screen for quicker access.",
"title": "Open the Ronin Wallet app"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "After you scan, a connection prompt will appear for you to connect your wallet.",
"title": "Tap the scan button"
}
},
"extension": {
"step1": {
"description": "We recommend pinning Ronin Wallet to your taskbar for quicker access to your wallet.",
"title": "Install the Ronin Wallet extension"
},
"step2": {
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",
"title": "Create or Import a Wallet"
},
"step3": {
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",
"title": "Refresh your browser"
}
}
},
"ramper": {
"extension": {
"step1": {
"title": "Install the Ramper extension",
"description": "We recommend pinning Ramper to your taskbar for easier access to your wallet."
},
"step2": {
"title": "Create a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"safeheron": {
"extension": {
"step1": {
"title": "Install the Core extension",
"description": "We recommend pinning Safeheron to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"taho": {
"extension": {
"step1": {
"title": "Install the Taho extension",
"description": "We recommend pinning Taho to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"wigwam": {
"extension": {
"step1": {
"title": "Install the Wigwam extension",
"description": "We recommend pinning Wigwam to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"talisman": {
"extension": {
"step1": {
"title": "Install the Talisman extension",
"description": "We recommend pinning Talisman to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import an Ethereum Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"xdefi": {
"extension": {
"step1": {
"title": "Install the XDEFI Wallet extension",
"description": "We recommend pinning XDEFI Wallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"zeal": {
"qr_code": {
"step1": {
"title": "Open the Zeal app",
"description": "Add Zeal Wallet to your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the QR icon and scan",
"description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."
}
},
"extension": {
"step1": {
"title": "Install the Zeal extension",
"description": "We recommend pinning Zeal to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"safepal": {
"extension": {
"step1": {
"title": "Install the SafePal Wallet extension",
"description": "Click at the top right of your browser and pin SafePal Wallet for easy access."
},
"step2": {
"title": "Create or Import a wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up SafePal Wallet, click below to refresh the browser and load up the extension."
}
},
"qr_code": {
"step1": {
"title": "Open the SafePal Wallet app",
"description": "Put SafePal Wallet on your home screen for faster access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap WalletConnect in Settings",
"description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."
}
}
},
"desig": {
"extension": {
"step1": {
"title": "Install the Desig extension",
"description": "We recommend pinning Desig to your taskbar for easier access to your wallet."
},
"step2": {
"title": "Create a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
}
},
"subwallet": {
"extension": {
"step1": {
"title": "Install the SubWallet extension",
"description": "We recommend pinning SubWallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
},
"qr_code": {
"step1": {
"title": "Open the SubWallet app",
"description": "We recommend putting SubWallet on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
}
},
"clv": {
"extension": {
"step1": {
"title": "Install the CLV Wallet extension",
"description": "We recommend pinning CLV Wallet to your taskbar for quicker access to your wallet."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Refresh your browser",
"description": "Once you set up your wallet, click below to refresh the browser and load up the extension."
}
},
"qr_code": {
"step1": {
"title": "Open the CLV Wallet app",
"description": "We recommend putting CLV Wallet on your home screen for quicker access."
},
"step2": {
"title": "Create or Import a Wallet",
"description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
}
},
"okto": {
"qr_code": {
"step1": {
"title": "Open the Okto app",
"description": "Add Okto to your home screen for quick access"
},
"step2": {
"title": "Create an MPC Wallet",
"description": "Create an account and generate a wallet"
},
"step3": {
"title": "Tap WalletConnect in Settings",
"description": "Tap the Scan QR icon at the top right and confirm the prompt to connect."
}
}
},
"ledger": {
"desktop": {
"step1": {
"title": "Open the Ledger Live app",
"description": "We recommend putting Ledger Live on your home screen for quicker access."
},
"step2": {
"title": "Set up your Ledger",
"description": "Set up a new Ledger or connect to an existing one."
},
"step3": {
"title": "Connect",
"description": "A connection prompt will appear for you to connect your wallet."
}
},
"qr_code": {
"step1": {
"title": "Open the Ledger Live app",
"description": "We recommend putting Ledger Live on your home screen for quicker access."
},
"step2": {
"title": "Set up your Ledger",
"description": "You can either sync with the desktop app or connect your Ledger."
},
"step3": {
"title": "Scan the code",
"description": "Tap WalletConnect then Switch to Scanner. After you scan, a connection prompt will appear for you to connect your wallet."
}
}
},
"valora": {
"qr_code": {
"step1": {
"title": "Open the Valora app",
"description": "We recommend putting Valora on your home screen for quicker access."
},
"step2": {
"title": "Create or import a wallet",
"description": "Create a new wallet or import an existing one."
},
"step3": {
"title": "Tap the scan button",
"description": "After you scan, a connection prompt will appear for you to connect your wallet."
}
}
}
}
}
`;function sOt(t,e){return Object.defineProperty(t,"__recipe__",{value:e,writable:!1}),t}var XLe=sOt;function QLe(t){var{conditions:e}=t;if(!e)throw new Error("Styles have no conditions");function n(r){if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return{[e.defaultCondition]:r}}if(Array.isArray(r)){if(!("responsiveArray"in e))throw new Error("Responsive arrays are not supported");var s={};for(var a in e.responsiveArray)r[a]!=null&&(s[e.responsiveArray[a]]=r[a]);return s}return r}return XLe(n,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:t.conditions}]})}function iOt(t){var{conditions:e}=t;if(!e)throw new Error("Styles have no conditions");var n=QLe(t);function r(s,a){if(typeof s=="string"||typeof s=="number"||typeof s=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return a(s,e.defaultCondition)}var o=Array.isArray(s)?n(s):s,l={};for(var c in o)o[c]!=null&&(l[c]=a(o[c],c));return l}return XLe(r,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createMapValueFn",args:[{conditions:t.conditions}]})}function aOt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oOt(t){var e=aOt(t,"string");return typeof e=="symbol"?e:String(e)}function lOt(t,e,n){return e=oOt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fbe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function FW(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fbe(Object(n),!0).forEach(function(r){lOt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fbe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var cOt=t=>function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=Object.assign({},...n.map(c=>c.styles)),a=Object.keys(s),o=a.filter(c=>"mappings"in s[c]),l=c=>{var u=[],d={},f=FW({},c),x=!1;for(var g of o){var y=c[g];if(y!=null){var v=s[g];x=!0;for(var C of v.mappings)d[C]=y,f[C]==null&&delete f[C]}}var N=x?FW(FW({},d),f):c,P=function(){var F=N[T],$=s[T];try{if($.mappings)return 1;if(typeof F=="string"||typeof F=="number")u.push($.values[F].defaultClass);else if(Array.isArray(F))for(var L=0;L<F.length;L++){var z=F[L];if(z!=null){var X=$.responsiveArray[L];u.push($.values[z].conditions[X])}}else for(var ne in F){var J=F[ne];J!=null&&u.push($.values[J].conditions[ne])}}catch(K){throw K}};for(var T in N)P();return t(u.join(" "))};return Object.assign(l,{properties:new Set(a)})},uOt=t=>t,dOt=function(){return cOt(uOt)(...arguments)};function ZLe(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=ZLe(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function JLe(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=ZLe(t))&&(r&&(r+=" "),r+=e);return r}var fOt="AEkU4AngDVgB0QKRAQYBOwDqATEAnwDbAIUApABsAOAAbwCRAEYAiQBPAHYAPgA+ACsANwAlAGMAHwAvACsAJQAWAC8AGwAiACIALwAUACsAEQAiAAsAGwARABcAGAA6ACkALAAsADUAFgAsABEAHQAhAA8AGwAdABUAFgAZAA0ADQAXABAAGQAUABIEqgYJAR4UFjfDBdMAsQCuPwFnAKUBA10jAK5/Ly8vLwE/pwUJ6/0HPwbkMQVXBVgAPSs5APa2EQbIwQuUCkEDyJ4zAsUKLwKOoQKG2D+Ob4kCxcsCg/IBH98JAPKtAUECLY0KP48A4wDiChUAF9S5yAwLPZ0EG3cA/QI5GL0P6wkGKekFBIFnDRsHLQCrAGmR76WcfwBbBpMjBukAGwA7DJMAWxVbqfu75wzbIM8IuykDsRQ7APcta6MAoX0YABcEJdcWAR0AuRnNBPoJIEw3CZcJiB4bVllM44NCABMADAAVAA5rVAAhAA4AR+4V2D3zOVjKleYuChAdX01YPewAEwAMABUADmsgXECXAMPrABsAOQzFABsVW6n7Adq4HB0FWwXiAtCfAsSwCkwcpGUUcxptTPUAuw1nAuEACy00iRfJkQKBewETGwC9DWcC4QALLQFIUCWRTAoDLfsFMgnXaRetAddDAEkrEncCMRYhAusnuTdrADnhAfUlAMcOy7UBG2OBALEFAAUAitNJBRvDHwcXAKgn0QGhKy0DmwBnAQoZPu03dAQYFwCqAccCIQDTKxJzOvNQsAWQOncnNUgF+icFWQVYr7gFaTtdQhI6WEGXe5NmX6H4CxMDxQcl8XcjBKNLAlNTAnUbqycBj6OlNVsDRRcEg2EJANEGqz8vIwcpAjldAGsBYR9xAIMdGQCVAUm3ACdpFwGvxQM3LSFDUwFvWQZlAmUA8UkXAykBBQBJQQCrAF0AcwArtQYH8+8ZjX8ACSEAKQCzG0cB0QHbBwsxl3iB6AAKABEANAA9ADgzd3nTwBBfEFwBTQlMbDoVCwKsD6YL5REVDNEqy9PYADSpB+sDUwfrA1MDUwfrB+sDUwfrA1MDUwNTA1McCvAa08AQXw9IBG0FjgWLBNYIgyZJEYEHKAjSVA10HhxHA0UA/CMlSRw7kzMLJUJMDE0DB/w2QmynfTgDRzGrVPWQogPLMk85bAEecRKgACoPcxw1tU5+ekdxoApLT661f0liTmcCvjqoP/gKIQmTb7t3TgY9EBcnoRDzDC8BsQE3DelL1ATtBjcExR95GRUPyZWYCKEt2QzpJt8unYBWI/EqfwXpS/A82QtJUWQPVQthCd86X4FKAx0BCSKHCtkNNQhpEO8KxWcN4RFBBzUD0UmWAKEG/QsNHTEVsSYMYqgLBTlzBvca8guLJqsTJXr4Bc8aHQZJASUa+wDLLuOFrFotXBhPWwX/CyEjwxSkUBwNIUCzeEQaFwcRJaUCjUNsSoNRMh6PIfI8OQ1iLg9ReAfxPAEZSwt9PJpGp0UKEc4+iT1EIkVMKAQxeywrJ4cJyw+BDLV8bgFVCR0JrQxtEy0REzfBCDUHFSmXICcRCB1GkWCWBPObA+8TzQMHBTsJPQcPA7EcKRMqFSUFCYEg0wLvNtEurwKLVnwBEwXHDyEf2xBMR9wO5QiXAmEDfyXnACkVHQATIpcIP18AW4/UUwEuxwjDamgjcANjFONdEW8HjQ5TB6McLxW7HN1wxF4HhgQon6sJVwFxCZUBWwTfCAU1V4ycID1nT4tUGJcgXUE7XfgCLQxhFZtEuYd0AocPZxIXATEBbwc1DP0CcxHpEWcQkQjnhgA1sTP0OiEESyF/IA0KIwNLbMoLIyb1DPRlAZ8SXgMINDl36menYLIgF/kHFTLBQVwh7QuOT8kMmBq9GD5UKhngB7sD7xrvJ+ZBUwX7A58POkkz6gS5C2UIhwk7AEUOnxMH0xhmCm2MzAEthwGzlQNTjX8Ca4sGMwcHAGMHgwV14QAZAqMInwABAMsDUwA1AqkHmQAVAIE9ATkDIysBHeECiwOPCC3HAZErAe8lBBe/DBEA8zNuRgLDrQKAZmaeBdlUAooCRTEBSSEEAUpDTQOrbd0A1wBHBg/bQwERp0bHFt8/AdtrJwDDAPcAATEHAT0ByQHvaQCzAVsLLQmer7EBSeUlAH8AEWcB0wKFANkAMQB77QFPAEkFVfUFzwJLRQENLRQnU10BtwMbAS8BCQB1BseJocUDGwRpB88CEBcV3QLvKgexAyLbE8lCwQK92lEAMhIKNAq1CrQfX/NcLwItbj1MAAofpD7DP0oFTTtPO1Q7TztUO087VDtPO1Q7TztUA5O73rveCmhfQWHnDKIN0ETEOkUT12BNYC4TxC2zFL0VyiVSGTkauCcBJeBVBQ8ALc9mLAgoNHEXuAA7KWSDPWOCHiwKRxzjU41U9C0XAK1LnjOrDagbEUQ8BUN16WImFgoKHgJkfQJiPldJq1c3HAKh8wJolAJmBQKfgDgXBwJmNwJmIgRqBHsDfw8Dfo45AjlzEzl+Oh8fAmwZAjIyOAYCbcMCbarrhi9jQScBYwDaAN0ARgEHlAyJAPoHvgAJsQJ3KwJ2njsCeUc/Ani2GVjXRapG0wJ8OwJ6xAJ9BQJ87AVVBRxH/Eh5XyAAJxFJVEpXERNKyALQ/QLQyEsjA4hLA4fiRMGRLgLynVz/AwOqS8pMKSHLTUhNqwKLOwKK1L0XAxk/YwGzAo4zAo5YPJN9Ao7VAo5YdFGwUzEGUtBUgQKT9wKTCADlABhVGlWrVcwCLBcpkYIy3XhiRTc1ApebAu+uWB2kAFUhApaLApZ4mAClWahaBX1JADcClrEClkpcQFzNApnHAplgXMZdAxUCnJc5vjqZApwSAp+XAp60hgAZCy0mCwKd7QKejgCxOWEwYesCns8CoGoBpQKemxsCnkqhY8RkIyEnAierAiZ6AqD3AqBIAqLZAqHAAqYrAqXKAqf7AHkCp+5oeGit/0VqGGrNAqzfAqyqAq1jAqz+AlcZAlXYArHd0wMfSmyTArK5CQKy5BNs3G1fbURbAyXJArZYNztujAMpQQK4WgK5QxECuSZzcDJw3QK9FQK71nCSAzINAr6Ecf4DM20CvhZzHnNLAsPHAsMAc350RzFBdNwDPKMDPJYDPbsCxXgCxkMCxgyFAshlTQLIQALJSwLJKgJkmQLdznh1XXiqeSFLzAMYn2b+AmHwGe+VIHsHXo5etw0Cz2cCz2grR0/O7w+bAMKpAs9vASXmA04OfkcBAtwjAtuGAtJLA1JYA1NbAP0DVYiAhTvHEulcQYIYgs+CyoOJAtrDAtnahAyERac4A4ahACsDZAqGbVX1AFEC32EC3rRvcwLiK+0QAfMsIwH0lwHyzoMC6+8C6Wx1Aur1AurgAPVDAbUC7oUC65iWppb/Au47A4XcmHVw3HGdAvL/AGUDjhKZjwL3DwORagOSgwL3lAL51QL4YpoYmqe3M5saA51/Av72ARcANZ8Yn68DBYkDpmYDptUAzcEDBmahhKIBBQMMRQELARsHaQZdtWMBALcEZ7sNhx6vCQATcTUAHwMvEkkDhXsBXyMdAIzrAB0A5p8Dm40IswYbn8EApwURu+kdPT4WeAVoNz5AK0IhQrRfcRFfvACWxQUyAJBMGZu5OyZgMhG6zw4vGMYYicn2BVcFWAVXBVgFYwVYBVcFWAVXBVgFVwVYBVcFWEYVCNeFZwICAgpkXukrBMkDsQYvu7sAuwSnuwDnQCkWsgVGPmk+cEI/QrZfdTdf6ABYETOrAIz+zGvL/KbnRno9JiMEKxYnNjV+bd9qwfEZwixpAWvXbjAXBV8FasnBybgIz0lbAAAACnxefYu+ADM/gQADFtEG5a0jBQCMwwsDAQ0A5WUdPSQfSkKxQrxBOCNfJ2A2JzgjCcE9CkQ/Qz54PoE+cD5xAolCvElCO1/LTk9qTQosa1QvagtuH1/gMzobCWebCmIjKzwdJkKrQrwrzAHL/F/JDh8uCQgJIn6d32o6LUoXyavJrAllwcvMCmBBXw/lEKMRAJONHUVCJRupbTnOOAozP0M+cEI/HAcKHUxHbFssLVrhvBIKfe0dK0I/HF0ISgkOM1RDQjcEO0OcLAqBGy1CPxv1CFMiIxgwMQAFj2HwXgpxZMlgC2AtI25DYBk5AhseYLMGAmsQZU5gTREBZOdgFWCVYH1gs2BLYJFoFhcGtQ7cVam8WgtDFqsBuyvNwQIfFQAcAx4BeQJsLzCVUoABigq4RxoA5CN0jgrKDaZN6gGbAoecTwVAXwD39wkANBZXDAulDCQfuq9HAE8MNAAVE58rggh6AtILS2URGwDYTgZ1BAoeWgAxALa4AZonCxZvqyQ4nxkBWwGGCfwD2e0PBqoGSga5AB3LValaCbthE4kLLT8OuwG7ASICR1ooKCggHh8hLBImBiEMjQBUAm5XkEmVAW4fD3FHAdN1D85RIBmpsE3qBxEFTF8A9/cKAHoGJGwKKwulODAtx69WDQsAX7wLAGNAlQh6AOpN7yIbvwAxALa4AZonLTsOzgKQGHtQu1jIdHKO16WbDvWZFT0b7AEpEFwSBg8bAccJOhCTBRArDDYLABEAs84BAgCkAOEAmIIABWtXLwAUAFsbxi5sdioNwRACOyQz0+EcHgsbfQJ7Ls6hHATBCqrxbAA3OS0Opge7CQAQOi7OERkAfavaHA+7GkcczaF3HgE9Kl8cAuugCAHCAULz5B9lAb4Jtwz6CDwKPgAFwAs9AksNuwi8DTwKvC7OoSoJPA67BZgBG2sKD4sa4QHDARELuxY7AKALOxC7BBige9wAO2sMPAACpgm8BRvQ9QUBvgH6bsoGewAHuwG7D00RErwBAQDqAQAAdBVbBhbLFPxvF7sYOwAuuwLrDlaouwAeuwJVICp/AAG7AALjAAg7FTwVuwAbuwG9KOClWw6/xAD0AGj7L7ZtvgNIo7vIqDsDAbuVJ0sAAlsACrsEAOfdGbsIGnsIoQUK/3AA37unuxjbGruji3lyBvupm4MAErsGGwsBvAAAhgBtuwYAC7unOwEaO7oIoZzKAbsL7QfAqTsA4XsBvwAA5QAVuwAG+wAJuwBpiwAauwAOuwIYu45pFfsAAVsADmsALkseAAa7ABe7CCEADUoBwgC3ryYBwAAAtAAOmwG+J+QAsloAHBsBv/7hCqEABcYLFRXbAAebAEK7AQIAabsAC3sAHbsACLsJoQAFygBunxnVAJEIIQAFygABOwAH2wAdmwghAAaaAAl7ABsrAG0bAOa7gAAIWwAUuwkhAAbKAOOLAAk7C6EOxPtfAAc7AG6cQEgARwADOwAJrQM3AAcbABl7Abv/Aab7AAobAAo7AAn7p+sGuwAJGwADCwAQOwAAFDsAEWsAD4sADesADbsAGQsGFhsAFTsAbpsWswG7ALoAEzsDAGkrCgDhSwACOwAEUgAXewUbAAbQABi7AAv7AF+7AGv7AOSLAbsAF3YBvAABcguhAAVKHgF7KFIAOUUA/gcNDHIAKCpwAaQFCF4BvF4jDAkHb0tsXyqJHzwUYi02A6EKtAHYABYC0QNuAXZyR1IUIQNPAhU+ASwGA3NGvHtSekAAKQAxAfsAUwrbAHuQLAErAHblDREyRgFKAFcFAAFQAQeKzAB4OwQgpQBaANYVAJVoNx+LAM1rsQDP1BYIwnVzGxhWHQnRAYiQqyJTU01IEjzCifkAfxw3QCkr4BGXTwByASksMClCGQ8DMFUE98XuAEtl3ABqAnECPxF6Osd4LjXVBgUAEBsdCggMKgQfHSlOU04IuboAChLNACYAARoAhgCJAI41AO4AtADgAJ08ALsAqwCmAKEA8gCfANMAnADrAQwBBwDAAHkAWgDLAM0BBwDXAOsAiACiATUA4wDYANUDAQcqM9TU1NS2wNzN0M5DMhcBTQFXL0cBVQFkAWMBVgFHS0NFaA0BThUHCAMyNgwHACINJCYpLDg6Oj09PT4/DkAeUVFRUVNTUlMpVFVXVlYcXWFhYGJhI2ZocG9ycnJycnJ0dHR0dHR0dHR0dHZ2d3Z1WwBA7ABFAJYAdAAuAGLyAIoAUwBTADMCc+kAh//y8gBgAI/sAJsASwBeAGD5+aoAgQCBAGUAUgCtAB4AsgB/AjwCPwD4AOMA+gD6AOQA+wDlAOUA5ADiACkCdwFNATwBOgFQAToBOgE6ATUBNAE0ATQBGAFUDwArCAAATRcKFgMVFg4AigCSAKIASwBkGAItAHAAaQCRAxIDJCoDHkE+RykAiwJLAMMCUwKgALoCkgKSApICkgKSApIChwKSApICkgKSApICkgKRApEClAKcApMCkgKSApACkAKQApACjgKRAnEB0AKTApsCkgKSApEWeQsA+gUDpwJdAjYXAVAQNQLeEQorEwFKNxNNkQF3pDwBZVkA/wM9RwEAAJMpHhiPagApYABpAC4AiQOUzIvwroRaBborDsIRAZ3VdCoLBCMxbAEzWmwBsgDdfoB/foB+gYKCfoOGhH6FiIaAh4KIgol+in6LfoyKjX6Ofo+CkH6RfpJ+k36Ug5WIloKXftoC2WzhAtdsAIJsJGygAINsbARCBD8EQQREBEIESARFBEAERgRIBEcEQwRFBEgAlmZsAKMDh2wAtGYBBWwAyVFsbADPbAIMbAD2WmwA9gEZAPYA9AD0APUA9AN8XmzUhCNlvwD2APQA9AD1APQcbGwAiVpsAPYAiQEZAPYAiQLsAPYAiQN8XmzUhCNlvxxsAPdabAEZAPYA9gD0APQA9QD0APcA9AD0APUA9AN8XmzUhCNlvxxsbACJWmwBGQD2AIkA9gCJAuwA9gCJA3xebNSEI2W/HGwCQwE2bAJKATlsAkvBbGwCV2xsA54C7AOeA54DnwOfA58DnwN8XmzUhCNlvxxsbACJWmwBGQOeAIkDngCJAuwDngCJA3xebNSEI2W/HGwEN2wAiQQ4AIkGjTFtIC9s1m4DJmwA/QDGWgJsbABVWv4UMgJsbACJAmwAVAEAuV5sAmxebGwAiV5sAmxebD3YAEls1gJsbEZFNiJ9FGVAe8xvEZKvxVfKZszAVTBzYBH2d1iyUXEHH7twNw7eZF5JJRHI5EgaRr5D20/3dfONrFLSq5qSrrgd2CEUq722WBQ/LzpA+bx1oREI5xy4BDSZNun0ZWORUJqInZSyMaioyvfSI0l5uFDzbWaQ28/zdB0hwR4OQZ0/jn9ALSLNikjFYGfqR389qtFlhD3a6KdIh97rhZYpywuLc7o8ql5/X8KCbPU3L/QlmCowhRXhsGDvg6wUNprA9bM/49uxlAj7ZVy3ouEY/BgFXBNyK0TLrSjZWeJm/T4nz6QGLT3cJNtWRZVZTvIdtaxMMJRHgig9+S11LjBh7Inr06ykoch1U097Rw0hvgmOrydQyaWcEQDg0RavuMuT0zYabUZl1e33HNSK1oNUCS03eh+9C2EvF3fq9h+XBaAMFuoWeZf+mfZgL4HzyiKDIUtfNU4oFu0aE9qt3VA3U4D3fOSrAcYVnjG3cSkp1vhXZnp3JQm4JknKdBitO2NVnGCYQwU3YMWHWB87NEd+4AHuOKI8BSIH92reW0pfs+kWCTJxDCbRjFv8Cfc4/DSBYJScJYTeAEgg9wTEvcwd/QuHRHqGzAQ4fXf5FUI1lPrO+fvEcPl4JInM1z9AtBT2bL4QYEREe7KiSnnxTwtmAFjn8lqT3mND8qTktX2F16Ae9cakqJ6/pEQsHURqyqWlRMCzKXRKfCHT7sYHWx9/T/ugYTFY6iVN3Btm58ATJR5alYZybKMWojwOw3HbFn23NFyeLl7+Er82RchyYuBoGQ3j7SAWNxiYvp5U+Fq/DEzB9cG5DlJWsqkosRze92OVlCtQEYo1S1lF72Z8xWc4ld/+fFcfTEDTFb9d8tJGQ75dpJEvcWyGmGBiTbiWDdGOcw93Dmxq5ISUrmasygONfHLvhgo83HQZenbdBtSzBkvYrCEQ/xEDMhMZsN6gqplx5jGG9mSQLhM81UEdEeJ59sdNJDAFy/gPyJoKlwPZgB/MkC/kICLiCB8va+nCdO2ry4aDfkmPFpF/H/SGQ3LJ6aAv9dtJ8DniHtLOckZix0BVb0iR5V3LAp521LBSIi6AtV7r2ZB/hQEvAw54EFNOQcFnl1xGUIc67tqK1INNwD2n/RbwgzO9h45LM6VMuN8V1ZNIQ6t+Xy3lTqyVCD5kqLy/t3/b8MLbgDg8JIWDkSZ+LrGhhr+gYpH+pr1TnCUnZPjpUdw6bSL6MWVXoDDciQDWECwU2e6VEpfrcOBbrSOijqGkEIoJPbpmeJLkcwbvA0yWIixQVjo0HnYh7fji+Dfdq1mtV1lG2Zz9R7eFMHS+FK7nybutu2fwzDpFldO2pZBshsHJWaltn3PWOoGJpCT2jE8EHOuC6FkejNWcfsWCqNqMLP9xTwcWArj2EiiI7D+EaDi7/2cqHL1gPiF6C/J7aUo7RQqogPZ11WqbyP97nsoMxPOC78wZMF7B1Y0g7JNXJV/nN1m4xx8hbqWz07KSaqr5hE4icB326DMR/vUKX9LoNjle/ZWtbUhrTAcsdgrLlG5Ne8aiR0bS/2ZhpNOVVxavWIZsEM/rd68EB4vjbbD13NkMK1qvMk74vGbSkL7ULO0sZ9R6APSCo6KH+Xn98wEdw1bCPAnDTaBsD6sidAGN58uiH4a3ovG1KyZAu2XtyGgF/vgWKGxw9R1lfAVcfuYE71DHuxtTzfGZnHaDpDGWmfEq0N4GawE7yIkaoz8jcmVmzJe1ydM8q0p08YIxFcY1YcqQc1djWBEoNETDFcgk5waRftEJasPREkrV++N/TOKkERF1fCLrXS8DFGYGRBeECMQRNEs0ES3FzUtXCcNxpYEM3Uei6XodZruXUIRnn+UXf2b/r7n1vQutoi6WoIbW7svDNWBbUWcDUc7F9SJK3bvSy9KIqhgyJHoW2Kpvv0J4ob14HFXGWWVsYXJzjwxS+SADShTgCRjhoDgjAYRGxwJ1Vonw+cpnCKhz8NQPrb0SFxHIRbmG95Q2hlC4mDxvPBRbkFa60cvWakd7f0kVBxxktzZ9agPJEWyA63RSHYVqt8cPrs2uFJ3rS3k9ETGKn5+A6F9IOrdZHfT1biEyUJKEvwzuscwshGCBJvd16TrefW03xVnJf4xvs72PdxrMidjJO8EiWyN/VWyB3fv9kc34YIuZTFtXGo9DuG3H1Uka5FgBMwDPEvRcSabi3WakNQkXFecJlFk6buLVk5YHpuKWTw6oF632FPPSVIVl5hgUAeHhj0t/sw/PEEvThLQDDFE34eCg/rLOyXT3r+L98oRKrlTO0MdALYQ3rRQqC7d822dJPGxF1K4J2TtfPSMFaCAg0n0NGk9yiaKKOJD1v2aBX9HUOIawjjfvwCmjHZJTR62R9c9x33JnBjWrN4QYEOmehy0oZMP9XM9Zyi6TYoe07PaLceRXcCWZiY/imRUWW6+mci7+wMxSdwMdbXckXtvhJH8sc4iQcTwm7yp+3f7CaesTTQB2qkgeXh+wFiSMXfMlH7Yil0OoZ2QTtRLTip2O0cLZ4SstqWHZ6H+8A2kZXhpm0kPbL9dUanTOvziqIUh6Ambwa3WrCb2eWbuCN3L1hgWUmjRC3JoL3dBhR3imSQI8xuCMfsszlji7cSShNSYdqCXPxEVwbqO9i5B6hf93YI7aeyI8jxgcVXK0I/klbvhSXjkjOIwZgPdVwmsFW7HGPLUAvDRuKm+itybRg7c8+Yqqjg824Qf+/NxsBSUNAK9KCoJpauFqK0XQULrWYj4FnxeKDuvr54iokpi+D57e6Y1zxRJJdsHnDR3JyraCUufHBRTKODWBVzthjm4k3/Hv+Q990XDVR+KW+TcJX045LW86EKhz/97aqj89A8ZvTk1//tczosU90loIPVaHuWegJU3wP//7XHcO7c0yQM2jM/IhQKrf8hiObHWiWDZManF8Uf/HzbmDfC2wT//aiZ4hGTv/xzgKwdb1sD6cGEkceow0s3b89/zg+3plyRm0HlZi886j5wUwFhdHiDTaBidZRo5cx/tMeLyguOATbzq17ydhzbrpxunuHx6lbFGiO97gsd4dk//7iCIo+Ew+hG2so5kvv+ITG4c1fzHPtu1Xn5QfUnqY3/uByVmB7gmnE/E+5zdm+6nDmoews5fr+NzThdSHzK4bBQOL9c4O8OI0xLSqjJ4lbniLJg1aFpQRLwaSMZmpkC9e/j6FOVrTQ6a/a4alGgfrl2ZL1sbHUQ3DOI7ntq9diHFfm3t1mul3rdJEJCHnlW/hlQntipMrpeMs7fUr6wK370D7VbXH0DUHzdYfRg/6Z11Ult1sffJS+heHbco15Sxy3+rDnPesqH1lajk0yu02hPUvEUqvcUXWXL7Ad0wNGMx5gOle4XJxq/r/YY0xdco2wRSEGwcT7YADlBrHc9ZbvzOL0QwyWCWWChB9Obg800v7tyBWaNvdwz+fL7Ph9i2irEeJkRgOzeEDw+JiD/V93vH9FgMEoFIJMoIuogmicZohf94SBuPn6hXaV9jP4VVVA/bu+Wg8S88GLtmEPSNRLdtlXx2XL/nuM8nKkhnlnjaropiKKLIH94pLIASci0pDBfj9Hi5BfaTSXQg5+PMjQX91Ktk4MOqK1K99l4BRPv5+vNovGZ3IxQv8ICvjV4/diThpoaM8uvd3D9d/DE477w3yAbW3IDm2i73pZ9aEj38JqS6h/s8/xgmUIVcuq2JTgefAyuoafzQxAuRASeg3NtG3ach/JEkyuX+JDt2PnDZTShUhyHHG3ttBg/6lhAchGjLJBtopj4e01MlCp2yqQRTr4sBBXru+lKaoanwYX8y2aWCJiR3KnhCOkYVFSvsO0oDRujUFOEptiNDTYrJoUbvOyvl4AhC9h3wORiTXK1MrpMfnvdnndnR/HRVSusMBgIxwrLdn3vq1VcncPiD0SquTx/kNmxeFyCT4uXVUd9AL+rSGmuq7OOCzDKeVPjiNWVaoP5KOFqYq5Xcuf/xW9S+u9eIq9GAtZWtQlgkRecjRtvG1NR4WXXpn+pwsTBTIy079Ikg8rSef1aVapIFcXCd6C2wHVjLXR+N0tw4Taw6x6H90BFRgNrtlq2up6hHKuV3inM5RJaQWZHd84e6RsKkk9po3dk9by54tpPw7cBkFas/G+GbHwuG+AwP55BZyXILTHCIVrPpXHEaUPYfL6nphJP1Rc10xG4UaCeY4IHCwuur8xmSQDgY4aVwhzWhjbtSHG8JO6P2i2nC9/0Bfx0zk6dYQq3aw7k5vIObD7SEKrxhz0fQ0+YTOfHW23CBNeZci1qNsUDhoeqmfyP6PvjoEjHk8QbrFyQVZPHVWijnb8YCM65iYNoEbvnchStZ/9cKg5Vd45j8KnB6UjzXl/bkyZx7VoD47ocUUi117WwgySSb4rXgLJ52Mv5XJbp3I+uBP81BUvOjy4Cacgi+GWWlC/8dwgqwiojjUBDnEOxyRyowwLQfytFra1OZS4XvRYr4uoamAfG3I/p2bA7G90yqKThH8Ke00Tqd+3l3dmJpaCZelBMYjGqNLVa3SM4+LQeL56gY6Bymy2LQPVOxjWfj5tq4o74swcxhyGJPynkS5xAjOXZP1/FAYcBT3u6qLoIkEfErwo4gozmyI1YCvM0oyI3ghjGPQSsof2sKUhq91WsKy9cYWN+4A2v4pG/Mxpdc6w6kI/HX7Xb0TuihmsiOy2wQIsrZbUmr3OBSUo6oDJNgQp+YqYkgTgYcWZDgawJw3DFfdzT//PhVUidgB2qa8uw/j9ToHBAS33iT8YLhhAfyXG0bQUFp7QmH7oQ3i6Flf4OTZLvJdh8pfuflmWu2ohm5pTiSg1pl3vq9uluTJwqXfh1hqy8e2iHoD+Y35gCIViTo6VOtK5dD8HYClucJucXASzwe2kPj4S4eYQtmkYHagXhAzp/F541xE8YFYqSPszDuz3soWzHy0p3E2jwZNQaIcGU9FNQwQxeDw0ZlK9dxXrj9IUHGUPTOyib8CqXmbZ7Ex54bn1rLx3qqAavu/gh6XjV0GmN1p+yyMK9HN5uYEvxgbAk43tsheREhyI+Q5WLIneKTGPmYiM/lxOp8fvqHy8YgXK0TlMiX0tliLI2JtfmWZP8eVV732sdYm+pcWzDzEmKLJZyeelyaZKkjPnnUO9keDwtgiLnmd5+t+Sr5y8brRnlvxcWEWfCqIALQYHvaXx6jTg4dAlye469uGwwOZVZCILLfGjaMg4LUCNMTtMSp1aC2y/3wR2t1v3w/iNBRQ+bNbtDqL2NAr7K4rUcyqbSpNrXZgAWXvjxBBtfYLK1uRYt3q2pfXJOAL0HtWcEwJLddOSJKV1SwvcvEuzg/4MPnA8MIUJOLqm3qI6wFyN99Ck6zYaV/zGSAzF/PGsaNa4vPLe5QnyuqVUnVQ6xELA6gbe53aGgeke+R/ycb2LJVyc7BhuzI90zA+c6wUDTb7NH//gdDSl2u/aW7lRJm8m1fLtPxcNuEM5JbkOCZKPM88HUsLRoC1pmKKlvWyeAXuxILbu0snpSxf8N+RgtLUSe5n2gdjOjoSTaN7mMZ7bF+cWk/MS8mFD4pcyl5UN7CbpFZH2a+Pm1VAnUTVfbw8qrmz1G9m5aKmRzY1SMhhPrlCn2t4uNUXNA3IFe6NOjSC1DEaAFZAfDlEkQCsbNhsZPj6NQPDSB3tLiTo0ZYoEbIeEIaKtU3Wk60rEszawTFuyHVd365LA/c/uarABN5M5rGq/dqTG3Ilye/5EKiYisisuzqNaZjmWv0z9TORc0CKbaTea214oNM9u2sXUZub/eqM3Pi/PjRSyQiOSwPWif2asTgu6hS6fb5UGosCWxdedMqdViIUUSSdIJx+qQ4KShfTT39VAWZbi+mB+iKICNwpt6cflY57Rcbs6d1kA26Iru73cuxYVlSvuJdcR5VfDYZRk8X0AXePROyw3Le6LaUdmTLzYsoNhhgQpd67xVNiHgk3pakmndeIAtTC4DCXy9oS6eU4CWxDdVmY53pKNbdAKmQsP37lrJZC6iDXMELGKcHjNuuZgcDyY8W/yv6ha3DX7OWm/35fpvhw55oitf4V+GULlcPWYyGGuVBdro19c8u0RDddDun40W7G5cSIzHLh/qZxb59R+EPY+wZ2XerkUim92hhXpKyW6WtAh6zQS97DrPyjCvKi3pCw96LeKynOpyjtsMQc2RmI/20zFOZcSa2AK++PoRcT6zeJyxlBZ7kk5mhqXGkLlM2hFKc+/T544xXP0Ua38Q6xdPTLTeG1PHnLMaOvksUQMrEFTB/lizCirmFQL8zYVU+OTeYQEFaITsBSMMYexS9HkajO2gGIf2micvntCZJsZQEwIH3/4JGJQGflBuH5rNXmnRRYXDQs3ZoEQoMtYDr1kFKUS/siiQSUxcTH9XYeBZiKDDFQoExREO9dddKQLO3BwMHvymCSTFyY+vxn3D27NDx6OlU092D5EDUwilttqVHpjJQDUceJYCLsK2swfXeNUVrBJT/w/sk+7si8rPtiMFis+oxvGdGQxirMBID700T39mULuNHzOyN+xBfcFACZcyngF1aSpv0JPkNUrAZTqfplv509cGXFUiEEm5dZb+OsP/blizqdK45/dSsIrufYTrCPY2lgJD6k6QljTfXVlHfYKSq+MsagyUcaMintyr95bD8kdTAeYNLNsMmo/Wdd8a2nStBP49ARIjqqpUHWY4q4mvO5Cq/CgCP+4/B+5zutGwX5pssgVLr1+fIM7WWLfiUQDk4c6ZdHZOWv5hG3g2dgQ5NXnpIY+BWwJpaouf25bXnjDzbHnQNofH/c6m+dEAS9Gs2h7pFRPKOBDnqswZ8KZjhId1ytHUTs533KwBoSiImoxKQUgZ7z6pA9QB3sZ8Cq0vwutJTTkfbX8AzCpm2cFXx/P22niUMHauU8IGc+78R6TsutoonoqFuoNA3l80t387YHMoL5KGAT1JO4zmx+vJ0LbLHlicHraSVYvJjnO9p++qnWgKw9OwFVVUagvZuf9qfiuum+hIicxP1q4zDnzkHsCNriLxBpxY9N+UOmqzdY1MunLMDgkMyi3uvnN3UBXJeZ8YLs5xr8QrOhimYoKuGBebZHAiBIkViv3DG8k2oNpp5OIgX6ulqaRN8V62QUPjn5tl1kPXhT9bcd8qIm8gi4or/FGbvQ6pgGSHmnayrugmf5E0upGxPRf/3xOtitGMaHLKJVm5zhglmVfI91o0yxhJZVS/5wQ8zfxK8Ylw0WmHXoGfRkoBRx9Hsnl/6sgTjAVwpmNuSeZtBwlX4qB8Bh8lxjqBDIuFGJ4I1wxN0XRlAAslzqMKwQfyA7OkuivCXfv+i+3XmhcBFM2n4jdT+NyUmBnQJPV3F2sZfKvJhUlXzSosFR4VevVVcOkFnnjdiRWc0TeSYxj41sJGYMbZTeLI3GvyZ8/gAAudQ1+4oFX+enX5V49MczGCYVBuoC4kHjp7ZVxj+clBwPr9k+v05SsezQK3enxLs1Nt/N7c7AImVUysjGou4iOohHo83Zs9/MI/OWB+OyXzOBD93NbApGHXrv8CVRHp2bwH+xB55cfNrdqFD35HSMx4iVmtzYAmSCIV8kXsHoq3DIb93riTWbubnjxbBW5zConVtbxLRStXHkIyAByaozME952Gc9aAdAbBpZSVCH88Uwb/4bPTVOVl+WoMYD7JIvK8VcMrJ8zHV4bbG0Dg7Kx17A4ej/ZcZ2Z5pVuVLUH1E/AccUTKm81SE+LQ6STTUDscUk0x2OWIbEORhg69tdoTGNkA1RfkGIRZHr5mCXOpLC55WWzCZoGPFUVtZRHwh0nq039CDdjEPo+JyaxSQAvDgR6Iqvxy0frrtEG1A385N81l05SSzN+IDm9bypF9m92EUqblnauZ5sjc37wRykOdl7w4o8WMgQsjii3EE/aJYDfHs1cH6DNBEujjcCc8qAefYFyIAURDcDnzun5UmkbBQsU4eu/W8I9nBE0qJKTdg2hwjq0+XV7a3TJ7R+alvJZCRia9lJ+grNB9dbrOmWEvUotMjvDhq4wV/kq4fvIBkzUGpDeYH74rne8uU3dgoNZdR9pUL6q9YDNRfOiF6Dyk+SYXQIghTjm9qR4tBHh0gnmF/9q3Qv22EzaLhSvDlDOxMrrCNRmLCl1jApzLrBCPn2mjn5zqK7OYK7VxOfQ5GfBfoPdyQwqFEgCVHkJ9oTnagRM3R0+rsuN5jQv9icCav/p1WqiEXSzCdLd/WEA6z6dDP7tPqPbeDYKAkVcz1lLGbFOC9b7cBd3MV0Ve8dZ89oR7OnxGS7uVpSry8banVZwpJg+nkH1jRBYa2BvBMY2xITH9ERXCjHzdZxs+ipdXP2DY7X+eWiBhtT2L0RRGTLPeazn5tpl4tu8iE2rWig731iuJDRbCHHy+g/Mb9+miAyVqfIpXT/iZeOxOxODO0hEpLM78I1+G2Z45yi3lS1K3m4WMQ559Lp4UML5vZUjYGJuxl+OPpUH5klpyBujkjprhei0TmUik10gjvNUp8mDkWlNKikmYspaVTqewbnOzJrmz8FLIpsT67EJLHIIfeDcWEfiP+DJrZ1jfxpoAb2abeMqLx+9RuZGzQoYtYVGgAWwEM9Kek2vPIeBNAKD6ao7nw6sgvfeLZPoXkbYO/tStHJdKzk+WFSFEU2NcALJAEP6S8pcnqqBBt57dwTrzQNCIdk2SocK4dLRbD/pu/VryKnm65ZYXiJCfHJk3mx9MRSl+nSK6OqEBSoGjz0/LADddwF/HqcfK3K3O+6YUGQcmj8pZL4PhZ6KrGkb8B38FmDvvLd3XQXbvS/FQmrXFTvJNkaN/FGo83KuS43BK1UfVnIqigGkCoP5fBda2MwAGTGNKX9K9t4Bx83pMFc5KSORmWKv+8VoVggWxoaBz3/9IBh6RwLd1tebwy89xvE5z6EEpXpDfrXWfRsMs6+ekUHH6idVosno55+xQ8Zqzelh0bxtJTgCcH3Z3/Cxlx9eNIS4JIFKOAVrDqbrXRszmY55a5+niJGHtkO3b6mnIDxLa1WXc7BAe33mt2KyM4Fbc3R6/WVTQN8QhlqAtave2WsQTqzWeSlKuGUVIJRqtObpv294rS0kDN1RKzdstZTXJebR2HlzsQ4P3NbMHUqFZMZw+/IKXnh4t+lY8qocp/B1oMszR03EFs3bPeND8QkItMvllObeCz3SZAjqZrobmLcrpFyQV7mwBjg3C3C8/bc5goQhv8j/IXMLGnt4mF7tybRDG5G0polxoUScQkPvmnga2/K+aapKeqSL0BTmo1Cm5g+booNOtdyKva2KoefRURaBk7113QKo3y+WTuFKtgETIK8HRluYS9DvlcciCDvnG8UaJRfZE2siZsiTHvRmN80xkUIInHeRZl5Re/+ATL6VhKFi8CZ/n/jbFV6T5pZ+Uoppvsi3qjacVFOJgWWfdlwVHKPW/TJO3na9hRM9bS2yo2rEsC6IBzRReVO6IesJU7PItzOamr+ROFfwGZmZ7ue8HNxAgLJKb7P3p8dMqk6Be5PJaT/5Rdc1deYVihWH9cjVKc9uz5EnfHqxLUkOO8iJUENBNVf5LyNy8zjLu/78k5WNTywiPfYeX3CPk7yc6CI3lum/CEZwfUaNpcI3KsPqfn2lmz3kd/acQjKA1ebkJaiuLD+epQ/Fc1llHXXMzofWzz/Kd29SNmOhcjMWw1jq1g3YfrXZ9rzXDYW4ZttfgfMi6oCUtBs0PkMVuxmq5lxEoCaSXPSqCJJ7MlKdRDidVt0AFlxk5cTdX++sBF2+E35mjwfm8ERVxH0FvuAQtsfA4V2G0TKTUxeyRGVjd/u6F1SvuAiU2/WaQjcNCU4Ep7VunXCYSbZj3U3wzu/LWM5MPlYuyQ3FOOCD/zt7K295hY2JhwF+ODDIZ676vGQFKveEQYkWj7lkK7rVmD7MhU0Y/tF8EcTTpo4/yqOufbd/zWIpMajnbDuWK2vn6OPPtz2rc9MIBNlPd8tt+yf+7SC4wqEPbozKMCwY5Bygx4JmoIEDsixWRDcdHd6S3/dZMHXOJAAv7+NIstl00crgSqHZKAEe4g3G4dzIV51EeZB01r7p8GNlfUnG/GjZgNGsqXZdYMBVtAtFNv3hJWPve4GvqZ2XxuiNkHTz5kxWgr0PjQdJlVywJ9Zf2ZvqeeTbolKtvK54re2Lq5BoyzfsRtvDfyao3kmyFzDQ88nM+qx83w74RDlkngtYiArI05Epre3GgBeSlMig0pE6RGQaFznKkGeb0SozLCyiOtxh7hgwZlbKbClzUUfC8ntMiHUOZE375RhTy9c4DA+oMLkUDkztSybZbdmP1xpaIbjUpPAHBq3cIq+CBFzbMlMMCCkUQ6d9LGV6GYCsYiEWZIy3nBnuxOYXeU4YTGDSin9e4/pCjPtQSHlg5LMEvIlF0ElthqrF129iK2RPBEWd3XWOl3SWV5uz5VUyZYp5kEFmz7QfP/B1W1BBzQ2iTGbSVT79lUHzcGXz3PJceSgz4uknETUwo0xffpr2KUvZF0i/r2sL3IFIClYx8CbIZE6Qt7MDJbOPB3xMScwaOcWG66IJfCnDkb0D2Mb+PHzX+oiCbxeTIogtyN+s2NJirNACk/OACSOTtV6vscwbzW4M168xqaI+RzR47S1nlV/rOoZnid87n/Ima2XYa3un3BuGAisNjb8eLMT9OnMtazQROFCuO1HiZXaOc0oUDbNC4eKLToOx8DzVhMgGA8XIAQ2x3b6I0uEyLssQjJX3QphcUMx4KsMgJ+72km4N2aqkBF2coKmUEt1eqIMGn+5txMT4kYVGd3ALO+y9Z4PP3d3l48JQK8s9ZZ/Qx/+NBKgBEJFlQ32psoJiihGO7FSYM5L81q72kaAYcilEFMG+ZK1BcMqELkflyCV7v8JEXLO4Rf/oZYNZHZVjJhfL6fnpP9Tio3Euue5uS7FMkfGOeRCTrBZ06Caev7tgufeTrX34Ur/Vvc+b8ksiIShNJtuF9WmYxOZ4xg8y6zTdy3KAB2y5kYkcRnXsptWwAFyKZ2I/QGySNeoQLkINUMloC+5L3WuMMx297Q1xUYLKqZ9XHavaobo6QQv4auMm+i84IhxRpPt9nUmcav9NcjCcP+TcMmxsQZ/F3mgeoA0fQgwvTsyXuuTaM3Sqtv2jaaajmaFQpK9W6uIbeqwvSDo34ZrY6elDUHwSCjHRRmlwmyy+eOra64Ssq0XSXYljMHtKY+FShcMkHsEUY/4Bw63dJ6KpwDaxmthlDdbdE+TvYF3v33cGSKqO+1H1pKYhJMvZD5ckQcHyNF8zrtiR5b0ko6NPGoRexUZTYP6VbUdn3zzxGBOi8Z0OqHjGqYxRXwN3mYi0GYEEZYq+Q3QvdKcEHILLLj8S+VFepSfErtmfZCdvxbfIifFSpEzKi+7VJsLMT+zEFeyp1OdwRC1VZrfTLIyR7xTPUcZFYPD9qI7D70uTb4hdpqPXsJIRNYbZtNwch1OI3trh3u2ScoQyM9POnInsUa+OovcwkUP1UfIzPb95n4BaF2ev57NHAej0+BVMF9/Cj9663HN2/JN3SQgslL914bKfiTTDFAz9PlQEL/dSv1H8xl3mtWxh1McFO9EJXlRDaKQDsyKO4vOJW90NFE6yw2tjbc2GeF95sbs0I9enAa6QwQVf/kJQhAD2BzUDKggOyjy1TEhED6sfk+418lQy3c/uj8aw8UEzZ6hIMCd8RohAkumMtIj9m73l2yPWoGHVTPaywkC7Yj9tBM1NxMgcrDwRtk4RO2WHT7Ql5kQCKdJj6kNuOTeyEBYBjLMhGz+O5/YGa84HEiTYEpZ6fFzy26GG2hWtTyteuYrhSyG56BjsT/wQeLRytpTY3D7sIMqZnJ9z1FDrfyjFlGl2TNw9BQysbaxOuwYYZs/7I6BANgkqCknWZC7/BBXvaeKwAmC959I+G39BUE9bExkNlbRoFRyEtNzv+NJ91FuisG3JCS6uYBeRnfv8AkAfKTeg9EYamqnsGfAV7d0f9DghHEQ5IsPGDIUhgoSj7obM4Bu5uhQ3/CYEDTHc92AsFvDK4XGrwUeGBWBHPlS+f4x+CxmmHz2sAGmSFNt65kwZC64mnaoWlu2310laYn8r62AqsR5dfjyK18MEdurdagldzfJtjFXlZs7St4QhdPiye6TPh2/ZAQLU/Fip5s7TDEM16KtRWrK9hmxnQ7bmfa/+7pa10Z8WDPK3NuJ+NN/RAbQ5vHx2uX0Lm7/w7cAEH/hvZA+mt7J7zGw7YtQYwnNN6dpgwkGjjrS3yQoeoYt1EnczmtmJfQZWzUlP3Hlg9Wzlr9IH23q3thGth+QNEANFettxKfskkGOlLk8AqoKJwDqOxAa6UzAx07plSSyNBJSGco9zjnC5gGbDoKvsMDuBR6bGRlGzJ+hFsGa/Izt78aI+WZ6dJlZKp4pGISuv9rV0sAS0MWEwCmfauO7oQZMiakHU35LBxiyJoOMddhUWgcZuC8r4Ksvn75TTcQXLJ7kWtYhGuGqPd9dZuFjBWQHNwosXY5snbHFQq72CvHXhIg+shQxycuLOuWYErwCLZeF24b7F78pO7xw4X6lIAR02hUOf5087Rl0nOaeb6CK4i/KA/EZv76ftOWZtjwxslNr0E/u8rWUmnf3amfg6UZmBAluuoj3Dd7UV+9IAJ6iYcDfSJlgmIImohjfIUMJ27z+opj50Ak9af2LCNrWrBJvMovA1OeNO+MF/MwZvnaCxTgG7Cw4QfSPF6AYCGFt21M8PySZFeV3t2Rqqs5JMzMYzGRgq4o+UaKRgBf9GHi/9X9HXA3wxkCsd/UhnHSh2zUVDiraio/6nP4y3XJqs8ABfALAtCYU7DHPMPRjgcM6Ad/HiSXDAbOdSMkvGZPAkHs8wuQTy6X2Ov/JFvcPuKfV3/r9Q28";const Obe=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Mbe=4;function hOt(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,a=[0,1];for(let F=1;F<r;F++)a.push(s+=n());let o=n(),l=e;e+=o;let c=0,u=0;function d(){return c==0&&(u=u<<8|t[e++],c=8),u>>--c&1}const f=31,x=2**f,g=x>>>1,y=g>>1,v=x-1;let C=0;for(let F=0;F<f;F++)C=C<<1|d();let N=[],P=0,T=x;for(;;){let F=Math.floor(((C-P+1)*s-1)/T),$=0,L=r;for(;L-$>1;){let ne=$+L>>>1;F<a[ne]?L=ne:$=ne}if($==0)break;N.push($);let z=P+Math.floor(T*a[$]/s),X=P+Math.floor(T*a[$+1]/s)-1;for(;!((z^X)&g);)C=C<<1&v|d(),z=z<<1&v,X=X<<1&v|1;for(;z&~X&y;)C=C&g|C<<1&v>>>1|d(),z=z<<1^g,X=(X^g)<<1|g|1;P=z,T=1+X-z}let M=r-4;return N.map(F=>{switch(F-M){case 3:return M+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return M+256+(t[l++]<<8|t[l++]);case 1:return M+t[l++];default:return F-1}})}function pOt(t){let e=0;return()=>t[e++]}function eDe(t){return pOt(hOt(mOt(t)))}function mOt(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,a)=>e[s.charCodeAt(0)]=a);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,a=0,o=0,l=0;s<n;s++)l=l<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[a++]=l>>(o-=8));return r}function xOt(t){return t&1?~t>>1:t>>1}function gOt(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=xOt(e());return n}function P_(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let a=0;a<s;a++)n.push(e+a);e+=s+1}return n}function tDe(t){return I_(()=>{let e=P_(t);if(e.length)return e})}function nDe(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(bOt(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(yOt(n,t))}return e.flat()}function I_(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function rDe(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)gOt(t,n).forEach((a,o)=>r[o].push(a));return r}function bOt(t,e){let n=1+e(),r=e(),s=I_(e);return rDe(s.length,1+t,e).flatMap((o,l)=>{let[c,...u]=o;return Array(s[l]).fill().map((d,f)=>{let x=f*r;return[c+f*n,u.map(g=>g+x)]})})}function yOt(t,e){let n=1+e();return rDe(n,1+t,e).map(s=>[s[0],s.slice(1)])}function vOt(t){let e=[],n=P_(t);return s(r([]),[]),e;function r(a){let o=t(),l=I_(()=>{let c=P_(t).map(u=>n[u]);if(c.length)return r(c)});return{S:o,B:l,Q:a}}function s({S:a,B:o},l,c){if(!(a&4&&c===l[l.length-1])){a&2&&(c=l[l.length-1]),a&1&&e.push(l);for(let u of o)for(let d of u.Q)s(u,[...l,d],c)}}}function wOt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function sDe(t){return`{${wOt(t)}}`}function COt(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function BN(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function SOt(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var NOt="AEUDVgHLCGMATwDUADIAdAAhADQAFAAtABQAIQAPACcADQASAAoAGAAJABIACQARAAUACwAFAAwABQAQAAMABwAEAAoABQAJAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACwANAA0AAwAKAAkABAAdAAYAZwDTAeYDMwCxCl8B8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgPi89uj00MsvBXxEPAGPCDwBnQKoEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiC+AZ4EWRJJFbEu7QDQLARtEbgECxDwAb/RyAk1AV4nD2cEQQKTAzsAGpobWgAahAGPCrysdy0OAKwAfFIcBAQFUmoA/PtZADkBIadVj2UMUgx5Il4ANQC9vAITAdQZWxDzALN9AhsZVwIcGSkCBAgXOhG7AqMZ4M7+1M0UAPDNAWsC+mcJDe8AAQA99zkEXLICyQozAo6lAobcP5JvjQLFzwKD9gU/OD8FEQCtEQL6bW+nAKUEvzjDHsuRyUvOFHcacUz5AqIFRSE2kzsBEQCuaQL5DQTlcgO6twSpTiUgCwIFCAUXBHQEqQV6swAVxUlmTmsCwjqsP/wKJQmXb793UgZBEBsnpRD3DDMBtQE7De1L2ATxBjsEyR99GRkPzZWcCKUt3QztJuMuoYBaI/UqgwXtS/Q83QtNUWgPWQtlCeM6Y4FOAyEBDSKLCt0NOQhtEPMKyWsN5RFFBzkD1UmaAKUHAQsRHTUVtSYQYqwLCTl3Bvsa9guPJq8TKXr8BdMaIQZNASka/wDPLueFsFoxXBxPXwYDCyUjxxSoUCANJUC3eEgaGwcVJakCkUNwSodRNh6TIfY8PQ1mLhNRfAf1PAUZTwuBPJ5Gq0UOEdI+jT1IIklMLAQ1fywvJ4sJzw+FDLl8cgFZCSEJsQxxEzERFzfFCDkHGS2XJCcVCCFGlWCaBPefA/MT0QMLBT8JQQcTA7UcLRMuFSkFDYEk1wLzNtUuswKPVoABFwXLDyUf3xBQR+AO6QibAmUDgyXrAC0VIQAXIpsIQ2MAX4/YUwUuywjHamwjdANnFOdhEXMHkQ5XB6ccMxW/HOFwyF4Lhggoo68JWwF1CZkBXwTjCAk1W4ygIEFnU4tYGJsgYUE/XfwCMQxlFZ9EvYd4AosPaxIbATUBcwc5DQECdxHtEWsQlQjrhgQ1tTP4OiUETyGDIBEKJwNPbM4LJyb5DPhpAaMSYgMMND137merYLYkF/0HGTLFQWAh8QuST80MnBrBGEJULhnkB78D8xrzJ+pBVwX/A6MDEzpNM+4EvQtpCIsJPwBJDqMXB9cYagpxjNABMYsBt5kDV5GDAm+PBjcHCwBnC4cFeeUAHQKnCKMABQDPA1cAOQKtB50AGQCFQQE9AycvASHlAo8DkwgxywGVLwHzKQQbwwwVAPc3bkoCw7ECgGpmogXdWAKOAkk1AU0lBAVOR1EDr3HhANsASwYT30cBFatKyxrjQwHfbysAxwD7AAU1BwVBAc0B820AtwFfCzEJorO1AU3pKQCDABVrAdcCiQDdADUAf/EBUwBNBVn5BdMCT0kBETEYK1dhAbsDHwEzAQ0AeQbLjaXJBx8EbQfTAhAbFeEC7y4HtQEDIt8TzULFAr3eVaFgAmSBAmJCW02vWzcgAqH3AmiYAmYJAp+EOBsLAmY7AmYmBG4EfwN/EwN+kjkGOXcXOYI6IyMCbB0CMjY4CgJtxwJtru+KM2dFKwFnAN4A4QBKBQeYDI0A/gvCAA21AncvAnaiPwJ5S0MCeLodXNtFrkbXAnw/AnrIAn0JAnzwBVkFIEgASH1jJAKBbQKAAAKABQJ/rklYSlsVF0rMAtEBAtDMSycDiE8Dh+ZExZEyAvKhXQMDA65LzkwtJQPPTUxNrwKLPwKK2MEbBx1DZwW3Ao43Ao5cQJeBAo7ZAo5ceFG0UzUKUtRUhQKT+wKTDADpABxVHlWvVdAGLBsplYYy4XhmRTs5ApefAu+yWCGoAFklApaPApZ8nACpWaxaCYFNADsClrUClk5cRFzRApnLAplkXMpdBxkCnJs5wjqdApwWAp+bAp64igAdDzEqDwKd8QKekgC1PWE0Ye8CntMCoG4BqQKenx8Cnk6lY8hkJyUrAievAiZ+AqD7AqBMAqLdAqHEAqYvAqXOAqf/AH0Cp/JofGixAANJahxq0QKs4wKsrgKtZwKtAgJXHQJV3AKx4dcDH05slwKyvQ0CsugXbOBtY21IXwMlzQK2XDs/bpADKUUCuF4CuUcVArkqd3A2cOECvRkCu9pwlgMyEQK+iHICAzNxAr4acyJzTwLDywLDBHOCdEs1RXTgAzynAzyaAz2/AsV8AsZHAsYQiQLIaVECyEQCyU8CyS4CZJ0C3dJ4eWF4rnklS9ADGKNnAgJh9BnzlSR7C16SXrsRAs9rAs9sL0tT0vMTnwDGrQLPcwEp6gNOEn5LBQLcJwLbigLSTwNSXANTXwEBA1WMgIk/AMsW7WBFghyC04LOg40C2scC2d6EEIRJpzwDhqUALwNkDoZxWfkAVQLfZQLeuHN3AuIv7RQB8zAnAfSbAfLShwLr8wLpcHkC6vkC6uQA+UcBuQLuiQLrnJaqlwMC7j8DheCYeXDgcaEC8wMAaQOOFpmTAvcTA5FuA5KHAveYAvnZAvhmmhyaq7s3mx4DnYMC/voBGwA5nxyfswMFjQOmagOm2QDRxQMGaqGIogUJAwxJAtQAPwMA4UEXUwER8wNrB5dnBQCTLSu3r73bAYmZFH8RBDkB+ykFIQ6dCZ8Akv0TtRQrxQL3LScApQC3BbmOkRc/xqdtQS4UJo0uAUMBgPwBtSYAdQMOBG0ALAIWDKEAAAoCPQJqA90DfgSRASBFBSF8CgAFAEQAEwA2EgJ3AQAF1QNr7wrFAgD3Cp8nv7G35QGRIUFCAekUfxE0wIkABAAbAFoCRQKEiwAGOlM6lI1tALg6jzrQAI04wTrcAKUA6ADLATqBOjs5/Dn5O3aJOls7nok6bzkYAVYBMwFsBS81XTWeNa01ZjV1NbY1xTWCNZE10jXhNZ41rTXuNf01sjXBNgI2ETXGNdU2FjYnNd417TYuNj02LjUtITY6Nj02PDbJNwgEkDxXNjg23TcgNw82yiA3iTcwCgSwPGc2JDcZN2w6jTchQtRDB0LgQwscDw8JmyhtKFFVBgDpfwDpsAD+mxQ91wLpNSMArQC9BbeOkRdLxptzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgELgEaJZkC7aMAoQCjBcGOmxdNxrsBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUHqSvAj5Gqwr7YrMUACT9AN3rlr3JG9m8w9lIAXltp/v8kfWaIaaR9OwpAES/I3ZVamDXSgB/UsOgAG6D0tq+5CIqE15FiAhV3yA2VhCQ7tj+m6xXaF53FIfGi/IAZIskMGAi2MU7MDVJNCbMzERyHZi+osdPtnFVbvq653O8rwaCy4IAf9OOok65AqJUtUriUfYsGPPVbe6jm0s9lbKlPCUKjdkHsFsEhvX4kT39ZCtAAbwQdn/h4TpO5hTByWAmr5n+Wuwhdegv6bmvX4LyOes3z2+cuHv2JFYwVMNuq2gzn8YHTjlUQd39osyWei4NKl3LAdfxlO876hh5ENp/cOvpuI9bF55guEthLLPOXjD4dktTH04P5TvZrWTM0e4+BHJxj7MLApXIFOs0sWKhNkG8iwuM5wR83my6V3wW06abhDzTXYfOr/ZpFXgXzmv4d12FFyP00/dPGbIVGV5ao8UufGzUwp/IHx6v/wDWJr9iaoCulhWwlZ7A8q/NMoD12+mBdNRgJYnThRLtMx1Bgwttn8/4Qn2CDfOSup9GVXEvA21ILgp0owHYxNOkpwLWz0G7K+WREIDjIzUzSn8I99CuJSmSpPyH0Ke6/NERYiNx+3dncSebPnOUnnWD61AhJ1n/tSLZmU5wYO5GfgzyAYJm6VL91LxZ8hL1lfximQxIDMRhIecQZBmeE5R0XlrpvwplVrJwpa8BBCdp93GPP9lyBeZ2zkRr920CR3cYbKpKHfogvm0nV7XdDz6EbjzlxADCMjSLXuXpIpyuizy39yY+I+H9rmpoIF3YwEjlH9MgGgWcCNTjHEWMqAbprn2Ox7rOHupaVE3lNyg3nt5XaZID6Y+uml5Ja+aOPu+BI+DZbiJVfaspUadakWUX6TA4dETkIqdJJHYnU4Z4yKpt5y8rVIahoMUf8A8kWtAQNCTbjp71gx3/zVdqNz1Sutkw0gFIMVm2BF4Xdv/0olw+NaDIR9Bb3DPweZA2K/cw+/b+AwyWl9ZOP67A9nexmeTNjfdzPGf9J6E6BMPKa5lJh+qNsdUz3HBUevU71eQFCqOcxiIYhacAhh/8PX0J5DdSViZ6WazDDx7cukJNpMfEkYLJ5Ao4vLoVd3d25Pg4qaVa2p2D2L3WvYPJ5Yf/A/MSxptjlgXL/KJtP2U0cRv2I09ATAiWCJYuRwiapeKFsqmi18yMMulDp3HdcIldq+7jkwsJUOHLHCzzzBw5XFvL0CAmo1ub456z7zb7shk3KPGCLZzr47oT1k/j06XNnJvG3Udv6XrP+wsqTBlZ5MaNPt9FOs/4Bt/ja/vbVhTNpBFl9Gq7MqINvGlWKOAwQzwOZy+EzSdjAqKJVV2YcskTuM94aIK+kc/AZaXiZLPREUDpkXIV947IFfj+85TrqPqLfkGcxgboMQjosf+az+odLNXdyp1mDNGsqSdK/pJ2Ca04mt/4d6s1X+lncOEYaGBBeW4pApGcjf7/XJCFbj3N3mFb+BtlIcw8ZiDKoClFX9Rf0bxCqtLpicObKJzBVVHr/6u4siH2hK75RNv7w9GfTbhJOQBYiFUZAByY4rn37tZBHT//kqKsNi3ryL9AqXJRzqiMIJMhILjoi/i8LVEsbu+Ih9bsyW16sgQqjYLO0qda6KaCPKj3DQcu6CfV5lKtjS3ZCdqLAZkOey9MR+QutJBGiz/r15GVD6rCVwJR4UUKC4GNJkfDf00OMW8aQtLSAGLXV8MIi9mbbl/qQEpxCm2L5hutFX4ekeLH4QgBWUFKs/2VVMKy46WtFE6AbwgmYm/Z0yHk5veDIrcl2HpVqb/rSE0PC9EbDzJEWqeaPhh7vF369Umq2kSiB3s5rBI6c/7N9bkRu4h2n+/h5nSwy+7n+/I+6oXQVANo2Jb5zDwtiBPf1ySCzHdT6yJShMzqSRZfnykX49CaFaxhoVF4PBhEuECJ1PrFYSpmHuyYsl14DTAV9ZxRms1XiR/kBrjhZjidOt0UNe+GSml7XNgpVw8YsUTmZXLTK+6iYnyW/wYR1W4UXwOi14xpFROHb6HcZzksgF5DbL2AFXzKNwHU2adjdAY+KCyM/cwRTBkkq/a227NI0q6DR2MkMCRu620t79bGcYUmACtqN3mk/0uNwd3JSXHqE1kzf6Yyj0W2083JNDRnIXDlgBxJ6uf58NN1f6FQiRCWB4egF8QDx74AixV8oTyw7PluIjr3/rj/WzgwPSq4xPojaF7V0xqG2u5ti2L1h6yYHv73Isrukr0kURDIEjClBsBx7kdcXUxaYMS0syT3ymLzDzslNDWQOT1Tao1YNmJHARUenhCkmV9tqCPGI5GqZaRpkiPxyjoncWjyOHYGqvbvRX+Bn1pn7EhRNXa1lqJPmoeN5VqdqIDPhEVhFsyG0d4iQEIYX0wZUbY2XbZWYlpZ/l66IrDDY0q1C1YzBDpHC4h05YqHQLqS9anyl22JQ6lEvjvdBwMHfE7z0luCXD34/rFeDa2TmSeEAykSpYO5j1G/nsgpR3qn0qaQEmLjnnLfcz+veoYqPnRqmRGwCJ6FJ3Gm/Z1/aVX5PSb03MMnjAf41ww54sD5k8FrkfBP+K0b1MrYpapWjtpZfve2HVf4ickX3LKSOhu7qI1Vd4c1kNrn2ajy1t4y93JhV4fnWCKq7OmFpcr7FjdJCXPTql0Drr14Ho3Z87+GPQ4Z/DcTiGqtvZxlRYi8cNuhXABveZIwNl/BX1huhVLaFax5OqypUrQRyb9OE3SSkPlDdy5uo5XGg2EIGEjLY1MO5cr1ibfiFWV7zspcTgkBKkwo5jPyAin04LqizZXb2tDRgwKJjGx4cVk3ngAQixwcxjYAg2Q7vmUR/hpwInMdw7OhC2qyf41vTPkudQAORS0DdLtOGQxb4fH2VYGsvJCkeWPeUwtf1/tuIhzXEThoCZzzSJqqjUtbaPI3ntHm3T5uf849hGUA0zU8ni5W+EEn3/0Y6oUhQFw9z0aGjkljBbAlFXc0y82G2wkd7VdgWa5KTgJJNjNwZMfmdnUIUn1JU5LiWX5UZEZbVlKSN76mlmjUR2ku+fucTNlO4IAAahnLjBhlvQNR9pe9swGBgq0YR7P3VCyI/seYwQ4QBzy9X+HPePgoF8WfKaJ4MBOhLCGHae6Z8xkNXwni9QAKvTNtVA56x8YJflZ/VvONRSlsSLmiSyNMnTjTaE1ko81zkzGEnVwEhjCzlwIqpxmpDAqwsEmtpdr3xpc7i/ZX3f2TzT3M0FdxIEQvO1jgmmiN+D1YpMduAzEhBtj2OBkMN/rv6p7Th4pSH6f5aH3aTvwFTl7EOSgGASI7ttyMehzpm4AVyK+bFEaFg9gnZsSUPpsbAe/0RFhrH+EXZ12Z7thf4dzN1+Sn+G8QrDA1VKaN4IFxD1rQz9Xq9Coii9S9/hPbTGjyBwFH3H1UdQuz5KsgPDEHua4/kPg2Gp/IIItsaLWBqiT9XH45MiQxSosGJ56H/0F2cjcCFd72l1665RNHURdC3lspI77esfJsl+rXXabkAy7vxDXG/XGGcKpwiKDPFfvMEgjkAHil4Za1F36RnyxxvdIAzvgfH8knukYDck07tc++DP4TdWeI7HXuq5Yl6VVFrUQtf64/dkXewlKZSHQo6YvCSpREB0GDrz+Ys2GfO8nw2SwrYwaf88AifzlPvP17bf1mI3AuccJvAjZIpBmqvharKFAebEjVKfGAwpQjWoXlm9LROsq9bCk1UeQ3CJxJqprzssS/Q04JeS1ReCCubL3J7sx86spkP4eNpp95UF+8K748icIs8vdILFklk9skQqi1So6cx3X906pvy1vz+KipTJ8fiVJxsV5MmT0XwA";const F_=44032,AL=4352,jL=4449,EL=4519,iDe=19,aDe=21,$N=28,_L=aDe*$N,AOt=iDe*_L,jOt=F_+AOt,EOt=AL+iDe,_Ot=jL+aDe,kOt=EL+$N;function t9(t){return t>>24&255}function oDe(t){return t&16777215}let hne,Rbe,pne,hM;function TOt(){let t=eDe(NOt);hne=new Map(tDe(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),Rbe=new Set(P_(t)),pne=new Map,hM=new Map;for(let[e,n]of nDe(t)){if(!Rbe.has(e)&&n.length==2){let[r,s]=n,a=hM.get(r);a||(a=new Map,hM.set(r,a)),a.set(s,e)}pne.set(e,n.reverse())}}function lDe(t){return t>=F_&&t<jOt}function POt(t,e){if(t>=AL&&t<EOt&&e>=jL&&e<_Ot)return F_+(t-AL)*_L+(e-jL)*$N;if(lDe(t)&&e>EL&&e<kOt&&(t-F_)%$N==0)return t+(e-EL);{let n=hM.get(t);return n&&(n=n.get(e),n)?n:-1}}function cDe(t){hne||TOt();let e=[],n=[],r=!1;function s(a){let o=hne.get(a);o&&(r=!0,a|=o),e.push(a)}for(let a of t)for(;;){if(a<128)e.push(a);else if(lDe(a)){let o=a-F_,l=o/_L|0,c=o%_L/$N|0,u=o%$N;s(AL+l),s(jL+c),u>0&&s(EL+u)}else{let o=pne.get(a);o?n.push(...o):s(a)}if(!n.length)break;a=n.pop()}if(r&&e.length>1){let a=t9(e[0]);for(let o=1;o<e.length;o++){let l=t9(e[o]);if(l==0||a<=l){a=l;continue}let c=o-1;for(;;){let u=e[c+1];if(e[c+1]=e[c],e[c]=u,!c||(a=t9(e[--c]),a<=l))break}a=t9(e[o])}}return e}function IOt(t){let e=[],n=[],r=-1,s=0;for(let a of t){let o=t9(a),l=oDe(a);if(r==-1)o==0?r=l:e.push(l);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=l):n.push(l),s=o;else{let c=POt(r,l);c>=0?r=c:s==0&&o==0?(e.push(r),r=l):(n.push(l),s=o)}}return r>=0&&e.push(r,...n),e}function uDe(t){return cDe(t).map(oDe)}function FOt(t){return IOt(cDe(t))}const Lbe=45,dDe=".",fDe=65039,hDe=1,kL=t=>Array.from(t);function O_(t,e){return t.P.has(e)||t.Q.has(e)}class OOt extends Array{get is_emoji(){return!0}}let mne,pDe,vw,xne,mDe,O4,OW,KC,Gv,Dbe,gne;function Nce(){if(mne)return;let t=eDe(fOt);const e=()=>P_(t),n=()=>new Set(e()),r=(d,f)=>f.forEach(x=>d.add(x));mne=new Map(nDe(t)),pDe=n(),vw=e(),xne=new Set(e().map(d=>vw[d])),vw=new Set(vw),mDe=n(),n();let s=tDe(t),a=t();const o=()=>{let d=new Set;return e().forEach(f=>r(d,s[f])),r(d,e()),d};O4=I_(d=>{let f=I_(t).map(x=>x+96);if(f.length){let x=d>=a;f[0]-=32,f=BN(f),x&&(f=`Restricted[${f}]`);let g=o(),y=o(),v=!t();return{N:f,P:g,Q:y,M:v,R:x}}}),OW=n(),KC=new Map;let l=e().concat(kL(OW)).sort((d,f)=>d-f);l.forEach((d,f)=>{let x=t(),g=l[f]=x?l[f-x]:{V:[],M:new Map};g.V.push(d),OW.has(d)||KC.set(d,g)});for(let{V:d,M:f}of new Set(KC.values())){let x=[];for(let y of d){let v=O4.filter(N=>O_(N,y)),C=x.find(({G:N})=>v.some(P=>N.has(P)));C||(C={G:new Set,V:[]},x.push(C)),C.V.push(y),r(C.G,v)}let g=x.flatMap(y=>kL(y.G));for(let{G:y,V:v}of x){let C=new Set(g.filter(N=>!y.has(N)));for(let N of v)f.set(N,C)}}Gv=new Set;let c=new Set;const u=d=>Gv.has(d)?c.add(d):Gv.add(d);for(let d of O4){for(let f of d.P)u(f);for(let f of d.Q)u(f)}for(let d of Gv)!KC.has(d)&&!c.has(d)&&KC.set(d,hDe);r(Gv,uDe(Gv)),Dbe=vOt(t).map(d=>OOt.from(d)).sort(SOt),gne=new Map;for(let d of Dbe){let f=[gne];for(let x of d){let g=f.map(y=>{let v=y.get(x);return v||(v=new Map,y.set(x,v)),v});x===fDe?f.push(...g):f=g}for(let x of f)x.V=d}}function Ace(t){return(xDe(t)?"":`${jce(CU([t]))} `)+sDe(t)}function jce(t){return`"${t}"`}function MOt(t){if(t.length>=4&&t[2]==Lbe&&t[3]==Lbe)throw new Error(`invalid label extension: "${BN(t.slice(0,4))}"`)}function ROt(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function LOt(t){let e=t[0],n=Obe.get(e);if(n)throw F9(`leading ${n}`);let r=t.length,s=-1;for(let a=1;a<r;a++){e=t[a];let o=Obe.get(e);if(o){if(s==a)throw F9(`${n} + ${o}`);s=a+1,n=o}}if(s==r)throw F9(`trailing ${n}`)}function CU(t,e=1/0,n=sDe){let r=[];DOt(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,a=t.length;for(let o=0;o<a;o++){let l=t[o];xDe(l)&&(r.push(BN(t.slice(s,o))),r.push(n(l)),s=o+1)}return r.push(BN(t.slice(s,a))),r.join("")}function DOt(t,e){return Nce(),vw.has(t)}function xDe(t){return Nce(),mDe.has(t)}function BOt(t){return HOt($Ot(t,FOt,qOt))}function $Ot(t,e,n){if(!t)return[];Nce();let r=0;return t.split(dDe).map(s=>{let a=COt(s),o={input:a,offset:r};r+=a.length+1;try{let l=o.tokens=WOt(a,e,n),c=l.length,u;if(!c)throw new Error("empty label");let d=o.output=l.flat();if(ROt(d),!(o.emoji=c>1||l[0].is_emoji)&&d.every(x=>x<128))MOt(d),u="ASCII";else{let x=l.flatMap(g=>g.is_emoji?[]:g);if(!x.length)u="Emoji";else{if(vw.has(d[0]))throw F9("leading combining mark");for(let v=1;v<c;v++){let C=l[v];if(!C.is_emoji&&vw.has(C[0]))throw F9(`emoji + combining mark: "${BN(l[v-1])} + ${CU([C[0]])}"`)}LOt(d);let g=kL(new Set(x)),[y]=zOt(g);VOt(y,x),UOt(y,g),u=y.N}}o.type=u}catch(l){o.error=l}return o})}function UOt(t,e){let n,r=[];for(let s of e){let a=KC.get(s);if(a===hDe)return;if(a){let o=a.M.get(s);if(n=n?n.filter(l=>o.has(l)):kL(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(a=>O_(s,a)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function zOt(t){let e=O4;for(let n of t){let r=e.filter(s=>O_(s,n));if(!r.length)throw O4.some(s=>O_(s,n))?bDe(e[0],n):gDe(n);if(e=r,r.length==1)break}return e}function HOt(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${jce(CU(e,63))}: ${s}`)}return BN(r)}).join(dDe)}function gDe(t){return new Error(`disallowed character: ${Ace(t)}`)}function bDe(t,e){let n=Ace(e),r=O4.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function F9(t){return new Error(`illegal placement: ${t}`)}function VOt(t,e){for(let n of e)if(!O_(t,n))throw bDe(t,n);if(t.M){let n=uDe(e);for(let r=1,s=n.length;r<s;r++)if(xne.has(n[r])){let a=r+1;for(let o;a<s&&xne.has(o=n[a]);a++)for(let l=r;l<a;l++)if(n[l]==o)throw new Error(`duplicate non-spacing marks: ${Ace(o)}`);if(a-r>Mbe)throw new Error(`excessive non-spacing marks: ${jce(CU(n.slice(r-1,a)))} (${a-r}/${Mbe})`);r=a}}}function WOt(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let a=GOt(t);if(a)s.length&&(r.push(e(s)),s=[]),r.push(n(a));else{let o=t.pop();if(Gv.has(o))s.push(o);else{let l=mne.get(o);if(l)s.push(...l);else if(!pDe.has(o))throw gDe(o)}}}return s.length&&r.push(e(s)),r}function qOt(t){return t.filter(e=>e!=fDe)}function GOt(t,e){let n=gne,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:a}=n;a&&(r=a,t.length=s)}return r}function KOt(t){return BOt(t)}function YOt(t){return KOt(t)}const XOt={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},QOt={block:Lpt({format(t){var n;return{transactions:(n=t.transactions)==null?void 0:n.map(r=>{if(typeof r=="string")return r;const s=i$(r);return s.typeHex==="0x7e"&&(s.isSystemTx=r.isSystemTx,s.mint=r.mint?cd(r.mint):void 0,s.sourceHash=r.sourceHash,s.type="deposit"),s}),stateRoot:t.stateRoot}}}),transaction:Mpt({format(t){const e={};return t.type==="0x7e"&&(e.isSystemTx=t.isSystemTx,e.mint=t.mint?cd(t.mint):void 0,e.sourceHash=t.sourceHash,e.type="deposit"),e}}),transactionReceipt:axt({format(t){return{l1GasPrice:t.l1GasPrice?cd(t.l1GasPrice):null,l1GasUsed:t.l1GasUsed?cd(t.l1GasUsed):null,l1Fee:t.l1Fee?cd(t.l1Fee):null,l1FeeScalar:t.l1FeeScalar?Number(t.l1FeeScalar):null}}})};function ZOt(t,e){return tMt(t)?eMt(t):Ggt(t,e)}const JOt={transaction:ZOt};function eMt(t){nMt(t);const{sourceHash:e,data:n,from:r,gas:s,isSystemTx:a,mint:o,to:l,value:c}=t,u=[e,r,l??"0x",o?di(o):"0x",c?di(c):"0x",s?di(s):"0x",a?"0x1":"0x",n??"0x"];return Im(["0x7e",Jy(u)])}function tMt(t){return t.type==="deposit"||typeof t.sourceHash<"u"}function nMt(t){const{from:e,to:n}=t;if(e&&!uc(e))throw new Cd({address:e});if(n&&!uc(n))throw new Cd({address:n})}const Bbe={contracts:XOt,formatters:QOt,serializers:JOt},$be=h$({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),M_=h$({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),o7=1,Ube=h$({...Bbe,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...Bbe.contracts,disputeGameFactory:{[o7]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[o7]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[o7]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[o7]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:o7}),zbe=h$({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});var Gb=function(){return Gb=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Gb.apply(this,arguments)};function rMt(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function sMt(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,a;r<s;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}var O9="right-scroll-bar-position",M9="width-before-scroll-bar",iMt="with-scroll-bars-hidden",aMt="--removed-body-scroll-bar-size";function MW(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function oMt(t,e){var n=m.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var lMt=typeof window<"u"?m.useLayoutEffect:m.useEffect,Hbe=new WeakMap;function yDe(t,e){var n=oMt(null,function(r){return t.forEach(function(s){return MW(s,r)})});return lMt(function(){var r=Hbe.get(n);if(r){var s=new Set(r),a=new Set(t),o=n.current;s.forEach(function(l){a.has(l)||MW(l,null)}),a.forEach(function(l){s.has(l)||MW(l,o)})}Hbe.set(n,t)},[t]),n}var bne=function(t,e){return bne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},bne(t,e)};function vDe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");bne(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var UN=function(){return UN=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},UN.apply(this,arguments)};function Ece(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function wDe(t,e,n,r){var s=arguments.length,a=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(a=(s<3?o(a):s>3?o(e,n,a):o(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a}function CDe(t,e){return function(n,r){e(n,r,t)}}function SDe(t,e,n,r,s,a){function o(N){if(N!==void 0&&typeof N!="function")throw new TypeError("Function expected");return N}for(var l=r.kind,c=l==="getter"?"get":l==="setter"?"set":"value",u=!e&&t?r.static?t:t.prototype:null,d=e||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),f,x=!1,g=n.length-1;g>=0;g--){var y={};for(var v in r)y[v]=v==="access"?{}:r[v];for(var v in r.access)y.access[v]=r.access[v];y.addInitializer=function(N){if(x)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(N||null))};var C=(0,n[g])(l==="accessor"?{get:d.get,set:d.set}:d[c],y);if(l==="accessor"){if(C===void 0)continue;if(C===null||typeof C!="object")throw new TypeError("Object expected");(f=o(C.get))&&(d.get=f),(f=o(C.set))&&(d.set=f),(f=o(C.init))&&s.unshift(f)}else(f=o(C))&&(l==="field"?s.unshift(f):d[c]=f)}u&&Object.defineProperty(u,r.name,d),x=!0}function NDe(t,e,n){for(var r=arguments.length>2,s=0;s<e.length;s++)n=r?e[s].call(t,n):e[s].call(t);return r?n:void 0}function ADe(t){return typeof t=="symbol"?t:"".concat(t)}function jDe(t,e,n){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:n?"".concat(n," ",e):e})}function EDe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function _De(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})}function kDe(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var SU=Object.create?function(t,e,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]};function TDe(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&SU(e,t,n)}function TL(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _ce(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),s,a=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function PDe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(_ce(arguments[e]));return t}function IDe(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),s=0,e=0;e<n;e++)for(var a=arguments[e],o=0,l=a.length;o<l;o++,s++)r[s]=a[o];return r}function FDe(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,a;r<s;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}function zN(t){return this instanceof zN?(this.v=t,this):new zN(t)}function ODe(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),s,a=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(g){return function(y){return Promise.resolve(y).then(g,f)}}function l(g,y){r[g]&&(s[g]=function(v){return new Promise(function(C,N){a.push([g,v,C,N])>1||c(g,v)})},y&&(s[g]=y(s[g])))}function c(g,y){try{u(r[g](y))}catch(v){x(a[0][3],v)}}function u(g){g.value instanceof zN?Promise.resolve(g.value.v).then(d,f):x(a[0][2],g)}function d(g){c("next",g)}function f(g){c("throw",g)}function x(g,y){g(y),a.shift(),a.length&&c(a[0][0],a[0][1])}}function MDe(t){var e,n;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,a){e[s]=t[s]?function(o){return(n=!n)?{value:zN(t[s](o)),done:!1}:a?a(o):o}:a}}function RDe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof TL=="function"?TL(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(a){n[a]=t[a]&&function(o){return new Promise(function(l,c){o=t[a](o),s(l,c,o.done,o.value)})}}function s(a,o,l,c){Promise.resolve(c).then(function(u){a({value:u,done:l})},o)}}function LDe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var cMt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function DDe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&SU(e,t,n);return cMt(e,t),e}function BDe(t){return t&&t.__esModule?t:{default:t}}function $De(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function UDe(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n}function zDe(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function HDe(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,s;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(a){return Promise.reject(a)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e}var uMt=typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r};function VDe(t){function e(a){t.error=t.hasError?new uMt(a,t.error,"An error was suppressed during disposal."):a,t.hasError=!0}var n,r=0;function s(){for(;n=t.stack.pop();)try{if(!n.async&&r===1)return r=0,t.stack.push(n),Promise.resolve().then(s);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(s,function(o){return e(o),s()})}else r|=1}catch(o){e(o)}if(r===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function WDe(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,s,a,o){return r?e?".jsx":".js":s&&(!a||!o)?n:s+a+"."+o.toLowerCase()+"js"}):t}const dMt={__extends:vDe,__assign:UN,__rest:Ece,__decorate:wDe,__param:CDe,__esDecorate:SDe,__runInitializers:NDe,__propKey:ADe,__setFunctionName:jDe,__metadata:EDe,__awaiter:_De,__generator:kDe,__createBinding:SU,__exportStar:TDe,__values:TL,__read:_ce,__spread:PDe,__spreadArrays:IDe,__spreadArray:FDe,__await:zN,__asyncGenerator:ODe,__asyncDelegator:MDe,__asyncValues:RDe,__makeTemplateObject:LDe,__importStar:DDe,__importDefault:BDe,__classPrivateFieldGet:$De,__classPrivateFieldSet:UDe,__classPrivateFieldIn:zDe,__addDisposableResource:HDe,__disposeResources:VDe,__rewriteRelativeImportExtension:WDe},qCn=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:HDe,get __assign(){return UN},__asyncDelegator:MDe,__asyncGenerator:ODe,__asyncValues:RDe,__await:zN,__awaiter:_De,__classPrivateFieldGet:$De,__classPrivateFieldIn:zDe,__classPrivateFieldSet:UDe,__createBinding:SU,__decorate:wDe,__disposeResources:VDe,__esDecorate:SDe,__exportStar:TDe,__extends:vDe,__generator:kDe,__importDefault:BDe,__importStar:DDe,__makeTemplateObject:LDe,__metadata:EDe,__param:CDe,__propKey:ADe,__read:_ce,__rest:Ece,__rewriteRelativeImportExtension:WDe,__runInitializers:NDe,__setFunctionName:jDe,__spread:PDe,__spreadArray:FDe,__spreadArrays:IDe,__values:TL,default:dMt},Symbol.toStringTag,{value:"Module"}));function fMt(t){return t}function hMt(t,e){e===void 0&&(e=fMt);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(a){var o=e(a,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(r=!0;n.length;){var o=n;n=[],o.forEach(a)}n={push:function(l){return a(l)},filter:function(){return n}}},assignMedium:function(a){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(a),o=n}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return s}function qDe(t){t===void 0&&(t={});var e=hMt(null);return e.options=UN({async:!0,ssr:!1},t),e}var GDe=function(t){var e=t.sideCar,n=Ece(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,UN({},n))};GDe.isSideCarExport=!0;function KDe(t,e){return t.useMedium(e),GDe}var YDe=qDe(),RW=function(){},NU=m.forwardRef(function(t,e){var n=m.useRef(null),r=m.useState({onScrollCapture:RW,onWheelCapture:RW,onTouchMoveCapture:RW}),s=r[0],a=r[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,x=t.sideCar,g=t.noIsolation,y=t.inert,v=t.allowPinchZoom,C=t.as,N=C===void 0?"div":C,P=t.gapMode,T=rMt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=x,F=yDe([n,e]),$=Gb(Gb({},T),s);return m.createElement(m.Fragment,null,d&&m.createElement(M,{sideCar:YDe,removeScrollBar:u,shards:f,noIsolation:g,inert:y,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:P}),o?m.cloneElement(m.Children.only(l),Gb(Gb({},$),{ref:F})):m.createElement(N,Gb({},$,{className:c,ref:F}),l))});NU.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};NU.classNames={fullWidth:M9,zeroRight:O9};var pMt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mMt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=pMt();return e&&t.setAttribute("nonce",e),t}function xMt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function gMt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var bMt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=mMt())&&(xMt(e,n),gMt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},yMt=function(){var t=bMt();return function(e,n){m.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},kce=function(){var t=yMt(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},vMt={left:0,top:0,right:0,gap:0},LW=function(t){return parseInt(t||"",10)||0},wMt=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[LW(n),LW(r),LW(s)]},CMt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return vMt;var e=wMt(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},SMt=kce(),M4="data-scroll-locked",NMt=function(t,e,n,r){var s=t.left,a=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
.`.concat(iMt,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(l,"px ").concat(r,`;
}
body[`).concat(M4,`] {
overflow: hidden `).concat(r,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
padding-left: `.concat(s,`px;
padding-top: `).concat(a,`px;
padding-right: `).concat(o,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(r,`;
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
}
.`).concat(O9,` {
right: `).concat(l,"px ").concat(r,`;
}
.`).concat(M9,` {
margin-right: `).concat(l,"px ").concat(r,`;
}
.`).concat(O9," .").concat(O9,` {
right: 0 `).concat(r,`;
}
.`).concat(M9," .").concat(M9,` {
margin-right: 0 `).concat(r,`;
}
body[`).concat(M4,`] {
`).concat(aMt,": ").concat(l,`px;
}
`)},Vbe=function(){var t=parseInt(document.body.getAttribute(M4)||"0",10);return isFinite(t)?t:0},AMt=function(){m.useEffect(function(){return document.body.setAttribute(M4,(Vbe()+1).toString()),function(){var t=Vbe()-1;t<=0?document.body.removeAttribute(M4):document.body.setAttribute(M4,t.toString())}},[])},XDe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;AMt();var a=m.useMemo(function(){return CMt(s)},[s]);return m.createElement(SMt,{styles:NMt(a,!e,s,n?"":"!important")})},yne=!1;if(typeof window<"u")try{var tF=Object.defineProperty({},"passive",{get:function(){return yne=!0,!0}});window.addEventListener("test",tF,tF),window.removeEventListener("test",tF,tF)}catch{yne=!1}var hC=yne?{passive:!1}:!1,jMt=function(t){return t.tagName==="TEXTAREA"},QDe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!jMt(t)&&n[e]==="visible")},EMt=function(t){return QDe(t,"overflowY")},_Mt=function(t){return QDe(t,"overflowX")},Wbe=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=ZDe(t,r);if(s){var a=JDe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},kMt=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},TMt=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ZDe=function(t,e){return t==="v"?EMt(e):_Mt(e)},JDe=function(t,e){return t==="v"?kMt(e):TMt(e)},PMt=function(t,e){return t==="h"&&e==="rtl"?-1:1},IMt=function(t,e,n,r,s){var a=PMt(t,window.getComputedStyle(e).direction),o=a*r,l=n.target,c=e.contains(l),u=!1,d=o>0,f=0,x=0;do{var g=JDe(t,l),y=g[0],v=g[1],C=g[2],N=v-C-a*y;(y||N)&&ZDe(t,l)&&(f+=N,x+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&Math.abs(f)<1||!d&&Math.abs(x)<1)&&(u=!0),u},nF=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},qbe=function(t){return[t.deltaX,t.deltaY]},Gbe=function(t){return t&&"current"in t?t.current:t},FMt=function(t,e){return t[0]===e[0]&&t[1]===e[1]},OMt=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},MMt=0,pC=[];function RMt(t){var e=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(MMt++)[0],a=m.useState(kce)[0],o=m.useRef(t);m.useEffect(function(){o.current=t},[t]),m.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var v=sMt([t.lockRef.current],(t.shards||[]).map(Gbe),!0).filter(Boolean);return v.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=m.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var N=nF(v),P=n.current,T="deltaX"in v?v.deltaX:P[0]-N[0],M="deltaY"in v?v.deltaY:P[1]-N[1],F,$=v.target,L=Math.abs(T)>Math.abs(M)?"h":"v";if("touches"in v&&L==="h"&&$.type==="range")return!1;var z=Wbe(L,$);if(!z)return!0;if(z?F=L:(F=L==="v"?"h":"v",z=Wbe(L,$)),!z)return!1;if(!r.current&&"changedTouches"in v&&(T||M)&&(r.current=F),!F)return!0;var X=r.current||F;return IMt(X,C,v,X==="h"?T:M)},[]),c=m.useCallback(function(v){var C=v;if(!(!pC.length||pC[pC.length-1]!==a)){var N="deltaY"in C?qbe(C):nF(C),P=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&FMt(F.delta,N)})[0];if(P&&P.should){C.cancelable&&C.preventDefault();return}if(!P){var T=(o.current.shards||[]).map(Gbe).filter(Boolean).filter(function(F){return F.contains(C.target)}),M=T.length>0?l(C,T[0]):!o.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),u=m.useCallback(function(v,C,N,P){var T={name:v,delta:C,target:N,should:P,shadowParent:LMt(N)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(M){return M!==T})},1)},[]),d=m.useCallback(function(v){n.current=nF(v),r.current=void 0},[]),f=m.useCallback(function(v){u(v.type,qbe(v),v.target,l(v,t.lockRef.current))},[]),x=m.useCallback(function(v){u(v.type,nF(v),v.target,l(v,t.lockRef.current))},[]);m.useEffect(function(){return pC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,hC),document.addEventListener("touchmove",c,hC),document.addEventListener("touchstart",d,hC),function(){pC=pC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,hC),document.removeEventListener("touchmove",c,hC),document.removeEventListener("touchstart",d,hC)}},[]);var g=t.removeScrollBar,y=t.inert;return m.createElement(m.Fragment,null,y?m.createElement(a,{styles:OMt(s)}):null,g?m.createElement(XDe,{gapMode:t.gapMode}):null)}function LMt(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const DMt=KDe(YDe,RMt);var eBe=m.forwardRef(function(t,e){return m.createElement(NU,Gb({},t,{ref:e,sideCar:DMt}))});eBe.classNames=NU.classNames;function Kbe(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function BMt(t,e){var n=t;for(var r of e){if(!(r in n))throw new Error("Path ".concat(e.join(" -> ")," does not exist in object"));n=n[r]}return n}function tBe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r={};for(var s in t){var a=t[s],o=[...n,s];typeof a=="string"||typeof a=="number"||a==null?r[s]=e(a,o):typeof a=="object"&&!Array.isArray(a)?r[s]=tBe(a,e,o):console.warn('Skipping invalid key "'.concat(o.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(a)?"Array":typeof a,'"'))}return r}function Ybe(t,e){var n={};if(typeof e=="object"){var r=t;tBe(e,(l,c)=>{if(l!=null){var u=BMt(r,c);n[Kbe(u)]=String(l)}})}else{var s=t;for(var a in s){var o=s[a];o!=null&&(n[Kbe(a)]=o)}}return Object.defineProperty(n,"toString",{value:function(){return Object.keys(this).map(c=>"".concat(c,":").concat(this[c])).join(";")},writable:!1}),n}var n9={exports:{}},$Mt=n9.exports,Xbe;function UMt(){return Xbe||(Xbe=1,function(t,e){(function(n,r){var s="1.0.40",a="",o="?",l="function",c="undefined",u="object",d="string",f="major",x="model",g="name",y="type",v="vendor",C="version",N="architecture",P="console",T="mobile",M="tablet",F="smarttv",$="wearable",L="embedded",z=500,X="Amazon",ne="Apple",J="ASUS",K="BlackBerry",te="Browser",fe="Chrome",q="Edge",se="Firefox",ae="Google",W="Huawei",V="LG",ee="Microsoft",oe="Motorola",de="Opera",Ce="Samsung",me="Sharp",we="Sony",xe="Xiaomi",be="Zebra",je="Facebook",Ie="Chromium OS",Re="Mac OS",Qe=" Browser",Ke=function(an,Jt){var Ye={};for(var Je in an)Jt[Je]&&Jt[Je].length%2===0?Ye[Je]=Jt[Je].concat(an[Je]):Ye[Je]=an[Je];return Ye},dt=function(an){for(var Jt={},Ye=0;Ye<an.length;Ye++)Jt[an[Ye].toUpperCase()]=an[Ye];return Jt},tt=function(an,Jt){return typeof an===d?nt(Jt).indexOf(nt(an))!==-1:!1},nt=function(an){return an.toLowerCase()},Le=function(an){return typeof an===d?an.replace(/[^\d\.]/g,a).split(".")[0]:r},Be=function(an,Jt){if(typeof an===d)return an=an.replace(/^\s\s*/,a),typeof Jt===c?an:an.substring(0,z)},ht=function(an,Jt){for(var Ye=0,Je,It,hn,Yt,Rt,ot;Ye<Jt.length&&!Rt;){var De=Jt[Ye],At=Jt[Ye+1];for(Je=It=0;Je<De.length&&!Rt&&De[Je];)if(Rt=De[Je++].exec(an),Rt)for(hn=0;hn<At.length;hn++)ot=Rt[++It],Yt=At[hn],typeof Yt===u&&Yt.length>0?Yt.length===2?typeof Yt[1]==l?this[Yt[0]]=Yt[1].call(this,ot):this[Yt[0]]=Yt[1]:Yt.length===3?typeof Yt[1]===l&&!(Yt[1].exec&&Yt[1].test)?this[Yt[0]]=ot?Yt[1].call(this,ot,Yt[2]):r:this[Yt[0]]=ot?ot.replace(Yt[1],Yt[2]):r:Yt.length===4&&(this[Yt[0]]=ot?Yt[3].call(this,ot.replace(Yt[1],Yt[2])):r):this[Yt]=ot||r;Ye+=2}},pt=function(an,Jt){for(var Ye in Jt)if(typeof Jt[Ye]===u&&Jt[Ye].length>0){for(var Je=0;Je<Jt[Ye].length;Je++)if(tt(Jt[Ye][Je],an))return Ye===o?r:Ye}else if(tt(Jt[Ye],an))return Ye===o?r:Ye;return Jt.hasOwnProperty("*")?Jt["*"]:an},Gt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},wt={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},nn={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[C,[g,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[C,[g,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[g,C],[/opios[\/ ]+([\w\.]+)/i],[C,[g,de+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[C,[g,de+" GX"]],[/\bopr\/([\w\.]+)/i],[C,[g,de]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[C,[g,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[C,[g,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[g,C],[/quark(?:pc)?\/([-\w\.]+)/i],[C,[g,"Quark"]],[/\bddg\/([\w\.]+)/i],[C,[g,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[C,[g,"UC"+te]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[C,[g,"WeChat"]],[/konqueror\/([\w\.]+)/i],[C,[g,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[C,[g,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[C,[g,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[C,[g,"Smart Lenovo "+te]],[/(avast|avg)\/([\w\.]+)/i],[[g,/(.+)/,"$1 Secure "+te],C],[/\bfocus\/([\w\.]+)/i],[C,[g,se+" Focus"]],[/\bopt\/([\w\.]+)/i],[C,[g,de+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[C,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[C,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[C,[g,de+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[C,[g,"MIUI"+Qe]],[/fxios\/([\w\.-]+)/i],[C,[g,se]],[/\bqihoobrowser\/?([\w\.]*)/i],[C,[g,"360"]],[/\b(qq)\/([\w\.]+)/i],[[g,/(.+)/,"$1Browser"],C],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1"+Qe],C],[/samsungbrowser\/([\w\.]+)/i],[C,[g,Ce+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[C,[g,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[g,"Sogou Mobile"],C],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[g,C],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[g],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[C,g],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[g,je],C],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[g,C],[/\bgsa\/([\w\.]+) .*safari\//i],[C,[g,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[C,[g,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[C,[g,fe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,fe+" WebView"],C],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[C,[g,"Android "+te]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[g,C],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[C,[g,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[C,g],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[g,[C,pt,Gt]],[/(webkit|khtml)\/([\w\.]+)/i],[g,C],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],C],[/(wolvic|librewolf)\/([\w\.]+)/i],[g,C],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[C,[g,se+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[g,[C,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[g,[C,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[N,"amd64"]],[/(ia32(?=;))/i],[[N,nt]],[/((?:i[346]|x)86)[;\)]/i],[[N,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[N,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[N,"armhf"]],[/windows (ce|mobile); ppc;/i],[[N,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[N,/ower/,a,nt]],[/(sun4\w)[;\)]/i],[[N,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[N,nt]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[x,[v,Ce],[y,M]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[x,[v,Ce],[y,T]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[x,[v,ne],[y,T]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[x,[v,ne],[y,M]],[/(macintosh);/i],[x,[v,ne]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[x,[v,me],[y,T]],[/(?:honor)([-\w ]+)[;\)]/i],[x,[v,"Honor"],[y,T]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[x,[v,W],[y,M]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[x,[v,W],[y,T]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[x,/_/g," "],[v,xe],[y,T]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[x,/_/g," "],[v,xe],[y,M]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[x,[v,"OPPO"],[y,T]],[/\b(opd2\d{3}a?) bui/i],[x,[v,"OPPO"],[y,M]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[x,[v,"Vivo"],[y,T]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[x,[v,"Realme"],[y,T]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[x,[v,oe],[y,T]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[x,[v,oe],[y,M]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[x,[v,V],[y,M]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[x,[v,V],[y,T]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[x,[v,"Lenovo"],[y,M]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[x,/_/g," "],[v,"Nokia"],[y,T]],[/(pixel c)\b/i],[x,[v,ae],[y,M]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[x,[v,ae],[y,T]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[x,[v,we],[y,T]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[x,"Xperia Tablet"],[v,we],[y,M]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[x,[v,"OnePlus"],[y,T]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[x,[v,X],[y,M]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[x,/(.+)/g,"Fire Phone $1"],[v,X],[y,T]],[/(playbook);[-\w\),; ]+(rim)/i],[x,v,[y,M]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[x,[v,K],[y,T]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[x,[v,J],[y,M]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[x,[v,J],[y,T]],[/(nexus 9)/i],[x,[v,"HTC"],[y,M]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[v,[x,/_/g," "],[y,T]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[x,[v,"TCL"],[y,M]],[/(itel) ((\w+))/i],[[v,nt],x,[y,pt,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[x,[v,"Acer"],[y,M]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[x,[v,"Meizu"],[y,T]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[x,[v,"Ulefone"],[y,T]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[x,[v,"Energizer"],[y,T]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[x,[v,"Cat"],[y,T]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[x,[v,"Smartfren"],[y,T]],[/droid.+; (a(?:015|06[35]|142p?))/i],[x,[v,"Nothing"],[y,T]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[v,x,[y,T]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[v,x,[y,M]],[/(surface duo)/i],[x,[v,ee],[y,M]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[x,[v,"Fairphone"],[y,T]],[/(u304aa)/i],[x,[v,"AT&T"],[y,T]],[/\bsie-(\w*)/i],[x,[v,"Siemens"],[y,T]],[/\b(rct\w+) b/i],[x,[v,"RCA"],[y,M]],[/\b(venue[\d ]{2,7}) b/i],[x,[v,"Dell"],[y,M]],[/\b(q(?:mv|ta)\w+) b/i],[x,[v,"Verizon"],[y,M]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[x,[v,"Barnes & Noble"],[y,M]],[/\b(tm\d{3}\w+) b/i],[x,[v,"NuVision"],[y,M]],[/\b(k88) b/i],[x,[v,"ZTE"],[y,M]],[/\b(nx\d{3}j) b/i],[x,[v,"ZTE"],[y,T]],[/\b(gen\d{3}) b.+49h/i],[x,[v,"Swiss"],[y,T]],[/\b(zur\d{3}) b/i],[x,[v,"Swiss"],[y,M]],[/\b((zeki)?tb.*\b) b/i],[x,[v,"Zeki"],[y,M]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[v,"Dragon Touch"],x,[y,M]],[/\b(ns-?\w{0,9}) b/i],[x,[v,"Insignia"],[y,M]],[/\b((nxa|next)-?\w{0,9}) b/i],[x,[v,"NextBook"],[y,M]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[v,"Voice"],x,[y,T]],[/\b(lvtel\-)?(v1[12]) b/i],[[v,"LvTel"],x,[y,T]],[/\b(ph-1) /i],[x,[v,"Essential"],[y,T]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[x,[v,"Envizen"],[y,M]],[/\b(trio[-\w\. ]+) b/i],[x,[v,"MachSpeed"],[y,M]],[/\btu_(1491) b/i],[x,[v,"Rotor"],[y,M]],[/(shield[\w ]+) b/i],[x,[v,"Nvidia"],[y,M]],[/(sprint) (\w+)/i],[v,x,[y,T]],[/(kin\.[onetw]{3})/i],[[x,/\./g," "],[v,ee],[y,T]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[x,[v,be],[y,M]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[x,[v,be],[y,T]],[/smart-tv.+(samsung)/i],[v,[y,F]],[/hbbtv.+maple;(\d+)/i],[[x,/^/,"SmartTV"],[v,Ce],[y,F]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[v,V],[y,F]],[/(apple) ?tv/i],[v,[x,ne+" TV"],[y,F]],[/crkey/i],[[x,fe+"cast"],[v,ae],[y,F]],[/droid.+aft(\w+)( bui|\))/i],[x,[v,X],[y,F]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[x,[v,me],[y,F]],[/(bravia[\w ]+)( bui|\))/i],[x,[v,we],[y,F]],[/(mitv-\w{5}) bui/i],[x,[v,xe],[y,F]],[/Hbbtv.*(technisat) (.*);/i],[v,x,[y,F]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[v,Be],[x,Be],[y,F]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,F]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[v,x,[y,P]],[/droid.+; (shield) bui/i],[x,[v,"Nvidia"],[y,P]],[/(playstation [345portablevi]+)/i],[x,[v,we],[y,P]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[x,[v,ee],[y,P]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[x,[v,Ce],[y,$]],[/((pebble))app/i],[v,x,[y,$]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[x,[v,ne],[y,$]],[/droid.+; (glass) \d/i],[x,[v,ae],[y,$]],[/droid.+; (wt63?0{2,3})\)/i],[x,[v,be],[y,$]],[/droid.+; (glass) \d/i],[x,[v,ae],[y,$]],[/(pico) (4|neo3(?: link|pro)?)/i],[v,x,[y,$]],[/; (quest( \d| pro)?)/i],[x,[v,je],[y,$]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[v,[y,L]],[/(aeobc)\b/i],[x,[v,X],[y,L]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[x,[y,T]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[x,[y,M]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,M]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,T]],[/(android[-\w\. ]{0,9});.+buil/i],[x,[v,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[C,[g,q+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[g,C],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[C,[g,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[g,C],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[C,g]],os:[[/microsoft (windows) (vista|xp)/i],[g,C],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[g,[C,pt,wt]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[C,pt,wt],[g,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[C,/_/g,"."],[g,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[g,Re],[C,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[C,g],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[g,C],[/\(bb(10);/i],[C,[g,K]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[C,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[C,[g,se+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[C,[g,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[C,[g,"watchOS"]],[/crkey\/([\d\.]+)/i],[C,[g,fe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,Ie],C],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[g,C],[/(sunos) ?([\w\.\d]*)/i],[[g,"Solaris"],C],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[g,C]]},cn=function(an,Jt){if(typeof an===u&&(Jt=an,an=r),!(this instanceof cn))return new cn(an,Jt).getResult();var Ye=typeof n!==c&&n.navigator?n.navigator:r,Je=an||(Ye&&Ye.userAgent?Ye.userAgent:a),It=Ye&&Ye.userAgentData?Ye.userAgentData:r,hn=Jt?Ke(nn,Jt):nn,Yt=Ye&&Ye.userAgent==Je;return this.getBrowser=function(){var Rt={};return Rt[g]=r,Rt[C]=r,ht.call(Rt,Je,hn.browser),Rt[f]=Le(Rt[C]),Yt&&Ye&&Ye.brave&&typeof Ye.brave.isBrave==l&&(Rt[g]="Brave"),Rt},this.getCPU=function(){var Rt={};return Rt[N]=r,ht.call(Rt,Je,hn.cpu),Rt},this.getDevice=function(){var Rt={};return Rt[v]=r,Rt[x]=r,Rt[y]=r,ht.call(Rt,Je,hn.device),Yt&&!Rt[y]&&It&&It.mobile&&(Rt[y]=T),Yt&&Rt[x]=="Macintosh"&&Ye&&typeof Ye.standalone!==c&&Ye.maxTouchPoints&&Ye.maxTouchPoints>2&&(Rt[x]="iPad",Rt[y]=M),Rt},this.getEngine=function(){var Rt={};return Rt[g]=r,Rt[C]=r,ht.call(Rt,Je,hn.engine),Rt},this.getOS=function(){var Rt={};return Rt[g]=r,Rt[C]=r,ht.call(Rt,Je,hn.os),Yt&&!Rt[g]&&It&&It.platform&&It.platform!="Unknown"&&(Rt[g]=It.platform.replace(/chrome os/i,Ie).replace(/macos/i,Re)),Rt},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return Je},this.setUA=function(Rt){return Je=typeof Rt===d&&Rt.length>z?Be(Rt,z):Rt,this},this.setUA(Je),this};cn.VERSION=s,cn.BROWSER=dt([g,C,f]),cn.CPU=dt([N]),cn.DEVICE=dt([x,v,y,P,T,F,M,$,L]),cn.ENGINE=cn.OS=dt([g,C]),t.exports&&(e=t.exports=cn),e.UAParser=cn;var Un=typeof n!==c&&(n.jQuery||n.Zepto);if(Un&&!Un.ua){var Xt=new cn;Un.ua=Xt.getResult(),Un.ua.get=function(){return Xt.getUA()},Un.ua.set=function(an){Xt.setUA(an);var Jt=Xt.getResult();for(var Ye in Jt)Un.ua[Ye]=Jt[Ye]}}})(typeof window=="object"?window:$Mt)}(n9,n9.exports)),n9.exports}var zMt=UMt(),mC={},DW,Qbe;function HMt(){return Qbe||(Qbe=1,DW=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),DW}var BW={},jb={},Zbe;function M5(){if(Zbe)return jb;Zbe=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return jb.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},jb.getSymbolTotalCodewords=function(r){return e[r]},jb.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},jb.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},jb.isKanjiModeEnabled=function(){return typeof t<"u"},jb.toSJIS=function(r){return t(r)},jb}var $W={},Jbe;function Tce(){return Jbe||(Jbe=1,function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,s){if(t.isValid(r))return r;try{return e(r)}catch{return s}}}($W)),$W}var UW,eye;function VMt(){if(eye)return UW;eye=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(e){const n=Math.floor(e/8);return(this.buffer[n]>>>7-e%8&1)===1},put:function(e,n){for(let r=0;r<n;r++)this.putBit((e>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),e&&(this.buffer[n]|=128>>>this.length%8),this.length++}},UW=t,UW}var zW,tye;function WMt(){if(tye)return zW;tye=1;function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return t.prototype.set=function(e,n,r,s){const a=e*this.size+n;this.data[a]=r,s&&(this.reservedBit[a]=!0)},t.prototype.get=function(e,n){return this.data[e*this.size+n]},t.prototype.xor=function(e,n,r){this.data[e*this.size+n]^=r},t.prototype.isReserved=function(e,n){return this.reservedBit[e*this.size+n]},zW=t,zW}var HW={},nye;function qMt(){return nye||(nye=1,function(t){const e=M5().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const s=Math.floor(r/7)+2,a=e(r),o=a===145?26:Math.ceil((a-13)/(2*s-2))*2,l=[a-7];for(let c=1;c<s-1;c++)l[c]=l[c-1]-o;return l.push(6),l.reverse()},t.getPositions=function(r){const s=[],a=t.getRowColCoords(r),o=a.length;for(let l=0;l<o;l++)for(let c=0;c<o;c++)l===0&&c===0||l===0&&c===o-1||l===o-1&&c===0||s.push([a[l],a[c]]);return s}}(HW)),HW}var VW={},rye;function GMt(){if(rye)return VW;rye=1;const t=M5().getSymbolSize,e=7;return VW.getPositions=function(r){const s=t(r);return[[0,0],[s-e,0],[0,s-e]]},VW}var WW={},sye;function KMt(){return sye||(sye=1,function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},t.from=function(s){return t.isValid(s)?parseInt(s,10):void 0},t.getPenaltyN1=function(s){const a=s.size;let o=0,l=0,c=0,u=null,d=null;for(let f=0;f<a;f++){l=c=0,u=d=null;for(let x=0;x<a;x++){let g=s.get(f,x);g===u?l++:(l>=5&&(o+=e.N1+(l-5)),u=g,l=1),g=s.get(x,f),g===d?c++:(c>=5&&(o+=e.N1+(c-5)),d=g,c=1)}l>=5&&(o+=e.N1+(l-5)),c>=5&&(o+=e.N1+(c-5))}return o},t.getPenaltyN2=function(s){const a=s.size;let o=0;for(let l=0;l<a-1;l++)for(let c=0;c<a-1;c++){const u=s.get(l,c)+s.get(l,c+1)+s.get(l+1,c)+s.get(l+1,c+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(s){const a=s.size;let o=0,l=0,c=0;for(let u=0;u<a;u++){l=c=0;for(let d=0;d<a;d++)l=l<<1&2047|s.get(u,d),d>=10&&(l===1488||l===93)&&o++,c=c<<1&2047|s.get(d,u),d>=10&&(c===1488||c===93)&&o++}return o*e.N3},t.getPenaltyN4=function(s){let a=0;const o=s.data.length;for(let c=0;c<o;c++)a+=s.data[c];return Math.abs(Math.ceil(a*100/o/5)-10)*e.N4};function n(r,s,a){switch(r){case t.Patterns.PATTERN000:return(s+a)%2===0;case t.Patterns.PATTERN001:return s%2===0;case t.Patterns.PATTERN010:return a%3===0;case t.Patterns.PATTERN011:return(s+a)%3===0;case t.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(a/3))%2===0;case t.Patterns.PATTERN101:return s*a%2+s*a%3===0;case t.Patterns.PATTERN110:return(s*a%2+s*a%3)%2===0;case t.Patterns.PATTERN111:return(s*a%3+(s+a)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(s,a){const o=a.size;for(let l=0;l<o;l++)for(let c=0;c<o;c++)a.isReserved(c,l)||a.xor(c,l,n(s,c,l))},t.getBestMask=function(s,a){const o=Object.keys(t.Patterns).length;let l=0,c=1/0;for(let u=0;u<o;u++){a(u),t.applyMask(u,s);const d=t.getPenaltyN1(s)+t.getPenaltyN2(s)+t.getPenaltyN3(s)+t.getPenaltyN4(s);t.applyMask(u,s),d<c&&(c=d,l=u)}return l}}(WW)),WW}var rF={},iye;function nBe(){if(iye)return rF;iye=1;const t=Tce(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return rF.getBlocksCount=function(s,a){switch(a){case t.L:return e[(s-1)*4+0];case t.M:return e[(s-1)*4+1];case t.Q:return e[(s-1)*4+2];case t.H:return e[(s-1)*4+3];default:return}},rF.getTotalCodewordsCount=function(s,a){switch(a){case t.L:return n[(s-1)*4+0];case t.M:return n[(s-1)*4+1];case t.Q:return n[(s-1)*4+2];case t.H:return n[(s-1)*4+3];default:return}},rF}var qW={},l7={},aye;function YMt(){if(aye)return l7;aye=1;const t=new Uint8Array(512),e=new Uint8Array(256);return function(){let r=1;for(let s=0;s<255;s++)t[s]=r,e[r]=s,r<<=1,r&256&&(r^=285);for(let s=255;s<512;s++)t[s]=t[s-255]}(),l7.log=function(r){if(r<1)throw new Error("log("+r+")");return e[r]},l7.exp=function(r){return t[r]},l7.mul=function(r,s){return r===0||s===0?0:t[e[r]+e[s]]},l7}var oye;function XMt(){return oye||(oye=1,function(t){const e=YMt();t.mul=function(r,s){const a=new Uint8Array(r.length+s.length-1);for(let o=0;o<r.length;o++)for(let l=0;l<s.length;l++)a[o+l]^=e.mul(r[o],s[l]);return a},t.mod=function(r,s){let a=new Uint8Array(r);for(;a.length-s.length>=0;){const o=a[0];for(let c=0;c<s.length;c++)a[c]^=e.mul(s[c],o);let l=0;for(;l<a.length&&a[l]===0;)l++;a=a.slice(l)}return a},t.generateECPolynomial=function(r){let s=new Uint8Array([1]);for(let a=0;a<r;a++)s=t.mul(s,new Uint8Array([1,e.exp(a)]));return s}}(qW)),qW}var GW,lye;function QMt(){if(lye)return GW;lye=1;const t=XMt();function e(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},e.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(r.length+this.degree);s.set(r);const a=t.mod(s,this.genPoly),o=this.degree-a.length;if(o>0){const l=new Uint8Array(this.degree);return l.set(a,o),l}return a},GW=e,GW}var KW={},YW={},XW={},cye;function rBe(){return cye||(cye=1,XW.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),XW}var o0={},uye;function sBe(){if(uye)return o0;uye=1;const t="[0-9]+",e="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
]))+`;o0.KANJI=new RegExp(n,"g"),o0.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),o0.BYTE=new RegExp(r,"g"),o0.NUMERIC=new RegExp(t,"g"),o0.ALPHANUMERIC=new RegExp(e,"g");const s=new RegExp("^"+n+"$"),a=new RegExp("^"+t+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return o0.testKanji=function(c){return s.test(c)},o0.testNumeric=function(c){return a.test(c)},o0.testAlphanumeric=function(c){return o.test(c)},o0}var dye;function R5(){return dye||(dye=1,function(t){const e=rBe(),n=sBe();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(a,o){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?a.ccBits[0]:o<27?a.ccBits[1]:a.ccBits[2]},t.getBestModeForData=function(a){return n.testNumeric(a)?t.NUMERIC:n.testAlphanumeric(a)?t.ALPHANUMERIC:n.testKanji(a)?t.KANJI:t.BYTE},t.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},t.isValid=function(a){return a&&a.bit&&a.ccBits};function r(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+s)}}t.from=function(a,o){if(t.isValid(a))return a;try{return r(a)}catch{return o}}}(YW)),YW}var fye;function ZMt(){return fye||(fye=1,function(t){const e=M5(),n=nBe(),r=Tce(),s=R5(),a=rBe(),o=7973,l=e.getBCHDigit(o);function c(x,g,y){for(let v=1;v<=40;v++)if(g<=t.getCapacity(v,y,x))return v}function u(x,g){return s.getCharCountIndicator(x,g)+4}function d(x,g){let y=0;return x.forEach(function(v){const C=u(v.mode,g);y+=C+v.getBitsLength()}),y}function f(x,g){for(let y=1;y<=40;y++)if(d(x,y)<=t.getCapacity(y,g,s.MIXED))return y}t.from=function(g,y){return a.isValid(g)?parseInt(g,10):y},t.getCapacity=function(g,y,v){if(!a.isValid(g))throw new Error("Invalid QR Code version");typeof v>"u"&&(v=s.BYTE);const C=e.getSymbolTotalCodewords(g),N=n.getTotalCodewordsCount(g,y),P=(C-N)*8;if(v===s.MIXED)return P;const T=P-u(v,g);switch(v){case s.NUMERIC:return Math.floor(T/10*3);case s.ALPHANUMERIC:return Math.floor(T/11*2);case s.KANJI:return Math.floor(T/13);case s.BYTE:default:return Math.floor(T/8)}},t.getBestVersionForData=function(g,y){let v;const C=r.from(y,r.M);if(Array.isArray(g)){if(g.length>1)return f(g,C);if(g.length===0)return 1;v=g[0]}else v=g;return c(v.mode,v.getLength(),C)},t.getEncodedBits=function(g){if(!a.isValid(g)||g<7)throw new Error("Invalid QR Code version");let y=g<<12;for(;e.getBCHDigit(y)-l>=0;)y^=o<<e.getBCHDigit(y)-l;return g<<12|y}}(KW)),KW}var QW={},hye;function JMt(){if(hye)return QW;hye=1;const t=M5(),e=1335,n=21522,r=t.getBCHDigit(e);return QW.getEncodedBits=function(a,o){const l=a.bit<<3|o;let c=l<<10;for(;t.getBCHDigit(c)-r>=0;)c^=e<<t.getBCHDigit(c)-r;return(l<<10|c)^n},QW}var ZW={},JW,pye;function eRt(){if(pye)return JW;pye=1;const t=R5();function e(n){this.mode=t.NUMERIC,this.data=n.toString()}return e.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(r){let s,a,o;for(s=0;s+3<=this.data.length;s+=3)a=this.data.substr(s,3),o=parseInt(a,10),r.put(o,10);const l=this.data.length-s;l>0&&(a=this.data.substr(s),o=parseInt(a,10),r.put(o,l*3+1))},JW=e,JW}var eq,mye;function tRt(){if(mye)return eq;mye=1;const t=R5(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=t.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){let a;for(a=0;a+2<=this.data.length;a+=2){let o=e.indexOf(this.data[a])*45;o+=e.indexOf(this.data[a+1]),s.put(o,11)}this.data.length%2&&s.put(e.indexOf(this.data[a]),6)},eq=n,eq}var tq,xye;function nRt(){if(xye)return tq;xye=1;const t=R5();function e(n){this.mode=t.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return e.getBitsLength=function(r){return r*8},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(n){for(let r=0,s=this.data.length;r<s;r++)n.put(this.data[r],8)},tq=e,tq}var nq,gye;function rRt(){if(gye)return nq;gye=1;const t=R5(),e=M5();function n(r){this.mode=t.KANJI,this.data=r}return n.getBitsLength=function(s){return s*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let s;for(s=0;s<this.data.length;s++){let a=e.toSJIS(this.data[s]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),r.put(a,13)}},nq=n,nq}var rq={exports:{}},bye;function sRt(){return bye||(bye=1,function(t){var e={single_source_shortest_paths:function(n,r,s){var a={},o={};o[r]=0;var l=e.PriorityQueue.make();l.push(r,0);for(var c,u,d,f,x,g,y,v,C;!l.empty();){c=l.pop(),u=c.value,f=c.cost,x=n[u]||{};for(d in x)x.hasOwnProperty(d)&&(g=x[d],y=f+g,v=o[d],C=typeof o[d]>"u",(C||v>y)&&(o[d]=y,l.push(d,y),a[d]=u))}if(typeof s<"u"&&typeof o[s]>"u"){var N=["Could not find a path from ",r," to ",s,"."].join("");throw new Error(N)}return a},extract_shortest_path_from_predecessor_list:function(n,r){for(var s=[],a=r;a;)s.push(a),n[a],a=n[a];return s.reverse(),s},find_path:function(n,r,s){var a=e.single_source_shortest_paths(n,r,s);return e.extract_shortest_path_from_predecessor_list(a,s)},PriorityQueue:{make:function(n){var r=e.PriorityQueue,s={},a;n=n||{};for(a in r)r.hasOwnProperty(a)&&(s[a]=r[a]);return s.queue=[],s.sorter=n.sorter||r.default_sorter,s},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var s={value:n,cost:r};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e}(rq)),rq.exports}var yye;function iRt(){return yye||(yye=1,function(t){const e=R5(),n=eRt(),r=tRt(),s=nRt(),a=rRt(),o=sBe(),l=M5(),c=sRt();function u(N){return unescape(encodeURIComponent(N)).length}function d(N,P,T){const M=[];let F;for(;(F=N.exec(T))!==null;)M.push({data:F[0],index:F.index,mode:P,length:F[0].length});return M}function f(N){const P=d(o.NUMERIC,e.NUMERIC,N),T=d(o.ALPHANUMERIC,e.ALPHANUMERIC,N);let M,F;return l.isKanjiModeEnabled()?(M=d(o.BYTE,e.BYTE,N),F=d(o.KANJI,e.KANJI,N)):(M=d(o.BYTE_KANJI,e.BYTE,N),F=[]),P.concat(T,M,F).sort(function(L,z){return L.index-z.index}).map(function(L){return{data:L.data,mode:L.mode,length:L.length}})}function x(N,P){switch(P){case e.NUMERIC:return n.getBitsLength(N);case e.ALPHANUMERIC:return r.getBitsLength(N);case e.KANJI:return a.getBitsLength(N);case e.BYTE:return s.getBitsLength(N)}}function g(N){return N.reduce(function(P,T){const M=P.length-1>=0?P[P.length-1]:null;return M&&M.mode===T.mode?(P[P.length-1].data+=T.data,P):(P.push(T),P)},[])}function y(N){const P=[];for(let T=0;T<N.length;T++){const M=N[T];switch(M.mode){case e.NUMERIC:P.push([M,{data:M.data,mode:e.ALPHANUMERIC,length:M.length},{data:M.data,mode:e.BYTE,length:M.length}]);break;case e.ALPHANUMERIC:P.push([M,{data:M.data,mode:e.BYTE,length:M.length}]);break;case e.KANJI:P.push([M,{data:M.data,mode:e.BYTE,length:u(M.data)}]);break;case e.BYTE:P.push([{data:M.data,mode:e.BYTE,length:u(M.data)}])}}return P}function v(N,P){const T={},M={start:{}};let F=["start"];for(let $=0;$<N.length;$++){const L=N[$],z=[];for(let X=0;X<L.length;X++){const ne=L[X],J=""+$+X;z.push(J),T[J]={node:ne,lastCount:0},M[J]={};for(let K=0;K<F.length;K++){const te=F[K];T[te]&&T[te].node.mode===ne.mode?(M[te][J]=x(T[te].lastCount+ne.length,ne.mode)-x(T[te].lastCount,ne.mode),T[te].lastCount+=ne.length):(T[te]&&(T[te].lastCount=ne.length),M[te][J]=x(ne.length,ne.mode)+4+e.getCharCountIndicator(ne.mode,P))}}F=z}for(let $=0;$<F.length;$++)M[F[$]].end=0;return{map:M,table:T}}function C(N,P){let T;const M=e.getBestModeForData(N);if(T=e.from(P,M),T!==e.BYTE&&T.bit<M.bit)throw new Error('"'+N+'" cannot be encoded with mode '+e.toString(T)+`.
Suggested mode is: `+e.toString(M));switch(T===e.KANJI&&!l.isKanjiModeEnabled()&&(T=e.BYTE),T){case e.NUMERIC:return new n(N);case e.ALPHANUMERIC:return new r(N);case e.KANJI:return new a(N);case e.BYTE:return new s(N)}}t.fromArray=function(P){return P.reduce(function(T,M){return typeof M=="string"?T.push(C(M,null)):M.data&&T.push(C(M.data,M.mode)),T},[])},t.fromString=function(P,T){const M=f(P,l.isKanjiModeEnabled()),F=y(M),$=v(F,T),L=c.find_path($.map,"start","end"),z=[];for(let X=1;X<L.length-1;X++)z.push($.table[L[X]].node);return t.fromArray(g(z))},t.rawSplit=function(P){return t.fromArray(f(P,l.isKanjiModeEnabled()))}}(ZW)),ZW}var vye;function aRt(){if(vye)return BW;vye=1;const t=M5(),e=Tce(),n=VMt(),r=WMt(),s=qMt(),a=GMt(),o=KMt(),l=nBe(),c=QMt(),u=ZMt(),d=JMt(),f=R5(),x=iRt();function g($,L){const z=$.size,X=a.getPositions(L);for(let ne=0;ne<X.length;ne++){const J=X[ne][0],K=X[ne][1];for(let te=-1;te<=7;te++)if(!(J+te<=-1||z<=J+te))for(let fe=-1;fe<=7;fe++)K+fe<=-1||z<=K+fe||(te>=0&&te<=6&&(fe===0||fe===6)||fe>=0&&fe<=6&&(te===0||te===6)||te>=2&&te<=4&&fe>=2&&fe<=4?$.set(J+te,K+fe,!0,!0):$.set(J+te,K+fe,!1,!0))}}function y($){const L=$.size;for(let z=8;z<L-8;z++){const X=z%2===0;$.set(z,6,X,!0),$.set(6,z,X,!0)}}function v($,L){const z=s.getPositions(L);for(let X=0;X<z.length;X++){const ne=z[X][0],J=z[X][1];for(let K=-2;K<=2;K++)for(let te=-2;te<=2;te++)K===-2||K===2||te===-2||te===2||K===0&&te===0?$.set(ne+K,J+te,!0,!0):$.set(ne+K,J+te,!1,!0)}}function C($,L){const z=$.size,X=u.getEncodedBits(L);let ne,J,K;for(let te=0;te<18;te++)ne=Math.floor(te/3),J=te%3+z-8-3,K=(X>>te&1)===1,$.set(ne,J,K,!0),$.set(J,ne,K,!0)}function N($,L,z){const X=$.size,ne=d.getEncodedBits(L,z);let J,K;for(J=0;J<15;J++)K=(ne>>J&1)===1,J<6?$.set(J,8,K,!0):J<8?$.set(J+1,8,K,!0):$.set(X-15+J,8,K,!0),J<8?$.set(8,X-J-1,K,!0):J<9?$.set(8,15-J-1+1,K,!0):$.set(8,15-J-1,K,!0);$.set(X-8,8,1,!0)}function P($,L){const z=$.size;let X=-1,ne=z-1,J=7,K=0;for(let te=z-1;te>0;te-=2)for(te===6&&te--;;){for(let fe=0;fe<2;fe++)if(!$.isReserved(ne,te-fe)){let q=!1;K<L.length&&(q=(L[K]>>>J&1)===1),$.set(ne,te-fe,q),J--,J===-1&&(K++,J=7)}if(ne+=X,ne<0||z<=ne){ne-=X,X=-X;break}}}function T($,L,z){const X=new n;z.forEach(function(fe){X.put(fe.mode.bit,4),X.put(fe.getLength(),f.getCharCountIndicator(fe.mode,$)),fe.write(X)});const ne=t.getSymbolTotalCodewords($),J=l.getTotalCodewordsCount($,L),K=(ne-J)*8;for(X.getLengthInBits()+4<=K&&X.put(0,4);X.getLengthInBits()%8!==0;)X.putBit(0);const te=(K-X.getLengthInBits())/8;for(let fe=0;fe<te;fe++)X.put(fe%2?17:236,8);return M(X,$,L)}function M($,L,z){const X=t.getSymbolTotalCodewords(L),ne=l.getTotalCodewordsCount(L,z),J=X-ne,K=l.getBlocksCount(L,z),te=X%K,fe=K-te,q=Math.floor(X/K),se=Math.floor(J/K),ae=se+1,W=q-se,V=new c(W);let ee=0;const oe=new Array(K),de=new Array(K);let Ce=0;const me=new Uint8Array($.buffer);for(let Ie=0;Ie<K;Ie++){const Re=Ie<fe?se:ae;oe[Ie]=me.slice(ee,ee+Re),de[Ie]=V.encode(oe[Ie]),ee+=Re,Ce=Math.max(Ce,Re)}const we=new Uint8Array(X);let xe=0,be,je;for(be=0;be<Ce;be++)for(je=0;je<K;je++)be<oe[je].length&&(we[xe++]=oe[je][be]);for(be=0;be<W;be++)for(je=0;je<K;je++)we[xe++]=de[je][be];return we}function F($,L,z,X){let ne;if(Array.isArray($))ne=x.fromArray($);else if(typeof $=="string"){let q=L;if(!q){const se=x.rawSplit($);q=u.getBestVersionForData(se,z)}ne=x.fromString($,q||40)}else throw new Error("Invalid data");const J=u.getBestVersionForData(ne,z);if(!J)throw new Error("The amount of data is too big to be stored in a QR Code");if(!L)L=J;else if(L<J)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+J+`.
`);const K=T(L,z,ne),te=t.getSymbolSize(L),fe=new r(te);return g(fe,L),y(fe),v(fe,L),N(fe,z,0),L>=7&&C(fe,L),P(fe,K),isNaN(X)&&(X=o.getBestMask(fe,N.bind(null,fe,z))),o.applyMask(X,fe),N(fe,z,X),{modules:fe,version:L,errorCorrectionLevel:z,maskPattern:X,segments:ne}}return BW.create=function(L,z){if(typeof L>"u"||L==="")throw new Error("No input text");let X=e.M,ne,J;return typeof z<"u"&&(X=e.from(z.errorCorrectionLevel,e.M),ne=u.from(z.version),J=o.from(z.maskPattern),z.toSJISFunc&&t.setToSJISFunction(z.toSJISFunc)),F(L,ne,X,J)},BW}var sq={},iq={},wye;function iBe(){return wye||(wye=1,function(t){function e(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(a){return[a,a]}))),r.length===6&&r.push("F","F");const s=parseInt(r.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const s=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,a=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:a,scale:a?4:o,margin:s,color:{dark:e(r.color.dark||"#000000ff"),light:e(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,s){return s.width&&s.width>=r+s.margin*2?s.width/(r+s.margin*2):s.scale},t.getImageWidth=function(r,s){const a=t.getScale(r,s);return Math.floor((r+s.margin*2)*a)},t.qrToImageData=function(r,s,a){const o=s.modules.size,l=s.modules.data,c=t.getScale(o,a),u=Math.floor((o+a.margin*2)*c),d=a.margin*c,f=[a.color.light,a.color.dark];for(let x=0;x<u;x++)for(let g=0;g<u;g++){let y=(x*u+g)*4,v=a.color.light;if(x>=d&&g>=d&&x<u-d&&g<u-d){const C=Math.floor((x-d)/c),N=Math.floor((g-d)/c);v=f[l[C*o+N]?1:0]}r[y++]=v.r,r[y++]=v.g,r[y++]=v.b,r[y]=v.a}}}(iq)),iq}var Cye;function oRt(){return Cye||(Cye=1,function(t){const e=iBe();function n(s,a,o){s.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=o,a.width=o,a.style.height=o+"px",a.style.width=o+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(a,o,l){let c=l,u=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(u=r()),c=e.getOptions(c);const d=e.getImageWidth(a.modules.size,c),f=u.getContext("2d"),x=f.createImageData(d,d);return e.qrToImageData(x.data,a,c),n(f,u,d),f.putImageData(x,0,0),u},t.renderToDataURL=function(a,o,l){let c=l;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const u=t.render(a,o,c),d=c.type||"image/png",f=c.rendererOpts||{};return u.toDataURL(d,f.quality)}}(sq)),sq}var aq={},Sye;function lRt(){if(Sye)return aq;Sye=1;const t=iBe();function e(s,a){const o=s.a/255,l=a+'="'+s.hex+'"';return o<1?l+" "+a+'-opacity="'+o.toFixed(2).slice(1)+'"':l}function n(s,a,o){let l=s+a;return typeof o<"u"&&(l+=" "+o),l}function r(s,a,o){let l="",c=0,u=!1,d=0;for(let f=0;f<s.length;f++){const x=Math.floor(f%a),g=Math.floor(f/a);!x&&!u&&(u=!0),s[f]?(d++,f>0&&x>0&&s[f-1]||(l+=u?n("M",x+o,.5+g+o):n("m",c,0),c=0,u=!1),x+1<a&&s[f+1]||(l+=n("h",d),d=0)):c++}return l}return aq.render=function(a,o,l){const c=t.getOptions(o),u=a.modules.size,d=a.modules.data,f=u+c.margin*2,x=c.color.light.a?"<path "+e(c.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",g="<path "+e(c.color.dark,"stroke")+' d="'+r(d,u,c.margin)+'"/>',y='viewBox="0 0 '+f+" "+f+'"',C='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+y+' shape-rendering="crispEdges">'+x+g+`</svg>
`;return typeof l=="function"&&l(null,C),C},aq}var Nye;function cRt(){if(Nye)return mC;Nye=1;const t=HMt(),e=aRt(),n=oRt(),r=lRt();function s(a,o,l,c,u){const d=[].slice.call(arguments,1),f=d.length,x=typeof d[f-1]=="function";if(!x&&!t())throw new Error("Callback required as last argument");if(x){if(f<2)throw new Error("Too few arguments provided");f===2?(u=l,l=o,o=c=void 0):f===3&&(o.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=o,o=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=o,o=c=void 0):f===2&&!o.getContext&&(c=l,l=o,o=void 0),new Promise(function(g,y){try{const v=e.create(l,c);g(a(v,o,c))}catch(v){y(v)}})}try{const g=e.create(l,c);u(null,a(g,o,c))}catch(g){u(g)}}return mC.create=e.create,mC.toCanvas=s.bind(null,n.render),mC.toDataURL=s.bind(null,n.renderToDataURL),mC.toString=s.bind(null,function(a,o,l){return r.render(a,l)}),mC}var uRt=cRt();const dRt=Ii(uRt);AU.type="coinbaseWallet";function AU(t={}){return t.version==="3"||t.headlessMode?hRt(t):fRt(t)}function fRt(t){let e,n,r,s;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:AU.type,async connect({chainId:o,...l}={}){try{const c=await this.getProvider(),u=(await c.request({method:"eth_requestAccounts",params:"instantOnboarding"in l&&l.instantOnboarding?[{onboarding:"instant"}]:[]})).map(f=>Tc(f));n||(n=this.onAccountsChanged.bind(this),c.on("accountsChanged",n)),r||(r=this.onChainChanged.bind(this),c.on("chainChanged",r)),s||(s=this.onDisconnect.bind(this),c.on("disconnect",s));let d=await this.getChainId();if(o&&d!==o){const f=await this.switchChain({chainId:o}).catch(x=>{if(x.code===So.code)throw x;return{id:d}});d=(f==null?void 0:f.id)??d}return{accounts:u,chainId:d}}catch(c){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message)?new So(c):c}},async disconnect(){var l;const o=await this.getProvider();n&&(o.removeListener("accountsChanged",n),n=void 0),r&&(o.removeListener("chainChanged",r),r=void 0),s&&(o.removeListener("disconnect",s),s=void 0),o.disconnect(),(l=o.close)==null||l.call(o)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(l=>Tc(l))},async getChainId(){const l=await(await this.getProvider()).request({method:"eth_chainId"});return Number(l)},async getProvider(){if(!e){const o=(()=>{var u;return typeof t.preference=="string"?{options:t.preference}:{...t.preference,options:((u=t.preference)==null?void 0:u.options)??"all"}})(),{createCoinbaseWalletSDK:l}=await os(async()=>{const{createCoinbaseWalletSDK:u}=await import("./index-CcSeRxRa.js");return{createCoinbaseWalletSDK:u}},__vite__mapDeps([0,1,2,3]));e=l({...t,appChainIds:a.chains.map(u=>u.id),preference:o}).getProvider()}return e},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:l}){var d,f,x,g;const c=a.chains.find(y=>y.id===l);if(!c)throw new pp(new H3);const u=await this.getProvider();try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:zs(c.id)}]}),c}catch(y){if(y.code===4902)try{let v;o!=null&&o.blockExplorerUrls?v=o.blockExplorerUrls:v=(d=c.blockExplorers)!=null&&d.default.url?[(f=c.blockExplorers)==null?void 0:f.default.url]:[];let C;(x=o==null?void 0:o.rpcUrls)!=null&&x.length?C=o.rpcUrls:C=[((g=c.rpcUrls.default)==null?void 0:g.http[0])??""];const N={blockExplorerUrls:v,chainId:zs(l),chainName:(o==null?void 0:o.chainName)??c.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??c.nativeCurrency,rpcUrls:C};return await u.request({method:"wallet_addEthereumChain",params:[N]}),c}catch(v){throw new So(v)}throw new pp(y)}},onAccountsChanged(o){o.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:o.map(l=>Tc(l))})},onChainChanged(o){const l=Number(o);a.emitter.emit("change",{chainId:l})},async onDisconnect(o){a.emitter.emit("disconnect");const l=await this.getProvider();n&&(l.removeListener("accountsChanged",n),n=void 0),r&&(l.removeListener("chainChanged",r),r=void 0),s&&(l.removeListener("disconnect",s),s=void 0)}})}function hRt(t){let n,r,s,a,o;return l=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",type:AU.type,async connect({chainId:c}={}){try{const u=await this.getProvider(),d=(await u.request({method:"eth_requestAccounts"})).map(x=>Tc(x));s||(s=this.onAccountsChanged.bind(this),u.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),u.on("chainChanged",a)),o||(o=this.onDisconnect.bind(this),u.on("disconnect",o));let f=await this.getChainId();if(c&&f!==c){const x=await this.switchChain({chainId:c}).catch(g=>{if(g.code===So.code)throw g;return{id:f}});f=(x==null?void 0:x.id)??f}return{accounts:d,chainId:f}}catch(u){throw/(user closed modal|accounts received is empty|user denied account)/i.test(u.message)?new So(u):u}},async disconnect(){const c=await this.getProvider();s&&(c.removeListener("accountsChanged",s),s=void 0),a&&(c.removeListener("chainChanged",a),a=void 0),o&&(c.removeListener("disconnect",o),o=void 0),c.disconnect(),c.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(u=>Tc(u))},async getChainId(){const u=await(await this.getProvider()).request({method:"eth_chainId"});return Number(u)},async getProvider(){var c;if(!r){const u=await(async()=>{const{default:y}=await os(async()=>{const{default:v}=await import("./index-DC7AP6br.js").then(C=>C.i);return{default:v}},__vite__mapDeps([4,3,5]));return typeof y!="function"&&typeof y.default=="function"?y.default:y})();n=new u({...t,reloadOnDisconnect:!1});const d=(c=n.walletExtension)==null?void 0:c.getChainId(),f=l.chains.find(y=>t.chainId?y.id===t.chainId:y.id===d)||l.chains[0],x=t.chainId||(f==null?void 0:f.id),g=t.jsonRpcUrl||(f==null?void 0:f.rpcUrls.default.http[0]);r=n.makeWeb3Provider(g,x)}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:u}){var x,g,y,v;const d=l.chains.find(C=>C.id===u);if(!d)throw new pp(new H3);const f=await this.getProvider();try{return await f.request({method:"wallet_switchEthereumChain",params:[{chainId:zs(d.id)}]}),d}catch(C){if(C.code===4902)try{let N;c!=null&&c.blockExplorerUrls?N=c.blockExplorerUrls:N=(x=d.blockExplorers)!=null&&x.default.url?[(g=d.blockExplorers)==null?void 0:g.default.url]:[];let P;(y=c==null?void 0:c.rpcUrls)!=null&&y.length?P=c.rpcUrls:P=[((v=d.rpcUrls.default)==null?void 0:v.http[0])??""];const T={blockExplorerUrls:N,chainId:zs(u),chainName:(c==null?void 0:c.chainName)??d.name,iconUrls:c==null?void 0:c.iconUrls,nativeCurrency:(c==null?void 0:c.nativeCurrency)??d.nativeCurrency,rpcUrls:P};return await f.request({method:"wallet_addEthereumChain",params:[T]}),d}catch(N){throw new So(N)}throw new pp(C)}},onAccountsChanged(c){c.length===0?this.onDisconnect():l.emitter.emit("change",{accounts:c.map(u=>Tc(u))})},onChainChanged(c){const u=Number(c);l.emitter.emit("change",{chainId:u})},async onDisconnect(c){l.emitter.emit("disconnect");const u=await this.getProvider();s&&(u.removeListener("accountsChanged",s),s=void 0),a&&(u.removeListener("chainChanged",a),a=void 0),o&&(u.removeListener("disconnect",o),o=void 0)}})}Pce.type="safe";function Pce(t={}){const{shimDisconnect:e=!1}=t;let n,r;return s=>({id:"safe",name:"Safe",type:Pce.type,async connect(){var c;const a=await this.getProvider();if(!a)throw new tp;const o=await this.getAccounts(),l=await this.getChainId();return r||(r=this.onDisconnect.bind(this),a.on("disconnect",r)),e&&await((c=s.storage)==null?void 0:c.removeItem("safe.disconnected")),{accounts:o,chainId:l}},async disconnect(){var o;const a=await this.getProvider();if(!a)throw new tp;r&&(a.removeListener("disconnect",r),r=void 0),e&&await((o=s.storage)==null?void 0:o.setItem("safe.disconnected",!0))},async getAccounts(){const a=await this.getProvider();if(!a)throw new tp;return(await a.request({method:"eth_accounts"})).map(Tc)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!n){const{default:o}=await os(async()=>{const{default:d}=await import("./index-B8lqC164.js");return{default:d}},__vite__mapDeps([6,7,2])),l=new o(t),c=await uoe(()=>l.safe.getInfo(),{timeout:t.unstable_getInfoTimeout??10});if(!c)throw new Error("Could not load Safe information");const u=await(async()=>{const d=await os(()=>import("./index-D3tye22W.js").then(f=>f.i),__vite__mapDeps([8,7,1,5]));return typeof d.SafeAppProvider!="function"&&typeof d.default.SafeAppProvider=="function"?d.default.SafeAppProvider:d.SafeAppProvider})();n=new u(c,l)}return n}},async getChainId(){const a=await this.getProvider();if(!a)throw new tp;return Number(a.chainId)},async isAuthorized(){var a;try{return e&&await((a=s.storage)==null?void 0:a.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){s.emitter.emit("disconnect")}})}Ice.type="walletConnect";function Ice(t){const e=t.isNewChainsStale??!0;let n,r;const s="eip155";let a,o,l,c,u,d;return f=>({id:"walletConnect",name:"WalletConnect",type:Ice.type,async setup(){const x=await this.getProvider().catch(()=>null);x&&(l||(l=this.onConnect.bind(this),x.on("connect",l)),u||(u=this.onSessionDelete.bind(this),x.on("session_delete",u)))},async connect({chainId:x,...g}={}){var y,v;try{const C=await this.getProvider();if(!C)throw new tp;c||(c=this.onDisplayUri,C.on("display_uri",c));let N=x;if(!N){const F=await((y=f.storage)==null?void 0:y.getItem("state"))??{};f.chains.some(L=>L.id===F.chainId)?N=F.chainId:N=(v=f.chains[0])==null?void 0:v.id}if(!N)throw new Error("No chains found on connector.");const P=await this.isChainsStale();if(C.session&&P&&await C.disconnect(),!C.session||P){const F=f.chains.filter($=>$.id!==N).map($=>$.id);await C.connect({optionalChains:[N,...F],..."pairingTopic"in g?{pairingTopic:g.pairingTopic}:{}}),this.setRequestedChainsIds(f.chains.map($=>$.id))}const T=(await C.enable()).map(F=>Tc(F)),M=await this.getChainId();return c&&(C.removeListener("display_uri",c),c=void 0),l&&(C.removeListener("connect",l),l=void 0),a||(a=this.onAccountsChanged.bind(this),C.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),C.on("chainChanged",o)),d||(d=this.onDisconnect.bind(this),C.on("disconnect",d)),u||(u=this.onSessionDelete.bind(this),C.on("session_delete",u)),{accounts:T,chainId:M}}catch(C){throw/(user rejected|connection request reset)/i.test(C==null?void 0:C.message)?new So(C):C}},async disconnect(){const x=await this.getProvider();try{await(x==null?void 0:x.disconnect())}catch(g){if(!/No matching key/i.test(g.message))throw g}finally{o&&(x==null||x.removeListener("chainChanged",o),o=void 0),d&&(x==null||x.removeListener("disconnect",d),d=void 0),l||(l=this.onConnect.bind(this),x==null||x.on("connect",l)),a&&(x==null||x.removeListener("accountsChanged",a),a=void 0),u&&(x==null||x.removeListener("session_delete",u),u=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(g=>Tc(g))},async getProvider({chainId:x}={}){var y;async function g(){const v=f.chains.map(N=>N.id);if(!v.length)return;const{EthereumProvider:C}=await os(async()=>{const{EthereumProvider:N}=await import("./index.es-BxZNpZ4D.js");return{EthereumProvider:N}},__vite__mapDeps([9,5]));return await C.init({...t,disableProviderPing:!0,optionalChains:v,projectId:t.projectId,rpcMap:Object.fromEntries(f.chains.map(N=>{const[P]=Ybt({chain:N,transports:f.transports});return[N.id,P]})),showQrModal:t.showQrModal??!0})}return n||(r||(r=g()),n=await r,n==null||n.events.setMaxListeners(Number.POSITIVE_INFINITY)),x&&await((y=this.switchChain)==null?void 0:y.call(this,{chainId:x})),n},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[x,g]=await Promise.all([this.getAccounts(),this.getProvider()]);return x.length?await this.isChainsStale()&&g.session?(await g.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:x,chainId:g}){var C,N,P;const y=await this.getProvider();if(!y)throw new tp;const v=f.chains.find(T=>T.id===g);if(!v)throw new pp(new H3);try{await Promise.all([new Promise(M=>{const F=({chainId:$})=>{$===g&&(f.emitter.off("change",F),M())};f.emitter.on("change",F)}),y.request({method:"wallet_switchEthereumChain",params:[{chainId:zs(g)}]})]);const T=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...T,g]),v}catch(T){const M=T;if(/(user rejected)/i.test(M.message))throw new So(M);try{let F;x!=null&&x.blockExplorerUrls?F=x.blockExplorerUrls:F=(C=v.blockExplorers)!=null&&C.default.url?[(N=v.blockExplorers)==null?void 0:N.default.url]:[];let $;(P=x==null?void 0:x.rpcUrls)!=null&&P.length?$=x.rpcUrls:$=[...v.rpcUrls.default.http];const L={blockExplorerUrls:F,chainId:zs(g),chainName:(x==null?void 0:x.chainName)??v.name,iconUrls:x==null?void 0:x.iconUrls,nativeCurrency:(x==null?void 0:x.nativeCurrency)??v.nativeCurrency,rpcUrls:$};await y.request({method:"wallet_addEthereumChain",params:[L]});const z=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...z,g]),v}catch(F){throw new So(F)}}},onAccountsChanged(x){x.length===0?this.onDisconnect():f.emitter.emit("change",{accounts:x.map(g=>Tc(g))})},onChainChanged(x){const g=Number(x);f.emitter.emit("change",{chainId:g})},async onConnect(x){const g=Number(x.chainId),y=await this.getAccounts();f.emitter.emit("connect",{accounts:y,chainId:g})},async onDisconnect(x){this.setRequestedChainsIds([]),f.emitter.emit("disconnect");const g=await this.getProvider();a&&(g.removeListener("accountsChanged",a),a=void 0),o&&(g.removeListener("chainChanged",o),o=void 0),d&&(g.removeListener("disconnect",d),d=void 0),u&&(g.removeListener("session_delete",u),u=void 0),l||(l=this.onConnect.bind(this),g.on("connect",l))},onDisplayUri(x){f.emitter.emit("message",{type:"display_uri",data:x})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var g,y,v;return n?((v=(y=(g=n.session)==null?void 0:g.namespaces[s])==null?void 0:y.accounts)==null?void 0:v.map(C=>Number.parseInt(C.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var x;return await((x=f.storage)==null?void 0:x.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!e)return!1;const x=f.chains.map(v=>v.id),g=this.getNamespaceChainsIds();if(g.length&&!g.some(v=>x.includes(v)))return!1;const y=await this.getRequestedChainsIds();return!x.every(v=>y.includes(v))},async setRequestedChainsIds(x){var g;await((g=f.storage)==null?void 0:g.setItem(this.requestedChainsStorageKey,x))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var PL={},pRt=768;iOt({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}});var mRt=QLe({conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0}}),vne=dOt({conditions:{defaultCondition:"base",conditionNames:["base","hover","active"],responsiveArray:void 0},styles:{background:{values:{accentColor:{conditions:{base:"ju367v9i",hover:"ju367v9j",active:"ju367v9k"},defaultClass:"ju367v9i"},accentColorForeground:{conditions:{base:"ju367v9l",hover:"ju367v9m",active:"ju367v9n"},defaultClass:"ju367v9l"},actionButtonBorder:{conditions:{base:"ju367v9o",hover:"ju367v9p",active:"ju367v9q"},defaultClass:"ju367v9o"},actionButtonBorderMobile:{conditions:{base:"ju367v9r",hover:"ju367v9s",active:"ju367v9t"},defaultClass:"ju367v9r"},actionButtonSecondaryBackground:{conditions:{base:"ju367v9u",hover:"ju367v9v",active:"ju367v9w"},defaultClass:"ju367v9u"},closeButton:{conditions:{base:"ju367v9x",hover:"ju367v9y",active:"ju367v9z"},defaultClass:"ju367v9x"},closeButtonBackground:{conditions:{base:"ju367va0",hover:"ju367va1",active:"ju367va2"},defaultClass:"ju367va0"},connectButtonBackground:{conditions:{base:"ju367va3",hover:"ju367va4",active:"ju367va5"},defaultClass:"ju367va3"},connectButtonBackgroundError:{conditions:{base:"ju367va6",hover:"ju367va7",active:"ju367va8"},defaultClass:"ju367va6"},connectButtonInnerBackground:{conditions:{base:"ju367va9",hover:"ju367vaa",active:"ju367vab"},defaultClass:"ju367va9"},connectButtonText:{conditions:{base:"ju367vac",hover:"ju367vad",active:"ju367vae"},defaultClass:"ju367vac"},connectButtonTextError:{conditions:{base:"ju367vaf",hover:"ju367vag",active:"ju367vah"},defaultClass:"ju367vaf"},connectionIndicator:{conditions:{base:"ju367vai",hover:"ju367vaj",active:"ju367vak"},defaultClass:"ju367vai"},downloadBottomCardBackground:{conditions:{base:"ju367val",hover:"ju367vam",active:"ju367van"},defaultClass:"ju367val"},downloadTopCardBackground:{conditions:{base:"ju367vao",hover:"ju367vap",active:"ju367vaq"},defaultClass:"ju367vao"},error:{conditions:{base:"ju367var",hover:"ju367vas",active:"ju367vat"},defaultClass:"ju367var"},generalBorder:{conditions:{base:"ju367vau",hover:"ju367vav",active:"ju367vaw"},defaultClass:"ju367vau"},generalBorderDim:{conditions:{base:"ju367vax",hover:"ju367vay",active:"ju367vaz"},defaultClass:"ju367vax"},menuItemBackground:{conditions:{base:"ju367vb0",hover:"ju367vb1",active:"ju367vb2"},defaultClass:"ju367vb0"},modalBackdrop:{conditions:{base:"ju367vb3",hover:"ju367vb4",active:"ju367vb5"},defaultClass:"ju367vb3"},modalBackground:{conditions:{base:"ju367vb6",hover:"ju367vb7",active:"ju367vb8"},defaultClass:"ju367vb6"},modalBorder:{conditions:{base:"ju367vb9",hover:"ju367vba",active:"ju367vbb"},defaultClass:"ju367vb9"},modalText:{conditions:{base:"ju367vbc",hover:"ju367vbd",active:"ju367vbe"},defaultClass:"ju367vbc"},modalTextDim:{conditions:{base:"ju367vbf",hover:"ju367vbg",active:"ju367vbh"},defaultClass:"ju367vbf"},modalTextSecondary:{conditions:{base:"ju367vbi",hover:"ju367vbj",active:"ju367vbk"},defaultClass:"ju367vbi"},profileAction:{conditions:{base:"ju367vbl",hover:"ju367vbm",active:"ju367vbn"},defaultClass:"ju367vbl"},profileActionHover:{conditions:{base:"ju367vbo",hover:"ju367vbp",active:"ju367vbq"},defaultClass:"ju367vbo"},profileForeground:{conditions:{base:"ju367vbr",hover:"ju367vbs",active:"ju367vbt"},defaultClass:"ju367vbr"},selectedOptionBorder:{conditions:{base:"ju367vbu",hover:"ju367vbv",active:"ju367vbw"},defaultClass:"ju367vbu"},standby:{conditions:{base:"ju367vbx",hover:"ju367vby",active:"ju367vbz"},defaultClass:"ju367vbx"}}},borderColor:{values:{accentColor:{conditions:{base:"ju367vc0",hover:"ju367vc1",active:"ju367vc2"},defaultClass:"ju367vc0"},accentColorForeground:{conditions:{base:"ju367vc3",hover:"ju367vc4",active:"ju367vc5"},defaultClass:"ju367vc3"},actionButtonBorder:{conditions:{base:"ju367vc6",hover:"ju367vc7",active:"ju367vc8"},defaultClass:"ju367vc6"},actionButtonBorderMobile:{conditions:{base:"ju367vc9",hover:"ju367vca",active:"ju367vcb"},defaultClass:"ju367vc9"},actionButtonSecondaryBackground:{conditions:{base:"ju367vcc",hover:"ju367vcd",active:"ju367vce"},defaultClass:"ju367vcc"},closeButton:{conditions:{base:"ju367vcf",hover:"ju367vcg",active:"ju367vch"},defaultClass:"ju367vcf"},closeButtonBackground:{conditions:{base:"ju367vci",hover:"ju367vcj",active:"ju367vck"},defaultClass:"ju367vci"},connectButtonBackground:{conditions:{base:"ju367vcl",hover:"ju367vcm",active:"ju367vcn"},defaultClass:"ju367vcl"},connectButtonBackgroundError:{conditions:{base:"ju367vco",hover:"ju367vcp",active:"ju367vcq"},defaultClass:"ju367vco"},connectButtonInnerBackground:{conditions:{base:"ju367vcr",hover:"ju367vcs",active:"ju367vct"},defaultClass:"ju367vcr"},connectButtonText:{conditions:{base:"ju367vcu",hover:"ju367vcv",active:"ju367vcw"},defaultClass:"ju367vcu"},connectButtonTextError:{conditions:{base:"ju367vcx",hover:"ju367vcy",active:"ju367vcz"},defaultClass:"ju367vcx"},connectionIndicator:{conditions:{base:"ju367vd0",hover:"ju367vd1",active:"ju367vd2"},defaultClass:"ju367vd0"},downloadBottomCardBackground:{conditions:{base:"ju367vd3",hover:"ju367vd4",active:"ju367vd5"},defaultClass:"ju367vd3"},downloadTopCardBackground:{conditions:{base:"ju367vd6",hover:"ju367vd7",active:"ju367vd8"},defaultClass:"ju367vd6"},error:{conditions:{base:"ju367vd9",hover:"ju367vda",active:"ju367vdb"},defaultClass:"ju367vd9"},generalBorder:{conditions:{base:"ju367vdc",hover:"ju367vdd",active:"ju367vde"},defaultClass:"ju367vdc"},generalBorderDim:{conditions:{base:"ju367vdf",hover:"ju367vdg",active:"ju367vdh"},defaultClass:"ju367vdf"},menuItemBackground:{conditions:{base:"ju367vdi",hover:"ju367vdj",active:"ju367vdk"},defaultClass:"ju367vdi"},modalBackdrop:{conditions:{base:"ju367vdl",hover:"ju367vdm",active:"ju367vdn"},defaultClass:"ju367vdl"},modalBackground:{conditions:{base:"ju367vdo",hover:"ju367vdp",active:"ju367vdq"},defaultClass:"ju367vdo"},modalBorder:{conditions:{base:"ju367vdr",hover:"ju367vds",active:"ju367vdt"},defaultClass:"ju367vdr"},modalText:{conditions:{base:"ju367vdu",hover:"ju367vdv",active:"ju367vdw"},defaultClass:"ju367vdu"},modalTextDim:{conditions:{base:"ju367vdx",hover:"ju367vdy",active:"ju367vdz"},defaultClass:"ju367vdx"},modalTextSecondary:{conditions:{base:"ju367ve0",hover:"ju367ve1",active:"ju367ve2"},defaultClass:"ju367ve0"},profileAction:{conditions:{base:"ju367ve3",hover:"ju367ve4",active:"ju367ve5"},defaultClass:"ju367ve3"},profileActionHover:{conditions:{base:"ju367ve6",hover:"ju367ve7",active:"ju367ve8"},defaultClass:"ju367ve6"},profileForeground:{conditions:{base:"ju367ve9",hover:"ju367vea",active:"ju367veb"},defaultClass:"ju367ve9"},selectedOptionBorder:{conditions:{base:"ju367vec",hover:"ju367ved",active:"ju367vee"},defaultClass:"ju367vec"},standby:{conditions:{base:"ju367vef",hover:"ju367veg",active:"ju367veh"},defaultClass:"ju367vef"}}},boxShadow:{values:{connectButton:{conditions:{base:"ju367vei",hover:"ju367vej",active:"ju367vek"},defaultClass:"ju367vei"},dialog:{conditions:{base:"ju367vel",hover:"ju367vem",active:"ju367ven"},defaultClass:"ju367vel"},profileDetailsAction:{conditions:{base:"ju367veo",hover:"ju367vep",active:"ju367veq"},defaultClass:"ju367veo"},selectedOption:{conditions:{base:"ju367ver",hover:"ju367ves",active:"ju367vet"},defaultClass:"ju367ver"},selectedWallet:{conditions:{base:"ju367veu",hover:"ju367vev",active:"ju367vew"},defaultClass:"ju367veu"},walletLogo:{conditions:{base:"ju367vex",hover:"ju367vey",active:"ju367vez"},defaultClass:"ju367vex"}}},color:{values:{accentColor:{conditions:{base:"ju367vf0",hover:"ju367vf1",active:"ju367vf2"},defaultClass:"ju367vf0"},accentColorForeground:{conditions:{base:"ju367vf3",hover:"ju367vf4",active:"ju367vf5"},defaultClass:"ju367vf3"},actionButtonBorder:{conditions:{base:"ju367vf6",hover:"ju367vf7",active:"ju367vf8"},defaultClass:"ju367vf6"},actionButtonBorderMobile:{conditions:{base:"ju367vf9",hover:"ju367vfa",active:"ju367vfb"},defaultClass:"ju367vf9"},actionButtonSecondaryBackground:{conditions:{base:"ju367vfc",hover:"ju367vfd",active:"ju367vfe"},defaultClass:"ju367vfc"},closeButton:{conditions:{base:"ju367vff",hover:"ju367vfg",active:"ju367vfh"},defaultClass:"ju367vff"},closeButtonBackground:{conditions:{base:"ju367vfi",hover:"ju367vfj",active:"ju367vfk"},defaultClass:"ju367vfi"},connectButtonBackground:{conditions:{base:"ju367vfl",hover:"ju367vfm",active:"ju367vfn"},defaultClass:"ju367vfl"},connectButtonBackgroundError:{conditions:{base:"ju367vfo",hover:"ju367vfp",active:"ju367vfq"},defaultClass:"ju367vfo"},connectButtonInnerBackground:{conditions:{base:"ju367vfr",hover:"ju367vfs",active:"ju367vft"},defaultClass:"ju367vfr"},connectButtonText:{conditions:{base:"ju367vfu",hover:"ju367vfv",active:"ju367vfw"},defaultClass:"ju367vfu"},connectButtonTextError:{conditions:{base:"ju367vfx",hover:"ju367vfy",active:"ju367vfz"},defaultClass:"ju367vfx"},connectionIndicator:{conditions:{base:"ju367vg0",hover:"ju367vg1",active:"ju367vg2"},defaultClass:"ju367vg0"},downloadBottomCardBackground:{conditions:{base:"ju367vg3",hover:"ju367vg4",active:"ju367vg5"},defaultClass:"ju367vg3"},downloadTopCardBackground:{conditions:{base:"ju367vg6",hover:"ju367vg7",active:"ju367vg8"},defaultClass:"ju367vg6"},error:{conditions:{base:"ju367vg9",hover:"ju367vga",active:"ju367vgb"},defaultClass:"ju367vg9"},generalBorder:{conditions:{base:"ju367vgc",hover:"ju367vgd",active:"ju367vge"},defaultClass:"ju367vgc"},generalBorderDim:{conditions:{base:"ju367vgf",hover:"ju367vgg",active:"ju367vgh"},defaultClass:"ju367vgf"},menuItemBackground:{conditions:{base:"ju367vgi",hover:"ju367vgj",active:"ju367vgk"},defaultClass:"ju367vgi"},modalBackdrop:{conditions:{base:"ju367vgl",hover:"ju367vgm",active:"ju367vgn"},defaultClass:"ju367vgl"},modalBackground:{conditions:{base:"ju367vgo",hover:"ju367vgp",active:"ju367vgq"},defaultClass:"ju367vgo"},modalBorder:{conditions:{base:"ju367vgr",hover:"ju367vgs",active:"ju367vgt"},defaultClass:"ju367vgr"},modalText:{conditions:{base:"ju367vgu",hover:"ju367vgv",active:"ju367vgw"},defaultClass:"ju367vgu"},modalTextDim:{conditions:{base:"ju367vgx",hover:"ju367vgy",active:"ju367vgz"},defaultClass:"ju367vgx"},modalTextSecondary:{conditions:{base:"ju367vh0",hover:"ju367vh1",active:"ju367vh2"},defaultClass:"ju367vh0"},profileAction:{conditions:{base:"ju367vh3",hover:"ju367vh4",active:"ju367vh5"},defaultClass:"ju367vh3"},profileActionHover:{conditions:{base:"ju367vh6",hover:"ju367vh7",active:"ju367vh8"},defaultClass:"ju367vh6"},profileForeground:{conditions:{base:"ju367vh9",hover:"ju367vha",active:"ju367vhb"},defaultClass:"ju367vh9"},selectedOptionBorder:{conditions:{base:"ju367vhc",hover:"ju367vhd",active:"ju367vhe"},defaultClass:"ju367vhc"},standby:{conditions:{base:"ju367vhf",hover:"ju367vhg",active:"ju367vhh"},defaultClass:"ju367vhf"}}}}},{conditions:{defaultCondition:"smallScreen",conditionNames:["smallScreen","largeScreen"],responsiveArray:void 0},styles:{alignItems:{values:{"flex-start":{conditions:{smallScreen:"ju367v0",largeScreen:"ju367v1"},defaultClass:"ju367v0"},"flex-end":{conditions:{smallScreen:"ju367v2",largeScreen:"ju367v3"},defaultClass:"ju367v2"},center:{conditions:{smallScreen:"ju367v4",largeScreen:"ju367v5"},defaultClass:"ju367v4"}}},display:{values:{none:{conditions:{smallScreen:"ju367v6",largeScreen:"ju367v7"},defaultClass:"ju367v6"},block:{conditions:{smallScreen:"ju367v8",largeScreen:"ju367v9"},defaultClass:"ju367v8"},flex:{conditions:{smallScreen:"ju367va",largeScreen:"ju367vb"},defaultClass:"ju367va"},inline:{conditions:{smallScreen:"ju367vc",largeScreen:"ju367vd"},defaultClass:"ju367vc"}}}}},{conditions:void 0,styles:{margin:{mappings:["marginTop","marginBottom","marginLeft","marginRight"]},marginX:{mappings:["marginLeft","marginRight"]},marginY:{mappings:["marginTop","marginBottom"]},padding:{mappings:["paddingTop","paddingBottom","paddingLeft","paddingRight"]},paddingX:{mappings:["paddingLeft","paddingRight"]},paddingY:{mappings:["paddingTop","paddingBottom"]},alignSelf:{values:{"flex-start":{defaultClass:"ju367ve"},"flex-end":{defaultClass:"ju367vf"},center:{defaultClass:"ju367vg"}}},backgroundSize:{values:{cover:{defaultClass:"ju367vh"}}},borderRadius:{values:{1:{defaultClass:"ju367vi"},6:{defaultClass:"ju367vj"},10:{defaultClass:"ju367vk"},13:{defaultClass:"ju367vl"},actionButton:{defaultClass:"ju367vm"},connectButton:{defaultClass:"ju367vn"},menuButton:{defaultClass:"ju367vo"},modal:{defaultClass:"ju367vp"},modalMobile:{defaultClass:"ju367vq"},"25%":{defaultClass:"ju367vr"},full:{defaultClass:"ju367vs"}}},borderStyle:{values:{solid:{defaultClass:"ju367vt"}}},borderWidth:{values:{0:{defaultClass:"ju367vu"},1:{defaultClass:"ju367vv"},2:{defaultClass:"ju367vw"},4:{defaultClass:"ju367vx"}}},cursor:{values:{pointer:{defaultClass:"ju367vy"},none:{defaultClass:"ju367vz"}}},pointerEvents:{values:{none:{defaultClass:"ju367v10"},all:{defaultClass:"ju367v11"}}},minHeight:{values:{8:{defaultClass:"ju367v12"},44:{defaultClass:"ju367v13"}}},flexDirection:{values:{row:{defaultClass:"ju367v14"},column:{defaultClass:"ju367v15"}}},fontFamily:{values:{body:{defaultClass:"ju367v16"}}},fontSize:{values:{12:{defaultClass:"ju367v17"},13:{defaultClass:"ju367v18"},14:{defaultClass:"ju367v19"},16:{defaultClass:"ju367v1a"},18:{defaultClass:"ju367v1b"},20:{defaultClass:"ju367v1c"},23:{defaultClass:"ju367v1d"}}},fontWeight:{values:{regular:{defaultClass:"ju367v1e"},medium:{defaultClass:"ju367v1f"},semibold:{defaultClass:"ju367v1g"},bold:{defaultClass:"ju367v1h"},heavy:{defaultClass:"ju367v1i"}}},gap:{values:{0:{defaultClass:"ju367v1j"},1:{defaultClass:"ju367v1k"},2:{defaultClass:"ju367v1l"},3:{defaultClass:"ju367v1m"},4:{defaultClass:"ju367v1n"},5:{defaultClass:"ju367v1o"},6:{defaultClass:"ju367v1p"},8:{defaultClass:"ju367v1q"},10:{defaultClass:"ju367v1r"},12:{defaultClass:"ju367v1s"},14:{defaultClass:"ju367v1t"},16:{defaultClass:"ju367v1u"},18:{defaultClass:"ju367v1v"},20:{defaultClass:"ju367v1w"},24:{defaultClass:"ju367v1x"},28:{defaultClass:"ju367v1y"},32:{defaultClass:"ju367v1z"},36:{defaultClass:"ju367v20"},44:{defaultClass:"ju367v21"},64:{defaultClass:"ju367v22"},"-1":{defaultClass:"ju367v23"}}},height:{values:{1:{defaultClass:"ju367v24"},2:{defaultClass:"ju367v25"},4:{defaultClass:"ju367v26"},8:{defaultClass:"ju367v27"},12:{defaultClass:"ju367v28"},20:{defaultClass:"ju367v29"},24:{defaultClass:"ju367v2a"},28:{defaultClass:"ju367v2b"},30:{defaultClass:"ju367v2c"},32:{defaultClass:"ju367v2d"},34:{defaultClass:"ju367v2e"},36:{defaultClass:"ju367v2f"},40:{defaultClass:"ju367v2g"},44:{defaultClass:"ju367v2h"},48:{defaultClass:"ju367v2i"},54:{defaultClass:"ju367v2j"},60:{defaultClass:"ju367v2k"},200:{defaultClass:"ju367v2l"},full:{defaultClass:"ju367v2m"},max:{defaultClass:"ju367v2n"}}},justifyContent:{values:{"flex-start":{defaultClass:"ju367v2o"},"flex-end":{defaultClass:"ju367v2p"},center:{defaultClass:"ju367v2q"},"space-between":{defaultClass:"ju367v2r"},"space-around":{defaultClass:"ju367v2s"}}},textAlign:{values:{left:{defaultClass:"ju367v2t"},center:{defaultClass:"ju367v2u"},inherit:{defaultClass:"ju367v2v"}}},marginBottom:{values:{0:{defaultClass:"ju367v2w"},1:{defaultClass:"ju367v2x"},2:{defaultClass:"ju367v2y"},3:{defaultClass:"ju367v2z"},4:{defaultClass:"ju367v30"},5:{defaultClass:"ju367v31"},6:{defaultClass:"ju367v32"},8:{defaultClass:"ju367v33"},10:{defaultClass:"ju367v34"},12:{defaultClass:"ju367v35"},14:{defaultClass:"ju367v36"},16:{defaultClass:"ju367v37"},18:{defaultClass:"ju367v38"},20:{defaultClass:"ju367v39"},24:{defaultClass:"ju367v3a"},28:{defaultClass:"ju367v3b"},32:{defaultClass:"ju367v3c"},36:{defaultClass:"ju367v3d"},44:{defaultClass:"ju367v3e"},64:{defaultClass:"ju367v3f"},"-1":{defaultClass:"ju367v3g"}}},marginLeft:{values:{0:{defaultClass:"ju367v3h"},1:{defaultClass:"ju367v3i"},2:{defaultClass:"ju367v3j"},3:{defaultClass:"ju367v3k"},4:{defaultClass:"ju367v3l"},5:{defaultClass:"ju367v3m"},6:{defaultClass:"ju367v3n"},8:{defaultClass:"ju367v3o"},10:{defaultClass:"ju367v3p"},12:{defaultClass:"ju367v3q"},14:{defaultClass:"ju367v3r"},16:{defaultClass:"ju367v3s"},18:{defaultClass:"ju367v3t"},20:{defaultClass:"ju367v3u"},24:{defaultClass:"ju367v3v"},28:{defaultClass:"ju367v3w"},32:{defaultClass:"ju367v3x"},36:{defaultClass:"ju367v3y"},44:{defaultClass:"ju367v3z"},64:{defaultClass:"ju367v40"},"-1":{defaultClass:"ju367v41"}}},marginRight:{values:{0:{defaultClass:"ju367v42"},1:{defaultClass:"ju367v43"},2:{defaultClass:"ju367v44"},3:{defaultClass:"ju367v45"},4:{defaultClass:"ju367v46"},5:{defaultClass:"ju367v47"},6:{defaultClass:"ju367v48"},8:{defaultClass:"ju367v49"},10:{defaultClass:"ju367v4a"},12:{defaultClass:"ju367v4b"},14:{defaultClass:"ju367v4c"},16:{defaultClass:"ju367v4d"},18:{defaultClass:"ju367v4e"},20:{defaultClass:"ju367v4f"},24:{defaultClass:"ju367v4g"},28:{defaultClass:"ju367v4h"},32:{defaultClass:"ju367v4i"},36:{defaultClass:"ju367v4j"},44:{defaultClass:"ju367v4k"},64:{defaultClass:"ju367v4l"},"-1":{defaultClass:"ju367v4m"}}},marginTop:{values:{0:{defaultClass:"ju367v4n"},1:{defaultClass:"ju367v4o"},2:{defaultClass:"ju367v4p"},3:{defaultClass:"ju367v4q"},4:{defaultClass:"ju367v4r"},5:{defaultClass:"ju367v4s"},6:{defaultClass:"ju367v4t"},8:{defaultClass:"ju367v4u"},10:{defaultClass:"ju367v4v"},12:{defaultClass:"ju367v4w"},14:{defaultClass:"ju367v4x"},16:{defaultClass:"ju367v4y"},18:{defaultClass:"ju367v4z"},20:{defaultClass:"ju367v50"},24:{defaultClass:"ju367v51"},28:{defaultClass:"ju367v52"},32:{defaultClass:"ju367v53"},36:{defaultClass:"ju367v54"},44:{defaultClass:"ju367v55"},64:{defaultClass:"ju367v56"},"-1":{defaultClass:"ju367v57"}}},maxWidth:{values:{1:{defaultClass:"ju367v58"},2:{defaultClass:"ju367v59"},4:{defaultClass:"ju367v5a"},8:{defaultClass:"ju367v5b"},12:{defaultClass:"ju367v5c"},20:{defaultClass:"ju367v5d"},24:{defaultClass:"ju367v5e"},28:{defaultClass:"ju367v5f"},30:{defaultClass:"ju367v5g"},32:{defaultClass:"ju367v5h"},34:{defaultClass:"ju367v5i"},36:{defaultClass:"ju367v5j"},40:{defaultClass:"ju367v5k"},44:{defaultClass:"ju367v5l"},48:{defaultClass:"ju367v5m"},54:{defaultClass:"ju367v5n"},60:{defaultClass:"ju367v5o"},200:{defaultClass:"ju367v5p"},full:{defaultClass:"ju367v5q"},max:{defaultClass:"ju367v5r"}}},minWidth:{values:{1:{defaultClass:"ju367v5s"},2:{defaultClass:"ju367v5t"},4:{defaultClass:"ju367v5u"},8:{defaultClass:"ju367v5v"},12:{defaultClass:"ju367v5w"},20:{defaultClass:"ju367v5x"},24:{defaultClass:"ju367v5y"},28:{defaultClass:"ju367v5z"},30:{defaultClass:"ju367v60"},32:{defaultClass:"ju367v61"},34:{defaultClass:"ju367v62"},36:{defaultClass:"ju367v63"},40:{defaultClass:"ju367v64"},44:{defaultClass:"ju367v65"},48:{defaultClass:"ju367v66"},54:{defaultClass:"ju367v67"},60:{defaultClass:"ju367v68"},200:{defaultClass:"ju367v69"},full:{defaultClass:"ju367v6a"},max:{defaultClass:"ju367v6b"}}},overflow:{values:{hidden:{defaultClass:"ju367v6c"}}},paddingBottom:{values:{0:{defaultClass:"ju367v6d"},1:{defaultClass:"ju367v6e"},2:{defaultClass:"ju367v6f"},3:{defaultClass:"ju367v6g"},4:{defaultClass:"ju367v6h"},5:{defaultClass:"ju367v6i"},6:{defaultClass:"ju367v6j"},8:{defaultClass:"ju367v6k"},10:{defaultClass:"ju367v6l"},12:{defaultClass:"ju367v6m"},14:{defaultClass:"ju367v6n"},16:{defaultClass:"ju367v6o"},18:{defaultClass:"ju367v6p"},20:{defaultClass:"ju367v6q"},24:{defaultClass:"ju367v6r"},28:{defaultClass:"ju367v6s"},32:{defaultClass:"ju367v6t"},36:{defaultClass:"ju367v6u"},44:{defaultClass:"ju367v6v"},64:{defaultClass:"ju367v6w"},"-1":{defaultClass:"ju367v6x"}}},paddingLeft:{values:{0:{defaultClass:"ju367v6y"},1:{defaultClass:"ju367v6z"},2:{defaultClass:"ju367v70"},3:{defaultClass:"ju367v71"},4:{defaultClass:"ju367v72"},5:{defaultClass:"ju367v73"},6:{defaultClass:"ju367v74"},8:{defaultClass:"ju367v75"},10:{defaultClass:"ju367v76"},12:{defaultClass:"ju367v77"},14:{defaultClass:"ju367v78"},16:{defaultClass:"ju367v79"},18:{defaultClass:"ju367v7a"},20:{defaultClass:"ju367v7b"},24:{defaultClass:"ju367v7c"},28:{defaultClass:"ju367v7d"},32:{defaultClass:"ju367v7e"},36:{defaultClass:"ju367v7f"},44:{defaultClass:"ju367v7g"},64:{defaultClass:"ju367v7h"},"-1":{defaultClass:"ju367v7i"}}},paddingRight:{values:{0:{defaultClass:"ju367v7j"},1:{defaultClass:"ju367v7k"},2:{defaultClass:"ju367v7l"},3:{defaultClass:"ju367v7m"},4:{defaultClass:"ju367v7n"},5:{defaultClass:"ju367v7o"},6:{defaultClass:"ju367v7p"},8:{defaultClass:"ju367v7q"},10:{defaultClass:"ju367v7r"},12:{defaultClass:"ju367v7s"},14:{defaultClass:"ju367v7t"},16:{defaultClass:"ju367v7u"},18:{defaultClass:"ju367v7v"},20:{defaultClass:"ju367v7w"},24:{defaultClass:"ju367v7x"},28:{defaultClass:"ju367v7y"},32:{defaultClass:"ju367v7z"},36:{defaultClass:"ju367v80"},44:{defaultClass:"ju367v81"},64:{defaultClass:"ju367v82"},"-1":{defaultClass:"ju367v83"}}},paddingTop:{values:{0:{defaultClass:"ju367v84"},1:{defaultClass:"ju367v85"},2:{defaultClass:"ju367v86"},3:{defaultClass:"ju367v87"},4:{defaultClass:"ju367v88"},5:{defaultClass:"ju367v89"},6:{defaultClass:"ju367v8a"},8:{defaultClass:"ju367v8b"},10:{defaultClass:"ju367v8c"},12:{defaultClass:"ju367v8d"},14:{defaultClass:"ju367v8e"},16:{defaultClass:"ju367v8f"},18:{defaultClass:"ju367v8g"},20:{defaultClass:"ju367v8h"},24:{defaultClass:"ju367v8i"},28:{defaultClass:"ju367v8j"},32:{defaultClass:"ju367v8k"},36:{defaultClass:"ju367v8l"},44:{defaultClass:"ju367v8m"},64:{defaultClass:"ju367v8n"},"-1":{defaultClass:"ju367v8o"}}},position:{values:{absolute:{defaultClass:"ju367v8p"},fixed:{defaultClass:"ju367v8q"},relative:{defaultClass:"ju367v8r"}}},WebkitUserSelect:{values:{none:{defaultClass:"ju367v8s"}}},right:{values:{0:{defaultClass:"ju367v8t"}}},transition:{values:{default:{defaultClass:"ju367v8u"},transform:{defaultClass:"ju367v8v"}}},userSelect:{values:{none:{defaultClass:"ju367v8w"}}},width:{values:{1:{defaultClass:"ju367v8x"},2:{defaultClass:"ju367v8y"},4:{defaultClass:"ju367v8z"},8:{defaultClass:"ju367v90"},12:{defaultClass:"ju367v91"},20:{defaultClass:"ju367v92"},24:{defaultClass:"ju367v93"},28:{defaultClass:"ju367v94"},30:{defaultClass:"ju367v95"},32:{defaultClass:"ju367v96"},34:{defaultClass:"ju367v97"},36:{defaultClass:"ju367v98"},40:{defaultClass:"ju367v99"},44:{defaultClass:"ju367v9a"},48:{defaultClass:"ju367v9b"},54:{defaultClass:"ju367v9c"},60:{defaultClass:"ju367v9d"},200:{defaultClass:"ju367v9e"},full:{defaultClass:"ju367v9f"},max:{defaultClass:"ju367v9g"}}},backdropFilter:{values:{modalOverlay:{defaultClass:"ju367v9h"}}}}}),Aye={colors:{accentColor:"var(--rk-colors-accentColor)",accentColorForeground:"var(--rk-colors-accentColorForeground)",actionButtonBorder:"var(--rk-colors-actionButtonBorder)",actionButtonBorderMobile:"var(--rk-colors-actionButtonBorderMobile)",actionButtonSecondaryBackground:"var(--rk-colors-actionButtonSecondaryBackground)",closeButton:"var(--rk-colors-closeButton)",closeButtonBackground:"var(--rk-colors-closeButtonBackground)",connectButtonBackground:"var(--rk-colors-connectButtonBackground)",connectButtonBackgroundError:"var(--rk-colors-connectButtonBackgroundError)",connectButtonInnerBackground:"var(--rk-colors-connectButtonInnerBackground)",connectButtonText:"var(--rk-colors-connectButtonText)",connectButtonTextError:"var(--rk-colors-connectButtonTextError)",connectionIndicator:"var(--rk-colors-connectionIndicator)",downloadBottomCardBackground:"var(--rk-colors-downloadBottomCardBackground)",downloadTopCardBackground:"var(--rk-colors-downloadTopCardBackground)",error:"var(--rk-colors-error)",generalBorder:"var(--rk-colors-generalBorder)",generalBorderDim:"var(--rk-colors-generalBorderDim)",menuItemBackground:"var(--rk-colors-menuItemBackground)",modalBackdrop:"var(--rk-colors-modalBackdrop)",modalBackground:"var(--rk-colors-modalBackground)",modalBorder:"var(--rk-colors-modalBorder)",modalText:"var(--rk-colors-modalText)",modalTextDim:"var(--rk-colors-modalTextDim)",modalTextSecondary:"var(--rk-colors-modalTextSecondary)",profileAction:"var(--rk-colors-profileAction)",profileActionHover:"var(--rk-colors-profileActionHover)",profileForeground:"var(--rk-colors-profileForeground)",selectedOptionBorder:"var(--rk-colors-selectedOptionBorder)",standby:"var(--rk-colors-standby)"},fonts:{body:"var(--rk-fonts-body)"},radii:{actionButton:"var(--rk-radii-actionButton)",connectButton:"var(--rk-radii-connectButton)",menuButton:"var(--rk-radii-menuButton)",modal:"var(--rk-radii-modal)",modalMobile:"var(--rk-radii-modalMobile)"},shadows:{connectButton:"var(--rk-shadows-connectButton)",dialog:"var(--rk-shadows-dialog)",profileDetailsAction:"var(--rk-shadows-profileDetailsAction)",selectedOption:"var(--rk-shadows-selectedOption)",selectedWallet:"var(--rk-shadows-selectedWallet)",walletLogo:"var(--rk-shadows-walletLogo)"},blurs:{modalOverlay:"var(--rk-blurs-modalOverlay)"}},xRt={shrink:"_12cbo8i6",shrinkSm:"_12cbo8i7"},gRt="_12cbo8i3 ju367v8r",bRt={grow:"_12cbo8i4",growLg:"_12cbo8i5"};function uu({active:t,hover:e}){return[gRt,e&&bRt[e],xRt[t]]}var aBe=m.createContext(null);function yRt(){const{adapter:t}=m.useContext(aBe)??{};if(!t)throw new Error("No authentication adapter found");return t}function jU(){const t=m.useContext(aBe);return(t==null?void 0:t.status)??null}function oBe(){const t=jU(),{isConnected:e}=ns();return e?t&&(t==="loading"||t==="unauthenticated")?t:"connected":"disconnected"}function Fce(){return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}function vRt(){return typeof navigator<"u"&&/iPhone|iPod/.test(navigator.userAgent)}function wRt(){return typeof navigator<"u"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function L5(){return vRt()||wRt()}function fu(){return Fce()||L5()}var CRt="iekbcc0",SRt={a:"iekbcca",blockquote:"iekbcc2",button:"iekbcc9",input:"iekbcc8 iekbcc5 iekbcc4",mark:"iekbcc6",ol:"iekbcc1",q:"iekbcc2",select:"iekbcc7 iekbcc5 iekbcc4",table:"iekbcc3",textarea:"iekbcc5 iekbcc4",ul:"iekbcc1"},NRt=({reset:t,...e})=>{if(!t)return vne(e);const n=SRt[t],r=vne(e);return JLe(CRt,n,r)},Cn=Ne.forwardRef(({as:t="div",className:e,testId:n,...r},s)=>{const a={},o={};for(const c in r)vne.properties.has(c)?a[c]=r[c]:o[c]=r[c];const l=NRt({reset:typeof t=="string"?t:"div",...a});return Ne.createElement(t,{className:JLe(l,e),...o,"data-testid":n?`rk-${n.replace(/^rk-/,"")}`:void 0,ref:s})});Cn.displayName="Box";var lBe=new Map,oq=new Map;async function cBe(t){const e=oq.get(t);if(e)return e;const n=async()=>t().then(async s=>(lBe.set(t,s),s)),r=n().catch(s=>n().catch(a=>{oq.delete(t)}));return oq.set(t,r),r}async function px(...t){return await Promise.all(t.map(e=>typeof e=="function"?cBe(e):e))}function ARt(){const[,t]=m.useReducer(e=>e+1,0);return t}function Oce(t){const e=typeof t=="function"?lBe.get(t):void 0,n=ARt();return m.useEffect(()=>{typeof t=="function"&&!e&&cBe(t).then(n)},[t,e,n]),typeof t=="function"?e:t}function Rc({alt:t,background:e,borderColor:n,borderRadius:r,useAsImage:s,boxShadow:a,height:o,src:l,width:c,testId:u}){const d=L5(),f=Oce(l),x=f&&/^http/.test(f),[g,y]=m.useReducer(()=>!0,!1);return Ne.createElement(Cn,{"aria-label":t,borderRadius:r,boxShadow:a,height:typeof o=="string"?o:void 0,overflow:"hidden",position:"relative",role:"img",style:{background:e,height:typeof o=="number"?o:void 0,width:typeof c=="number"?c:void 0},width:typeof c=="string"?c:void 0,testId:u},Ne.createElement(Cn,{...x?{"aria-hidden":!0,as:"img",onLoad:y,src:f}:{"aria-hidden":!0,as:"img",src:f},height:"full",position:"absolute",...d?{WebkitUserSelect:"none"}:{},style:{WebkitTouchCallout:"none",transition:"opacity .15s linear",userSelect:"none",...!s&&x?{opacity:g?1:0}:{}},width:"full"}),n?Ne.createElement(Cn,{...typeof n=="object"&&"custom"in n?{style:{borderColor:n.custom}}:{borderColor:n},borderRadius:r,borderStyle:"solid",borderWidth:"1",height:"full",position:"relative",width:"full"}):null)}var jRt="_1luule42",ERt="_1luule43",_Rt=t=>m.useMemo(()=>`${t}_${Math.round(Math.random()*1e9)}`,[t]),R_=({height:t=21,width:e=21})=>{const n=_Rt("spinner");return Ne.createElement("svg",{className:jRt,fill:"none",height:t,viewBox:"0 0 21 21",width:e,xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Loading"),Ne.createElement("clipPath",{id:n},Ne.createElement("path",{d:"M10.5 3C6.35786 3 3 6.35786 3 10.5C3 14.6421 6.35786 18 10.5 18C11.3284 18 12 18.6716 12 19.5C12 20.3284 11.3284 21 10.5 21C4.70101 21 0 16.299 0 10.5C0 4.70101 4.70101 0 10.5 0C16.299 0 21 4.70101 21 10.5C21 11.3284 20.3284 12 19.5 12C18.6716 12 18 11.3284 18 10.5C18 6.35786 14.6421 3 10.5 3Z"})),Ne.createElement("foreignObject",{clipPath:`url(#${n})`,height:"21",width:"21",x:"0",y:"0"},Ne.createElement("div",{className:ERt})))},Ji=["#FC5C54","#FFD95A","#E95D72","#6A87C8","#5FD0F3","#75C06B","#FFDD86","#5FC6D4","#FF949A","#FF8024","#9BA1A4","#EC66FF","#FF8CBC","#FF9A23","#C5DADB","#A8CE63","#71ABFF","#FFE279","#B6B1B6","#FF6780","#A575FF","#4D82FF","#FFB35A"],jye=[{color:Ji[0],emoji:"🌶"},{color:Ji[1],emoji:"🤑"},{color:Ji[2],emoji:"🐙"},{color:Ji[3],emoji:"🫐"},{color:Ji[4],emoji:"🐳"},{color:Ji[0],emoji:"🤶"},{color:Ji[5],emoji:"🌲"},{color:Ji[6],emoji:"🌞"},{color:Ji[7],emoji:"🐒"},{color:Ji[8],emoji:"🐵"},{color:Ji[9],emoji:"🦊"},{color:Ji[10],emoji:"🐼"},{color:Ji[11],emoji:"🦄"},{color:Ji[12],emoji:"🐷"},{color:Ji[13],emoji:"🐧"},{color:Ji[8],emoji:"🦩"},{color:Ji[14],emoji:"👽"},{color:Ji[0],emoji:"🎈"},{color:Ji[8],emoji:"🍉"},{color:Ji[1],emoji:"🎉"},{color:Ji[15],emoji:"🐲"},{color:Ji[16],emoji:"🌎"},{color:Ji[17],emoji:"🍊"},{color:Ji[18],emoji:"🐭"},{color:Ji[19],emoji:"🍣"},{color:Ji[1],emoji:"🐥"},{color:Ji[20],emoji:"👾"},{color:Ji[15],emoji:"🥦"},{color:Ji[0],emoji:"👹"},{color:Ji[17],emoji:"🙀"},{color:Ji[4],emoji:"⛱"},{color:Ji[21],emoji:"⛵️"},{color:Ji[17],emoji:"🥳"},{color:Ji[8],emoji:"🤯"},{color:Ji[22],emoji:"🤠"}];function kRt(t){let e=0;if(t.length===0)return e;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e|=0}return e}function TRt(t){const n=Math.abs(kRt((typeof t=="string"?t:"").toLowerCase())%jye.length);return jye[n??0]}var PRt=({address:t,ensImage:e,size:n})=>{const[r,s]=m.useState(!1);m.useEffect(()=>{if(e){const l=new Image;l.src=e,l.onload=()=>s(!0)}},[e]);const{color:a,emoji:o}=m.useMemo(()=>TRt(t),[t]);return e?r?Ne.createElement(Cn,{backgroundSize:"cover",borderRadius:"full",position:"absolute",style:{backgroundImage:`url(${e})`,backgroundPosition:"center",height:n,width:n}}):Ne.createElement(Cn,{alignItems:"center",backgroundSize:"cover",borderRadius:"full",color:"modalText",display:"flex",justifyContent:"center",position:"absolute",style:{height:n,width:n}},Ne.createElement(R_,null)):Ne.createElement(Cn,{alignItems:"center",display:"flex",justifyContent:"center",overflow:"hidden",style:{...!e&&{backgroundColor:a},height:n,width:n}},o)},uBe=PRt,dBe=m.createContext(uBe);function IRt({address:t,imageUrl:e,loading:n,size:r}){const s=m.useContext(dBe);return Ne.createElement(Cn,{"aria-hidden":!0,borderRadius:"full",overflow:"hidden",position:"relative",style:{height:`${r}px`,width:`${r}px`},userSelect:"none"},Ne.createElement(Cn,{alignItems:"center",borderRadius:"full",display:"flex",justifyContent:"center",overflow:"hidden",position:"absolute",style:{fontSize:`${Math.round(r*.55)}px`,height:`${r}px`,transform:n?"scale(0.72)":void 0,transition:".25s ease",transitionDelay:n?void 0:".1s",width:`${r}px`,willChange:"transform"},userSelect:"none"},Ne.createElement(s,{address:t,ensImage:e,size:r})),n&&Ne.createElement(Cn,{color:"accentColor",display:"flex",height:"full",position:"absolute",width:"full"},Ne.createElement(R_,{height:"100%",width:"100%"})))}var Eye={defaultLocale:"en",locale:"en"},FRt=class{constructor(t){this.listeners=new Set,this.defaultLocale=Eye.defaultLocale,this.enableFallback=!1,this.locale=Eye.locale,this.cachedLocales=[],this.translations={};for(const[e,n]of Object.entries(t))this.cachedLocales=[...this.cachedLocales,e],this.translations={...this.translations,...this.flattenTranslation(n,e)}}missingMessage(t){return`[missing: "${this.locale}.${t}" translation]`}flattenTranslation(t,e){const n={},r=(s,a)=>{for(const o of Object.keys(s)){const l=`${a}.${o}`,c=s[o];typeof c=="object"&&c!==null?r(c,l):n[l]=c}};return r(t,e),n}translateWithReplacements(t,e={}){let n=t;for(const r in e){const s=e[r];n=n.replace(`%{${r}}`,s)}return n}t(t,e,n){const r=`${this.locale}.${t}`,s=this.translations[r];if(!s){if(this.enableFallback){const a=`${this.defaultLocale}.${t}`,o=this.translations[a];if(o)return this.translateWithReplacements(o,e)}return n!=null&&n.rawKeyIfTranslationMissing?t:this.missingMessage(t)}return this.translateWithReplacements(s,e)}isLocaleCached(t){return this.cachedLocales.includes(t)}updateLocale(t){this.locale=t,this.notifyListeners()}setTranslations(t,e){this.isLocaleCached(t)||(this.cachedLocales=[...this.cachedLocales,t],this.translations={...this.translations,...this.flattenTranslation(e,t)}),this.locale=t,this.notifyListeners()}notifyListeners(){for(const t of this.listeners)t()}onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}},ip=new FRt({en:JSON.parse(fne),"en-US":JSON.parse(fne)});ip.defaultLocale="en-US";ip.locale="en-US";ip.enableFallback=!0;var ORt=async t=>{switch(t){case"ar":case"ar-AR":return(await os(async()=>{const{default:e}=await import("./ar_AR-ZRPPM56D-d2WEfzQ_.js");return{default:e}},[])).default;case"de":case"de-DE":return(await os(async()=>{const{default:e}=await import("./de_DE-GYZFZXWH-CYZf24IR.js");return{default:e}},[])).default;case"en":case"en-US":return(await os(async()=>{const{default:e}=await Promise.resolve().then(()=>s8e);return{default:e}},void 0)).default;case"es":case"es-419":return(await os(async()=>{const{default:e}=await import("./es_419-OGVOQEFZ-D6BJPTeQ.js");return{default:e}},[])).default;case"fr":case"fr-FR":return(await os(async()=>{const{default:e}=await import("./fr_FR-Q5QBQBX2-lQoTmpTH.js");return{default:e}},[])).default;case"hi":case"hi-IN":return(await os(async()=>{const{default:e}=await import("./hi_IN-7I7LRHGW-CTQjmeYe.js");return{default:e}},[])).default;case"id":case"id-ID":return(await os(async()=>{const{default:e}=await import("./id_ID-ZMGZ2JFV-CgKQKAmU.js");return{default:e}},[])).default;case"ja":case"ja-JP":return(await os(async()=>{const{default:e}=await import("./ja_JP-NYBCHQTZ-CMaBl8Za.js");return{default:e}},[])).default;case"ko":case"ko-KR":return(await os(async()=>{const{default:e}=await import("./ko_KR-67WE736M-DHWhIjcm.js");return{default:e}},[])).default;case"ms":case"ms-MY":return(await os(async()=>{const{default:e}=await import("./ms_MY-65AJIBUS-BLlUrxe6.js");return{default:e}},[])).default;case"pt":case"pt-BR":return(await os(async()=>{const{default:e}=await import("./pt_BR-DMJANC65-DMs4DrlC.js");return{default:e}},[])).default;case"ru":case"ru-RU":return(await os(async()=>{const{default:e}=await import("./ru_RU-WER7RQ6A-DsJK55uv.js");return{default:e}},[])).default;case"th":case"th-TH":return(await os(async()=>{const{default:e}=await import("./th_TH-JOSHEZ6D-Cp87mIRZ.js");return{default:e}},[])).default;case"tr":case"tr-TR":return(await os(async()=>{const{default:e}=await import("./tr_TR-EAMG2YPO-C52_xfsf.js");return{default:e}},[])).default;case"ua":case"uk-UA":return(await os(async()=>{const{default:e}=await import("./uk_UA-GO2TRVWA-C1C1400t.js");return{default:e}},[])).default;case"vi":case"vi-VN":return(await os(async()=>{const{default:e}=await import("./vi_VN-5HLLSOJA-Dj7ferOp.js");return{default:e}},[])).default;case"zh":case"zh-CN":case"zh-Hans":return(await os(async()=>{const{default:e}=await import("./zh_CN-THPIFVWJ-Cbp71xMR.js");return{default:e}},[])).default;case"zh-HK":return(await os(async()=>{const{default:e}=await import("./zh_HK-R7XP4TGF-CyJtfKGw.js");return{default:e}},[])).default;case"zh-Hant":case"zh-TW":return(await os(async()=>{const{default:e}=await import("./zh_TW-F5LD752V-AHFgsYw-.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await Promise.resolve().then(()=>s8e);return{default:e}},void 0)).default}};async function _ye(t){if(ip.isLocaleCached(t)){ip.updateLocale(t);return}const n=await ORt(t);ip.setTranslations(t,JSON.parse(n))}var MRt=()=>{var t;if(typeof window<"u"&&typeof navigator<"u"){if((t=navigator.languages)!=null&&t.length)return navigator.languages[0];if(navigator.language)return navigator.language}},fc=m.createContext({i18n:ip}),RRt=({children:t,locale:e})=>{const[n,r]=m.useState(0),s=m.useMemo(()=>MRt(),[]);m.useEffect(()=>ip.onChange(()=>{r(l=>l+1)}),[]),m.useEffect(()=>{e&&e!==ip.locale?_ye(e):!e&&s&&s!==ip.locale&&_ye(s)},[e,s]);const a=m.useMemo(()=>({t:(l,c)=>ip.t(l,c),i18n:ip}),[n]);return Ne.createElement(fc.Provider,{value:a},t)};function fBe(t){return t!=null}var kye={iconBackground:"#7290CC",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./apechain-COEQ5RUI-0TDoXOYf.js");return{default:t}},[])).default},lq={iconBackground:"#96bedc",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./arbitrum-HW44W6XR-hPA5bMPt.js");return{default:t}},[])).default},Tye={iconBackground:"#e84141",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./avalanche-MXEFEDSW-DcC5FNt3.js");return{default:t}},[])).default},cq={iconBackground:"#0052ff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./base-Z4LFBE5D-DHfqMzJC.js");return{default:t}},[])).default},uq={iconBackground:"#814625",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./berachain-ZN3U5LDZ-CAvW_8ws.js");return{default:t}},[])).default},Pye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./blast-46UQLYYY-BV_Xlsq4.js");return{default:t}},[])).default},Iye={iconBackground:"#ebac0e",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./bsc-RVE67I5L-DVYEF0vl.js");return{default:t}},[])).default},Fye={iconBackground:"#FCFF52",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./celo-E6XU57FO-C5IguUgF.js");return{default:t}},[])).default},Oye={iconBackground:"#002D74",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./cronos-ROYR77VZ-Prn3LRPZ.js");return{default:t}},[])).default},LRt={iconBackground:"#A36EFD",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./degen-7ROC3GCY-9HqAkHtZ.js");return{default:t}},[])).default},Eb={iconBackground:"#484c50",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ethereum-RFBAMUVK-WsW8NXqo.js");return{default:t}},[])).default},Mye={iconBackground:"transparent",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./flow-NBCRNYVF-D2XasjKk.js");return{default:t}},[])).default},DRt={iconBackground:"#04795c",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./gnosis-Y56LN66M-D4_J-ZQH.js");return{default:t}},[])).default},Rye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./gravity-LMEBVSFN-DLxWpxhy.js");return{default:t}},[])).default},BRt={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./hardhat-NEEC6JX7-DzuWQYyS.js");return{default:t}},[])).default},$Rt={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./hyperevm-J6CONVCX-C6oeYIAP.js");return{default:t}},[])).default},Lye={iconBackground:"#7132F5",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ink-4U4ZVNAB-AlM1MLfQ.js");return{default:t}},[])).default},Dye={iconBackground:"transparent",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./kaia-A33DVQBT-Fgclbhio.js");return{default:t}},[])).default},dq={iconBackground:"#ffffff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./linea-IALBSJQC-Cmyd7vgA.js");return{default:t}},[])).default},fq={iconBackground:"#ffffff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./manta-5V6W5D7G-BnjsGzeJ.js");return{default:t}},[])).default},Bye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./mantle-KBL3OIYT-DIpe0poV.js");return{default:t}},[])).default},sF={iconBackground:"#ff5a57",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./optimism-YWJ3IQHA-DYER-OR5.js");return{default:t}},[])).default},hq={iconBackground:"#9f71ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./polygon-WWEUOMKW-CNBYSB1T.js");return{default:t}},[])).default},URt={iconBackground:"#1273EA",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./ronin-PNHX5V6H-BS-WPXjQ.js");return{default:t}},[])).default},zRt={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./sanko-RHQYXGM5-OX010CbN.js");return{default:t}},[])).default},$ye={iconBackground:"#FFEEDA",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./scroll-MCKFTBRS-C2gqZSab.js");return{default:t}},[])).default},Uye={iconBackground:"#F50DB4",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./unichain-OQ3BZUDH-CyMLDmFg.js");return{default:t}},[])).default},zye={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./xdc-X7V4QFNF-CSGs0o6M.js");return{default:t}},[])).default},Hye={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zetachain-BMJKVYBN-IK2CZBr3.js");return{default:t}},[])).default},Vye={iconBackground:"#f9f7ec",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zksync-UWUXFL74-Bt0brpXu.js");return{default:t}},[])).default},pq={iconBackground:"#000000",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./zora-YZH32HP3-CY3tp3EJ.js");return{default:t}},[])).default},HRt={apechain:{chainId:33139,name:"ApeChain",...kye},apechainCurtis:{chainId:33111,name:"ApeChain Curtis",...kye},arbitrum:{chainId:42161,name:"Arbitrum",...lq},arbitrumGoerli:{chainId:421613,...lq},arbitrumSepolia:{chainId:421614,...lq},avalanche:{chainId:43114,...Tye},avalancheFuji:{chainId:43113,...Tye},base:{chainId:8453,name:"Base",...cq},baseGoerli:{chainId:84531,...cq},baseSepolia:{chainId:84532,...cq},berachain:{chainId:80094,name:"Berachain",...uq},berachainArtio:{chainId:80085,name:"Berachain Artio",...uq},berachainBArtio:{chainId:80084,name:"Berachain bArtio",...uq},blast:{chainId:81457,name:"Blast",...Pye},blastSepolia:{chainId:168587773,...Pye},bsc:{chainId:56,name:"BSC",...Iye},bscTestnet:{chainId:97,...Iye},celo:{chainId:42220,name:"Celo",...Fye},celoAlfajores:{chainId:44787,name:"Celo Alfajores",...Fye},cronos:{chainId:25,...Oye},cronosTestnet:{chainId:338,...Oye},degen:{chainId:666666666,name:"Degen",...LRt},flow:{chainId:747,...Mye},flowTestnet:{chainId:545,...Mye},gnosis:{chainId:100,name:"Gnosis",...DRt},goerli:{chainId:5,...Eb},gravity:{chainId:1625,name:"Gravity",...Rye},gravitySepolia:{chainId:13505,name:"Gravity Sepolia",...Rye},hardhat:{chainId:31337,...BRt},holesky:{chainId:17e3,...Eb},hyperevm:{chainId:999,...$Rt},ink:{chainId:57073,...Lye},inkSepolia:{chainId:763373,...Lye},kaia:{chainId:8217,name:"Kaia",...Dye},kairos:{chainId:1001,name:"Kairos",...Dye},kovan:{chainId:42,...Eb},linea:{chainId:59144,name:"Linea",...dq},lineaGoerli:{chainId:59140,name:"Linea Goerli",...dq},lineaSepolia:{chainId:59141,name:"Linea Sepolia",...dq},localhost:{chainId:1337,...Eb},mainnet:{chainId:1,name:"Ethereum",...Eb},manta:{chainId:169,name:"Manta",...fq},mantaSepolia:{chainId:3441006,...fq},mantaTestnet:{chainId:3441005,...fq},mantle:{chainId:5e3,...Bye},mantleTestnet:{chainId:5001,...Bye},optimism:{chainId:10,name:"Optimism",...sF},optimismGoerli:{chainId:420,...sF},optimismKovan:{chainId:69,...sF},optimismSepolia:{chainId:11155420,...sF},polygon:{chainId:137,name:"Polygon",...hq},polygonAmoy:{chainId:80002,...hq},polygonMumbai:{chainId:80001,...hq},rinkeby:{chainId:4,...Eb},ronin:{chainId:2020,...URt},ropsten:{chainId:3,...Eb},sanko:{chainId:1996,name:"Sanko",...zRt},scroll:{chainId:534352,...$ye},scrollSepolia:{chainId:534351,...$ye},sepolia:{chainId:11155111,...Eb},unichain:{chainId:130,...Uye},unichainSepolia:{chainId:1301,...Uye},xdc:{chainId:50,name:"XinFin",...zye},xdcTestnet:{chainId:51,...zye},zetachain:{chainId:7e3,name:"ZetaChain",...Hye},zetachainAthensTestnet:{chainId:7001,name:"Zeta Athens",...Hye},zkSync:{chainId:324,name:"zkSync",...Vye},zkSyncTestnet:{chainId:280,...Vye},zora:{chainId:7777777,name:"Zora",...pq},zoraSepolia:{chainId:999999999,...pq},zoraTestnet:{chainId:999,...pq}},VRt=Object.fromEntries(Object.values(HRt).filter(fBe).map(({chainId:t,...e})=>[t,e])),WRt=t=>t.map(e=>{const n=VRt[e.id]??{};return{...e,name:n.name??e.name,iconUrl:e.iconUrl??n.iconUrl,iconBackground:e.iconBackground??n.iconBackground}}),Mce=m.createContext({chains:[]});function qRt({children:t,initialChain:e}){const{chains:n}=Tl();return Ne.createElement(Mce.Provider,{value:m.useMemo(()=>({chains:WRt(n),initialChainId:typeof e=="number"?e:e==null?void 0:e.id}),[n,e])},t)}var xj=()=>m.useContext(Mce).chains,GRt=()=>m.useContext(Mce).initialChainId,KRt=()=>{const t=xj();return m.useMemo(()=>{const e={};for(const n of t)e[n.id]=n;return e},[t])},hBe=m.createContext({showBalance:void 0,setShowBalance:()=>{}});function YRt({children:t}){const[e,n]=m.useState();return Ne.createElement(hBe.Provider,{value:{showBalance:e,setShowBalance:n}},t)}var XRt=()=>m.useContext(hBe);function QRt(){const[t,e]=m.useState(!1);return m.useEffect(()=>(e(!0),()=>{e(!1)}),[]),m.useCallback(()=>t,[t])}function pBe(){const t=xj(),e=M_.id;return t.some(r=>r.id===e)}function ZRt(t){const e=pBe(),n=s=>{try{return YOt(s)}catch{}},{data:r}=o2t({chainId:M_.id,name:t?n(t):void 0,query:{enabled:e}});return r}async function _v(t,e){if(e={headers:{},method:"get",...e,timeout:e.timeout??1e4},!t)throw new Error("rainbowFetch: Missing url argument");const n=new AbortController,r=setTimeout(()=>n.abort(),e.timeout),{body:s,params:a,headers:o,...l}=e,c=s&&typeof s=="object"?JSON.stringify(e.body):e.body,u=await fetch(`${t}${eLt(a)}`,{...l,body:c,headers:{Accept:"application/json","Content-Type":"application/json",...o},signal:n.signal});clearTimeout(r);const d=await JRt(u);if(u.ok){const{headers:g,status:y}=u;return{data:d,headers:g,status:y}}throw tLt({requestBody:s,response:u,responseBody:typeof d=="string"?{error:d}:d})}function JRt(t){const e=t.headers.get("Content-Type");return e!=null&&e.startsWith("application/json")?t.json():t.text()}function eLt(t){return t&&Object.keys(t).length?`?${new URLSearchParams(t)}`:""}function tLt({requestBody:t,response:e,responseBody:n}){const r=(n==null?void 0:n.error)||(e==null?void 0:e.statusText)||"There was an error with the request.",s=new Error(r);return s.response=e,s.responseBody=n,s.requestBody=t,s}var nLt=class{constructor(t={}){const{baseUrl:e="",...n}=t;this.baseUrl=e,this.opts=n}get(t,e){return _v(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"get"})}delete(t,e){return _v(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"delete"})}head(t,e){return _v(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"head"})}options(t,e){return _v(`${this.baseUrl}${t}`,{...this.opts,...e||{},method:"options"})}post(t,e,n){return _v(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"post"})}put(t,e,n){return _v(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"put"})}patch(t,e,n){return _v(`${this.baseUrl}${t}`,{...this.opts,...n||{},body:e,method:"patch"})}};function rLt({baseUrl:t,headers:e,params:n,timeout:r}){return new nLt({baseUrl:t,headers:e,params:n,timeout:r})}var sLt=!!(typeof process<"u"&&typeof PL<"u"&&PL.RAINBOW_PROVIDER_API_KEY),iLt=rLt({baseUrl:"https://enhanced-provider.rainbow.me",headers:{"x-api-key":typeof process<"u"&&typeof PL<"u"&&PL.RAINBOW_PROVIDER_API_KEY||"LzbasoBiLqltex3VkcQ7LRmL4PtfiiZ1EMJrizrgfonWN6byJReu/l6yrUoo3zLW"}});function aLt(t,e,n={}){return[t,e,n]}function pM(t){return`rk-ens-name-${t}`}function oLt(t){try{const e=t?JSON.parse(t):null;return typeof e=="object"?e:null}catch{return null}}function lLt(t,e){if(!uc(t))return;const n=new Date,r=new Date(n.getTime()+180*6e4);localStorage.setItem(pM(t),JSON.stringify({ensName:e,expires:r.getTime()}))}function cLt(t){const e=oLt(localStorage.getItem(pM(t)));if(!e)return null;const{ensName:n,expires:r}=e;return typeof n!="string"||Number.isNaN(Number(r))||new Date().getTime()>Number(r)?(localStorage.removeItem(pM(t)),null):n}async function uLt({address:t}){const e=cLt(t);if(e)return e;const r=(await iLt.get("/v1/resolve-ens",{params:{address:t}})).data.data;return r&&lLt(t,r),r}function dLt(t){const e=pBe(),{data:n}=l2t({chainId:M_.id,address:t,query:{enabled:e}}),{data:r}=oPe({queryKey:aLt("address",t),queryFn:()=>uLt({address:t}),enabled:!e&&!!t&&sLt,staleTime:10*(60*1e3),retry:1});return n||r}function mBe({address:t,includeBalance:e}){const n=dLt(t),r=ZRt(n),{data:s}=lPe({address:e?t:void 0});return{ensName:n,ensAvatar:r,balance:s}}function Rce(){const{chain:t}=ns();return(t==null?void 0:t.id)??null}var xBe="rk-transactions";function fLt(t){try{const e=t?JSON.parse(t):{};return typeof e=="object"?e:{}}catch{return{}}}function Wye(){return fLt(typeof localStorage<"u"?localStorage.getItem(xBe):null)}var hLt=/^0x([A-Fa-f0-9]{64})$/;function pLt(t){const e=[];return hLt.test(t.hash)||e.push("Invalid transaction hash"),typeof t.description!="string"&&e.push("Transaction must have a description"),typeof t.confirmations<"u"&&(!Number.isInteger(t.confirmations)||t.confirmations<1)&&e.push("Transaction confirmations must be a positiver integer"),e}function mLt({provider:t}){let e=Wye(),n=t;const r=new Set,s=new Set,a=new Map;function o(P){n=P}function l(P,T){var M;return((M=e[P])==null?void 0:M[T])??[]}function c(P,T,M){const F=pLt(M);if(F.length>0)throw new Error(["Unable to add transaction",...F].join(`
`));x(P,T,$=>[{...M,status:"pending"},...$.filter(({hash:L})=>L!==M.hash)])}function u(P,T){x(P,T,()=>[])}function d(P,T,M,F){x(P,T,$=>$.map(L=>L.hash===M?{...L,status:F}:L))}async function f(P,T){await Promise.all(l(P,T).filter(M=>M.status==="pending").map(async M=>{const{confirmations:F,hash:$}=M,L=a.get($);if(L)return await L;const z=n.waitForTransactionReceipt({confirmations:F,hash:$,timeout:3e5}).then(({status:X})=>{a.delete($),X!==void 0&&(d(P,T,$,X===0||X==="reverted"?"failed":"confirmed"),v(X))}).catch(()=>{d(P,T,$,"failed")});return a.set($,z),await z}))}function x(P,T,M){e=Wye(),e[P]=e[P]??{};let F=0;const $=10,L=M(e[P][T]??[]).filter(({status:z})=>z==="pending"?!0:F++<=$);e[P][T]=L.length>0?L:void 0,g(),y(),f(P,T)}function g(){localStorage.setItem(xBe,JSON.stringify(e))}function y(){for(const P of r)P()}function v(P){for(const T of s)T(P)}function C(P){return r.add(P),()=>{r.delete(P)}}function N(P){return s.add(P),()=>{s.delete(P)}}return{addTransaction:c,clearTransactions:u,getTransactions:l,onTransactionStatus:N,onChange:C,setProvider:o,waitForPendingTransactions:f}}var qye,gBe=Ne.createContext(null);function xLt({children:t}){const e=cPe(),{address:n}=ns(),r=Rce(),{refetch:s}=lPe({address:n,query:{enabled:!1}}),[a]=Ne.useState(()=>qye??(qye=mLt({provider:e}))),o=Ne.useCallback(l=>{l==="success"&&s()},[s]);return Ne.useEffect(()=>{a.setProvider(e)},[a,e]),Ne.useEffect(()=>{n&&r&&a.waitForPendingTransactions(n,r)},[a,n,r]),Ne.useEffect(()=>{if(a&&n&&r)return a.onTransactionStatus(o)},[a,n,r,o]),Ne.createElement(gBe.Provider,{value:a},t)}function bBe(){const t=Ne.useContext(gBe);if(!t)throw new Error("Transaction hooks must be used within RainbowKitProvider");return t}function yBe(){const t=bBe(),{address:e}=ns(),n=Rce(),[r,s]=m.useState(()=>t&&e&&n?t.getTransactions(e,n):[]);return m.useEffect(()=>{if(t&&e&&n)return s(t.getTransactions(e,n)),t.onChange(()=>{s(t.getTransactions(e,n))})},[t,e,n]),r}var Gye=t=>typeof t=="function"?t():t;function gLt(t,{extends:e}={}){const n={...Ybe(Aye,Gye(t))};if(!e)return n;const r=Ybe(Aye,Gye(e));return Object.fromEntries(Object.entries(n).filter(([a,o])=>o!==r[a]))}function Kye(t,e={}){return Object.entries(gLt(t,e)).map(([n,r])=>`${n}:${r.replace(/[:;{}</>]/g,"")};`).join("")}var vBe={appName:void 0,disclaimer:void 0,learnMoreUrl:"https://learn.rainbow.me/understanding-web3?utm_source=rainbowkit&utm_campaign=learnmore"},WT=m.createContext(vBe),wBe=m.createContext(!1);function bLt(t,e){let n;return()=>{n&&clearTimeout(n),n=setTimeout(()=>{n=null,t()},e)}}var CBe=()=>{const[t,e]=m.useState({height:void 0,width:void 0});return m.useEffect(()=>{const n=bLt(()=>{e({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)},[]),t},qT=m.createContext({connector:null,setConnector:()=>{}});function yLt({children:t}){const[e,n]=m.useState(null);return Ne.createElement(qT.Provider,{value:m.useMemo(()=>({connector:e,setConnector:n}),[e])},t)}var GT={COMPACT:"compact",WIDE:"wide"},EU=m.createContext(GT.WIDE);function vLt({children:t,modalSize:e}){const{width:n}=CBe(),r=n&&n<pRt,{connector:s}=m.useContext(qT);return Ne.createElement(EU.Provider,{value:r||s?GT.COMPACT:e},t)}var Lce=m.createContext(!1),wLt="rk-version";function CLt({version:t}){localStorage.setItem(wLt,t)}function SLt(){const t=m.useCallback(()=>{CLt({version:"2.2.4"})},[]);m.useEffect(()=>{t()},[t])}function NLt(t,e){const n={};for(const r of t){const s=e(r);s&&(n[s]=r)}return n}function Dce(){return typeof navigator<"u"&&typeof navigator.userAgent<"u"&&/Version\/([0-9._]+).*Safari/.test(navigator.userAgent)}function ALt(){return typeof document<"u"&&getComputedStyle(document.body).getPropertyValue("--arc-palette-focus")!==""}function Bce(){var e,n;if(typeof navigator>"u")return"Browser";const t=(e=navigator.userAgent)==null?void 0:e.toLowerCase();return(n=navigator.brave)!=null&&n.isBrave?"Brave":(t==null?void 0:t.indexOf("edg/"))>-1?"Edge":(t==null?void 0:t.indexOf("op"))>-1?"Opera":ALt()?"Arc":(t==null?void 0:t.indexOf("chrome"))>-1?"Chrome":(t==null?void 0:t.indexOf("firefox"))>-1?"Firefox":Dce()?"Safari":"Browser"}var jLt=zMt.UAParser(),{os:$ce}=jLt;function ELt(){return $ce.name==="Windows"}function _Lt(){return $ce.name==="Mac OS"}function kLt(){return["Ubuntu","Mint","Fedora","Debian","Arch","Linux"].includes($ce.name)}function Uce(){return ELt()?"Windows":_Lt()?"macOS":kLt()?"Linux":"Desktop"}var TLt=t=>{var n,r,s,a,o,l,c,u,d,f,x;const e=Bce();return{Arc:(n=t==null?void 0:t.downloadUrls)==null?void 0:n.chrome,Brave:(r=t==null?void 0:t.downloadUrls)==null?void 0:r.chrome,Chrome:(s=t==null?void 0:t.downloadUrls)==null?void 0:s.chrome,Edge:((a=t==null?void 0:t.downloadUrls)==null?void 0:a.edge)||((o=t==null?void 0:t.downloadUrls)==null?void 0:o.chrome),Firefox:(l=t==null?void 0:t.downloadUrls)==null?void 0:l.firefox,Opera:((c=t==null?void 0:t.downloadUrls)==null?void 0:c.opera)||((u=t==null?void 0:t.downloadUrls)==null?void 0:u.chrome),Safari:(d=t==null?void 0:t.downloadUrls)==null?void 0:d.safari,Browser:(f=t==null?void 0:t.downloadUrls)==null?void 0:f.browserExtension}[e]??((x=t==null?void 0:t.downloadUrls)==null?void 0:x.browserExtension)},PLt=t=>{var n,r,s;return(L5()?(n=t==null?void 0:t.downloadUrls)==null?void 0:n.ios:(r=t==null?void 0:t.downloadUrls)==null?void 0:r.android)??((s=t==null?void 0:t.downloadUrls)==null?void 0:s.mobile)},ILt=t=>{var n,r,s,a,o;const e=Uce();return{Windows:(n=t==null?void 0:t.downloadUrls)==null?void 0:n.windows,macOS:(r=t==null?void 0:t.downloadUrls)==null?void 0:r.macos,Linux:(s=t==null?void 0:t.downloadUrls)==null?void 0:s.linux,Desktop:(a=t==null?void 0:t.downloadUrls)==null?void 0:a.desktop}[e]??((o=t==null?void 0:t.downloadUrls)==null?void 0:o.desktop)},SBe=(t,e)=>t.some(n=>n.id===e),FLt=t=>!!t.isRainbowKitConnector,Yye=t=>{var e;return!!(!t.isRainbowKitConnector&&((e=t.icon)!=null&&e.replace(/\n/g,"").startsWith("data:image"))&&t.uid&&t.name)},OLt=(t,e)=>t.id==="walletConnect"&&e?{...t,walletConnectModalConnector:e}:t,MLt=({wallets:t,recentWallets:e})=>[...e,...t.filter(n=>!SBe(e,n.id))],NBe="rk-recent";function RLt(t){try{const e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}function ABe(){return typeof localStorage<"u"?RLt(localStorage.getItem(NBe)):[]}function LLt(t){return[...new Set(t)]}function DLt(t){const e=LLt([t,...ABe()]);localStorage.setItem(NBe,JSON.stringify(e))}function L_(t=!1){var M,F,$;const e=xj(),n=GRt(),{connectAsync:r,connectors:s}=i2t(),a=s,{setIsWalletConnectModalOpen:o}=XBe(),l=a.map(L=>({...L,...L.rkDetails||{}}));async function c(L){var ne,J;const z=await L.getChainId(),X=await r({chainId:n??((ne=e.find(({id:K})=>K===z))==null?void 0:ne.id)??((J=e[0])==null?void 0:J.id),connector:L});return X&&DLt(L.id),X}async function u(L){try{o(!0),await c(L),o(!1)}catch(z){const X=z.name==="UserRejectedRequestError"||z.message==="Connection request reset. Please try again.";if(o(!1),!X)throw z}}const d=async(L,z)=>{const X=await L.getProvider();return L.id==="coinbase"?X.qrUrl:new Promise(ne=>X.once("display_uri",J=>{ne(z(J))}))},f=l.find(L=>L.id==="walletConnect"&&L.isWalletConnectModalConnector),x=l.filter(Yye).map(L=>({...L,groupIndex:0})),g=l.filter(FLt).filter(L=>!L.isWalletConnectModalConnector).filter(L=>t?!x.some(X=>X.id===L.rdns):!0).map(L=>OLt(L,f)),y=[...x,...g],v=NLt(y,L=>L.id),N=ABe().map(L=>v[L]).filter(Boolean).slice(0,3),P=[],T=MLt({wallets:y,recentWallets:N});for(const L of T){if(!L)continue;const z=Yye(L),X=SBe(N,L.id);if(z){P.push({...L,iconUrl:L.icon,ready:!0,connect:()=>c(L),groupName:"Installed",recent:X});continue}P.push({...L,ready:L.installed??!0,connect:()=>c(L),desktopDownloadUrl:ILt(L),extensionDownloadUrl:TLt(L),groupName:L.groupName,mobileDownloadUrl:PLt(L),getQrCodeUri:(M=L.qrCode)!=null&&M.getUri?()=>d(L,L.qrCode.getUri):void 0,getDesktopUri:(F=L.desktop)!=null&&F.getUri?()=>d(L,L.desktop.getUri):void 0,getMobileUri:($=L.mobile)!=null&&$.getUri?()=>{var ne;return d(L,(ne=L.mobile)==null?void 0:ne.getUri)}:void 0,recent:X,showWalletConnectModal:L.walletConnectModalConnector?()=>u(L.walletConnectModalConnector):void 0})}return P}var jBe=async()=>(await os(async()=>{const{default:t}=await import("./assets-NU2OP443-COMs-Mo6.js");return{default:t}},[])).default,BLt=()=>px(jBe),$Lt=()=>Ne.createElement(Rc,{background:"#d0d5de",borderRadius:"10",height:"48",src:jBe,width:"48"}),EBe=async()=>(await os(async()=>{const{default:t}=await import("./login-CWDTIDNK-DhDUYE4b.js");return{default:t}},[])).default,ULt=()=>px(EBe),zLt=()=>Ne.createElement(Rc,{background:"#d0d5de",borderRadius:"10",height:"48",src:EBe,width:"48"}),Rs=Ne.forwardRef(({as:t="div",children:e,className:n,color:r,display:s,font:a="body",id:o,size:l="16",style:c,tabIndex:u,textAlign:d="inherit",weight:f="regular",testId:x},g)=>Ne.createElement(Cn,{as:t,className:n,color:r,display:s,fontFamily:a,fontSize:l,fontWeight:f,id:o,ref:g,style:c,tabIndex:u,textAlign:d,testId:x},e));Rs.displayName="Text";var HLt={large:{fontSize:"16",paddingX:"24",paddingY:"10"},medium:{fontSize:"14",height:"28",paddingX:"12",paddingY:"4"},small:{fontSize:"14",paddingX:"10",paddingY:"5"}};function vd({disabled:t=!1,href:e,label:n,onClick:r,rel:s="noreferrer noopener",size:a="medium",target:o="_blank",testId:l,type:c="primary"}){const u=c==="primary",d=a!=="large",f=fu(),x=t?"actionButtonSecondaryBackground":u?"accentColor":d?"actionButtonSecondaryBackground":null,{fontSize:g,height:y,paddingX:v,paddingY:C}=HLt[a],N=!f||!d;return Ne.createElement(Cn,{...e?t?{}:{as:"a",href:e,rel:s,target:o}:{as:"button",type:"button"},onClick:t?void 0:r,...N?{borderColor:f&&!d&&!u?"actionButtonBorderMobile":"actionButtonBorder",borderStyle:"solid",borderWidth:"1"}:{},borderRadius:"actionButton",className:!t&&uu({active:"shrinkSm",hover:"grow"}),display:"block",paddingX:v,paddingY:C,style:{willChange:"transform"},testId:l,textAlign:"center",transition:"transform",...x?{background:x}:{},...y?{height:y}:{}},Ne.createElement(Rs,{color:t?"modalTextSecondary":u?"accentColorForeground":"accentColor",size:g,weight:"bold"},n))}var VLt=()=>fu()?Ne.createElement("svg",{"aria-hidden":!0,fill:"none",height:"11.5",viewBox:"0 0 11.5 11.5",width:"11.5",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Close"),Ne.createElement("path",{d:"M2.13388 0.366117C1.64573 -0.122039 0.854272 -0.122039 0.366117 0.366117C-0.122039 0.854272 -0.122039 1.64573 0.366117 2.13388L3.98223 5.75L0.366117 9.36612C-0.122039 9.85427 -0.122039 10.6457 0.366117 11.1339C0.854272 11.622 1.64573 11.622 2.13388 11.1339L5.75 7.51777L9.36612 11.1339C9.85427 11.622 10.6457 11.622 11.1339 11.1339C11.622 10.6457 11.622 9.85427 11.1339 9.36612L7.51777 5.75L11.1339 2.13388C11.622 1.64573 11.622 0.854272 11.1339 0.366117C10.6457 -0.122039 9.85427 -0.122039 9.36612 0.366117L5.75 3.98223L2.13388 0.366117Z",fill:"currentColor"})):Ne.createElement("svg",{"aria-hidden":!0,fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Close"),Ne.createElement("path",{d:"M1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L3.58579 5L0.292893 8.29289C-0.0976311 8.68342 -0.0976311 9.31658 0.292893 9.70711C0.683417 10.0976 1.31658 10.0976 1.70711 9.70711L5 6.41421L8.29289 9.70711C8.68342 10.0976 9.31658 10.0976 9.70711 9.70711C10.0976 9.31658 10.0976 8.68342 9.70711 8.29289L6.41421 5L9.70711 1.70711C10.0976 1.31658 10.0976 0.683417 9.70711 0.292893C9.31658 -0.0976311 8.68342 -0.0976311 8.29289 0.292893L5 3.58579L1.70711 0.292893Z",fill:"currentColor"})),l5=({"aria-label":t="Close",onClose:e})=>{const n=fu();return Ne.createElement(Cn,{alignItems:"center","aria-label":t,as:"button",background:"closeButtonBackground",borderColor:"actionButtonBorder",borderRadius:"full",borderStyle:"solid",borderWidth:n?"0":"1",className:uu({active:"shrinkSm",hover:"growLg"}),color:"closeButton",display:"flex",height:n?"30":"28",justifyContent:"center",onClick:e,style:{willChange:"transform"},transition:"default",type:"button",width:n?"30":"28"},Ne.createElement(VLt,null))},_Be=async()=>(await os(async()=>{const{default:t}=await import("./sign-A7IJEUT5-CGsRnPrd.js");return{default:t}},[])).default;function WLt({onClose:t,onCloseModal:e}){const{i18n:n}=m.useContext(fc),[{status:r,...s},a]=Ne.useState({status:"idle"}),o=yRt(),l=m.useCallback(async()=>{try{const y=await o.getNonce();a(v=>({...v,nonce:y}))}catch{a(y=>({...y,errorMessage:n.t("sign_in.message.preparing_error"),status:"idle"}))}},[o,n.t]),c=m.useRef(!1);Ne.useEffect(()=>{c.current||(c.current=!0,l())},[l]);const u=fu(),{address:d,chain:f}=ns(),{signMessageAsync:x}=uPe(),g=async()=>{try{const y=f==null?void 0:f.id,{nonce:v}=s;if(!d||!y||!v)return;a(P=>({...P,errorMessage:void 0,status:"signing"}));const C=o.createMessage({address:d,chainId:y,nonce:v});let N;try{N=await x({message:C})}catch(P){return P instanceof So?a(T=>({...T,status:"idle"})):a(T=>({...T,errorMessage:n.t("sign_in.signature.signing_error"),status:"idle"}))}a(P=>({...P,status:"verifying"}));try{if(await o.verify({message:C,signature:N})){e();return}throw new Error}catch{return a(P=>({...P,errorMessage:n.t("sign_in.signature.verifying_error"),status:"idle"}))}}catch{a({errorMessage:n.t("sign_in.signature.oops_error"),status:"idle"})}};return Ne.createElement(Cn,{position:"relative"},Ne.createElement(Cn,{display:"flex",paddingRight:"16",paddingTop:"16",position:"absolute",right:"0"},Ne.createElement(l5,{onClose:t})),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"24",padding:"24",paddingX:"18",style:{paddingTop:u?"60px":"36px"}},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"6":"4",style:{maxWidth:u?320:280}},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"32":"16"},Ne.createElement(Rc,{height:40,src:_Be,width:40}),Ne.createElement(Rs,{color:"modalText",size:u?"20":"18",textAlign:"center",weight:"heavy"},n.t("sign_in.label"))),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:u?"16":"12"},Ne.createElement(Rs,{color:"modalTextSecondary",size:u?"16":"14",textAlign:"center"},n.t("sign_in.description")),r==="idle"&&s.errorMessage?Ne.createElement(Rs,{color:"error",size:u?"16":"14",textAlign:"center",weight:"bold"},s.errorMessage):null)),Ne.createElement(Cn,{alignItems:u?void 0:"center",display:"flex",flexDirection:"column",gap:"8",width:"full"},Ne.createElement(vd,{disabled:!s.nonce||r==="signing"||r==="verifying",label:s.nonce?r==="signing"?n.t("sign_in.signature.waiting"):r==="verifying"?n.t("sign_in.signature.verifying"):n.t("sign_in.message.send"):n.t("sign_in.message.preparing"),onClick:g,size:u?"large":"medium",testId:"auth-message-button"}),u?Ne.createElement(vd,{label:"Cancel",onClick:t,size:"large",type:"secondary"}):Ne.createElement(Cn,{as:"button",borderRadius:"full",className:uu({active:"shrink",hover:"grow"}),display:"block",onClick:t,paddingX:"10",paddingY:"5",rel:"noreferrer",style:{willChange:"transform"},target:"_blank",transition:"default"},Ne.createElement(Rs,{color:"closeButton",size:u?"16":"14",weight:"bold"},n.t("sign_in.message.cancel"))))))}function qLt(){const t=xj(),e=L_(),n=jU()==="unauthenticated",r=m.useCallback(()=>{px(...e.map(s=>s.iconUrl),...t.map(s=>s.iconUrl).filter(fBe)),fu()||(BLt(),ULt()),n&&px(_Be)},[e,t,n]);m.useEffect(()=>{r()},[r])}var kBe="WALLETCONNECT_DEEPLINK_CHOICE";function GLt({mobileUri:t,name:e}){localStorage.setItem(kBe,JSON.stringify({href:t.split("?")[0],name:e}))}function KLt(){localStorage.removeItem(kBe)}var TBe=m.createContext(void 0),wne="data-rk",PBe=t=>({[wne]:t||""}),YLt=t=>{if(t&&!/^[a-zA-Z0-9_]+$/.test(t))throw new Error(`Invalid ID: ${t}`);return t?`[${wne}="${t}"]`:`[${wne}]`},XLt=()=>{const t=m.useContext(TBe);return PBe(t)},QLt=GLe();function ZLt({appInfo:t,avatar:e,children:n,coolMode:r=!1,id:s,initialChain:a,locale:o,modalSize:l=GT.WIDE,showRecentTransactions:c=!1,theme:u=QLt}){if(qLt(),SLt(),GTe({onDisconnect:KLt}),typeof u=="function")throw new Error('A theme function was provided to the "theme" prop instead of a theme object. You must execute this function to get the resulting theme object.');const d=YLt(s),f={...vBe,...t},x=e??uBe;return Ne.createElement(qRt,{initialChain:a},Ne.createElement(yLt,null,Ne.createElement(RRt,{locale:o},Ne.createElement(wBe.Provider,{value:r},Ne.createElement(vLt,{modalSize:l},Ne.createElement(Lce.Provider,{value:c},Ne.createElement(xLt,null,Ne.createElement(dBe.Provider,{value:x},Ne.createElement(WT.Provider,{value:f},Ne.createElement(TBe.Provider,{value:s},Ne.createElement(YRt,null,Ne.createElement(hBt,null,u?Ne.createElement("div",{...PBe(s)},Ne.createElement("style",{dangerouslySetInnerHTML:{__html:[`${d}{${Kye("lightMode"in u?u.lightMode:u)}}`,"darkMode"in u?`@media(prefers-color-scheme:dark){${d}{${Kye(u.darkMode,{extends:u.lightMode})}}}`:null].join("")}}),n):n))))))))))))}var JLt="_9pm4ki5 ju367va ju367v15 ju367v8r",eDt="_9pm4ki3 ju367v9h ju367vb3 ju367va ju367v2q ju367v8q",Xye=(t,e)=>{const n=t.querySelectorAll("button:not(:disabled), a[href]");n.length!==0&&n[e==="end"?n.length-1:0].focus()};function tDt(t){const e=m.useRef(null);return m.useEffect(()=>{const n=document.activeElement;return()=>{var r;(r=n.focus)==null||r.call(n)}},[]),m.useEffect(()=>{if(e.current){const n=e.current.querySelector("[data-auto-focus]");n?n.focus():e.current.focus()}},[]),Ne.createElement(Ne.Fragment,null,Ne.createElement("div",{onFocus:m.useCallback(()=>e.current&&Xye(e.current,"end"),[]),tabIndex:0}),Ne.createElement("div",{ref:e,style:{outline:"none"},tabIndex:-1,...t}),Ne.createElement("div",{onFocus:m.useCallback(()=>e.current&&Xye(e.current,"start"),[]),tabIndex:0}))}var nDt=t=>t.stopPropagation();function IL({children:t,onClose:e,open:n,titleId:r}){m.useEffect(()=>{const u=d=>n&&d.key==="Escape"&&e();return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n,e]);const[s,a]=m.useState(!0);m.useEffect(()=>{a(getComputedStyle(window.document.body).overflow!=="hidden")},[]);const o=m.useCallback(()=>e(),[e]),l=XLt(),c=fu();return Ne.createElement(Ne.Fragment,null,n?Aa.createPortal(Ne.createElement(eBe,{enabled:s},Ne.createElement(Cn,{...l},Ne.createElement(Cn,{...l,alignItems:c?"flex-end":"center","aria-labelledby":r,"aria-modal":!0,className:eDt,onClick:o,position:"fixed",role:"dialog"},Ne.createElement(tDt,{className:JLt,onClick:nDt,role:"document"},t)))),document.body):null)}var rDt="_1ckjpok7",sDt="_1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",iDt="_1ckjpok4 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",aDt="_1ckjpok6 ju367vq",oDt="_1ckjpok3 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r",lDt="_1ckjpok2 _1ckjpok1 ju367vb6 ju367vdr ju367vp ju367vt ju367vv ju367vel ju367va ju367v15 ju367v6c ju367v8r";function FL({bottomSheetOnMobile:t=!1,children:e,marginTop:n,padding:r="16",paddingBottom:s,wide:a=!1}){const o=fu(),c=m.useContext(EU)===GT.COMPACT;return Ne.createElement(Cn,{marginTop:n},Ne.createElement(Cn,{className:[a?o?lDt:c?iDt:oDt:sDt,o?aDt:null,o&&t?rDt:null].join(" ")},Ne.createElement(Cn,{padding:r,paddingBottom:s??r},e)))}var Qye=["k","m","b","t"];function iF(t,e=1){return t.toString().replace(new RegExp(`(.+\\.\\d{${e}})\\d+`),"$1").replace(/(\.[1-9]*)0+$/,"$1").replace(/\.$/,"")}function IBe(t){if(t<1)return iF(t,3);if(t<10**2)return iF(t,2);if(t<10**4)return new Intl.NumberFormat().format(Number.parseFloat(iF(t,1)));const e=10**1;let n=String(t);for(let r=Qye.length-1;r>=0;r--){const s=10**((r+1)*3);if(s<=t){t=t*e/s/e,n=iF(t,1)+Qye[r];break}}return n}function FBe(t){return t.length<8?t:`${t.substring(0,4)}…${t.substring(t.length-4)}`}function OBe(t){if(!t)return"";const e=t.split("."),n=e.pop();return e.join(".").length>24?`${e.join(".").substring(0,24)}...`:`${e.join(".")}.${n}`}var cDt=()=>Ne.createElement("svg",{fill:"none",height:"13",viewBox:"0 0 13 13",width:"13",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Copied"),Ne.createElement("path",{d:"M4.94568 12.2646C5.41052 12.2646 5.77283 12.0869 6.01892 11.7109L12.39 1.96973C12.5677 1.69629 12.6429 1.44336 12.6429 1.2041C12.6429 0.561523 12.1644 0.0966797 11.5082 0.0966797C11.057 0.0966797 10.7767 0.260742 10.5033 0.691406L4.9115 9.50977L2.07458 5.98926C1.82166 5.68848 1.54822 5.55176 1.16541 5.55176C0.502319 5.55176 0.0238037 6.02344 0.0238037 6.66602C0.0238037 6.95312 0.112671 7.20605 0.358765 7.48633L3.88611 11.7588C4.18005 12.1074 4.50818 12.2646 4.94568 12.2646Z",fill:"currentColor"})),uDt=()=>Ne.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 17 16",width:"17",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Copy"),Ne.createElement("path",{d:"M3.04236 12.3027H4.18396V13.3008C4.18396 14.8525 5.03845 15.7002 6.59705 15.7002H13.6244C15.183 15.7002 16.0375 14.8525 16.0375 13.3008V6.24609C16.0375 4.69434 15.183 3.84668 13.6244 3.84668H12.4828V2.8418C12.4828 1.29688 11.6283 0.442383 10.0697 0.442383H3.04236C1.48376 0.442383 0.629272 1.29004 0.629272 2.8418V9.90332C0.629272 11.4551 1.48376 12.3027 3.04236 12.3027ZM3.23376 10.5391C2.68689 10.5391 2.39294 10.2656 2.39294 9.68457V3.06055C2.39294 2.47949 2.68689 2.21289 3.23376 2.21289H9.8783C10.4252 2.21289 10.7191 2.47949 10.7191 3.06055V3.84668H6.59705C5.03845 3.84668 4.18396 4.69434 4.18396 6.24609V10.5391H3.23376ZM6.78845 13.9365C6.24158 13.9365 5.94763 13.6699 5.94763 13.0889V6.45801C5.94763 5.87695 6.24158 5.61035 6.78845 5.61035H13.433C13.9799 5.61035 14.2738 5.87695 14.2738 6.45801V13.0889C14.2738 13.6699 13.9799 13.9365 13.433 13.9365H6.78845Z",fill:"currentColor"})),dDt=()=>Ne.createElement("svg",{fill:"none",height:"16",viewBox:"0 0 18 16",width:"18",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Disconnect"),Ne.createElement("path",{d:"M2.67834 15.5908H9.99963C11.5514 15.5908 12.399 14.7432 12.399 13.1777V10.2656H10.6354V12.9863C10.6354 13.5332 10.3688 13.8271 9.78772 13.8271H2.89026C2.3092 13.8271 2.0426 13.5332 2.0426 12.9863V3.15625C2.0426 2.60254 2.3092 2.30859 2.89026 2.30859H9.78772C10.3688 2.30859 10.6354 2.60254 10.6354 3.15625V5.89746H12.399V2.95801C12.399 1.39941 11.5514 0.544922 9.99963 0.544922H2.67834C1.12659 0.544922 0.278931 1.39941 0.278931 2.95801V13.1777C0.278931 14.7432 1.12659 15.5908 2.67834 15.5908ZM7.43616 8.85059H14.0875L15.0924 8.78906L14.566 9.14453L13.6842 9.96484C13.5406 10.1016 13.4586 10.2861 13.4586 10.4844C13.4586 10.8398 13.7321 11.168 14.1217 11.168C14.3199 11.168 14.4635 11.0928 14.6002 10.9561L16.7809 8.68652C16.986 8.48145 17.0543 8.27637 17.0543 8.06445C17.0543 7.85254 16.986 7.64746 16.7809 7.43555L14.6002 5.17285C14.4635 5.03613 14.3199 4.9541 14.1217 4.9541C13.7321 4.9541 13.4586 5.27539 13.4586 5.6377C13.4586 5.83594 13.5406 6.02734 13.6842 6.15723L14.566 6.98438L15.0924 7.33984L14.0875 7.27148H7.43616C7.01917 7.27148 6.65686 7.62012 6.65686 8.06445C6.65686 8.50195 7.01917 8.85059 7.43616 8.85059Z",fill:"currentColor"}));function fDt(){const t=bBe(),{address:e}=ns(),n=Rce();return m.useCallback(()=>{if(!e||!n)throw new Error("No address or chain ID found");t.clearTransactions(e,n)},[t,e,n])}var MBe=t=>{var e,n;return(n=(e=t==null?void 0:t.blockExplorers)==null?void 0:e.default)==null?void 0:n.url},RBe=()=>Ne.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Link"),Ne.createElement("path",{d:"M10 18.9443C15.0977 18.9443 19.2812 14.752 19.2812 9.6543C19.2812 4.56543 15.0889 0.373047 10 0.373047C4.90234 0.373047 0.71875 4.56543 0.71875 9.6543C0.71875 14.752 4.91113 18.9443 10 18.9443ZM10 16.6328C6.1416 16.6328 3.03906 13.5215 3.03906 9.6543C3.03906 5.7959 6.13281 2.68457 10 2.68457C13.8584 2.68457 16.9697 5.7959 16.9697 9.6543C16.9785 13.5215 13.8672 16.6328 10 16.6328ZM12.7158 12.1416C13.2432 12.1416 13.5684 11.7549 13.5684 11.1836V7.19336C13.5684 6.44629 13.1377 6.05957 12.417 6.05957H8.40918C7.8291 6.05957 7.45117 6.38477 7.45117 6.91211C7.45117 7.43945 7.8291 7.77344 8.40918 7.77344H9.69238L10.7207 7.63281L9.53418 8.67871L6.73047 11.4912C6.53711 11.6758 6.41406 11.9395 6.41406 12.2031C6.41406 12.7832 6.85352 13.1699 7.39844 13.1699C7.68848 13.1699 7.92578 13.0732 8.1543 12.8623L10.9316 10.0762L11.9775 8.89844L11.8545 9.98828V11.1836C11.8545 11.7725 12.1885 12.1416 12.7158 12.1416Z",fill:"currentColor"})),hDt=()=>Ne.createElement("svg",{fill:"none",height:"19",viewBox:"0 0 20 19",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Cancel"),Ne.createElement("path",{d:"M10 18.9443C15.0977 18.9443 19.2812 14.752 19.2812 9.6543C19.2812 4.56543 15.0889 0.373047 10 0.373047C4.90234 0.373047 0.71875 4.56543 0.71875 9.6543C0.71875 14.752 4.91113 18.9443 10 18.9443ZM10 16.6328C6.1416 16.6328 3.03906 13.5215 3.03906 9.6543C3.03906 5.7959 6.13281 2.68457 10 2.68457C13.8584 2.68457 16.9697 5.7959 16.9697 9.6543C16.9785 13.5215 13.8672 16.6328 10 16.6328ZM7.29297 13.3018C7.58301 13.3018 7.81152 13.2139 7.99609 13.0205L10 11.0166L12.0127 13.0205C12.1973 13.2051 12.4258 13.3018 12.707 13.3018C13.2432 13.3018 13.6562 12.8887 13.6562 12.3525C13.6562 12.0977 13.5508 11.8691 13.3662 11.6934L11.3535 9.67188L13.375 7.6416C13.5596 7.44824 13.6562 7.22852 13.6562 6.98242C13.6562 6.44629 13.2432 6.0332 12.7158 6.0332C12.4346 6.0332 12.2148 6.12109 12.0215 6.31445L10 8.32715L7.9873 6.32324C7.80273 6.12988 7.58301 6.04199 7.29297 6.04199C6.76562 6.04199 6.35254 6.45508 6.35254 6.99121C6.35254 7.2373 6.44922 7.46582 6.63379 7.6416L8.65527 9.67188L6.63379 11.6934C6.44922 11.8691 6.35254 12.1064 6.35254 12.3525C6.35254 12.8887 6.76562 13.3018 7.29297 13.3018Z",fill:"currentColor"})),pDt=()=>Ne.createElement("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Success"),Ne.createElement("path",{d:"M10 19.4443C15.0977 19.4443 19.2812 15.252 19.2812 10.1543C19.2812 5.06543 15.0889 0.873047 10 0.873047C4.90234 0.873047 0.71875 5.06543 0.71875 10.1543C0.71875 15.252 4.91113 19.4443 10 19.4443ZM10 17.1328C6.1416 17.1328 3.03906 14.0215 3.03906 10.1543C3.03906 6.2959 6.13281 3.18457 10 3.18457C13.8584 3.18457 16.9697 6.2959 16.9697 10.1543C16.9785 14.0215 13.8672 17.1328 10 17.1328ZM9.07715 14.3379C9.4375 14.3379 9.7627 14.1533 9.97363 13.8369L13.7441 8.00977C13.8848 7.79883 13.9814 7.5791 13.9814 7.36816C13.9814 6.84961 13.5244 6.48926 13.0322 6.48926C12.707 6.48926 12.4258 6.66504 12.2148 7.0166L9.05957 12.0967L7.5918 10.2949C7.37207 10.0225 7.13477 9.9082 6.84473 9.9082C6.33496 9.9082 5.92188 10.3125 5.92188 10.8223C5.92188 11.0684 6.00098 11.2793 6.18555 11.5078L8.1543 13.8545C8.40918 14.1709 8.70801 14.3379 9.07715 14.3379Z",fill:"currentColor"})),mDt=t=>{switch(t){case"pending":return R_;case"confirmed":return pDt;case"failed":return hDt;default:return R_}};function xDt({tx:t}){const e=fu(),n=mDt(t.status),r=t.status==="failed"?"error":"accentColor",{chain:s}=ns(),a=t.status==="confirmed"?"Confirmed":t.status==="failed"?"Failed":"Pending",o=MBe(s);return Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{...o?{as:"a",background:{hover:"profileForeground"},borderRadius:"menuButton",className:uu({active:"shrink"}),href:`${o}/tx/${t.hash}`,rel:"noreferrer noopener",target:"_blank",transition:"default"}:{},color:"modalText",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"8",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:e?"16":"14"},Ne.createElement(Cn,{color:r},Ne.createElement(n,null)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:e?"3":"1"},Ne.createElement(Cn,null,Ne.createElement(Rs,{color:"modalText",font:"body",size:e?"16":"14",weight:"bold"},t==null?void 0:t.description)),Ne.createElement(Cn,null,Ne.createElement(Rs,{color:t.status==="pending"?"modalTextSecondary":r,font:"body",size:"14",weight:e?"medium":"regular"},a)))),o&&Ne.createElement(Cn,{alignItems:"center",color:"modalTextDim",display:"flex"},Ne.createElement(RBe,null))))}var gDt=3;function bDt({address:t}){const e=yBe(),n=fDt(),{chain:r}=ns(),s=MBe(r),a=e.slice(0,gDt),o=a.length>0,l=fu(),{appName:c}=m.useContext(WT),{i18n:u}=m.useContext(fc);return Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"10",paddingBottom:"2",paddingTop:"16",paddingX:l?"8":"18"},o&&Ne.createElement(Cn,{paddingBottom:l?"4":"0",paddingTop:"8",paddingX:l?"12":"6"},Ne.createElement(Cn,{display:"flex",justifyContent:"space-between"},Ne.createElement(Rs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.recent.title")),Ne.createElement(Cn,{style:{marginBottom:-6,marginLeft:-10,marginRight:-10,marginTop:-6}},Ne.createElement(Cn,{as:"button",background:{hover:"profileForeground"},borderRadius:"actionButton",className:uu({active:"shrink"}),onClick:n,paddingX:l?"8":"12",paddingY:l?"4":"5",transition:"default",type:"button"},Ne.createElement(Rs,{color:"modalTextSecondary",size:l?"16":"14",weight:"semibold"},u.t("profile.transactions.clear.label")))))),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},o?a.map(d=>Ne.createElement(xDt,{key:d.hash,tx:d})):Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{padding:l?"12":"8"},Ne.createElement(Rs,{color:"modalTextDim",size:l?"16":"14",weight:l?"medium":"bold"},c?u.t("profile.transactions.description",{appName:c}):u.t("profile.transactions.description_fallback"))),l&&Ne.createElement(Cn,{background:"generalBorderDim",height:"1",marginX:"12",marginY:"8"})))),s&&Ne.createElement(Cn,{paddingBottom:"18",paddingX:l?"8":"18"},Ne.createElement(Cn,{alignItems:"center",as:"a",background:{hover:"profileForeground"},borderRadius:"menuButton",className:uu({active:"shrink"}),color:"modalTextDim",display:"flex",flexDirection:"row",href:`${s}/address/${t}`,justifyContent:"space-between",paddingX:"8",paddingY:"12",rel:"noreferrer noopener",style:{willChange:"transform"},target:"_blank",transition:"default",width:"full",...l?{paddingLeft:"12"}:{}},Ne.createElement(Rs,{color:"modalText",font:"body",size:l?"16":"14",weight:l?"semibold":"bold"},u.t("profile.explorer.label")),Ne.createElement(RBe,null))))}function Zye({action:t,icon:e,label:n,testId:r,url:s}){const a=fu();return Ne.createElement(Cn,{...s?{as:"a",href:s,rel:"noreferrer noopener",target:"_blank"}:{as:"button",type:"button"},background:{base:"profileAction",...a?{}:{hover:"profileActionHover"}},borderRadius:"menuButton",boxShadow:"profileDetailsAction",className:uu({active:"shrinkSm",hover:a?void 0:"grow"}),display:"flex",onClick:t,padding:a?"6":"8",style:{willChange:"transform"},testId:r,transition:"default",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"1",justifyContent:"center",paddingTop:"2",width:"full"},Ne.createElement(Cn,{color:"modalText",height:"max"},e),Ne.createElement(Cn,null,Ne.createElement(Rs,{color:"modalText",size:a?"12":"13",weight:"semibold"},n))))}function yDt({address:t,ensAvatar:e,ensName:n,balance:r,onClose:s,onDisconnect:a}){const o=m.useContext(Lce),[l,c]=m.useState(!1),u=m.useCallback(()=>{t&&(navigator.clipboard.writeText(t),c(!0))},[t]);if(m.useEffect(()=>{if(l){const C=setTimeout(()=>{c(!1)},1500);return()=>clearTimeout(C)}},[l]),!t)return null;const d=n?OBe(n):FBe(t),f=r==null?void 0:r.formatted,x=f?IBe(Number.parseFloat(f)):void 0,g="rk_profile_title",y=fu(),{i18n:v}=m.useContext(fc);return Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{display:"flex",flexDirection:"column"},Ne.createElement(Cn,{background:"profileForeground",padding:"16"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:y?"16":"12",justifyContent:"center",margin:"8",style:{textAlign:"center"}},Ne.createElement(Cn,{style:{position:"absolute",right:16,top:16,willChange:"transform"}},Ne.createElement(l5,{onClose:s}))," ",Ne.createElement(Cn,{marginTop:y?"24":"0"},Ne.createElement(IRt,{address:t,imageUrl:e,size:y?82:74})),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:y?"4":"0",textAlign:"center"},Ne.createElement(Cn,{textAlign:"center"},Ne.createElement(Rs,{as:"h1",color:"modalText",id:g,size:y?"20":"18",weight:"heavy"},d)),!!r&&Ne.createElement(Cn,{textAlign:"center"},Ne.createElement(Rs,{as:"h1",color:"modalTextSecondary",id:g,size:y?"16":"14",weight:"semibold"},x," ",r.symbol)))),Ne.createElement(Cn,{display:"flex",flexDirection:"row",gap:"8",margin:"2",marginTop:"16"},Ne.createElement(Zye,{action:u,icon:l?Ne.createElement(cDt,null):Ne.createElement(uDt,null),label:l?v.t("profile.copy_address.copied"):v.t("profile.copy_address.label")}),Ne.createElement(Zye,{action:a,icon:Ne.createElement(dDt,null),label:v.t("profile.disconnect.label"),testId:"disconnect-button"}))),o&&Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{background:"generalBorder",height:"1",marginTop:"-1"}),Ne.createElement(Cn,null,Ne.createElement(bDt,{address:t})))))}function vDt({onClose:t,open:e}){const{address:n}=ns(),{balance:r,ensAvatar:s,ensName:a}=mBe({address:n,includeBalance:e}),{disconnect:o}=w$();return n?Ne.createElement(Ne.Fragment,null,n&&Ne.createElement(IL,{onClose:t,open:e,titleId:"rk_account_modal_title"},Ne.createElement(FL,{bottomSheetOnMobile:!0,padding:"0"},Ne.createElement(yDt,{address:n,ensAvatar:s,ensName:a,balance:r,onClose:t,onDisconnect:o})))):null}var wDt=({size:t})=>Ne.createElement("svg",{fill:"none",height:t,viewBox:"0 0 28 28",width:t,xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Disconnect"),Ne.createElement("path",{d:"M6.742 22.195h8.367c1.774 0 2.743-.968 2.743-2.758V16.11h-2.016v3.11c0 .625-.305.96-.969.96H6.984c-.664 0-.968-.335-.968-.96V7.984c0-.632.304-.968.968-.968h7.883c.664 0 .969.336.969.968v3.133h2.016v-3.36c0-1.78-.97-2.757-2.743-2.757H6.742C4.97 5 4 5.977 4 7.758v11.68c0 1.789.969 2.757 2.742 2.757Zm5.438-7.703h7.601l1.149-.07-.602.406-1.008.938a.816.816 0 0 0-.258.593c0 .407.313.782.758.782.227 0 .39-.086.547-.243l2.492-2.593c.235-.235.313-.47.313-.711 0-.242-.078-.477-.313-.719l-2.492-2.586c-.156-.156-.32-.25-.547-.25-.445 0-.758.367-.758.781 0 .227.094.446.258.594l1.008.945.602.407-1.149-.079H12.18a.904.904 0 0 0 0 1.805Z",fill:"currentColor"})),CDt="v9horb0",zce=Ne.forwardRef(({children:t,currentlySelected:e=!1,onClick:n,testId:r,...s},a)=>{const o=fu();return Ne.createElement(Cn,{as:"button",borderRadius:"menuButton",disabled:e,display:"flex",onClick:n,ref:a,testId:r,type:"button"},Ne.createElement(Cn,{borderRadius:"menuButton",className:[o?CDt:void 0,!e&&uu({active:"shrink"})],padding:o?"8":"6",transition:"default",width:"full",...e?{background:"accentColor",borderColor:"selectedOptionBorder",borderStyle:"solid",borderWidth:"1",boxShadow:"selectedOption",color:"accentColorForeground"}:{background:{hover:"menuItemBackground"},color:"modalText",transition:"default"},...s},t))});zce.displayName="MenuButton";var SDt=({chainId:t,currentChainId:e,switchChain:n,chainIconSize:r,isLoading:s,src:a,name:o,iconBackground:l,idx:c})=>{const u=fu(),{i18n:d}=m.useContext(fc),f=xj(),x=e===t;return Ne.createElement(m.Fragment,null,Ne.createElement(zce,{currentlySelected:x,onClick:x?void 0:()=>n({chainId:t}),testId:`chain-option-${t}`},Ne.createElement(Cn,{fontFamily:"body",fontSize:"16",fontWeight:"bold"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:r},a&&Ne.createElement(Cn,{height:"full",marginRight:"8"},Ne.createElement(Rc,{alt:o,background:l,borderRadius:"full",height:r,src:a,width:r,testId:`chain-option-${t}-icon`})),Ne.createElement("div",null,o??o)),x&&Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},Ne.createElement(Rs,{color:"accentColorForeground",size:"14",weight:"medium"},d.t("chains.connected")),Ne.createElement(Cn,{background:"connectionIndicator",borderColor:"selectedOptionBorder",borderRadius:"full",borderStyle:"solid",borderWidth:"1",height:"8",marginLeft:"8",width:"8"})),s&&Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",marginRight:"6"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"medium"},d.t("chains.confirm")),Ne.createElement(Cn,{background:"standby",borderRadius:"full",height:"8",marginLeft:"8",width:"8"}))))),u&&c<f.length-1&&Ne.createElement(Cn,{background:"generalBorderDim",height:"1",marginX:"8"}))},NDt=SDt,ADt="_18dqw9x0",jDt="_18dqw9x1";function EDt({onClose:t,open:e}){const{chainId:n}=ns(),{chains:r}=Tl(),[s,a]=m.useState(null),{switchChain:o}=Noe({mutation:{onMutate:({chainId:y})=>{a(y)},onSuccess:()=>{s&&a(null)},onError:()=>{s&&a(null)},onSettled:()=>{t()}}}),{i18n:l}=m.useContext(fc),{disconnect:c}=w$(),u="rk_chain_modal_title",d=fu(),f=r.some(y=>y.id===n),x=d?"36":"28",g=xj();return n?Ne.createElement(IL,{onClose:t,open:e,titleId:u},Ne.createElement(FL,{bottomSheetOnMobile:!0,paddingBottom:"0"},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"14"},Ne.createElement(Cn,{display:"flex",flexDirection:"row",justifyContent:"space-between"},d&&Ne.createElement(Cn,{width:"30"}),Ne.createElement(Cn,{paddingBottom:"0",paddingLeft:"8",paddingTop:"4"},Ne.createElement(Rs,{as:"h1",color:"modalText",id:u,size:d?"20":"18",weight:"heavy"},l.t("chains.title"))),Ne.createElement(l5,{onClose:t})),!f&&Ne.createElement(Cn,{marginX:"8",textAlign:d?"center":"left"},Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},l.t("chains.wrong_network"))),Ne.createElement(Cn,{className:d?jDt:ADt,display:"flex",flexDirection:"column",gap:"4",padding:"2",paddingBottom:"16"},g.map(({iconBackground:y,iconUrl:v,id:C,name:N},P)=>Ne.createElement(NDt,{key:C,chainId:C,currentChainId:n,switchChain:o,chainIconSize:x,isLoading:s===C,src:v,name:N,iconBackground:y,idx:P})),!f&&Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{background:"generalBorderDim",height:"1",marginX:"8"}),Ne.createElement(zce,{onClick:()=>c(),testId:"chain-option-disconnect"},Ne.createElement(Cn,{color:"error",fontFamily:"body",fontSize:"16",fontWeight:"bold"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",height:x},Ne.createElement(Cn,{alignItems:"center",color:"error",height:x,justifyContent:"center",marginRight:"8"},Ne.createElement(wDt,{size:Number(x)})),Ne.createElement("div",null,l.t("chains.disconnect"))))))))))):null}function _Dt(t,e){const n={};for(const r of t){const s=e(r);s&&(n[s]||(n[s]=[]),n[s].push(r))}return n}var Hce=({children:t,href:e})=>Ne.createElement(Cn,{as:"a",color:"accentColor",href:e,rel:"noreferrer",target:"_blank"},t),Vce=({children:t})=>Ne.createElement(Rs,{color:"modalTextSecondary",size:"12",weight:"medium"},t);function Jye({compactModeEnabled:t=!1,getWallet:e}){const{disclaimer:n,learnMoreUrl:r}=m.useContext(WT),{i18n:s}=m.useContext(fc);return Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{alignItems:"center",color:"accentColor",display:"flex",flexDirection:"column",height:"full",justifyContent:"space-around"},Ne.createElement(Cn,{marginBottom:"10"},!t&&Ne.createElement(Rs,{color:"modalText",size:"18",weight:"heavy"},s.t("intro.title"))),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"32",justifyContent:"center",marginY:"20",style:{maxWidth:312}},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ne.createElement(Cn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},Ne.createElement($Lt,null)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.digital_asset.title")),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.digital_asset.description")))),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ne.createElement(Cn,{borderRadius:"6",height:"48",minWidth:"48",width:"48"},Ne.createElement(zLt,null)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("intro.login.title")),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},s.t("intro.login.description"))))),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",margin:"10"},Ne.createElement(vd,{label:s.t("intro.get.label"),onClick:e}),Ne.createElement(Cn,{as:"a",className:uu({active:"shrink",hover:"grow"}),display:"block",href:r,paddingX:"12",paddingY:"4",rel:"noreferrer",style:{willChange:"transform"},target:"_blank",transition:"default"},Ne.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},s.t("intro.learn_more.label")))),n&&!t&&Ne.createElement(Cn,{marginBottom:"8",marginTop:"12",textAlign:"center"},Ne.createElement(n,{Link:Hce,Text:Vce}))))}var LBe=()=>Ne.createElement("svg",{fill:"none",height:"17",viewBox:"0 0 11 17",width:"11",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Back"),Ne.createElement("path",{d:"M0.99707 8.6543C0.99707 9.08496 1.15527 9.44531 1.51562 9.79688L8.16016 16.3096C8.43262 16.5732 8.74902 16.7051 9.13574 16.7051C9.90918 16.7051 10.5508 16.0811 10.5508 15.3076C10.5508 14.9121 10.3838 14.5605 10.0938 14.2705L4.30176 8.64551L10.0938 3.0293C10.3838 2.74805 10.5508 2.3877 10.5508 2.00098C10.5508 1.23633 9.90918 0.603516 9.13574 0.603516C8.74902 0.603516 8.43262 0.735352 8.16016 0.999023L1.51562 7.51172C1.15527 7.85449 1.00586 8.21484 0.99707 8.6543Z",fill:"currentColor"})),kDt=()=>Ne.createElement("svg",{fill:"none",height:"12",viewBox:"0 0 8 12",width:"8",xmlns:"http://www.w3.org/2000/svg"},Ne.createElement("title",null,"Info"),Ne.createElement("path",{d:"M3.64258 7.99609C4.19336 7.99609 4.5625 7.73828 4.68555 7.24609C4.69141 7.21094 4.70312 7.16406 4.70898 7.13477C4.80859 6.60742 5.05469 6.35547 6.04492 5.76367C7.14648 5.10156 7.67969 4.3457 7.67969 3.24414C7.67969 1.39844 6.17383 0.255859 3.95898 0.255859C2.32422 0.255859 1.05859 0.894531 0.548828 1.86719C0.396484 2.14844 0.320312 2.44727 0.320312 2.74023C0.314453 3.37305 0.742188 3.79492 1.42188 3.79492C1.91406 3.79492 2.33594 3.54883 2.53516 3.11523C2.78711 2.47656 3.23242 2.21289 3.83594 2.21289C4.55664 2.21289 5.10742 2.65234 5.10742 3.29102C5.10742 3.9707 4.7793 4.29883 3.81836 4.87891C3.02148 5.36523 2.50586 5.92773 2.50586 6.76562V6.90039C2.50586 7.55664 2.96289 7.99609 3.64258 7.99609ZM3.67188 11.4473C4.42773 11.4473 5.04297 10.8672 5.04297 10.1406C5.04297 9.41406 4.42773 8.83984 3.67188 8.83984C2.91602 8.83984 2.30664 9.41406 2.30664 10.1406C2.30664 10.8672 2.91602 11.4473 3.67188 11.4473Z",fill:"currentColor"})),TDt=({"aria-label":t="Info",onClick:e})=>{const n=fu();return Ne.createElement(Cn,{alignItems:"center","aria-label":t,as:"button",background:"closeButtonBackground",borderColor:"actionButtonBorder",borderRadius:"full",borderStyle:"solid",borderWidth:n?"0":"1",className:uu({active:"shrinkSm",hover:"growLg"}),color:"closeButton",display:"flex",height:n?"30":"28",justifyContent:"center",onClick:e,style:{willChange:"transform"},transition:"default",type:"button",width:n?"30":"28"},Ne.createElement(kDt,null))},DBe=t=>{const e=m.useRef(null),n=m.useContext(wBe),r=Oce(t);return m.useEffect(()=>{if(n&&e.current&&r)return IDt(e.current,r)},[n,r]),e},PDt=()=>{const t="_rk_coolMode",e=document.getElementById(t);if(e)return e;const n=document.createElement("div");return n.setAttribute("id",t),n.setAttribute("style",["overflow:hidden","position:fixed","height:100%","top:0","left:0","right:0","bottom:0","pointer-events:none","z-index:2147483647"].join(";")),document.body.appendChild(n),n},e2e=0;function IDt(t,e){e2e++;const n=[15,20,25,35,45],r=35;let s=[],a=!1,o=0,l=0;const c=PDt();function u(){const M=n[Math.floor(Math.random()*n.length)],F=Math.random()*10,$=Math.random()*25,L=Math.random()*360,z=Math.random()*35*(Math.random()<=.5?-1:1),X=l-M/2,ne=o-M/2,J=Math.random()<=.5?-1:1,K=document.createElement("div");K.innerHTML=`<img src="${e}" width="${M}" height="${M}" style="border-radius: 25%">`,K.setAttribute("style",["position:absolute","will-change:transform",`top:${X}px`,`left:${ne}px`,`transform:rotate(${L}deg)`].join(";")),c.appendChild(K),s.push({direction:J,element:K,left:ne,size:M,speedHorz:F,speedUp:$,spinSpeed:z,spinVal:L,top:X})}function d(){for(const M of s)M.left=M.left-M.speedHorz*M.direction,M.top=M.top-M.speedUp,M.speedUp=Math.min(M.size,M.speedUp-1),M.spinVal=M.spinVal+M.spinSpeed,M.top>=Math.max(window.innerHeight,document.body.clientHeight)+M.size&&(s=s.filter(F=>F!==M),M.element.remove()),M.element.setAttribute("style",["position:absolute","will-change:transform",`top:${M.top}px`,`left:${M.left}px`,`transform:rotate(${M.spinVal}deg)`].join(";"))}let f;function x(){a&&s.length<r&&u(),d(),f=requestAnimationFrame(x)}x();const g="ontouchstart"in window||navigator.msMaxTouchPoints,y=g?"touchstart":"mousedown",v=g?"touchend":"mouseup",C=g?"touchmove":"mousemove",N=M=>{var F,$;"touches"in M?(o=(F=M.touches)==null?void 0:F[0].clientX,l=($=M.touches)==null?void 0:$[0].clientY):(o=M.clientX,l=M.clientY)},P=M=>{N(M),a=!0},T=()=>{a=!1};return t.addEventListener(C,N,{passive:!1}),t.addEventListener(y,P),t.addEventListener(v,T),t.addEventListener("mouseleave",T),()=>{t.removeEventListener(C,N),t.removeEventListener(y,P),t.removeEventListener(v,T),t.removeEventListener("mouseleave",T);const M=setInterval(()=>{f&&s.length===0&&(cancelAnimationFrame(f),clearInterval(M),--e2e===0&&c.remove())},500)}}var FDt="g5kl0l0",BBe=({as:t="button",currentlySelected:e=!1,iconBackground:n,iconUrl:r,name:s,onClick:a,ready:o,recent:l,testId:c,isRainbowKitConnector:u,...d})=>{const f=DBe(r),[x,g]=Ne.useState(!1),{i18n:y}=Ne.useContext(fc);return Ne.createElement(Cn,{display:"flex",flexDirection:"column",onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),ref:f},Ne.createElement(Cn,{as:t,borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:e?void 0:[FDt,uu({active:"shrink"})],disabled:e,onClick:a,padding:"5",style:{willChange:"transform"},testId:c,transition:"default",width:"full",...e?{background:"accentColor",borderColor:"selectedOptionBorder",boxShadow:"selectedWallet"}:{background:{hover:"menuItemBackground"}},...d},Ne.createElement(Cn,{color:e?"accentColorForeground":"modalText",disabled:!o,fontFamily:"body",fontSize:"16",fontWeight:"bold",transition:"default"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"12"},Ne.createElement(Rc,{background:n,...!x&&u?{borderColor:"actionButtonBorder"}:{},useAsImage:!u,borderRadius:"6",height:"28",src:r,width:"28"}),Ne.createElement(Cn,null,Ne.createElement(Cn,{style:{marginTop:l?-2:void 0},maxWidth:"200"},s),l&&Ne.createElement(Rs,{color:e?"accentColorForeground":"accentColor",size:"12",style:{lineHeight:1,marginTop:-1},weight:"medium"},y.t("connect.recent")))))))};BBe.displayName="ModalSelection";var ODt="rk-latest-id";function MDt(t){localStorage.setItem(ODt,t)}var mq=(t,e=1)=>{let n=t.replace("#","");n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);const r=Number.parseInt(n.substring(0,2),16),s=Number.parseInt(n.substring(2,4),16),a=Number.parseInt(n.substring(4,6),16);return e>1&&e<=100&&(e=e/100),`rgba(${r},${s},${a},${e})`},RDt=t=>t?[mq(t,.2),mq(t,.14),mq(t,.1)]:null,LDt=t=>/^#([0-9a-f]{3}){1,2}$/i.test(t),$Be=async()=>(await os(async()=>{const{default:t}=await import("./connect-MR6XDLIE-BET5HMNk.js");return{default:t}},[])).default,DDt=()=>px($Be),BDt=()=>Ne.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:$Be,width:"48"}),UBe=async()=>(await os(async()=>{const{default:t}=await import("./create-X4WFHLCW-De9pC3ym.js");return{default:t}},[])).default,zBe=()=>px(UBe),$Dt=()=>Ne.createElement(Rc,{background:"#e3a5e8",borderColor:"generalBorder",borderRadius:"10",height:"48",src:UBe,width:"48"}),HBe=async()=>(await os(async()=>{const{default:t}=await import("./refresh-HJGJRASX-D0rkc63_.js");return{default:t}},[])).default,UDt=()=>px(HBe),zDt=()=>Ne.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:HBe,width:"48"}),VBe=async()=>(await os(async()=>{const{default:t}=await import("./scan-DEOT2M37-1-mJ5OyF.js");return{default:t}},[])).default,WBe=()=>px(VBe),HDt=()=>Ne.createElement(Rc,{background:"#515a70",borderColor:"generalBorder",borderRadius:"10",height:"48",src:VBe,width:"48"}),VDt="_1vwt0cg0",WDt="_1vwt0cg2 ju367v7a ju367v7v",qDt="_1vwt0cg3",GDt="_1vwt0cg4",KDt=(t,e)=>{const n=Array.prototype.slice.call(dRt.create(t,{errorCorrectionLevel:e}).modules.data,0),r=Math.sqrt(n.length);return n.reduce((s,a,o)=>(o%r===0?s.push([a]):s[s.length-1].push(a))&&s,[])};function qBe({ecl:t="M",logoBackground:e,logoMargin:n=10,logoSize:r=50,logoUrl:s,size:a=200,uri:o}){const l="20",c=a-Number.parseInt(l,10)*2,u=m.useMemo(()=>{const x=[],g=KDt(o,t),y=c/g.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:T,y:M})=>{const F=(g.length-7)*y*T,$=(g.length-7)*y*M;for(let L=0;L<3;L++)x.push(Ne.createElement("rect",{fill:L%2!==0?"white":"black",height:y*(7-L*2),key:`${L}-${T}-${M}`,rx:(L-2)*-5+(L===0?2:0),ry:(L-2)*-5+(L===0?2:0),width:y*(7-L*2),x:F+y*L,y:$+y*L}))});const C=Math.floor((r+25)/y),N=g.length/2-C/2,P=g.length/2+C/2-1;return g.forEach((T,M)=>{T.forEach((F,$)=>{g[M][$]&&(M<7&&$<7||M>g.length-8&&$<7||M<7&&$>g.length-8||M>N&&M<P&&$>N&&$<P||x.push(Ne.createElement("circle",{cx:M*y+y/2,cy:$*y+y/2,fill:"black",key:`circle-${M}-${$}`,r:y/3})))})}),x},[t,r,c,o]),d=c/2-r/2,f=r+n*2;return Ne.createElement(Cn,{borderColor:"generalBorder",borderRadius:"menuButton",borderStyle:"solid",borderWidth:"1",className:VDt,padding:l,width:"max"},Ne.createElement(Cn,{style:{height:c,userSelect:"none",width:c},userSelect:"none"},Ne.createElement(Cn,{display:"flex",justifyContent:"center",position:"relative",style:{height:0,top:d,width:c},width:"full"},Ne.createElement(Rc,{background:e,borderColor:{custom:"rgba(0, 0, 0, 0.06)"},borderRadius:"13",height:r,src:s,width:r})),Ne.createElement("svg",{height:c,style:{all:"revert"},width:c},Ne.createElement("title",null,"QR Code"),Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"clip-wrapper"},Ne.createElement("rect",{height:f,width:f})),Ne.createElement("clipPath",{id:"clip-logo"},Ne.createElement("rect",{height:r,width:r}))),Ne.createElement("rect",{fill:"transparent",height:c,width:c}),u)))}var GBe=async()=>{switch(Bce()){case"Arc":return(await os(async()=>{const{default:e}=await import("./Arc-R3PUWRPJ-CUdEQO8X.js");return{default:e}},[])).default;case"Brave":return(await os(async()=>{const{default:e}=await import("./Brave-24BM36UM-C6C5mkTK.js");return{default:e}},[])).default;case"Chrome":return(await os(async()=>{const{default:e}=await import("./Chrome-TLI42HDP-BgiVz-ma.js");return{default:e}},[])).default;case"Edge":return(await os(async()=>{const{default:e}=await import("./Edge-AZ34LAFM-EBh9cG_z.js");return{default:e}},[])).default;case"Firefox":return(await os(async()=>{const{default:e}=await import("./Firefox-ZDK7RHKK-5nyhB0sj.js");return{default:e}},[])).default;case"Opera":return(await os(async()=>{const{default:e}=await import("./Opera-BKMCKUXC-CCypmVaM.js");return{default:e}},[])).default;case"Safari":return(await os(async()=>{const{default:e}=await import("./Safari-PXQIVS6N-B-Lfxb9r.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await import("./Browser-4R4QKTV2-D3ON1q-S.js");return{default:e}},[])).default}},YDt=()=>px(GBe),KBe=async()=>{switch(Uce()){case"Windows":return(await os(async()=>{const{default:e}=await import("./Windows-GTAT3OTE-K9Pt3pUF.js");return{default:e}},[])).default;case"macOS":return(await os(async()=>{const{default:e}=await import("./Macos-5QL4JBJE-DLNYPiln.js");return{default:e}},[])).default;case"Linux":return(await os(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default;default:return(await os(async()=>{const{default:e}=await import("./Linux-VYP66PDO--MOvpQUa.js");return{default:e}},[])).default}},XDt=()=>px(KBe);function QDt({getWalletDownload:t,compactModeEnabled:e}){const r=L_().filter(a=>a.isRainbowKitConnector).splice(0,5),{i18n:s}=m.useContext(fc);return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginTop:"18",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"28",height:"full",width:"full"},r==null?void 0:r.filter(a=>{var o;return a.extensionDownloadUrl||a.desktopDownloadUrl||a.qrCode&&((o=a.downloadUrls)==null?void 0:o.qrCode)}).map(a=>{const{downloadUrls:o,iconBackground:l,iconUrl:c,id:u,name:d,qrCode:f}=a,x=(o==null?void 0:o.qrCode)&&f,g=!!a.extensionDownloadUrl,y=(o==null?void 0:o.qrCode)&&g,v=(o==null?void 0:o.qrCode)&&!!a.desktopDownloadUrl;return Ne.createElement(Cn,{alignItems:"center",display:"flex",gap:"16",justifyContent:"space-between",key:a.id,width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16"},Ne.createElement(Rc,{background:l,borderColor:"actionButtonBorder",borderRadius:"10",height:"48",src:c,width:"48"}),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"2"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},d),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},y?s.t("get.mobile_and_extension.description"):v?s.t("get.mobile_and_desktop.description"):x?s.t("get.mobile.description"):g?s.t("get.extension.description"):null))),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(vd,{label:s.t("get.action.label"),onClick:()=>t(u),type:"secondary"})))})),Ne.createElement(Cn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"column",gap:"8",justifyContent:"space-between",marginBottom:"4",paddingY:"8",style:{maxWidth:275,textAlign:"center"}},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},s.t("get.looking_for.title")),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e?s.t("get.looking_for.desktop.compact_description"):s.t("get.looking_for.desktop.wide_description"))))}var xq="44";function ZDt({changeWalletStep:t,compactModeEnabled:e,connectionError:n,onClose:r,qrCodeUri:s,reconnect:a,wallet:o}){const{downloadUrls:l,iconBackground:c,iconUrl:u,name:d,qrCode:f,ready:x,showWalletConnectModal:g,getDesktopUri:y}=o,v=!!y,C=Dce(),{i18n:N}=m.useContext(fc),P=!!o.extensionDownloadUrl,T=(l==null?void 0:l.qrCode)&&P,M=(l==null?void 0:l.qrCode)&&!!o.desktopDownloadUrl,F=f&&s,$=async()=>{const ne=await(y==null?void 0:y());window.open(ne,C?"_blank":"_self")},L=g?{description:e?N.t("connect.walletconnect.description.compact"):N.t("connect.walletconnect.description.full"),label:N.t("connect.walletconnect.open.label"),onClick:()=>{r(),g()}}:F?{description:N.t("connect.secondary_action.get.description",{wallet:d}),label:N.t("connect.secondary_action.get.label"),onClick:()=>t(T||M?"DOWNLOAD_OPTIONS":"DOWNLOAD")}:null,{width:z}=CBe(),X=z&&z<768;return m.useEffect(()=>{YDt(),XDt()},[]),Ne.createElement(Cn,{display:"flex",flexDirection:"column",height:"full",width:"full"},F?Ne.createElement(Cn,{alignItems:"center",display:"flex",height:"full",justifyContent:"center"},Ne.createElement(qBe,{logoBackground:c,logoSize:e?60:72,logoUrl:u,size:e?318:X?Math.max(280,Math.min(z-308,382)):382,uri:s})):Ne.createElement(Cn,{alignItems:"center",display:"flex",justifyContent:"center",style:{flexGrow:1}},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8"},Ne.createElement(Cn,{borderRadius:"10",height:xq,overflow:"hidden"},Ne.createElement(Rc,{useAsImage:!o.isRainbowKitConnector,height:xq,src:u,width:xq})),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"4",paddingX:"32",style:{textAlign:"center"}},Ne.createElement(Rs,{color:"modalText",size:"18",weight:"bold"},x?N.t("connect.status.opening",{wallet:d}):P?N.t("connect.status.not_installed",{wallet:d}):N.t("connect.status.not_available",{wallet:d})),!x&&P?Ne.createElement(Cn,{paddingTop:"20"},Ne.createElement(vd,{href:o.extensionDownloadUrl,label:N.t("connect.secondary_action.install.label"),type:"secondary"})):null,x&&!F&&Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",textAlign:"center",weight:"medium"},N.t("connect.status.confirm"))),Ne.createElement(Cn,{alignItems:"center",color:"modalText",display:"flex",flexDirection:"row",height:"32",marginTop:"8"},n?Ne.createElement(vd,{label:N.t("connect.secondary_action.retry.label"),onClick:async()=>{v&&$(),a(o)}}):Ne.createElement(Cn,{color:"modalTextSecondary"},Ne.createElement(R_,null))))))),Ne.createElement(Cn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"28",justifyContent:"space-between",marginTop:"12"},x&&L&&Ne.createElement(Ne.Fragment,null,Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},L.description),Ne.createElement(vd,{label:L.label,onClick:L.onClick,type:"secondary"}))))}var gq=({actionLabel:t,description:e,iconAccent:n,iconBackground:r,iconUrl:s,isCompact:a,onAction:o,title:l,url:c,variant:u})=>{const d=u==="browser",f=!d&&n&&RDt(n);return Ne.createElement(Cn,{alignItems:"center",borderRadius:"13",display:"flex",justifyContent:"center",overflow:"hidden",paddingX:a?"18":"44",position:"relative",style:{flex:1,isolation:"isolate"},width:"full"},Ne.createElement(Cn,{borderColor:"actionButtonBorder",borderRadius:"13",borderStyle:"solid",borderWidth:"1",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0",zIndex:1}}),d&&Ne.createElement(Cn,{background:"downloadTopCardBackground",height:"full",position:"absolute",style:{zIndex:0},width:"full"},Ne.createElement(Cn,{display:"flex",flexDirection:"row",justifyContent:"space-between",style:{bottom:"0",filter:"blur(20px)",left:"0",position:"absolute",right:"0",top:"0",transform:"translate3d(0, 0, 0)"}},Ne.createElement(Cn,{style:{filter:"blur(100px)",marginLeft:-27,marginTop:-20,opacity:.6,transform:"translate3d(0, 0, 0)"}},Ne.createElement(Rc,{borderRadius:"full",height:"200",src:s,width:"200"})),Ne.createElement(Cn,{style:{filter:"blur(100px)",marginRight:0,marginTop:105,opacity:.6,overflow:"auto",transform:"translate3d(0, 0, 0)"}},Ne.createElement(Rc,{borderRadius:"full",height:"200",src:s,width:"200"})))),!d&&f&&Ne.createElement(Cn,{background:"downloadBottomCardBackground",style:{bottom:"0",left:"0",position:"absolute",right:"0",top:"0"}},Ne.createElement(Cn,{position:"absolute",style:{background:`radial-gradient(50% 50% at 50% 50%, ${f[0]} 0%, ${f[1]} 25%, rgba(0,0,0,0) 100%)`,height:564,left:-215,top:-197,transform:"translate3d(0, 0, 0)",width:564}}),Ne.createElement(Cn,{position:"absolute",style:{background:`radial-gradient(50% 50% at 50% 50%, ${f[2]} 0%, rgba(0, 0, 0, 0) 100%)`,height:564,left:-1,top:-76,transform:"translate3d(0, 0, 0)",width:564}})),Ne.createElement(Cn,{alignItems:"flex-start",display:"flex",flexDirection:"row",gap:"24",height:"max",justifyContent:"center",style:{zIndex:1}},Ne.createElement(Cn,null,Ne.createElement(Rc,{height:"60",src:s,width:"60",...r?{background:r,borderColor:"generalBorder",borderRadius:"10"}:null})),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4",style:{flex:1},width:"full"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},l),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e),Ne.createElement(Cn,{marginTop:"14",width:"max"},Ne.createElement(vd,{href:c,label:t,onClick:o,size:"medium"})))))};function JDt({changeWalletStep:t,wallet:e}){const n=Bce(),r=Uce(),a=m.useContext(EU)==="compact",{desktop:o,desktopDownloadUrl:l,extension:c,extensionDownloadUrl:u,mobileDownloadUrl:d}=e,{i18n:f}=m.useContext(fc);return m.useEffect(()=>{zBe(),WBe(),UDt(),DDt()},[]),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",marginBottom:"8",marginTop:"4",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"8",height:"full",justifyContent:"center",width:"full"},u&&Ne.createElement(gq,{actionLabel:f.t("get_options.extension.download.label",{browser:n}),description:f.t("get_options.extension.description"),iconUrl:GBe,isCompact:a,onAction:()=>t(c!=null&&c.instructions?"INSTRUCTIONS_EXTENSION":"CONNECT"),title:f.t("get_options.extension.title",{wallet:e.name,browser:n}),url:u,variant:"browser"}),l&&Ne.createElement(gq,{actionLabel:f.t("get_options.desktop.download.label",{platform:r}),description:f.t("get_options.desktop.description"),iconUrl:KBe,isCompact:a,onAction:()=>t(o!=null&&o.instructions?"INSTRUCTIONS_DESKTOP":"CONNECT"),title:f.t("get_options.desktop.title",{wallet:e.name,platform:r}),url:l,variant:"desktop"}),d&&Ne.createElement(gq,{actionLabel:f.t("get_options.mobile.download.label",{wallet:e.name}),description:f.t("get_options.mobile.description"),iconAccent:e.iconAccent,iconBackground:e.iconBackground,iconUrl:e.iconUrl,isCompact:a,onAction:()=>{t("DOWNLOAD")},title:f.t("get_options.mobile.title",{wallet:e.name}),variant:"app"})))}function eBt({changeWalletStep:t,wallet:e}){const{downloadUrls:n,qrCode:r}=e,{i18n:s}=m.useContext(fc);return m.useEffect(()=>{zBe(),WBe()},[]),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"24",height:"full",width:"full"},Ne.createElement(Cn,{style:{maxWidth:220,textAlign:"center"}},Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"semibold"},s.t("get_mobile.description"))),Ne.createElement(Cn,{height:"full"},n!=null&&n.qrCode?Ne.createElement(qBe,{logoSize:0,size:268,uri:n.qrCode}):null),Ne.createElement(Cn,{alignItems:"center",borderRadius:"10",display:"flex",flexDirection:"row",gap:"8",height:"34",justifyContent:"space-between",marginBottom:"12",paddingY:"8"},Ne.createElement(vd,{label:s.t("get_mobile.continue.label"),onClick:()=>t(r!=null&&r.instructions?"INSTRUCTIONS_MOBILE":"CONNECT")})))}var i1={connect:()=>Ne.createElement(BDt,null),create:()=>Ne.createElement($Dt,null),install:t=>Ne.createElement(Rc,{background:t.iconBackground,borderColor:"generalBorder",borderRadius:"10",height:"48",src:t.iconUrl,width:"48"}),refresh:()=>Ne.createElement(zDt,null),scan:()=>Ne.createElement(HDt,null)};function tBt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=m.useContext(fc);return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"28",height:"full",justifyContent:"center",paddingY:"32",style:{maxWidth:320}},(s=(r=e==null?void 0:e.qrCode)==null?void 0:r.instructions)==null?void 0:s.steps.map((l,c)=>{var u;return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},Ne.createElement(Cn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=i1[l.step])==null?void 0:u.call(i1,e)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ne.createElement(vd,{label:n.t("get_instructions.mobile.connect.label"),onClick:()=>t(e)}),Ne.createElement(Cn,{as:"a",className:uu({active:"shrink",hover:"grow"}),display:"block",href:(o=(a=e==null?void 0:e.qrCode)==null?void 0:a.instructions)==null?void 0:o.learnMoreUrl,paddingX:"12",paddingY:"4",rel:"noreferrer",style:{willChange:"transform"},target:"_blank",transition:"default"},Ne.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.mobile.learn_more.label")))))}function nBt({wallet:t}){var n,r,s,a;const{i18n:e}=m.useContext(fc);return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"28",height:"full",justifyContent:"center",paddingY:"32",style:{maxWidth:320}},(r=(n=t==null?void 0:t.extension)==null?void 0:n.instructions)==null?void 0:r.steps.map((o,l)=>{var c;return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:l},Ne.createElement(Cn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(c=i1[o.step])==null?void 0:c.call(i1,t)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},e.t(o.title,void 0,{rawKeyIfTranslationMissing:!0})),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},e.t(o.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ne.createElement(vd,{label:e.t("get_instructions.extension.refresh.label"),onClick:window.location.reload.bind(window.location)}),Ne.createElement(Cn,{as:"a",className:uu({active:"shrink",hover:"grow"}),display:"block",href:(a=(s=t==null?void 0:t.extension)==null?void 0:s.instructions)==null?void 0:a.learnMoreUrl,paddingX:"12",paddingY:"4",rel:"noreferrer",style:{willChange:"transform"},target:"_blank",transition:"default"},Ne.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},e.t("get_instructions.extension.learn_more.label")))))}function rBt({connectWallet:t,wallet:e}){var r,s,a,o;const{i18n:n}=m.useContext(fc);return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",width:"full"},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"28",height:"full",justifyContent:"center",paddingY:"32",style:{maxWidth:320}},(s=(r=e==null?void 0:e.desktop)==null?void 0:r.instructions)==null?void 0:s.steps.map((l,c)=>{var u;return Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"16",key:c},Ne.createElement(Cn,{borderRadius:"10",height:"48",minWidth:"48",overflow:"hidden",position:"relative",width:"48"},(u=i1[l.step])==null?void 0:u.call(i1,e)),Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},Ne.createElement(Rs,{color:"modalText",size:"14",weight:"bold"},n.t(l.title,void 0,{rawKeyIfTranslationMissing:!0})),Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},n.t(l.description,void 0,{rawKeyIfTranslationMissing:!0}))))})),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"12",justifyContent:"center",marginBottom:"16"},Ne.createElement(vd,{label:n.t("get_instructions.desktop.connect.label"),onClick:()=>t(e)}),Ne.createElement(Cn,{as:"a",className:uu({active:"shrink",hover:"grow"}),display:"block",href:(o=(a=e==null?void 0:e.desktop)==null?void 0:a.instructions)==null?void 0:o.learnMoreUrl,paddingX:"12",paddingY:"4",rel:"noreferrer",style:{willChange:"transform"},target:"_blank",transition:"default"},Ne.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},n.t("get_instructions.desktop.learn_more.label")))))}function sBt({onClose:t}){const e="rk_connect_title",[n,r]=m.useState(),[s,a]=m.useState(),[o,l]=m.useState(),c=!!(s!=null&&s.qrCode)&&o,[u,d]=m.useState(!1),x=m.useContext(EU)===GT.COMPACT,{disclaimer:g}=m.useContext(WT),{i18n:y}=m.useContext(fc),v=Dce(),C=m.useRef(!1),{connector:N}=m.useContext(qT),T=L_(!N).filter(me=>me.ready||!!me.extensionDownloadUrl).sort((me,we)=>me.groupIndex-we.groupIndex),M=L_(),F=_Dt(T,me=>me.groupName),$=["Recommended","Other","Popular","More","Others","Installed"];m.useEffect(()=>{N&&!C.current&&(te("CONNECT"),ne(N),C.current=!0)},[N]);const L=me=>{var we,xe;d(!1),me.ready&&((xe=(we=me==null?void 0:me.connect)==null?void 0:we.call(me))==null||xe.catch(()=>{d(!0)}))},z=async me=>{const we=T.find(xe=>me.id===xe.id);we!=null&&we.getDesktopUri&&setTimeout(async()=>{var be;const xe=await((be=we==null?void 0:we.getDesktopUri)==null?void 0:be.call(we));xe&&window.open(xe,v?"_blank":"_self")},0)},X=async me=>{var be;const we=T.find(je=>me.id===je.id),xe=await((be=we==null?void 0:we.getQrCodeUri)==null?void 0:be.call(we));l(xe),setTimeout(()=>{a(we),te("CONNECT")},xe?0:50)},ne=async me=>{MDt(me.id),me.ready&&(X(me),z(me)),L(me),r(me.id),me.ready||(a(me),te(me!=null&&me.extensionDownloadUrl?"DOWNLOAD_OPTIONS":"CONNECT"))},J=me=>{var Ie;const we=M.find(Re=>me===Re.id),xe=(Ie=we==null?void 0:we.downloadUrls)==null?void 0:Ie.qrCode,be=!!(we!=null&&we.desktopDownloadUrl),je=!!(we!=null&&we.extensionDownloadUrl);a(we),te(xe&&(je||be)?"DOWNLOAD_OPTIONS":xe?"DOWNLOAD":be?"INSTRUCTIONS_DESKTOP":"INSTRUCTIONS_EXTENSION")},K=()=>{r(void 0),a(void 0),l(void 0)},te=(me,we=!1)=>{we&&me==="GET"&&fe==="GET"?K():!we&&me==="GET"?q("GET"):!we&&me==="CONNECT"&&q("CONNECT"),ae(me)},[fe,q]=m.useState("NONE"),[se,ae]=m.useState("NONE");let W=null,V=null,ee=null,oe;m.useEffect(()=>{d(!1)},[se,s]);const Ce=!!(!!(s!=null&&s.extensionDownloadUrl)&&(s!=null&&s.mobileDownloadUrl));switch(se){case"NONE":W=Ne.createElement(Jye,{getWallet:()=>te("GET")});break;case"LEARN_COMPACT":W=Ne.createElement(Jye,{compactModeEnabled:x,getWallet:()=>te("GET")}),V=y.t("intro.title"),ee="NONE";break;case"GET":W=Ne.createElement(QDt,{getWalletDownload:J,compactModeEnabled:x}),V=y.t("get.title"),ee=x?"LEARN_COMPACT":"NONE";break;case"CONNECT":W=s&&Ne.createElement(ZDt,{changeWalletStep:te,compactModeEnabled:x,connectionError:u,onClose:t,qrCodeUri:o,reconnect:L,wallet:s}),V=c&&(s.name==="WalletConnect"?y.t("connect_scan.fallback_title"):y.t("connect_scan.title",{wallet:s.name})),ee=x?N?null:"NONE":null,oe=x?N?()=>{}:K:()=>{};break;case"DOWNLOAD_OPTIONS":W=s&&Ne.createElement(JDt,{changeWalletStep:te,wallet:s}),V=s&&y.t("get_options.short_title",{wallet:s.name}),ee=N?"CONNECT":x?"NONE":fe;break;case"DOWNLOAD":W=s&&Ne.createElement(eBt,{changeWalletStep:te,wallet:s}),V=s&&y.t("get_mobile.title",{wallet:s.name}),ee=Ce?"DOWNLOAD_OPTIONS":fe;break;case"INSTRUCTIONS_MOBILE":W=s&&Ne.createElement(tBt,{connectWallet:ne,wallet:s}),V=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD";break;case"INSTRUCTIONS_EXTENSION":W=s&&Ne.createElement(nBt,{wallet:s}),V=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD_OPTIONS";break;case"INSTRUCTIONS_DESKTOP":W=s&&Ne.createElement(rBt,{connectWallet:ne,wallet:s}),V=s&&y.t("get_options.title",{wallet:x&&s.shortName||s.name}),ee="DOWNLOAD_OPTIONS";break}return Ne.createElement(Cn,{display:"flex",flexDirection:"row",style:{maxHeight:x?468:504}},(x?se==="NONE":!0)&&Ne.createElement(Cn,{className:x?GDt:qDt,display:"flex",flexDirection:"column",marginTop:"16"},Ne.createElement(Cn,{display:"flex",justifyContent:"space-between"},x&&g&&Ne.createElement(Cn,{marginLeft:"16",width:"28"},Ne.createElement(TDt,{onClick:()=>te("LEARN_COMPACT")})),x&&!g&&Ne.createElement(Cn,{marginLeft:"16",width:"28"}),Ne.createElement(Cn,{marginLeft:x?"0":"6",paddingBottom:"8",paddingTop:"2",paddingX:"18"},Ne.createElement(Rs,{as:"h1",color:"modalText",id:e,size:"18",weight:"heavy",testId:"connect-header-label"},y.t("connect.title"))),x&&Ne.createElement(Cn,{marginRight:"16"},Ne.createElement(l5,{onClose:t}))),Ne.createElement(Cn,{className:WDt,paddingBottom:"18"},Object.entries(F).map(([me,we],xe)=>we.length>0&&Ne.createElement(m.Fragment,{key:xe},me?Ne.createElement(Cn,{marginBottom:"8",marginTop:"16",marginX:"6"},Ne.createElement(Rs,{color:me==="Installed"?"accentColor":"modalTextSecondary",size:"14",weight:"bold"},$.includes(me)?y.t(`connector_group.${me.toLowerCase()}`):me)):null,Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"4"},we.map(be=>Ne.createElement(BBe,{currentlySelected:be.id===n,iconBackground:be.iconBackground,iconUrl:be.iconUrl,key:be.id,name:be.name,onClick:()=>ne(be),ready:be.ready,recent:be.recent,testId:`wallet-option-${be.id}`,isRainbowKitConnector:be.isRainbowKitConnector})))))),x&&Ne.createElement(Ne.Fragment,null,Ne.createElement(Cn,{background:"generalBorder",height:"1",marginTop:"-1"}),g?Ne.createElement(Cn,{paddingX:"24",paddingY:"16",textAlign:"center"},Ne.createElement(g,{Link:Hce,Text:Vce})):Ne.createElement(Cn,{alignItems:"center",display:"flex",justifyContent:"space-between",paddingX:"24",paddingY:"16"},Ne.createElement(Cn,{paddingY:"4"},Ne.createElement(Rs,{color:"modalTextSecondary",size:"14",weight:"medium"},y.t("connect.new_to_ethereum.description"))),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"row",gap:"4",justifyContent:"center"},Ne.createElement(Cn,{className:uu({active:"shrink",hover:"grow"}),cursor:"pointer",onClick:()=>te("LEARN_COMPACT"),paddingY:"4",style:{willChange:"transform"},transition:"default"},Ne.createElement(Rs,{color:"accentColor",size:"14",weight:"bold"},y.t("connect.new_to_ethereum.learn_more.label"))))))),(x?se!=="NONE":!0)&&Ne.createElement(Ne.Fragment,null,!x&&Ne.createElement(Cn,{background:"generalBorder",minWidth:"1",width:"1"}),Ne.createElement(Cn,{display:"flex",flexDirection:"column",margin:"16",style:{flexGrow:1}},Ne.createElement(Cn,{alignItems:"center",display:"flex",justifyContent:"space-between",marginBottom:"12"},Ne.createElement(Cn,{width:"28"},ee&&Ne.createElement(Cn,{as:"button",className:uu({active:"shrinkSm",hover:"growLg"}),color:"accentColor",onClick:()=>{ee&&te(ee,!0),oe==null||oe()},paddingX:"8",paddingY:"4",style:{boxSizing:"content-box",height:17,willChange:"transform"},transition:"default",type:"button"},Ne.createElement(LBe,null))),Ne.createElement(Cn,{display:"flex",justifyContent:"center",style:{flexGrow:1}},V&&Ne.createElement(Rs,{color:"modalText",size:"18",textAlign:"center",weight:"heavy"},V)),Ne.createElement(l5,{onClose:t})),Ne.createElement(Cn,{display:"flex",flexDirection:"column",style:{minHeight:x?396:432}},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"6",height:"full",justifyContent:"center",marginX:"8"},W)))))}var iBt="_1am14412",aBt="_1am14410",oBt="_1am14413",lBt=({wallet:t})=>Ne.createElement("svg",{className:oBt,viewBox:"0 0 86 86",width:"86",height:"86"},Ne.createElement("title",null,"Loading"),Ne.createElement("rect",{x:"3",y:"3",width:80,height:80,rx:20,ry:20,strokeDasharray:`${160/3} ${2*160/3}`,strokeDashoffset:160,className:iBt,style:{stroke:(t==null?void 0:t.iconAccent)||"#0D3887"}}));function YBe({onClose:t,wallet:e,connecting:n}){const{connect:r,iconBackground:s,iconUrl:a,id:o,name:l,getMobileUri:c,ready:u,shortName:d,showWalletConnectModal:f}=e,x=DBe(a),g=m.useRef(!1),{i18n:y}=m.useContext(fc),v=m.useCallback(async()=>{if(o!=="walletConnect"&&(async()=>{const N=await(c==null?void 0:c());if(N)if(N&&GLt({mobileUri:N,name:l}),N.startsWith("http")){const P=document.createElement("a");P.href=N,P.target="_blank",P.rel="noreferrer noopener",P.click()}else window.location.href=N})(),f){f(),t==null||t();return}r==null||r()},[r,c,f,t,l,o]);return m.useEffect(()=>{n&&!g.current&&(v(),g.current=!0)},[n,v]),Ne.createElement(Cn,{as:"button",color:u?"modalText":"modalTextSecondary",disabled:!u,fontFamily:"body",key:o,onClick:v,ref:x,style:{overflow:"visible",textAlign:"center"},testId:`wallet-option-${o}`,type:"button",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",justifyContent:"center"},Ne.createElement(Cn,{display:"flex",alignItems:"center",justifyContent:"center",paddingBottom:"8",paddingTop:"10",position:"relative"},n?Ne.createElement(lBt,{wallet:e}):null,Ne.createElement(Rc,{background:s,borderRadius:"13",boxShadow:"walletLogo",height:"60",src:a,width:"60"})),n?null:Ne.createElement(Cn,{display:"flex",flexDirection:"column",textAlign:"center"},Ne.createElement(Rs,{as:"h2",color:e.ready?"modalText":"modalTextSecondary",size:"13",weight:"medium"},Ne.createElement(Cn,{as:"span",position:"relative"},d??l,!e.ready&&" (unsupported)")),e.recent&&Ne.createElement(Rs,{color:"accentColor",size:"12",weight:"medium"},y.t("connect.recent")))))}function cBt({onClose:t}){var g;const e="rk_connect_title",n=L_().filter(y=>y.isRainbowKitConnector),{disclaimer:r,learnMoreUrl:s}=m.useContext(WT);let a=null,o=null,l=!1,c=null;const[u,d]=m.useState("CONNECT"),{i18n:f}=m.useContext(fc),x=L5();switch(u){case"CONNECT":{a=f.t("connect.title"),l=!0,o=Ne.createElement(Cn,null,Ne.createElement(Cn,{background:"profileForeground",className:aBt,display:"flex",paddingBottom:"20",paddingTop:"6"},Ne.createElement(Cn,{display:"flex",style:{margin:"0 auto"}},n.filter(y=>y.ready).map(y=>Ne.createElement(Cn,{key:y.id,paddingX:"20"},Ne.createElement(Cn,{width:"60"},Ne.createElement(YBe,{onClose:t,wallet:y})))))),Ne.createElement(Cn,{background:"generalBorder",height:"1",marginBottom:"32",marginTop:"-1"}),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"32",paddingX:"32",style:{textAlign:"center"}},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"8",textAlign:"center"},Ne.createElement(Rs,{color:"modalText",size:"16",weight:"bold"},f.t("intro.title")),Ne.createElement(Rs,{color:"modalTextSecondary",size:"16"},f.t("intro.description")))),Ne.createElement(Cn,{paddingTop:"32",paddingX:"20"},Ne.createElement(Cn,{display:"flex",gap:"14",justifyContent:"center"},Ne.createElement(vd,{label:f.t("intro.get.label"),onClick:()=>d("GET"),size:"large",type:"secondary"}),Ne.createElement(vd,{href:s,label:f.t("intro.learn_more.label"),size:"large",type:"secondary"}))),r&&Ne.createElement(Cn,{marginTop:"28",marginX:"32",textAlign:"center"},Ne.createElement(r,{Link:Hce,Text:Vce})));break}case"GET":{a=f.t("get.title"),c="CONNECT";const y=(g=n==null?void 0:n.filter(v=>{var C,N,P;return((C=v.downloadUrls)==null?void 0:C.ios)||((N=v.downloadUrls)==null?void 0:N.android)||((P=v.downloadUrls)==null?void 0:P.mobile)}))==null?void 0:g.splice(0,3);o=Ne.createElement(Cn,null,Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",height:"full",marginBottom:"36",marginTop:"5",paddingTop:"12",width:"full"},y.map((v,C)=>{const{downloadUrls:N,iconBackground:P,iconUrl:T,name:M}=v;return!(N!=null&&N.ios)&&!(N!=null&&N.android)&&!(N!=null&&N.mobile)?null:Ne.createElement(Cn,{display:"flex",gap:"16",key:v.id,paddingX:"20",width:"full"},Ne.createElement(Cn,{style:{minHeight:48,minWidth:48}},Ne.createElement(Rc,{background:P,borderColor:"generalBorder",borderRadius:"10",height:"48",src:T,width:"48"})),Ne.createElement(Cn,{display:"flex",flexDirection:"column",width:"full"},Ne.createElement(Cn,{alignItems:"center",display:"flex",height:"48"},Ne.createElement(Cn,{width:"full"},Ne.createElement(Rs,{color:"modalText",size:"18",weight:"bold"},M)),Ne.createElement(vd,{href:(x?N==null?void 0:N.ios:N==null?void 0:N.android)||(N==null?void 0:N.mobile),label:f.t("get.action.label"),size:"small",type:"secondary"})),C<y.length-1&&Ne.createElement(Cn,{background:"generalBorderDim",height:"1",marginY:"10",width:"full"})))})),Ne.createElement(Cn,{style:{marginBottom:"42px"}}),Ne.createElement(Cn,{alignItems:"center",display:"flex",flexDirection:"column",gap:"36",paddingX:"36",style:{textAlign:"center"}},Ne.createElement(Cn,{display:"flex",flexDirection:"column",gap:"12",textAlign:"center"},Ne.createElement(Rs,{color:"modalText",size:"16",weight:"bold"},f.t("get.looking_for.title")),Ne.createElement(Rs,{color:"modalTextSecondary",size:"16"},f.t("get.looking_for.mobile.description")))));break}}return Ne.createElement(Cn,{display:"flex",flexDirection:"column",paddingBottom:"36"},Ne.createElement(Cn,{background:l?"profileForeground":"modalBackground",display:"flex",flexDirection:"column",paddingBottom:"4",paddingTop:"14"},Ne.createElement(Cn,{display:"flex",justifyContent:"center",paddingBottom:"6",paddingX:"20",position:"relative"},c&&Ne.createElement(Cn,{display:"flex",position:"absolute",style:{left:0,marginBottom:-20,marginTop:-20}},Ne.createElement(Cn,{alignItems:"center",as:"button",className:uu({active:"shrinkSm",hover:"growLg"}),color:"accentColor",display:"flex",marginLeft:"4",marginTop:"20",onClick:()=>d(c),padding:"16",style:{height:17,willChange:"transform"},transition:"default",type:"button"},Ne.createElement(LBe,null))),Ne.createElement(Cn,{marginTop:"4",textAlign:"center",width:"full"},Ne.createElement(Rs,{as:"h1",color:"modalText",id:e,size:"20",weight:"bold"},a)),Ne.createElement(Cn,{alignItems:"center",display:"flex",height:"32",paddingRight:"14",position:"absolute",right:"0"},Ne.createElement(Cn,{style:{marginBottom:-20,marginTop:-20}},Ne.createElement(l5,{onClose:t}))))),Ne.createElement(Cn,{display:"flex",flexDirection:"column"},o))}var uBt=({onClose:t})=>{const{connector:e}=m.useContext(qT),{i18n:n}=m.useContext(fc),r=(e==null?void 0:e.name)||"";return Ne.createElement(Cn,null,Ne.createElement(Cn,{display:"flex",paddingBottom:"32",justifyContent:"center",alignItems:"center",background:"profileForeground",flexDirection:"column"},Ne.createElement(Cn,{width:"full",display:"flex",justifyContent:"flex-end",marginTop:"18",marginRight:"24"},Ne.createElement(l5,{onClose:t})),Ne.createElement(Cn,{width:"60"},Ne.createElement(YBe,{onClose:t,wallet:e,connecting:!0})),Ne.createElement(Cn,{marginTop:"20"},Ne.createElement(Rs,{textAlign:"center",color:"modalText",size:"18",weight:"semibold"},n.t("connect.status.connect_mobile",{wallet:r}))),Ne.createElement(Cn,{maxWidth:"full",marginTop:"8"},Ne.createElement(Rs,{textAlign:"center",color:"modalText",size:"16",weight:"medium"},n.t("connect.status.confirm_mobile",{wallet:r})))))};function dBt({onClose:t}){const{connector:e}=m.useContext(qT);return fu()?e?Ne.createElement(uBt,{onClose:t}):Ne.createElement(cBt,{onClose:t}):Ne.createElement(sBt,{onClose:t})}function fBt({onClose:t,open:e}){const n="rk_connect_title",r=oBe(),{disconnect:s}=w$(),{isConnecting:a}=ns(),o=Ne.useCallback(()=>{t(),s()},[t,s]),l=Ne.useCallback(()=>{a&&s(),t()},[t,s,a]);return r==="disconnected"?Ne.createElement(IL,{onClose:l,open:e,titleId:n},Ne.createElement(FL,{bottomSheetOnMobile:!0,padding:"0",wide:!0},Ne.createElement(dBt,{onClose:l}))):r==="unauthenticated"?Ne.createElement(IL,{onClose:o,open:e,titleId:n},Ne.createElement(FL,{bottomSheetOnMobile:!0,padding:"0"},Ne.createElement(WLt,{onClose:o,onCloseModal:t}))):null}function bq(){const[t,e]=m.useState(!1);return{closeModal:m.useCallback(()=>e(!1),[]),isModalOpen:t,openModal:m.useCallback(()=>e(!0),[])}}var gj=m.createContext({accountModalOpen:!1,chainModalOpen:!1,connectModalOpen:!1,isWalletConnectModalOpen:!1,setIsWalletConnectModalOpen:()=>{}});function hBt({children:t}){const{closeModal:e,isModalOpen:n,openModal:r}=bq(),{closeModal:s,isModalOpen:a,openModal:o}=bq(),{closeModal:l,isModalOpen:c,openModal:u}=bq(),[d,f]=m.useState(!1),x=oBe(),{chainId:g}=ns(),{chains:y}=Tl(),v=y.some(P=>P.id===g),C=m.useCallback(({keepConnectModalOpen:P=!1}={})=>{P||e(),s(),l()},[e,s,l]),N=jU()==="unauthenticated";return GTe({onConnect:()=>C({keepConnectModalOpen:N}),onDisconnect:()=>C()}),m.useEffect(()=>{N&&C()},[N,C]),Ne.createElement(gj.Provider,{value:m.useMemo(()=>({accountModalOpen:a,chainModalOpen:c,connectModalOpen:n,isWalletConnectModalOpen:d,openAccountModal:v&&x==="connected"?o:void 0,openChainModal:x==="connected"?u:void 0,openConnectModal:x==="disconnected"||x==="unauthenticated"?r:void 0,setIsWalletConnectModalOpen:f}),[x,a,c,n,o,u,r,v,d])},t,Ne.createElement(fBt,{onClose:e,open:n}),Ne.createElement(vDt,{onClose:s,open:a}),Ne.createElement(EDt,{onClose:l,open:c}))}function pBt(){const{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}=m.useContext(gj);return{accountModalOpen:t,chainModalOpen:e,connectModalOpen:n}}function mBt(){const{accountModalOpen:t,openAccountModal:e}=m.useContext(gj);return{accountModalOpen:t,openAccountModal:e}}function xBt(){const{chainModalOpen:t,openChainModal:e}=m.useContext(gj);return{chainModalOpen:t,openChainModal:e}}function XBe(){const{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}=m.useContext(gj);return{isWalletConnectModalOpen:t,setIsWalletConnectModalOpen:e}}function D5(){const{connectModalOpen:t,openConnectModal:e}=m.useContext(gj),{isWalletConnectModalOpen:n}=XBe();return{connectModalOpen:t||n,openConnectModal:e}}var yq=()=>{};function gBt({children:t}){const e=QRt(),{address:n}=ns(),{chainId:r}=ns(),{chains:s}=Tl(),a=s.some(K=>K.id===r),o=KRt(),l=jU()??void 0,c=r?o[r]:void 0,u=(c==null?void 0:c.name)??void 0,d=(c==null?void 0:c.iconUrl)??void 0,f=(c==null?void 0:c.iconBackground)??void 0,x=Oce(d),g=m.useContext(Lce),y=yBe().some(({status:K})=>K==="pending")&&g,{showBalance:v}=XRt(),N=typeof v=="boolean"?v:v?mRt(v)[fu()?"smallScreen":"largeScreen"]:!0,{balance:P,ensAvatar:T,ensName:M}=mBe({address:n,includeBalance:N}),F=P?`${IBe(Number.parseFloat(P.formatted))} ${P.symbol}`:void 0,{openConnectModal:$}=D5(),{openChainModal:L}=xBt(),{openAccountModal:z}=mBt(),{accountModalOpen:X,chainModalOpen:ne,connectModalOpen:J}=pBt();return Ne.createElement(Ne.Fragment,null,t({account:n?{address:n,balanceDecimals:P==null?void 0:P.decimals,balanceFormatted:P==null?void 0:P.formatted,balanceSymbol:P==null?void 0:P.symbol,displayBalance:F,displayName:M?OBe(M):FBe(n),ensAvatar:T??void 0,ensName:M??void 0,hasPendingTransactions:y}:void 0,accountModalOpen:X,authenticationStatus:l,chain:r?{hasIcon:!!d,iconBackground:f,iconUrl:x,id:r,name:u,unsupported:!a}:void 0,chainModalOpen:ne,connectModalOpen:J,mounted:e(),openAccountModal:z??yq,openChainModal:L??yq,openConnectModal:$??yq}))}gBt.displayName="ConnectButton.Custom";var QBe=({appName:t,appDescription:e,appUrl:n,appIcon:r})=>({name:t,description:e??t,url:n??(typeof window<"u"?window.location.href:""),icons:[...r?[r]:[]]});function bBt(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>n!==void 0))}function yBt(t,e){const n=[];for(const r of t)n.some(s=>s[e]===r[e])||n.push(r);return n}var vBt=(t,{projectId:e,walletConnectParameters:n,appName:r,appDescription:s,appUrl:a,appIcon:o})=>{if(!t.length)throw new Error("No wallet list was provided");for(const{wallets:g,groupName:y}of t)if(!g.length)throw new Error(`No wallets provided for group: ${y}`);let l=-1;const c=[],u=[],d=[],f=QBe({appName:r,appDescription:s,appUrl:a,appIcon:o});for(const[g,{groupName:y,wallets:v}]of t.entries())for(const C of v){l++;const N=C({projectId:e,appName:r,appIcon:o,options:{metadata:f,...n},walletConnectParameters:{metadata:f,...n}});if(N!=null&&N.iconAccent&&!LDt(N==null?void 0:N.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${N.name}`);const P={...N,groupIndex:g+1,groupName:y,index:l};typeof N.hidden=="function"?d.push(P):u.push(P)}const x=yBt([...u,...d],"id");for(const{createConnector:g,groupIndex:y,groupName:v,hidden:C,...N}of x){if(typeof C=="function"&&C())continue;const P=F=>({rkDetails:bBt({...N,groupIndex:y,groupName:v,isRainbowKitConnector:!0,...F||{}})});N.id==="walletConnect"&&c.push(g(P({isWalletConnectModalConnector:!0,showQrModal:!0})));const M=g(P());c.push(M)}return c},t2e=new Map,wBt=({projectId:t,walletConnectParameters:e,rkDetailsShowQrModal:n})=>{let r={...e||{},projectId:t,showQrModal:!1};n&&(r={...r,showQrModal:!0});const s=JSON.stringify(r),a=t2e.get(s);if(a)return a;const o=Ice(r);return t2e.set(s,o),o};function CBt({projectId:t,walletDetails:e,walletConnectParameters:n}){return r=>({...wBt({projectId:t,walletConnectParameters:n,rkDetailsShowQrModal:e.rkDetails.showQrModal})(r),...e})}function Wce({projectId:t,walletConnectParameters:e}){const n="21fef48091f12692cad574a6f7753643";if(!t||t==="")throw new Error("No projectId found. Every dApp must now provide a WalletConnect Cloud projectId to enable WalletConnect v2 https://www.rainbowkit.com/docs/installation#configure");return t==="YOUR_PROJECT_ID"&&(t=n),r=>CBt({projectId:t,walletDetails:r,walletConnectParameters:e})}function ZBe(t){const e=typeof window<"u"?window:void 0;if(typeof e>"u"||typeof e.ethereum>"u")return;const n=e.ethereum.providers;return n?n.find(r=>r[t]):e.ethereum[t]?e.ethereum:void 0}function JBe(t){const e=(n,r)=>{const[s,...a]=r.split("."),o=n[s];if(o)return a.length===0?o:e(o,a.join("."))};if(typeof window<"u")return e(window,t)}function e$e({flag:t,namespace:e}){return!!(e&&typeof JBe(e)<"u"||t&&typeof ZBe(t)<"u")}function SBt({flag:t,namespace:e}){var s;const n=typeof window<"u"?window:void 0;if(typeof n>"u")return;if(e){const a=JBe(e);if(a)return a}const r=(s=n.ethereum)==null?void 0:s.providers;if(t){const a=ZBe(t);if(a)return a}return typeof r<"u"&&r.length>0?r[0]:n.ethereum}function NBt(t){return e=>{const n=t?{target:()=>({id:e.rkDetails.id,name:e.rkDetails.name,provider:t})}:{};return r=>({...b$(n)(r),...e})}}function t$e({flag:t,namespace:e,target:n}){const r=n||SBt({flag:t,namespace:e});return NBt(r)}var n$e=({appName:t,appIcon:e})=>{const n=s=>s,r=L5();return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",rdns:"com.coinbase.wallet",iconUrl:async()=>(await os(async()=>{const{default:s}=await import("./coinbaseWallet-WWX6LF36-BMRj6mTC.js");return{default:s}},[])).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:!0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},...r?{}:{qrCode:{getUri:n,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}},createConnector:s=>{const a=AU({appName:t,appLogoUrl:e,preference:n$e.preference});return o=>({...a(o),...s})}}};function ABt(t){return!(!(t!=null&&t.isMetaMask)||t.isBraveWallet&&!t._events&&!t._state||t.isApexWallet||t.isAvalanche||t.isBackpack||t.isBifrost||t.isBitKeep||t.isBitski||t.isBlockWallet||t.isCoinbaseWallet||t.isDawn||t.isEnkrypt||t.isExodus||t.isFrame||t.isFrontier||t.isGamestop||t.isHyperPay||t.isImToken||t.isKuCoinWallet||t.isMathWallet||t.isNestWallet||t.isOkxWallet||t.isOKExWallet||t.isOneInchIOSWallet||t.isOneInchAndroidWallet||t.isOpera||t.isPhantom||t.isPortal||t.isRabby||t.isRainbow||t.isStatus||t.isTalisman||t.isTally||t.isTokenPocket||t.isTokenary||t.isTrust||t.isTrustWallet||t.isXDEFI||t.isZeal||t.isZerion||t.__seif)}var jBt=({projectId:t,walletConnectParameters:e})=>{var a,o;const n=e$e({flag:"isMetaMask"}),r=!n,s=l=>Fce()?l:L5()?`metamask://wc?uri=${encodeURIComponent(l)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(l)}`;return{id:"metaMask",name:"MetaMask",rdns:"io.metamask",iconUrl:async()=>(await os(async()=>{const{default:l}=await import("./metaMaskWallet-YFHEHW7V-BggUDXad.js");return{default:l}},[])).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:r?void 0:n,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},mobile:{getUri:r?s:void 0},qrCode:r?{getUri:s,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}},createConnector:r?Wce({projectId:t,walletConnectParameters:e}):t$e({target:typeof window<"u"?((o=(a=window.ethereum)==null?void 0:a.providers)==null?void 0:o.find(ABt))??window.ethereum:void 0})}},EBt=({projectId:t,walletConnectParameters:e})=>{const n=e$e({flag:"isRainbow"}),r=!n,s=a=>Fce()?a:L5()?`rainbow://wc?uri=${encodeURIComponent(a)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(a)}&connector=rainbowkit`;return{id:"rainbow",name:"Rainbow",rdns:"me.rainbow",iconUrl:async()=>(await os(async()=>{const{default:a}=await import("./rainbowWallet-2SR6TVBF-kimcGeuf.js");return{default:a}},[])).default,iconBackground:"#0c2f78",installed:r?void 0:n,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},mobile:{getUri:r?s:void 0},qrCode:r?{getUri:s,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0,createConnector:r?Wce({projectId:t,walletConnectParameters:e}):t$e({flag:"isRainbow"})}},_Bt=()=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await os(async()=>{const{default:t}=await import("./safeWallet-VUYZPLY4-CXnodgMs.js");return{default:t}},[])).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:t=>e=>({...Pce()(e),...t})}),kBt=({projectId:t,options:e})=>({id:"walletConnect",name:"WalletConnect",installed:void 0,iconUrl:async()=>(await os(async()=>{const{default:r}=await import("./walletConnectWallet-FNSU4KNU-B0ci71fU.js");return{default:r}},[])).default,iconBackground:"#3b99fc",qrCode:{getUri:r=>r},createConnector:Wce({projectId:t,walletConnectParameters:e})}),TBt=t=>t.reduce((n,r)=>{const s=r.id;return n[s]=U7(),n},{}),PBt=({appName:t,appDescription:e,appUrl:n,appIcon:r,wallets:s,projectId:a,...o})=>{const{transports:l,chains:c,...u}=o,d=QBe({appName:t,appDescription:e,appUrl:n,appIcon:r}),f=vBt(s||[{groupName:"Popular",wallets:[_Bt,EBt,n$e,jBt,kBt]}],{projectId:a,appName:t,appDescription:e,appUrl:n,appIcon:r,walletConnectParameters:{metadata:d}});return Gbt({connectors:f,chains:c,transports:l||TBt(c),...u})};function IBt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z",clipRule:"evenodd"}))}const n2e=m.forwardRef(IBt);function FBt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z",clipRule:"evenodd"}))}const ky=m.forwardRef(FBt);function OBt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const MBt=m.forwardRef(OBt);function RBt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M8.75 2.5a.75.75 0 0 0-1.5 0v.508a32.661 32.661 0 0 0-4.624.434.75.75 0 0 0 .246 1.48l.13-.021-1.188 4.75a.75.75 0 0 0 .33.817A3.487 3.487 0 0 0 4 11c.68 0 1.318-.195 1.856-.532a.75.75 0 0 0 .33-.818l-1.25-5a31.31 31.31 0 0 1 2.314-.141V12.012c-.882.027-1.752.104-2.607.226a.75.75 0 0 0 .213 1.485 22.188 22.188 0 0 1 6.288 0 .75.75 0 1 0 .213-1.485 23.657 23.657 0 0 0-2.607-.226V4.509c.779.018 1.55.066 2.314.14L9.814 9.65a.75.75 0 0 0 .329.818 3.487 3.487 0 0 0 1.856.532c.68 0 1.318-.195 1.856-.532a.75.75 0 0 0 .33-.818L12.997 4.9l.13.022a.75.75 0 1 0 .247-1.48 32.66 32.66 0 0 0-4.624-.434V2.5ZM3.42 9.415a2 2 0 0 0 1.16 0L4 7.092l-.58 2.323ZM12 9.5a2 2 0 0 1-.582-.085L12 7.092l.58 2.323A2 2 0 0 1 12 9.5Z",clipRule:"evenodd"}))}const LBt=m.forwardRef(RBt);function DBt({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{fillRule:"evenodd",d:"M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z",clipRule:"evenodd"}))}const BBt=m.forwardRef(DBt),$Bt=()=>{const{address:t}=ns(),{disconnect:e}=w$(),{subsExpireDay:n}=m.useContext(Qr),[r,s]=m.useState(!1),a=c=>c<=3?"red":c<=7?"yellow":"green",o=Number(n)||0,l=a(o);return i.jsxs(i.Fragment,{children:[i.jsx(P5,{open:r,setOpen:s,handleListRequest:()=>{},handlePageChange:()=>{}}),i.jsxs(MB,{as:"div",className:"relative inline-block text-left font-manrope",children:[i.jsx("div",{children:i.jsxs(FB,{className:"bg-[#232323] hover:bg-[#404040] border-none rounded-[256px] justify-start items-center gap-2 inline-flex focus:outline-none focus:ring-0 py-1.5 pl-4 pr-3 text-[13px] font-semibold text-white",children:[window.localStorage.getItem("hyperAddress")&&t.slice(0,6)+"..."+t.slice(-4),i.jsx(MBt,{className:"size-4 fill-white/60"})]})}),i.jsx(OB,{transition:!0,anchor:"bottom end",className:"origin-top-right absolute right-0 top-10 w-36 rounded-xl px-2 py-2.5 text-sm/6 text-white transition duration-100 ease-out [--anchor-gap:var(--spacing-1)] focus:outline-none data-[closed]:scale-95 data-[closed]:opacity-0 z-[60]",children:i.jsx(YC,{children:i.jsxs("button",{className:"group flex flex-col gap-[6px] items-center rounded-lg px-1 py-2 focus:outline-none focus:ring-0 border-none origin-top-right bg-[#363636] border border-[#404040] shadow-lg ring-1 ring-black ring-opacity-5 z-20 h-max w-full",children:[i.jsxs("div",{onClick:()=>{window.open("/wallet-management#hyperliquid#add-account#hyperliquid","_blank")},className:"h-8 px-1 py-3 bg-[#7445ff] rounded-md shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] flex justify-center items-center gap-1 cursor-pointer relative",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] min-w-max -mb-[1px]",children:"Add Account"}),i.jsx("div",{className:"absolute -top-[15.5px] right-[1px]",children:i.jsx("img",{src:vEe,alt:""})})]}),i.jsx("div",{onClick:()=>{window.open("/my-profile","_blank")},className:"h-8 w-[calc(100%-6px)] px-1 py-3 bg-[#7445ff] rounded-md shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] flex justify-center items-center gap-1 cursor-pointer",children:i.jsxs("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] min-w-max -mb-[1px] flex items-center gap-2",children:[l!=="green"&&i.jsx("span",{className:`${l==="red"?"bg-[#FF4A4A]":""} ${l==="yellow"?"bg-[#FFD447]":""} w-2 h-2 min-w-2 min-h-2 rounded-full inline-block live-dot`}),"My Profile"]})}),i.jsx("div",{onClick:()=>{e(),window.localStorage.removeItem("hyperAddress"),window.localStorage.removeItem("hyperToken"),window.dispatchEvent(new Event("localStorageUpdated"))},className:"py-2 px-3 text-13px rounded-md flex justify-between items-center hover:bg-[#404040] relative w-full",children:"Disconnect"})]})})})]})]})},UBt=()=>{const t=jo(),[e,n]=m.useState(Date.now()),{isConnected:r,address:s,isDisconnected:a}=ns(),{walletLogin:o,signIn:l,hyperToken:c,hyperAddress:u,setTelegramChatId:d,setSubscriberRole:f,setSubsExpireDay:x,setIsReferralCode:g,setIsReferralCodeName:y,setMushboomerETH:v,setMushboomerSOL:C,setIsWhitelist:N,setHyperToken:P,setHyperAddress:T,setSignModalOpen:M,signInConnectButtonOpen:F,setSignInConnectButtonOpen:$}=m.useContext(Qr),{openConnectModal:L}=D5(),z=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches;m.useEffect(()=>{!a&&s==null&&!z&&(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),P(""),T(""))},[a]);const X=()=>{window.localStorage.getItem("hyperToken")&&c?o():l(1)};m.useEffect(()=>{F&&(M(!0),$(!1))},[F]),m.useEffect(()=>{s!=null&&window.localStorage.getItem("hyperAddress")!=null&&window.localStorage.getItem("hyperAddress").toLowerCase()!==s.toLowerCase()&&!z&&(window.localStorage.removeItem("hyperToken"),P(""))},[s,u]);const ne=m.useRef(!1);return m.useEffect(()=>{const J=async()=>{var q,se;if(ne.current)return;ne.current=!0;const te=window.localStorage.getItem("hyperToken"),fe=window.localStorage.getItem("hyperAddress");if(!te||!fe){ne.current=!1;return}try{const ae=await ki(fe.toLowerCase(),te);ae!=null&&ae.success?(d(ae==null?void 0:ae.telegram_chat_id),f(ae==null?void 0:ae.subscriber_role),x(ae==null?void 0:ae.subs_expire_day),v((q=ae==null?void 0:ae.mushboomer_counts)==null?void 0:q.eth),C((se=ae==null?void 0:ae.mushboomer_counts)==null?void 0:se.sol),g(ae==null?void 0:ae.referral_code),y(ae==null?void 0:ae.refcode),N(ae==null?void 0:ae.whitelist),P(te),T(fe)):(window.localStorage.removeItem("hyperAddress"),window.localStorage.removeItem("hyperToken"),P(""),T(""))}catch(ae){console.error("Token verification error:",ae),ae.response?console.error("Server Error Response:",ae.response):ae.message?console.error("Network or Other Error:",ae.message):console.error("Unknown Error:",ae)}finally{ne.current=!1}},K=()=>{if(document.visibilityState==="visible"){const te=Date.now();te-e>1e3&&J(),n(te)}};return document.addEventListener("visibilitychange",K),()=>{document.removeEventListener("visibilitychange",K)}},[t,e]),i.jsx(i.Fragment,{children:r?s&&window.localStorage.getItem("hyperAddress")?i.jsxs("div",{className:"sm:block relative font-manrope",children:[i.jsx($Bt,{}),i.jsx("div",{className:"absolute right-4",children:(s==null?void 0:s.toLowerCase())!==window.localStorage.getItem("hyperAddress")?i.jsxs("div",{className:"flex justify-end font-manrope",children:[i.jsx("img",{src:xlt,alt:""}),i.jsx("span",{className:"text-[#D35B5B] text-[10px] leading-4 font-medium",children:"Not connected"})]}):i.jsxs("div",{className:"flex justify-end font-manrope",children:[i.jsx("img",{src:glt,alt:""}),i.jsx("span",{className:"text-[#0A9C55] text-[10px] leading-4 font-medium",children:"Connected"})]})})]}):i.jsx("div",{onClick:J=>X(),style:{background:"linear-gradient(98deg, #FFF1FF 0%, #6FDBBF 28.15%, #57DCF5 57.96%, #D834D8 98.77%)"},className:"h-[30.60px] rounded-[256px] justify-center items-center gap-2.5 sm:inline-flex w-[91px] p-[1.4px] cursor-pointer font-manrope",children:i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-none w-full h-full flex items-center justify-center rounded-[256px] bg-[#161616]",children:"Sign In"})}):i.jsx("div",{onClick:()=>{L(),$(!0)},style:{background:"linear-gradient(98deg, #FFF1FF 0%, #6FDBBF 28.15%, #57DCF5 57.96%, #D834D8 98.77%)"},className:"h-[30.60px] rounded-[256px] justify-center items-center gap-2.5 sm:inline-flex w-[91px] p-[1.4px] cursor-pointer",children:i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-none w-full h-full flex items-center justify-center rounded-[256px] bg-[#161616]",children:"Connect"})})})};var xC={},vq={exports:{}},wq,r2e;function zBt(){if(r2e)return wq;r2e=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return wq=t,wq}var Cq,s2e;function HBt(){if(s2e)return Cq;s2e=1;var t=zBt();function e(){}function n(){}return n.resetWarningCache=e,Cq=function(){function r(o,l,c,u,d,f){if(f!==t){var x=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw x.name="Invariant Violation",x}}r.isRequired=r;function s(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:e};return a.PropTypes=a,a},Cq}var i2e;function _U(){return i2e||(i2e=1,vq.exports=HBt()()),vq.exports}var Sq,a2e;function r$e(){return a2e||(a2e=1,Sq={L:1,M:0,Q:3,H:2}),Sq}var Nq,o2e;function s$e(){return o2e||(o2e=1,Nq={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}),Nq}var Aq,l2e;function VBt(){if(l2e)return Aq;l2e=1;var t=s$e();function e(n){this.mode=t.MODE_8BIT_BYTE,this.data=n}return e.prototype={getLength:function(n){return this.data.length},write:function(n){for(var r=0;r<this.data.length;r++)n.put(this.data.charCodeAt(r),8)}},Aq=e,Aq}var jq,c2e;function WBt(){if(c2e)return jq;c2e=1;var t=r$e();function e(n,r){this.totalCount=n,this.dataCount=r}return e.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e.getRSBlocks=function(n,r){var s=e.getRsBlockTable(n,r);if(s==null)throw new Error("bad rs block @ typeNumber:"+n+"/errorCorrectLevel:"+r);for(var a=s.length/3,o=new Array,l=0;l<a;l++)for(var c=s[l*3+0],u=s[l*3+1],d=s[l*3+2],f=0;f<c;f++)o.push(new e(u,d));return o},e.getRsBlockTable=function(n,r){switch(r){case t.L:return e.RS_BLOCK_TABLE[(n-1)*4+0];case t.M:return e.RS_BLOCK_TABLE[(n-1)*4+1];case t.Q:return e.RS_BLOCK_TABLE[(n-1)*4+2];case t.H:return e.RS_BLOCK_TABLE[(n-1)*4+3];default:return}},jq=e,jq}var Eq,u2e;function qBt(){if(u2e)return Eq;u2e=1;function t(){this.buffer=new Array,this.length=0}return t.prototype={get:function(e){var n=Math.floor(e/8);return(this.buffer[n]>>>7-e%8&1)==1},put:function(e,n){for(var r=0;r<n;r++)this.putBit((e>>>n-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),e&&(this.buffer[n]|=128>>>this.length%8),this.length++}},Eq=t,Eq}var _q,d2e;function i$e(){if(d2e)return _q;d2e=1;for(var t={glog:function(n){if(n<1)throw new Error("glog("+n+")");return t.LOG_TABLE[n]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return t.EXP_TABLE[n]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},e=0;e<8;e++)t.EXP_TABLE[e]=1<<e;for(var e=8;e<256;e++)t.EXP_TABLE[e]=t.EXP_TABLE[e-4]^t.EXP_TABLE[e-5]^t.EXP_TABLE[e-6]^t.EXP_TABLE[e-8];for(var e=0;e<255;e++)t.LOG_TABLE[t.EXP_TABLE[e]]=e;return _q=t,_q}var kq,f2e;function a$e(){if(f2e)return kq;f2e=1;var t=i$e();function e(n,r){if(n.length==null)throw new Error(n.length+"/"+r);for(var s=0;s<n.length&&n[s]==0;)s++;this.num=new Array(n.length-s+r);for(var a=0;a<n.length-s;a++)this.num[a]=n[a+s]}return e.prototype={get:function(n){return this.num[n]},getLength:function(){return this.num.length},multiply:function(n){for(var r=new Array(this.getLength()+n.getLength()-1),s=0;s<this.getLength();s++)for(var a=0;a<n.getLength();a++)r[s+a]^=t.gexp(t.glog(this.get(s))+t.glog(n.get(a)));return new e(r,0)},mod:function(n){if(this.getLength()-n.getLength()<0)return this;for(var r=t.glog(this.get(0))-t.glog(n.get(0)),s=new Array(this.getLength()),a=0;a<this.getLength();a++)s[a]=this.get(a);for(var a=0;a<n.getLength();a++)s[a]^=t.gexp(t.glog(n.get(a))+r);return new e(s,0).mod(n)}},kq=e,kq}var Tq,h2e;function GBt(){if(h2e)return Tq;h2e=1;var t=s$e(),e=a$e(),n=i$e(),r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var o=a<<10;s.getBCHDigit(o)-s.getBCHDigit(s.G15)>=0;)o^=s.G15<<s.getBCHDigit(o)-s.getBCHDigit(s.G15);return(a<<10|o)^s.G15_MASK},getBCHTypeNumber:function(a){for(var o=a<<12;s.getBCHDigit(o)-s.getBCHDigit(s.G18)>=0;)o^=s.G18<<s.getBCHDigit(o)-s.getBCHDigit(s.G18);return a<<12|o},getBCHDigit:function(a){for(var o=0;a!=0;)o++,a>>>=1;return o},getPatternPosition:function(a){return s.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,o,l){switch(a){case r.PATTERN000:return(o+l)%2==0;case r.PATTERN001:return o%2==0;case r.PATTERN010:return l%3==0;case r.PATTERN011:return(o+l)%3==0;case r.PATTERN100:return(Math.floor(o/2)+Math.floor(l/3))%2==0;case r.PATTERN101:return o*l%2+o*l%3==0;case r.PATTERN110:return(o*l%2+o*l%3)%2==0;case r.PATTERN111:return(o*l%3+(o+l)%2)%2==0;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var o=new e([1],0),l=0;l<a;l++)o=o.multiply(new e([1,n.gexp(l)],0));return o},getLengthInBits:function(a,o){if(1<=o&&o<10)switch(a){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(o<27)switch(a){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else if(o<41)switch(a){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}else throw new Error("type:"+o)},getLostPoint:function(a){for(var o=a.getModuleCount(),l=0,c=0;c<o;c++)for(var u=0;u<o;u++){for(var d=0,f=a.isDark(c,u),x=-1;x<=1;x++)if(!(c+x<0||o<=c+x))for(var g=-1;g<=1;g++)u+g<0||o<=u+g||x==0&&g==0||f==a.isDark(c+x,u+g)&&d++;d>5&&(l+=3+d-5)}for(var c=0;c<o-1;c++)for(var u=0;u<o-1;u++){var y=0;a.isDark(c,u)&&y++,a.isDark(c+1,u)&&y++,a.isDark(c,u+1)&&y++,a.isDark(c+1,u+1)&&y++,(y==0||y==4)&&(l+=3)}for(var c=0;c<o;c++)for(var u=0;u<o-6;u++)a.isDark(c,u)&&!a.isDark(c,u+1)&&a.isDark(c,u+2)&&a.isDark(c,u+3)&&a.isDark(c,u+4)&&!a.isDark(c,u+5)&&a.isDark(c,u+6)&&(l+=40);for(var u=0;u<o;u++)for(var c=0;c<o-6;c++)a.isDark(c,u)&&!a.isDark(c+1,u)&&a.isDark(c+2,u)&&a.isDark(c+3,u)&&a.isDark(c+4,u)&&!a.isDark(c+5,u)&&a.isDark(c+6,u)&&(l+=40);for(var v=0,u=0;u<o;u++)for(var c=0;c<o;c++)a.isDark(c,u)&&v++;var C=Math.abs(100*v/o/o-50)/5;return l+=C*10,l}};return Tq=s,Tq}var Pq,p2e;function KBt(){if(p2e)return Pq;p2e=1;var t=VBt(),e=WBt(),n=qBt(),r=GBt(),s=a$e();function a(l,c){this.typeNumber=l,this.errorCorrectLevel=c,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var o=a.prototype;return o.addData=function(l){var c=new t(l);this.dataList.push(c),this.dataCache=null},o.isDark=function(l,c){if(l<0||this.moduleCount<=l||c<0||this.moduleCount<=c)throw new Error(l+","+c);return this.modules[l][c]},o.getModuleCount=function(){return this.moduleCount},o.make=function(){if(this.typeNumber<1){var l=1;for(l=1;l<40;l++){for(var c=e.getRSBlocks(l,this.errorCorrectLevel),u=new n,d=0,f=0;f<c.length;f++)d+=c[f].dataCount;for(var f=0;f<this.dataList.length;f++){var x=this.dataList[f];u.put(x.mode,4),u.put(x.getLength(),r.getLengthInBits(x.mode,l)),x.write(u)}if(u.getLengthInBits()<=d*8)break}this.typeNumber=l}this.makeImpl(!1,this.getBestMaskPattern())},o.makeImpl=function(l,c){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var u=0;u<this.moduleCount;u++){this.modules[u]=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[u][d]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(l,c),this.typeNumber>=7&&this.setupTypeNumber(l),this.dataCache==null&&(this.dataCache=a.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},o.setupPositionProbePattern=function(l,c){for(var u=-1;u<=7;u++)if(!(l+u<=-1||this.moduleCount<=l+u))for(var d=-1;d<=7;d++)c+d<=-1||this.moduleCount<=c+d||(0<=u&&u<=6&&(d==0||d==6)||0<=d&&d<=6&&(u==0||u==6)||2<=u&&u<=4&&2<=d&&d<=4?this.modules[l+u][c+d]=!0:this.modules[l+u][c+d]=!1)},o.getBestMaskPattern=function(){for(var l=0,c=0,u=0;u<8;u++){this.makeImpl(!0,u);var d=r.getLostPoint(this);(u==0||l>d)&&(l=d,c=u)}return c},o.createMovieClip=function(l,c,u){var d=l.createEmptyMovieClip(c,u),f=1;this.make();for(var x=0;x<this.modules.length;x++)for(var g=x*f,y=0;y<this.modules[x].length;y++){var v=y*f,C=this.modules[x][y];C&&(d.beginFill(0,100),d.moveTo(v,g),d.lineTo(v+f,g),d.lineTo(v+f,g+f),d.lineTo(v,g+f),d.endFill())}return d},o.setupTimingPattern=function(){for(var l=8;l<this.moduleCount-8;l++)this.modules[l][6]==null&&(this.modules[l][6]=l%2==0);for(var c=8;c<this.moduleCount-8;c++)this.modules[6][c]==null&&(this.modules[6][c]=c%2==0)},o.setupPositionAdjustPattern=function(){for(var l=r.getPatternPosition(this.typeNumber),c=0;c<l.length;c++)for(var u=0;u<l.length;u++){var d=l[c],f=l[u];if(this.modules[d][f]==null)for(var x=-2;x<=2;x++)for(var g=-2;g<=2;g++)x==-2||x==2||g==-2||g==2||x==0&&g==0?this.modules[d+x][f+g]=!0:this.modules[d+x][f+g]=!1}},o.setupTypeNumber=function(l){for(var c=r.getBCHTypeNumber(this.typeNumber),u=0;u<18;u++){var d=!l&&(c>>u&1)==1;this.modules[Math.floor(u/3)][u%3+this.moduleCount-8-3]=d}for(var u=0;u<18;u++){var d=!l&&(c>>u&1)==1;this.modules[u%3+this.moduleCount-8-3][Math.floor(u/3)]=d}},o.setupTypeInfo=function(l,c){for(var u=this.errorCorrectLevel<<3|c,d=r.getBCHTypeInfo(u),f=0;f<15;f++){var x=!l&&(d>>f&1)==1;f<6?this.modules[f][8]=x:f<8?this.modules[f+1][8]=x:this.modules[this.moduleCount-15+f][8]=x}for(var f=0;f<15;f++){var x=!l&&(d>>f&1)==1;f<8?this.modules[8][this.moduleCount-f-1]=x:f<9?this.modules[8][15-f-1+1]=x:this.modules[8][15-f-1]=x}this.modules[this.moduleCount-8][8]=!l},o.mapData=function(l,c){for(var u=-1,d=this.moduleCount-1,f=7,x=0,g=this.moduleCount-1;g>0;g-=2)for(g==6&&g--;;){for(var y=0;y<2;y++)if(this.modules[d][g-y]==null){var v=!1;x<l.length&&(v=(l[x]>>>f&1)==1);var C=r.getMask(c,d,g-y);C&&(v=!v),this.modules[d][g-y]=v,f--,f==-1&&(x++,f=7)}if(d+=u,d<0||this.moduleCount<=d){d-=u,u=-u;break}}},a.PAD0=236,a.PAD1=17,a.createData=function(l,c,u){for(var d=e.getRSBlocks(l,c),f=new n,x=0;x<u.length;x++){var g=u[x];f.put(g.mode,4),f.put(g.getLength(),r.getLengthInBits(g.mode,l)),g.write(f)}for(var y=0,x=0;x<d.length;x++)y+=d[x].dataCount;if(f.getLengthInBits()>y*8)throw new Error("code length overflow. ("+f.getLengthInBits()+">"+y*8+")");for(f.getLengthInBits()+4<=y*8&&f.put(0,4);f.getLengthInBits()%8!=0;)f.putBit(!1);for(;!(f.getLengthInBits()>=y*8||(f.put(a.PAD0,8),f.getLengthInBits()>=y*8));)f.put(a.PAD1,8);return a.createBytes(f,d)},a.createBytes=function(l,c){for(var u=0,d=0,f=0,x=new Array(c.length),g=new Array(c.length),y=0;y<c.length;y++){var v=c[y].dataCount,C=c[y].totalCount-v;d=Math.max(d,v),f=Math.max(f,C),x[y]=new Array(v);for(var N=0;N<x[y].length;N++)x[y][N]=255&l.buffer[N+u];u+=v;var P=r.getErrorCorrectPolynomial(C),T=new s(x[y],P.getLength()-1),M=T.mod(P);g[y]=new Array(P.getLength()-1);for(var N=0;N<g[y].length;N++){var F=N+M.getLength()-g[y].length;g[y][N]=F>=0?M.get(F):0}}for(var $=0,N=0;N<c.length;N++)$+=c[N].totalCount;for(var L=new Array($),z=0,N=0;N<d;N++)for(var y=0;y<c.length;y++)N<x[y].length&&(L[z++]=x[y][N]);for(var N=0;N<f;N++)for(var y=0;y<c.length;y++)N<g[y].length&&(L[z++]=g[y][N]);return L},Pq=a,Pq}var aF={},m2e;function YBt(){if(m2e)return aF;m2e=1,Object.defineProperty(aF,"__esModule",{value:!0});var t=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var f=arguments[d];for(var x in f)Object.prototype.hasOwnProperty.call(f,x)&&(u[x]=f[x])}return u},e=_U(),n=a(e),r=xx(),s=a(r);function a(u){return u&&u.__esModule?u:{default:u}}function o(u,d){var f={};for(var x in u)d.indexOf(x)>=0||Object.prototype.hasOwnProperty.call(u,x)&&(f[x]=u[x]);return f}var l={bgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,bgD:n.default.string.isRequired,fgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,fgD:n.default.string.isRequired,size:n.default.number.isRequired,title:n.default.string,viewBoxSize:n.default.number.isRequired,xmlns:n.default.string},c=(0,r.forwardRef)(function(u,d){var f=u.bgColor,x=u.bgD,g=u.fgD,y=u.fgColor,v=u.size,C=u.title,N=u.viewBoxSize,P=u.xmlns,T=P===void 0?"http://www.w3.org/2000/svg":P,M=o(u,["bgColor","bgD","fgD","fgColor","size","title","viewBoxSize","xmlns"]);return s.default.createElement("svg",t({},M,{height:v,ref:d,viewBox:"0 0 "+N+" "+N,width:v,xmlns:T}),C?s.default.createElement("title",null,C):null,s.default.createElement("path",{d:x,fill:f}),s.default.createElement("path",{d:g,fill:y}))});return c.displayName="QRCodeSvg",c.propTypes=l,aF.default=c,aF}var x2e;function XBt(){if(x2e)return xC;x2e=1,Object.defineProperty(xC,"__esModule",{value:!0}),xC.QRCode=void 0;var t=Object.assign||function(v){for(var C=1;C<arguments.length;C++){var N=arguments[C];for(var P in N)Object.prototype.hasOwnProperty.call(N,P)&&(v[P]=N[P])}return v},e=_U(),n=f(e),r=r$e(),s=f(r),a=KBt(),o=f(a),l=xx(),c=f(l),u=YBt(),d=f(u);function f(v){return v&&v.__esModule?v:{default:v}}function x(v,C){var N={};for(var P in v)C.indexOf(P)>=0||Object.prototype.hasOwnProperty.call(v,P)&&(N[P]=v[P]);return N}var g={bgColor:n.default.oneOfType([n.default.object,n.default.string]),fgColor:n.default.oneOfType([n.default.object,n.default.string]),level:n.default.string,size:n.default.number,value:n.default.string.isRequired},y=(0,l.forwardRef)(function(v,C){var N=v.bgColor,P=N===void 0?"#FFFFFF":N,T=v.fgColor,M=T===void 0?"#000000":T,F=v.level,$=F===void 0?"L":F,L=v.size,z=L===void 0?256:L,X=v.value,ne=x(v,["bgColor","fgColor","level","size","value"]),J=new o.default(-1,s.default[$]);J.addData(X),J.make();var K=J.modules;return c.default.createElement(d.default,t({},ne,{bgColor:P,bgD:K.map(function(te,fe){return te.map(function(q,se){return q?"":"M "+se+" "+fe+" l 1 0 0 1 -1 0 Z"}).join(" ")}).join(" "),fgColor:M,fgD:K.map(function(te,fe){return te.map(function(q,se){return q?"M "+se+" "+fe+" l 1 0 0 1 -1 0 Z":""}).join(" ")}).join(" "),ref:C,size:z,viewBoxSize:K.length}))});return xC.QRCode=y,y.displayName="QRCode",y.propTypes=g,xC.default=y,xC}var QBt=XBt();const ZBt=Ii(QBt),yp=({isOpen:t,onClose:e,children:n,fullscreen:r=!1,blurBackground:s=!1})=>{const[a,o]=m.useState(t),[l,c]=m.useState(!1);m.useEffect(()=>{t?(o(!0),c(!0)):(c(!1),o(!1))},[t]),m.useEffect(()=>{const d=f=>{f.key==="Escape"&&u()};return a&&(document.body.style.overflow="hidden",document.addEventListener("keydown",d)),()=>{document.body.style.overflow="",document.removeEventListener("keydown",d)}},[a]);const u=()=>{c(!1),e()};return a?Aa.createPortal(i.jsxs("div",{className:`fixed inset-0 z-[9999] transition-opacity duration-0 ${l?"opacity-100":"opacity-0"} flex items-center justify-center`,children:[i.jsx("div",{className:`absolute inset-0 ${s?"backdrop-blur-md bg-black/50":"bg-black/50"}`,onClick:u}),i.jsxs("div",{className:`relative bg-[#101010] shadow-lg transform transition-transform duration-0 ${l?"translate-y-0":"translate-y-full"} ${r?"w-screen h-[100dvh] rounded-none p-0":"w-auto max-w-[95vw] max-h-[95vh] rounded-[24px] p-2"}`,onClick:d=>d.stopPropagation(),children:[n,i.jsx("div",{className:`absolute ${r?"top-4 right-4 text-white":"top-2 right-4 text-gray-400 hover:text-white"} text-2xl cursor-pointer z-50`,onClick:u,children:"×"})]})]}),document.body):null},JBt=({progress:t=0,size:e=24,strokeWidth:n=3})=>{const r=(e-n)/2,s=2*Math.PI*r,a=s-t/100*s;return i.jsxs("svg",{width:e,height:e,style:{transform:"rotate(-90deg)"},children:[i.jsx("circle",{stroke:"#FFFFFF",fill:"transparent",strokeWidth:n,r,cx:e/2,cy:e/2}),i.jsx("circle",{stroke:"#000000",fill:"transparent",strokeWidth:n,r,cx:e/2,cy:e/2,strokeDasharray:s,strokeDashoffset:a,strokeLinecap:"round"})]})},e$t=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState(null),[s,a]=m.useState(0),[o,l]=m.useState(15),c=window.localStorage.getItem("hyperToken"),u=window.localStorage.getItem("hyperAddress"),d=m.useRef(null),f=m.useRef(null),x=2e3;m.useEffect(()=>{let P=null;return n&&(l(15),P=setInterval(()=>{l(T=>T<=1?(clearInterval(P),y(),0):T-1)},1e3)),()=>{P&&clearInterval(P)}},[n]);const g=()=>{r(null),a(0),e(!0)},y=()=>{e(!1),N()},v=()=>{a(0),f.current=Date.now(),d.current=setInterval(()=>{const T=(Date.now()-f.current)/x,M=Math.min(T*100,100);a(M),T>=1&&(clearInterval(d.current),d.current=null,a(100),ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/sign_mobile_start/",{address:u,token:c}).then(F=>{const{temp_mobile_password:$}=F.data;r($)}).catch(F=>{console.error("Axios error:",F)}))},30)},C=()=>{N()},N=()=>{d.current&&(clearInterval(d.current),d.current=null),a(0)};return m.useEffect(()=>()=>{d.current&&clearInterval(d.current)},[]),i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:g,className:"cursor-pointer text-white flex items-center justify-center",children:i.jsx(TSt,{className:"mr-2"})}),i.jsx(yp,{isOpen:t,onClose:y,children:i.jsx("div",{className:"flex flex-col items-center text-center text-white px-4 py-6 rounded-md mx-auto",children:n?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:Yi,className:"w-12 h-12 mb-4",alt:"Dextrabot"}),i.jsx("h2",{className:"mt-2 text-xl font-semibold",children:"Link Mobile Device"}),i.jsx("p",{className:"mt-2 text-sm leading-normal text-gray-300",children:"Scan this QR code with your native camera to connect."}),i.jsx("div",{className:"mt-4 bg-white p-2",children:i.jsx(ZBt,{value:`${window.location.origin}/mobile-auth?temp_mobile_password=${n}`})}),i.jsxs("p",{className:"mt-4 text-sm text-gray-400",children:["This window will close automatically in"," ",i.jsx("span",{className:"text-white font-semibold",children:o})," ","seconds."]})]}):i.jsxs(i.Fragment,{children:[i.jsx("img",{src:Yi,className:"w-12 h-12 mb-4",alt:"Dextrabot"}),i.jsx("h2",{className:"mt-2 text-xl font-semibold",children:"Link Mobile Device"}),i.jsxs("p",{className:"mt-2 text-sm leading-normal text-gray-300",children:["Just open your camera and scan the QR code to log in to"," ",i.jsx("span",{className:"text-[#46eda1]",children:"Dextra."}),i.jsx("br",{}),"This QR code enables mobile copy trading (not deposits or withdrawals). Do not share this code or screenshots of it with anyone. Make sure you're not sharing your screen."]}),i.jsxs("button",{onMouseDown:v,onMouseUp:C,onMouseLeave:C,onTouchStart:v,onTouchEnd:C,className:`mt-6 flex items-center space-x-2 px-4 py-2 rounded-md
bg-[#46eda1] text-black font-medium text-sm`,children:[i.jsx("div",{className:"text-black",children:i.jsx(JBt,{progress:s,size:16,strokeWidth:3})}),i.jsx("span",{children:"Hold to Reveal"})]})]})})})]})},Os=({className:t})=>i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M13.5525 10.8225L9.00001 15.375L4.44751 10.8225",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9 2.62506V15.2476",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ma=({content:t,positionTop:e,alignRight:n})=>i.jsxs("span",{className:`tooltip ${n?"left-5 top-1/2 -translate-y-1/2 ":e?"-top-6 -translate-x-1/2 left-1/2":"-bottom-6 -translate-x-1/2 left-1/2"} transform bg-[#353535] text-white font-manrope font-semibold text-xs leading-3 py-1 px-1.5 rounded-sm relative whitespace-nowrap`,children:[t,i.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`absolute transform -z-1 ${n?"-rotate-90 left-1 -translate-x-full -translate-y-1/2 top-1/2 ":e?"-bottom-1 rotate-180 -translate-x-1/2 left-1/2":"-top-1 -translate-x-1/2 left-1/2"}`,children:i.jsx("path",{d:"M3.70096 1.25C4.27831 0.25 5.72169 0.25 6.29904 1.25L8.89711 5.75C9.47446 6.75 8.75278 8 7.59808 8H2.40192C1.24722 8 0.525536 6.75 1.10289 5.75L3.70096 1.25Z",fill:"#353535"})})]}),t$t=()=>{const{hyperToken:t,notificationData:e,setNotificationData:n,announcementData:r,setAnnouncementData:s,handleAnnouncement:a}=m.useContext(Qr),{isConnected:o,address:l}=ns(),[c,u]=m.useState(window.localStorage.getItem("selectedNotificationTab")||"notification"),f=localStorage.getItem("isDateNotificationFormat")||"date",[x,g]=m.useState(f),v=localStorage.getItem("isDateAnnouncementFormat")||"date",[C,N]=m.useState(v),[P,T]=m.useState(!1);m.useEffect(()=>{localStorage.setItem("isDateNotificationFormat",x)},[x]),m.useEffect(()=>{localStorage.setItem("isDateNotificationFormat",C)},[C]),m.useEffect(()=>{if(!window.localStorage.getItem("hyperToken")||!l){n([]),s([]);return}const X=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`,ne=J=>{if(J.key===X){const K=JSON.parse(J.newValue||"[]");n(K)}};return window.addEventListener("storage",ne),()=>window.removeEventListener("storage",ne)},[t,l]),m.useEffect(()=>{const L=window.localStorage.getItem("hyperToken");if(!P||c!="notification"||!L)return;const X=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`;if(!e.some(K=>!K.is_read))return;const J=setTimeout(()=>{const K=e.map(te=>te.is_read?te:{...te,is_read:!0});n(K),localStorage.setItem(X,JSON.stringify(K))},1e3);return()=>clearTimeout(J)},[e,P,c]),m.useEffect(()=>{var X;if(!P||c!=="announcement"||!(r!=null&&r.announcements)||((X=r==null?void 0:r.announcements)==null?void 0:X.length)===0)return;const L="readNotSignAnnouncementIds",z=setTimeout(()=>{const ne=JSON.parse(localStorage.getItem(L)||"[]"),J=r==null?void 0:r.announcements.map(K=>K.id).filter(K=>!ne.includes(K));if(J.length>0){const K=[...ne,...J];localStorage.setItem(L,JSON.stringify(K))}},1e3);return()=>clearTimeout(z)},[r,P,c,t]);const M=async()=>{try{const L=window.localStorage.getItem("hyperToken"),z="https://dextrabothypev2.nftinit.io/api/subscriber/announcement/setlastseenannouncement/";if(!o||!L)return;const X=await fetch(z,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l==null?void 0:l.toLowerCase(),token:L})});if(!X.ok)throw new Error(`Server responded with status ${X.status}`);const ne=await X.json();ne.success?a():console.log(ne.error_message)}catch(L){console.error("Error in handleAnnouncement:",L)}};m.useEffect(()=>{!P||c!=="announcement"||(r==null?void 0:r.new_announcement_count)>0&&t&&o&&M()},[P,c]);const F=e.filter(L=>!L.is_read).length,$=(()=>{var X,ne;const L=l==null?void 0:l.toLowerCase(),z=window.localStorage.getItem("hyperToken");if(!L||!z){const J="readNotSignAnnouncementIds",K=new Set(JSON.parse(localStorage.getItem(J)||"[]").map(String)),te=new Date,fe=new Date;return fe.setDate(te.getDate()-2),(X=r==null?void 0:r.announcements)==null?void 0:X.filter(q=>{const se=new Date(q==null?void 0:q.created_at);return!K.has(String(q==null?void 0:q.id))&&se>=fe}).length}if(L&&z&&(r==null?void 0:r.new_announcement_count)>0){const J="readNotSignAnnouncementIds",K=new Set(JSON.parse(localStorage.getItem(J)||"[]").map(String));return((ne=r==null?void 0:r.announcements)==null?void 0:ne.filter(fe=>fe.is_new&&!K.has(String(fe.id))).length)||0}return(r==null?void 0:r.new_announcement_count)||0})();return i.jsx(MB,{as:"div",className:"relative hidden sm:inline-block text-left",children:({open:L,close:z})=>{var X,ne;return m.useEffect(()=>{T(L)},[L]),i.jsxs(i.Fragment,{children:[i.jsx("div",{children:i.jsxs(FB,{className:"relative inline-flex w-full justify-center rounded-md gap-x-1.5 p-1 text-[11px] font-semibold text-gray-900 shadow-sm focus:outline-none focus:ring-0 border-none bg-transparent mt-[2px]",children:[i.jsxs("div",{className:"relative",children:[$>0&&i.jsx("span",{className:"absolute flex h-6 w-6 rounded-full bg-[#FF797C] opacity-55 animate-ping duration-[30000ms] top-0 left-0"}),i.jsx("img",{src:Hlt,alt:"",className:`${$>0?"bg-transparent":"bg-[#1a1a1a]"} w-[18px] h-[18px] min-w-[18px] min-h-[18px] relative z-10`})]}),($>0||F>0)&&i.jsx("span",{className:`${$+F>99?"":"w-5 h-5"} absolute -top-1 bg-[#FF373B] text-white rounded-full flex items-center justify-center text-[10px] -right-1 p-0.5 z-20`,children:$+F>99?"99+":$+F})]})}),i.jsx(q7e,{as:m.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:i.jsxs(OB,{className:"absolute -right-3 mt-2 w-[432px] min-h-60 max-h-96 sm:max-h-[600px] origin-top-right rounded-lg bg-[#242424] ring-1 ring-black ring-opacity-5 focus:outline-none flex flex-col gap-[15px] z-[55]",children:[i.jsxs("div",{className:"flex flex-col gap-4 bg-[#242424] relative rounded-tl-lg rounded-tr-lg px-4 pt-4",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("div",{className:"absolute -top-2 right-[21px]",children:i.jsx("img",{src:vEe})}),i.jsx("span",{className:"flex gap-1.5 items-center text-white text-base font-semibold font-['Manrope'] leading-[21px] select-none",children:"Notifications"}),i.jsx("div",{className:"flex justify-center items-center gap-2",children:c!="announcement"&&i.jsxs("div",{className:"flex justify-center items-center relative has-tooltip",children:[i.jsx(BBt,{onClick:J=>{J.preventDefault();const K=window.localStorage.getItem("hyperToken");if(!l||!K)return;const te=`notificationsFeedSocket_${l==null?void 0:l.toLowerCase()}`;n([]),localStorage.removeItem(te)},className:`${(e==null?void 0:e.length)>0?"text-[#7f7f7f] hover:text-[#c8c6c6]":"text-[#7f7f7f]"} w-4 h-4 cursor-pointer -mt-[2px]`}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Clear All",positionTop:!1,alignRight:!1})})]})})]}),i.jsx("div",{className:"flex flex-col justify-start items-start w-full",children:i.jsxs("div",{className:"flex justify-stretch w-full gap-[15px]",children:[i.jsxs("div",{onClick:()=>{u("notification"),window.localStorage.setItem("selectedNotificationTab","notification")},className:`relative ${c==="notification"?"text-white bg-[#494949] rounded-lg inline-flex justify-center items-center gap-1":"text-[#919191]"} flex h-7 px-1.5 py-1 justify-center items-center gap-2 itext-white text-[13px] font-semibold font-['Manrope'] leading-[18px] cursor-pointer select-none`,children:["Notifications",F>0&&i.jsx("div",{className:"w-[18px] h-[18px] bg-[#ff373b] rounded-[256px] inline-flex justify-center items-center gap-2.5",children:i.jsx("div",{className:"justify-start text-white text-[11px] font-bold font-['Manrope'] leading-[10px]",children:F})})]}),i.jsxs("div",{onClick:()=>{u("announcement"),window.localStorage.setItem("selectedNotificationTab","announcement")},className:`relative ${c==="announcement"?"text-white bg-[#494949] rounded-lg inline-flex justify-center items-center gap-1":"text-[#919191]"} flex h-7 px-1.5 py-1 justify-center items-center gap-2 itext-white text-[13px] font-semibold font-['Manrope'] leading-[18px] cursor-pointer select-none`,children:["Announcements",$>0&&i.jsx("div",{className:"w-[18px] h-[18px] bg-[#ff373b] rounded-[256px] inline-flex justify-center items-center gap-2.5",children:i.jsx("div",{className:"justify-start text-white text-[11px] font-bold font-['Manrope'] leading-[10px]",children:$})})]})]})})]}),i.jsx("div",{className:"px-2 mb-4 overflow-auto text-[13px] leading-4 font-semibold",children:c==="notification"&&(e==null?void 0:e.length)>0?i.jsx("div",{className:"flex flex-col items-start justify-center gap-1 w-full",children:e==null?void 0:e.map((J,K)=>i.jsx(n$t,{listenUser:J==null?void 0:J.listen_user,asset:J==null?void 0:J.coin,feeToken:J==null?void 0:J.feeToken,dir:J==null?void 0:J.dir,leverage:J==null?void 0:J.leverage,type:J==null?void 0:J.fill_direction_type,time:J==null?void 0:J.time,status:J.message,isDateFormat:x,setIsDateFormat:g,close:z,isError:J==null?void 0:J.success,traderPNL:J==null?void 0:J.trader_pnl,targetPlatform:J==null?void 0:J.target_platform},K))}):c==="announcement"&&((X=r==null?void 0:r.announcements)==null?void 0:X.length)>0?i.jsx("div",{className:"flex flex-col items-start justify-center gap-1 w-full",children:(ne=r==null?void 0:r.announcements)==null?void 0:ne.map((J,K)=>i.jsx(r$t,{address:J==null?void 0:J.address,content:J==null?void 0:J.content,createdAt:J==null?void 0:J.created_at,typeId:J==null?void 0:J.type_id,isDateAnnouncementFormat:C,setIsDateAnnouncementFormat:N},K))}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center gap-2 py-9",children:[i.jsx("span",{children:i.jsx("img",{src:klt,alt:""})}),i.jsx("span",{className:"text-[#9C9C9C] text-[13px] leading-4 font-semibold text-center px-4",children:"So clean! You have no new notifications"})]})})]})})]})}})},n$t=({asset:t,type:e,status:n,feeToken:r,dir:s,leverage:a,listenUser:o,time:l,isDateFormat:c,setIsDateFormat:u,close:d,isError:f,traderPNL:x,targetPlatform:g})=>{function y({date:C}){const[N,P]=m.useState($o(C));return m.useEffect(()=>{const T=setInterval(()=>{P($o(C))},1e3);return()=>clearInterval(T)},[C]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:N.dateTime})}const v={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("span",{onClick:()=>{window.location.pathname+window.location.hash==="/tracker#my-activities"?d():window.open("/tracker","_self")},className:"flex gap-2 items-start justify-start px-3 pt-3 pb-2 bg-[#2b2b2b] rounded-2xl min-w-full hover:bg-[#373737] cursor-pointer min-h-16 relative",children:[i.jsx("div",{className:`${f?"bg-[#67ffbd]":"bg-[#ff787b]"} w-0.5 h-10 min-h-10 absolute left-0 top-[27.5%]`}),i.jsxs("div",{className:"flex flex-col items-center gap-3",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${v[t]||(t==null?void 0:t.split("/")[0])}.svg`||dummyImage,alt:t,className:"rounded-full w-8 h-8 min-w-8 min-h-8 bg-white",loading:"lazy",onError:C=>wm(C)}),g==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx("img",{src:I1,alt:"hyper",className:"w-4 h-4 rounded-sm"})}):g==="lighter"?i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsx(bf,{className:"w-4 h-4 text-[#fff]"})}):""]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[3px] w-full",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1 w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsxs("div",{className:"text-white text-[13px] font-bold font-['Manrope'] leading-[18px]",children:[t,"/",r??"USDC"]}),i.jsxs("div",{className:"flex justify-start gap-1 items-center ml-[2px]",children:[i.jsxs("div",{className:`${s!=null&&s.includes("Long")?s==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":s==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":s=="Buy"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-[18px] pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex min-w-max`,children:[i.jsx("div",{className:"w-2.5 h-2.5 justify-center items-center flex",children:i.jsx("div",{className:"w-2.5 h-2.5 relative",children:s!=null&&s.includes("Long")?s==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-2.5 h-2.5"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):s=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-2.5 h-2.5"}):i.jsx(Os,{className:"text-[#FF797C] w-2.5 h-2.5"})})}),i.jsxs("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:[s=="Sell"?"Sell":s=="Buy"?"Buy":s=="Close Short"?"Short":s=="Close Long"?"Long":s=="Open Short"?"Short":s=="Open Long"?"Long":s||"--",a?" - "+a+"X":""]})]}),i.jsxs("div",{onClick:C=>{C.stopPropagation(),window.open(`/wallet-details/${o}`,"_blank")},className:"flex justify-start items-center gap-1 cursor-pointer min-w-max h-[18px] px-1.5 py-[3px] bg-white/20 rounded-md",children:[i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-none ",children:o&&(o==null?void 0:o.slice(0,5))+"..."+(o==null?void 0:o.slice(-4))}),i.jsx("img",{onClick:C=>{C.stopPropagation(),navigator.clipboard.writeText(o),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})]}),i.jsx("div",{className:"w-[18px] h-[18px] min-w-[18px] min-h-[18px] flex justify-center items-center rounded",children:i.jsx("img",{src:pae,alt:""})})]}),i.jsx("span",{className:"text-[#b7b7b7] text-xs font-medium font-['Manrope'] leading-[15px] tracking-tight select-none max-w-[92%]",children:n&&(n==null?void 0:n.length)>100?(n==null?void 0:n.slice(0,105))+"...":n}),i.jsxs("div",{className:`${x!=null&&x!==0?"justify-between":"justify-end"} flex items-center w-full`,children:[i.jsx("div",{className:`${x!=null&&x!==0?x>0?"text-[#67ffbd] bg-[#67ffbd]/20":"bg-[#ff787b]/20 text-[#ff787b]":"hidden"} text-[11px] font-semibold font-['Manrope'] leading-[8px] p-1.5 rounded-md inline-flex justify-center items-center gap-1 max-h-5`,children:x!=null&&x!==0?x>0?`+$${_r(x)}`:`-$${_r(Math.abs(x))}`:""}),i.jsx("div",{onClick:C=>{C.stopPropagation(),u(c=="time"?"date":"time")},className:"flex justify-center items-center text-[#a5a5a5] text-[11px] font-medium font-['Manrope'] leading-[13px] tracking-tight cursor-pointer min-w-max w-max",children:c=="time"?i.jsx(y,{date:l}):cu(l)})]})]})]})},r$t=({address:t,content:e,createdAt:n,typeId:r,isDateAnnouncementFormat:s,setIsDateAnnouncementFormat:a})=>{function o({date:u}){const[d,f]=m.useState($o(u));return m.useEffect(()=>{const x=setInterval(()=>{f($o(u))},1e3);return()=>clearInterval(x)},[u]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:d.dateTime})}function l(u){if(!u)return null;try{const f=new URL(u).searchParams.get("v");return f?`https://img.youtube.com/vi/${f}/default.jpg`:null}catch(d){return console.error("Invalid YouTube URL:",u,d),null}}const c=l(e==null?void 0:e.url);return i.jsxs("span",{onClick:u=>{var d;u.preventDefault(),typeof(e==null?void 0:e.url)=="string"&&e.url.trim()!==""&&window.open((d=e==null?void 0:e.url)==null?void 0:d.trim(),"_blank")},className:`${typeof(e==null?void 0:e.url)=="string"&&e.url.trim()!==""?"cursor-pointer":""} flex gap-2 items-start justify-start px-3 pt-3 pb-2 bg-[#2b2b2b] rounded-2xl min-w-full hover:bg-[#404040] min-h-16 relative`,children:[i.jsx("div",{className:`${r==1?"w-8 h-8 min-w-8 min-h-8 bg-[#ff4848] rounded-full":r==2?c?"w-[75px] h-[56px] min-w-[75px] min-h-[56px] rounded-xl":"w-8 h-8 min-w-8 min-h-8 bg-[#FF0000] rounded-full":"w-8 h-8 min-w-8 min-h-8 bg-[#191919] rounded-full"} flex justify-center items-center overflow-hidden`,children:i.jsx("img",{src:r==1?zlt:r==2?c||Wlt:Vlt,alt:"",className:`${r==2?c?"w-[75px] h-[56px] min-w-[75px] min-h-[56px]":"w-[10px] h-[12px] min-w-[10px] min-h-[12px] ml-[2px]":r==3?"w-[13.92px] h-[13px] min-w-[13.92px] min-h-[13px]":"w-[18px] h-[18px] min-w-[18px] min-h-[18px]"} `,loading:"lazy",onError:u=>wm(u)})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[3px] w-full",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1 w-full",children:[i.jsx("div",{className:"text-white text-[13px] font-bold font-['Manrope'] leading-[18px]",children:e==null?void 0:e.title}),typeof(e==null?void 0:e.url)=="string"&&e.url.trim()!==""&&i.jsx("div",{className:"w-[18px] h-[18px] min-w-[18px] min-h-[18px] flex justify-center items-center rounded",children:i.jsx("img",{src:pae,alt:""})})]}),i.jsx("span",{className:"text-[#B7B7B7] text-xs font-medium font-['Manrope'] leading-[15px] tracking-tight select-none max-w-[92%]",children:e==null?void 0:e.message}),i.jsx("div",{className:"flex justify-end items-center w-full",children:i.jsx("div",{onClick:u=>{u.stopPropagation(),a(s=="time"?"date":"time")},className:"flex justify-end items-center text-[#a5a5a5] text-[11px] font-medium font-['Manrope'] leading-[13px] tracking-tight cursor-pointer min-w-max w-max",children:s=="time"?i.jsx(o,{date:n}):cu(n)})})]})]})},s$t=()=>{const{hyperToken:t}=m.useContext(Qr),[e,n]=m.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(wU,{open:e,setOpen:n}),i.jsx("div",{className:"bg-[#171717] w-full px-2 sm:px-6 border-b border-[#2a2a2a] z-50",children:i.jsxs("div",{className:"flex items-center w-full h-16 gap-2",children:[i.jsx("div",{className:"flex-none",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx(JFt,{})})}),i.jsxs("div",{className:"ml-auto flex items-center",children:[i.jsx("div",{className:"hidden sm:block w-[140px] mr-[12px]",children:i.jsx(VLe,{})}),t&&i.jsx(e$t,{}),i.jsx(t$t,{}),i.jsx("span",{className:"hidden sm:block ml-2",children:i.jsx(UBt,{})})]})]})})]})},ld=({className:t})=>i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M9.96004 4.4751L6.70004 7.7351C6.31504 8.1201 5.68504 8.1201 5.30004 7.7351L2.04004 4.4751",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})});var js;(function(t){t[t.QR_CODE=0]="QR_CODE",t[t.AZTEC=1]="AZTEC",t[t.CODABAR=2]="CODABAR",t[t.CODE_39=3]="CODE_39",t[t.CODE_93=4]="CODE_93",t[t.CODE_128=5]="CODE_128",t[t.DATA_MATRIX=6]="DATA_MATRIX",t[t.MAXICODE=7]="MAXICODE",t[t.ITF=8]="ITF",t[t.EAN_13=9]="EAN_13",t[t.EAN_8=10]="EAN_8",t[t.PDF_417=11]="PDF_417",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(js||(js={}));var g2e=new Map([[js.QR_CODE,"QR_CODE"],[js.AZTEC,"AZTEC"],[js.CODABAR,"CODABAR"],[js.CODE_39,"CODE_39"],[js.CODE_93,"CODE_93"],[js.CODE_128,"CODE_128"],[js.DATA_MATRIX,"DATA_MATRIX"],[js.MAXICODE,"MAXICODE"],[js.ITF,"ITF"],[js.EAN_13,"EAN_13"],[js.EAN_8,"EAN_8"],[js.PDF_417,"PDF_417"],[js.RSS_14,"RSS_14"],[js.RSS_EXPANDED,"RSS_EXPANDED"],[js.UPC_A,"UPC_A"],[js.UPC_E,"UPC_E"],[js.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),b2e;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.URL=1]="URL"})(b2e||(b2e={}));function i$t(t){return Object.values(js).includes(t)}var OL;(function(t){t[t.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",t[t.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(OL||(OL={}));var a$t=function(){function t(){}return t.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",t.SCAN_DEFAULT_FPS=2,t.DEFAULT_DISABLE_FLIP=!1,t.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,t.DEFAULT_SUPPORTED_SCAN_TYPE=[OL.SCAN_TYPE_CAMERA,OL.SCAN_TYPE_FILE],t}(),o$e=function(){function t(e,n){this.format=e,this.formatName=n}return t.prototype.toString=function(){return this.formatName},t.create=function(e){if(!g2e.has(e))throw"".concat(e," not in html5QrcodeSupportedFormatsTextMap");return new t(e,g2e.get(e))},t}(),y2e=function(){function t(){}return t.createFromText=function(e){var n={text:e};return{decodedText:e,result:n}},t.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},t}(),Cne;(function(t){t[t.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",t[t.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",t[t.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Cne||(Cne={}));var o$t=function(){function t(){}return t.createFrom=function(e){return{errorMessage:e,type:Cne.UNKWOWN_ERROR}},t}(),l$t=function(){function t(e){this.verbose=e}return t.prototype.log=function(e){this.verbose&&console.log(e)},t.prototype.warn=function(e){this.verbose&&console.warn(e)},t.prototype.logError=function(e,n){(this.verbose||n===!0)&&console.error(e)},t.prototype.logErrors=function(e){if(e.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},t}();function mg(t){return typeof t>"u"||t===null}var a4=function(){function t(){}return t.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},t.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},t.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},t.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},t.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},t.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},t.scannerPaused=function(){return"Scanner paused"},t}(),l$e=function(){function t(){}return t.isMediaStreamConstraintsValid=function(e,n){if(typeof e!="object"){var r=typeof e;return n.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var s=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],a=new Set(s),o=Object.keys(e),l=0,c=o;l<c.length;l++){var u=c[l];if(a.has(u))return n.logError("".concat(u," is not supported videoConstaints."),!0),!1}return!0},t}(),r9={exports:{}},c$t=r9.exports,v2e;function u$t(){return v2e||(v2e=1,function(t,e){(function(n,r){r(e)})(c$t,function(n){function r(ft){return ft==null}var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ft,w){ft.__proto__=w}||function(ft,w){for(var E in w)w.hasOwnProperty(E)&&(ft[E]=w[E])};function a(ft,w){s(ft,w);function E(){this.constructor=ft}ft.prototype=w===null?Object.create(w):(E.prototype=w.prototype,new E)}function o(ft,w){var E=Object.setPrototypeOf;E?E(ft,w):ft.__proto__=w}function l(ft,w){w===void 0&&(w=ft.constructor);var E=Error.captureStackTrace;E&&E(ft,w)}var c=function(ft){a(w,ft);function w(E){var O=this.constructor,U=ft.call(this,E)||this;return Object.defineProperty(U,"name",{value:O.name,enumerable:!1}),o(U,O.prototype),l(U),U}return w}(Error);class u extends c{constructor(w=void 0){super(w),this.message=w}getKind(){return this.constructor.kind}}u.kind="Exception";class d extends u{}d.kind="ArgumentException";class f extends u{}f.kind="IllegalArgumentException";class x{constructor(w){if(this.binarizer=w,w===null)throw new f("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(w,E){return this.binarizer.getBlackRow(w,E)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(w,E,O,U){const H=this.binarizer.getLuminanceSource().crop(w,E,O,U);return new x(this.binarizer.createBinarizer(H))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const w=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new x(this.binarizer.createBinarizer(w))}rotateCounterClockwise45(){const w=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new x(this.binarizer.createBinarizer(w))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class g extends u{static getChecksumInstance(){return new g}}g.kind="ChecksumException";class y{constructor(w){this.source=w}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class v{static arraycopy(w,E,O,U,H){for(;H--;)O[U++]=w[E++]}static currentTimeMillis(){return Date.now()}}class C extends u{}C.kind="IndexOutOfBoundsException";class N extends C{constructor(w=void 0,E=void 0){super(E),this.index=w,this.message=E}}N.kind="ArrayIndexOutOfBoundsException";class P{static fill(w,E){for(let O=0,U=w.length;O<U;O++)w[O]=E}static fillWithin(w,E,O,U){P.rangeCheck(w.length,E,O);for(let H=E;H<O;H++)w[H]=U}static rangeCheck(w,E,O){if(E>O)throw new f("fromIndex("+E+") > toIndex("+O+")");if(E<0)throw new N(E);if(O>w)throw new N(O)}static asList(...w){return w}static create(w,E,O){return Array.from({length:w}).map(H=>Array.from({length:E}).fill(O))}static createInt32Array(w,E,O){return Array.from({length:w}).map(H=>Int32Array.from({length:E}).fill(O))}static equals(w,E){if(!w||!E||!w.length||!E.length||w.length!==E.length)return!1;for(let O=0,U=w.length;O<U;O++)if(w[O]!==E[O])return!1;return!0}static hashCode(w){if(w===null)return 0;let E=1;for(const O of w)E=31*E+O;return E}static fillUint8Array(w,E){for(let O=0;O!==w.length;O++)w[O]=E}static copyOf(w,E){return w.slice(0,E)}static copyOfUint8Array(w,E){if(w.length<=E){const O=new Uint8Array(E);return O.set(w),O}return w.slice(0,E)}static copyOfRange(w,E,O){const U=O-E,H=new Int32Array(U);return v.arraycopy(w,E,H,0,U),H}static binarySearch(w,E,O){O===void 0&&(O=P.numberComparator);let U=0,H=w.length-1;for(;U<=H;){const Q=H+U>>1,le=O(E,w[Q]);if(le>0)U=Q+1;else if(le<0)H=Q-1;else return Q}return-U-1}static numberComparator(w,E){return w-E}}class T{static numberOfTrailingZeros(w){let E;if(w===0)return 32;let O=31;return E=w<<16,E!==0&&(O-=16,w=E),E=w<<8,E!==0&&(O-=8,w=E),E=w<<4,E!==0&&(O-=4,w=E),E=w<<2,E!==0&&(O-=2,w=E),O-(w<<1>>>31)}static numberOfLeadingZeros(w){if(w===0)return 32;let E=1;return w>>>16||(E+=16,w<<=16),w>>>24||(E+=8,w<<=8),w>>>28||(E+=4,w<<=4),w>>>30||(E+=2,w<<=2),E-=w>>>31,E}static toHexString(w){return w.toString(16)}static toBinaryString(w){return String(parseInt(String(w),2))}static bitCount(w){return w=w-(w>>>1&1431655765),w=(w&858993459)+(w>>>2&858993459),w=w+(w>>>4)&252645135,w=w+(w>>>8),w=w+(w>>>16),w&63}static truncDivision(w,E){return Math.trunc(w/E)}static parseInt(w,E=void 0){return parseInt(w,E)}}T.MIN_VALUE_32_BITS=-2147483648,T.MAX_VALUE=Number.MAX_SAFE_INTEGER;class M{constructor(w,E){w===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=w,E==null?this.bits=M.makeArray(w):this.bits=E)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(w){if(w>this.bits.length*32){const E=M.makeArray(w);v.arraycopy(this.bits,0,E,0,this.bits.length),this.bits=E}}get(w){return(this.bits[Math.floor(w/32)]&1<<(w&31))!==0}set(w){this.bits[Math.floor(w/32)]|=1<<(w&31)}flip(w){this.bits[Math.floor(w/32)]^=1<<(w&31)}getNextSet(w){const E=this.size;if(w>=E)return E;const O=this.bits;let U=Math.floor(w/32),H=O[U];H&=~((1<<(w&31))-1);const Q=O.length;for(;H===0;){if(++U===Q)return E;H=O[U]}const le=U*32+T.numberOfTrailingZeros(H);return le>E?E:le}getNextUnset(w){const E=this.size;if(w>=E)return E;const O=this.bits;let U=Math.floor(w/32),H=~O[U];H&=~((1<<(w&31))-1);const Q=O.length;for(;H===0;){if(++U===Q)return E;H=~O[U]}const le=U*32+T.numberOfTrailingZeros(H);return le>E?E:le}setBulk(w,E){this.bits[Math.floor(w/32)]=E}setRange(w,E){if(E<w||w<0||E>this.size)throw new f;if(E===w)return;E--;const O=Math.floor(w/32),U=Math.floor(E/32),H=this.bits;for(let Q=O;Q<=U;Q++){const le=Q>O?0:w&31,Te=(2<<(Q<U?31:E&31))-(1<<le);H[Q]|=Te}}clear(){const w=this.bits.length,E=this.bits;for(let O=0;O<w;O++)E[O]=0}isRange(w,E,O){if(E<w||w<0||E>this.size)throw new f;if(E===w)return!0;E--;const U=Math.floor(w/32),H=Math.floor(E/32),Q=this.bits;for(let le=U;le<=H;le++){const ve=le>U?0:w&31,Ze=(2<<(le<H?31:E&31))-(1<<ve)&4294967295;if((Q[le]&Ze)!==(O?Ze:0))return!1}return!0}appendBit(w){this.ensureCapacity(this.size+1),w&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(w,E){if(E<0||E>32)throw new f("Num bits must be between 0 and 32");this.ensureCapacity(this.size+E);for(let O=E;O>0;O--)this.appendBit((w>>O-1&1)===1)}appendBitArray(w){const E=w.size;this.ensureCapacity(this.size+E);for(let O=0;O<E;O++)this.appendBit(w.get(O))}xor(w){if(this.size!==w.size)throw new f("Sizes don't match");const E=this.bits;for(let O=0,U=E.length;O<U;O++)E[O]^=w.bits[O]}toBytes(w,E,O,U){for(let H=0;H<U;H++){let Q=0;for(let le=0;le<8;le++)this.get(w)&&(Q|=1<<7-le),w++;E[O+H]=Q}}getBitArray(){return this.bits}reverse(){const w=new Int32Array(this.bits.length),E=Math.floor((this.size-1)/32),O=E+1,U=this.bits;for(let H=0;H<O;H++){let Q=U[H];Q=Q>>1&1431655765|(Q&1431655765)<<1,Q=Q>>2&858993459|(Q&858993459)<<2,Q=Q>>4&252645135|(Q&252645135)<<4,Q=Q>>8&16711935|(Q&16711935)<<8,Q=Q>>16&65535|(Q&65535)<<16,w[E-H]=Q}if(this.size!==O*32){const H=O*32-this.size;let Q=w[0]>>>H;for(let le=1;le<O;le++){const ve=w[le];Q|=ve<<32-H,w[le-1]=Q,Q=ve>>>H}w[O-1]=Q}this.bits=w}static makeArray(w){return new Int32Array(Math.floor((w+31)/32))}equals(w){if(!(w instanceof M))return!1;const E=w;return this.size===E.size&&P.equals(this.bits,E.bits)}hashCode(){return 31*this.size+P.hashCode(this.bits)}toString(){let w="";for(let E=0,O=this.size;E<O;E++)E&7||(w+=" "),w+=this.get(E)?"X":".";return w}clone(){return new M(this.size,this.bits.slice())}}var F;(function(ft){ft[ft.OTHER=0]="OTHER",ft[ft.PURE_BARCODE=1]="PURE_BARCODE",ft[ft.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",ft[ft.TRY_HARDER=3]="TRY_HARDER",ft[ft.CHARACTER_SET=4]="CHARACTER_SET",ft[ft.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",ft[ft.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",ft[ft.ASSUME_GS1=7]="ASSUME_GS1",ft[ft.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",ft[ft.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",ft[ft.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(F||(F={}));var $=F;class L extends u{static getFormatInstance(){return new L}}L.kind="FormatException";var z;(function(ft){ft[ft.Cp437=0]="Cp437",ft[ft.ISO8859_1=1]="ISO8859_1",ft[ft.ISO8859_2=2]="ISO8859_2",ft[ft.ISO8859_3=3]="ISO8859_3",ft[ft.ISO8859_4=4]="ISO8859_4",ft[ft.ISO8859_5=5]="ISO8859_5",ft[ft.ISO8859_6=6]="ISO8859_6",ft[ft.ISO8859_7=7]="ISO8859_7",ft[ft.ISO8859_8=8]="ISO8859_8",ft[ft.ISO8859_9=9]="ISO8859_9",ft[ft.ISO8859_10=10]="ISO8859_10",ft[ft.ISO8859_11=11]="ISO8859_11",ft[ft.ISO8859_13=12]="ISO8859_13",ft[ft.ISO8859_14=13]="ISO8859_14",ft[ft.ISO8859_15=14]="ISO8859_15",ft[ft.ISO8859_16=15]="ISO8859_16",ft[ft.SJIS=16]="SJIS",ft[ft.Cp1250=17]="Cp1250",ft[ft.Cp1251=18]="Cp1251",ft[ft.Cp1252=19]="Cp1252",ft[ft.Cp1256=20]="Cp1256",ft[ft.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",ft[ft.UTF8=22]="UTF8",ft[ft.ASCII=23]="ASCII",ft[ft.Big5=24]="Big5",ft[ft.GB18030=25]="GB18030",ft[ft.EUC_KR=26]="EUC_KR"})(z||(z={}));class X{constructor(w,E,O,...U){this.valueIdentifier=w,this.name=O,typeof E=="number"?this.values=Int32Array.from([E]):this.values=E,this.otherEncodingNames=U,X.VALUE_IDENTIFIER_TO_ECI.set(w,this),X.NAME_TO_ECI.set(O,this);const H=this.values;for(let Q=0,le=H.length;Q!==le;Q++){const ve=H[Q];X.VALUES_TO_ECI.set(ve,this)}for(const Q of U)X.NAME_TO_ECI.set(Q,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(w){if(w<0||w>=900)throw new L("incorect value");const E=X.VALUES_TO_ECI.get(w);if(E===void 0)throw new L("incorect value");return E}static getCharacterSetECIByName(w){const E=X.NAME_TO_ECI.get(w);if(E===void 0)throw new L("incorect value");return E}equals(w){if(!(w instanceof X))return!1;const E=w;return this.getName()===E.getName()}}X.VALUE_IDENTIFIER_TO_ECI=new Map,X.VALUES_TO_ECI=new Map,X.NAME_TO_ECI=new Map,X.Cp437=new X(z.Cp437,Int32Array.from([0,2]),"Cp437"),X.ISO8859_1=new X(z.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),X.ISO8859_2=new X(z.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),X.ISO8859_3=new X(z.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),X.ISO8859_4=new X(z.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),X.ISO8859_5=new X(z.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),X.ISO8859_6=new X(z.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),X.ISO8859_7=new X(z.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),X.ISO8859_8=new X(z.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),X.ISO8859_9=new X(z.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),X.ISO8859_10=new X(z.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),X.ISO8859_11=new X(z.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),X.ISO8859_13=new X(z.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),X.ISO8859_14=new X(z.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),X.ISO8859_15=new X(z.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),X.ISO8859_16=new X(z.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),X.SJIS=new X(z.SJIS,20,"SJIS","Shift_JIS"),X.Cp1250=new X(z.Cp1250,21,"Cp1250","windows-1250"),X.Cp1251=new X(z.Cp1251,22,"Cp1251","windows-1251"),X.Cp1252=new X(z.Cp1252,23,"Cp1252","windows-1252"),X.Cp1256=new X(z.Cp1256,24,"Cp1256","windows-1256"),X.UnicodeBigUnmarked=new X(z.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),X.UTF8=new X(z.UTF8,26,"UTF8","UTF-8"),X.ASCII=new X(z.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),X.Big5=new X(z.Big5,28,"Big5"),X.GB18030=new X(z.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),X.EUC_KR=new X(z.EUC_KR,30,"EUC_KR","EUC-KR");class ne extends u{}ne.kind="UnsupportedOperationException";class J{static decode(w,E){const O=this.encodingName(E);return this.customDecoder?this.customDecoder(w,O):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(O)?this.decodeFallback(w,O):new TextDecoder(O).decode(w)}static shouldDecodeOnFallback(w){return!J.isBrowser()&&w==="ISO-8859-1"}static encode(w,E){const O=this.encodingName(E);return this.customEncoder?this.customEncoder(w,O):typeof TextEncoder>"u"?this.encodeFallback(w):new TextEncoder().encode(w)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(w){return typeof w=="string"?w:w.getName()}static encodingCharacterSet(w){return w instanceof X?w:X.getCharacterSetECIByName(w)}static decodeFallback(w,E){const O=this.encodingCharacterSet(E);if(J.isDecodeFallbackSupported(O)){let U="";for(let H=0,Q=w.length;H<Q;H++){let le=w[H].toString(16);le.length<2&&(le="0"+le),U+="%"+le}return decodeURIComponent(U)}if(O.equals(X.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(w.buffer));throw new ne(`Encoding ${this.encodingName(E)} not supported by fallback.`)}static isDecodeFallbackSupported(w){return w.equals(X.UTF8)||w.equals(X.ISO8859_1)||w.equals(X.ASCII)}static encodeFallback(w){const O=btoa(unescape(encodeURIComponent(w))).split(""),U=[];for(let H=0;H<O.length;H++)U.push(O[H].charCodeAt(0));return new Uint8Array(U)}}class K{static castAsNonUtf8Char(w,E=null){const O=E?E.getName():this.ISO88591;return J.decode(new Uint8Array([w]),O)}static guessEncoding(w,E){if(E!=null&&E.get($.CHARACTER_SET)!==void 0)return E.get($.CHARACTER_SET).toString();const O=w.length;let U=!0,H=!0,Q=!0,le=0,ve=0,Te=0,Ze=0,xt=0,_t=0,Qt=0,St=0,$t=0,Ht=0,jn=0;const xr=w.length>3&&w[0]===239&&w[1]===187&&w[2]===191;for(let Nr=0;Nr<O&&(U||H||Q);Nr++){const jr=w[Nr]&255;Q&&(le>0?jr&128?le--:Q=!1:jr&128&&(jr&64?(le++,jr&32?(le++,jr&16?(le++,jr&8?Q=!1:Ze++):Te++):ve++):Q=!1)),U&&(jr>127&&jr<160?U=!1:jr>159&&(jr<192||jr===215||jr===247)&&jn++),H&&(xt>0?jr<64||jr===127||jr>252?H=!1:xt--:jr===128||jr===160||jr>239?H=!1:jr>160&&jr<224?(_t++,St=0,Qt++,Qt>$t&&($t=Qt)):jr>127?(xt++,Qt=0,St++,St>Ht&&(Ht=St)):(Qt=0,St=0))}return Q&&le>0&&(Q=!1),H&&xt>0&&(H=!1),Q&&(xr||ve+Te+Ze>0)?K.UTF8:H&&(K.ASSUME_SHIFT_JIS||$t>=3||Ht>=3)?K.SHIFT_JIS:U&&H?$t===2&&_t===2||jn*10>=O?K.SHIFT_JIS:K.ISO88591:U?K.ISO88591:H?K.SHIFT_JIS:Q?K.UTF8:K.PLATFORM_DEFAULT_ENCODING}static format(w,...E){let O=-1;function U(Q,le,ve,Te,Ze,xt){if(Q==="%%")return"%";if(E[++O]===void 0)return;Q=Te?parseInt(Te.substr(1)):void 0;let _t=Ze?parseInt(Ze.substr(1)):void 0,Qt;switch(xt){case"s":Qt=E[O];break;case"c":Qt=E[O][0];break;case"f":Qt=parseFloat(E[O]).toFixed(Q);break;case"p":Qt=parseFloat(E[O]).toPrecision(Q);break;case"e":Qt=parseFloat(E[O]).toExponential(Q);break;case"x":Qt=parseInt(E[O]).toString(_t||16);break;case"d":Qt=parseFloat(parseInt(E[O],_t||10).toPrecision(Q)).toFixed(0);break}Qt=typeof Qt=="object"?JSON.stringify(Qt):(+Qt).toString(_t);let St=parseInt(ve),$t=ve&&ve[0]+""=="0"?"0":" ";for(;Qt.length<St;)Qt=le!==void 0?Qt+$t:$t+Qt;return Qt}let H=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(H,U)}static getBytes(w,E){return J.encode(w,E)}static getCharCode(w,E=0){return w.charCodeAt(E)}static getCharAt(w){return String.fromCharCode(w)}}K.SHIFT_JIS=X.SJIS.getName(),K.GB2312="GB2312",K.ISO88591=X.ISO8859_1.getName(),K.EUC_JP="EUC_JP",K.UTF8=X.UTF8.getName(),K.PLATFORM_DEFAULT_ENCODING=K.UTF8,K.ASSUME_SHIFT_JIS=!1;class te{constructor(w=""){this.value=w}enableDecoding(w){return this.encoding=w,this}append(w){return typeof w=="string"?this.value+=w.toString():this.encoding?this.value+=K.castAsNonUtf8Char(w,this.encoding):this.value+=String.fromCharCode(w),this}appendChars(w,E,O){for(let U=E;E<E+O;U++)this.append(w[U]);return this}length(){return this.value.length}charAt(w){return this.value.charAt(w)}deleteCharAt(w){this.value=this.value.substr(0,w)+this.value.substring(w+1)}setCharAt(w,E){this.value=this.value.substr(0,w)+E+this.value.substr(w+1)}substring(w,E){return this.value.substring(w,E)}setLengthToZero(){this.value=""}toString(){return this.value}insert(w,E){this.value=this.value.substr(0,w)+E+this.value.substr(w+E.length)}}class fe{constructor(w,E,O,U){if(this.width=w,this.height=E,this.rowSize=O,this.bits=U,E==null&&(E=w),this.height=E,w<1||E<1)throw new f("Both dimensions must be greater than 0");O==null&&(O=Math.floor((w+31)/32)),this.rowSize=O,U==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(w){const E=w.length,O=w[0].length,U=new fe(O,E);for(let H=0;H<E;H++){const Q=w[H];for(let le=0;le<O;le++)Q[le]&&U.set(le,H)}return U}static parseFromString(w,E,O){if(w===null)throw new f("stringRepresentation cannot be null");const U=new Array(w.length);let H=0,Q=0,le=-1,ve=0,Te=0;for(;Te<w.length;)if(w.charAt(Te)===`
`||w.charAt(Te)==="\r"){if(H>Q){if(le===-1)le=H-Q;else if(H-Q!==le)throw new f("row lengths do not match");Q=H,ve++}Te++}else if(w.substring(Te,Te+E.length)===E)Te+=E.length,U[H]=!0,H++;else if(w.substring(Te,Te+O.length)===O)Te+=O.length,U[H]=!1,H++;else throw new f("illegal character encountered: "+w.substring(Te));if(H>Q){if(le===-1)le=H-Q;else if(H-Q!==le)throw new f("row lengths do not match");ve++}const Ze=new fe(le,ve);for(let xt=0;xt<H;xt++)U[xt]&&Ze.set(Math.floor(xt%le),Math.floor(xt/le));return Ze}get(w,E){const O=E*this.rowSize+Math.floor(w/32);return(this.bits[O]>>>(w&31)&1)!==0}set(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]|=1<<(w&31)&4294967295}unset(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]&=~(1<<(w&31)&4294967295)}flip(w,E){const O=E*this.rowSize+Math.floor(w/32);this.bits[O]^=1<<(w&31)&4294967295}xor(w){if(this.width!==w.getWidth()||this.height!==w.getHeight()||this.rowSize!==w.getRowSize())throw new f("input matrix dimensions do not match");const E=new M(Math.floor(this.width/32)+1),O=this.rowSize,U=this.bits;for(let H=0,Q=this.height;H<Q;H++){const le=H*O,ve=w.getRow(H,E).getBitArray();for(let Te=0;Te<O;Te++)U[le+Te]^=ve[Te]}}clear(){const w=this.bits,E=w.length;for(let O=0;O<E;O++)w[O]=0}setRegion(w,E,O,U){if(E<0||w<0)throw new f("Left and top must be nonnegative");if(U<1||O<1)throw new f("Height and width must be at least 1");const H=w+O,Q=E+U;if(Q>this.height||H>this.width)throw new f("The region must fit inside the matrix");const le=this.rowSize,ve=this.bits;for(let Te=E;Te<Q;Te++){const Ze=Te*le;for(let xt=w;xt<H;xt++)ve[Ze+Math.floor(xt/32)]|=1<<(xt&31)&4294967295}}getRow(w,E){E==null||E.getSize()<this.width?E=new M(this.width):E.clear();const O=this.rowSize,U=this.bits,H=w*O;for(let Q=0;Q<O;Q++)E.setBulk(Q*32,U[H+Q]);return E}setRow(w,E){v.arraycopy(E.getBitArray(),0,this.bits,w*this.rowSize,this.rowSize)}rotate180(){const w=this.getWidth(),E=this.getHeight();let O=new M(w),U=new M(w);for(let H=0,Q=Math.floor((E+1)/2);H<Q;H++)O=this.getRow(H,O),U=this.getRow(E-1-H,U),O.reverse(),U.reverse(),this.setRow(H,U),this.setRow(E-1-H,O)}getEnclosingRectangle(){const w=this.width,E=this.height,O=this.rowSize,U=this.bits;let H=w,Q=E,le=-1,ve=-1;for(let Te=0;Te<E;Te++)for(let Ze=0;Ze<O;Ze++){const xt=U[Te*O+Ze];if(xt!==0){if(Te<Q&&(Q=Te),Te>ve&&(ve=Te),Ze*32<H){let _t=0;for(;!(xt<<31-_t&4294967295);)_t++;Ze*32+_t<H&&(H=Ze*32+_t)}if(Ze*32+31>le){let _t=31;for(;!(xt>>>_t);)_t--;Ze*32+_t>le&&(le=Ze*32+_t)}}}return le<H||ve<Q?null:Int32Array.from([H,Q,le-H+1,ve-Q+1])}getTopLeftOnBit(){const w=this.rowSize,E=this.bits;let O=0;for(;O<E.length&&E[O]===0;)O++;if(O===E.length)return null;const U=O/w;let H=O%w*32;const Q=E[O];let le=0;for(;!(Q<<31-le&4294967295);)le++;return H+=le,Int32Array.from([H,U])}getBottomRightOnBit(){const w=this.rowSize,E=this.bits;let O=E.length-1;for(;O>=0&&E[O]===0;)O--;if(O<0)return null;const U=Math.floor(O/w);let H=Math.floor(O%w)*32;const Q=E[O];let le=31;for(;!(Q>>>le);)le--;return H+=le,Int32Array.from([H,U])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(w){if(!(w instanceof fe))return!1;const E=w;return this.width===E.width&&this.height===E.height&&this.rowSize===E.rowSize&&P.equals(this.bits,E.bits)}hashCode(){let w=this.width;return w=31*w+this.width,w=31*w+this.height,w=31*w+this.rowSize,w=31*w+P.hashCode(this.bits),w}toString(w="X ",E=" ",O=`
`){return this.buildToString(w,E,O)}buildToString(w,E,O){let U=new te;for(let H=0,Q=this.height;H<Q;H++){for(let le=0,ve=this.width;le<ve;le++)U.append(this.get(le,H)?w:E);U.append(O)}return U.toString()}clone(){return new fe(this.width,this.height,this.rowSize,this.bits.slice())}}class q extends u{static getNotFoundInstance(){return new q}}q.kind="NotFoundException";class se extends y{constructor(w){super(w),this.luminances=se.EMPTY,this.buckets=new Int32Array(se.LUMINANCE_BUCKETS)}getBlackRow(w,E){const O=this.getLuminanceSource(),U=O.getWidth();E==null||E.getSize()<U?E=new M(U):E.clear(),this.initArrays(U);const H=O.getRow(w,this.luminances),Q=this.buckets;for(let ve=0;ve<U;ve++)Q[(H[ve]&255)>>se.LUMINANCE_SHIFT]++;const le=se.estimateBlackPoint(Q);if(U<3)for(let ve=0;ve<U;ve++)(H[ve]&255)<le&&E.set(ve);else{let ve=H[0]&255,Te=H[1]&255;for(let Ze=1;Ze<U-1;Ze++){const xt=H[Ze+1]&255;(Te*4-ve-xt)/2<le&&E.set(Ze),ve=Te,Te=xt}}return E}getBlackMatrix(){const w=this.getLuminanceSource(),E=w.getWidth(),O=w.getHeight(),U=new fe(E,O);this.initArrays(E);const H=this.buckets;for(let ve=1;ve<5;ve++){const Te=Math.floor(O*ve/5),Ze=w.getRow(Te,this.luminances),xt=Math.floor(E*4/5);for(let _t=Math.floor(E/5);_t<xt;_t++){const Qt=Ze[_t]&255;H[Qt>>se.LUMINANCE_SHIFT]++}}const Q=se.estimateBlackPoint(H),le=w.getMatrix();for(let ve=0;ve<O;ve++){const Te=ve*E;for(let Ze=0;Ze<E;Ze++)(le[Te+Ze]&255)<Q&&U.set(Ze,ve)}return U}createBinarizer(w){return new se(w)}initArrays(w){this.luminances.length<w&&(this.luminances=new Uint8ClampedArray(w));const E=this.buckets;for(let O=0;O<se.LUMINANCE_BUCKETS;O++)E[O]=0}static estimateBlackPoint(w){const E=w.length;let O=0,U=0,H=0;for(let Ze=0;Ze<E;Ze++)w[Ze]>H&&(U=Ze,H=w[Ze]),w[Ze]>O&&(O=w[Ze]);let Q=0,le=0;for(let Ze=0;Ze<E;Ze++){const xt=Ze-U,_t=w[Ze]*xt*xt;_t>le&&(Q=Ze,le=_t)}if(U>Q){const Ze=U;U=Q,Q=Ze}if(Q-U<=E/16)throw new q;let ve=Q-1,Te=-1;for(let Ze=Q-1;Ze>U;Ze--){const xt=Ze-U,_t=xt*xt*(Q-Ze)*(O-w[Ze]);_t>Te&&(ve=Ze,Te=_t)}return ve<<se.LUMINANCE_SHIFT}}se.LUMINANCE_BITS=5,se.LUMINANCE_SHIFT=8-se.LUMINANCE_BITS,se.LUMINANCE_BUCKETS=1<<se.LUMINANCE_BITS,se.EMPTY=Uint8ClampedArray.from([0]);class ae extends se{constructor(w){super(w),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const w=this.getLuminanceSource(),E=w.getWidth(),O=w.getHeight();if(E>=ae.MINIMUM_DIMENSION&&O>=ae.MINIMUM_DIMENSION){const U=w.getMatrix();let H=E>>ae.BLOCK_SIZE_POWER;E&ae.BLOCK_SIZE_MASK&&H++;let Q=O>>ae.BLOCK_SIZE_POWER;O&ae.BLOCK_SIZE_MASK&&Q++;const le=ae.calculateBlackPoints(U,H,Q,E,O),ve=new fe(E,O);ae.calculateThresholdForBlock(U,H,Q,E,O,le,ve),this.matrix=ve}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(w){return new ae(w)}static calculateThresholdForBlock(w,E,O,U,H,Q,le){const ve=H-ae.BLOCK_SIZE,Te=U-ae.BLOCK_SIZE;for(let Ze=0;Ze<O;Ze++){let xt=Ze<<ae.BLOCK_SIZE_POWER;xt>ve&&(xt=ve);const _t=ae.cap(Ze,2,O-3);for(let Qt=0;Qt<E;Qt++){let St=Qt<<ae.BLOCK_SIZE_POWER;St>Te&&(St=Te);const $t=ae.cap(Qt,2,E-3);let Ht=0;for(let xr=-2;xr<=2;xr++){const Nr=Q[_t+xr];Ht+=Nr[$t-2]+Nr[$t-1]+Nr[$t]+Nr[$t+1]+Nr[$t+2]}const jn=Ht/25;ae.thresholdBlock(w,St,xt,jn,U,le)}}}static cap(w,E,O){return w<E?E:w>O?O:w}static thresholdBlock(w,E,O,U,H,Q){for(let le=0,ve=O*H+E;le<ae.BLOCK_SIZE;le++,ve+=H)for(let Te=0;Te<ae.BLOCK_SIZE;Te++)(w[ve+Te]&255)<=U&&Q.set(E+Te,O+le)}static calculateBlackPoints(w,E,O,U,H){const Q=H-ae.BLOCK_SIZE,le=U-ae.BLOCK_SIZE,ve=new Array(O);for(let Te=0;Te<O;Te++){ve[Te]=new Int32Array(E);let Ze=Te<<ae.BLOCK_SIZE_POWER;Ze>Q&&(Ze=Q);for(let xt=0;xt<E;xt++){let _t=xt<<ae.BLOCK_SIZE_POWER;_t>le&&(_t=le);let Qt=0,St=255,$t=0;for(let jn=0,xr=Ze*U+_t;jn<ae.BLOCK_SIZE;jn++,xr+=U){for(let Nr=0;Nr<ae.BLOCK_SIZE;Nr++){const jr=w[xr+Nr]&255;Qt+=jr,jr<St&&(St=jr),jr>$t&&($t=jr)}if($t-St>ae.MIN_DYNAMIC_RANGE)for(jn++,xr+=U;jn<ae.BLOCK_SIZE;jn++,xr+=U)for(let Nr=0;Nr<ae.BLOCK_SIZE;Nr++)Qt+=w[xr+Nr]&255}let Ht=Qt>>ae.BLOCK_SIZE_POWER*2;if($t-St<=ae.MIN_DYNAMIC_RANGE&&(Ht=St/2,Te>0&&xt>0)){const jn=(ve[Te-1][xt]+2*ve[Te][xt-1]+ve[Te-1][xt-1])/4;St<jn&&(Ht=jn)}ve[Te][xt]=Ht}}return ve}}ae.BLOCK_SIZE_POWER=3,ae.BLOCK_SIZE=1<<ae.BLOCK_SIZE_POWER,ae.BLOCK_SIZE_MASK=ae.BLOCK_SIZE-1,ae.MINIMUM_DIMENSION=ae.BLOCK_SIZE*5,ae.MIN_DYNAMIC_RANGE=24;class W{constructor(w,E){this.width=w,this.height=E}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(w,E,O,U){throw new ne("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new ne("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new ne("This luminance source does not support rotation by 45 degrees.")}toString(){const w=new Uint8ClampedArray(this.width);let E=new te;for(let O=0;O<this.height;O++){const U=this.getRow(O,w);for(let H=0;H<this.width;H++){const Q=U[H]&255;let le;Q<64?le="#":Q<128?le="+":Q<192?le=".":le=" ",E.append(le)}E.append(`
`)}return E.toString()}}class V extends W{constructor(w){super(w.getWidth(),w.getHeight()),this.delegate=w}getRow(w,E){const O=this.delegate.getRow(w,E),U=this.getWidth();for(let H=0;H<U;H++)O[H]=255-(O[H]&255);return O}getMatrix(){const w=this.delegate.getMatrix(),E=this.getWidth()*this.getHeight(),O=new Uint8ClampedArray(E);for(let U=0;U<E;U++)O[U]=255-(w[U]&255);return O}isCropSupported(){return this.delegate.isCropSupported()}crop(w,E,O,U){return new V(this.delegate.crop(w,E,O,U))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new V(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new V(this.delegate.rotateCounterClockwise45())}}class ee extends W{constructor(w){super(w.width,w.height),this.canvas=w,this.tempCanvasElement=null,this.buffer=ee.makeBufferFromCanvasImageData(w)}static makeBufferFromCanvasImageData(w){const E=w.getContext("2d").getImageData(0,0,w.width,w.height);return ee.toGrayscaleBuffer(E.data,w.width,w.height)}static toGrayscaleBuffer(w,E,O){const U=new Uint8ClampedArray(E*O);for(let H=0,Q=0,le=w.length;H<le;H+=4,Q++){let ve;if(w[H+3]===0)ve=255;else{const Ze=w[H],xt=w[H+1],_t=w[H+2];ve=306*Ze+601*xt+117*_t+512>>10}U[Q]=ve}return U}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth(),U=w*O;return E===null?E=this.buffer.slice(U,U+O):(E.length<O&&(E=new Uint8ClampedArray(O)),E.set(this.buffer.slice(U,U+O))),E}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(w,E,O,U){return super.crop(w,E,O,U),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const w=this.canvas.ownerDocument.createElement("canvas");w.width=this.canvas.width,w.height=this.canvas.height,this.tempCanvasElement=w}return this.tempCanvasElement}rotate(w){const E=this.getTempCanvasElement(),O=E.getContext("2d"),U=w*ee.DEGREE_TO_RADIANS,H=this.canvas.width,Q=this.canvas.height,le=Math.ceil(Math.abs(Math.cos(U))*H+Math.abs(Math.sin(U))*Q),ve=Math.ceil(Math.abs(Math.sin(U))*H+Math.abs(Math.cos(U))*Q);return E.width=le,E.height=ve,O.translate(le/2,ve/2),O.rotate(U),O.drawImage(this.canvas,H/-2,Q/-2),this.buffer=ee.makeBufferFromCanvasImageData(E),this}invert(){return new V(this)}}ee.DEGREE_TO_RADIANS=Math.PI/180;class oe{constructor(w,E,O){this.deviceId=w,this.label=E,this.kind="videoinput",this.groupId=O||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var de=(globalThis||Ru||self||window||void 0)&&(globalThis||Ru||self||window||void 0).__awaiter||function(ft,w,E,O){function U(H){return H instanceof E?H:new E(function(Q){Q(H)})}return new(E||(E=Promise))(function(H,Q){function le(Ze){try{Te(O.next(Ze))}catch(xt){Q(xt)}}function ve(Ze){try{Te(O.throw(Ze))}catch(xt){Q(xt)}}function Te(Ze){Ze.done?H(Ze.value):U(Ze.value).then(le,ve)}Te((O=O.apply(ft,w||[])).next())})};class Ce{constructor(w,E=500,O){this.reader=w,this.timeBetweenScansMillis=E,this._hints=O,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(w){this._timeBetweenDecodingAttempts=w<0?0:w}set hints(w){this._hints=w||null}get hints(){return this._hints}listVideoInputDevices(){return de(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const w=yield navigator.mediaDevices.enumerateDevices(),E=[];for(const O of w){const U=O.kind==="video"?"videoinput":O.kind;if(U!=="videoinput")continue;const H=O.deviceId||O.id,Q=O.label||`Video device ${E.length+1}`,le=O.groupId,ve={deviceId:H,label:Q,kind:U,groupId:le};E.push(ve)}return E})}getVideoInputDevices(){return de(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(E=>new oe(E.deviceId,E.label))})}findDeviceById(w){return de(this,void 0,void 0,function*(){const E=yield this.listVideoInputDevices();return E?E.find(O=>O.deviceId===w):null})}decodeFromInputVideoDevice(w,E){return de(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(w,E)})}decodeOnceFromVideoDevice(w,E){return de(this,void 0,void 0,function*(){this.reset();let O;w?O={deviceId:{exact:w}}:O={facingMode:"environment"};const U={video:O};return yield this.decodeOnceFromConstraints(U,E)})}decodeOnceFromConstraints(w,E){return de(this,void 0,void 0,function*(){const O=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeOnceFromStream(O,E)})}decodeOnceFromStream(w,E){return de(this,void 0,void 0,function*(){this.reset();const O=yield this.attachStreamToVideo(w,E);return yield this.decodeOnce(O)})}decodeFromInputVideoDeviceContinuously(w,E,O){return de(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(w,E,O)})}decodeFromVideoDevice(w,E,O){return de(this,void 0,void 0,function*(){let U;w?U={deviceId:{exact:w}}:U={facingMode:"environment"};const H={video:U};return yield this.decodeFromConstraints(H,E,O)})}decodeFromConstraints(w,E,O){return de(this,void 0,void 0,function*(){const U=yield navigator.mediaDevices.getUserMedia(w);return yield this.decodeFromStream(U,E,O)})}decodeFromStream(w,E,O){return de(this,void 0,void 0,function*(){this.reset();const U=yield this.attachStreamToVideo(w,E);return yield this.decodeContinuously(U,O)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(w,E){return de(this,void 0,void 0,function*(){const O=this.prepareVideoElement(E);return this.addVideoSource(O,w),this.videoElement=O,this.stream=w,yield this.playVideoOnLoadAsync(O),O})}playVideoOnLoadAsync(w){return new Promise((E,O)=>this.playVideoOnLoad(w,()=>E()))}playVideoOnLoad(w,E){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(w),w.addEventListener("ended",this.videoEndedListener),w.addEventListener("canplay",this.videoCanPlayListener),w.addEventListener("playing",E),this.tryPlayVideo(w)}isVideoPlaying(w){return w.currentTime>0&&!w.paused&&!w.ended&&w.readyState>2}tryPlayVideo(w){return de(this,void 0,void 0,function*(){if(this.isVideoPlaying(w)){console.warn("Trying to play video that is already playing.");return}try{yield w.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(w,E){const O=document.getElementById(w);if(!O)throw new d(`element with id '${w}' not found`);if(O.nodeName.toLowerCase()!==E.toLowerCase())throw new d(`element with id '${w}' must be an ${E} element`);return O}decodeFromImage(w,E){if(!w&&!E)throw new d("either imageElement with a src set or an url must be provided");return E&&!w?this.decodeFromImageUrl(E):this.decodeFromImageElement(w)}decodeFromVideo(w,E){if(!w&&!E)throw new d("Either an element with a src set or an URL must be provided");return E&&!w?this.decodeFromVideoUrl(E):this.decodeFromVideoElement(w)}decodeFromVideoContinuously(w,E,O){if(w===void 0&&E===void 0)throw new d("Either an element with a src set or an URL must be provided");return E&&!w?this.decodeFromVideoUrlContinuously(E,O):this.decodeFromVideoElementContinuously(w,O)}decodeFromImageElement(w){if(!w)throw new d("An image element must be provided.");this.reset();const E=this.prepareImageElement(w);this.imageElement=E;let O;return this.isImageLoaded(E)?O=this.decodeOnce(E,!1,!0):O=this._decodeOnLoadImage(E),O}decodeFromVideoElement(w){const E=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideo(E)}decodeFromVideoElementContinuously(w,E){const O=this._decodeFromVideoElementSetup(w);return this._decodeOnLoadVideoContinuously(O,E)}_decodeFromVideoElementSetup(w){if(!w)throw new d("A video element must be provided.");this.reset();const E=this.prepareVideoElement(w);return this.videoElement=E,E}decodeFromImageUrl(w){if(!w)throw new d("An URL must be provided.");this.reset();const E=this.prepareImageElement();this.imageElement=E;const O=this._decodeOnLoadImage(E);return E.src=w,O}decodeFromVideoUrl(w){if(!w)throw new d("An URL must be provided.");this.reset();const E=this.prepareVideoElement(),O=this.decodeFromVideoElement(E);return E.src=w,O}decodeFromVideoUrlContinuously(w,E){if(!w)throw new d("An URL must be provided.");this.reset();const O=this.prepareVideoElement(),U=this.decodeFromVideoElementContinuously(O,E);return O.src=w,U}_decodeOnLoadImage(w){return new Promise((E,O)=>{this.imageLoadedListener=()=>this.decodeOnce(w,!1,!0).then(E,O),w.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(w){return de(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(w),yield this.decodeOnce(w)})}_decodeOnLoadVideoContinuously(w,E){return de(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(w),this.decodeContinuously(w,E)})}isImageLoaded(w){return!(!w.complete||w.naturalWidth===0)}prepareImageElement(w){let E;return typeof w>"u"&&(E=document.createElement("img"),E.width=200,E.height=200),typeof w=="string"&&(E=this.getMediaElement(w,"img")),w instanceof HTMLImageElement&&(E=w),E}prepareVideoElement(w){let E;return!w&&typeof document<"u"&&(E=document.createElement("video"),E.width=200,E.height=200),typeof w=="string"&&(E=this.getMediaElement(w,"video")),w instanceof HTMLVideoElement&&(E=w),E.setAttribute("autoplay","true"),E.setAttribute("muted","true"),E.setAttribute("playsinline","true"),E}decodeOnce(w,E=!0,O=!0){this._stopAsyncDecode=!1;const U=(H,Q)=>{if(this._stopAsyncDecode){Q(new q("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const le=this.decode(w);H(le)}catch(le){const ve=E&&le instanceof q,Ze=(le instanceof g||le instanceof L)&&O;if(ve||Ze)return setTimeout(U,this._timeBetweenDecodingAttempts,H,Q);Q(le)}};return new Promise((H,Q)=>U(H,Q))}decodeContinuously(w,E){this._stopContinuousDecode=!1;const O=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const U=this.decode(w);E(U,null),setTimeout(O,this.timeBetweenScansMillis)}catch(U){E(null,U);const H=U instanceof g||U instanceof L,Q=U instanceof q;(H||Q)&&setTimeout(O,this._timeBetweenDecodingAttempts)}};O()}decode(w){const E=this.createBinaryBitmap(w);return this.decodeBitmap(E)}_isHTMLVideoElement(w){return w.videoWidth!==0}drawFrameOnCanvas(w,E,O){E||(E={sx:0,sy:0,sWidth:w.videoWidth,sHeight:w.videoHeight,dx:0,dy:0,dWidth:w.videoWidth,dHeight:w.videoHeight}),O||(O=this.captureCanvasContext),O.drawImage(w,E.sx,E.sy,E.sWidth,E.sHeight,E.dx,E.dy,E.dWidth,E.dHeight)}drawImageOnCanvas(w,E,O=this.captureCanvasContext){E||(E={sx:0,sy:0,sWidth:w.naturalWidth,sHeight:w.naturalHeight,dx:0,dy:0,dWidth:w.naturalWidth,dHeight:w.naturalHeight}),O||(O=this.captureCanvasContext),O.drawImage(w,E.sx,E.sy,E.sWidth,E.sHeight,E.dx,E.dy,E.dWidth,E.dHeight)}createBinaryBitmap(w){this.getCaptureCanvasContext(w),this._isHTMLVideoElement(w)?this.drawFrameOnCanvas(w):this.drawImageOnCanvas(w);const E=this.getCaptureCanvas(w),O=new ee(E),U=new ae(O);return new x(U)}getCaptureCanvasContext(w){if(!this.captureCanvasContext){const O=this.getCaptureCanvas(w).getContext("2d");this.captureCanvasContext=O}return this.captureCanvasContext}getCaptureCanvas(w){if(!this.captureCanvas){const E=this.createCaptureCanvas(w);this.captureCanvas=E}return this.captureCanvas}decodeBitmap(w){return this.reader.decode(w,this._hints)}createCaptureCanvas(w){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const E=document.createElement("canvas");let O,U;return typeof w<"u"&&(w instanceof HTMLVideoElement?(O=w.videoWidth,U=w.videoHeight):w instanceof HTMLImageElement&&(O=w.naturalWidth||w.width,U=w.naturalHeight||w.height)),E.style.width=O+"px",E.style.height=U+"px",E.width=O,E.height=U,E}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(w=>w.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(w,E){try{w.srcObject=E}catch{w.src=URL.createObjectURL(E)}}cleanVideoSource(w){try{w.srcObject=null}catch{w.src=""}this.videoElement.removeAttribute("src")}}class me{constructor(w,E,O=E==null?0:8*E.length,U,H,Q=v.currentTimeMillis()){this.text=w,this.rawBytes=E,this.numBits=O,this.resultPoints=U,this.format=H,this.timestamp=Q,this.text=w,this.rawBytes=E,O==null?this.numBits=E==null?0:8*E.length:this.numBits=O,this.resultPoints=U,this.format=H,this.resultMetadata=null,Q==null?this.timestamp=v.currentTimeMillis():this.timestamp=Q}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(w,E){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(w,E)}putAllMetadata(w){w!==null&&(this.resultMetadata===null?this.resultMetadata=w:this.resultMetadata=new Map(w))}addResultPoints(w){const E=this.resultPoints;if(E===null)this.resultPoints=w;else if(w!==null&&w.length>0){const O=new Array(E.length+w.length);v.arraycopy(E,0,O,0,E.length),v.arraycopy(w,0,O,E.length,w.length),this.resultPoints=O}}getTimestamp(){return this.timestamp}toString(){return this.text}}var we;(function(ft){ft[ft.AZTEC=0]="AZTEC",ft[ft.CODABAR=1]="CODABAR",ft[ft.CODE_39=2]="CODE_39",ft[ft.CODE_93=3]="CODE_93",ft[ft.CODE_128=4]="CODE_128",ft[ft.DATA_MATRIX=5]="DATA_MATRIX",ft[ft.EAN_8=6]="EAN_8",ft[ft.EAN_13=7]="EAN_13",ft[ft.ITF=8]="ITF",ft[ft.MAXICODE=9]="MAXICODE",ft[ft.PDF_417=10]="PDF_417",ft[ft.QR_CODE=11]="QR_CODE",ft[ft.RSS_14=12]="RSS_14",ft[ft.RSS_EXPANDED=13]="RSS_EXPANDED",ft[ft.UPC_A=14]="UPC_A",ft[ft.UPC_E=15]="UPC_E",ft[ft.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(we||(we={}));var xe=we,be;(function(ft){ft[ft.OTHER=0]="OTHER",ft[ft.ORIENTATION=1]="ORIENTATION",ft[ft.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",ft[ft.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",ft[ft.ISSUE_NUMBER=4]="ISSUE_NUMBER",ft[ft.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",ft[ft.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",ft[ft.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",ft[ft.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",ft[ft.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",ft[ft.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(be||(be={}));var je=be;class Ie{constructor(w,E,O,U,H=-1,Q=-1){this.rawBytes=w,this.text=E,this.byteSegments=O,this.ecLevel=U,this.structuredAppendSequenceNumber=H,this.structuredAppendParity=Q,this.numBits=w==null?0:8*w.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(w){this.numBits=w}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(w){this.errorsCorrected=w}getErasures(){return this.erasures}setErasures(w){this.erasures=w}getOther(){return this.other}setOther(w){this.other=w}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Re{exp(w){return this.expTable[w]}log(w){if(w===0)throw new f;return this.logTable[w]}static addOrSubtract(w,E){return w^E}}class Qe{constructor(w,E){if(E.length===0)throw new f;this.field=w;const O=E.length;if(O>1&&E[0]===0){let U=1;for(;U<O&&E[U]===0;)U++;U===O?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(O-U),v.arraycopy(E,U,this.coefficients,0,this.coefficients.length))}else this.coefficients=E}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(w){return this.coefficients[this.coefficients.length-1-w]}evaluateAt(w){if(w===0)return this.getCoefficient(0);const E=this.coefficients;let O;if(w===1){O=0;for(let Q=0,le=E.length;Q!==le;Q++){const ve=E[Q];O=Re.addOrSubtract(O,ve)}return O}O=E[0];const U=E.length,H=this.field;for(let Q=1;Q<U;Q++)O=Re.addOrSubtract(H.multiply(w,O),E[Q]);return O}addOrSubtract(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero())return w;if(w.isZero())return this;let E=this.coefficients,O=w.coefficients;if(E.length>O.length){const Q=E;E=O,O=Q}let U=new Int32Array(O.length);const H=O.length-E.length;v.arraycopy(O,0,U,0,H);for(let Q=H;Q<O.length;Q++)U[Q]=Re.addOrSubtract(E[Q-H],O[Q]);return new Qe(this.field,U)}multiply(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(this.isZero()||w.isZero())return this.field.getZero();const E=this.coefficients,O=E.length,U=w.coefficients,H=U.length,Q=new Int32Array(O+H-1),le=this.field;for(let ve=0;ve<O;ve++){const Te=E[ve];for(let Ze=0;Ze<H;Ze++)Q[ve+Ze]=Re.addOrSubtract(Q[ve+Ze],le.multiply(Te,U[Ze]))}return new Qe(le,Q)}multiplyScalar(w){if(w===0)return this.field.getZero();if(w===1)return this;const E=this.coefficients.length,O=this.field,U=new Int32Array(E),H=this.coefficients;for(let Q=0;Q<E;Q++)U[Q]=O.multiply(H[Q],w);return new Qe(O,U)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return this.field.getZero();const O=this.coefficients,U=O.length,H=new Int32Array(U+w),Q=this.field;for(let le=0;le<U;le++)H[le]=Q.multiply(O[le],E);return new Qe(Q,H)}divide(w){if(!this.field.equals(w.field))throw new f("GenericGFPolys do not have same GenericGF field");if(w.isZero())throw new f("Divide by 0");const E=this.field;let O=E.getZero(),U=this;const H=w.getCoefficient(w.getDegree()),Q=E.inverse(H);for(;U.getDegree()>=w.getDegree()&&!U.isZero();){const le=U.getDegree()-w.getDegree(),ve=E.multiply(U.getCoefficient(U.getDegree()),Q),Te=w.multiplyByMonomial(le,ve),Ze=E.buildMonomial(le,ve);O=O.addOrSubtract(Ze),U=U.addOrSubtract(Te)}return[O,U]}toString(){let w="";for(let E=this.getDegree();E>=0;E--){let O=this.getCoefficient(E);if(O!==0){if(O<0?(w+=" - ",O=-O):w.length>0&&(w+=" + "),E===0||O!==1){const U=this.field.log(O);U===0?w+="1":U===1?w+="a":(w+="a^",w+=U)}E!==0&&(E===1?w+="x":(w+="x^",w+=E))}}return w}}class Ke extends u{}Ke.kind="ArithmeticException";class dt extends Re{constructor(w,E,O){super(),this.primitive=w,this.size=E,this.generatorBase=O;const U=new Int32Array(E);let H=1;for(let le=0;le<E;le++)U[le]=H,H*=2,H>=E&&(H^=w,H&=E-1);this.expTable=U;const Q=new Int32Array(E);for(let le=0;le<E-1;le++)Q[U[le]]=le;this.logTable=Q,this.zero=new Qe(this,Int32Array.from([0])),this.one=new Qe(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(w,E){if(w<0)throw new f;if(E===0)return this.zero;const O=new Int32Array(w+1);return O[0]=E,new Qe(this,O)}inverse(w){if(w===0)throw new Ke;return this.expTable[this.size-this.logTable[w]-1]}multiply(w,E){return w===0||E===0?0:this.expTable[(this.logTable[w]+this.logTable[E])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+T.toHexString(this.primitive)+","+this.size+")"}equals(w){return w===this}}dt.AZTEC_DATA_12=new dt(4201,4096,1),dt.AZTEC_DATA_10=new dt(1033,1024,1),dt.AZTEC_DATA_6=new dt(67,64,1),dt.AZTEC_PARAM=new dt(19,16,1),dt.QR_CODE_FIELD_256=new dt(285,256,0),dt.DATA_MATRIX_FIELD_256=new dt(301,256,1),dt.AZTEC_DATA_8=dt.DATA_MATRIX_FIELD_256,dt.MAXICODE_FIELD_64=dt.AZTEC_DATA_6;class tt extends u{}tt.kind="ReedSolomonException";class nt extends u{}nt.kind="IllegalStateException";class Le{constructor(w){this.field=w}decode(w,E){const O=this.field,U=new Qe(O,w),H=new Int32Array(E);let Q=!0;for(let Qt=0;Qt<E;Qt++){const St=U.evaluateAt(O.exp(Qt+O.getGeneratorBase()));H[H.length-1-Qt]=St,St!==0&&(Q=!1)}if(Q)return;const le=new Qe(O,H),ve=this.runEuclideanAlgorithm(O.buildMonomial(E,1),le,E),Te=ve[0],Ze=ve[1],xt=this.findErrorLocations(Te),_t=this.findErrorMagnitudes(Ze,xt);for(let Qt=0;Qt<xt.length;Qt++){const St=w.length-1-O.log(xt[Qt]);if(St<0)throw new tt("Bad error location");w[St]=dt.addOrSubtract(w[St],_t[Qt])}}runEuclideanAlgorithm(w,E,O){if(w.getDegree()<E.getDegree()){const Qt=w;w=E,E=Qt}const U=this.field;let H=w,Q=E,le=U.getZero(),ve=U.getOne();for(;Q.getDegree()>=(O/2|0);){let Qt=H,St=le;if(H=Q,le=ve,H.isZero())throw new tt("r_{i-1} was zero");Q=Qt;let $t=U.getZero();const Ht=H.getCoefficient(H.getDegree()),jn=U.inverse(Ht);for(;Q.getDegree()>=H.getDegree()&&!Q.isZero();){const xr=Q.getDegree()-H.getDegree(),Nr=U.multiply(Q.getCoefficient(Q.getDegree()),jn);$t=$t.addOrSubtract(U.buildMonomial(xr,Nr)),Q=Q.addOrSubtract(H.multiplyByMonomial(xr,Nr))}if(ve=$t.multiply(le).addOrSubtract(St),Q.getDegree()>=H.getDegree())throw new nt("Division algorithm failed to reduce polynomial?")}const Te=ve.getCoefficient(0);if(Te===0)throw new tt("sigmaTilde(0) was zero");const Ze=U.inverse(Te),xt=ve.multiplyScalar(Ze),_t=Q.multiplyScalar(Ze);return[xt,_t]}findErrorLocations(w){const E=w.getDegree();if(E===1)return Int32Array.from([w.getCoefficient(1)]);const O=new Int32Array(E);let U=0;const H=this.field;for(let Q=1;Q<H.getSize()&&U<E;Q++)w.evaluateAt(Q)===0&&(O[U]=H.inverse(Q),U++);if(U!==E)throw new tt("Error locator degree does not match number of roots");return O}findErrorMagnitudes(w,E){const O=E.length,U=new Int32Array(O),H=this.field;for(let Q=0;Q<O;Q++){const le=H.inverse(E[Q]);let ve=1;for(let Te=0;Te<O;Te++)if(Q!==Te){const Ze=H.multiply(E[Te],le),xt=Ze&1?Ze&-2:Ze|1;ve=H.multiply(ve,xt)}U[Q]=H.multiply(w.evaluateAt(le),H.inverse(ve)),H.getGeneratorBase()!==0&&(U[Q]=H.multiply(U[Q],le))}return U}}var Be;(function(ft){ft[ft.UPPER=0]="UPPER",ft[ft.LOWER=1]="LOWER",ft[ft.MIXED=2]="MIXED",ft[ft.DIGIT=3]="DIGIT",ft[ft.PUNCT=4]="PUNCT",ft[ft.BINARY=5]="BINARY"})(Be||(Be={}));class ht{decode(w){this.ddata=w;let E=w.getBits(),O=this.extractBits(E),U=this.correctBits(O),H=ht.convertBoolArrayToByteArray(U),Q=ht.getEncodedData(U),le=new Ie(H,Q,null,null);return le.setNumBits(U.length),le}static highLevelDecode(w){return this.getEncodedData(w)}static getEncodedData(w){let E=w.length,O=Be.UPPER,U=Be.UPPER,H="",Q=0;for(;Q<E;)if(U===Be.BINARY){if(E-Q<5)break;let le=ht.readCode(w,Q,5);if(Q+=5,le===0){if(E-Q<11)break;le=ht.readCode(w,Q,11)+31,Q+=11}for(let ve=0;ve<le;ve++){if(E-Q<8){Q=E;break}const Te=ht.readCode(w,Q,8);H+=K.castAsNonUtf8Char(Te),Q+=8}U=O}else{let le=U===Be.DIGIT?4:5;if(E-Q<le)break;let ve=ht.readCode(w,Q,le);Q+=le;let Te=ht.getCharacter(U,ve);Te.startsWith("CTRL_")?(O=U,U=ht.getTable(Te.charAt(5)),Te.charAt(6)==="L"&&(O=U)):(H+=Te,U=O)}return H}static getTable(w){switch(w){case"L":return Be.LOWER;case"P":return Be.PUNCT;case"M":return Be.MIXED;case"D":return Be.DIGIT;case"B":return Be.BINARY;case"U":default:return Be.UPPER}}static getCharacter(w,E){switch(w){case Be.UPPER:return ht.UPPER_TABLE[E];case Be.LOWER:return ht.LOWER_TABLE[E];case Be.MIXED:return ht.MIXED_TABLE[E];case Be.PUNCT:return ht.PUNCT_TABLE[E];case Be.DIGIT:return ht.DIGIT_TABLE[E];default:throw new nt("Bad table")}}correctBits(w){let E,O;this.ddata.getNbLayers()<=2?(O=6,E=dt.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(O=8,E=dt.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(O=10,E=dt.AZTEC_DATA_10):(O=12,E=dt.AZTEC_DATA_12);let U=this.ddata.getNbDatablocks(),H=w.length/O;if(H<U)throw new L;let Q=w.length%O,le=new Int32Array(H);for(let _t=0;_t<H;_t++,Q+=O)le[_t]=ht.readCode(w,Q,O);try{new Le(E).decode(le,H-U)}catch(_t){throw new L(_t)}let ve=(1<<O)-1,Te=0;for(let _t=0;_t<U;_t++){let Qt=le[_t];if(Qt===0||Qt===ve)throw new L;(Qt===1||Qt===ve-1)&&Te++}let Ze=new Array(U*O-Te),xt=0;for(let _t=0;_t<U;_t++){let Qt=le[_t];if(Qt===1||Qt===ve-1)Ze.fill(Qt>1,xt,xt+O-1),xt+=O-1;else for(let St=O-1;St>=0;--St)Ze[xt++]=(Qt&1<<St)!==0}return Ze}extractBits(w){let E=this.ddata.isCompact(),O=this.ddata.getNbLayers(),U=(E?11:14)+O*4,H=new Int32Array(U),Q=new Array(this.totalBitsInLayer(O,E));if(E)for(let le=0;le<H.length;le++)H[le]=le;else{let le=U+1+2*T.truncDivision(T.truncDivision(U,2)-1,15),ve=U/2,Te=T.truncDivision(le,2);for(let Ze=0;Ze<ve;Ze++){let xt=Ze+T.truncDivision(Ze,15);H[ve-Ze-1]=Te-xt-1,H[ve+Ze]=Te+xt+1}}for(let le=0,ve=0;le<O;le++){let Te=(O-le)*4+(E?9:12),Ze=le*2,xt=U-1-Ze;for(let _t=0;_t<Te;_t++){let Qt=_t*2;for(let St=0;St<2;St++)Q[ve+Qt+St]=w.get(H[Ze+St],H[Ze+_t]),Q[ve+2*Te+Qt+St]=w.get(H[Ze+_t],H[xt-St]),Q[ve+4*Te+Qt+St]=w.get(H[xt-St],H[xt-_t]),Q[ve+6*Te+Qt+St]=w.get(H[xt-_t],H[Ze+St])}ve+=Te*8}return Q}static readCode(w,E,O){let U=0;for(let H=E;H<E+O;H++)U<<=1,w[H]&&(U|=1);return U}static readByte(w,E){let O=w.length-E;return O>=8?ht.readCode(w,E,8):ht.readCode(w,E,O)<<8-O}static convertBoolArrayToByteArray(w){let E=new Uint8Array((w.length+7)/8);for(let O=0;O<E.length;O++)E[O]=ht.readByte(w,8*O);return E}totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}ht.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],ht.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],ht.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ht.PUNCT_TABLE=["","\r",`\r
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ht.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class pt{constructor(){}static round(w){return w===NaN?0:w<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:w>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:w+(w<0?-.5:.5)|0}static distance(w,E,O,U){const H=w-O,Q=E-U;return Math.sqrt(H*H+Q*Q)}static sum(w){let E=0;for(let O=0,U=w.length;O!==U;O++){const H=w[O];E+=H}return E}}class Gt{static floatToIntBits(w){return w}}Gt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class wt{constructor(w,E){this.x=w,this.y=E}getX(){return this.x}getY(){return this.y}equals(w){if(w instanceof wt){const E=w;return this.x===E.x&&this.y===E.y}return!1}hashCode(){return 31*Gt.floatToIntBits(this.x)+Gt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(w){const E=this.distance(w[0],w[1]),O=this.distance(w[1],w[2]),U=this.distance(w[0],w[2]);let H,Q,le;if(O>=E&&O>=U?(Q=w[0],H=w[1],le=w[2]):U>=O&&U>=E?(Q=w[1],H=w[0],le=w[2]):(Q=w[2],H=w[0],le=w[1]),this.crossProductZ(H,Q,le)<0){const ve=H;H=le,le=ve}w[0]=H,w[1]=Q,w[2]=le}static distance(w,E){return pt.distance(w.x,w.y,E.x,E.y)}static crossProductZ(w,E,O){const U=E.x,H=E.y;return(O.x-U)*(w.y-H)-(O.y-H)*(w.x-U)}}class nn{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class cn extends nn{constructor(w,E,O,U,H){super(w,E),this.compact=O,this.nbDatablocks=U,this.nbLayers=H}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Un{constructor(w,E,O,U){this.image=w,this.height=w.getHeight(),this.width=w.getWidth(),E==null&&(E=Un.INIT_SIZE),O==null&&(O=w.getWidth()/2|0),U==null&&(U=w.getHeight()/2|0);const H=E/2|0;if(this.leftInit=O-H,this.rightInit=O+H,this.upInit=U-H,this.downInit=U+H,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new q}detect(){let w=this.leftInit,E=this.rightInit,O=this.upInit,U=this.downInit,H=!1,Q=!0,le=!1,ve=!1,Te=!1,Ze=!1,xt=!1;const _t=this.width,Qt=this.height;for(;Q;){Q=!1;let St=!0;for(;(St||!ve)&&E<_t;)St=this.containsBlackPoint(O,U,E,!1),St?(E++,Q=!0,ve=!0):ve||E++;if(E>=_t){H=!0;break}let $t=!0;for(;($t||!Te)&&U<Qt;)$t=this.containsBlackPoint(w,E,U,!0),$t?(U++,Q=!0,Te=!0):Te||U++;if(U>=Qt){H=!0;break}let Ht=!0;for(;(Ht||!Ze)&&w>=0;)Ht=this.containsBlackPoint(O,U,w,!1),Ht?(w--,Q=!0,Ze=!0):Ze||w--;if(w<0){H=!0;break}let jn=!0;for(;(jn||!xt)&&O>=0;)jn=this.containsBlackPoint(w,E,O,!0),jn?(O--,Q=!0,xt=!0):xt||O--;if(O<0){H=!0;break}Q&&(le=!0)}if(!H&&le){const St=E-w;let $t=null;for(let Nr=1;$t===null&&Nr<St;Nr++)$t=this.getBlackPointOnSegment(w,U-Nr,w+Nr,U);if($t==null)throw new q;let Ht=null;for(let Nr=1;Ht===null&&Nr<St;Nr++)Ht=this.getBlackPointOnSegment(w,O+Nr,w+Nr,O);if(Ht==null)throw new q;let jn=null;for(let Nr=1;jn===null&&Nr<St;Nr++)jn=this.getBlackPointOnSegment(E,O+Nr,E-Nr,O);if(jn==null)throw new q;let xr=null;for(let Nr=1;xr===null&&Nr<St;Nr++)xr=this.getBlackPointOnSegment(E,U-Nr,E-Nr,U);if(xr==null)throw new q;return this.centerEdges(xr,$t,jn,Ht)}else throw new q}getBlackPointOnSegment(w,E,O,U){const H=pt.round(pt.distance(w,E,O,U)),Q=(O-w)/H,le=(U-E)/H,ve=this.image;for(let Te=0;Te<H;Te++){const Ze=pt.round(w+Te*Q),xt=pt.round(E+Te*le);if(ve.get(Ze,xt))return new wt(Ze,xt)}return null}centerEdges(w,E,O,U){const H=w.getX(),Q=w.getY(),le=E.getX(),ve=E.getY(),Te=O.getX(),Ze=O.getY(),xt=U.getX(),_t=U.getY(),Qt=Un.CORR;return H<this.width/2?[new wt(xt-Qt,_t+Qt),new wt(le+Qt,ve+Qt),new wt(Te-Qt,Ze-Qt),new wt(H+Qt,Q-Qt)]:[new wt(xt+Qt,_t+Qt),new wt(le+Qt,ve-Qt),new wt(Te-Qt,Ze+Qt),new wt(H-Qt,Q-Qt)]}containsBlackPoint(w,E,O,U){const H=this.image;if(U){for(let Q=w;Q<=E;Q++)if(H.get(Q,O))return!0}else for(let Q=w;Q<=E;Q++)if(H.get(O,Q))return!0;return!1}}Un.INIT_SIZE=10,Un.CORR=1;class Xt{static checkAndNudgePoints(w,E){const O=w.getWidth(),U=w.getHeight();let H=!0;for(let Q=0;Q<E.length&&H;Q+=2){const le=Math.floor(E[Q]),ve=Math.floor(E[Q+1]);if(le<-1||le>O||ve<-1||ve>U)throw new q;H=!1,le===-1?(E[Q]=0,H=!0):le===O&&(E[Q]=O-1,H=!0),ve===-1?(E[Q+1]=0,H=!0):ve===U&&(E[Q+1]=U-1,H=!0)}H=!0;for(let Q=E.length-2;Q>=0&&H;Q-=2){const le=Math.floor(E[Q]),ve=Math.floor(E[Q+1]);if(le<-1||le>O||ve<-1||ve>U)throw new q;H=!1,le===-1?(E[Q]=0,H=!0):le===O&&(E[Q]=O-1,H=!0),ve===-1?(E[Q+1]=0,H=!0):ve===U&&(E[Q+1]=U-1,H=!0)}}}class an{constructor(w,E,O,U,H,Q,le,ve,Te){this.a11=w,this.a21=E,this.a31=O,this.a12=U,this.a22=H,this.a32=Q,this.a13=le,this.a23=ve,this.a33=Te}static quadrilateralToQuadrilateral(w,E,O,U,H,Q,le,ve,Te,Ze,xt,_t,Qt,St,$t,Ht){const jn=an.quadrilateralToSquare(w,E,O,U,H,Q,le,ve);return an.squareToQuadrilateral(Te,Ze,xt,_t,Qt,St,$t,Ht).times(jn)}transformPoints(w){const E=w.length,O=this.a11,U=this.a12,H=this.a13,Q=this.a21,le=this.a22,ve=this.a23,Te=this.a31,Ze=this.a32,xt=this.a33;for(let _t=0;_t<E;_t+=2){const Qt=w[_t],St=w[_t+1],$t=H*Qt+ve*St+xt;w[_t]=(O*Qt+Q*St+Te)/$t,w[_t+1]=(U*Qt+le*St+Ze)/$t}}transformPointsWithValues(w,E){const O=this.a11,U=this.a12,H=this.a13,Q=this.a21,le=this.a22,ve=this.a23,Te=this.a31,Ze=this.a32,xt=this.a33,_t=w.length;for(let Qt=0;Qt<_t;Qt++){const St=w[Qt],$t=E[Qt],Ht=H*St+ve*$t+xt;w[Qt]=(O*St+Q*$t+Te)/Ht,E[Qt]=(U*St+le*$t+Ze)/Ht}}static squareToQuadrilateral(w,E,O,U,H,Q,le,ve){const Te=w-O+H-le,Ze=E-U+Q-ve;if(Te===0&&Ze===0)return new an(O-w,H-O,w,U-E,Q-U,E,0,0,1);{const xt=O-H,_t=le-H,Qt=U-Q,St=ve-Q,$t=xt*St-_t*Qt,Ht=(Te*St-_t*Ze)/$t,jn=(xt*Ze-Te*Qt)/$t;return new an(O-w+Ht*O,le-w+jn*le,w,U-E+Ht*U,ve-E+jn*ve,E,Ht,jn,1)}}static quadrilateralToSquare(w,E,O,U,H,Q,le,ve){return an.squareToQuadrilateral(w,E,O,U,H,Q,le,ve).buildAdjoint()}buildAdjoint(){return new an(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(w){return new an(this.a11*w.a11+this.a21*w.a12+this.a31*w.a13,this.a11*w.a21+this.a21*w.a22+this.a31*w.a23,this.a11*w.a31+this.a21*w.a32+this.a31*w.a33,this.a12*w.a11+this.a22*w.a12+this.a32*w.a13,this.a12*w.a21+this.a22*w.a22+this.a32*w.a23,this.a12*w.a31+this.a22*w.a32+this.a32*w.a33,this.a13*w.a11+this.a23*w.a12+this.a33*w.a13,this.a13*w.a21+this.a23*w.a22+this.a33*w.a23,this.a13*w.a31+this.a23*w.a32+this.a33*w.a33)}}class Jt extends Xt{sampleGrid(w,E,O,U,H,Q,le,ve,Te,Ze,xt,_t,Qt,St,$t,Ht,jn,xr,Nr){const jr=an.quadrilateralToQuadrilateral(U,H,Q,le,ve,Te,Ze,xt,_t,Qt,St,$t,Ht,jn,xr,Nr);return this.sampleGridWithTransform(w,E,O,jr)}sampleGridWithTransform(w,E,O,U){if(E<=0||O<=0)throw new q;const H=new fe(E,O),Q=new Float32Array(2*E);for(let le=0;le<O;le++){const ve=Q.length,Te=le+.5;for(let Ze=0;Ze<ve;Ze+=2)Q[Ze]=Ze/2+.5,Q[Ze+1]=Te;U.transformPoints(Q),Xt.checkAndNudgePoints(w,Q);try{for(let Ze=0;Ze<ve;Ze+=2)w.get(Math.floor(Q[Ze]),Math.floor(Q[Ze+1]))&&H.set(Ze/2,le)}catch{throw new q}}return H}}class Ye{static setGridSampler(w){Ye.gridSampler=w}static getInstance(){return Ye.gridSampler}}Ye.gridSampler=new Jt;class Je{constructor(w,E){this.x=w,this.y=E}toResultPoint(){return new wt(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class It{constructor(w){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=w}detect(){return this.detectMirror(!1)}detectMirror(w){let E=this.getMatrixCenter(),O=this.getBullsEyeCorners(E);if(w){let Q=O[0];O[0]=O[2],O[2]=Q}this.extractParameters(O);let U=this.sampleGrid(this.image,O[this.shift%4],O[(this.shift+1)%4],O[(this.shift+2)%4],O[(this.shift+3)%4]),H=this.getMatrixCornerPoints(O);return new cn(U,H,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(w){if(!this.isValidPoint(w[0])||!this.isValidPoint(w[1])||!this.isValidPoint(w[2])||!this.isValidPoint(w[3]))throw new q;let E=2*this.nbCenterLayers,O=new Int32Array([this.sampleLine(w[0],w[1],E),this.sampleLine(w[1],w[2],E),this.sampleLine(w[2],w[3],E),this.sampleLine(w[3],w[0],E)]);this.shift=this.getRotation(O,E);let U=0;for(let Q=0;Q<4;Q++){let le=O[(this.shift+Q)%4];this.compact?(U<<=7,U+=le>>1&127):(U<<=10,U+=(le>>2&992)+(le>>1&31))}let H=this.getCorrectedParameterData(U,this.compact);this.compact?(this.nbLayers=(H>>6)+1,this.nbDataBlocks=(H&63)+1):(this.nbLayers=(H>>11)+1,this.nbDataBlocks=(H&2047)+1)}getRotation(w,E){let O=0;w.forEach((U,H,Q)=>{let le=(U>>E-2<<1)+(U&1);O=(O<<3)+le}),O=((O&1)<<11)+(O>>1);for(let U=0;U<4;U++)if(T.bitCount(O^this.EXPECTED_CORNER_BITS[U])<=2)return U;throw new q}getCorrectedParameterData(w,E){let O,U;E?(O=7,U=2):(O=10,U=4);let H=O-U,Q=new Int32Array(O);for(let ve=O-1;ve>=0;--ve)Q[ve]=w&15,w>>=4;try{new Le(dt.AZTEC_PARAM).decode(Q,H)}catch{throw new q}let le=0;for(let ve=0;ve<U;ve++)le=(le<<4)+Q[ve];return le}getBullsEyeCorners(w){let E=w,O=w,U=w,H=w,Q=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let xt=this.getFirstDifferent(E,Q,1,-1),_t=this.getFirstDifferent(O,Q,1,1),Qt=this.getFirstDifferent(U,Q,-1,1),St=this.getFirstDifferent(H,Q,-1,-1);if(this.nbCenterLayers>2){let $t=this.distancePoint(St,xt)*this.nbCenterLayers/(this.distancePoint(H,E)*(this.nbCenterLayers+2));if($t<.75||$t>1.25||!this.isWhiteOrBlackRectangle(xt,_t,Qt,St))break}E=xt,O=_t,U=Qt,H=St,Q=!Q}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new q;this.compact=this.nbCenterLayers===5;let le=new wt(E.getX()+.5,E.getY()-.5),ve=new wt(O.getX()+.5,O.getY()+.5),Te=new wt(U.getX()-.5,U.getY()+.5),Ze=new wt(H.getX()-.5,H.getY()-.5);return this.expandSquare([le,ve,Te,Ze],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let w,E,O,U;try{let le=new Un(this.image).detect();w=le[0],E=le[1],O=le[2],U=le[3]}catch{let ve=this.image.getWidth()/2,Te=this.image.getHeight()/2;w=this.getFirstDifferent(new Je(ve+7,Te-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new Je(ve+7,Te+7),!1,1,1).toResultPoint(),O=this.getFirstDifferent(new Je(ve-7,Te+7),!1,-1,1).toResultPoint(),U=this.getFirstDifferent(new Je(ve-7,Te-7),!1,-1,-1).toResultPoint()}let H=pt.round((w.getX()+U.getX()+E.getX()+O.getX())/4),Q=pt.round((w.getY()+U.getY()+E.getY()+O.getY())/4);try{let le=new Un(this.image,15,H,Q).detect();w=le[0],E=le[1],O=le[2],U=le[3]}catch{w=this.getFirstDifferent(new Je(H+7,Q-7),!1,1,-1).toResultPoint(),E=this.getFirstDifferent(new Je(H+7,Q+7),!1,1,1).toResultPoint(),O=this.getFirstDifferent(new Je(H-7,Q+7),!1,-1,1).toResultPoint(),U=this.getFirstDifferent(new Je(H-7,Q-7),!1,-1,-1).toResultPoint()}return H=pt.round((w.getX()+U.getX()+E.getX()+O.getX())/4),Q=pt.round((w.getY()+U.getY()+E.getY()+O.getY())/4),new Je(H,Q)}getMatrixCornerPoints(w){return this.expandSquare(w,2*this.nbCenterLayers,this.getDimension())}sampleGrid(w,E,O,U,H){let Q=Ye.getInstance(),le=this.getDimension(),ve=le/2-this.nbCenterLayers,Te=le/2+this.nbCenterLayers;return Q.sampleGrid(w,le,le,ve,ve,Te,ve,Te,Te,ve,Te,E.getX(),E.getY(),O.getX(),O.getY(),U.getX(),U.getY(),H.getX(),H.getY())}sampleLine(w,E,O){let U=0,H=this.distanceResultPoint(w,E),Q=H/O,le=w.getX(),ve=w.getY(),Te=Q*(E.getX()-w.getX())/H,Ze=Q*(E.getY()-w.getY())/H;for(let xt=0;xt<O;xt++)this.image.get(pt.round(le+xt*Te),pt.round(ve+xt*Ze))&&(U|=1<<O-xt-1);return U}isWhiteOrBlackRectangle(w,E,O,U){let H=3;w=new Je(w.getX()-H,w.getY()+H),E=new Je(E.getX()-H,E.getY()-H),O=new Je(O.getX()+H,O.getY()-H),U=new Je(U.getX()+H,U.getY()+H);let Q=this.getColor(U,w);if(Q===0)return!1;let le=this.getColor(w,E);return le!==Q||(le=this.getColor(E,O),le!==Q)?!1:(le=this.getColor(O,U),le===Q)}getColor(w,E){let O=this.distancePoint(w,E),U=(E.getX()-w.getX())/O,H=(E.getY()-w.getY())/O,Q=0,le=w.getX(),ve=w.getY(),Te=this.image.get(w.getX(),w.getY()),Ze=Math.ceil(O);for(let _t=0;_t<Ze;_t++)le+=U,ve+=H,this.image.get(pt.round(le),pt.round(ve))!==Te&&Q++;let xt=Q/O;return xt>.1&&xt<.9?0:xt<=.1===Te?1:-1}getFirstDifferent(w,E,O,U){let H=w.getX()+O,Q=w.getY()+U;for(;this.isValid(H,Q)&&this.image.get(H,Q)===E;)H+=O,Q+=U;for(H-=O,Q-=U;this.isValid(H,Q)&&this.image.get(H,Q)===E;)H+=O;for(H-=O;this.isValid(H,Q)&&this.image.get(H,Q)===E;)Q+=U;return Q-=U,new Je(H,Q)}expandSquare(w,E,O){let U=O/(2*E),H=w[0].getX()-w[2].getX(),Q=w[0].getY()-w[2].getY(),le=(w[0].getX()+w[2].getX())/2,ve=(w[0].getY()+w[2].getY())/2,Te=new wt(le+U*H,ve+U*Q),Ze=new wt(le-U*H,ve-U*Q);H=w[1].getX()-w[3].getX(),Q=w[1].getY()-w[3].getY(),le=(w[1].getX()+w[3].getX())/2,ve=(w[1].getY()+w[3].getY())/2;let xt=new wt(le+U*H,ve+U*Q),_t=new wt(le-U*H,ve-U*Q);return[Te,xt,Ze,_t]}isValid(w,E){return w>=0&&w<this.image.getWidth()&&E>0&&E<this.image.getHeight()}isValidPoint(w){let E=pt.round(w.getX()),O=pt.round(w.getY());return this.isValid(E,O)}distancePoint(w,E){return pt.distance(w.getX(),w.getY(),E.getX(),E.getY())}distanceResultPoint(w,E){return pt.distance(w.getX(),w.getY(),E.getX(),E.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(T.truncDivision(this.nbLayers-4,8)+1)+15}}class hn{decode(w,E=null){let O=null,U=new It(w.getBlackMatrix()),H=null,Q=null;try{let Ze=U.detectMirror(!1);H=Ze.getPoints(),this.reportFoundResultPoints(E,H),Q=new ht().decode(Ze)}catch(Ze){O=Ze}if(Q==null)try{let Ze=U.detectMirror(!0);H=Ze.getPoints(),this.reportFoundResultPoints(E,H),Q=new ht().decode(Ze)}catch(Ze){throw O??Ze}let le=new me(Q.getText(),Q.getRawBytes(),Q.getNumBits(),H,xe.AZTEC,v.currentTimeMillis()),ve=Q.getByteSegments();ve!=null&&le.putMetadata(je.BYTE_SEGMENTS,ve);let Te=Q.getECLevel();return Te!=null&&le.putMetadata(je.ERROR_CORRECTION_LEVEL,Te),le}reportFoundResultPoints(w,E){if(w!=null){let O=w.get($.NEED_RESULT_POINT_CALLBACK);O!=null&&E.forEach((U,H,Q)=>{O.foundPossibleResultPoint(U)})}}reset(){}}class Yt extends Ce{constructor(w=500){super(new hn,w)}}class Rt{decode(w,E){try{return this.doDecode(w,E)}catch{if(E&&E.get($.TRY_HARDER)===!0&&w.isRotateSupported()){const H=w.rotateCounterClockwise(),Q=this.doDecode(H,E),le=Q.getResultMetadata();let ve=270;le!==null&&le.get(je.ORIENTATION)===!0&&(ve=ve+le.get(je.ORIENTATION)%360),Q.putMetadata(je.ORIENTATION,ve);const Te=Q.getResultPoints();if(Te!==null){const Ze=H.getHeight();for(let xt=0;xt<Te.length;xt++)Te[xt]=new wt(Ze-Te[xt].getY()-1,Te[xt].getX())}return Q}else throw new q}}reset(){}doDecode(w,E){const O=w.getWidth(),U=w.getHeight();let H=new M(O);const Q=E&&E.get($.TRY_HARDER)===!0,le=Math.max(1,U>>(Q?8:5));let ve;Q?ve=U:ve=15;const Te=Math.trunc(U/2);for(let Ze=0;Ze<ve;Ze++){const xt=Math.trunc((Ze+1)/2),_t=(Ze&1)===0,Qt=Te+le*(_t?xt:-xt);if(Qt<0||Qt>=U)break;try{H=w.getBlackRow(Qt,H)}catch{continue}for(let St=0;St<2;St++){if(St===1&&(H.reverse(),E&&E.get($.NEED_RESULT_POINT_CALLBACK)===!0)){const $t=new Map;E.forEach((Ht,jn)=>$t.set(jn,Ht)),$t.delete($.NEED_RESULT_POINT_CALLBACK),E=$t}try{const $t=this.decodeRow(Qt,H,E);if(St===1){$t.putMetadata(je.ORIENTATION,180);const Ht=$t.getResultPoints();Ht!==null&&(Ht[0]=new wt(O-Ht[0].getX()-1,Ht[0].getY()),Ht[1]=new wt(O-Ht[1].getX()-1,Ht[1].getY()))}return $t}catch{}}}throw new q}static recordPattern(w,E,O){const U=O.length;for(let Te=0;Te<U;Te++)O[Te]=0;const H=w.getSize();if(E>=H)throw new q;let Q=!w.get(E),le=0,ve=E;for(;ve<H;){if(w.get(ve)!==Q)O[le]++;else{if(++le===U)break;O[le]=1,Q=!Q}ve++}if(!(le===U||le===U-1&&ve===H))throw new q}static recordPatternInReverse(w,E,O){let U=O.length,H=w.get(E);for(;E>0&&U>=0;)w.get(--E)!==H&&(U--,H=!H);if(U>=0)throw new q;Rt.recordPattern(w,E+1,O)}static patternMatchVariance(w,E,O){const U=w.length;let H=0,Q=0;for(let Te=0;Te<U;Te++)H+=w[Te],Q+=E[Te];if(H<Q)return Number.POSITIVE_INFINITY;const le=H/Q;O*=le;let ve=0;for(let Te=0;Te<U;Te++){const Ze=w[Te],xt=E[Te]*le,_t=Ze>xt?Ze-xt:xt-Ze;if(_t>O)return Number.POSITIVE_INFINITY;ve+=_t}return ve/H}}class ot extends Rt{static findStartPattern(w){const E=w.getSize(),O=w.getNextSet(0);let U=0,H=Int32Array.from([0,0,0,0,0,0]),Q=O,le=!1;const ve=6;for(let Te=O;Te<E;Te++)if(w.get(Te)!==le)H[U]++;else{if(U===ve-1){let Ze=ot.MAX_AVG_VARIANCE,xt=-1;for(let _t=ot.CODE_START_A;_t<=ot.CODE_START_C;_t++){const Qt=Rt.patternMatchVariance(H,ot.CODE_PATTERNS[_t],ot.MAX_INDIVIDUAL_VARIANCE);Qt<Ze&&(Ze=Qt,xt=_t)}if(xt>=0&&w.isRange(Math.max(0,Q-(Te-Q)/2),Q,!1))return Int32Array.from([Q,Te,xt]);Q+=H[0]+H[1],H=H.slice(2,H.length-1),H[U-1]=0,H[U]=0,U--}else U++;H[U]=1,le=!le}throw new q}static decodeCode(w,E,O){Rt.recordPattern(w,O,E);let U=ot.MAX_AVG_VARIANCE,H=-1;for(let Q=0;Q<ot.CODE_PATTERNS.length;Q++){const le=ot.CODE_PATTERNS[Q],ve=this.patternMatchVariance(E,le,ot.MAX_INDIVIDUAL_VARIANCE);ve<U&&(U=ve,H=Q)}if(H>=0)return H;throw new q}decodeRow(w,E,O){const U=O&&O.get($.ASSUME_GS1)===!0,H=ot.findStartPattern(E),Q=H[2];let le=0;const ve=new Uint8Array(20);ve[le++]=Q;let Te;switch(Q){case ot.CODE_START_A:Te=ot.CODE_CODE_A;break;case ot.CODE_START_B:Te=ot.CODE_CODE_B;break;case ot.CODE_START_C:Te=ot.CODE_CODE_C;break;default:throw new L}let Ze=!1,xt=!1,_t="",Qt=H[0],St=H[1];const $t=Int32Array.from([0,0,0,0,0,0]);let Ht=0,jn=0,xr=Q,Nr=0,jr=!0,Ns=!1,Js=!1;for(;!Ze;){const Oi=xt;switch(xt=!1,Ht=jn,jn=ot.decodeCode(E,$t,St),ve[le++]=jn,jn!==ot.CODE_STOP&&(jr=!0),jn!==ot.CODE_STOP&&(Nr++,xr+=Nr*jn),Qt=St,St+=$t.reduce((Lm,W1)=>Lm+W1,0),jn){case ot.CODE_START_A:case ot.CODE_START_B:case ot.CODE_START_C:throw new L}switch(Te){case ot.CODE_CODE_A:if(jn<64)Js===Ns?_t+=String.fromCharCode(32+jn):_t+=String.fromCharCode(32+jn+128),Js=!1;else if(jn<96)Js===Ns?_t+=String.fromCharCode(jn-64):_t+=String.fromCharCode(jn+64),Js=!1;else switch(jn!==ot.CODE_STOP&&(jr=!1),jn){case ot.CODE_FNC_1:U&&(_t.length===0?_t+="]C1":_t+="");break;case ot.CODE_FNC_2:case ot.CODE_FNC_3:break;case ot.CODE_FNC_4_A:!Ns&&Js?(Ns=!0,Js=!1):Ns&&Js?(Ns=!1,Js=!1):Js=!0;break;case ot.CODE_SHIFT:xt=!0,Te=ot.CODE_CODE_B;break;case ot.CODE_CODE_B:Te=ot.CODE_CODE_B;break;case ot.CODE_CODE_C:Te=ot.CODE_CODE_C;break;case ot.CODE_STOP:Ze=!0;break}break;case ot.CODE_CODE_B:if(jn<96)Js===Ns?_t+=String.fromCharCode(32+jn):_t+=String.fromCharCode(32+jn+128),Js=!1;else switch(jn!==ot.CODE_STOP&&(jr=!1),jn){case ot.CODE_FNC_1:U&&(_t.length===0?_t+="]C1":_t+="");break;case ot.CODE_FNC_2:case ot.CODE_FNC_3:break;case ot.CODE_FNC_4_B:!Ns&&Js?(Ns=!0,Js=!1):Ns&&Js?(Ns=!1,Js=!1):Js=!0;break;case ot.CODE_SHIFT:xt=!0,Te=ot.CODE_CODE_A;break;case ot.CODE_CODE_A:Te=ot.CODE_CODE_A;break;case ot.CODE_CODE_C:Te=ot.CODE_CODE_C;break;case ot.CODE_STOP:Ze=!0;break}break;case ot.CODE_CODE_C:if(jn<100)jn<10&&(_t+="0"),_t+=jn;else switch(jn!==ot.CODE_STOP&&(jr=!1),jn){case ot.CODE_FNC_1:U&&(_t.length===0?_t+="]C1":_t+="");break;case ot.CODE_CODE_A:Te=ot.CODE_CODE_A;break;case ot.CODE_CODE_B:Te=ot.CODE_CODE_B;break;case ot.CODE_STOP:Ze=!0;break}break}Oi&&(Te=Te===ot.CODE_CODE_A?ot.CODE_CODE_B:ot.CODE_CODE_A)}const mc=St-Qt;if(St=E.getNextUnset(St),!E.isRange(St,Math.min(E.getSize(),St+(St-Qt)/2),!1))throw new q;if(xr-=Nr*Ht,xr%103!==Ht)throw new g;const no=_t.length;if(no===0)throw new q;no>0&&jr&&(Te===ot.CODE_CODE_C?_t=_t.substring(0,no-2):_t=_t.substring(0,no-1));const ro=(H[1]+H[0])/2,ha=Qt+mc/2,Ta=ve.length,Xo=new Uint8Array(Ta);for(let Oi=0;Oi<Ta;Oi++)Xo[Oi]=ve[Oi];const _d=[new wt(ro,w),new wt(ha,w)];return new me(_t,Xo,0,_d,xe.CODE_128,new Date().getTime())}}ot.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],ot.MAX_AVG_VARIANCE=.25,ot.MAX_INDIVIDUAL_VARIANCE=.7,ot.CODE_SHIFT=98,ot.CODE_CODE_C=99,ot.CODE_CODE_B=100,ot.CODE_CODE_A=101,ot.CODE_FNC_1=102,ot.CODE_FNC_2=97,ot.CODE_FNC_3=96,ot.CODE_FNC_4_A=101,ot.CODE_FNC_4_B=100,ot.CODE_START_A=103,ot.CODE_START_B=104,ot.CODE_START_C=105,ot.CODE_STOP=106;class De extends Rt{constructor(w=!1,E=!1){super(),this.usingCheckDigit=w,this.extendedMode=E,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(w,E,O){let U=this.counters;U.fill(0),this.decodeRowResult="";let H=De.findAsteriskPattern(E,U),Q=E.getNextSet(H[1]),le=E.getSize(),ve,Te;do{De.recordPattern(E,Q,U);let $t=De.toNarrowWidePattern(U);if($t<0)throw new q;ve=De.patternToChar($t),this.decodeRowResult+=ve,Te=Q;for(let Ht of U)Q+=Ht;Q=E.getNextSet(Q)}while(ve!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let Ze=0;for(let $t of U)Ze+=$t;let xt=Q-Te-Ze;if(Q!==le&&xt*2<Ze)throw new q;if(this.usingCheckDigit){let $t=this.decodeRowResult.length-1,Ht=0;for(let jn=0;jn<$t;jn++)Ht+=De.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(jn));if(this.decodeRowResult.charAt($t)!==De.ALPHABET_STRING.charAt(Ht%43))throw new g;this.decodeRowResult=this.decodeRowResult.substring(0,$t)}if(this.decodeRowResult.length===0)throw new q;let _t;this.extendedMode?_t=De.decodeExtended(this.decodeRowResult):_t=this.decodeRowResult;let Qt=(H[1]+H[0])/2,St=Te+Ze/2;return new me(_t,null,0,[new wt(Qt,w),new wt(St,w)],xe.CODE_39,new Date().getTime())}static findAsteriskPattern(w,E){let O=w.getSize(),U=w.getNextSet(0),H=0,Q=U,le=!1,ve=E.length;for(let Te=U;Te<O;Te++)if(w.get(Te)!==le)E[H]++;else{if(H===ve-1){if(this.toNarrowWidePattern(E)===De.ASTERISK_ENCODING&&w.isRange(Math.max(0,Q-Math.floor((Te-Q)/2)),Q,!1))return[Q,Te];Q+=E[0]+E[1],E.copyWithin(0,2,2+H-1),E[H-1]=0,E[H]=0,H--}else H++;E[H]=1,le=!le}throw new q}static toNarrowWidePattern(w){let E=w.length,O=0,U;do{let H=2147483647;for(let ve of w)ve<H&&ve>O&&(H=ve);O=H,U=0;let Q=0,le=0;for(let ve=0;ve<E;ve++){let Te=w[ve];Te>O&&(le|=1<<E-1-ve,U++,Q+=Te)}if(U===3){for(let ve=0;ve<E&&U>0;ve++){let Te=w[ve];if(Te>O&&(U--,Te*2>=Q))return-1}return le}}while(U>3);return-1}static patternToChar(w){for(let E=0;E<De.CHARACTER_ENCODINGS.length;E++)if(De.CHARACTER_ENCODINGS[E]===w)return De.ALPHABET_STRING.charAt(E);if(w===De.ASTERISK_ENCODING)return"*";throw new q}static decodeExtended(w){let E=w.length,O="";for(let U=0;U<E;U++){let H=w.charAt(U);if(H==="+"||H==="$"||H==="%"||H==="/"){let Q=w.charAt(U+1),le="\0";switch(H){case"+":if(Q>="A"&&Q<="Z")le=String.fromCharCode(Q.charCodeAt(0)+32);else throw new L;break;case"$":if(Q>="A"&&Q<="Z")le=String.fromCharCode(Q.charCodeAt(0)-64);else throw new L;break;case"%":if(Q>="A"&&Q<="E")le=String.fromCharCode(Q.charCodeAt(0)-38);else if(Q>="F"&&Q<="J")le=String.fromCharCode(Q.charCodeAt(0)-11);else if(Q>="K"&&Q<="O")le=String.fromCharCode(Q.charCodeAt(0)+16);else if(Q>="P"&&Q<="T")le=String.fromCharCode(Q.charCodeAt(0)+43);else if(Q==="U")le="\0";else if(Q==="V")le="@";else if(Q==="W")le="`";else if(Q==="X"||Q==="Y"||Q==="Z")le="";else throw new L;break;case"/":if(Q>="A"&&Q<="O")le=String.fromCharCode(Q.charCodeAt(0)-32);else if(Q==="Z")le=":";else throw new L;break}O+=le,U++}else O+=H}return O}}De.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",De.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],De.ASTERISK_ENCODING=148;class At extends Rt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(w,E,O){let U=this.decodeStart(E),H=this.decodeEnd(E),Q=new te;At.decodeMiddle(E,U[1],H[0],Q);let le=Q.toString(),ve=null;O!=null&&(ve=O.get($.ALLOWED_LENGTHS)),ve==null&&(ve=At.DEFAULT_ALLOWED_LENGTHS);let Te=le.length,Ze=!1,xt=0;for(let St of ve){if(Te===St){Ze=!0;break}St>xt&&(xt=St)}if(!Ze&&Te>xt&&(Ze=!0),!Ze)throw new L;const _t=[new wt(U[1],w),new wt(H[0],w)];return new me(le,null,0,_t,xe.ITF,new Date().getTime())}static decodeMiddle(w,E,O,U){let H=new Int32Array(10),Q=new Int32Array(5),le=new Int32Array(5);for(H.fill(0),Q.fill(0),le.fill(0);E<O;){Rt.recordPattern(w,E,H);for(let Te=0;Te<5;Te++){let Ze=2*Te;Q[Te]=H[Ze],le[Te]=H[Ze+1]}let ve=At.decodeDigit(Q);U.append(ve.toString()),ve=this.decodeDigit(le),U.append(ve.toString()),H.forEach(function(Te){E+=Te})}}decodeStart(w){let E=At.skipWhiteSpace(w),O=At.findGuardPattern(w,E,At.START_PATTERN);return this.narrowLineWidth=(O[1]-O[0])/4,this.validateQuietZone(w,O[0]),O}validateQuietZone(w,E){let O=this.narrowLineWidth*10;O=O<E?O:E;for(let U=E-1;O>0&&U>=0&&!w.get(U);U--)O--;if(O!==0)throw new q}static skipWhiteSpace(w){const E=w.getSize(),O=w.getNextSet(0);if(O===E)throw new q;return O}decodeEnd(w){w.reverse();try{let E=At.skipWhiteSpace(w),O;try{O=At.findGuardPattern(w,E,At.END_PATTERN_REVERSED[0])}catch(H){H instanceof q&&(O=At.findGuardPattern(w,E,At.END_PATTERN_REVERSED[1]))}this.validateQuietZone(w,O[0]);let U=O[0];return O[0]=w.getSize()-O[1],O[1]=w.getSize()-U,O}finally{w.reverse()}}static findGuardPattern(w,E,O){let U=O.length,H=new Int32Array(U),Q=w.getSize(),le=!1,ve=0,Te=E;H.fill(0);for(let Ze=E;Ze<Q;Ze++)if(w.get(Ze)!==le)H[ve]++;else{if(ve===U-1){if(Rt.patternMatchVariance(H,O,At.MAX_INDIVIDUAL_VARIANCE)<At.MAX_AVG_VARIANCE)return[Te,Ze];Te+=H[0]+H[1],v.arraycopy(H,2,H,0,ve-1),H[ve-1]=0,H[ve]=0,ve--}else ve++;H[ve]=1,le=!le}throw new q}static decodeDigit(w){let E=At.MAX_AVG_VARIANCE,O=-1,U=At.PATTERNS.length;for(let H=0;H<U;H++){let Q=At.PATTERNS[H],le=Rt.patternMatchVariance(w,Q,At.MAX_INDIVIDUAL_VARIANCE);le<E?(E=le,O=H):le===E&&(O=-1)}if(O>=0)return O%10;throw new q}}At.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],At.MAX_AVG_VARIANCE=.38,At.MAX_INDIVIDUAL_VARIANCE=.5,At.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],At.START_PATTERN=Int32Array.from([1,1,1,1]),At.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class ze extends Rt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(w){let E=!1,O,U=0,H=Int32Array.from([0,0,0]);for(;!E;){H=Int32Array.from([0,0,0]),O=ze.findGuardPattern(w,U,!1,this.START_END_PATTERN,H);let Q=O[0];U=O[1];let le=Q-(U-Q);le>=0&&(E=w.isRange(le,Q,!1))}return O}static checkChecksum(w){return ze.checkStandardUPCEANChecksum(w)}static checkStandardUPCEANChecksum(w){let E=w.length;if(E===0)return!1;let O=parseInt(w.charAt(E-1),10);return ze.getStandardUPCEANChecksum(w.substring(0,E-1))===O}static getStandardUPCEANChecksum(w){let E=w.length,O=0;for(let U=E-1;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}O*=3;for(let U=E-2;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}return(1e3-O)%10}static decodeEnd(w,E){return ze.findGuardPattern(w,E,!1,ze.START_END_PATTERN,new Int32Array(ze.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(w,E,O,U){return this.findGuardPattern(w,E,O,U,new Int32Array(U.length))}static findGuardPattern(w,E,O,U,H){let Q=w.getSize();E=O?w.getNextUnset(E):w.getNextSet(E);let le=0,ve=E,Te=U.length,Ze=O;for(let xt=E;xt<Q;xt++)if(w.get(xt)!==Ze)H[le]++;else{if(le===Te-1){if(Rt.patternMatchVariance(H,U,ze.MAX_INDIVIDUAL_VARIANCE)<ze.MAX_AVG_VARIANCE)return Int32Array.from([ve,xt]);ve+=H[0]+H[1];let _t=H.slice(2,H.length-1);for(let Qt=0;Qt<le-1;Qt++)H[Qt]=_t[Qt];H[le-1]=0,H[le]=0,le--}else le++;H[le]=1,Ze=!Ze}throw new q}static decodeDigit(w,E,O,U){this.recordPattern(w,O,E);let H=this.MAX_AVG_VARIANCE,Q=-1,le=U.length;for(let ve=0;ve<le;ve++){let Te=U[ve],Ze=Rt.patternMatchVariance(E,Te,ze.MAX_INDIVIDUAL_VARIANCE);Ze<H&&(H=Ze,Q=ve)}if(Q>=0)return Q;throw new q}}ze.MAX_AVG_VARIANCE=.48,ze.MAX_INDIVIDUAL_VARIANCE=.7,ze.START_END_PATTERN=Int32Array.from([1,1,1]),ze.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),ze.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),ze.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class rt{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(w,E,O){let U=this.decodeRowStringBuffer,H=this.decodeMiddle(E,O,U),Q=U.toString(),le=rt.parseExtensionString(Q),ve=[new wt((O[0]+O[1])/2,w),new wt(H,w)],Te=new me(Q,null,0,ve,xe.UPC_EAN_EXTENSION,new Date().getTime());return le!=null&&Te.putAllMetadata(le),Te}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Q=E[1],le=0;for(let Te=0;Te<5&&Q<H;Te++){let Ze=ze.decodeDigit(w,U,Q,ze.L_AND_G_PATTERNS);O+=String.fromCharCode(48+Ze%10);for(let xt of U)Q+=xt;Ze>=10&&(le|=1<<4-Te),Te!==4&&(Q=w.getNextSet(Q),Q=w.getNextUnset(Q))}if(O.length!==5)throw new q;let ve=this.determineCheckDigit(le);if(rt.extensionChecksum(O.toString())!==ve)throw new q;return Q}static extensionChecksum(w){let E=w.length,O=0;for(let U=E-2;U>=0;U-=2)O+=w.charAt(U).charCodeAt(0)-48;O*=3;for(let U=E-1;U>=0;U-=2)O+=w.charAt(U).charCodeAt(0)-48;return O*=3,O%10}determineCheckDigit(w){for(let E=0;E<10;E++)if(w===this.CHECK_DIGIT_ENCODINGS[E])return E;throw new q}static parseExtensionString(w){if(w.length!==5)return null;let E=rt.parseExtension5String(w);return E==null?null:new Map([[je.SUGGESTED_PRICE,E]])}static parseExtension5String(w){let E;switch(w.charAt(0)){case"0":E="£";break;case"5":E="$";break;case"9":switch(w){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}E="";break;default:E="";break}let O=parseInt(w.substring(1)),U=(O/100).toString(),H=O%100,Q=H<10?"0"+H:H.toString();return E+U+"."+Q}}class mt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(w,E,O){let U=this.decodeRowStringBuffer,H=this.decodeMiddle(E,O,U),Q=U.toString(),le=mt.parseExtensionString(Q),ve=[new wt((O[0]+O[1])/2,w),new wt(H,w)],Te=new me(Q,null,0,ve,xe.UPC_EAN_EXTENSION,new Date().getTime());return le!=null&&Te.putAllMetadata(le),Te}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Q=E[1],le=0;for(let ve=0;ve<2&&Q<H;ve++){let Te=ze.decodeDigit(w,U,Q,ze.L_AND_G_PATTERNS);O+=String.fromCharCode(48+Te%10);for(let Ze of U)Q+=Ze;Te>=10&&(le|=1<<1-ve),ve!==1&&(Q=w.getNextSet(Q),Q=w.getNextUnset(Q))}if(O.length!==2)throw new q;if(parseInt(O.toString())%4!==le)throw new q;return Q}static parseExtensionString(w){return w.length!==2?null:new Map([[je.ISSUE_NUMBER,parseInt(w)]])}}class Lt{static decodeRow(w,E,O){let U=ze.findGuardPattern(E,O,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new rt().decodeRow(w,E,U)}catch{return new mt().decodeRow(w,E,U)}}}Lt.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class kt extends ze{constructor(){super(),this.decodeRowStringBuffer="",kt.L_AND_G_PATTERNS=kt.L_PATTERNS.map(w=>Int32Array.from(w));for(let w=10;w<20;w++){let E=kt.L_PATTERNS[w-10],O=new Int32Array(E.length);for(let U=0;U<E.length;U++)O[U]=E[E.length-U-1];kt.L_AND_G_PATTERNS[w]=O}}decodeRow(w,E,O){let U=kt.findStartGuardPattern(E),H=O==null?null:O.get($.NEED_RESULT_POINT_CALLBACK);if(H!=null){const jr=new wt((U[0]+U[1])/2,w);H.foundPossibleResultPoint(jr)}let Q=this.decodeMiddle(E,U,this.decodeRowStringBuffer),le=Q.rowOffset,ve=Q.resultString;if(H!=null){const jr=new wt(le,w);H.foundPossibleResultPoint(jr)}let Te=this.decodeEnd(E,le);if(H!=null){const jr=new wt((Te[0]+Te[1])/2,w);H.foundPossibleResultPoint(jr)}let Ze=Te[1],xt=Ze+(Ze-Te[0]);if(xt>=E.getSize()||!E.isRange(Ze,xt,!1))throw new q;let _t=ve.toString();if(_t.length<8)throw new L;if(!kt.checkChecksum(_t))throw new g;let Qt=(U[1]+U[0])/2,St=(Te[1]+Te[0])/2,$t=this.getBarcodeFormat(),Ht=[new wt(Qt,w),new wt(St,w)],jn=new me(_t,null,0,Ht,$t,new Date().getTime()),xr=0;try{let jr=Lt.decodeRow(w,E,Te[1]);jn.putMetadata(je.UPC_EAN_EXTENSION,jr.getText()),jn.putAllMetadata(jr.getResultMetadata()),jn.addResultPoints(jr.getResultPoints()),xr=jr.getText().length}catch{}let Nr=O==null?null:O.get($.ALLOWED_EAN_EXTENSIONS);if(Nr!=null){let jr=!1;for(let Ns in Nr)if(xr.toString()===Ns){jr=!0;break}if(!jr)throw new q}return jn}decodeEnd(w,E){return kt.findGuardPattern(w,E,!1,kt.START_END_PATTERN,new Int32Array(kt.START_END_PATTERN.length).fill(0))}static checkChecksum(w){return kt.checkStandardUPCEANChecksum(w)}static checkStandardUPCEANChecksum(w){let E=w.length;if(E===0)return!1;let O=parseInt(w.charAt(E-1),10);return kt.getStandardUPCEANChecksum(w.substring(0,E-1))===O}static getStandardUPCEANChecksum(w){let E=w.length,O=0;for(let U=E-1;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}O*=3;for(let U=E-2;U>=0;U-=2){let H=w.charAt(U).charCodeAt(0)-48;if(H<0||H>9)throw new L;O+=H}return(1e3-O)%10}}class dn extends kt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,O){let U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Q=E[1],le=0;for(let Te=0;Te<6&&Q<H;Te++){let Ze=kt.decodeDigit(w,U,Q,kt.L_AND_G_PATTERNS);O+=String.fromCharCode(48+Ze%10);for(let xt of U)Q+=xt;Ze>=10&&(le|=1<<5-Te)}O=dn.determineFirstDigit(O,le),Q=kt.findGuardPattern(w,Q,!0,kt.MIDDLE_PATTERN,new Int32Array(kt.MIDDLE_PATTERN.length).fill(0))[1];for(let Te=0;Te<6&&Q<H;Te++){let Ze=kt.decodeDigit(w,U,Q,kt.L_PATTERNS);O+=String.fromCharCode(48+Ze);for(let xt of U)Q+=xt}return{rowOffset:Q,resultString:O}}getBarcodeFormat(){return xe.EAN_13}static determineFirstDigit(w,E){for(let O=0;O<10;O++)if(E===this.FIRST_DIGIT_ENCODINGS[O])return w=String.fromCharCode(48+O)+w,w;throw new q}}dn.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class rn extends kt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(w,E,O){const U=this.decodeMiddleCounters;U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Q=E[1];for(let ve=0;ve<4&&Q<H;ve++){let Te=kt.decodeDigit(w,U,Q,kt.L_PATTERNS);O+=String.fromCharCode(48+Te);for(let Ze of U)Q+=Ze}Q=kt.findGuardPattern(w,Q,!0,kt.MIDDLE_PATTERN,new Int32Array(kt.MIDDLE_PATTERN.length).fill(0))[1];for(let ve=0;ve<4&&Q<H;ve++){let Te=kt.decodeDigit(w,U,Q,kt.L_PATTERNS);O+=String.fromCharCode(48+Te);for(let Ze of U)Q+=Ze}return{rowOffset:Q,resultString:O}}getBarcodeFormat(){return xe.EAN_8}}class gn extends kt{constructor(){super(...arguments),this.ean13Reader=new dn}getBarcodeFormat(){return xe.UPC_A}decode(w,E){return this.maybeReturnResult(this.ean13Reader.decode(w))}decodeRow(w,E,O){return this.maybeReturnResult(this.ean13Reader.decodeRow(w,E,O))}decodeMiddle(w,E,O){return this.ean13Reader.decodeMiddle(w,E,O)}maybeReturnResult(w){let E=w.getText();if(E.charAt(0)==="0"){let O=new me(E.substring(1),null,null,w.getResultPoints(),xe.UPC_A);return w.getResultMetadata()!=null&&O.putAllMetadata(w.getResultMetadata()),O}else throw new q}reset(){this.ean13Reader.reset()}}class An extends kt{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(w,E,O){const U=this.decodeMiddleCounters.map(Te=>Te);U[0]=0,U[1]=0,U[2]=0,U[3]=0;const H=w.getSize();let Q=E[1],le=0;for(let Te=0;Te<6&&Q<H;Te++){const Ze=An.decodeDigit(w,U,Q,An.L_AND_G_PATTERNS);O+=String.fromCharCode(48+Ze%10);for(let xt of U)Q+=xt;Ze>=10&&(le|=1<<5-Te)}let ve=An.determineNumSysAndCheckDigit(O,le);return{rowOffset:Q,resultString:ve}}decodeEnd(w,E){return An.findGuardPatternWithoutCounters(w,E,!0,An.MIDDLE_END_PATTERN)}checkChecksum(w){return kt.checkChecksum(An.convertUPCEtoUPCA(w))}static determineNumSysAndCheckDigit(w,E){for(let O=0;O<=1;O++)for(let U=0;U<10;U++)if(E===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[O][U]){let H=String.fromCharCode(48+O),Q=String.fromCharCode(48+U);return H+w+Q}throw q.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(w){const E=w.slice(1,7).split("").map(H=>H.charCodeAt(0)),O=new te;O.append(w.charAt(0));let U=E[5];switch(U){case 0:case 1:case 2:O.appendChars(E,0,2),O.append(U),O.append("0000"),O.appendChars(E,2,3);break;case 3:O.appendChars(E,0,3),O.append("00000"),O.appendChars(E,3,2);break;case 4:O.appendChars(E,0,4),O.append("00000"),O.append(E[4]);break;default:O.appendChars(E,0,5),O.append("0000"),O.append(U);break}return w.length>=8&&O.append(w.charAt(7)),O.toString()}}An.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),An.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class kn extends Rt{constructor(w){super();let E=w==null?null:w.get($.POSSIBLE_FORMATS),O=[];r(E)?(O.push(new dn),O.push(new gn),O.push(new rn),O.push(new An)):(E.indexOf(xe.EAN_13)>-1&&O.push(new dn),E.indexOf(xe.UPC_A)>-1&&O.push(new gn),E.indexOf(xe.EAN_8)>-1&&O.push(new rn),E.indexOf(xe.UPC_E)>-1&&O.push(new An)),this.readers=O}decodeRow(w,E,O){for(let U of this.readers)try{const H=U.decodeRow(w,E,O),Q=H.getBarcodeFormat()===xe.EAN_13&&H.getText().charAt(0)==="0",le=O==null?null:O.get($.POSSIBLE_FORMATS),ve=le==null||le.includes(xe.UPC_A);if(Q&&ve){const Te=H.getRawBytes(),Ze=new me(H.getText().substring(1),Te,Te?Te.length:null,H.getResultPoints(),xe.UPC_A);return Ze.putAllMetadata(H.getResultMetadata()),Ze}return H}catch{}throw new q}reset(){for(let w of this.readers)w.reset()}}class yn extends Rt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(w,E){for(let O=0;O<E.length;O++)if(Rt.patternMatchVariance(w,E[O],yn.MAX_INDIVIDUAL_VARIANCE)<yn.MAX_AVG_VARIANCE)return O;throw new q}static count(w){return pt.sum(new Int32Array(w))}static increment(w,E){let O=0,U=E[0];for(let H=1;H<w.length;H++)E[H]>U&&(U=E[H],O=H);w[O]++}static decrement(w,E){let O=0,U=E[0];for(let H=1;H<w.length;H++)E[H]<U&&(U=E[H],O=H);w[O]--}static isFinderPattern(w){let E=w[0]+w[1],O=E+w[2]+w[3],U=E/O;if(U>=yn.MIN_FINDER_PATTERN_RATIO&&U<=yn.MAX_FINDER_PATTERN_RATIO){let H=Number.MAX_SAFE_INTEGER,Q=Number.MIN_SAFE_INTEGER;for(let le of w)le>Q&&(Q=le),le<H&&(H=le);return Q<10*H}return!1}}yn.MAX_AVG_VARIANCE=.2,yn.MAX_INDIVIDUAL_VARIANCE=.45,yn.MIN_FINDER_PATTERN_RATIO=9.5/12,yn.MAX_FINDER_PATTERN_RATIO=12.5/14;class Vn{constructor(w,E){this.value=w,this.checksumPortion=E}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(w){if(!(w instanceof Vn))return!1;const E=w;return this.value===E.value&&this.checksumPortion===E.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Kn{constructor(w,E,O,U,H){this.value=w,this.startEnd=E,this.value=w,this.startEnd=E,this.resultPoints=new Array,this.resultPoints.push(new wt(O,H)),this.resultPoints.push(new wt(U,H))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(w){if(!(w instanceof Kn))return!1;const E=w;return this.value===E.value}hashCode(){return this.value}}class Dn{constructor(){}static getRSSvalue(w,E,O){let U=0;for(let ve of w)U+=ve;let H=0,Q=0,le=w.length;for(let ve=0;ve<le-1;ve++){let Te;for(Te=1,Q|=1<<ve;Te<w[ve];Te++,Q&=~(1<<ve)){let Ze=Dn.combins(U-Te-1,le-ve-2);if(O&&Q===0&&U-Te-(le-ve-1)>=le-ve-1&&(Ze-=Dn.combins(U-Te-(le-ve),le-ve-2)),le-ve-1>1){let xt=0;for(let _t=U-Te-(le-ve-2);_t>E;_t--)xt+=Dn.combins(U-Te-_t-1,le-ve-3);Ze-=xt*(le-1-ve)}else U-Te>E&&Ze--;H+=Ze}U-=Te}return H}static combins(w,E){let O,U;w-E>E?(U=E,O=w-E):(U=w-E,O=E);let H=1,Q=1;for(let le=w;le>O;le--)H*=le,Q<=U&&(H/=Q,Q++);for(;Q<=U;)H/=Q,Q++;return H}}class Xn{static buildBitArray(w){let E=w.length*2-1;w[w.length-1].getRightChar()==null&&(E-=1);let O=12*E,U=new M(O),H=0,le=w[0].getRightChar().getValue();for(let ve=11;ve>=0;--ve)le&1<<ve&&U.set(H),H++;for(let ve=1;ve<w.length;++ve){let Te=w[ve],Ze=Te.getLeftChar().getValue();for(let xt=11;xt>=0;--xt)Ze&1<<xt&&U.set(H),H++;if(Te.getRightChar()!=null){let xt=Te.getRightChar().getValue();for(let _t=11;_t>=0;--_t)xt&1<<_t&&U.set(H),H++}}return U}}class Nn{constructor(w,E){E?this.decodedInformation=null:(this.finished=w,this.decodedInformation=E)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class on{constructor(w){this.newPosition=w}getNewPosition(){return this.newPosition}}class Oe extends on{constructor(w,E){super(w),this.value=E}getValue(){return this.value}isFNC1(){return this.value===Oe.FNC1}}Oe.FNC1="$";class Zt extends on{constructor(w,E,O){super(w),O?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=E}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class sn extends on{constructor(w,E,O){if(super(w),E<0||E>10||O<0||O>10)throw new L;this.firstDigit=E,this.secondDigit=O}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===sn.FNC1}isSecondDigitFNC1(){return this.secondDigit===sn.FNC1}isAnyFNC1(){return this.firstDigit===sn.FNC1||this.secondDigit===sn.FNC1}}sn.FNC1=10;class jt{constructor(){}static parseFieldsInGeneralPurpose(w){if(!w)return null;if(w.length<2)throw new q;let E=w.substring(0,2);for(let H of jt.TWO_DIGIT_DATA_LENGTH)if(H[0]===E)return H[1]===jt.VARIABLE_LENGTH?jt.processVariableAI(2,H[2],w):jt.processFixedAI(2,H[1],w);if(w.length<3)throw new q;let O=w.substring(0,3);for(let H of jt.THREE_DIGIT_DATA_LENGTH)if(H[0]===O)return H[1]===jt.VARIABLE_LENGTH?jt.processVariableAI(3,H[2],w):jt.processFixedAI(3,H[1],w);for(let H of jt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(H[0]===O)return H[1]===jt.VARIABLE_LENGTH?jt.processVariableAI(4,H[2],w):jt.processFixedAI(4,H[1],w);if(w.length<4)throw new q;let U=w.substring(0,4);for(let H of jt.FOUR_DIGIT_DATA_LENGTH)if(H[0]===U)return H[1]===jt.VARIABLE_LENGTH?jt.processVariableAI(4,H[2],w):jt.processFixedAI(4,H[1],w);throw new q}static processFixedAI(w,E,O){if(O.length<w)throw new q;let U=O.substring(0,w);if(O.length<w+E)throw new q;let H=O.substring(w,w+E),Q=O.substring(w+E),le="("+U+")"+H,ve=jt.parseFieldsInGeneralPurpose(Q);return ve==null?le:le+ve}static processVariableAI(w,E,O){let U=O.substring(0,w),H;O.length<w+E?H=O.length:H=w+E;let Q=O.substring(w,H),le=O.substring(H),ve="("+U+")"+Q,Te=jt.parseFieldsInGeneralPurpose(le);return Te==null?ve:ve+Te}}jt.VARIABLE_LENGTH=[],jt.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",jt.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",jt.VARIABLE_LENGTH,20],["22",jt.VARIABLE_LENGTH,29],["30",jt.VARIABLE_LENGTH,8],["37",jt.VARIABLE_LENGTH,8],["90",jt.VARIABLE_LENGTH,30],["91",jt.VARIABLE_LENGTH,30],["92",jt.VARIABLE_LENGTH,30],["93",jt.VARIABLE_LENGTH,30],["94",jt.VARIABLE_LENGTH,30],["95",jt.VARIABLE_LENGTH,30],["96",jt.VARIABLE_LENGTH,30],["97",jt.VARIABLE_LENGTH,3],["98",jt.VARIABLE_LENGTH,30],["99",jt.VARIABLE_LENGTH,30]],jt.THREE_DIGIT_DATA_LENGTH=[["240",jt.VARIABLE_LENGTH,30],["241",jt.VARIABLE_LENGTH,30],["242",jt.VARIABLE_LENGTH,6],["250",jt.VARIABLE_LENGTH,30],["251",jt.VARIABLE_LENGTH,30],["253",jt.VARIABLE_LENGTH,17],["254",jt.VARIABLE_LENGTH,20],["400",jt.VARIABLE_LENGTH,30],["401",jt.VARIABLE_LENGTH,30],["402",17],["403",jt.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",jt.VARIABLE_LENGTH,20],["421",jt.VARIABLE_LENGTH,15],["422",3],["423",jt.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],jt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",jt.VARIABLE_LENGTH,15],["391",jt.VARIABLE_LENGTH,18],["392",jt.VARIABLE_LENGTH,15],["393",jt.VARIABLE_LENGTH,18],["703",jt.VARIABLE_LENGTH,30]],jt.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",jt.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",jt.VARIABLE_LENGTH,20],["8003",jt.VARIABLE_LENGTH,30],["8004",jt.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",jt.VARIABLE_LENGTH,30],["8008",jt.VARIABLE_LENGTH,12],["8018",18],["8020",jt.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",jt.VARIABLE_LENGTH,70],["8200",jt.VARIABLE_LENGTH,70]];class Qn{constructor(w){this.buffer=new te,this.information=w}decodeAllCodes(w,E){let O=E,U=null;do{let H=this.decodeGeneralPurposeField(O,U),Q=jt.parseFieldsInGeneralPurpose(H.getNewString());if(Q!=null&&w.append(Q),H.isRemaining()?U=""+H.getRemainingValue():U=null,O===H.getNewPosition())break;O=H.getNewPosition()}while(!0);return w.toString()}isStillNumeric(w){if(w+7>this.information.getSize())return w+4<=this.information.getSize();for(let E=w;E<w+3;++E)if(this.information.get(E))return!0;return this.information.get(w+3)}decodeNumeric(w){if(w+7>this.information.getSize()){let H=this.extractNumericValueFromBitArray(w,4);return H===0?new sn(this.information.getSize(),sn.FNC1,sn.FNC1):new sn(this.information.getSize(),H-1,sn.FNC1)}let E=this.extractNumericValueFromBitArray(w,7),O=(E-8)/11,U=(E-8)%11;return new sn(w+7,O,U)}extractNumericValueFromBitArray(w,E){return Qn.extractNumericValueFromBitArray(this.information,w,E)}static extractNumericValueFromBitArray(w,E,O){let U=0;for(let H=0;H<O;++H)w.get(E+H)&&(U|=1<<O-H-1);return U}decodeGeneralPurposeField(w,E){this.buffer.setLengthToZero(),E!=null&&this.buffer.append(E),this.current.setPosition(w);let O=this.parseBlocks();return O!=null&&O.isRemaining()?new Zt(this.current.getPosition(),this.buffer.toString(),O.getRemainingValue()):new Zt(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let w,E;do{let O=this.current.getPosition();if(this.current.isAlpha()?(E=this.parseAlphaBlock(),w=E.isFinished()):this.current.isIsoIec646()?(E=this.parseIsoIec646Block(),w=E.isFinished()):(E=this.parseNumericBlock(),w=E.isFinished()),!(O!==this.current.getPosition())&&!w)break}while(!w);return E.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let w=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(w.getNewPosition()),w.isFirstDigitFNC1()){let E;return w.isSecondDigitFNC1()?E=new Zt(this.current.getPosition(),this.buffer.toString()):E=new Zt(this.current.getPosition(),this.buffer.toString(),w.getSecondDigit()),new Nn(!0,E)}if(this.buffer.append(w.getFirstDigit()),w.isSecondDigitFNC1()){let E=new Zt(this.current.getPosition(),this.buffer.toString());return new Nn(!0,E)}this.buffer.append(w.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Nn(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let w=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(w.getNewPosition()),w.isFNC1()){let E=new Zt(this.current.getPosition(),this.buffer.toString());return new Nn(!0,E)}this.buffer.append(w.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new Nn(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let w=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(w.getNewPosition()),w.isFNC1()){let E=new Zt(this.current.getPosition(),this.buffer.toString());return new Nn(!0,E)}this.buffer.append(w.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new Nn(!1)}isStillIsoIec646(w){if(w+5>this.information.getSize())return!1;let E=this.extractNumericValueFromBitArray(w,5);if(E>=5&&E<16)return!0;if(w+7>this.information.getSize())return!1;let O=this.extractNumericValueFromBitArray(w,7);if(O>=64&&O<116)return!0;if(w+8>this.information.getSize())return!1;let U=this.extractNumericValueFromBitArray(w,8);return U>=232&&U<253}decodeIsoIec646(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new Oe(w+5,Oe.FNC1);if(E>=5&&E<15)return new Oe(w+5,"0"+(E-5));let O=this.extractNumericValueFromBitArray(w,7);if(O>=64&&O<90)return new Oe(w+7,""+(O+1));if(O>=90&&O<116)return new Oe(w+7,""+(O+7));let U=this.extractNumericValueFromBitArray(w,8),H;switch(U){case 232:H="!";break;case 233:H='"';break;case 234:H="%";break;case 235:H="&";break;case 236:H="'";break;case 237:H="(";break;case 238:H=")";break;case 239:H="*";break;case 240:H="+";break;case 241:H=",";break;case 242:H="-";break;case 243:H=".";break;case 244:H="/";break;case 245:H=":";break;case 246:H=";";break;case 247:H="<";break;case 248:H="=";break;case 249:H=">";break;case 250:H="?";break;case 251:H="_";break;case 252:H=" ";break;default:throw new L}return new Oe(w+8,H)}isStillAlpha(w){if(w+5>this.information.getSize())return!1;let E=this.extractNumericValueFromBitArray(w,5);if(E>=5&&E<16)return!0;if(w+6>this.information.getSize())return!1;let O=this.extractNumericValueFromBitArray(w,6);return O>=16&&O<63}decodeAlphanumeric(w){let E=this.extractNumericValueFromBitArray(w,5);if(E===15)return new Oe(w+5,Oe.FNC1);if(E>=5&&E<15)return new Oe(w+5,"0"+(E-5));let O=this.extractNumericValueFromBitArray(w,6);if(O>=32&&O<58)return new Oe(w+6,""+(O+33));let U;switch(O){case 58:U="*";break;case 59:U=",";break;case 60:U="-";break;case 61:U=".";break;case 62:U="/";break;default:throw new nt("Decoding invalid alphanumeric value: "+O)}return new Oe(w+6,U)}isAlphaTo646ToAlphaLatch(w){if(w+1>this.information.getSize())return!1;for(let E=0;E<5&&E+w<this.information.getSize();++E)if(E===2){if(!this.information.get(w+2))return!1}else if(this.information.get(w+E))return!1;return!0}isAlphaOr646ToNumericLatch(w){if(w+3>this.information.getSize())return!1;for(let E=w;E<w+3;++E)if(this.information.get(E))return!1;return!0}isNumericToAlphaNumericLatch(w){if(w+1>this.information.getSize())return!1;for(let E=0;E<4&&E+w<this.information.getSize();++E)if(this.information.get(w+E))return!1;return!0}}class bn{constructor(w){this.information=w,this.generalDecoder=new Qn(w)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Dt extends bn{constructor(w){super(w)}encodeCompressedGtin(w,E){w.append("(01)");let O=w.length();w.append("9"),this.encodeCompressedGtinWithoutAI(w,E,O)}encodeCompressedGtinWithoutAI(w,E,O){for(let U=0;U<4;++U){let H=this.getGeneralDecoder().extractNumericValueFromBitArray(E+10*U,10);H/100===0&&w.append("0"),H/10===0&&w.append("0"),w.append(H)}Dt.appendCheckDigit(w,O)}static appendCheckDigit(w,E){let O=0;for(let U=0;U<13;U++){let H=w.charAt(U+E).charCodeAt(0)-48;O+=U&1?H:3*H}O=10-O%10,O===10&&(O=0),w.append(O)}}Dt.GTIN_SIZE=40;class en extends Dt{constructor(w){super(w)}parseInformation(){let w=new te;w.append("(01)");let E=w.length(),O=this.getGeneralDecoder().extractNumericValueFromBitArray(en.HEADER_SIZE,4);return w.append(O),this.encodeCompressedGtinWithoutAI(w,en.HEADER_SIZE+4,E),this.getGeneralDecoder().decodeAllCodes(w,en.HEADER_SIZE+44)}}en.HEADER_SIZE=4;class Pn extends bn{constructor(w){super(w)}parseInformation(){let w=new te;return this.getGeneralDecoder().decodeAllCodes(w,Pn.HEADER_SIZE)}}Pn.HEADER_SIZE=5;class tr extends Dt{constructor(w){super(w)}encodeCompressedWeight(w,E,O){let U=this.getGeneralDecoder().extractNumericValueFromBitArray(E,O);this.addWeightCode(w,U);let H=this.checkWeight(U),Q=1e5;for(let le=0;le<5;++le)H/Q===0&&w.append("0"),Q/=10;w.append(H)}}class ar extends tr{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()!=ar.HEADER_SIZE+tr.GTIN_SIZE+ar.WEIGHT_SIZE)throw new q;let w=new te;return this.encodeCompressedGtin(w,ar.HEADER_SIZE),this.encodeCompressedWeight(w,ar.HEADER_SIZE+tr.GTIN_SIZE,ar.WEIGHT_SIZE),w.toString()}}ar.HEADER_SIZE=5,ar.WEIGHT_SIZE=15;class hr extends ar{constructor(w){super(w)}addWeightCode(w,E){w.append("(3103)")}checkWeight(w){return w}}class qt extends ar{constructor(w){super(w)}addWeightCode(w,E){E<1e4?w.append("(3202)"):w.append("(3203)")}checkWeight(w){return w<1e4?w:w-1e4}}class zn extends Dt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<zn.HEADER_SIZE+Dt.GTIN_SIZE)throw new q;let w=new te;this.encodeCompressedGtin(w,zn.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(zn.HEADER_SIZE+Dt.GTIN_SIZE,zn.LAST_DIGIT_SIZE);w.append("(392"),w.append(E),w.append(")");let O=this.getGeneralDecoder().decodeGeneralPurposeField(zn.HEADER_SIZE+Dt.GTIN_SIZE+zn.LAST_DIGIT_SIZE,null);return w.append(O.getNewString()),w.toString()}}zn.HEADER_SIZE=8,zn.LAST_DIGIT_SIZE=2;class Zn extends Dt{constructor(w){super(w)}parseInformation(){if(this.getInformation().getSize()<Zn.HEADER_SIZE+Dt.GTIN_SIZE)throw new q;let w=new te;this.encodeCompressedGtin(w,Zn.HEADER_SIZE);let E=this.getGeneralDecoder().extractNumericValueFromBitArray(Zn.HEADER_SIZE+Dt.GTIN_SIZE,Zn.LAST_DIGIT_SIZE);w.append("(393"),w.append(E),w.append(")");let O=this.getGeneralDecoder().extractNumericValueFromBitArray(Zn.HEADER_SIZE+Dt.GTIN_SIZE+Zn.LAST_DIGIT_SIZE,Zn.FIRST_THREE_DIGITS_SIZE);O/100==0&&w.append("0"),O/10==0&&w.append("0"),w.append(O);let U=this.getGeneralDecoder().decodeGeneralPurposeField(Zn.HEADER_SIZE+Dt.GTIN_SIZE+Zn.LAST_DIGIT_SIZE+Zn.FIRST_THREE_DIGITS_SIZE,null);return w.append(U.getNewString()),w.toString()}}Zn.HEADER_SIZE=8,Zn.LAST_DIGIT_SIZE=2,Zn.FIRST_THREE_DIGITS_SIZE=10;class Ft extends tr{constructor(w,E,O){super(w),this.dateCode=O,this.firstAIdigits=E}parseInformation(){if(this.getInformation().getSize()!=Ft.HEADER_SIZE+Ft.GTIN_SIZE+Ft.WEIGHT_SIZE+Ft.DATE_SIZE)throw new q;let w=new te;return this.encodeCompressedGtin(w,Ft.HEADER_SIZE),this.encodeCompressedWeight(w,Ft.HEADER_SIZE+Ft.GTIN_SIZE,Ft.WEIGHT_SIZE),this.encodeCompressedDate(w,Ft.HEADER_SIZE+Ft.GTIN_SIZE+Ft.WEIGHT_SIZE),w.toString()}encodeCompressedDate(w,E){let O=this.getGeneralDecoder().extractNumericValueFromBitArray(E,Ft.DATE_SIZE);if(O==38400)return;w.append("("),w.append(this.dateCode),w.append(")");let U=O%32;O/=32;let H=O%12+1;O/=12;let Q=O;Q/10==0&&w.append("0"),w.append(Q),H/10==0&&w.append("0"),w.append(H),U/10==0&&w.append("0"),w.append(U)}addWeightCode(w,E){w.append("("),w.append(this.firstAIdigits),w.append(E/1e5),w.append(")")}checkWeight(w){return w%1e5}}Ft.HEADER_SIZE=8,Ft.WEIGHT_SIZE=20,Ft.DATE_SIZE=16;function En(ft){try{if(ft.get(1))return new en(ft);if(!ft.get(2))return new Pn(ft);switch(Qn.extractNumericValueFromBitArray(ft,1,4)){case 4:return new hr(ft);case 5:return new qt(ft)}switch(Qn.extractNumericValueFromBitArray(ft,1,5)){case 12:return new zn(ft);case 13:return new Zn(ft)}switch(Qn.extractNumericValueFromBitArray(ft,1,7)){case 56:return new Ft(ft,"310","11");case 57:return new Ft(ft,"320","11");case 58:return new Ft(ft,"310","13");case 59:return new Ft(ft,"320","13");case 60:return new Ft(ft,"310","15");case 61:return new Ft(ft,"320","15");case 62:return new Ft(ft,"310","17");case 63:return new Ft(ft,"320","17")}}catch(w){throw console.log(w),new nt("unknown decoder: "+ft)}}class Ee{constructor(w,E,O,U){this.leftchar=w,this.rightchar=E,this.finderpattern=O,this.maybeLast=U}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(w,E){return w instanceof Ee?Ee.equalsOrNull(w.leftchar,E.leftchar)&&Ee.equalsOrNull(w.rightchar,E.rightchar)&&Ee.equalsOrNull(w.finderpattern,E.finderpattern):!1}static equalsOrNull(w,E){return w===null?E===null:Ee.equals(w,E)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class h{constructor(w,E,O){this.pairs=w,this.rowNumber=E,this.wasReversed=O}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(w){return this.checkEqualitity(this,w)}toString(){return"{ "+this.pairs+" }"}equals(w,E){return w instanceof h?this.checkEqualitity(w,E)&&w.wasReversed===E.wasReversed:!1}checkEqualitity(w,E){if(!w||!E)return;let O;return w.forEach((U,H)=>{E.forEach(Q=>{U.getLeftChar().getValue()===Q.getLeftChar().getValue()&&U.getRightChar().getValue()===Q.getRightChar().getValue()&&U.getFinderPatter().getValue()===Q.getFinderPatter().getValue()&&(O=!0)})}),O}}class p extends yn{constructor(w){super(...arguments),this.pairs=new Array(p.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=w===!0}decodeRow(w,E,O){this.pairs.length=0,this.startFromEven=!1;try{return p.constructResult(this.decodeRow2pairs(w,E))}catch(U){this.verbose&&console.log(U)}return this.pairs.length=0,this.startFromEven=!0,p.constructResult(this.decodeRow2pairs(w,E))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(w,E){let O=!1;for(;!O;)try{this.pairs.push(this.retrieveNextPair(E,this.pairs,w))}catch(H){if(H instanceof q){if(!this.pairs.length)throw new q;O=!0}}if(this.checkChecksum())return this.pairs;let U;if(this.rows.length?U=!0:U=!1,this.storeRow(w,!1),U){let H=this.checkRowsBoolean(!1);if(H!=null||(H=this.checkRowsBoolean(!0),H!=null))return H}throw new q}checkRowsBoolean(w){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,w&&(this.rows=this.rows.reverse());let E=null;try{E=this.checkRows(new Array,0)}catch(O){this.verbose&&console.log(O)}return w&&(this.rows=this.rows.reverse()),E}checkRows(w,E){for(let O=E;O<this.rows.length;O++){let U=this.rows[O];this.pairs.length=0;for(let Q of w)this.pairs.push(Q.getPairs());if(this.pairs.push(U.getPairs()),!p.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let H=new Array(w);H.push(U);try{return this.checkRows(H,O+1)}catch(Q){this.verbose&&console.log(Q)}}throw new q}static isValidSequence(w){for(let E of p.FINDER_PATTERN_SEQUENCES){if(w.length>E.length)continue;let O=!0;for(let U=0;U<w.length;U++)if(w[U].getFinderPattern().getValue()!=E[U]){O=!1;break}if(O)return!0}return!1}storeRow(w,E){let O=0,U=!1,H=!1;for(;O<this.rows.length;){let Q=this.rows[O];if(Q.getRowNumber()>w){H=Q.isEquivalent(this.pairs);break}U=Q.isEquivalent(this.pairs),O++}H||U||p.isPartialRow(this.pairs,this.rows)||(this.rows.push(O,new h(this.pairs,w,E)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(w,E){for(let O of E)if(O.getPairs().length!==w.length){for(let U of O.getPairs())for(let H of w)if(Ee.equals(U,H))break}}static isPartialRow(w,E){for(let O of E){let U=!0;for(let H of w){let Q=!1;for(let le of O.getPairs())if(H.equals(le)){Q=!0;break}if(!Q){U=!1;break}}if(U)return!0}return!1}getRows(){return this.rows}static constructResult(w){let E=Xn.buildBitArray(w),U=En(E).parseInformation(),H=w[0].getFinderPattern().getResultPoints(),Q=w[w.length-1].getFinderPattern().getResultPoints(),le=[H[0],H[1],Q[0],Q[1]];return new me(U,null,null,le,xe.RSS_EXPANDED,null)}checkChecksum(){let w=this.pairs.get(0),E=w.getLeftChar(),O=w.getRightChar();if(O==null)return!1;let U=O.getChecksumPortion(),H=2;for(let le=1;le<this.pairs.size();++le){let ve=this.pairs.get(le);U+=ve.getLeftChar().getChecksumPortion(),H++;let Te=ve.getRightChar();Te!=null&&(U+=Te.getChecksumPortion(),H++)}return U%=211,211*(H-4)+U==E.getValue()}static getNextSecondBar(w,E){let O;return w.get(E)?(O=w.getNextUnset(E),O=w.getNextSet(O)):(O=w.getNextSet(E),O=w.getNextUnset(O)),O}retrieveNextPair(w,E,O){let U=E.length%2==0;this.startFromEven&&(U=!U);let H,Q=!0,le=-1;do this.findNextPair(w,E,le),H=this.parseFoundFinderPattern(w,O,U),H==null?le=p.getNextSecondBar(w,this.startEnd[0]):Q=!1;while(Q);let ve=this.decodeDataCharacter(w,H,U,!0);if(!this.isEmptyPair(E)&&E[E.length-1].mustBeLast())throw new q;let Te;try{Te=this.decodeDataCharacter(w,H,U,!1)}catch(Ze){Te=null,this.verbose&&console.log(Ze)}return new Ee(ve,Te,H,!0)}isEmptyPair(w){return w.length===0}findNextPair(w,E,O){let U=this.getDecodeFinderCounters();U[0]=0,U[1]=0,U[2]=0,U[3]=0;let H=w.getSize(),Q;O>=0?Q=O:this.isEmptyPair(E)?Q=0:Q=E[E.length-1].getFinderPattern().getStartEnd()[1];let le=E.length%2!=0;this.startFromEven&&(le=!le);let ve=!1;for(;Q<H&&(ve=!w.get(Q),!!ve);)Q++;let Te=0,Ze=Q;for(let xt=Q;xt<H;xt++)if(w.get(xt)!=ve)U[Te]++;else{if(Te==3){if(le&&p.reverseCounters(U),p.isFinderPattern(U)){this.startEnd[0]=Ze,this.startEnd[1]=xt;return}le&&p.reverseCounters(U),Ze+=U[0]+U[1],U[0]=U[2],U[1]=U[3],U[2]=0,U[3]=0,Te--}else Te++;U[Te]=1,ve=!ve}throw new q}static reverseCounters(w){let E=w.length;for(let O=0;O<E/2;++O){let U=w[O];w[O]=w[E-O-1],w[E-O-1]=U}}parseFoundFinderPattern(w,E,O){let U,H,Q;if(O){let Te=this.startEnd[0]-1;for(;Te>=0&&!w.get(Te);)Te--;Te++,U=this.startEnd[0]-Te,H=Te,Q=this.startEnd[1]}else H=this.startEnd[0],Q=w.getNextUnset(this.startEnd[1]+1),U=Q-this.startEnd[1];let le=this.getDecodeFinderCounters();v.arraycopy(le,0,le,1,le.length-1),le[0]=U;let ve;try{ve=this.parseFinderValue(le,p.FINDER_PATTERNS)}catch{return null}return new Kn(ve,[H,Q],H,Q,E)}decodeDataCharacter(w,E,O,U){let H=this.getDataCharacterCounters();for(let ha=0;ha<H.length;ha++)H[ha]=0;if(U)p.recordPatternInReverse(w,E.getStartEnd()[0],H);else{p.recordPattern(w,E.getStartEnd()[1],H);for(let ha=0,Ta=H.length-1;ha<Ta;ha++,Ta--){let Xo=H[ha];H[ha]=H[Ta],H[Ta]=Xo}}let Q=17,le=pt.sum(new Int32Array(H))/Q,ve=(E.getStartEnd()[1]-E.getStartEnd()[0])/15;if(Math.abs(le-ve)/ve>.3)throw new q;let Te=this.getOddCounts(),Ze=this.getEvenCounts(),xt=this.getOddRoundingErrors(),_t=this.getEvenRoundingErrors();for(let ha=0;ha<H.length;ha++){let Ta=1*H[ha]/le,Xo=Ta+.5;if(Xo<1){if(Ta<.3)throw new q;Xo=1}else if(Xo>8){if(Ta>8.7)throw new q;Xo=8}let _d=ha/2;ha&1?(Ze[_d]=Xo,_t[_d]=Ta-Xo):(Te[_d]=Xo,xt[_d]=Ta-Xo)}this.adjustOddEvenCounts(Q);let Qt=4*E.getValue()+(O?0:2)+(U?0:1)-1,St=0,$t=0;for(let ha=Te.length-1;ha>=0;ha--){if(p.isNotA1left(E,O,U)){let Ta=p.WEIGHTS[Qt][2*ha];$t+=Te[ha]*Ta}St+=Te[ha]}let Ht=0;for(let ha=Ze.length-1;ha>=0;ha--)if(p.isNotA1left(E,O,U)){let Ta=p.WEIGHTS[Qt][2*ha+1];Ht+=Ze[ha]*Ta}let jn=$t+Ht;if(St&1||St>13||St<4)throw new q;let xr=(13-St)/2,Nr=p.SYMBOL_WIDEST[xr],jr=9-Nr,Ns=Dn.getRSSvalue(Te,Nr,!0),Js=Dn.getRSSvalue(Ze,jr,!1),mc=p.EVEN_TOTAL_SUBSET[xr],no=p.GSUM[xr],ro=Ns*mc+Js+no;return new Vn(ro,jn)}static isNotA1left(w,E,O){return!(w.getValue()==0&&E&&O)}adjustOddEvenCounts(w){let E=pt.sum(new Int32Array(this.getOddCounts())),O=pt.sum(new Int32Array(this.getEvenCounts())),U=!1,H=!1;E>13?H=!0:E<4&&(U=!0);let Q=!1,le=!1;O>13?le=!0:O<4&&(Q=!0);let ve=E+O-w,Te=(E&1)==1,Ze=(O&1)==0;if(ve==1)if(Te){if(Ze)throw new q;H=!0}else{if(!Ze)throw new q;le=!0}else if(ve==-1)if(Te){if(Ze)throw new q;U=!0}else{if(!Ze)throw new q;Q=!0}else if(ve==0){if(Te){if(!Ze)throw new q;E<O?(U=!0,le=!0):(H=!0,Q=!0)}else if(Ze)throw new q}else throw new q;if(U){if(H)throw new q;p.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(H&&p.decrement(this.getOddCounts(),this.getOddRoundingErrors()),Q){if(le)throw new q;p.increment(this.getEvenCounts(),this.getOddRoundingErrors())}le&&p.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}p.SYMBOL_WIDEST=[7,5,4,3,1],p.EVEN_TOTAL_SUBSET=[4,20,52,104,204],p.GSUM=[0,348,1388,2948,3988],p.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],p.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],p.FINDER_PAT_A=0,p.FINDER_PAT_B=1,p.FINDER_PAT_C=2,p.FINDER_PAT_D=3,p.FINDER_PAT_E=4,p.FINDER_PAT_F=5,p.FINDER_PATTERN_SEQUENCES=[[p.FINDER_PAT_A,p.FINDER_PAT_A],[p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B],[p.FINDER_PAT_A,p.FINDER_PAT_C,p.FINDER_PAT_B,p.FINDER_PAT_D],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_C],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_D,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_E,p.FINDER_PAT_B,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_D],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_E],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F],[p.FINDER_PAT_A,p.FINDER_PAT_A,p.FINDER_PAT_B,p.FINDER_PAT_B,p.FINDER_PAT_C,p.FINDER_PAT_D,p.FINDER_PAT_D,p.FINDER_PAT_E,p.FINDER_PAT_E,p.FINDER_PAT_F,p.FINDER_PAT_F]],p.MAX_PAIRS=11;class S extends Vn{constructor(w,E,O){super(w,E),this.count=0,this.finderPattern=O}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class _ extends yn{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(w,E,O){const U=this.decodePair(E,!1,w,O);_.addOrTally(this.possibleLeftPairs,U),E.reverse();let H=this.decodePair(E,!0,w,O);_.addOrTally(this.possibleRightPairs,H),E.reverse();for(let Q of this.possibleLeftPairs)if(Q.getCount()>1){for(let le of this.possibleRightPairs)if(le.getCount()>1&&_.checkChecksum(Q,le))return _.constructResult(Q,le)}throw new q}static addOrTally(w,E){if(E==null)return;let O=!1;for(let U of w)if(U.getValue()===E.getValue()){U.incrementCount(),O=!0;break}O||w.push(E)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(w,E){let O=4537077*w.getValue()+E.getValue(),U=new String(O).toString(),H=new te;for(let Te=13-U.length;Te>0;Te--)H.append("0");H.append(U);let Q=0;for(let Te=0;Te<13;Te++){let Ze=H.charAt(Te).charCodeAt(0)-48;Q+=Te&1?Ze:3*Ze}Q=10-Q%10,Q===10&&(Q=0),H.append(Q.toString());let le=w.getFinderPattern().getResultPoints(),ve=E.getFinderPattern().getResultPoints();return new me(H.toString(),null,0,[le[0],le[1],ve[0],ve[1]],xe.RSS_14,new Date().getTime())}static checkChecksum(w,E){let O=(w.getChecksumPortion()+16*E.getChecksumPortion())%79,U=9*w.getFinderPattern().getValue()+E.getFinderPattern().getValue();return U>72&&U--,U>8&&U--,O===U}decodePair(w,E,O,U){try{let H=this.findFinderPattern(w,E),Q=this.parseFoundFinderPattern(w,O,E,H),le=U==null?null:U.get($.NEED_RESULT_POINT_CALLBACK);if(le!=null){let Ze=(H[0]+H[1])/2;E&&(Ze=w.getSize()-1-Ze),le.foundPossibleResultPoint(new wt(Ze,O))}let ve=this.decodeDataCharacter(w,Q,!0),Te=this.decodeDataCharacter(w,Q,!1);return new S(1597*ve.getValue()+Te.getValue(),ve.getChecksumPortion()+4*Te.getChecksumPortion(),Q)}catch{return null}}decodeDataCharacter(w,E,O){let U=this.getDataCharacterCounters();for(let Ht=0;Ht<U.length;Ht++)U[Ht]=0;if(O)Rt.recordPatternInReverse(w,E.getStartEnd()[0],U);else{Rt.recordPattern(w,E.getStartEnd()[1]+1,U);for(let Ht=0,jn=U.length-1;Ht<jn;Ht++,jn--){let xr=U[Ht];U[Ht]=U[jn],U[jn]=xr}}let H=O?16:15,Q=pt.sum(new Int32Array(U))/H,le=this.getOddCounts(),ve=this.getEvenCounts(),Te=this.getOddRoundingErrors(),Ze=this.getEvenRoundingErrors();for(let Ht=0;Ht<U.length;Ht++){let jn=U[Ht]/Q,xr=Math.floor(jn+.5);xr<1?xr=1:xr>8&&(xr=8);let Nr=Math.floor(Ht/2);Ht&1?(ve[Nr]=xr,Ze[Nr]=jn-xr):(le[Nr]=xr,Te[Nr]=jn-xr)}this.adjustOddEvenCounts(O,H);let xt=0,_t=0;for(let Ht=le.length-1;Ht>=0;Ht--)_t*=9,_t+=le[Ht],xt+=le[Ht];let Qt=0,St=0;for(let Ht=ve.length-1;Ht>=0;Ht--)Qt*=9,Qt+=ve[Ht],St+=ve[Ht];let $t=_t+3*Qt;if(O){if(xt&1||xt>12||xt<4)throw new q;let Ht=(12-xt)/2,jn=_.OUTSIDE_ODD_WIDEST[Ht],xr=9-jn,Nr=Dn.getRSSvalue(le,jn,!1),jr=Dn.getRSSvalue(ve,xr,!0),Ns=_.OUTSIDE_EVEN_TOTAL_SUBSET[Ht],Js=_.OUTSIDE_GSUM[Ht];return new Vn(Nr*Ns+jr+Js,$t)}else{if(St&1||St>10||St<4)throw new q;let Ht=(10-St)/2,jn=_.INSIDE_ODD_WIDEST[Ht],xr=9-jn,Nr=Dn.getRSSvalue(le,jn,!0),jr=Dn.getRSSvalue(ve,xr,!1),Ns=_.INSIDE_ODD_TOTAL_SUBSET[Ht],Js=_.INSIDE_GSUM[Ht];return new Vn(jr*Ns+Nr+Js,$t)}}findFinderPattern(w,E){let O=this.getDecodeFinderCounters();O[0]=0,O[1]=0,O[2]=0,O[3]=0;let U=w.getSize(),H=!1,Q=0;for(;Q<U&&(H=!w.get(Q),E!==H);)Q++;let le=0,ve=Q;for(let Te=Q;Te<U;Te++)if(w.get(Te)!==H)O[le]++;else{if(le===3){if(yn.isFinderPattern(O))return[ve,Te];ve+=O[0]+O[1],O[0]=O[2],O[1]=O[3],O[2]=0,O[3]=0,le--}else le++;O[le]=1,H=!H}throw new q}parseFoundFinderPattern(w,E,O,U){let H=w.get(U[0]),Q=U[0]-1;for(;Q>=0&&H!==w.get(Q);)Q--;Q++;const le=U[0]-Q,ve=this.getDecodeFinderCounters(),Te=new Int32Array(ve.length);v.arraycopy(ve,0,Te,1,ve.length-1),Te[0]=le;const Ze=this.parseFinderValue(Te,_.FINDER_PATTERNS);let xt=Q,_t=U[1];return O&&(xt=w.getSize()-1-xt,_t=w.getSize()-1-_t),new Kn(Ze,[Q,U[1]],xt,_t,E)}adjustOddEvenCounts(w,E){let O=pt.sum(new Int32Array(this.getOddCounts())),U=pt.sum(new Int32Array(this.getEvenCounts())),H=!1,Q=!1,le=!1,ve=!1;w?(O>12?Q=!0:O<4&&(H=!0),U>12?ve=!0:U<4&&(le=!0)):(O>11?Q=!0:O<5&&(H=!0),U>10?ve=!0:U<4&&(le=!0));let Te=O+U-E,Ze=(O&1)===(w?1:0),xt=(U&1)===1;if(Te===1)if(Ze){if(xt)throw new q;Q=!0}else{if(!xt)throw new q;ve=!0}else if(Te===-1)if(Ze){if(xt)throw new q;H=!0}else{if(!xt)throw new q;le=!0}else if(Te===0){if(Ze){if(!xt)throw new q;O<U?(H=!0,ve=!0):(Q=!0,le=!0)}else if(xt)throw new q}else throw new q;if(H){if(Q)throw new q;yn.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(Q&&yn.decrement(this.getOddCounts(),this.getOddRoundingErrors()),le){if(ve)throw new q;yn.increment(this.getEvenCounts(),this.getOddRoundingErrors())}ve&&yn.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}_.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],_.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],_.OUTSIDE_GSUM=[0,161,961,2015,2715],_.INSIDE_GSUM=[0,336,1036,1516],_.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],_.INSIDE_ODD_WIDEST=[2,4,6,8],_.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class k extends Rt{constructor(w,E){super(),this.readers=[],this.verbose=E===!0;const O=w?w.get($.POSSIBLE_FORMATS):null,U=w&&w.get($.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;O?((O.includes(xe.EAN_13)||O.includes(xe.UPC_A)||O.includes(xe.EAN_8)||O.includes(xe.UPC_E))&&this.readers.push(new kn(w)),O.includes(xe.CODE_39)&&this.readers.push(new De(U)),O.includes(xe.CODE_128)&&this.readers.push(new ot),O.includes(xe.ITF)&&this.readers.push(new At),O.includes(xe.RSS_14)&&this.readers.push(new _),O.includes(xe.RSS_EXPANDED)&&this.readers.push(new p(this.verbose))):(this.readers.push(new kn(w)),this.readers.push(new De),this.readers.push(new kn(w)),this.readers.push(new ot),this.readers.push(new At),this.readers.push(new _),this.readers.push(new p(this.verbose)))}decodeRow(w,E,O){for(let U=0;U<this.readers.length;U++)try{return this.readers[U].decodeRow(w,E,O)}catch{}throw new q}reset(){this.readers.forEach(w=>w.reset())}}class I extends Ce{constructor(w=500,E){super(new k(E),w,E)}}class B{constructor(w,E,O){this.ecCodewords=w,this.ecBlocks=[E],O&&this.ecBlocks.push(O)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class G{constructor(w,E){this.count=w,this.dataCodewords=E}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class re{constructor(w,E,O,U,H,Q){this.versionNumber=w,this.symbolSizeRows=E,this.symbolSizeColumns=O,this.dataRegionSizeRows=U,this.dataRegionSizeColumns=H,this.ecBlocks=Q;let le=0;const ve=Q.getECCodewords(),Te=Q.getECBlocks();for(let Ze of Te)le+=Ze.getCount()*(Ze.getDataCodewords()+ve);this.totalCodewords=le}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(w,E){if(w&1||E&1)throw new L;for(let O of re.VERSIONS)if(O.symbolSizeRows===w&&O.symbolSizeColumns===E)return O;throw new L}toString(){return""+this.versionNumber}static buildVersions(){return[new re(1,10,10,8,8,new B(5,new G(1,3))),new re(2,12,12,10,10,new B(7,new G(1,5))),new re(3,14,14,12,12,new B(10,new G(1,8))),new re(4,16,16,14,14,new B(12,new G(1,12))),new re(5,18,18,16,16,new B(14,new G(1,18))),new re(6,20,20,18,18,new B(18,new G(1,22))),new re(7,22,22,20,20,new B(20,new G(1,30))),new re(8,24,24,22,22,new B(24,new G(1,36))),new re(9,26,26,24,24,new B(28,new G(1,44))),new re(10,32,32,14,14,new B(36,new G(1,62))),new re(11,36,36,16,16,new B(42,new G(1,86))),new re(12,40,40,18,18,new B(48,new G(1,114))),new re(13,44,44,20,20,new B(56,new G(1,144))),new re(14,48,48,22,22,new B(68,new G(1,174))),new re(15,52,52,24,24,new B(42,new G(2,102))),new re(16,64,64,14,14,new B(56,new G(2,140))),new re(17,72,72,16,16,new B(36,new G(4,92))),new re(18,80,80,18,18,new B(48,new G(4,114))),new re(19,88,88,20,20,new B(56,new G(4,144))),new re(20,96,96,22,22,new B(68,new G(4,174))),new re(21,104,104,24,24,new B(56,new G(6,136))),new re(22,120,120,18,18,new B(68,new G(6,175))),new re(23,132,132,20,20,new B(62,new G(8,163))),new re(24,144,144,22,22,new B(62,new G(8,156),new G(2,155))),new re(25,8,18,6,16,new B(7,new G(1,5))),new re(26,8,32,6,14,new B(11,new G(1,10))),new re(27,12,26,10,24,new B(14,new G(1,16))),new re(28,12,36,10,16,new B(18,new G(1,22))),new re(29,16,36,14,16,new B(24,new G(1,32))),new re(30,16,48,14,22,new B(28,new G(1,49)))]}}re.VERSIONS=re.buildVersions();class ce{constructor(w){const E=w.getHeight();if(E<8||E>144||E&1)throw new L;this.version=ce.readVersion(w),this.mappingBitMatrix=this.extractDataRegion(w),this.readMappingMatrix=new fe(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(w){const E=w.getHeight(),O=w.getWidth();return re.getVersionForDimensions(E,O)}readCodewords(){const w=new Int8Array(this.version.getTotalCodewords());let E=0,O=4,U=0;const H=this.mappingBitMatrix.getHeight(),Q=this.mappingBitMatrix.getWidth();let le=!1,ve=!1,Te=!1,Ze=!1;do if(O===H&&U===0&&!le)w[E++]=this.readCorner1(H,Q)&255,O-=2,U+=2,le=!0;else if(O===H-2&&U===0&&Q&3&&!ve)w[E++]=this.readCorner2(H,Q)&255,O-=2,U+=2,ve=!0;else if(O===H+4&&U===2&&!(Q&7)&&!Te)w[E++]=this.readCorner3(H,Q)&255,O-=2,U+=2,Te=!0;else if(O===H-2&&U===0&&(Q&7)===4&&!Ze)w[E++]=this.readCorner4(H,Q)&255,O-=2,U+=2,Ze=!0;else{do O<H&&U>=0&&!this.readMappingMatrix.get(U,O)&&(w[E++]=this.readUtah(O,U,H,Q)&255),O-=2,U+=2;while(O>=0&&U<Q);O+=1,U+=3;do O>=0&&U<Q&&!this.readMappingMatrix.get(U,O)&&(w[E++]=this.readUtah(O,U,H,Q)&255),O+=2,U-=2;while(O<H&&U>=0);O+=3,U+=1}while(O<H||U<Q);if(E!==this.version.getTotalCodewords())throw new L;return w}readModule(w,E,O,U){return w<0&&(w+=O,E+=4-(O+4&7)),E<0&&(E+=U,w+=4-(U+4&7)),this.readMappingMatrix.set(E,w),this.mappingBitMatrix.get(E,w)}readUtah(w,E,O,U){let H=0;return this.readModule(w-2,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w-2,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w-1,E,O,U)&&(H|=1),H<<=1,this.readModule(w,E-2,O,U)&&(H|=1),H<<=1,this.readModule(w,E-1,O,U)&&(H|=1),H<<=1,this.readModule(w,E,O,U)&&(H|=1),H}readCorner1(w,E){let O=0;return this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,1,w,E)&&(O|=1),O<<=1,this.readModule(w-1,2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(2,E-1,w,E)&&(O|=1),O<<=1,this.readModule(3,E-1,w,E)&&(O|=1),O}readCorner2(w,E){let O=0;return this.readModule(w-3,0,w,E)&&(O|=1),O<<=1,this.readModule(w-2,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(0,E-4,w,E)&&(O|=1),O<<=1,this.readModule(0,E-3,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O}readCorner3(w,E){let O=0;return this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(0,E-3,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-3,w,E)&&(O|=1),O<<=1,this.readModule(1,E-2,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O}readCorner4(w,E){let O=0;return this.readModule(w-3,0,w,E)&&(O|=1),O<<=1,this.readModule(w-2,0,w,E)&&(O|=1),O<<=1,this.readModule(w-1,0,w,E)&&(O|=1),O<<=1,this.readModule(0,E-2,w,E)&&(O|=1),O<<=1,this.readModule(0,E-1,w,E)&&(O|=1),O<<=1,this.readModule(1,E-1,w,E)&&(O|=1),O<<=1,this.readModule(2,E-1,w,E)&&(O|=1),O<<=1,this.readModule(3,E-1,w,E)&&(O|=1),O}extractDataRegion(w){const E=this.version.getSymbolSizeRows(),O=this.version.getSymbolSizeColumns();if(w.getHeight()!==E)throw new f("Dimension of bitMatrix must match the version size");const U=this.version.getDataRegionSizeRows(),H=this.version.getDataRegionSizeColumns(),Q=E/U|0,le=O/H|0,ve=Q*U,Te=le*H,Ze=new fe(Te,ve);for(let xt=0;xt<Q;++xt){const _t=xt*U;for(let Qt=0;Qt<le;++Qt){const St=Qt*H;for(let $t=0;$t<U;++$t){const Ht=xt*(U+2)+1+$t,jn=_t+$t;for(let xr=0;xr<H;++xr){const Nr=Qt*(H+2)+1+xr;if(w.get(Nr,Ht)){const jr=St+xr;Ze.set(jr,jn)}}}}}return Ze}}class ue{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E){const O=E.getECBlocks();let U=0;const H=O.getECBlocks();for(let $t of H)U+=$t.getCount();const Q=new Array(U);let le=0;for(let $t of H)for(let Ht=0;Ht<$t.getCount();Ht++){const jn=$t.getDataCodewords(),xr=O.getECCodewords()+jn;Q[le++]=new ue(jn,new Uint8Array(xr))}const Te=Q[0].codewords.length-O.getECCodewords(),Ze=Te-1;let xt=0;for(let $t=0;$t<Ze;$t++)for(let Ht=0;Ht<le;Ht++)Q[Ht].codewords[$t]=w[xt++];const _t=E.getVersionNumber()===24,Qt=_t?8:le;for(let $t=0;$t<Qt;$t++)Q[$t].codewords[Te-1]=w[xt++];const St=Q[0].codewords.length;for(let $t=Te;$t<St;$t++)for(let Ht=0;Ht<le;Ht++){const jn=_t?(Ht+8)%le:Ht,xr=_t&&jn>7?$t-1:$t;Q[jn].codewords[xr]=w[xt++]}if(xt!==w.length)throw new f;return Q}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class ge{constructor(w){this.bytes=w,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(w){if(w<1||w>32||w>this.available())throw new f(""+w);let E=0,O=this.bitOffset,U=this.byteOffset;const H=this.bytes;if(O>0){const Q=8-O,le=w<Q?w:Q,ve=Q-le,Te=255>>8-le<<ve;E=(H[U]&Te)>>ve,w-=le,O+=le,O===8&&(O=0,U++)}if(w>0){for(;w>=8;)E=E<<8|H[U]&255,U++,w-=8;if(w>0){const Q=8-w,le=255>>Q<<Q;E=E<<w|(H[U]&le)>>Q,O+=w}}return this.bitOffset=O,this.byteOffset=U,E}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Ae;(function(ft){ft[ft.PAD_ENCODE=0]="PAD_ENCODE",ft[ft.ASCII_ENCODE=1]="ASCII_ENCODE",ft[ft.C40_ENCODE=2]="C40_ENCODE",ft[ft.TEXT_ENCODE=3]="TEXT_ENCODE",ft[ft.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",ft[ft.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",ft[ft.BASE256_ENCODE=6]="BASE256_ENCODE"})(Ae||(Ae={}));class ke{static decode(w){const E=new ge(w),O=new te,U=new te,H=new Array;let Q=Ae.ASCII_ENCODE;do if(Q===Ae.ASCII_ENCODE)Q=this.decodeAsciiSegment(E,O,U);else{switch(Q){case Ae.C40_ENCODE:this.decodeC40Segment(E,O);break;case Ae.TEXT_ENCODE:this.decodeTextSegment(E,O);break;case Ae.ANSIX12_ENCODE:this.decodeAnsiX12Segment(E,O);break;case Ae.EDIFACT_ENCODE:this.decodeEdifactSegment(E,O);break;case Ae.BASE256_ENCODE:this.decodeBase256Segment(E,O,H);break;default:throw new L}Q=Ae.ASCII_ENCODE}while(Q!==Ae.PAD_ENCODE&&E.available()>0);return U.length()>0&&O.append(U.toString()),new Ie(w,O.toString(),H.length===0?null:H,null)}static decodeAsciiSegment(w,E,O){let U=!1;do{let H=w.readBits(8);if(H===0)throw new L;if(H<=128)return U&&(H+=128),E.append(String.fromCharCode(H-1)),Ae.ASCII_ENCODE;if(H===129)return Ae.PAD_ENCODE;if(H<=229){const Q=H-130;Q<10&&E.append("0"),E.append(""+Q)}else switch(H){case 230:return Ae.C40_ENCODE;case 231:return Ae.BASE256_ENCODE;case 232:E.append("");break;case 233:case 234:break;case 235:U=!0;break;case 236:E.append("[)>05"),O.insert(0,"");break;case 237:E.append("[)>06"),O.insert(0,"");break;case 238:return Ae.ANSIX12_ENCODE;case 239:return Ae.TEXT_ENCODE;case 240:return Ae.EDIFACT_ENCODE;case 241:break;default:if(H!==254||w.available()!==0)throw new L;break}}while(w.available()>0);return Ae.ASCII_ENCODE}static decodeC40Segment(w,E){let O=!1;const U=[];let H=0;do{if(w.available()===8)return;const Q=w.readBits(8);if(Q===254)return;this.parseTwoBytes(Q,w.readBits(8),U);for(let le=0;le<3;le++){const ve=U[le];switch(H){case 0:if(ve<3)H=ve+1;else if(ve<this.C40_BASIC_SET_CHARS.length){const Te=this.C40_BASIC_SET_CHARS[ve];O?(E.append(String.fromCharCode(Te.charCodeAt(0)+128)),O=!1):E.append(Te)}else throw new L;break;case 1:O?(E.append(String.fromCharCode(ve+128)),O=!1):E.append(String.fromCharCode(ve)),H=0;break;case 2:if(ve<this.C40_SHIFT2_SET_CHARS.length){const Te=this.C40_SHIFT2_SET_CHARS[ve];O?(E.append(String.fromCharCode(Te.charCodeAt(0)+128)),O=!1):E.append(Te)}else switch(ve){case 27:E.append("");break;case 30:O=!0;break;default:throw new L}H=0;break;case 3:O?(E.append(String.fromCharCode(ve+224)),O=!1):E.append(String.fromCharCode(ve+96)),H=0;break;default:throw new L}}}while(w.available()>0)}static decodeTextSegment(w,E){let O=!1,U=[],H=0;do{if(w.available()===8)return;const Q=w.readBits(8);if(Q===254)return;this.parseTwoBytes(Q,w.readBits(8),U);for(let le=0;le<3;le++){const ve=U[le];switch(H){case 0:if(ve<3)H=ve+1;else if(ve<this.TEXT_BASIC_SET_CHARS.length){const Te=this.TEXT_BASIC_SET_CHARS[ve];O?(E.append(String.fromCharCode(Te.charCodeAt(0)+128)),O=!1):E.append(Te)}else throw new L;break;case 1:O?(E.append(String.fromCharCode(ve+128)),O=!1):E.append(String.fromCharCode(ve)),H=0;break;case 2:if(ve<this.TEXT_SHIFT2_SET_CHARS.length){const Te=this.TEXT_SHIFT2_SET_CHARS[ve];O?(E.append(String.fromCharCode(Te.charCodeAt(0)+128)),O=!1):E.append(Te)}else switch(ve){case 27:E.append("");break;case 30:O=!0;break;default:throw new L}H=0;break;case 3:if(ve<this.TEXT_SHIFT3_SET_CHARS.length){const Te=this.TEXT_SHIFT3_SET_CHARS[ve];O?(E.append(String.fromCharCode(Te.charCodeAt(0)+128)),O=!1):E.append(Te),H=0}else throw new L;break;default:throw new L}}}while(w.available()>0)}static decodeAnsiX12Segment(w,E){const O=[];do{if(w.available()===8)return;const U=w.readBits(8);if(U===254)return;this.parseTwoBytes(U,w.readBits(8),O);for(let H=0;H<3;H++){const Q=O[H];switch(Q){case 0:E.append("\r");break;case 1:E.append("*");break;case 2:E.append(">");break;case 3:E.append(" ");break;default:if(Q<14)E.append(String.fromCharCode(Q+44));else if(Q<40)E.append(String.fromCharCode(Q+51));else throw new L;break}}}while(w.available()>0)}static parseTwoBytes(w,E,O){let U=(w<<8)+E-1,H=Math.floor(U/1600);O[0]=H,U-=H*1600,H=Math.floor(U/40),O[1]=H,O[2]=U-H*40}static decodeEdifactSegment(w,E){do{if(w.available()<=16)return;for(let O=0;O<4;O++){let U=w.readBits(6);if(U===31){const H=8-w.getBitOffset();H!==8&&w.readBits(H);return}U&32||(U|=64),E.append(String.fromCharCode(U))}}while(w.available()>0)}static decodeBase256Segment(w,E,O){let U=1+w.getByteOffset();const H=this.unrandomize255State(w.readBits(8),U++);let Q;if(H===0?Q=w.available()/8|0:H<250?Q=H:Q=250*(H-249)+this.unrandomize255State(w.readBits(8),U++),Q<0)throw new L;const le=new Uint8Array(Q);for(let ve=0;ve<Q;ve++){if(w.available()<8)throw new L;le[ve]=this.unrandomize255State(w.readBits(8),U++)}O.push(le);try{E.append(J.decode(le,K.ISO88591))}catch(ve){throw new nt("Platform does not support required encoding: "+ve.message)}}static unrandomize255State(w,E){const O=149*E%255+1,U=w-O;return U>=0?U:U+256}}ke.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ke.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],ke.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],ke.TEXT_SHIFT2_SET_CHARS=ke.C40_SHIFT2_SET_CHARS,ke.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class Me{constructor(){this.rsDecoder=new Le(dt.DATA_MATRIX_FIELD_256)}decode(w){const E=new ce(w),O=E.getVersion(),U=E.readCodewords(),H=ue.getDataBlocks(U,O);let Q=0;for(let Te of H)Q+=Te.getNumDataCodewords();const le=new Uint8Array(Q),ve=H.length;for(let Te=0;Te<ve;Te++){const Ze=H[Te],xt=Ze.getCodewords(),_t=Ze.getNumDataCodewords();this.correctErrors(xt,_t);for(let Qt=0;Qt<_t;Qt++)le[Qt*ve+Te]=xt[Qt]}return ke.decode(le)}correctErrors(w,E){const O=new Int32Array(w);try{this.rsDecoder.decode(O,w.length-E)}catch{throw new g}for(let U=0;U<E;U++)w[U]=O[U]}}class qe{constructor(w){this.image=w,this.rectangleDetector=new Un(this.image)}detect(){const w=this.rectangleDetector.detect();let E=this.detectSolid1(w);if(E=this.detectSolid2(E),E[3]=this.correctTopRight(E),!E[3])throw new q;E=this.shiftToModuleCenter(E);const O=E[0],U=E[1],H=E[2],Q=E[3];let le=this.transitionsBetween(O,Q)+1,ve=this.transitionsBetween(H,Q)+1;(le&1)===1&&(le+=1),(ve&1)===1&&(ve+=1),4*le<7*ve&&4*ve<7*le&&(le=ve=Math.max(le,ve));let Te=qe.sampleGrid(this.image,O,U,H,Q,le,ve);return new nn(Te,[O,U,H,Q])}static shiftPoint(w,E,O){let U=(E.getX()-w.getX())/(O+1),H=(E.getY()-w.getY())/(O+1);return new wt(w.getX()+U,w.getY()+H)}static moveAway(w,E,O){let U=w.getX(),H=w.getY();return U<E?U-=1:U+=1,H<O?H-=1:H+=1,new wt(U,H)}detectSolid1(w){let E=w[0],O=w[1],U=w[3],H=w[2],Q=this.transitionsBetween(E,O),le=this.transitionsBetween(O,U),ve=this.transitionsBetween(U,H),Te=this.transitionsBetween(H,E),Ze=Q,xt=[H,E,O,U];return Ze>le&&(Ze=le,xt[0]=E,xt[1]=O,xt[2]=U,xt[3]=H),Ze>ve&&(Ze=ve,xt[0]=O,xt[1]=U,xt[2]=H,xt[3]=E),Ze>Te&&(xt[0]=U,xt[1]=H,xt[2]=E,xt[3]=O),xt}detectSolid2(w){let E=w[0],O=w[1],U=w[2],H=w[3],Q=this.transitionsBetween(E,H),le=qe.shiftPoint(O,U,(Q+1)*4),ve=qe.shiftPoint(U,O,(Q+1)*4),Te=this.transitionsBetween(le,E),Ze=this.transitionsBetween(ve,H);return Te<Ze?(w[0]=E,w[1]=O,w[2]=U,w[3]=H):(w[0]=O,w[1]=U,w[2]=H,w[3]=E),w}correctTopRight(w){let E=w[0],O=w[1],U=w[2],H=w[3],Q=this.transitionsBetween(E,H),le=this.transitionsBetween(O,H),ve=qe.shiftPoint(E,O,(le+1)*4),Te=qe.shiftPoint(U,O,(Q+1)*4);Q=this.transitionsBetween(ve,H),le=this.transitionsBetween(Te,H);let Ze=new wt(H.getX()+(U.getX()-O.getX())/(Q+1),H.getY()+(U.getY()-O.getY())/(Q+1)),xt=new wt(H.getX()+(E.getX()-O.getX())/(le+1),H.getY()+(E.getY()-O.getY())/(le+1));if(!this.isValid(Ze))return this.isValid(xt)?xt:null;if(!this.isValid(xt))return Ze;let _t=this.transitionsBetween(ve,Ze)+this.transitionsBetween(Te,Ze),Qt=this.transitionsBetween(ve,xt)+this.transitionsBetween(Te,xt);return _t>Qt?Ze:xt}shiftToModuleCenter(w){let E=w[0],O=w[1],U=w[2],H=w[3],Q=this.transitionsBetween(E,H)+1,le=this.transitionsBetween(U,H)+1,ve=qe.shiftPoint(E,O,le*4),Te=qe.shiftPoint(U,O,Q*4);Q=this.transitionsBetween(ve,H)+1,le=this.transitionsBetween(Te,H)+1,(Q&1)===1&&(Q+=1),(le&1)===1&&(le+=1);let Ze=(E.getX()+O.getX()+U.getX()+H.getX())/4,xt=(E.getY()+O.getY()+U.getY()+H.getY())/4;E=qe.moveAway(E,Ze,xt),O=qe.moveAway(O,Ze,xt),U=qe.moveAway(U,Ze,xt),H=qe.moveAway(H,Ze,xt);let _t,Qt;return ve=qe.shiftPoint(E,O,le*4),ve=qe.shiftPoint(ve,H,Q*4),_t=qe.shiftPoint(O,E,le*4),_t=qe.shiftPoint(_t,U,Q*4),Te=qe.shiftPoint(U,H,le*4),Te=qe.shiftPoint(Te,O,Q*4),Qt=qe.shiftPoint(H,U,le*4),Qt=qe.shiftPoint(Qt,E,Q*4),[ve,_t,Te,Qt]}isValid(w){return w.getX()>=0&&w.getX()<this.image.getWidth()&&w.getY()>0&&w.getY()<this.image.getHeight()}static sampleGrid(w,E,O,U,H,Q,le){return Ye.getInstance().sampleGrid(w,Q,le,.5,.5,Q-.5,.5,Q-.5,le-.5,.5,le-.5,E.getX(),E.getY(),H.getX(),H.getY(),U.getX(),U.getY(),O.getX(),O.getY())}transitionsBetween(w,E){let O=Math.trunc(w.getX()),U=Math.trunc(w.getY()),H=Math.trunc(E.getX()),Q=Math.trunc(E.getY()),le=Math.abs(Q-U)>Math.abs(H-O);if(le){let $t=O;O=U,U=$t,$t=H,H=Q,Q=$t}let ve=Math.abs(H-O),Te=Math.abs(Q-U),Ze=-ve/2,xt=U<Q?1:-1,_t=O<H?1:-1,Qt=0,St=this.image.get(le?U:O,le?O:U);for(let $t=O,Ht=U;$t!==H;$t+=_t){let jn=this.image.get(le?Ht:$t,le?$t:Ht);if(jn!==St&&(Qt++,St=jn),Ze+=Te,Ze>0){if(Ht===Q)break;Ht+=xt,Ze-=ve}}return Qt}}class Fe{constructor(){this.decoder=new Me}decode(w,E=null){let O,U;if(E!=null&&E.has($.PURE_BARCODE)){const Te=Fe.extractPureBits(w.getBlackMatrix());O=this.decoder.decode(Te),U=Fe.NO_POINTS}else{const Te=new qe(w.getBlackMatrix()).detect();O=this.decoder.decode(Te.getBits()),U=Te.getPoints()}const H=O.getRawBytes(),Q=new me(O.getText(),H,8*H.length,U,xe.DATA_MATRIX,v.currentTimeMillis()),le=O.getByteSegments();le!=null&&Q.putMetadata(je.BYTE_SEGMENTS,le);const ve=O.getECLevel();return ve!=null&&Q.putMetadata(je.ERROR_CORRECTION_LEVEL,ve),Q}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),O=w.getBottomRightOnBit();if(E==null||O==null)throw new q;const U=this.moduleSize(E,w);let H=E[1];const Q=O[1];let le=E[0];const Te=(O[0]-le+1)/U,Ze=(Q-H+1)/U;if(Te<=0||Ze<=0)throw new q;const xt=U/2;H+=xt,le+=xt;const _t=new fe(Te,Ze);for(let Qt=0;Qt<Ze;Qt++){const St=H+Qt*U;for(let $t=0;$t<Te;$t++)w.get(le+$t*U,St)&&_t.set($t,Qt)}return _t}static moduleSize(w,E){const O=E.getWidth();let U=w[0];const H=w[1];for(;U<O&&E.get(U,H);)U++;if(U===O)throw new q;const Q=U-w[0];if(Q===0)throw new q;return Q}}Fe.NO_POINTS=[];class at extends Ce{constructor(w=500){super(new Fe,w)}}var ie;(function(ft){ft[ft.L=0]="L",ft[ft.M=1]="M",ft[ft.Q=2]="Q",ft[ft.H=3]="H"})(ie||(ie={}));class Se{constructor(w,E,O){this.value=w,this.stringValue=E,this.bits=O,Se.FOR_BITS.set(O,this),Se.FOR_VALUE.set(w,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(w){switch(w){case"L":return Se.L;case"M":return Se.M;case"Q":return Se.Q;case"H":return Se.H;default:throw new d(w+"not available")}}toString(){return this.stringValue}equals(w){if(!(w instanceof Se))return!1;const E=w;return this.value===E.value}static forBits(w){if(w<0||w>=Se.FOR_BITS.size)throw new f;return Se.FOR_BITS.get(w)}}Se.FOR_BITS=new Map,Se.FOR_VALUE=new Map,Se.L=new Se(ie.L,"L",1),Se.M=new Se(ie.M,"M",0),Se.Q=new Se(ie.Q,"Q",3),Se.H=new Se(ie.H,"H",2);class $e{constructor(w){this.errorCorrectionLevel=Se.forBits(w>>3&3),this.dataMask=w&7}static numBitsDiffering(w,E){return T.bitCount(w^E)}static decodeFormatInformation(w,E){const O=$e.doDecodeFormatInformation(w,E);return O!==null?O:$e.doDecodeFormatInformation(w^$e.FORMAT_INFO_MASK_QR,E^$e.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(w,E){let O=Number.MAX_SAFE_INTEGER,U=0;for(const H of $e.FORMAT_INFO_DECODE_LOOKUP){const Q=H[0];if(Q===w||Q===E)return new $e(H[1]);let le=$e.numBitsDiffering(w,Q);le<O&&(U=H[1],O=le),w!==E&&(le=$e.numBitsDiffering(E,Q),le<O&&(U=H[1],O=le))}return O<=3?new $e(U):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(w){if(!(w instanceof $e))return!1;const E=w;return this.errorCorrectionLevel===E.errorCorrectionLevel&&this.dataMask===E.dataMask}}$e.FORMAT_INFO_MASK_QR=21522,$e.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class Ue{constructor(w,...E){this.ecCodewordsPerBlock=w,this.ecBlocks=E}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let w=0;const E=this.ecBlocks;for(const O of E)w+=O.getCount();return w}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class _e{constructor(w,E){this.count=w,this.dataCodewords=E}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class st{constructor(w,E,...O){this.versionNumber=w,this.alignmentPatternCenters=E,this.ecBlocks=O;let U=0;const H=O[0].getECCodewordsPerBlock(),Q=O[0].getECBlocks();for(const le of Q)U+=le.getCount()*(le.getDataCodewords()+H);this.totalCodewords=U}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(w){return this.ecBlocks[w.getValue()]}static getProvisionalVersionForDimension(w){if(w%4!==1)throw new L;try{return this.getVersionForNumber((w-17)/4)}catch{throw new L}}static getVersionForNumber(w){if(w<1||w>40)throw new f;return st.VERSIONS[w-1]}static decodeVersionInformation(w){let E=Number.MAX_SAFE_INTEGER,O=0;for(let U=0;U<st.VERSION_DECODE_INFO.length;U++){const H=st.VERSION_DECODE_INFO[U];if(H===w)return st.getVersionForNumber(U+7);const Q=$e.numBitsDiffering(w,H);Q<E&&(O=U+7,E=Q)}return E<=3?st.getVersionForNumber(O):null}buildFunctionPattern(){const w=this.getDimensionForVersion(),E=new fe(w);E.setRegion(0,0,9,9),E.setRegion(w-8,0,8,9),E.setRegion(0,w-8,9,8);const O=this.alignmentPatternCenters.length;for(let U=0;U<O;U++){const H=this.alignmentPatternCenters[U]-2;for(let Q=0;Q<O;Q++)U===0&&(Q===0||Q===O-1)||U===O-1&&Q===0||E.setRegion(this.alignmentPatternCenters[Q]-2,H,5,5)}return E.setRegion(6,9,1,w-17),E.setRegion(9,6,w-17,1),this.versionNumber>6&&(E.setRegion(w-11,0,3,6),E.setRegion(0,w-11,6,3)),E}toString(){return""+this.versionNumber}}st.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),st.VERSIONS=[new st(1,new Int32Array(0),new Ue(7,new _e(1,19)),new Ue(10,new _e(1,16)),new Ue(13,new _e(1,13)),new Ue(17,new _e(1,9))),new st(2,Int32Array.from([6,18]),new Ue(10,new _e(1,34)),new Ue(16,new _e(1,28)),new Ue(22,new _e(1,22)),new Ue(28,new _e(1,16))),new st(3,Int32Array.from([6,22]),new Ue(15,new _e(1,55)),new Ue(26,new _e(1,44)),new Ue(18,new _e(2,17)),new Ue(22,new _e(2,13))),new st(4,Int32Array.from([6,26]),new Ue(20,new _e(1,80)),new Ue(18,new _e(2,32)),new Ue(26,new _e(2,24)),new Ue(16,new _e(4,9))),new st(5,Int32Array.from([6,30]),new Ue(26,new _e(1,108)),new Ue(24,new _e(2,43)),new Ue(18,new _e(2,15),new _e(2,16)),new Ue(22,new _e(2,11),new _e(2,12))),new st(6,Int32Array.from([6,34]),new Ue(18,new _e(2,68)),new Ue(16,new _e(4,27)),new Ue(24,new _e(4,19)),new Ue(28,new _e(4,15))),new st(7,Int32Array.from([6,22,38]),new Ue(20,new _e(2,78)),new Ue(18,new _e(4,31)),new Ue(18,new _e(2,14),new _e(4,15)),new Ue(26,new _e(4,13),new _e(1,14))),new st(8,Int32Array.from([6,24,42]),new Ue(24,new _e(2,97)),new Ue(22,new _e(2,38),new _e(2,39)),new Ue(22,new _e(4,18),new _e(2,19)),new Ue(26,new _e(4,14),new _e(2,15))),new st(9,Int32Array.from([6,26,46]),new Ue(30,new _e(2,116)),new Ue(22,new _e(3,36),new _e(2,37)),new Ue(20,new _e(4,16),new _e(4,17)),new Ue(24,new _e(4,12),new _e(4,13))),new st(10,Int32Array.from([6,28,50]),new Ue(18,new _e(2,68),new _e(2,69)),new Ue(26,new _e(4,43),new _e(1,44)),new Ue(24,new _e(6,19),new _e(2,20)),new Ue(28,new _e(6,15),new _e(2,16))),new st(11,Int32Array.from([6,30,54]),new Ue(20,new _e(4,81)),new Ue(30,new _e(1,50),new _e(4,51)),new Ue(28,new _e(4,22),new _e(4,23)),new Ue(24,new _e(3,12),new _e(8,13))),new st(12,Int32Array.from([6,32,58]),new Ue(24,new _e(2,92),new _e(2,93)),new Ue(22,new _e(6,36),new _e(2,37)),new Ue(26,new _e(4,20),new _e(6,21)),new Ue(28,new _e(7,14),new _e(4,15))),new st(13,Int32Array.from([6,34,62]),new Ue(26,new _e(4,107)),new Ue(22,new _e(8,37),new _e(1,38)),new Ue(24,new _e(8,20),new _e(4,21)),new Ue(22,new _e(12,11),new _e(4,12))),new st(14,Int32Array.from([6,26,46,66]),new Ue(30,new _e(3,115),new _e(1,116)),new Ue(24,new _e(4,40),new _e(5,41)),new Ue(20,new _e(11,16),new _e(5,17)),new Ue(24,new _e(11,12),new _e(5,13))),new st(15,Int32Array.from([6,26,48,70]),new Ue(22,new _e(5,87),new _e(1,88)),new Ue(24,new _e(5,41),new _e(5,42)),new Ue(30,new _e(5,24),new _e(7,25)),new Ue(24,new _e(11,12),new _e(7,13))),new st(16,Int32Array.from([6,26,50,74]),new Ue(24,new _e(5,98),new _e(1,99)),new Ue(28,new _e(7,45),new _e(3,46)),new Ue(24,new _e(15,19),new _e(2,20)),new Ue(30,new _e(3,15),new _e(13,16))),new st(17,Int32Array.from([6,30,54,78]),new Ue(28,new _e(1,107),new _e(5,108)),new Ue(28,new _e(10,46),new _e(1,47)),new Ue(28,new _e(1,22),new _e(15,23)),new Ue(28,new _e(2,14),new _e(17,15))),new st(18,Int32Array.from([6,30,56,82]),new Ue(30,new _e(5,120),new _e(1,121)),new Ue(26,new _e(9,43),new _e(4,44)),new Ue(28,new _e(17,22),new _e(1,23)),new Ue(28,new _e(2,14),new _e(19,15))),new st(19,Int32Array.from([6,30,58,86]),new Ue(28,new _e(3,113),new _e(4,114)),new Ue(26,new _e(3,44),new _e(11,45)),new Ue(26,new _e(17,21),new _e(4,22)),new Ue(26,new _e(9,13),new _e(16,14))),new st(20,Int32Array.from([6,34,62,90]),new Ue(28,new _e(3,107),new _e(5,108)),new Ue(26,new _e(3,41),new _e(13,42)),new Ue(30,new _e(15,24),new _e(5,25)),new Ue(28,new _e(15,15),new _e(10,16))),new st(21,Int32Array.from([6,28,50,72,94]),new Ue(28,new _e(4,116),new _e(4,117)),new Ue(26,new _e(17,42)),new Ue(28,new _e(17,22),new _e(6,23)),new Ue(30,new _e(19,16),new _e(6,17))),new st(22,Int32Array.from([6,26,50,74,98]),new Ue(28,new _e(2,111),new _e(7,112)),new Ue(28,new _e(17,46)),new Ue(30,new _e(7,24),new _e(16,25)),new Ue(24,new _e(34,13))),new st(23,Int32Array.from([6,30,54,78,102]),new Ue(30,new _e(4,121),new _e(5,122)),new Ue(28,new _e(4,47),new _e(14,48)),new Ue(30,new _e(11,24),new _e(14,25)),new Ue(30,new _e(16,15),new _e(14,16))),new st(24,Int32Array.from([6,28,54,80,106]),new Ue(30,new _e(6,117),new _e(4,118)),new Ue(28,new _e(6,45),new _e(14,46)),new Ue(30,new _e(11,24),new _e(16,25)),new Ue(30,new _e(30,16),new _e(2,17))),new st(25,Int32Array.from([6,32,58,84,110]),new Ue(26,new _e(8,106),new _e(4,107)),new Ue(28,new _e(8,47),new _e(13,48)),new Ue(30,new _e(7,24),new _e(22,25)),new Ue(30,new _e(22,15),new _e(13,16))),new st(26,Int32Array.from([6,30,58,86,114]),new Ue(28,new _e(10,114),new _e(2,115)),new Ue(28,new _e(19,46),new _e(4,47)),new Ue(28,new _e(28,22),new _e(6,23)),new Ue(30,new _e(33,16),new _e(4,17))),new st(27,Int32Array.from([6,34,62,90,118]),new Ue(30,new _e(8,122),new _e(4,123)),new Ue(28,new _e(22,45),new _e(3,46)),new Ue(30,new _e(8,23),new _e(26,24)),new Ue(30,new _e(12,15),new _e(28,16))),new st(28,Int32Array.from([6,26,50,74,98,122]),new Ue(30,new _e(3,117),new _e(10,118)),new Ue(28,new _e(3,45),new _e(23,46)),new Ue(30,new _e(4,24),new _e(31,25)),new Ue(30,new _e(11,15),new _e(31,16))),new st(29,Int32Array.from([6,30,54,78,102,126]),new Ue(30,new _e(7,116),new _e(7,117)),new Ue(28,new _e(21,45),new _e(7,46)),new Ue(30,new _e(1,23),new _e(37,24)),new Ue(30,new _e(19,15),new _e(26,16))),new st(30,Int32Array.from([6,26,52,78,104,130]),new Ue(30,new _e(5,115),new _e(10,116)),new Ue(28,new _e(19,47),new _e(10,48)),new Ue(30,new _e(15,24),new _e(25,25)),new Ue(30,new _e(23,15),new _e(25,16))),new st(31,Int32Array.from([6,30,56,82,108,134]),new Ue(30,new _e(13,115),new _e(3,116)),new Ue(28,new _e(2,46),new _e(29,47)),new Ue(30,new _e(42,24),new _e(1,25)),new Ue(30,new _e(23,15),new _e(28,16))),new st(32,Int32Array.from([6,34,60,86,112,138]),new Ue(30,new _e(17,115)),new Ue(28,new _e(10,46),new _e(23,47)),new Ue(30,new _e(10,24),new _e(35,25)),new Ue(30,new _e(19,15),new _e(35,16))),new st(33,Int32Array.from([6,30,58,86,114,142]),new Ue(30,new _e(17,115),new _e(1,116)),new Ue(28,new _e(14,46),new _e(21,47)),new Ue(30,new _e(29,24),new _e(19,25)),new Ue(30,new _e(11,15),new _e(46,16))),new st(34,Int32Array.from([6,34,62,90,118,146]),new Ue(30,new _e(13,115),new _e(6,116)),new Ue(28,new _e(14,46),new _e(23,47)),new Ue(30,new _e(44,24),new _e(7,25)),new Ue(30,new _e(59,16),new _e(1,17))),new st(35,Int32Array.from([6,30,54,78,102,126,150]),new Ue(30,new _e(12,121),new _e(7,122)),new Ue(28,new _e(12,47),new _e(26,48)),new Ue(30,new _e(39,24),new _e(14,25)),new Ue(30,new _e(22,15),new _e(41,16))),new st(36,Int32Array.from([6,24,50,76,102,128,154]),new Ue(30,new _e(6,121),new _e(14,122)),new Ue(28,new _e(6,47),new _e(34,48)),new Ue(30,new _e(46,24),new _e(10,25)),new Ue(30,new _e(2,15),new _e(64,16))),new st(37,Int32Array.from([6,28,54,80,106,132,158]),new Ue(30,new _e(17,122),new _e(4,123)),new Ue(28,new _e(29,46),new _e(14,47)),new Ue(30,new _e(49,24),new _e(10,25)),new Ue(30,new _e(24,15),new _e(46,16))),new st(38,Int32Array.from([6,32,58,84,110,136,162]),new Ue(30,new _e(4,122),new _e(18,123)),new Ue(28,new _e(13,46),new _e(32,47)),new Ue(30,new _e(48,24),new _e(14,25)),new Ue(30,new _e(42,15),new _e(32,16))),new st(39,Int32Array.from([6,26,54,82,110,138,166]),new Ue(30,new _e(20,117),new _e(4,118)),new Ue(28,new _e(40,47),new _e(7,48)),new Ue(30,new _e(43,24),new _e(22,25)),new Ue(30,new _e(10,15),new _e(67,16))),new st(40,Int32Array.from([6,30,58,86,114,142,170]),new Ue(30,new _e(19,118),new _e(6,119)),new Ue(28,new _e(18,47),new _e(31,48)),new Ue(30,new _e(34,24),new _e(34,25)),new Ue(30,new _e(20,15),new _e(61,16)))];var ut;(function(ft){ft[ft.DATA_MASK_000=0]="DATA_MASK_000",ft[ft.DATA_MASK_001=1]="DATA_MASK_001",ft[ft.DATA_MASK_010=2]="DATA_MASK_010",ft[ft.DATA_MASK_011=3]="DATA_MASK_011",ft[ft.DATA_MASK_100=4]="DATA_MASK_100",ft[ft.DATA_MASK_101=5]="DATA_MASK_101",ft[ft.DATA_MASK_110=6]="DATA_MASK_110",ft[ft.DATA_MASK_111=7]="DATA_MASK_111"})(ut||(ut={}));class yt{constructor(w,E){this.value=w,this.isMasked=E}unmaskBitMatrix(w,E){for(let O=0;O<E;O++)for(let U=0;U<E;U++)this.isMasked(O,U)&&w.flip(U,O)}}yt.values=new Map([[ut.DATA_MASK_000,new yt(ut.DATA_MASK_000,(ft,w)=>(ft+w&1)===0)],[ut.DATA_MASK_001,new yt(ut.DATA_MASK_001,(ft,w)=>(ft&1)===0)],[ut.DATA_MASK_010,new yt(ut.DATA_MASK_010,(ft,w)=>w%3===0)],[ut.DATA_MASK_011,new yt(ut.DATA_MASK_011,(ft,w)=>(ft+w)%3===0)],[ut.DATA_MASK_100,new yt(ut.DATA_MASK_100,(ft,w)=>(Math.floor(ft/2)+Math.floor(w/3)&1)===0)],[ut.DATA_MASK_101,new yt(ut.DATA_MASK_101,(ft,w)=>ft*w%6===0)],[ut.DATA_MASK_110,new yt(ut.DATA_MASK_110,(ft,w)=>ft*w%6<3)],[ut.DATA_MASK_111,new yt(ut.DATA_MASK_111,(ft,w)=>(ft+w+ft*w%3&1)===0)]]);class Mt{constructor(w){const E=w.getHeight();if(E<21||(E&3)!==1)throw new L;this.bitMatrix=w}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let w=0;for(let H=0;H<6;H++)w=this.copyBit(H,8,w);w=this.copyBit(7,8,w),w=this.copyBit(8,8,w),w=this.copyBit(8,7,w);for(let H=5;H>=0;H--)w=this.copyBit(8,H,w);const E=this.bitMatrix.getHeight();let O=0;const U=E-7;for(let H=E-1;H>=U;H--)O=this.copyBit(8,H,O);for(let H=E-8;H<E;H++)O=this.copyBit(H,8,O);if(this.parsedFormatInfo=$e.decodeFormatInformation(w,O),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new L}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const w=this.bitMatrix.getHeight(),E=Math.floor((w-17)/4);if(E<=6)return st.getVersionForNumber(E);let O=0;const U=w-11;for(let Q=5;Q>=0;Q--)for(let le=w-9;le>=U;le--)O=this.copyBit(le,Q,O);let H=st.decodeVersionInformation(O);if(H!==null&&H.getDimensionForVersion()===w)return this.parsedVersion=H,H;O=0;for(let Q=5;Q>=0;Q--)for(let le=w-9;le>=U;le--)O=this.copyBit(Q,le,O);if(H=st.decodeVersionInformation(O),H!==null&&H.getDimensionForVersion()===w)return this.parsedVersion=H,H;throw new L}copyBit(w,E,O){return(this.isMirror?this.bitMatrix.get(E,w):this.bitMatrix.get(w,E))?O<<1|1:O<<1}readCodewords(){const w=this.readFormatInformation(),E=this.readVersion(),O=yt.values.get(w.getDataMask()),U=this.bitMatrix.getHeight();O.unmaskBitMatrix(this.bitMatrix,U);const H=E.buildFunctionPattern();let Q=!0;const le=new Uint8Array(E.getTotalCodewords());let ve=0,Te=0,Ze=0;for(let xt=U-1;xt>0;xt-=2){xt===6&&xt--;for(let _t=0;_t<U;_t++){const Qt=Q?U-1-_t:_t;for(let St=0;St<2;St++)H.get(xt-St,Qt)||(Ze++,Te<<=1,this.bitMatrix.get(xt-St,Qt)&&(Te|=1),Ze===8&&(le[ve++]=Te,Ze=0,Te=0))}Q=!Q}if(ve!==E.getTotalCodewords())throw new L;return le}remask(){if(this.parsedFormatInfo===null)return;const w=yt.values[this.parsedFormatInfo.getDataMask()],E=this.bitMatrix.getHeight();w.unmaskBitMatrix(this.bitMatrix,E)}setMirror(w){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=w}mirror(){const w=this.bitMatrix;for(let E=0,O=w.getWidth();E<O;E++)for(let U=E+1,H=w.getHeight();U<H;U++)w.get(E,U)!==w.get(U,E)&&(w.flip(U,E),w.flip(E,U))}}class Kt{constructor(w,E){this.numDataCodewords=w,this.codewords=E}static getDataBlocks(w,E,O){if(w.length!==E.getTotalCodewords())throw new f;const U=E.getECBlocksForLevel(O);let H=0;const Q=U.getECBlocks();for(const St of Q)H+=St.getCount();const le=new Array(H);let ve=0;for(const St of Q)for(let $t=0;$t<St.getCount();$t++){const Ht=St.getDataCodewords(),jn=U.getECCodewordsPerBlock()+Ht;le[ve++]=new Kt(Ht,new Uint8Array(jn))}const Te=le[0].codewords.length;let Ze=le.length-1;for(;Ze>=0&&le[Ze].codewords.length!==Te;)Ze--;Ze++;const xt=Te-U.getECCodewordsPerBlock();let _t=0;for(let St=0;St<xt;St++)for(let $t=0;$t<ve;$t++)le[$t].codewords[St]=w[_t++];for(let St=Ze;St<ve;St++)le[St].codewords[xt]=w[_t++];const Qt=le[0].codewords.length;for(let St=xt;St<Qt;St++)for(let $t=0;$t<ve;$t++){const Ht=$t<Ze?St:St+1;le[$t].codewords[Ht]=w[_t++]}return le}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var un;(function(ft){ft[ft.TERMINATOR=0]="TERMINATOR",ft[ft.NUMERIC=1]="NUMERIC",ft[ft.ALPHANUMERIC=2]="ALPHANUMERIC",ft[ft.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",ft[ft.BYTE=4]="BYTE",ft[ft.ECI=5]="ECI",ft[ft.KANJI=6]="KANJI",ft[ft.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",ft[ft.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",ft[ft.HANZI=9]="HANZI"})(un||(un={}));class Xe{constructor(w,E,O,U){this.value=w,this.stringValue=E,this.characterCountBitsForVersions=O,this.bits=U,Xe.FOR_BITS.set(U,this),Xe.FOR_VALUE.set(w,this)}static forBits(w){const E=Xe.FOR_BITS.get(w);if(E===void 0)throw new f;return E}getCharacterCountBits(w){const E=w.getVersionNumber();let O;return E<=9?O=0:E<=26?O=1:O=2,this.characterCountBitsForVersions[O]}getValue(){return this.value}getBits(){return this.bits}equals(w){if(!(w instanceof Xe))return!1;const E=w;return this.value===E.value}toString(){return this.stringValue}}Xe.FOR_BITS=new Map,Xe.FOR_VALUE=new Map,Xe.TERMINATOR=new Xe(un.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Xe.NUMERIC=new Xe(un.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Xe.ALPHANUMERIC=new Xe(un.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Xe.STRUCTURED_APPEND=new Xe(un.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Xe.BYTE=new Xe(un.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Xe.ECI=new Xe(un.ECI,"ECI",Int32Array.from([0,0,0]),7),Xe.KANJI=new Xe(un.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Xe.FNC1_FIRST_POSITION=new Xe(un.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Xe.FNC1_SECOND_POSITION=new Xe(un.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Xe.HANZI=new Xe(un.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Pt{static decode(w,E,O,U){const H=new ge(w);let Q=new te;const le=new Array;let ve=-1,Te=-1;try{let Ze=null,xt=!1,_t;do{if(H.available()<4)_t=Xe.TERMINATOR;else{const Qt=H.readBits(4);_t=Xe.forBits(Qt)}switch(_t){case Xe.TERMINATOR:break;case Xe.FNC1_FIRST_POSITION:case Xe.FNC1_SECOND_POSITION:xt=!0;break;case Xe.STRUCTURED_APPEND:if(H.available()<16)throw new L;ve=H.readBits(8),Te=H.readBits(8);break;case Xe.ECI:const Qt=Pt.parseECIValue(H);if(Ze=X.getCharacterSetECIByValue(Qt),Ze===null)throw new L;break;case Xe.HANZI:const St=H.readBits(4),$t=H.readBits(_t.getCharacterCountBits(E));St===Pt.GB2312_SUBSET&&Pt.decodeHanziSegment(H,Q,$t);break;default:const Ht=H.readBits(_t.getCharacterCountBits(E));switch(_t){case Xe.NUMERIC:Pt.decodeNumericSegment(H,Q,Ht);break;case Xe.ALPHANUMERIC:Pt.decodeAlphanumericSegment(H,Q,Ht,xt);break;case Xe.BYTE:Pt.decodeByteSegment(H,Q,Ht,Ze,le,U);break;case Xe.KANJI:Pt.decodeKanjiSegment(H,Q,Ht);break;default:throw new L}break}}while(_t!==Xe.TERMINATOR)}catch{throw new L}return new Ie(w,Q.toString(),le.length===0?null:le,O===null?null:O.toString(),ve,Te)}static decodeHanziSegment(w,E,O){if(O*13>w.available())throw new L;const U=new Uint8Array(2*O);let H=0;for(;O>0;){const Q=w.readBits(13);let le=Q/96<<8&4294967295|Q%96;le<959?le+=41377:le+=42657,U[H]=le>>8&255,U[H+1]=le&255,H+=2,O--}try{E.append(J.decode(U,K.GB2312))}catch(Q){throw new L(Q)}}static decodeKanjiSegment(w,E,O){if(O*13>w.available())throw new L;const U=new Uint8Array(2*O);let H=0;for(;O>0;){const Q=w.readBits(13);let le=Q/192<<8&4294967295|Q%192;le<7936?le+=33088:le+=49472,U[H]=le>>8,U[H+1]=le,H+=2,O--}try{E.append(J.decode(U,K.SHIFT_JIS))}catch(Q){throw new L(Q)}}static decodeByteSegment(w,E,O,U,H,Q){if(8*O>w.available())throw new L;const le=new Uint8Array(O);for(let Te=0;Te<O;Te++)le[Te]=w.readBits(8);let ve;U===null?ve=K.guessEncoding(le,Q):ve=U.getName();try{E.append(J.decode(le,ve))}catch(Te){throw new L(Te)}H.push(le)}static toAlphaNumericChar(w){if(w>=Pt.ALPHANUMERIC_CHARS.length)throw new L;return Pt.ALPHANUMERIC_CHARS[w]}static decodeAlphanumericSegment(w,E,O,U){const H=E.length();for(;O>1;){if(w.available()<11)throw new L;const Q=w.readBits(11);E.append(Pt.toAlphaNumericChar(Math.floor(Q/45))),E.append(Pt.toAlphaNumericChar(Q%45)),O-=2}if(O===1){if(w.available()<6)throw new L;E.append(Pt.toAlphaNumericChar(w.readBits(6)))}if(U)for(let Q=H;Q<E.length();Q++)E.charAt(Q)==="%"&&(Q<E.length()-1&&E.charAt(Q+1)==="%"?E.deleteCharAt(Q+1):E.setCharAt(Q,""))}static decodeNumericSegment(w,E,O){for(;O>=3;){if(w.available()<10)throw new L;const U=w.readBits(10);if(U>=1e3)throw new L;E.append(Pt.toAlphaNumericChar(Math.floor(U/100))),E.append(Pt.toAlphaNumericChar(Math.floor(U/10)%10)),E.append(Pt.toAlphaNumericChar(U%10)),O-=3}if(O===2){if(w.available()<7)throw new L;const U=w.readBits(7);if(U>=100)throw new L;E.append(Pt.toAlphaNumericChar(Math.floor(U/10))),E.append(Pt.toAlphaNumericChar(U%10))}else if(O===1){if(w.available()<4)throw new L;const U=w.readBits(4);if(U>=10)throw new L;E.append(Pt.toAlphaNumericChar(U))}}static parseECIValue(w){const E=w.readBits(8);if(!(E&128))return E&127;if((E&192)===128){const O=w.readBits(8);return(E&63)<<8&4294967295|O}if((E&224)===192){const O=w.readBits(16);return(E&31)<<16&4294967295|O}throw new L}}Pt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Pt.GB2312_SUBSET=1;class Wt{constructor(w){this.mirrored=w}isMirrored(){return this.mirrored}applyMirroredCorrection(w){if(!this.mirrored||w===null||w.length<3)return;const E=w[0];w[0]=w[2],w[2]=E}}class ct{constructor(){this.rsDecoder=new Le(dt.QR_CODE_FIELD_256)}decodeBooleanArray(w,E){return this.decodeBitMatrix(fe.parseFromBooleanArray(w),E)}decodeBitMatrix(w,E){const O=new Mt(w);let U=null;try{return this.decodeBitMatrixParser(O,E)}catch(H){U=H}try{O.remask(),O.setMirror(!0),O.readVersion(),O.readFormatInformation(),O.mirror();const H=this.decodeBitMatrixParser(O,E);return H.setOther(new Wt(!0)),H}catch(H){throw U!==null?U:H}}decodeBitMatrixParser(w,E){const O=w.readVersion(),U=w.readFormatInformation().getErrorCorrectionLevel(),H=w.readCodewords(),Q=Kt.getDataBlocks(H,O,U);let le=0;for(const Ze of Q)le+=Ze.getNumDataCodewords();const ve=new Uint8Array(le);let Te=0;for(const Ze of Q){const xt=Ze.getCodewords(),_t=Ze.getNumDataCodewords();this.correctErrors(xt,_t);for(let Qt=0;Qt<_t;Qt++)ve[Te++]=xt[Qt]}return Pt.decode(ve,O,U,E)}correctErrors(w,E){const O=new Int32Array(w);try{this.rsDecoder.decode(O,w.length-E)}catch{throw new g}for(let U=0;U<E;U++)w[U]=O[U]}}class Ge extends wt{constructor(w,E,O){super(w,E),this.estimatedModuleSize=O}aboutEquals(w,E,O){if(Math.abs(E-this.getY())<=w&&Math.abs(O-this.getX())<=w){const U=Math.abs(w-this.estimatedModuleSize);return U<=1||U<=this.estimatedModuleSize}return!1}combineEstimate(w,E,O){const U=(this.getX()+E)/2,H=(this.getY()+w)/2,Q=(this.estimatedModuleSize+O)/2;return new Ge(U,H,Q)}}class Tt{constructor(w,E,O,U,H,Q,le){this.image=w,this.startX=E,this.startY=O,this.width=U,this.height=H,this.moduleSize=Q,this.resultPointCallback=le,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const w=this.startX,E=this.height,O=this.width,U=w+O,H=this.startY+E/2,Q=new Int32Array(3),le=this.image;for(let ve=0;ve<E;ve++){const Te=H+(ve&1?-Math.floor((ve+1)/2):Math.floor((ve+1)/2));Q[0]=0,Q[1]=0,Q[2]=0;let Ze=w;for(;Ze<U&&!le.get(Ze,Te);)Ze++;let xt=0;for(;Ze<U;){if(le.get(Ze,Te))if(xt===1)Q[1]++;else if(xt===2){if(this.foundPatternCross(Q)){const _t=this.handlePossibleCenter(Q,Te,Ze);if(_t!==null)return _t}Q[0]=Q[2],Q[1]=1,Q[2]=0,xt=1}else Q[++xt]++;else xt===1&&xt++,Q[xt]++;Ze++}if(this.foundPatternCross(Q)){const _t=this.handlePossibleCenter(Q,Te,U);if(_t!==null)return _t}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new q}static centerFromEnd(w,E){return E-w[2]-w[1]/2}foundPatternCross(w){const E=this.moduleSize,O=E/2;for(let U=0;U<3;U++)if(Math.abs(E-w[U])>=O)return!1;return!0}crossCheckVertical(w,E,O,U){const H=this.image,Q=H.getHeight(),le=this.crossCheckStateCount;le[0]=0,le[1]=0,le[2]=0;let ve=w;for(;ve>=0&&H.get(E,ve)&&le[1]<=O;)le[1]++,ve--;if(ve<0||le[1]>O)return NaN;for(;ve>=0&&!H.get(E,ve)&&le[0]<=O;)le[0]++,ve--;if(le[0]>O)return NaN;for(ve=w+1;ve<Q&&H.get(E,ve)&&le[1]<=O;)le[1]++,ve++;if(ve===Q||le[1]>O)return NaN;for(;ve<Q&&!H.get(E,ve)&&le[2]<=O;)le[2]++,ve++;if(le[2]>O)return NaN;const Te=le[0]+le[1]+le[2];return 5*Math.abs(Te-U)>=2*U?NaN:this.foundPatternCross(le)?Tt.centerFromEnd(le,ve):NaN}handlePossibleCenter(w,E,O){const U=w[0]+w[1]+w[2],H=Tt.centerFromEnd(w,O),Q=this.crossCheckVertical(E,H,2*w[1],U);if(!isNaN(Q)){const le=(w[0]+w[1]+w[2])/3;for(const Te of this.possibleCenters)if(Te.aboutEquals(le,Q,H))return Te.combineEstimate(Q,H,le);const ve=new Ge(H,Q,le);this.possibleCenters.push(ve),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(ve)}return null}}class fn extends wt{constructor(w,E,O,U){super(w,E),this.estimatedModuleSize=O,this.count=U,U===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(w,E,O){if(Math.abs(E-this.getY())<=w&&Math.abs(O-this.getX())<=w){const U=Math.abs(w-this.estimatedModuleSize);return U<=1||U<=this.estimatedModuleSize}return!1}combineEstimate(w,E,O){const U=this.count+1,H=(this.count*this.getX()+E)/U,Q=(this.count*this.getY()+w)/U,le=(this.count*this.estimatedModuleSize+O)/U;return new fn(H,Q,le,U)}}class Yn{constructor(w){this.bottomLeft=w[0],this.topLeft=w[1],this.topRight=w[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Fn{constructor(w,E){this.image=w,this.resultPointCallback=E,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=E}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(w){const E=w!=null&&w.get($.TRY_HARDER)!==void 0,O=w!=null&&w.get($.PURE_BARCODE)!==void 0,U=this.image,H=U.getHeight(),Q=U.getWidth();let le=Math.floor(3*H/(4*Fn.MAX_MODULES));(le<Fn.MIN_SKIP||E)&&(le=Fn.MIN_SKIP);let ve=!1;const Te=new Int32Array(5);for(let xt=le-1;xt<H&&!ve;xt+=le){Te[0]=0,Te[1]=0,Te[2]=0,Te[3]=0,Te[4]=0;let _t=0;for(let Qt=0;Qt<Q;Qt++)if(U.get(Qt,xt))(_t&1)===1&&_t++,Te[_t]++;else if(_t&1)Te[_t]++;else if(_t===4)if(Fn.foundPatternCross(Te)){if(this.handlePossibleCenter(Te,xt,Qt,O)===!0)if(le=2,this.hasSkipped===!0)ve=this.haveMultiplyConfirmedCenters();else{const $t=this.findRowSkip();$t>Te[2]&&(xt+=$t-Te[2]-le,Qt=Q-1)}else{Te[0]=Te[2],Te[1]=Te[3],Te[2]=Te[4],Te[3]=1,Te[4]=0,_t=3;continue}_t=0,Te[0]=0,Te[1]=0,Te[2]=0,Te[3]=0,Te[4]=0}else Te[0]=Te[2],Te[1]=Te[3],Te[2]=Te[4],Te[3]=1,Te[4]=0,_t=3;else Te[++_t]++;Fn.foundPatternCross(Te)&&this.handlePossibleCenter(Te,xt,Q,O)===!0&&(le=Te[0],this.hasSkipped&&(ve=this.haveMultiplyConfirmedCenters()))}const Ze=this.selectBestPatterns();return wt.orderBestPatterns(Ze),new Yn(Ze)}static centerFromEnd(w,E){return E-w[4]-w[3]-w[2]/2}static foundPatternCross(w){let E=0;for(let H=0;H<5;H++){const Q=w[H];if(Q===0)return!1;E+=Q}if(E<7)return!1;const O=E/7,U=O/2;return Math.abs(O-w[0])<U&&Math.abs(O-w[1])<U&&Math.abs(3*O-w[2])<3*U&&Math.abs(O-w[3])<U&&Math.abs(O-w[4])<U}getCrossCheckStateCount(){const w=this.crossCheckStateCount;return w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0,w}crossCheckDiagonal(w,E,O,U){const H=this.getCrossCheckStateCount();let Q=0;const le=this.image;for(;w>=Q&&E>=Q&&le.get(E-Q,w-Q);)H[2]++,Q++;if(w<Q||E<Q)return!1;for(;w>=Q&&E>=Q&&!le.get(E-Q,w-Q)&&H[1]<=O;)H[1]++,Q++;if(w<Q||E<Q||H[1]>O)return!1;for(;w>=Q&&E>=Q&&le.get(E-Q,w-Q)&&H[0]<=O;)H[0]++,Q++;if(H[0]>O)return!1;const ve=le.getHeight(),Te=le.getWidth();for(Q=1;w+Q<ve&&E+Q<Te&&le.get(E+Q,w+Q);)H[2]++,Q++;if(w+Q>=ve||E+Q>=Te)return!1;for(;w+Q<ve&&E+Q<Te&&!le.get(E+Q,w+Q)&&H[3]<O;)H[3]++,Q++;if(w+Q>=ve||E+Q>=Te||H[3]>=O)return!1;for(;w+Q<ve&&E+Q<Te&&le.get(E+Q,w+Q)&&H[4]<O;)H[4]++,Q++;if(H[4]>=O)return!1;const Ze=H[0]+H[1]+H[2]+H[3]+H[4];return Math.abs(Ze-U)<2*U&&Fn.foundPatternCross(H)}crossCheckVertical(w,E,O,U){const H=this.image,Q=H.getHeight(),le=this.getCrossCheckStateCount();let ve=w;for(;ve>=0&&H.get(E,ve);)le[2]++,ve--;if(ve<0)return NaN;for(;ve>=0&&!H.get(E,ve)&&le[1]<=O;)le[1]++,ve--;if(ve<0||le[1]>O)return NaN;for(;ve>=0&&H.get(E,ve)&&le[0]<=O;)le[0]++,ve--;if(le[0]>O)return NaN;for(ve=w+1;ve<Q&&H.get(E,ve);)le[2]++,ve++;if(ve===Q)return NaN;for(;ve<Q&&!H.get(E,ve)&&le[3]<O;)le[3]++,ve++;if(ve===Q||le[3]>=O)return NaN;for(;ve<Q&&H.get(E,ve)&&le[4]<O;)le[4]++,ve++;if(le[4]>=O)return NaN;const Te=le[0]+le[1]+le[2]+le[3]+le[4];return 5*Math.abs(Te-U)>=2*U?NaN:Fn.foundPatternCross(le)?Fn.centerFromEnd(le,ve):NaN}crossCheckHorizontal(w,E,O,U){const H=this.image,Q=H.getWidth(),le=this.getCrossCheckStateCount();let ve=w;for(;ve>=0&&H.get(ve,E);)le[2]++,ve--;if(ve<0)return NaN;for(;ve>=0&&!H.get(ve,E)&&le[1]<=O;)le[1]++,ve--;if(ve<0||le[1]>O)return NaN;for(;ve>=0&&H.get(ve,E)&&le[0]<=O;)le[0]++,ve--;if(le[0]>O)return NaN;for(ve=w+1;ve<Q&&H.get(ve,E);)le[2]++,ve++;if(ve===Q)return NaN;for(;ve<Q&&!H.get(ve,E)&&le[3]<O;)le[3]++,ve++;if(ve===Q||le[3]>=O)return NaN;for(;ve<Q&&H.get(ve,E)&&le[4]<O;)le[4]++,ve++;if(le[4]>=O)return NaN;const Te=le[0]+le[1]+le[2]+le[3]+le[4];return 5*Math.abs(Te-U)>=U?NaN:Fn.foundPatternCross(le)?Fn.centerFromEnd(le,ve):NaN}handlePossibleCenter(w,E,O,U){const H=w[0]+w[1]+w[2]+w[3]+w[4];let Q=Fn.centerFromEnd(w,O),le=this.crossCheckVertical(E,Math.floor(Q),w[2],H);if(!isNaN(le)&&(Q=this.crossCheckHorizontal(Math.floor(Q),Math.floor(le),w[2],H),!isNaN(Q)&&(!U||this.crossCheckDiagonal(Math.floor(le),Math.floor(Q),w[2],H)))){const ve=H/7;let Te=!1;const Ze=this.possibleCenters;for(let xt=0,_t=Ze.length;xt<_t;xt++){const Qt=Ze[xt];if(Qt.aboutEquals(ve,le,Q)){Ze[xt]=Qt.combineEstimate(le,Q,ve),Te=!0;break}}if(!Te){const xt=new fn(Q,le,ve);Ze.push(xt),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(xt)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let E=null;for(const O of this.possibleCenters)if(O.getCount()>=Fn.CENTER_QUORUM)if(E==null)E=O;else return this.hasSkipped=!0,Math.floor((Math.abs(E.getX()-O.getX())-Math.abs(E.getY()-O.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let w=0,E=0;const O=this.possibleCenters.length;for(const Q of this.possibleCenters)Q.getCount()>=Fn.CENTER_QUORUM&&(w++,E+=Q.getEstimatedModuleSize());if(w<3)return!1;const U=E/O;let H=0;for(const Q of this.possibleCenters)H+=Math.abs(Q.getEstimatedModuleSize()-U);return H<=.05*E}selectBestPatterns(){const w=this.possibleCenters.length;if(w<3)throw new q;const E=this.possibleCenters;let O;if(w>3){let U=0,H=0;for(const ve of this.possibleCenters){const Te=ve.getEstimatedModuleSize();U+=Te,H+=Te*Te}O=U/w;let Q=Math.sqrt(H/w-O*O);E.sort((ve,Te)=>{const Ze=Math.abs(Te.getEstimatedModuleSize()-O),xt=Math.abs(ve.getEstimatedModuleSize()-O);return Ze<xt?-1:Ze>xt?1:0});const le=Math.max(.2*O,Q);for(let ve=0;ve<E.length&&E.length>3;ve++){const Te=E[ve];Math.abs(Te.getEstimatedModuleSize()-O)>le&&(E.splice(ve,1),ve--)}}if(E.length>3){let U=0;for(const H of E)U+=H.getEstimatedModuleSize();O=U/E.length,E.sort((H,Q)=>{if(Q.getCount()===H.getCount()){const le=Math.abs(Q.getEstimatedModuleSize()-O),ve=Math.abs(H.getEstimatedModuleSize()-O);return le<ve?1:le>ve?-1:0}else return Q.getCount()-H.getCount()}),E.splice(3)}return[E[0],E[1],E[2]]}}Fn.CENTER_QUORUM=2,Fn.MIN_SKIP=3,Fn.MAX_MODULES=57;class Gn{constructor(w){this.image=w}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(w){this.resultPointCallback=w==null?null:w.get($.NEED_RESULT_POINT_CALLBACK);const O=new Fn(this.image,this.resultPointCallback).find(w);return this.processFinderPatternInfo(O)}processFinderPatternInfo(w){const E=w.getTopLeft(),O=w.getTopRight(),U=w.getBottomLeft(),H=this.calculateModuleSize(E,O,U);if(H<1)throw new q("No pattern found in proccess finder.");const Q=Gn.computeDimension(E,O,U,H),le=st.getProvisionalVersionForDimension(Q),ve=le.getDimensionForVersion()-7;let Te=null;if(le.getAlignmentPatternCenters().length>0){const Qt=O.getX()-E.getX()+U.getX(),St=O.getY()-E.getY()+U.getY(),$t=1-3/ve,Ht=Math.floor(E.getX()+$t*(Qt-E.getX())),jn=Math.floor(E.getY()+$t*(St-E.getY()));for(let xr=4;xr<=16;xr<<=1)try{Te=this.findAlignmentInRegion(H,Ht,jn,xr);break}catch(Nr){if(!(Nr instanceof q))throw Nr}}const Ze=Gn.createTransform(E,O,U,Te,Q),xt=Gn.sampleGrid(this.image,Ze,Q);let _t;return Te===null?_t=[U,E,O]:_t=[U,E,O,Te],new nn(xt,_t)}static createTransform(w,E,O,U,H){const Q=H-3.5;let le,ve,Te,Ze;return U!==null?(le=U.getX(),ve=U.getY(),Te=Q-3,Ze=Te):(le=E.getX()-w.getX()+O.getX(),ve=E.getY()-w.getY()+O.getY(),Te=Q,Ze=Q),an.quadrilateralToQuadrilateral(3.5,3.5,Q,3.5,Te,Ze,3.5,Q,w.getX(),w.getY(),E.getX(),E.getY(),le,ve,O.getX(),O.getY())}static sampleGrid(w,E,O){return Ye.getInstance().sampleGridWithTransform(w,O,O,E)}static computeDimension(w,E,O,U){const H=pt.round(wt.distance(w,E)/U),Q=pt.round(wt.distance(w,O)/U);let le=Math.floor((H+Q)/2)+7;switch(le&3){case 0:le++;break;case 2:le--;break;case 3:throw new q("Dimensions could be not found.")}return le}calculateModuleSize(w,E,O){return(this.calculateModuleSizeOneWay(w,E)+this.calculateModuleSizeOneWay(w,O))/2}calculateModuleSizeOneWay(w,E){const O=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(w.getX()),Math.floor(w.getY()),Math.floor(E.getX()),Math.floor(E.getY())),U=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(E.getX()),Math.floor(E.getY()),Math.floor(w.getX()),Math.floor(w.getY()));return isNaN(O)?U/7:isNaN(U)?O/7:(O+U)/14}sizeOfBlackWhiteBlackRunBothWays(w,E,O,U){let H=this.sizeOfBlackWhiteBlackRun(w,E,O,U),Q=1,le=w-(O-w);le<0?(Q=w/(w-le),le=0):le>=this.image.getWidth()&&(Q=(this.image.getWidth()-1-w)/(le-w),le=this.image.getWidth()-1);let ve=Math.floor(E-(U-E)*Q);return Q=1,ve<0?(Q=E/(E-ve),ve=0):ve>=this.image.getHeight()&&(Q=(this.image.getHeight()-1-E)/(ve-E),ve=this.image.getHeight()-1),le=Math.floor(w+(le-w)*Q),H+=this.sizeOfBlackWhiteBlackRun(w,E,le,ve),H-1}sizeOfBlackWhiteBlackRun(w,E,O,U){const H=Math.abs(U-E)>Math.abs(O-w);if(H){let Qt=w;w=E,E=Qt,Qt=O,O=U,U=Qt}const Q=Math.abs(O-w),le=Math.abs(U-E);let ve=-Q/2;const Te=w<O?1:-1,Ze=E<U?1:-1;let xt=0;const _t=O+Te;for(let Qt=w,St=E;Qt!==_t;Qt+=Te){const $t=H?St:Qt,Ht=H?Qt:St;if(xt===1===this.image.get($t,Ht)){if(xt===2)return pt.distance(Qt,St,w,E);xt++}if(ve+=le,ve>0){if(St===U)break;St+=Ze,ve-=Q}}return xt===2?pt.distance(O+Te,U,w,E):NaN}findAlignmentInRegion(w,E,O,U){const H=Math.floor(U*w),Q=Math.max(0,E-H),le=Math.min(this.image.getWidth()-1,E+H);if(le-Q<w*3)throw new q("Alignment top exceeds estimated module size.");const ve=Math.max(0,O-H),Te=Math.min(this.image.getHeight()-1,O+H);if(Te-ve<w*3)throw new q("Alignment bottom exceeds estimated module size.");return new Tt(this.image,Q,ve,le-Q,Te-ve,w,this.resultPointCallback).find()}}class Sr{constructor(){this.decoder=new ct}getDecoder(){return this.decoder}decode(w,E){let O,U;if(E!=null&&E.get($.PURE_BARCODE)!==void 0){const ve=Sr.extractPureBits(w.getBlackMatrix());O=this.decoder.decodeBitMatrix(ve,E),U=Sr.NO_POINTS}else{const ve=new Gn(w.getBlackMatrix()).detect(E);O=this.decoder.decodeBitMatrix(ve.getBits(),E),U=ve.getPoints()}O.getOther()instanceof Wt&&O.getOther().applyMirroredCorrection(U);const H=new me(O.getText(),O.getRawBytes(),void 0,U,xe.QR_CODE,void 0),Q=O.getByteSegments();Q!==null&&H.putMetadata(je.BYTE_SEGMENTS,Q);const le=O.getECLevel();return le!==null&&H.putMetadata(je.ERROR_CORRECTION_LEVEL,le),O.hasStructuredAppend()&&(H.putMetadata(je.STRUCTURED_APPEND_SEQUENCE,O.getStructuredAppendSequenceNumber()),H.putMetadata(je.STRUCTURED_APPEND_PARITY,O.getStructuredAppendParity())),H}reset(){}static extractPureBits(w){const E=w.getTopLeftOnBit(),O=w.getBottomRightOnBit();if(E===null||O===null)throw new q;const U=this.moduleSize(E,w);let H=E[1],Q=O[1],le=E[0],ve=O[0];if(le>=ve||H>=Q)throw new q;if(Q-H!==ve-le&&(ve=le+(Q-H),ve>=w.getWidth()))throw new q;const Te=Math.round((ve-le+1)/U),Ze=Math.round((Q-H+1)/U);if(Te<=0||Ze<=0)throw new q;if(Ze!==Te)throw new q;const xt=Math.floor(U/2);H+=xt,le+=xt;const _t=le+Math.floor((Te-1)*U)-ve;if(_t>0){if(_t>xt)throw new q;le-=_t}const Qt=H+Math.floor((Ze-1)*U)-Q;if(Qt>0){if(Qt>xt)throw new q;H-=Qt}const St=new fe(Te,Ze);for(let $t=0;$t<Ze;$t++){const Ht=H+Math.floor($t*U);for(let jn=0;jn<Te;jn++)w.get(le+Math.floor(jn*U),Ht)&&St.set(jn,$t)}return St}static moduleSize(w,E){const O=E.getHeight(),U=E.getWidth();let H=w[0],Q=w[1],le=!0,ve=0;for(;H<U&&Q<O;){if(le!==E.get(H,Q)){if(++ve===5)break;le=!le}H++,Q++}if(H===U||Q===O)throw new q;return(H-w[0])/7}}Sr.NO_POINTS=new Array;class ur{PDF417Common(){}static getBitCountSum(w){return pt.sum(w)}static toIntArray(w){if(w==null||!w.length)return ur.EMPTY_INT_ARRAY;const E=new Int32Array(w.length);let O=0;for(const U of w)E[O++]=U;return E}static getCodeword(w){const E=P.binarySearch(ur.SYMBOL_TABLE,w&262143);return E<0?-1:(ur.CODEWORD_TABLE[E]-1)%ur.NUMBER_OF_CODEWORDS}}ur.NUMBER_OF_CODEWORDS=929,ur.MAX_CODEWORDS_IN_BARCODE=ur.NUMBER_OF_CODEWORDS-1,ur.MIN_ROWS_IN_BARCODE=3,ur.MAX_ROWS_IN_BARCODE=90,ur.MODULES_IN_CODEWORD=17,ur.MODULES_IN_STOP_PATTERN=18,ur.BARS_IN_MODULE=8,ur.EMPTY_INT_ARRAY=new Int32Array([]),ur.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),ur.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class kr{constructor(w,E){this.bits=w,this.points=E}getBits(){return this.bits}getPoints(){return this.points}}class Bn{static detectMultiple(w,E,O){let U=w.getBlackMatrix(),H=Bn.detect(O,U);return H.length||(U=U.clone(),U.rotate180(),H=Bn.detect(O,U)),new kr(U,H)}static detect(w,E){const O=new Array;let U=0,H=0,Q=!1;for(;U<E.getHeight();){const le=Bn.findVertices(E,U,H);if(le[0]==null&&le[3]==null){if(!Q)break;Q=!1,H=0;for(const ve of O)ve[1]!=null&&(U=Math.trunc(Math.max(U,ve[1].getY()))),ve[3]!=null&&(U=Math.max(U,Math.trunc(ve[3].getY())));U+=Bn.ROW_STEP;continue}if(Q=!0,O.push(le),!w)break;le[2]!=null?(H=Math.trunc(le[2].getX()),U=Math.trunc(le[2].getY())):(H=Math.trunc(le[4].getX()),U=Math.trunc(le[4].getY()))}return O}static findVertices(w,E,O){const U=w.getHeight(),H=w.getWidth(),Q=new Array(8);return Bn.copyToResult(Q,Bn.findRowsWithPattern(w,U,H,E,O,Bn.START_PATTERN),Bn.INDEXES_START_PATTERN),Q[4]!=null&&(O=Math.trunc(Q[4].getX()),E=Math.trunc(Q[4].getY())),Bn.copyToResult(Q,Bn.findRowsWithPattern(w,U,H,E,O,Bn.STOP_PATTERN),Bn.INDEXES_STOP_PATTERN),Q}static copyToResult(w,E,O){for(let U=0;U<O.length;U++)w[O[U]]=E[U]}static findRowsWithPattern(w,E,O,U,H,Q){const le=new Array(4);let ve=!1;const Te=new Int32Array(Q.length);for(;U<E;U+=Bn.ROW_STEP){let xt=Bn.findGuardPattern(w,H,U,O,!1,Q,Te);if(xt!=null){for(;U>0;){const _t=Bn.findGuardPattern(w,H,--U,O,!1,Q,Te);if(_t!=null)xt=_t;else{U++;break}}le[0]=new wt(xt[0],U),le[1]=new wt(xt[1],U),ve=!0;break}}let Ze=U+1;if(ve){let xt=0,_t=Int32Array.from([Math.trunc(le[0].getX()),Math.trunc(le[1].getX())]);for(;Ze<E;Ze++){const Qt=Bn.findGuardPattern(w,_t[0],Ze,O,!1,Q,Te);if(Qt!=null&&Math.abs(_t[0]-Qt[0])<Bn.MAX_PATTERN_DRIFT&&Math.abs(_t[1]-Qt[1])<Bn.MAX_PATTERN_DRIFT)_t=Qt,xt=0;else{if(xt>Bn.SKIPPED_ROW_COUNT_MAX)break;xt++}}Ze-=xt+1,le[2]=new wt(_t[0],Ze),le[3]=new wt(_t[1],Ze)}return Ze-U<Bn.BARCODE_MIN_HEIGHT&&P.fill(le,null),le}static findGuardPattern(w,E,O,U,H,Q,le){P.fillWithin(le,0,le.length,0);let ve=E,Te=0;for(;w.get(ve,O)&&ve>0&&Te++<Bn.MAX_PIXEL_DRIFT;)ve--;let Ze=ve,xt=0,_t=Q.length;for(let Qt=H;Ze<U;Ze++)if(w.get(Ze,O)!==Qt)le[xt]++;else{if(xt===_t-1){if(Bn.patternMatchVariance(le,Q,Bn.MAX_INDIVIDUAL_VARIANCE)<Bn.MAX_AVG_VARIANCE)return new Int32Array([ve,Ze]);ve+=le[0]+le[1],v.arraycopy(le,2,le,0,xt-1),le[xt-1]=0,le[xt]=0,xt--}else xt++;le[xt]=1,Qt=!Qt}return xt===_t-1&&Bn.patternMatchVariance(le,Q,Bn.MAX_INDIVIDUAL_VARIANCE)<Bn.MAX_AVG_VARIANCE?new Int32Array([ve,Ze-1]):null}static patternMatchVariance(w,E,O){let U=w.length,H=0,Q=0;for(let Te=0;Te<U;Te++)H+=w[Te],Q+=E[Te];if(H<Q)return 1/0;let le=H/Q;O*=le;let ve=0;for(let Te=0;Te<U;Te++){let Ze=w[Te],xt=E[Te]*le,_t=Ze>xt?Ze-xt:xt-Ze;if(_t>O)return 1/0;ve+=_t}return ve/H}}Bn.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Bn.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Bn.MAX_AVG_VARIANCE=.42,Bn.MAX_INDIVIDUAL_VARIANCE=.8,Bn.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Bn.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Bn.MAX_PIXEL_DRIFT=3,Bn.MAX_PATTERN_DRIFT=5,Bn.SKIPPED_ROW_COUNT_MAX=25,Bn.ROW_STEP=5,Bn.BARCODE_MIN_HEIGHT=10;class Sn{constructor(w,E){if(E.length===0)throw new f;this.field=w;let O=E.length;if(O>1&&E[0]===0){let U=1;for(;U<O&&E[U]===0;)U++;U===O?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(O-U),v.arraycopy(E,U,this.coefficients,0,this.coefficients.length))}else this.coefficients=E}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(w){return this.coefficients[this.coefficients.length-1-w]}evaluateAt(w){if(w===0)return this.getCoefficient(0);if(w===1){let U=0;for(let H of this.coefficients)U=this.field.add(U,H);return U}let E=this.coefficients[0],O=this.coefficients.length;for(let U=1;U<O;U++)E=this.field.add(this.field.multiply(w,E),this.coefficients[U]);return E}add(w){if(!this.field.equals(w.field))throw new f("ModulusPolys do not have same ModulusGF field");if(this.isZero())return w;if(w.isZero())return this;let E=this.coefficients,O=w.coefficients;if(E.length>O.length){let Q=E;E=O,O=Q}let U=new Int32Array(O.length),H=O.length-E.length;v.arraycopy(O,0,U,0,H);for(let Q=H;Q<O.length;Q++)U[Q]=this.field.add(E[Q-H],O[Q]);return new Sn(this.field,U)}subtract(w){if(!this.field.equals(w.field))throw new f("ModulusPolys do not have same ModulusGF field");return w.isZero()?this:this.add(w.negative())}multiply(w){return w instanceof Sn?this.multiplyOther(w):this.multiplyScalar(w)}multiplyOther(w){if(!this.field.equals(w.field))throw new f("ModulusPolys do not have same ModulusGF field");if(this.isZero()||w.isZero())return new Sn(this.field,new Int32Array([0]));let E=this.coefficients,O=E.length,U=w.coefficients,H=U.length,Q=new Int32Array(O+H-1);for(let le=0;le<O;le++){let ve=E[le];for(let Te=0;Te<H;Te++)Q[le+Te]=this.field.add(Q[le+Te],this.field.multiply(ve,U[Te]))}return new Sn(this.field,Q)}negative(){let w=this.coefficients.length,E=new Int32Array(w);for(let O=0;O<w;O++)E[O]=this.field.subtract(0,this.coefficients[O]);return new Sn(this.field,E)}multiplyScalar(w){if(w===0)return new Sn(this.field,new Int32Array([0]));if(w===1)return this;let E=this.coefficients.length,O=new Int32Array(E);for(let U=0;U<E;U++)O[U]=this.field.multiply(this.coefficients[U],w);return new Sn(this.field,O)}multiplyByMonomial(w,E){if(w<0)throw new f;if(E===0)return new Sn(this.field,new Int32Array([0]));let O=this.coefficients.length,U=new Int32Array(O+w);for(let H=0;H<O;H++)U[H]=this.field.multiply(this.coefficients[H],E);return new Sn(this.field,U)}toString(){let w=new te;for(let E=this.getDegree();E>=0;E--){let O=this.getCoefficient(E);O!==0&&(O<0?(w.append(" - "),O=-O):w.length()>0&&w.append(" + "),(E===0||O!==1)&&w.append(O),E!==0&&(E===1?w.append("x"):(w.append("x^"),w.append(E))))}return w.toString()}}class Mn{add(w,E){return(w+E)%this.modulus}subtract(w,E){return(this.modulus+w-E)%this.modulus}exp(w){return this.expTable[w]}log(w){if(w===0)throw new f;return this.logTable[w]}inverse(w){if(w===0)throw new Ke;return this.expTable[this.modulus-this.logTable[w]-1]}multiply(w,E){return w===0||E===0?0:this.expTable[(this.logTable[w]+this.logTable[E])%(this.modulus-1)]}getSize(){return this.modulus}equals(w){return w===this}}class rr extends Mn{constructor(w,E){super(),this.modulus=w,this.expTable=new Int32Array(w),this.logTable=new Int32Array(w);let O=1;for(let U=0;U<w;U++)this.expTable[U]=O,O=O*E%w;for(let U=0;U<w-1;U++)this.logTable[this.expTable[U]]=U;this.zero=new Sn(this,new Int32Array([0])),this.one=new Sn(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(w,E){if(w<0)throw new f;if(E===0)return this.zero;let O=new Int32Array(w+1);return O[0]=E,new Sn(this,O)}}rr.PDF417_GF=new rr(ur.NUMBER_OF_CODEWORDS,3);class ls{constructor(){this.field=rr.PDF417_GF}decode(w,E,O){let U=new Sn(this.field,w),H=new Int32Array(E),Q=!1;for(let St=E;St>0;St--){let $t=U.evaluateAt(this.field.exp(St));H[E-St]=$t,$t!==0&&(Q=!0)}if(!Q)return 0;let le=this.field.getOne();if(O!=null)for(const St of O){let $t=this.field.exp(w.length-1-St),Ht=new Sn(this.field,new Int32Array([this.field.subtract(0,$t),1]));le=le.multiply(Ht)}let ve=new Sn(this.field,H),Te=this.runEuclideanAlgorithm(this.field.buildMonomial(E,1),ve,E),Ze=Te[0],xt=Te[1],_t=this.findErrorLocations(Ze),Qt=this.findErrorMagnitudes(xt,Ze,_t);for(let St=0;St<_t.length;St++){let $t=w.length-1-this.field.log(_t[St]);if($t<0)throw g.getChecksumInstance();w[$t]=this.field.subtract(w[$t],Qt[St])}return _t.length}runEuclideanAlgorithm(w,E,O){if(w.getDegree()<E.getDegree()){let _t=w;w=E,E=_t}let U=w,H=E,Q=this.field.getZero(),le=this.field.getOne();for(;H.getDegree()>=Math.round(O/2);){let _t=U,Qt=Q;if(U=H,Q=le,U.isZero())throw g.getChecksumInstance();H=_t;let St=this.field.getZero(),$t=U.getCoefficient(U.getDegree()),Ht=this.field.inverse($t);for(;H.getDegree()>=U.getDegree()&&!H.isZero();){let jn=H.getDegree()-U.getDegree(),xr=this.field.multiply(H.getCoefficient(H.getDegree()),Ht);St=St.add(this.field.buildMonomial(jn,xr)),H=H.subtract(U.multiplyByMonomial(jn,xr))}le=St.multiply(Q).subtract(Qt).negative()}let ve=le.getCoefficient(0);if(ve===0)throw g.getChecksumInstance();let Te=this.field.inverse(ve),Ze=le.multiply(Te),xt=H.multiply(Te);return[Ze,xt]}findErrorLocations(w){let E=w.getDegree(),O=new Int32Array(E),U=0;for(let H=1;H<this.field.getSize()&&U<E;H++)w.evaluateAt(H)===0&&(O[U]=this.field.inverse(H),U++);if(U!==E)throw g.getChecksumInstance();return O}findErrorMagnitudes(w,E,O){let U=E.getDegree(),H=new Int32Array(U);for(let Te=1;Te<=U;Te++)H[U-Te]=this.field.multiply(Te,E.getCoefficient(Te));let Q=new Sn(this.field,H),le=O.length,ve=new Int32Array(le);for(let Te=0;Te<le;Te++){let Ze=this.field.inverse(O[Te]),xt=this.field.subtract(0,w.evaluateAt(Ze)),_t=this.field.inverse(Q.evaluateAt(Ze));ve[Te]=this.field.multiply(xt,_t)}return ve}}class cs{constructor(w,E,O,U,H){w instanceof cs?this.constructor_2(w):this.constructor_1(w,E,O,U,H)}constructor_1(w,E,O,U,H){const Q=E==null||O==null,le=U==null||H==null;if(Q&&le)throw new q;Q?(E=new wt(0,U.getY()),O=new wt(0,H.getY())):le&&(U=new wt(w.getWidth()-1,E.getY()),H=new wt(w.getWidth()-1,O.getY())),this.image=w,this.topLeft=E,this.bottomLeft=O,this.topRight=U,this.bottomRight=H,this.minX=Math.trunc(Math.min(E.getX(),O.getX())),this.maxX=Math.trunc(Math.max(U.getX(),H.getX())),this.minY=Math.trunc(Math.min(E.getY(),U.getY())),this.maxY=Math.trunc(Math.max(O.getY(),H.getY()))}constructor_2(w){this.image=w.image,this.topLeft=w.getTopLeft(),this.bottomLeft=w.getBottomLeft(),this.topRight=w.getTopRight(),this.bottomRight=w.getBottomRight(),this.minX=w.getMinX(),this.maxX=w.getMaxX(),this.minY=w.getMinY(),this.maxY=w.getMaxY()}static merge(w,E){return w==null?E:E==null?w:new cs(w.image,w.topLeft,w.bottomLeft,E.topRight,E.bottomRight)}addMissingRows(w,E,O){let U=this.topLeft,H=this.bottomLeft,Q=this.topRight,le=this.bottomRight;if(w>0){let ve=O?this.topLeft:this.topRight,Te=Math.trunc(ve.getY()-w);Te<0&&(Te=0);let Ze=new wt(ve.getX(),Te);O?U=Ze:Q=Ze}if(E>0){let ve=O?this.bottomLeft:this.bottomRight,Te=Math.trunc(ve.getY()+E);Te>=this.image.getHeight()&&(Te=this.image.getHeight()-1);let Ze=new wt(ve.getX(),Te);O?H=Ze:le=Ze}return new cs(this.image,U,H,Q,le)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class et{constructor(w,E,O,U){this.columnCount=w,this.errorCorrectionLevel=U,this.rowCountUpperPart=E,this.rowCountLowerPart=O,this.rowCount=E+O}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class gt{constructor(){this.buffer=""}static form(w,E){let O=-1;function U(Q,le,ve,Te,Ze,xt){if(Q==="%%")return"%";if(E[++O]===void 0)return;Q=Te?parseInt(Te.substr(1)):void 0;let _t=Ze?parseInt(Ze.substr(1)):void 0,Qt;switch(xt){case"s":Qt=E[O];break;case"c":Qt=E[O][0];break;case"f":Qt=parseFloat(E[O]).toFixed(Q);break;case"p":Qt=parseFloat(E[O]).toPrecision(Q);break;case"e":Qt=parseFloat(E[O]).toExponential(Q);break;case"x":Qt=parseInt(E[O]).toString(_t||16);break;case"d":Qt=parseFloat(parseInt(E[O],_t||10).toPrecision(Q)).toFixed(0);break}Qt=typeof Qt=="object"?JSON.stringify(Qt):(+Qt).toString(_t);let St=parseInt(ve),$t=ve&&ve[0]+""=="0"?"0":" ";for(;Qt.length<St;)Qt=le!==void 0?Qt+$t:$t+Qt;return Qt}let H=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return w.replace(H,U)}format(w,...E){this.buffer+=gt.form(w,E)}toString(){return this.buffer}}class Tn{constructor(w){this.boundingBox=new cs(w),this.codewords=new Array(w.getMaxY()-w.getMinY()+1)}getCodewordNearby(w){let E=this.getCodeword(w);if(E!=null)return E;for(let O=1;O<Tn.MAX_NEARBY_DISTANCE;O++){let U=this.imageRowToCodewordIndex(w)-O;if(U>=0&&(E=this.codewords[U],E!=null)||(U=this.imageRowToCodewordIndex(w)+O,U<this.codewords.length&&(E=this.codewords[U],E!=null)))return E}return null}imageRowToCodewordIndex(w){return w-this.boundingBox.getMinY()}setCodeword(w,E){this.codewords[this.imageRowToCodewordIndex(w)]=E}getCodeword(w){return this.codewords[this.imageRowToCodewordIndex(w)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const w=new gt;let E=0;for(const O of this.codewords){if(O==null){w.format("%3d: | %n",E++);continue}w.format("%3d: %3d|%3d%n",E++,O.getRowNumber(),O.getValue())}return w.toString()}}Tn.MAX_NEARBY_DISTANCE=5;class sr{constructor(){this.values=new Map}setValue(w){w=Math.trunc(w);let E=this.values.get(w);E==null&&(E=0),E++,this.values.set(w,E)}getValue(){let w=-1,E=new Array;for(const[O,U]of this.values.entries()){const H={getKey:()=>O,getValue:()=>U};H.getValue()>w?(w=H.getValue(),E=[],E.push(H.getKey())):H.getValue()===w&&E.push(H.getKey())}return ur.toIntArray(E)}getConfidence(w){return this.values.get(w)}}class Tr extends Tn{constructor(w,E){super(w),this._isLeft=E}setRowNumbers(){for(let w of this.getCodewords())w!=null&&w.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(w){let E=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(E,w);let O=this.getBoundingBox(),U=this._isLeft?O.getTopLeft():O.getTopRight(),H=this._isLeft?O.getBottomLeft():O.getBottomRight(),Q=this.imageRowToCodewordIndex(Math.trunc(U.getY())),le=this.imageRowToCodewordIndex(Math.trunc(H.getY())),ve=-1,Te=1,Ze=0;for(let xt=Q;xt<le;xt++){if(E[xt]==null)continue;let _t=E[xt],Qt=_t.getRowNumber()-ve;if(Qt===0)Ze++;else if(Qt===1)Te=Math.max(Te,Ze),Ze=1,ve=_t.getRowNumber();else if(Qt<0||_t.getRowNumber()>=w.getRowCount()||Qt>xt)E[xt]=null;else{let St;Te>2?St=(Te-2)*Qt:St=Qt;let $t=St>=xt;for(let Ht=1;Ht<=St&&!$t;Ht++)$t=E[xt-Ht]!=null;$t?E[xt]=null:(ve=_t.getRowNumber(),Ze=1)}}}getRowHeights(){let w=this.getBarcodeMetadata();if(w==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(w);let E=new Int32Array(w.getRowCount());for(let O of this.getCodewords())if(O!=null){let U=O.getRowNumber();if(U>=E.length)continue;E[U]++}return E}adjustIncompleteIndicatorColumnRowNumbers(w){let E=this.getBoundingBox(),O=this._isLeft?E.getTopLeft():E.getTopRight(),U=this._isLeft?E.getBottomLeft():E.getBottomRight(),H=this.imageRowToCodewordIndex(Math.trunc(O.getY())),Q=this.imageRowToCodewordIndex(Math.trunc(U.getY())),le=this.getCodewords(),ve=-1;for(let Te=H;Te<Q;Te++){if(le[Te]==null)continue;let Ze=le[Te];Ze.setRowNumberAsRowIndicatorColumn();let xt=Ze.getRowNumber()-ve;xt===0||(xt===1?ve=Ze.getRowNumber():Ze.getRowNumber()>=w.getRowCount()?le[Te]=null:ve=Ze.getRowNumber())}}getBarcodeMetadata(){let w=this.getCodewords(),E=new sr,O=new sr,U=new sr,H=new sr;for(let le of w){if(le==null)continue;le.setRowNumberAsRowIndicatorColumn();let ve=le.getValue()%30,Te=le.getRowNumber();switch(this._isLeft||(Te+=2),Te%3){case 0:O.setValue(ve*3+1);break;case 1:H.setValue(ve/3),U.setValue(ve%3);break;case 2:E.setValue(ve+1);break}}if(E.getValue().length===0||O.getValue().length===0||U.getValue().length===0||H.getValue().length===0||E.getValue()[0]<1||O.getValue()[0]+U.getValue()[0]<ur.MIN_ROWS_IN_BARCODE||O.getValue()[0]+U.getValue()[0]>ur.MAX_ROWS_IN_BARCODE)return null;let Q=new et(E.getValue()[0],O.getValue()[0],U.getValue()[0],H.getValue()[0]);return this.removeIncorrectCodewords(w,Q),Q}removeIncorrectCodewords(w,E){for(let O=0;O<w.length;O++){let U=w[O];if(w[O]==null)continue;let H=U.getValue()%30,Q=U.getRowNumber();if(Q>E.getRowCount()){w[O]=null;continue}switch(this._isLeft||(Q+=2),Q%3){case 0:H*3+1!==E.getRowCountUpperPart()&&(w[O]=null);break;case 1:(Math.trunc(H/3)!==E.getErrorCorrectionLevel()||H%3!==E.getRowCountLowerPart())&&(w[O]=null);break;case 2:H+1!==E.getColumnCount()&&(w[O]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
`+super.toString()}}class Lr{constructor(w,E){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=w,this.barcodeColumnCount=w.getColumnCount(),this.boundingBox=E,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let w=ur.MAX_CODEWORDS_IN_BARCODE,E;do E=w,w=this.adjustRowNumbersAndGetCount();while(w>0&&w<E);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(w){w!=null&&w.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let w=this.adjustRowNumbersByRow();if(w===0)return 0;for(let E=1;E<this.barcodeColumnCount+1;E++){let O=this.detectionResultColumns[E].getCodewords();for(let U=0;U<O.length;U++)O[U]!=null&&(O[U].hasValidRowNumber()||this.adjustRowNumbers(E,U,O))}return w}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let w=this.detectionResultColumns[0].getCodewords(),E=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let O=0;O<w.length;O++)if(w[O]!=null&&E[O]!=null&&w[O].getRowNumber()===E[O].getRowNumber())for(let U=1;U<=this.barcodeColumnCount;U++){let H=this.detectionResultColumns[U].getCodewords()[O];H!=null&&(H.setRowNumber(w[O].getRowNumber()),H.hasValidRowNumber()||(this.detectionResultColumns[U].getCodewords()[O]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let w=0,E=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let O=0;O<E.length;O++){if(E[O]==null)continue;let U=E[O].getRowNumber(),H=0;for(let Q=this.barcodeColumnCount+1;Q>0&&H<this.ADJUST_ROW_NUMBER_SKIP;Q--){let le=this.detectionResultColumns[Q].getCodewords()[O];le!=null&&(H=Lr.adjustRowNumberIfValid(U,H,le),le.hasValidRowNumber()||w++)}}return w}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let w=0,E=this.detectionResultColumns[0].getCodewords();for(let O=0;O<E.length;O++){if(E[O]==null)continue;let U=E[O].getRowNumber(),H=0;for(let Q=1;Q<this.barcodeColumnCount+1&&H<this.ADJUST_ROW_NUMBER_SKIP;Q++){let le=this.detectionResultColumns[Q].getCodewords()[O];le!=null&&(H=Lr.adjustRowNumberIfValid(U,H,le),le.hasValidRowNumber()||w++)}}return w}static adjustRowNumberIfValid(w,E,O){return O==null||O.hasValidRowNumber()||(O.isValidRowNumber(w)?(O.setRowNumber(w),E=0):++E),E}adjustRowNumbers(w,E,O){if(!this.detectionResultColumns[w-1])return;let U=O[E],H=this.detectionResultColumns[w-1].getCodewords(),Q=H;this.detectionResultColumns[w+1]!=null&&(Q=this.detectionResultColumns[w+1].getCodewords());let le=new Array(14);le[2]=H[E],le[3]=Q[E],E>0&&(le[0]=O[E-1],le[4]=H[E-1],le[5]=Q[E-1]),E>1&&(le[8]=O[E-2],le[10]=H[E-2],le[11]=Q[E-2]),E<O.length-1&&(le[1]=O[E+1],le[6]=H[E+1],le[7]=Q[E+1]),E<O.length-2&&(le[9]=O[E+2],le[12]=H[E+2],le[13]=Q[E+2]);for(let ve of le)if(Lr.adjustRowNumber(U,ve))return}static adjustRowNumber(w,E){return E==null?!1:E.hasValidRowNumber()&&E.getBucket()===w.getBucket()?(w.setRowNumber(E.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(w){this.boundingBox=w}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(w,E){this.detectionResultColumns[w]=E}getDetectionResultColumn(w){return this.detectionResultColumns[w]}toString(){let w=this.detectionResultColumns[0];w==null&&(w=this.detectionResultColumns[this.barcodeColumnCount+1]);let E=new gt;for(let O=0;O<w.getCodewords().length;O++){E.format("CW %3d:",O);for(let U=0;U<this.barcodeColumnCount+2;U++){if(this.detectionResultColumns[U]==null){E.format(" | ");continue}let H=this.detectionResultColumns[U].getCodewords()[O];if(H==null){E.format(" | ");continue}E.format(" %3d|%3d",H.getRowNumber(),H.getValue())}E.format("%n")}return E.toString()}}class $r{constructor(w,E,O,U){this.rowNumber=$r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(w),this.endX=Math.trunc(E),this.bucket=Math.trunc(O),this.value=Math.trunc(U)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(w){return w!==$r.BARCODE_ROW_UNKNOWN&&this.bucket===w%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(w){this.rowNumber=w}toString(){return this.rowNumber+"|"+this.value}}$r.BARCODE_ROW_UNKNOWN=-1;class lr{static initialize(){for(let w=0;w<ur.SYMBOL_TABLE.length;w++){let E=ur.SYMBOL_TABLE[w],O=E&1;for(let U=0;U<ur.BARS_IN_MODULE;U++){let H=0;for(;(E&1)===O;)H+=1,E>>=1;O=E&1,lr.RATIOS_TABLE[w]||(lr.RATIOS_TABLE[w]=new Array(ur.BARS_IN_MODULE)),lr.RATIOS_TABLE[w][ur.BARS_IN_MODULE-U-1]=Math.fround(H/ur.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(w){let E=lr.getDecodedCodewordValue(lr.sampleBitCounts(w));return E!==-1?E:lr.getClosestDecodedValue(w)}static sampleBitCounts(w){let E=pt.sum(w),O=new Int32Array(ur.BARS_IN_MODULE),U=0,H=0;for(let Q=0;Q<ur.MODULES_IN_CODEWORD;Q++){let le=E/(2*ur.MODULES_IN_CODEWORD)+Q*E/ur.MODULES_IN_CODEWORD;H+w[U]<=le&&(H+=w[U],U++),O[U]++}return O}static getDecodedCodewordValue(w){let E=lr.getBitValue(w);return ur.getCodeword(E)===-1?-1:E}static getBitValue(w){let E=0;for(let O=0;O<w.length;O++)for(let U=0;U<w[O];U++)E=E<<1|(O%2===0?1:0);return Math.trunc(E)}static getClosestDecodedValue(w){let E=pt.sum(w),O=new Array(ur.BARS_IN_MODULE);if(E>1)for(let Q=0;Q<O.length;Q++)O[Q]=Math.fround(w[Q]/E);let U=Gt.MAX_VALUE,H=-1;this.bSymbolTableReady||lr.initialize();for(let Q=0;Q<lr.RATIOS_TABLE.length;Q++){let le=0,ve=lr.RATIOS_TABLE[Q];for(let Te=0;Te<ur.BARS_IN_MODULE;Te++){let Ze=Math.fround(ve[Te]-O[Te]);if(le+=Math.fround(Ze*Ze),le>=U)break}le<U&&(U=le,H=ur.SYMBOL_TABLE[Q])}return H}}lr.bSymbolTableReady=!1,lr.RATIOS_TABLE=new Array(ur.SYMBOL_TABLE.length).map(ft=>new Array(ur.BARS_IN_MODULE));class wr{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(w){this.segmentIndex=w}getFileId(){return this.fileId}setFileId(w){this.fileId=w}getOptionalData(){return this.optionalData}setOptionalData(w){this.optionalData=w}isLastSegment(){return this.lastSegment}setLastSegment(w){this.lastSegment=w}getSegmentCount(){return this.segmentCount}setSegmentCount(w){this.segmentCount=w}getSender(){return this.sender||null}setSender(w){this.sender=w}getAddressee(){return this.addressee||null}setAddressee(w){this.addressee=w}getFileName(){return this.fileName}setFileName(w){this.fileName=w}getFileSize(){return this.fileSize}setFileSize(w){this.fileSize=w}getChecksum(){return this.checksum}setChecksum(w){this.checksum=w}getTimestamp(){return this.timestamp}setTimestamp(w){this.timestamp=w}}class ss{static parseLong(w,E=void 0){return parseInt(w,E)}}class mr extends u{}mr.kind="NullPointerException";class es{writeBytes(w){this.writeBytesOffset(w,0,w.length)}writeBytesOffset(w,E,O){if(w==null)throw new mr;if(E<0||E>w.length||O<0||E+O>w.length||E+O<0)throw new C;if(O===0)return;for(let U=0;U<O;U++)this.write(w[E+U])}flush(){}close(){}}class Ys extends u{}class _s extends es{constructor(w=32){if(super(),this.count=0,w<0)throw new f("Negative initial size: "+w);this.buf=new Uint8Array(w)}ensureCapacity(w){w-this.buf.length>0&&this.grow(w)}grow(w){let O=this.buf.length<<1;if(O-w<0&&(O=w),O<0){if(w<0)throw new Ys;O=T.MAX_VALUE}this.buf=P.copyOfUint8Array(this.buf,O)}write(w){this.ensureCapacity(this.count+1),this.buf[this.count]=w,this.count+=1}writeBytesOffset(w,E,O){if(E<0||E>w.length||O<0||E+O-w.length>0)throw new C;this.ensureCapacity(this.count+O),v.arraycopy(w,E,this.buf,this.count,O),this.count+=O}writeTo(w){w.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return P.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(w){return w?typeof w=="string"?this.toString_string(w):this.toString_number(w):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(w){return new String(this.buf).toString()}toString_number(w){return new String(this.buf).toString()}close(){}}var br;(function(ft){ft[ft.ALPHA=0]="ALPHA",ft[ft.LOWER=1]="LOWER",ft[ft.MIXED=2]="MIXED",ft[ft.PUNCT=3]="PUNCT",ft[ft.ALPHA_SHIFT=4]="ALPHA_SHIFT",ft[ft.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(br||(br={}));function zt(){if(typeof window<"u")return window.BigInt||null;if(typeof Ru<"u")return Ru.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let he;function it(ft){if(typeof he>"u"&&(he=zt()),he===null)throw new Error("BigInt is not supported!");return he(ft)}function Ct(){let ft=[];ft[0]=it(1);let w=it(900);ft[1]=w;for(let E=2;E<16;E++)ft[E]=ft[E-1]*w;return ft}class vt{static decode(w,E){let O=new te(""),U=X.ISO8859_1;O.enableDecoding(U);let H=1,Q=w[H++],le=new wr;for(;H<w[0];){switch(Q){case vt.TEXT_COMPACTION_MODE_LATCH:H=vt.textCompaction(w,H,O);break;case vt.BYTE_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH_6:H=vt.byteCompaction(Q,w,U,H,O);break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:O.append(w[H++]);break;case vt.NUMERIC_COMPACTION_MODE_LATCH:H=vt.numericCompaction(w,H,O);break;case vt.ECI_CHARSET:X.getCharacterSetECIByValue(w[H++]);break;case vt.ECI_GENERAL_PURPOSE:H+=2;break;case vt.ECI_USER_DEFINED:H++;break;case vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:H=vt.decodeMacroBlock(w,H,le);break;case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case vt.MACRO_PDF417_TERMINATOR:throw new L;default:H--,H=vt.textCompaction(w,H,O);break}if(H<w.length)Q=w[H++];else throw L.getFormatInstance()}if(O.length()===0)throw L.getFormatInstance();let ve=new Ie(null,O.toString(),null,E);return ve.setOther(le),ve}static decodeMacroBlock(w,E,O){if(E+vt.NUMBER_OF_SEQUENCE_CODEWORDS>w[0])throw L.getFormatInstance();let U=new Int32Array(vt.NUMBER_OF_SEQUENCE_CODEWORDS);for(let le=0;le<vt.NUMBER_OF_SEQUENCE_CODEWORDS;le++,E++)U[le]=w[E];O.setSegmentIndex(T.parseInt(vt.decodeBase900toBase10(U,vt.NUMBER_OF_SEQUENCE_CODEWORDS)));let H=new te;E=vt.textCompaction(w,E,H),O.setFileId(H.toString());let Q=-1;for(w[E]===vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(Q=E+1);E<w[0];)switch(w[E]){case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(E++,w[E]){case vt.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let le=new te;E=vt.textCompaction(w,E+1,le),O.setFileName(le.toString());break;case vt.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let ve=new te;E=vt.textCompaction(w,E+1,ve),O.setSender(ve.toString());break;case vt.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let Te=new te;E=vt.textCompaction(w,E+1,Te),O.setAddressee(Te.toString());break;case vt.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let Ze=new te;E=vt.numericCompaction(w,E+1,Ze),O.setSegmentCount(T.parseInt(Ze.toString()));break;case vt.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let xt=new te;E=vt.numericCompaction(w,E+1,xt),O.setTimestamp(ss.parseLong(xt.toString()));break;case vt.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let _t=new te;E=vt.numericCompaction(w,E+1,_t),O.setChecksum(T.parseInt(_t.toString()));break;case vt.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let Qt=new te;E=vt.numericCompaction(w,E+1,Qt),O.setFileSize(ss.parseLong(Qt.toString()));break;default:throw L.getFormatInstance()}break;case vt.MACRO_PDF417_TERMINATOR:E++,O.setLastSegment(!0);break;default:throw L.getFormatInstance()}if(Q!==-1){let le=E-Q;O.isLastSegment()&&le--,O.setOptionalData(P.copyOfRange(w,Q,Q+le))}return E}static textCompaction(w,E,O){let U=new Int32Array((w[0]-E)*2),H=new Int32Array((w[0]-E)*2),Q=0,le=!1;for(;E<w[0]&&!le;){let ve=w[E++];if(ve<vt.TEXT_COMPACTION_MODE_LATCH)U[Q]=ve/30,U[Q+1]=ve%30,Q+=2;else switch(ve){case vt.TEXT_COMPACTION_MODE_LATCH:U[Q++]=vt.TEXT_COMPACTION_MODE_LATCH;break;case vt.BYTE_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH_6:case vt.NUMERIC_COMPACTION_MODE_LATCH:case vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case vt.MACRO_PDF417_TERMINATOR:E--,le=!0;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U[Q]=vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,ve=w[E++],H[Q]=ve,Q++;break}}return vt.decodeTextCompaction(U,H,Q,O),E}static decodeTextCompaction(w,E,O,U){let H=br.ALPHA,Q=br.ALPHA,le=0;for(;le<O;){let ve=w[le],Te="";switch(H){case br.ALPHA:if(ve<26)Te=String.fromCharCode(65+ve);else switch(ve){case 26:Te=" ";break;case vt.LL:H=br.LOWER;break;case vt.ML:H=br.MIXED;break;case vt.PS:Q=H,H=br.PUNCT_SHIFT;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[le]);break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.LOWER:if(ve<26)Te=String.fromCharCode(97+ve);else switch(ve){case 26:Te=" ";break;case vt.AS:Q=H,H=br.ALPHA_SHIFT;break;case vt.ML:H=br.MIXED;break;case vt.PS:Q=H,H=br.PUNCT_SHIFT;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[le]);break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.MIXED:if(ve<vt.PL)Te=vt.MIXED_CHARS[ve];else switch(ve){case vt.PL:H=br.PUNCT;break;case 26:Te=" ";break;case vt.LL:H=br.LOWER;break;case vt.AL:H=br.ALPHA;break;case vt.PS:Q=H,H=br.PUNCT_SHIFT;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[le]);break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.PUNCT:if(ve<vt.PAL)Te=vt.PUNCT_CHARS[ve];else switch(ve){case vt.PAL:H=br.ALPHA;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[le]);break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.ALPHA_SHIFT:if(H=Q,ve<26)Te=String.fromCharCode(65+ve);else switch(ve){case 26:Te=" ";break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break;case br.PUNCT_SHIFT:if(H=Q,ve<vt.PAL)Te=vt.PUNCT_CHARS[ve];else switch(ve){case vt.PAL:H=br.ALPHA;break;case vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:U.append(E[le]);break;case vt.TEXT_COMPACTION_MODE_LATCH:H=br.ALPHA;break}break}Te!==""&&U.append(Te),le++}}static byteCompaction(w,E,O,U,H){let Q=new _s,le=0,ve=0,Te=!1;switch(w){case vt.BYTE_COMPACTION_MODE_LATCH:let Ze=new Int32Array(6),xt=E[U++];for(;U<E[0]&&!Te;)switch(Ze[le++]=xt,ve=900*ve+xt,xt=E[U++],xt){case vt.TEXT_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH:case vt.NUMERIC_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH_6:case vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case vt.MACRO_PDF417_TERMINATOR:U--,Te=!0;break;default:if(le%5===0&&le>0){for(let _t=0;_t<6;++_t)Q.write(Number(it(ve)>>it(8*(5-_t))));ve=0,le=0}break}U===E[0]&&xt<vt.TEXT_COMPACTION_MODE_LATCH&&(Ze[le++]=xt);for(let _t=0;_t<le;_t++)Q.write(Ze[_t]);break;case vt.BYTE_COMPACTION_MODE_LATCH_6:for(;U<E[0]&&!Te;){let _t=E[U++];if(_t<vt.TEXT_COMPACTION_MODE_LATCH)le++,ve=900*ve+_t;else switch(_t){case vt.TEXT_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH:case vt.NUMERIC_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH_6:case vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case vt.MACRO_PDF417_TERMINATOR:U--,Te=!0;break}if(le%5===0&&le>0){for(let Qt=0;Qt<6;++Qt)Q.write(Number(it(ve)>>it(8*(5-Qt))));ve=0,le=0}}break}return H.append(J.decode(Q.toByteArray(),O)),U}static numericCompaction(w,E,O){let U=0,H=!1,Q=new Int32Array(vt.MAX_NUMERIC_CODEWORDS);for(;E<w[0]&&!H;){let le=w[E++];if(E===w[0]&&(H=!0),le<vt.TEXT_COMPACTION_MODE_LATCH)Q[U]=le,U++;else switch(le){case vt.TEXT_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH:case vt.BYTE_COMPACTION_MODE_LATCH_6:case vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case vt.MACRO_PDF417_TERMINATOR:E--,H=!0;break}(U%vt.MAX_NUMERIC_CODEWORDS===0||le===vt.NUMERIC_COMPACTION_MODE_LATCH||H)&&U>0&&(O.append(vt.decodeBase900toBase10(Q,U)),U=0)}return E}static decodeBase900toBase10(w,E){let O=it(0);for(let H=0;H<E;H++)O+=vt.EXP900[E-H-1]*it(w[H]);let U=O.toString();if(U.charAt(0)!=="1")throw new L;return U.substring(1)}}vt.TEXT_COMPACTION_MODE_LATCH=900,vt.BYTE_COMPACTION_MODE_LATCH=901,vt.NUMERIC_COMPACTION_MODE_LATCH=902,vt.BYTE_COMPACTION_MODE_LATCH_6=924,vt.ECI_USER_DEFINED=925,vt.ECI_GENERAL_PURPOSE=926,vt.ECI_CHARSET=927,vt.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,vt.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,vt.MACRO_PDF417_TERMINATOR=922,vt.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,vt.MAX_NUMERIC_CODEWORDS=15,vt.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,vt.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,vt.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,vt.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,vt.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,vt.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,vt.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,vt.PL=25,vt.LL=27,vt.AS=27,vt.ML=28,vt.AL=28,vt.PS=29,vt.PAL=29,vt.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
-.$/"|*()?{}'`,vt.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",vt.EXP900=zt()?Ct():[],vt.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ln{constructor(){}static decode(w,E,O,U,H,Q,le){let ve=new cs(w,E,O,U,H),Te=null,Ze=null,xt;for(let St=!0;;St=!1){if(E!=null&&(Te=ln.getRowIndicatorColumn(w,ve,E,!0,Q,le)),U!=null&&(Ze=ln.getRowIndicatorColumn(w,ve,U,!1,Q,le)),xt=ln.merge(Te,Ze),xt==null)throw q.getNotFoundInstance();let $t=xt.getBoundingBox();if(St&&$t!=null&&($t.getMinY()<ve.getMinY()||$t.getMaxY()>ve.getMaxY()))ve=$t;else break}xt.setBoundingBox(ve);let _t=xt.getBarcodeColumnCount()+1;xt.setDetectionResultColumn(0,Te),xt.setDetectionResultColumn(_t,Ze);let Qt=Te!=null;for(let St=1;St<=_t;St++){let $t=Qt?St:_t-St;if(xt.getDetectionResultColumn($t)!==void 0)continue;let Ht;$t===0||$t===_t?Ht=new Tr(ve,$t===0):Ht=new Tn(ve),xt.setDetectionResultColumn($t,Ht);let jn=-1,xr=jn;for(let Nr=ve.getMinY();Nr<=ve.getMaxY();Nr++){if(jn=ln.getStartColumn(xt,$t,Nr,Qt),jn<0||jn>ve.getMaxX()){if(xr===-1)continue;jn=xr}let jr=ln.detectCodeword(w,ve.getMinX(),ve.getMaxX(),Qt,jn,Nr,Q,le);jr!=null&&(Ht.setCodeword(Nr,jr),xr=jn,Q=Math.min(Q,jr.getWidth()),le=Math.max(le,jr.getWidth()))}}return ln.createDecoderResult(xt)}static merge(w,E){if(w==null&&E==null)return null;let O=ln.getBarcodeMetadata(w,E);if(O==null)return null;let U=cs.merge(ln.adjustBoundingBox(w),ln.adjustBoundingBox(E));return new Lr(O,U)}static adjustBoundingBox(w){if(w==null)return null;let E=w.getRowHeights();if(E==null)return null;let O=ln.getMax(E),U=0;for(let le of E)if(U+=O-le,le>0)break;let H=w.getCodewords();for(let le=0;U>0&&H[le]==null;le++)U--;let Q=0;for(let le=E.length-1;le>=0&&(Q+=O-E[le],!(E[le]>0));le--);for(let le=H.length-1;Q>0&&H[le]==null;le--)Q--;return w.getBoundingBox().addMissingRows(U,Q,w.isLeft())}static getMax(w){let E=-1;for(let O of w)E=Math.max(E,O);return E}static getBarcodeMetadata(w,E){let O;if(w==null||(O=w.getBarcodeMetadata())==null)return E==null?null:E.getBarcodeMetadata();let U;return E==null||(U=E.getBarcodeMetadata())==null?O:O.getColumnCount()!==U.getColumnCount()&&O.getErrorCorrectionLevel()!==U.getErrorCorrectionLevel()&&O.getRowCount()!==U.getRowCount()?null:O}static getRowIndicatorColumn(w,E,O,U,H,Q){let le=new Tr(E,U);for(let ve=0;ve<2;ve++){let Te=ve===0?1:-1,Ze=Math.trunc(Math.trunc(O.getX()));for(let xt=Math.trunc(Math.trunc(O.getY()));xt<=E.getMaxY()&&xt>=E.getMinY();xt+=Te){let _t=ln.detectCodeword(w,0,w.getWidth(),U,Ze,xt,H,Q);_t!=null&&(le.setCodeword(xt,_t),U?Ze=_t.getStartX():Ze=_t.getEndX())}}return le}static adjustCodewordCount(w,E){let O=E[0][1],U=O.getValue(),H=w.getBarcodeColumnCount()*w.getBarcodeRowCount()-ln.getNumberOfECCodeWords(w.getBarcodeECLevel());if(U.length===0){if(H<1||H>ur.MAX_CODEWORDS_IN_BARCODE)throw q.getNotFoundInstance();O.setValue(H)}else U[0]!==H&&O.setValue(H)}static createDecoderResult(w){let E=ln.createBarcodeMatrix(w);ln.adjustCodewordCount(w,E);let O=new Array,U=new Int32Array(w.getBarcodeRowCount()*w.getBarcodeColumnCount()),H=[],Q=new Array;for(let ve=0;ve<w.getBarcodeRowCount();ve++)for(let Te=0;Te<w.getBarcodeColumnCount();Te++){let Ze=E[ve][Te+1].getValue(),xt=ve*w.getBarcodeColumnCount()+Te;Ze.length===0?O.push(xt):Ze.length===1?U[xt]=Ze[0]:(Q.push(xt),H.push(Ze))}let le=new Array(H.length);for(let ve=0;ve<le.length;ve++)le[ve]=H[ve];return ln.createDecoderResultFromAmbiguousValues(w.getBarcodeECLevel(),U,ur.toIntArray(O),ur.toIntArray(Q),le)}static createDecoderResultFromAmbiguousValues(w,E,O,U,H){let Q=new Int32Array(U.length),le=100;for(;le-- >0;){for(let ve=0;ve<Q.length;ve++)E[U[ve]]=H[ve][Q[ve]];try{return ln.decodeCodewords(E,w,O)}catch(ve){if(!(ve instanceof g))throw ve}if(Q.length===0)throw g.getChecksumInstance();for(let ve=0;ve<Q.length;ve++)if(Q[ve]<H[ve].length-1){Q[ve]++;break}else if(Q[ve]=0,ve===Q.length-1)throw g.getChecksumInstance()}throw g.getChecksumInstance()}static createBarcodeMatrix(w){let E=Array.from({length:w.getBarcodeRowCount()},()=>new Array(w.getBarcodeColumnCount()+2));for(let U=0;U<E.length;U++)for(let H=0;H<E[U].length;H++)E[U][H]=new sr;let O=0;for(let U of w.getDetectionResultColumns()){if(U!=null){for(let H of U.getCodewords())if(H!=null){let Q=H.getRowNumber();if(Q>=0){if(Q>=E.length)continue;E[Q][O].setValue(H.getValue())}}}O++}return E}static isValidBarcodeColumn(w,E){return E>=0&&E<=w.getBarcodeColumnCount()+1}static getStartColumn(w,E,O,U){let H=U?1:-1,Q=null;if(ln.isValidBarcodeColumn(w,E-H)&&(Q=w.getDetectionResultColumn(E-H).getCodeword(O)),Q!=null)return U?Q.getEndX():Q.getStartX();if(Q=w.getDetectionResultColumn(E).getCodewordNearby(O),Q!=null)return U?Q.getStartX():Q.getEndX();if(ln.isValidBarcodeColumn(w,E-H)&&(Q=w.getDetectionResultColumn(E-H).getCodewordNearby(O)),Q!=null)return U?Q.getEndX():Q.getStartX();let le=0;for(;ln.isValidBarcodeColumn(w,E-H);){E-=H;for(let ve of w.getDetectionResultColumn(E).getCodewords())if(ve!=null)return(U?ve.getEndX():ve.getStartX())+H*le*(ve.getEndX()-ve.getStartX());le++}return U?w.getBoundingBox().getMinX():w.getBoundingBox().getMaxX()}static detectCodeword(w,E,O,U,H,Q,le,ve){H=ln.adjustCodewordStartColumn(w,E,O,U,H,Q);let Te=ln.getModuleBitCount(w,E,O,U,H,Q);if(Te==null)return null;let Ze,xt=pt.sum(Te);if(U)Ze=H+xt;else{for(let St=0;St<Te.length/2;St++){let $t=Te[St];Te[St]=Te[Te.length-1-St],Te[Te.length-1-St]=$t}Ze=H,H=Ze-xt}if(!ln.checkCodewordSkew(xt,le,ve))return null;let _t=lr.getDecodedValue(Te),Qt=ur.getCodeword(_t);return Qt===-1?null:new $r(H,Ze,ln.getCodewordBucketNumber(_t),Qt)}static getModuleBitCount(w,E,O,U,H,Q){let le=H,ve=new Int32Array(8),Te=0,Ze=U?1:-1,xt=U;for(;(U?le<O:le>=E)&&Te<ve.length;)w.get(le,Q)===xt?(ve[Te]++,le+=Ze):(Te++,xt=!xt);return Te===ve.length||le===(U?O:E)&&Te===ve.length-1?ve:null}static getNumberOfECCodeWords(w){return 2<<w}static adjustCodewordStartColumn(w,E,O,U,H,Q){let le=H,ve=U?-1:1;for(let Te=0;Te<2;Te++){for(;(U?le>=E:le<O)&&U===w.get(le,Q);){if(Math.abs(H-le)>ln.CODEWORD_SKEW_SIZE)return H;le+=ve}ve=-ve,U=!U}return le}static checkCodewordSkew(w,E,O){return E-ln.CODEWORD_SKEW_SIZE<=w&&w<=O+ln.CODEWORD_SKEW_SIZE}static decodeCodewords(w,E,O){if(w.length===0)throw L.getFormatInstance();let U=1<<E+1,H=ln.correctErrors(w,O,U);ln.verifyCodewordCount(w,U);let Q=vt.decode(w,""+E);return Q.setErrorsCorrected(H),Q.setErasures(O.length),Q}static correctErrors(w,E,O){if(E!=null&&E.length>O/2+ln.MAX_ERRORS||O<0||O>ln.MAX_EC_CODEWORDS)throw g.getChecksumInstance();return ln.errorCorrection.decode(w,O,E)}static verifyCodewordCount(w,E){if(w.length<4)throw L.getFormatInstance();let O=w[0];if(O>w.length)throw L.getFormatInstance();if(O===0)if(E<w.length)w[0]=w.length-E;else throw L.getFormatInstance()}static getBitCountForCodeword(w){let E=new Int32Array(8),O=0,U=E.length-1;for(;!((w&1)!==O&&(O=w&1,U--,U<0));)E[U]++,w>>=1;return E}static getCodewordBucketNumber(w){return w instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(w):this.getCodewordBucketNumber_number(w)}static getCodewordBucketNumber_number(w){return ln.getCodewordBucketNumber(ln.getBitCountForCodeword(w))}static getCodewordBucketNumber_Int32Array(w){return(w[0]-w[2]+w[4]-w[6]+9)%9}static toString(w){let E=new gt;for(let O=0;O<w.length;O++){E.format("Row %2d: ",O);for(let U=0;U<w[O].length;U++){let H=w[O][U];H.getValue().length===0?E.format(" ",null):E.format("%4d(%2d)",H.getValue()[0],H.getConfidence(H.getValue()[0]))}E.format("%n")}return E.toString()}}ln.CODEWORD_SKEW_SIZE=2,ln.MAX_ERRORS=3,ln.MAX_EC_CODEWORDS=512,ln.errorCorrection=new ls;class xn{decode(w,E=null){let O=xn.decode(w,E,!1);if(O==null||O.length===0||O[0]==null)throw q.getNotFoundInstance();return O[0]}decodeMultiple(w,E=null){try{return xn.decode(w,E,!0)}catch(O){throw O instanceof L||O instanceof g?q.getNotFoundInstance():O}}static decode(w,E,O){const U=new Array,H=Bn.detectMultiple(w,E,O);for(const Q of H.getPoints()){const le=ln.decode(H.getBits(),Q[4],Q[5],Q[6],Q[7],xn.getMinCodewordWidth(Q),xn.getMaxCodewordWidth(Q)),ve=new me(le.getText(),le.getRawBytes(),void 0,Q,xe.PDF_417);ve.putMetadata(je.ERROR_CORRECTION_LEVEL,le.getECLevel());const Te=le.getOther();Te!=null&&ve.putMetadata(je.PDF417_EXTRA_METADATA,Te),U.push(ve)}return U.map(Q=>Q)}static getMaxWidth(w,E){return w==null||E==null?0:Math.trunc(Math.abs(w.getX()-E.getX()))}static getMinWidth(w,E){return w==null||E==null?T.MAX_VALUE:Math.trunc(Math.abs(w.getX()-E.getX()))}static getMaxCodewordWidth(w){return Math.floor(Math.max(Math.max(xn.getMaxWidth(w[0],w[4]),xn.getMaxWidth(w[6],w[2])*ur.MODULES_IN_CODEWORD/ur.MODULES_IN_STOP_PATTERN),Math.max(xn.getMaxWidth(w[1],w[5]),xn.getMaxWidth(w[7],w[3])*ur.MODULES_IN_CODEWORD/ur.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(w){return Math.floor(Math.min(Math.min(xn.getMinWidth(w[0],w[4]),xn.getMinWidth(w[6],w[2])*ur.MODULES_IN_CODEWORD/ur.MODULES_IN_STOP_PATTERN),Math.min(xn.getMinWidth(w[1],w[5]),xn.getMinWidth(w[7],w[3])*ur.MODULES_IN_CODEWORD/ur.MODULES_IN_STOP_PATTERN)))}reset(){}}class dr extends u{}dr.kind="ReaderException";class Er{constructor(w,E){this.verbose=w===!0,E&&this.setHints(E)}decode(w,E){return E&&this.setHints(E),this.decodeInternal(w)}decodeWithState(w){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(w)}setHints(w){this.hints=w;const E=!r(w)&&w.get($.TRY_HARDER)===!0,O=r(w)?null:w.get($.POSSIBLE_FORMATS),U=new Array;if(!r(O)){const H=O.some(Q=>Q===xe.UPC_A||Q===xe.UPC_E||Q===xe.EAN_13||Q===xe.EAN_8||Q===xe.CODABAR||Q===xe.CODE_39||Q===xe.CODE_93||Q===xe.CODE_128||Q===xe.ITF||Q===xe.RSS_14||Q===xe.RSS_EXPANDED);H&&!E&&U.push(new k(w,this.verbose)),O.includes(xe.QR_CODE)&&U.push(new Sr),O.includes(xe.DATA_MATRIX)&&U.push(new Fe),O.includes(xe.AZTEC)&&U.push(new hn),O.includes(xe.PDF_417)&&U.push(new xn),H&&E&&U.push(new k(w,this.verbose))}U.length===0&&(E||U.push(new k(w,this.verbose)),U.push(new Sr),U.push(new Fe),U.push(new hn),U.push(new xn),E&&U.push(new k(w,this.verbose))),this.readers=U}reset(){if(this.readers!==null)for(const w of this.readers)w.reset()}decodeInternal(w){if(this.readers===null)throw new dr("No readers where selected, nothing can be read.");for(const E of this.readers)try{return E.decode(w,this.hints)}catch(O){if(O instanceof dr)continue}throw new q("No MultiFormat Readers were able to detect the code.")}}class pr extends Ce{constructor(w=null,E=500){const O=new Er;O.setHints(w),super(O,E)}decodeBitmap(w){return this.reader.decodeWithState(w)}}class fr extends Ce{constructor(w=500){super(new xn,w)}}class Yr extends Ce{constructor(w=500){super(new Sr,w)}}var is;(function(ft){ft[ft.ERROR_CORRECTION=0]="ERROR_CORRECTION",ft[ft.CHARACTER_SET=1]="CHARACTER_SET",ft[ft.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",ft[ft.MIN_SIZE=3]="MIN_SIZE",ft[ft.MAX_SIZE=4]="MAX_SIZE",ft[ft.MARGIN=5]="MARGIN",ft[ft.PDF417_COMPACT=6]="PDF417_COMPACT",ft[ft.PDF417_COMPACTION=7]="PDF417_COMPACTION",ft[ft.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",ft[ft.AZTEC_LAYERS=9]="AZTEC_LAYERS",ft[ft.QR_VERSION=10]="QR_VERSION"})(is||(is={}));var Ir=is;class yr{constructor(w){this.field=w,this.cachedGenerators=[],this.cachedGenerators.push(new Qe(w,Int32Array.from([1])))}buildGenerator(w){const E=this.cachedGenerators;if(w>=E.length){let O=E[E.length-1];const U=this.field;for(let H=E.length;H<=w;H++){const Q=O.multiply(new Qe(U,Int32Array.from([1,U.exp(H-1+U.getGeneratorBase())])));E.push(Q),O=Q}}return E[w]}encode(w,E){if(E===0)throw new f("No error correction bytes");const O=w.length-E;if(O<=0)throw new f("No data bytes provided");const U=this.buildGenerator(E),H=new Int32Array(O);v.arraycopy(w,0,H,0,O);let Q=new Qe(this.field,H);Q=Q.multiplyByMonomial(E,1);const ve=Q.divide(U)[1].getCoefficients(),Te=E-ve.length;for(let Ze=0;Ze<Te;Ze++)w[O+Ze]=0;v.arraycopy(ve,0,w,O+Te,ve.length)}}class Jn{constructor(){}static applyMaskPenaltyRule1(w){return Jn.applyMaskPenaltyRule1Internal(w,!0)+Jn.applyMaskPenaltyRule1Internal(w,!1)}static applyMaskPenaltyRule2(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let Q=0;Q<H-1;Q++){const le=O[Q];for(let ve=0;ve<U-1;ve++){const Te=le[ve];Te===le[ve+1]&&Te===O[Q+1][ve]&&Te===O[Q+1][ve+1]&&E++}}return Jn.N2*E}static applyMaskPenaltyRule3(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let Q=0;Q<H;Q++)for(let le=0;le<U;le++){const ve=O[Q];le+6<U&&ve[le]===1&&ve[le+1]===0&&ve[le+2]===1&&ve[le+3]===1&&ve[le+4]===1&&ve[le+5]===0&&ve[le+6]===1&&(Jn.isWhiteHorizontal(ve,le-4,le)||Jn.isWhiteHorizontal(ve,le+7,le+11))&&E++,Q+6<H&&O[Q][le]===1&&O[Q+1][le]===0&&O[Q+2][le]===1&&O[Q+3][le]===1&&O[Q+4][le]===1&&O[Q+5][le]===0&&O[Q+6][le]===1&&(Jn.isWhiteVertical(O,le,Q-4,Q)||Jn.isWhiteVertical(O,le,Q+7,Q+11))&&E++}return E*Jn.N3}static isWhiteHorizontal(w,E,O){E=Math.max(E,0),O=Math.min(O,w.length);for(let U=E;U<O;U++)if(w[U]===1)return!1;return!0}static isWhiteVertical(w,E,O,U){O=Math.max(O,0),U=Math.min(U,w.length);for(let H=O;H<U;H++)if(w[H][E]===1)return!1;return!0}static applyMaskPenaltyRule4(w){let E=0;const O=w.getArray(),U=w.getWidth(),H=w.getHeight();for(let ve=0;ve<H;ve++){const Te=O[ve];for(let Ze=0;Ze<U;Ze++)Te[Ze]===1&&E++}const Q=w.getHeight()*w.getWidth();return Math.floor(Math.abs(E*2-Q)*10/Q)*Jn.N4}static getDataMaskBit(w,E,O){let U,H;switch(w){case 0:U=O+E&1;break;case 1:U=O&1;break;case 2:U=E%3;break;case 3:U=(O+E)%3;break;case 4:U=Math.floor(O/2)+Math.floor(E/3)&1;break;case 5:H=O*E,U=(H&1)+H%3;break;case 6:H=O*E,U=(H&1)+H%3&1;break;case 7:H=O*E,U=H%3+(O+E&1)&1;break;default:throw new f("Invalid mask pattern: "+w)}return U===0}static applyMaskPenaltyRule1Internal(w,E){let O=0;const U=E?w.getHeight():w.getWidth(),H=E?w.getWidth():w.getHeight(),Q=w.getArray();for(let le=0;le<U;le++){let ve=0,Te=-1;for(let Ze=0;Ze<H;Ze++){const xt=E?Q[le][Ze]:Q[Ze][le];xt===Te?ve++:(ve>=5&&(O+=Jn.N1+(ve-5)),ve=1,Te=xt)}ve>=5&&(O+=Jn.N1+(ve-5))}return O}}Jn.N1=3,Jn.N2=3,Jn.N3=40,Jn.N4=10;class gs{constructor(w,E){this.width=w,this.height=E;const O=new Array(E);for(let U=0;U!==E;U++)O[U]=new Uint8Array(w);this.bytes=O}getHeight(){return this.height}getWidth(){return this.width}get(w,E){return this.bytes[E][w]}getArray(){return this.bytes}setNumber(w,E,O){this.bytes[E][w]=O}setBoolean(w,E,O){this.bytes[E][w]=O?1:0}clear(w){for(const E of this.bytes)P.fill(E,w)}equals(w){if(!(w instanceof gs))return!1;const E=w;if(this.width!==E.width||this.height!==E.height)return!1;for(let O=0,U=this.height;O<U;++O){const H=this.bytes[O],Q=E.bytes[O];for(let le=0,ve=this.width;le<ve;++le)if(H[le]!==Q[le])return!1}return!0}toString(){const w=new te;for(let E=0,O=this.height;E<O;++E){const U=this.bytes[E];for(let H=0,Q=this.width;H<Q;++H)switch(U[H]){case 0:w.append(" 0");break;case 1:w.append(" 1");break;default:w.append(" ");break}w.append(`
`)}return w.toString()}}class Zs{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const w=new te;return w.append(`<<
`),w.append(" mode: "),w.append(this.mode?this.mode.toString():"null"),w.append(`
ecLevel: `),w.append(this.ecLevel?this.ecLevel.toString():"null"),w.append(`
version: `),w.append(this.version?this.version.toString():"null"),w.append(`
maskPattern: `),w.append(this.maskPattern.toString()),this.matrix?(w.append(`
matrix:
`),w.append(this.matrix.toString())):w.append(`
matrix: null
`),w.append(`>>
`),w.toString()}setMode(w){this.mode=w}setECLevel(w){this.ecLevel=w}setVersion(w){this.version=w}setMaskPattern(w){this.maskPattern=w}setMatrix(w){this.matrix=w}static isValidMaskPattern(w){return w>=0&&w<Zs.NUM_MASK_PATTERNS}}Zs.NUM_MASK_PATTERNS=8;class oi extends u{}oi.kind="WriterException";class Fr{constructor(){}static clearMatrix(w){w.clear(255)}static buildMatrix(w,E,O,U,H){Fr.clearMatrix(H),Fr.embedBasicPatterns(O,H),Fr.embedTypeInfo(E,U,H),Fr.maybeEmbedVersionInfo(O,H),Fr.embedDataBits(w,U,H)}static embedBasicPatterns(w,E){Fr.embedPositionDetectionPatternsAndSeparators(E),Fr.embedDarkDotAtLeftBottomCorner(E),Fr.maybeEmbedPositionAdjustmentPatterns(w,E),Fr.embedTimingPatterns(E)}static embedTypeInfo(w,E,O){const U=new M;Fr.makeTypeInfoBits(w,E,U);for(let H=0,Q=U.getSize();H<Q;++H){const le=U.get(U.getSize()-1-H),ve=Fr.TYPE_INFO_COORDINATES[H],Te=ve[0],Ze=ve[1];if(O.setBoolean(Te,Ze,le),H<8){const xt=O.getWidth()-H-1;O.setBoolean(xt,8,le)}else{const _t=O.getHeight()-7+(H-8);O.setBoolean(8,_t,le)}}}static maybeEmbedVersionInfo(w,E){if(w.getVersionNumber()<7)return;const O=new M;Fr.makeVersionInfoBits(w,O);let U=6*3-1;for(let H=0;H<6;++H)for(let Q=0;Q<3;++Q){const le=O.get(U);U--,E.setBoolean(H,E.getHeight()-11+Q,le),E.setBoolean(E.getHeight()-11+Q,H,le)}}static embedDataBits(w,E,O){let U=0,H=-1,Q=O.getWidth()-1,le=O.getHeight()-1;for(;Q>0;){for(Q===6&&(Q-=1);le>=0&&le<O.getHeight();){for(let ve=0;ve<2;++ve){const Te=Q-ve;if(!Fr.isEmpty(O.get(Te,le)))continue;let Ze;U<w.getSize()?(Ze=w.get(U),++U):Ze=!1,E!==255&&Jn.getDataMaskBit(E,Te,le)&&(Ze=!Ze),O.setBoolean(Te,le,Ze)}le+=H}H=-H,le+=H,Q-=2}if(U!==w.getSize())throw new oi("Not all bits consumed: "+U+"/"+w.getSize())}static findMSBSet(w){return 32-T.numberOfLeadingZeros(w)}static calculateBCHCode(w,E){if(E===0)throw new f("0 polynomial");const O=Fr.findMSBSet(E);for(w<<=O-1;Fr.findMSBSet(w)>=O;)w^=E<<Fr.findMSBSet(w)-O;return w}static makeTypeInfoBits(w,E,O){if(!Zs.isValidMaskPattern(E))throw new oi("Invalid mask pattern");const U=w.getBits()<<3|E;O.appendBits(U,5);const H=Fr.calculateBCHCode(U,Fr.TYPE_INFO_POLY);O.appendBits(H,10);const Q=new M;if(Q.appendBits(Fr.TYPE_INFO_MASK_PATTERN,15),O.xor(Q),O.getSize()!==15)throw new oi("should not happen but we got: "+O.getSize())}static makeVersionInfoBits(w,E){E.appendBits(w.getVersionNumber(),6);const O=Fr.calculateBCHCode(w.getVersionNumber(),Fr.VERSION_INFO_POLY);if(E.appendBits(O,12),E.getSize()!==18)throw new oi("should not happen but we got: "+E.getSize())}static isEmpty(w){return w===255}static embedTimingPatterns(w){for(let E=8;E<w.getWidth()-8;++E){const O=(E+1)%2;Fr.isEmpty(w.get(E,6))&&w.setNumber(E,6,O),Fr.isEmpty(w.get(6,E))&&w.setNumber(6,E,O)}}static embedDarkDotAtLeftBottomCorner(w){if(w.get(8,w.getHeight()-8)===0)throw new oi;w.setNumber(8,w.getHeight()-8,1)}static embedHorizontalSeparationPattern(w,E,O){for(let U=0;U<8;++U){if(!Fr.isEmpty(O.get(w+U,E)))throw new oi;O.setNumber(w+U,E,0)}}static embedVerticalSeparationPattern(w,E,O){for(let U=0;U<7;++U){if(!Fr.isEmpty(O.get(w,E+U)))throw new oi;O.setNumber(w,E+U,0)}}static embedPositionAdjustmentPattern(w,E,O){for(let U=0;U<5;++U){const H=Fr.POSITION_ADJUSTMENT_PATTERN[U];for(let Q=0;Q<5;++Q)O.setNumber(w+Q,E+U,H[Q])}}static embedPositionDetectionPattern(w,E,O){for(let U=0;U<7;++U){const H=Fr.POSITION_DETECTION_PATTERN[U];for(let Q=0;Q<7;++Q)O.setNumber(w+Q,E+U,H[Q])}}static embedPositionDetectionPatternsAndSeparators(w){const E=Fr.POSITION_DETECTION_PATTERN[0].length;Fr.embedPositionDetectionPattern(0,0,w),Fr.embedPositionDetectionPattern(w.getWidth()-E,0,w),Fr.embedPositionDetectionPattern(0,w.getWidth()-E,w);const O=8;Fr.embedHorizontalSeparationPattern(0,O-1,w),Fr.embedHorizontalSeparationPattern(w.getWidth()-O,O-1,w),Fr.embedHorizontalSeparationPattern(0,w.getWidth()-O,w);const U=7;Fr.embedVerticalSeparationPattern(U,0,w),Fr.embedVerticalSeparationPattern(w.getHeight()-U-1,0,w),Fr.embedVerticalSeparationPattern(U,w.getHeight()-U,w)}static maybeEmbedPositionAdjustmentPatterns(w,E){if(w.getVersionNumber()<2)return;const O=w.getVersionNumber()-1,U=Fr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[O];for(let H=0,Q=U.length;H!==Q;H++){const le=U[H];if(le>=0)for(let ve=0;ve!==Q;ve++){const Te=U[ve];Te>=0&&Fr.isEmpty(E.get(Te,le))&&Fr.embedPositionAdjustmentPattern(Te-2,le-2,E)}}}}Fr.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Fr.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Fr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Fr.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Fr.VERSION_INFO_POLY=7973,Fr.TYPE_INFO_POLY=1335,Fr.TYPE_INFO_MASK_PATTERN=21522;class wn{constructor(w,E){this.dataBytes=w,this.errorCorrectionBytes=E}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class On{constructor(){}static calculateMaskPenalty(w){return Jn.applyMaskPenaltyRule1(w)+Jn.applyMaskPenaltyRule2(w)+Jn.applyMaskPenaltyRule3(w)+Jn.applyMaskPenaltyRule4(w)}static encode(w,E,O=null){let U=On.DEFAULT_BYTE_MODE_ENCODING;const H=O!==null&&O.get(Ir.CHARACTER_SET)!==void 0;H&&(U=O.get(Ir.CHARACTER_SET).toString());const Q=this.chooseMode(w,U),le=new M;if(Q===Xe.BYTE&&(H||On.DEFAULT_BYTE_MODE_ENCODING!==U)){const Nr=X.getCharacterSetECIByName(U);Nr!==void 0&&this.appendECI(Nr,le)}this.appendModeInfo(Q,le);const ve=new M;this.appendBytes(w,Q,ve,U);let Te;if(O!==null&&O.get(Ir.QR_VERSION)!==void 0){const Nr=Number.parseInt(O.get(Ir.QR_VERSION).toString(),10);Te=st.getVersionForNumber(Nr);const jr=this.calculateBitsNeeded(Q,le,ve,Te);if(!this.willFit(jr,Te,E))throw new oi("Data too big for requested version")}else Te=this.recommendVersion(E,Q,le,ve);const Ze=new M;Ze.appendBitArray(le);const xt=Q===Xe.BYTE?ve.getSizeInBytes():w.length;this.appendLengthInfo(xt,Te,Q,Ze),Ze.appendBitArray(ve);const _t=Te.getECBlocksForLevel(E),Qt=Te.getTotalCodewords()-_t.getTotalECCodewords();this.terminateBits(Qt,Ze);const St=this.interleaveWithECBytes(Ze,Te.getTotalCodewords(),Qt,_t.getNumBlocks()),$t=new Zs;$t.setECLevel(E),$t.setMode(Q),$t.setVersion(Te);const Ht=Te.getDimensionForVersion(),jn=new gs(Ht,Ht),xr=this.chooseMaskPattern(St,E,Te,jn);return $t.setMaskPattern(xr),Fr.buildMatrix(St,E,Te,xr,jn),$t.setMatrix(jn),$t}static recommendVersion(w,E,O,U){const H=this.calculateBitsNeeded(E,O,U,st.getVersionForNumber(1)),Q=this.chooseVersion(H,w),le=this.calculateBitsNeeded(E,O,U,Q);return this.chooseVersion(le,w)}static calculateBitsNeeded(w,E,O,U){return E.getSize()+w.getCharacterCountBits(U)+O.getSize()}static getAlphanumericCode(w){return w<On.ALPHANUMERIC_TABLE.length?On.ALPHANUMERIC_TABLE[w]:-1}static chooseMode(w,E=null){if(X.SJIS.getName()===E&&this.isOnlyDoubleByteKanji(w))return Xe.KANJI;let O=!1,U=!1;for(let H=0,Q=w.length;H<Q;++H){const le=w.charAt(H);if(On.isDigit(le))O=!0;else if(this.getAlphanumericCode(le.charCodeAt(0))!==-1)U=!0;else return Xe.BYTE}return U?Xe.ALPHANUMERIC:O?Xe.NUMERIC:Xe.BYTE}static isOnlyDoubleByteKanji(w){let E;try{E=J.encode(w,X.SJIS)}catch{return!1}const O=E.length;if(O%2!==0)return!1;for(let U=0;U<O;U+=2){const H=E[U]&255;if((H<129||H>159)&&(H<224||H>235))return!1}return!0}static chooseMaskPattern(w,E,O,U){let H=Number.MAX_SAFE_INTEGER,Q=-1;for(let le=0;le<Zs.NUM_MASK_PATTERNS;le++){Fr.buildMatrix(w,E,O,le,U);let ve=this.calculateMaskPenalty(U);ve<H&&(H=ve,Q=le)}return Q}static chooseVersion(w,E){for(let O=1;O<=40;O++){const U=st.getVersionForNumber(O);if(On.willFit(w,U,E))return U}throw new oi("Data too big")}static willFit(w,E,O){const U=E.getTotalCodewords(),Q=E.getECBlocksForLevel(O).getTotalECCodewords(),le=U-Q,ve=(w+7)/8;return le>=ve}static terminateBits(w,E){const O=w*8;if(E.getSize()>O)throw new oi("data bits cannot fit in the QR Code"+E.getSize()+" > "+O);for(let Q=0;Q<4&&E.getSize()<O;++Q)E.appendBit(!1);const U=E.getSize()&7;if(U>0)for(let Q=U;Q<8;Q++)E.appendBit(!1);const H=w-E.getSizeInBytes();for(let Q=0;Q<H;++Q)E.appendBits(Q&1?17:236,8);if(E.getSize()!==O)throw new oi("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(w,E,O,U,H,Q){if(U>=O)throw new oi("Block ID too large");const le=w%O,ve=O-le,Te=Math.floor(w/O),Ze=Te+1,xt=Math.floor(E/O),_t=xt+1,Qt=Te-xt,St=Ze-_t;if(Qt!==St)throw new oi("EC bytes mismatch");if(O!==ve+le)throw new oi("RS blocks mismatch");if(w!==(xt+Qt)*ve+(_t+St)*le)throw new oi("Total bytes mismatch");U<ve?(H[0]=xt,Q[0]=Qt):(H[0]=_t,Q[0]=St)}static interleaveWithECBytes(w,E,O,U){if(w.getSizeInBytes()!==O)throw new oi("Number of bits and data bytes does not match");let H=0,Q=0,le=0;const ve=new Array;for(let Ze=0;Ze<U;++Ze){const xt=new Int32Array(1),_t=new Int32Array(1);On.getNumDataBytesAndNumECBytesForBlockID(E,O,U,Ze,xt,_t);const Qt=xt[0],St=new Uint8Array(Qt);w.toBytes(8*H,St,0,Qt);const $t=On.generateECBytes(St,_t[0]);ve.push(new wn(St,$t)),Q=Math.max(Q,Qt),le=Math.max(le,$t.length),H+=xt[0]}if(O!==H)throw new oi("Data bytes does not match offset");const Te=new M;for(let Ze=0;Ze<Q;++Ze)for(const xt of ve){const _t=xt.getDataBytes();Ze<_t.length&&Te.appendBits(_t[Ze],8)}for(let Ze=0;Ze<le;++Ze)for(const xt of ve){const _t=xt.getErrorCorrectionBytes();Ze<_t.length&&Te.appendBits(_t[Ze],8)}if(E!==Te.getSizeInBytes())throw new oi("Interleaving error: "+E+" and "+Te.getSizeInBytes()+" differ.");return Te}static generateECBytes(w,E){const O=w.length,U=new Int32Array(O+E);for(let Q=0;Q<O;Q++)U[Q]=w[Q]&255;new yr(dt.QR_CODE_FIELD_256).encode(U,E);const H=new Uint8Array(E);for(let Q=0;Q<E;Q++)H[Q]=U[O+Q];return H}static appendModeInfo(w,E){E.appendBits(w.getBits(),4)}static appendLengthInfo(w,E,O,U){const H=O.getCharacterCountBits(E);if(w>=1<<H)throw new oi(w+" is bigger than "+((1<<H)-1));U.appendBits(w,H)}static appendBytes(w,E,O,U){switch(E){case Xe.NUMERIC:On.appendNumericBytes(w,O);break;case Xe.ALPHANUMERIC:On.appendAlphanumericBytes(w,O);break;case Xe.BYTE:On.append8BitBytes(w,O,U);break;case Xe.KANJI:On.appendKanjiBytes(w,O);break;default:throw new oi("Invalid mode: "+E)}}static getDigit(w){return w.charCodeAt(0)-48}static isDigit(w){const E=On.getDigit(w);return E>=0&&E<=9}static appendNumericBytes(w,E){const O=w.length;let U=0;for(;U<O;){const H=On.getDigit(w.charAt(U));if(U+2<O){const Q=On.getDigit(w.charAt(U+1)),le=On.getDigit(w.charAt(U+2));E.appendBits(H*100+Q*10+le,10),U+=3}else if(U+1<O){const Q=On.getDigit(w.charAt(U+1));E.appendBits(H*10+Q,7),U+=2}else E.appendBits(H,4),U++}}static appendAlphanumericBytes(w,E){const O=w.length;let U=0;for(;U<O;){const H=On.getAlphanumericCode(w.charCodeAt(U));if(H===-1)throw new oi;if(U+1<O){const Q=On.getAlphanumericCode(w.charCodeAt(U+1));if(Q===-1)throw new oi;E.appendBits(H*45+Q,11),U+=2}else E.appendBits(H,6),U++}}static append8BitBytes(w,E,O){let U;try{U=J.encode(w,O)}catch(H){throw new oi(H)}for(let H=0,Q=U.length;H!==Q;H++){const le=U[H];E.appendBits(le,8)}}static appendKanjiBytes(w,E){let O;try{O=J.encode(w,X.SJIS)}catch(H){throw new oi(H)}const U=O.length;for(let H=0;H<U;H+=2){const Q=O[H]&255,le=O[H+1]&255,ve=Q<<8&4294967295|le;let Te=-1;if(ve>=33088&&ve<=40956?Te=ve-33088:ve>=57408&&ve<=60351&&(Te=ve-49472),Te===-1)throw new oi("Invalid byte sequence");const Ze=(Te>>8)*192+(Te&255);E.appendBits(Ze,13)}}static appendECI(w,E){E.appendBits(Xe.ECI.getBits(),4),E.appendBits(w.getValue(),8)}}On.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),On.DEFAULT_BYTE_MODE_ENCODING=X.UTF8.getName();class lt{write(w,E,O,U=null){if(w.length===0)throw new f("Found empty contents");if(E<0||O<0)throw new f("Requested dimensions are too small: "+E+"x"+O);let H=Se.L,Q=lt.QUIET_ZONE_SIZE;U!==null&&(U.get(Ir.ERROR_CORRECTION)!==void 0&&(H=Se.fromString(U.get(Ir.ERROR_CORRECTION).toString())),U.get(Ir.MARGIN)!==void 0&&(Q=Number.parseInt(U.get(Ir.MARGIN).toString(),10)));const le=On.encode(w,H,U);return this.renderResult(le,E,O,Q)}writeToDom(w,E,O,U,H=null){typeof w=="string"&&(w=document.querySelector(w));const Q=this.write(E,O,U,H);w&&w.appendChild(Q)}renderResult(w,E,O,U){const H=w.getMatrix();if(H===null)throw new nt;const Q=H.getWidth(),le=H.getHeight(),ve=Q+U*2,Te=le+U*2,Ze=Math.max(E,ve),xt=Math.max(O,Te),_t=Math.min(Math.floor(Ze/ve),Math.floor(xt/Te)),Qt=Math.floor((Ze-Q*_t)/2),St=Math.floor((xt-le*_t)/2),$t=this.createSVGElement(Ze,xt);for(let Ht=0,jn=St;Ht<le;Ht++,jn+=_t)for(let xr=0,Nr=Qt;xr<Q;xr++,Nr+=_t)if(H.get(xr,Ht)===1){const jr=this.createSvgRectElement(Nr,jn,_t,_t);$t.appendChild(jr)}return $t}createSVGElement(w,E){const O=document.createElementNS(lt.SVG_NS,"svg");return O.setAttributeNS(null,"height",w.toString()),O.setAttributeNS(null,"width",E.toString()),O}createSvgRectElement(w,E,O,U){const H=document.createElementNS(lt.SVG_NS,"rect");return H.setAttributeNS(null,"x",w.toString()),H.setAttributeNS(null,"y",E.toString()),H.setAttributeNS(null,"height",O.toString()),H.setAttributeNS(null,"width",U.toString()),H.setAttributeNS(null,"fill","#000000"),H}}lt.QUIET_ZONE_SIZE=4,lt.SVG_NS="http://www.w3.org/2000/svg";class Bt{encode(w,E,O,U,H){if(w.length===0)throw new f("Found empty contents");if(E!==xe.QR_CODE)throw new f("Can only encode QR_CODE, but got "+E);if(O<0||U<0)throw new f(`Requested dimensions are too small: ${O}x${U}`);let Q=Se.L,le=Bt.QUIET_ZONE_SIZE;H!==null&&(H.get(Ir.ERROR_CORRECTION)!==void 0&&(Q=Se.fromString(H.get(Ir.ERROR_CORRECTION).toString())),H.get(Ir.MARGIN)!==void 0&&(le=Number.parseInt(H.get(Ir.MARGIN).toString(),10)));const ve=On.encode(w,Q,H);return Bt.renderResult(ve,O,U,le)}static renderResult(w,E,O,U){const H=w.getMatrix();if(H===null)throw new nt;const Q=H.getWidth(),le=H.getHeight(),ve=Q+U*2,Te=le+U*2,Ze=Math.max(E,ve),xt=Math.max(O,Te),_t=Math.min(Math.floor(Ze/ve),Math.floor(xt/Te)),Qt=Math.floor((Ze-Q*_t)/2),St=Math.floor((xt-le*_t)/2),$t=new fe(Ze,xt);for(let Ht=0,jn=St;Ht<le;Ht++,jn+=_t)for(let xr=0,Nr=Qt;xr<Q;xr++,Nr+=_t)H.get(xr,Ht)===1&&$t.setRegion(Nr,jn,_t,_t);return $t}}Bt.QUIET_ZONE_SIZE=4;class nr{encode(w,E,O,U,H){let Q;switch(E){case xe.QR_CODE:Q=new Bt;break;default:throw new f("No encoder available for format "+E)}return Q.encode(w,E,O,U,H)}}class Wn extends W{constructor(w,E,O,U,H,Q,le,ve){if(super(Q,le),this.yuvData=w,this.dataWidth=E,this.dataHeight=O,this.left=U,this.top=H,U+Q>E||H+le>O)throw new f("Crop rectangle does not fit within image data.");ve&&this.reverseHorizontal(Q,le)}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth();(E==null||E.length<O)&&(E=new Uint8ClampedArray(O));const U=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.yuvData,U,E,0,O),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.yuvData;const O=w*E,U=new Uint8ClampedArray(O);let H=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.yuvData,H,U,0,O),U;for(let Q=0;Q<E;Q++){const le=Q*w;v.arraycopy(this.yuvData,H,U,le,w),H+=this.dataWidth}return U}isCropSupported(){return!0}crop(w,E,O,U){return new Wn(this.yuvData,this.dataWidth,this.dataHeight,this.left+w,this.top+E,O,U,!1)}renderThumbnail(){const w=this.getWidth()/Wn.THUMBNAIL_SCALE_FACTOR,E=this.getHeight()/Wn.THUMBNAIL_SCALE_FACTOR,O=new Int32Array(w*E),U=this.yuvData;let H=this.top*this.dataWidth+this.left;for(let Q=0;Q<E;Q++){const le=Q*w;for(let ve=0;ve<w;ve++){const Te=U[H+ve*Wn.THUMBNAIL_SCALE_FACTOR]&255;O[le+ve]=4278190080|Te*65793}H+=this.dataWidth*Wn.THUMBNAIL_SCALE_FACTOR}return O}getThumbnailWidth(){return this.getWidth()/Wn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Wn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(w,E){const O=this.yuvData;for(let U=0,H=this.top*this.dataWidth+this.left;U<E;U++,H+=this.dataWidth){const Q=H+w/2;for(let le=H,ve=H+w-1;le<Q;le++,ve--){const Te=O[le];O[le]=O[ve],O[ve]=Te}}}invert(){return new V(this)}}Wn.THUMBNAIL_SCALE_FACTOR=2;class Or extends W{constructor(w,E,O,U,H,Q,le){if(super(E,O),this.dataWidth=U,this.dataHeight=H,this.left=Q,this.top=le,w.BYTES_PER_ELEMENT===4){const ve=E*O,Te=new Uint8ClampedArray(ve);for(let Ze=0;Ze<ve;Ze++){const xt=w[Ze],_t=xt>>16&255,Qt=xt>>7&510,St=xt&255;Te[Ze]=(_t+Qt+St)/4&255}this.luminances=Te}else this.luminances=w;if(U===void 0&&(this.dataWidth=E),H===void 0&&(this.dataHeight=O),Q===void 0&&(this.left=0),le===void 0&&(this.top=0),this.left+E>this.dataWidth||this.top+O>this.dataHeight)throw new f("Crop rectangle does not fit within image data.")}getRow(w,E){if(w<0||w>=this.getHeight())throw new f("Requested row is outside the image: "+w);const O=this.getWidth();(E==null||E.length<O)&&(E=new Uint8ClampedArray(O));const U=(w+this.top)*this.dataWidth+this.left;return v.arraycopy(this.luminances,U,E,0,O),E}getMatrix(){const w=this.getWidth(),E=this.getHeight();if(w===this.dataWidth&&E===this.dataHeight)return this.luminances;const O=w*E,U=new Uint8ClampedArray(O);let H=this.top*this.dataWidth+this.left;if(w===this.dataWidth)return v.arraycopy(this.luminances,H,U,0,O),U;for(let Q=0;Q<E;Q++){const le=Q*w;v.arraycopy(this.luminances,H,U,le,w),H+=this.dataWidth}return U}isCropSupported(){return!0}crop(w,E,O,U){return new Or(this.luminances,O,U,this.dataWidth,this.dataHeight,this.left+w,this.top+E)}invert(){return new V(this)}}class Pr extends X{static forName(w){return this.getCharacterSetECIByName(w)}}class ts{}ts.ISO_8859_1=X.ISO8859_1;class Ls{isCompact(){return this.compact}setCompact(w){this.compact=w}getSize(){return this.size}setSize(w){this.size=w}getLayers(){return this.layers}setLayers(w){this.layers=w}getCodeWords(){return this.codeWords}setCodeWords(w){this.codeWords=w}getMatrix(){return this.matrix}setMatrix(w){this.matrix=w}}class Et{static singletonList(w){return[w]}static min(w,E){return w.sort(E)[0]}}class or{constructor(w){this.previous=w}getPrevious(){return this.previous}}class Hn extends or{constructor(w,E,O){super(w),this.value=E,this.bitCount=O}appendTo(w,E){w.appendBits(this.value,this.bitCount)}add(w,E){return new Hn(this,w,E)}addBinaryShift(w,E){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Hn(this,w,E)}toString(){let w=this.value&(1<<this.bitCount)-1;return w|=1<<this.bitCount,"<"+T.toBinaryString(w|1<<this.bitCount).substring(1)+">"}}class Vr extends Hn{constructor(w,E,O){super(w,0,0),this.binaryShiftStart=E,this.binaryShiftByteCount=O}appendTo(w,E){for(let O=0;O<this.binaryShiftByteCount;O++)(O===0||O===31&&this.binaryShiftByteCount<=62)&&(w.appendBits(31,5),this.binaryShiftByteCount>62?w.appendBits(this.binaryShiftByteCount-31,16):O===0?w.appendBits(Math.min(this.binaryShiftByteCount,31),5):w.appendBits(this.binaryShiftByteCount-31,5)),w.appendBits(E[this.binaryShiftStart+O],8)}addBinaryShift(w,E){return new Vr(this,w,E)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function us(ft,w,E){return new Vr(ft,w,E)}function as(ft,w,E){return new Hn(ft,w,E)}const xs=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],bs=0,zi=1,Us=2,ys=3,Ss=4,pc=new Hn(null,0,0),ks=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function ka(ft){for(let w of ft)P.fill(w,-1);return ft[bs][Ss]=0,ft[zi][Ss]=0,ft[zi][bs]=28,ft[ys][Ss]=0,ft[Us][Ss]=0,ft[Us][bs]=15,ft}const Wu=ka(P.createInt32Array(6,6));class va{constructor(w,E,O,U){this.token=w,this.mode=E,this.binaryShiftByteCount=O,this.bitCount=U}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(w,E){let O=this.bitCount,U=this.token;if(w!==this.mode){let Q=ks[this.mode][w];U=as(U,Q&65535,Q>>16),O+=Q>>16}let H=w===Us?4:5;return U=as(U,E,H),new va(U,w,0,O+H)}shiftAndAppend(w,E){let O=this.token,U=this.mode===Us?4:5;return O=as(O,Wu[this.mode][w],U),O=as(O,E,5),new va(O,this.mode,0,this.bitCount+U+5)}addBinaryShiftChar(w){let E=this.token,O=this.mode,U=this.bitCount;if(this.mode===Ss||this.mode===Us){let le=ks[O][bs];E=as(E,le&65535,le>>16),U+=le>>16,O=bs}let H=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,Q=new va(E,O,this.binaryShiftByteCount+1,U+H);return Q.binaryShiftByteCount===2078&&(Q=Q.endBinaryShift(w+1)),Q}endBinaryShift(w){if(this.binaryShiftByteCount===0)return this;let E=this.token;return E=us(E,w-this.binaryShiftByteCount,this.binaryShiftByteCount),new va(E,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(w){let E=this.bitCount+(ks[this.mode][w.mode]>>16);return this.binaryShiftByteCount<w.binaryShiftByteCount?E+=va.calculateBinaryShiftCost(w)-va.calculateBinaryShiftCost(this):this.binaryShiftByteCount>w.binaryShiftByteCount&&w.binaryShiftByteCount>0&&(E+=10),E<=w.bitCount}toBitArray(w){let E=[];for(let U=this.endBinaryShift(w.length).token;U!==null;U=U.getPrevious())E.unshift(U);let O=new M;for(const U of E)U.appendTo(O,w);return O}toString(){return K.format("%s bits=%d bytes=%d",xs[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(w){return w.binaryShiftByteCount>62?21:w.binaryShiftByteCount>31?20:w.binaryShiftByteCount>0?10:0}}va.INITIAL_STATE=new va(pc,bs,0,0);function Yo(ft){const w=K.getCharCode(" "),E=K.getCharCode("."),O=K.getCharCode(",");ft[bs][w]=1;const U=K.getCharCode("Z"),H=K.getCharCode("A");for(let _t=H;_t<=U;_t++)ft[bs][_t]=_t-H+2;ft[zi][w]=1;const Q=K.getCharCode("z"),le=K.getCharCode("a");for(let _t=le;_t<=Q;_t++)ft[zi][_t]=_t-le+2;ft[Us][w]=1;const ve=K.getCharCode("9"),Te=K.getCharCode("0");for(let _t=Te;_t<=ve;_t++)ft[Us][_t]=_t-Te+2;ft[Us][O]=12,ft[Us][E]=13;const Ze=["\0"," ","","","","","","","\x07","\b"," ",`
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let _t=0;_t<Ze.length;_t++)ft[ys][K.getCharCode(Ze[_t])]=_t;const xt=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let _t=0;_t<xt.length;_t++)K.getCharCode(xt[_t])>0&&(ft[Ss][K.getCharCode(xt[_t])]=_t);return ft}const qu=Yo(P.createInt32Array(5,256));class Yl{constructor(w){this.text=w}encode(){const w=K.getCharCode(" "),E=K.getCharCode(`
`);let O=Et.singletonList(va.INITIAL_STATE);for(let H=0;H<this.text.length;H++){let Q,le=H+1<this.text.length?this.text[H+1]:0;switch(this.text[H]){case K.getCharCode("\r"):Q=le===E?2:0;break;case K.getCharCode("."):Q=le===w?3:0;break;case K.getCharCode(","):Q=le===w?4:0;break;case K.getCharCode(":"):Q=le===w?5:0;break;default:Q=0}Q>0?(O=Yl.updateStateListForPair(O,H,Q),H++):O=this.updateStateListForChar(O,H)}return Et.min(O,(H,Q)=>H.getBitCount()-Q.getBitCount()).toBitArray(this.text)}updateStateListForChar(w,E){const O=[];for(let U of w)this.updateStateForChar(U,E,O);return Yl.simplifyStates(O)}updateStateForChar(w,E,O){let U=this.text[E]&255,H=qu[w.getMode()][U]>0,Q=null;for(let le=0;le<=Ss;le++){let ve=qu[le][U];if(ve>0){if(Q==null&&(Q=w.endBinaryShift(E)),!H||le===w.getMode()||le===Us){const Te=Q.latchAndAppend(le,ve);O.push(Te)}if(!H&&Wu[w.getMode()][le]>=0){const Te=Q.shiftAndAppend(le,ve);O.push(Te)}}}if(w.getBinaryShiftByteCount()>0||qu[w.getMode()][U]===0){let le=w.addBinaryShiftChar(E);O.push(le)}}static updateStateListForPair(w,E,O){const U=[];for(let H of w)this.updateStateForPair(H,E,O,U);return this.simplifyStates(U)}static updateStateForPair(w,E,O,U){let H=w.endBinaryShift(E);if(U.push(H.latchAndAppend(Ss,O)),w.getMode()!==Ss&&U.push(H.shiftAndAppend(Ss,O)),O===3||O===4){let Q=H.latchAndAppend(Us,16-O).latchAndAppend(Us,1);U.push(Q)}if(w.getBinaryShiftByteCount()>0){let Q=w.addBinaryShiftChar(E).addBinaryShiftChar(E+1);U.push(Q)}}static simplifyStates(w){let E=[];for(const O of w){let U=!0;for(const H of E){if(H.isBetterThanOrEqualTo(O)){U=!1;break}O.isBetterThanOrEqualTo(H)&&(E=E.filter(Q=>Q!==H))}U&&E.push(O)}return E}}class yi{constructor(){}static encodeBytes(w){return yi.encode(w,yi.DEFAULT_EC_PERCENT,yi.DEFAULT_AZTEC_LAYERS)}static encode(w,E,O){let U=new Yl(w).encode(),H=T.truncDivision(U.getSize()*E,100)+11,Q=U.getSize()+H,le,ve,Te,Ze,xt;if(O!==yi.DEFAULT_AZTEC_LAYERS){if(le=O<0,ve=Math.abs(O),ve>(le?yi.MAX_NB_BITS_COMPACT:yi.MAX_NB_BITS))throw new f(K.format("Illegal value %s for layers",O));Te=yi.totalBitsInLayer(ve,le),Ze=yi.WORD_SIZE[ve];let jr=Te-Te%Ze;if(xt=yi.stuffBits(U,Ze),xt.getSize()+H>jr)throw new f("Data to large for user specified layer");if(le&&xt.getSize()>Ze*64)throw new f("Data to large for user specified layer")}else{Ze=0,xt=null;for(let jr=0;;jr++){if(jr>yi.MAX_NB_BITS)throw new f("Data too large for an Aztec code");if(le=jr<=3,ve=le?jr+1:jr,Te=yi.totalBitsInLayer(ve,le),Q>Te)continue;(xt==null||Ze!==yi.WORD_SIZE[ve])&&(Ze=yi.WORD_SIZE[ve],xt=yi.stuffBits(U,Ze));let Ns=Te-Te%Ze;if(!(le&&xt.getSize()>Ze*64)&&xt.getSize()+H<=Ns)break}}let _t=yi.generateCheckWords(xt,Te,Ze),Qt=xt.getSize()/Ze,St=yi.generateModeMessage(le,ve,Qt),$t=(le?11:14)+ve*4,Ht=new Int32Array($t),jn;if(le){jn=$t;for(let jr=0;jr<Ht.length;jr++)Ht[jr]=jr}else{jn=$t+1+2*T.truncDivision(T.truncDivision($t,2)-1,15);let jr=T.truncDivision($t,2),Ns=T.truncDivision(jn,2);for(let Js=0;Js<jr;Js++){let mc=Js+T.truncDivision(Js,15);Ht[jr-Js-1]=Ns-mc-1,Ht[jr+Js]=Ns+mc+1}}let xr=new fe(jn);for(let jr=0,Ns=0;jr<ve;jr++){let Js=(ve-jr)*4+(le?9:12);for(let mc=0;mc<Js;mc++){let no=mc*2;for(let ro=0;ro<2;ro++)_t.get(Ns+no+ro)&&xr.set(Ht[jr*2+ro],Ht[jr*2+mc]),_t.get(Ns+Js*2+no+ro)&&xr.set(Ht[jr*2+mc],Ht[$t-1-jr*2-ro]),_t.get(Ns+Js*4+no+ro)&&xr.set(Ht[$t-1-jr*2-ro],Ht[$t-1-jr*2-mc]),_t.get(Ns+Js*6+no+ro)&&xr.set(Ht[$t-1-jr*2-mc],Ht[jr*2+ro])}Ns+=Js*8}if(yi.drawModeMessage(xr,le,jn,St),le)yi.drawBullsEye(xr,T.truncDivision(jn,2),5);else{yi.drawBullsEye(xr,T.truncDivision(jn,2),7);for(let jr=0,Ns=0;jr<T.truncDivision($t,2)-1;jr+=15,Ns+=16)for(let Js=T.truncDivision(jn,2)&1;Js<jn;Js+=2)xr.set(T.truncDivision(jn,2)-Ns,Js),xr.set(T.truncDivision(jn,2)+Ns,Js),xr.set(Js,T.truncDivision(jn,2)-Ns),xr.set(Js,T.truncDivision(jn,2)+Ns)}let Nr=new Ls;return Nr.setCompact(le),Nr.setSize(jn),Nr.setLayers(ve),Nr.setCodeWords(Qt),Nr.setMatrix(xr),Nr}static drawBullsEye(w,E,O){for(let U=0;U<O;U+=2)for(let H=E-U;H<=E+U;H++)w.set(H,E-U),w.set(H,E+U),w.set(E-U,H),w.set(E+U,H);w.set(E-O,E-O),w.set(E-O+1,E-O),w.set(E-O,E-O+1),w.set(E+O,E-O),w.set(E+O,E-O+1),w.set(E+O,E+O-1)}static generateModeMessage(w,E,O){let U=new M;return w?(U.appendBits(E-1,2),U.appendBits(O-1,6),U=yi.generateCheckWords(U,28,4)):(U.appendBits(E-1,5),U.appendBits(O-1,11),U=yi.generateCheckWords(U,40,4)),U}static drawModeMessage(w,E,O,U){let H=T.truncDivision(O,2);if(E)for(let Q=0;Q<7;Q++){let le=H-3+Q;U.get(Q)&&w.set(le,H-5),U.get(Q+7)&&w.set(H+5,le),U.get(20-Q)&&w.set(le,H+5),U.get(27-Q)&&w.set(H-5,le)}else for(let Q=0;Q<10;Q++){let le=H-5+Q+T.truncDivision(Q,5);U.get(Q)&&w.set(le,H-7),U.get(Q+10)&&w.set(H+7,le),U.get(29-Q)&&w.set(le,H+7),U.get(39-Q)&&w.set(H-7,le)}}static generateCheckWords(w,E,O){let U=w.getSize()/O,H=new yr(yi.getGF(O)),Q=T.truncDivision(E,O),le=yi.bitsToWords(w,O,Q);H.encode(le,Q-U);let ve=E%O,Te=new M;Te.appendBits(0,ve);for(const Ze of Array.from(le))Te.appendBits(Ze,O);return Te}static bitsToWords(w,E,O){let U=new Int32Array(O),H,Q;for(H=0,Q=w.getSize()/E;H<Q;H++){let le=0;for(let ve=0;ve<E;ve++)le|=w.get(H*E+ve)?1<<E-ve-1:0;U[H]=le}return U}static getGF(w){switch(w){case 4:return dt.AZTEC_PARAM;case 6:return dt.AZTEC_DATA_6;case 8:return dt.AZTEC_DATA_8;case 10:return dt.AZTEC_DATA_10;case 12:return dt.AZTEC_DATA_12;default:throw new f("Unsupported word size "+w)}}static stuffBits(w,E){let O=new M,U=w.getSize(),H=(1<<E)-2;for(let Q=0;Q<U;Q+=E){let le=0;for(let ve=0;ve<E;ve++)(Q+ve>=U||w.get(Q+ve))&&(le|=1<<E-1-ve);(le&H)===H?(O.appendBits(le&H,E),Q--):le&H?O.appendBits(le,E):(O.appendBits(le|1,E),Q--)}return O}static totalBitsInLayer(w,E){return((E?88:112)+16*w)*w}}yi.DEFAULT_EC_PERCENT=33,yi.DEFAULT_AZTEC_LAYERS=0,yi.MAX_NB_BITS=32,yi.MAX_NB_BITS_COMPACT=4,yi.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Ed{encode(w,E,O,U){return this.encodeWithHints(w,E,O,U,null)}encodeWithHints(w,E,O,U,H){let Q=ts.ISO_8859_1,le=yi.DEFAULT_EC_PERCENT,ve=yi.DEFAULT_AZTEC_LAYERS;return H!=null&&(H.has(Ir.CHARACTER_SET)&&(Q=Pr.forName(H.get(Ir.CHARACTER_SET).toString())),H.has(Ir.ERROR_CORRECTION)&&(le=T.parseInt(H.get(Ir.ERROR_CORRECTION).toString())),H.has(Ir.AZTEC_LAYERS)&&(ve=T.parseInt(H.get(Ir.AZTEC_LAYERS).toString()))),Ed.encodeLayers(w,E,O,U,Q,le,ve)}static encodeLayers(w,E,O,U,H,Q,le){if(E!==xe.AZTEC)throw new f("Can only encode AZTEC, but got "+E);let ve=yi.encode(K.getBytes(w,H),Q,le);return Ed.renderResult(ve,O,U)}static renderResult(w,E,O){let U=w.getMatrix();if(U==null)throw new nt;let H=U.getWidth(),Q=U.getHeight(),le=Math.max(E,H),ve=Math.max(O,Q),Te=Math.min(le/H,ve/Q),Ze=(le-H*Te)/2,xt=(ve-Q*Te)/2,_t=new fe(le,ve);for(let Qt=0,St=xt;Qt<Q;Qt++,St+=Te)for(let $t=0,Ht=Ze;$t<H;$t++,Ht+=Te)U.get($t,Qt)&&_t.setRegion(Ht,St,Te,Te);return _t}}n.AbstractExpandedDecoder=bn,n.ArgumentException=d,n.ArithmeticException=Ke,n.AztecCode=Ls,n.AztecCodeReader=hn,n.AztecCodeWriter=Ed,n.AztecDecoder=ht,n.AztecDetector=It,n.AztecDetectorResult=cn,n.AztecEncoder=yi,n.AztecHighLevelEncoder=Yl,n.AztecPoint=Je,n.BarcodeFormat=xe,n.Binarizer=y,n.BinaryBitmap=x,n.BitArray=M,n.BitMatrix=fe,n.BitSource=ge,n.BrowserAztecCodeReader=Yt,n.BrowserBarcodeReader=I,n.BrowserCodeReader=Ce,n.BrowserDatamatrixCodeReader=at,n.BrowserMultiFormatReader=pr,n.BrowserPDF417Reader=fr,n.BrowserQRCodeReader=Yr,n.BrowserQRCodeSvgWriter=lt,n.CharacterSetECI=X,n.ChecksumException=g,n.Code128Reader=ot,n.Code39Reader=De,n.DataMatrixDecodedBitStreamParser=ke,n.DataMatrixReader=Fe,n.DecodeHintType=$,n.DecoderResult=Ie,n.DefaultGridSampler=Jt,n.DetectorResult=nn,n.EAN13Reader=dn,n.EncodeHintType=Ir,n.Exception=u,n.FormatException=L,n.GenericGF=dt,n.GenericGFPoly=Qe,n.GlobalHistogramBinarizer=se,n.GridSampler=Xt,n.GridSamplerInstance=Ye,n.HTMLCanvasElementLuminanceSource=ee,n.HybridBinarizer=ae,n.ITFReader=At,n.IllegalArgumentException=f,n.IllegalStateException=nt,n.InvertedLuminanceSource=V,n.LuminanceSource=W,n.MathUtils=pt,n.MultiFormatOneDReader=k,n.MultiFormatReader=Er,n.MultiFormatWriter=nr,n.NotFoundException=q,n.OneDReader=Rt,n.PDF417DecodedBitStreamParser=vt,n.PDF417DecoderErrorCorrection=ls,n.PDF417Reader=xn,n.PDF417ResultMetadata=wr,n.PerspectiveTransform=an,n.PlanarYUVLuminanceSource=Wn,n.QRCodeByteMatrix=gs,n.QRCodeDataMask=yt,n.QRCodeDecodedBitStreamParser=Pt,n.QRCodeDecoderErrorCorrectionLevel=Se,n.QRCodeDecoderFormatInformation=$e,n.QRCodeEncoder=On,n.QRCodeEncoderQRCode=Zs,n.QRCodeMaskUtil=Jn,n.QRCodeMatrixUtil=Fr,n.QRCodeMode=Xe,n.QRCodeReader=Sr,n.QRCodeVersion=st,n.QRCodeWriter=Bt,n.RGBLuminanceSource=Or,n.RSS14Reader=_,n.RSSExpandedReader=p,n.ReaderException=dr,n.ReedSolomonDecoder=Le,n.ReedSolomonEncoder=yr,n.ReedSolomonException=tt,n.Result=me,n.ResultMetadataType=je,n.ResultPoint=wt,n.StringUtils=K,n.UnsupportedOperationException=ne,n.VideoInputDevice=oe,n.WhiteRectangleDetector=Un,n.WriterException=oi,n.ZXingArrays=P,n.ZXingCharset=Pr,n.ZXingInteger=T,n.ZXingStandardCharsets=ts,n.ZXingStringBuilder=te,n.ZXingStringEncoding=J,n.ZXingSystem=v,n.createAbstractExpandedDecoder=En,Object.defineProperty(n,"__esModule",{value:!0})})}(r9,r9.exports)),r9.exports}var yo=u$t();const d$t=Ii(yo),f$t=g8e({__proto__:null,default:d$t},[yo]);var w2e=function(){function t(e,n,r){if(this.formatMap=new Map([[js.QR_CODE,yo.BarcodeFormat.QR_CODE],[js.AZTEC,yo.BarcodeFormat.AZTEC],[js.CODABAR,yo.BarcodeFormat.CODABAR],[js.CODE_39,yo.BarcodeFormat.CODE_39],[js.CODE_93,yo.BarcodeFormat.CODE_93],[js.CODE_128,yo.BarcodeFormat.CODE_128],[js.DATA_MATRIX,yo.BarcodeFormat.DATA_MATRIX],[js.MAXICODE,yo.BarcodeFormat.MAXICODE],[js.ITF,yo.BarcodeFormat.ITF],[js.EAN_13,yo.BarcodeFormat.EAN_13],[js.EAN_8,yo.BarcodeFormat.EAN_8],[js.PDF_417,yo.BarcodeFormat.PDF_417],[js.RSS_14,yo.BarcodeFormat.RSS_14],[js.RSS_EXPANDED,yo.BarcodeFormat.RSS_EXPANDED],[js.UPC_A,yo.BarcodeFormat.UPC_A],[js.UPC_E,yo.BarcodeFormat.UPC_E],[js.UPC_EAN_EXTENSION,yo.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!f$t)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=n,this.logger=r;var s=this.createZXingFormats(e),a=new Map;a.set(yo.DecodeHintType.POSSIBLE_FORMATS,s),a.set(yo.DecodeHintType.TRY_HARDER,!1),this.hints=a}return t.prototype.decodeAsync=function(e){var n=this;return new Promise(function(r,s){try{r(n.decode(e))}catch(a){s(a)}})},t.prototype.decode=function(e){var n=new yo.MultiFormatReader(this.verbose,this.hints),r=new yo.HTMLCanvasElementLuminanceSource(e),s=new yo.BinaryBitmap(new yo.HybridBinarizer(r)),a=n.decode(s);return{text:a.text,format:o$e.create(this.toHtml5QrcodeSupportedFormats(a.format)),debugData:this.createDebugData()}},t.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(n,r,s){e.set(n,r)}),e},t.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},t.prototype.createZXingFormats=function(e){for(var n=[],r=0,s=e;r<s.length;r++){var a=s[r];this.formatMap.has(a)?n.push(this.formatMap.get(a)):this.logger.logError("".concat(a," is not supported by")+"ZXingHtml5QrcodeShim")}return n},t.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},t}(),h$t=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},p$t=function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},C2e=function(){function t(e,n,r){if(this.formatMap=new Map([[js.QR_CODE,"qr_code"],[js.AZTEC,"aztec"],[js.CODABAR,"codabar"],[js.CODE_39,"code_39"],[js.CODE_93,"code_93"],[js.CODE_128,"code_128"],[js.DATA_MATRIX,"data_matrix"],[js.ITF,"itf"],[js.EAN_13,"ean_13"],[js.EAN_8,"ean_8"],[js.PDF_417,"pdf417"],[js.UPC_A,"upc_a"],[js.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!t.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var s=this.createBarcodeDetectorFormats(e);if(this.detector=new BarcodeDetector(s),!this.detector)throw"BarcodeDetector detector not supported"}return t.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var e=new BarcodeDetector({formats:["qr_code"]});return typeof e<"u"},t.prototype.decodeAsync=function(e){return h$t(this,void 0,void 0,function(){var n,r;return p$t(this,function(s){switch(s.label){case 0:return[4,this.detector.detect(e)];case 1:if(n=s.sent(),!n||n.length===0)throw"No barcode or QR code detected.";return r=this.selectLargestBarcode(n),[2,{text:r.rawValue,format:o$e.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})})},t.prototype.selectLargestBarcode=function(e){for(var n=null,r=0,s=0,a=e;s<a.length;s++){var o=a[s],l=o.boundingBox.width*o.boundingBox.height;l>r&&(r=l,n=o)}if(!n)throw"No largest barcode found";return n},t.prototype.createBarcodeDetectorFormats=function(e){for(var n=[],r=0,s=e;r<s.length;r++){var a=s[r];this.formatMap.has(a)?n.push(this.formatMap.get(a)):this.logger.warn("".concat(a," is not supported by")+"BarcodeDetectorDelegate")}return{formats:n}},t.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},t.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(n,r,s){e.set(n,r)}),e},t.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},t}(),S2e=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},N2e=function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},m$t=function(){function t(e,n,r,s){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,n&&C2e.isSupported()?(this.primaryDecoder=new C2e(e,r,s),this.secondaryDecoder=new w2e(e,r,s)):this.primaryDecoder=new w2e(e,r,s)}return t.prototype.decodeAsync=function(e){return S2e(this,void 0,void 0,function(){var n;return N2e(this,function(r){switch(r.label){case 0:n=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(n),[7];case 4:return[2]}})})},t.prototype.decodeRobustlyAsync=function(e){return S2e(this,void 0,void 0,function(){var n,r;return N2e(this,function(s){switch(s.label){case 0:n=performance.now(),s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,s.sent()];case 3:if(r=s.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw r;case 4:return this.possiblyLogPerformance(n),[7];case 5:return[2]}})})},t.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},t.prototype.possiblyLogPerformance=function(e){if(this.verbose){var n=performance.now()-e;this.executionResults.push(n),this.executions++,this.possiblyFlushPerformanceReport()}},t.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,n=0,r=this.executionResults;n<r.length;n++){var s=r[n];e+=s}var a=e/this.executionResults.length;console.log("".concat(a," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},t}(),qce=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ML=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},RL=function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},c$e=function(){function t(e,n){this.name=e,this.track=n}return t.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},t.prototype.apply=function(e){var n={};n[this.name]=e;var r={advanced:[n]};return this.track.applyConstraints(r)},t.prototype.value=function(){var e=this.track.getSettings();if(this.name in e){var n=e[this.name];return n}return null},t}(),x$t=function(t){qce(e,t);function e(n,r){return t.call(this,n,r)||this}return e.prototype.min=function(){return this.getCapabilities().min},e.prototype.max=function(){return this.getCapabilities().max},e.prototype.step=function(){return this.getCapabilities().step},e.prototype.apply=function(n){var r={};r[this.name]=n;var s={advanced:[r]};return this.track.applyConstraints(s)},e.prototype.getCapabilities=function(){this.failIfNotSupported();var n=this.track.getCapabilities(),r=n[this.name];return{min:r.min,max:r.max,step:r.step}},e.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},e}(c$e),g$t=function(t){qce(e,t);function e(n){return t.call(this,"zoom",n)||this}return e}(x$t),b$t=function(t){qce(e,t);function e(n){return t.call(this,"torch",n)||this}return e}(c$e),y$t=function(){function t(e){this.track=e}return t.prototype.zoomFeature=function(){return new g$t(this.track)},t.prototype.torchFeature=function(){return new b$t(this.track)},t}(),v$t=function(){function t(e,n,r){this.isClosed=!1,this.parentElement=e,this.mediaStream=n,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return t.prototype.createVideoElement=function(e){var n=document.createElement("video");return n.style.width="".concat(e,"px"),n.style.display="block",n.muted=!0,n.setAttribute("muted","true"),n.playsInline=!0,n},t.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var n=function(){var r=e.surface.clientWidth,s=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(r,s),e.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.srcObject=this.mediaStream,this.surface.play()},t.create=function(e,n,r,s){return ML(this,void 0,void 0,function(){var a,o;return RL(this,function(l){switch(l.label){case 0:return a=new t(e,n,s),r.aspectRatio?(o={aspectRatio:r.aspectRatio},[4,a.getFirstTrackOrFail().applyConstraints(o)]):[3,2];case 1:l.sent(),l.label=2;case 2:return a.setupSurface(),[2,a]}})})},t.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},t.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},t.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},t.prototype.resume=function(e){this.failIfClosed();var n=this,r=function(){setTimeout(e,200),n.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},t.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},t.prototype.getSurface=function(){return this.failIfClosed(),this.surface},t.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},t.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},t.prototype.applyVideoConstraints=function(e){return ML(this,void 0,void 0,function(){return RL(this,function(n){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},t.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(n,r){var s=e.mediaStream.getVideoTracks(),a=s.length,o=0;e.mediaStream.getVideoTracks().forEach(function(l){e.mediaStream.removeTrack(l),l.stop(),++o,o>=a&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),n())})})},t.prototype.getCapabilities=function(){return new y$t(this.getFirstTrackOrFail())},t}(),w$t=function(){function t(e){this.mediaStream=e}return t.prototype.render=function(e,n,r){return ML(this,void 0,void 0,function(){return RL(this,function(s){return[2,v$t.create(e,this.mediaStream,n,r)]})})},t.create=function(e){return ML(this,void 0,void 0,function(){var n,r;return RL(this,function(s){switch(s.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:e},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return r=s.sent(),[2,new t(r)]}})})},t}(),A2e=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},j2e=function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},C$t=function(){function t(){}return t.failIfNotSupported=function(){return A2e(this,void 0,void 0,function(){return j2e(this,function(e){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new t]})})},t.prototype.create=function(e){return A2e(this,void 0,void 0,function(){return j2e(this,function(n){return[2,w$t.create(e)]})})},t}(),S$t=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(d){try{u(r.next(d))}catch(f){o(f)}}function c(d){try{u(r.throw(d))}catch(f){o(f)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((r=r.apply(t,e||[])).next())})},N$t=function(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,s,a,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,s&&(a=u[0]&2?s.return:u[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,u[1])).done)return a;switch(s=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],s=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},A$t=function(){function t(){}return t.retrieve=function(){if(navigator.mediaDevices)return t.getCamerasFromMediaDevices();var e=MediaStreamTrack;return MediaStreamTrack&&e.getSources?t.getCamerasFromMediaStreamTrack():t.rejectWithError()},t.rejectWithError=function(){var e=a4.unableToQuerySupportedDevices();return t.isHttpsOrLocalhost()||(e=a4.insecureContextCameraQueryError()),Promise.reject(e)},t.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var e=location.host.split(":")[0];return e==="127.0.0.1"||e==="localhost"},t.getCamerasFromMediaDevices=function(){return S$t(this,void 0,void 0,function(){var e,n,r,s,a,o,l;return N$t(this,function(c){switch(c.label){case 0:return e=function(u){for(var d=u.getVideoTracks(),f=0,x=d;f<x.length;f++){var g=x[f];g.enabled=!1,g.stop(),u.removeTrack(g)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return n=c.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(r=c.sent(),s=[],a=0,o=r;a<o.length;a++)l=o[a],l.kind==="videoinput"&&s.push({id:l.deviceId,label:l.label});return e(n),[2,s]}})})},t.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,n){var r=function(a){for(var o=[],l=0,c=a;l<c.length;l++){var u=c[l];u.kind==="video"&&o.push({id:u.id,label:u.label})}e(o)},s=MediaStreamTrack;s.getSources(r)})},t}(),rl;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.NOT_STARTED=1]="NOT_STARTED",t[t.SCANNING=2]="SCANNING",t[t.PAUSED=3]="PAUSED"})(rl||(rl={}));var j$t=function(){function t(){this.state=rl.NOT_STARTED,this.onGoingTransactionNewState=rl.UNKNOWN}return t.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},t.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},t.prototype.execute=function(){if(this.onGoingTransactionNewState===rl.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=rl.UNKNOWN,this.directTransition(e)},t.prototype.cancel=function(){if(this.onGoingTransactionNewState===rl.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=rl.UNKNOWN},t.prototype.getState=function(){return this.state},t.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==rl.UNKNOWN)throw"Cannot transition to a new state, already under transition"},t.prototype.validateTransition=function(e){switch(this.state){case rl.UNKNOWN:throw"Transition from unknown is not allowed";case rl.NOT_STARTED:this.failIfNewStateIs(e,[rl.PAUSED]);break;case rl.SCANNING:break;case rl.PAUSED:break}},t.prototype.failIfNewStateIs=function(e,n){for(var r=0,s=n;r<s.length;r++){var a=s[r];if(e===a)throw"Cannot transition from ".concat(this.state," to ").concat(e)}},t}(),E$t=function(){function t(e){this.stateManager=e}return t.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},t.prototype.directTransition=function(e){this.stateManager.directTransition(e)},t.prototype.getState=function(){return this.stateManager.getState()},t.prototype.canScanFile=function(){return this.stateManager.getState()===rl.NOT_STARTED},t.prototype.isScanning=function(){return this.stateManager.getState()!==rl.NOT_STARTED},t.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===rl.SCANNING},t.prototype.isPaused=function(){return this.stateManager.getState()===rl.PAUSED},t}(),_$t=function(){function t(){}return t.create=function(){return new E$t(new j$t)},t}(),k$t=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Df=function(t){k$t(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.DEFAULT_WIDTH=300,e.DEFAULT_WIDTH_OFFSET=2,e.FILE_SCAN_MIN_HEIGHT=300,e.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,e.MIN_QR_BOX_SIZE=50,e.SHADED_LEFT=1,e.SHADED_RIGHT=2,e.SHADED_TOP=3,e.SHADED_BOTTOM=4,e.SHADED_REGION_ELEMENT_ID="qr-shaded-region",e.VERBOSE=!1,e.BORDER_SHADER_DEFAULT_COLOR="#ffffff",e.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",e}(a$t),T$t=function(){function t(e,n){this.logger=n,this.fps=Df.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=e.disableFlip===!0,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=Df.DEFAULT_DISABLE_FLIP}return t.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?l$e.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},t.prototype.isShadedBoxEnabled=function(){return!mg(this.qrbox)},t.create=function(e,n){return new t(e,n)},t}(),E2e=function(){function t(e,n){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1;var r;typeof n=="boolean"?this.verbose=n===!0:n&&(r=n,this.verbose=r.verbose===!0,r.experimentalFeatures),this.logger=new l$t(this.verbose),this.qrcode=new m$t(this.getSupportedFormats(n),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=_$t.create()}return t.prototype.start=function(e,n,r,s){var a=this;if(!e)throw"cameraIdOrConfig is required";if(!r||typeof r!="function")throw"qrCodeSuccessCallback is required and should be a function.";var o;s?o=s:o=this.verbose?this.logger.log:function(){};var l=T$t.create(n,this.logger);this.clearElement();var c=!1;l.videoConstraints&&(l.isMediaStreamConstraintsValid()?c=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var u=c,d=document.getElementById(this.elementId);d.clientWidth?d.clientWidth:Df.DEFAULT_WIDTH,d.style.position="relative",this.shouldScan=!0,this.element=d;var f=this,x=this.stateManagerProxy.startTransition(rl.SCANNING);return new Promise(function(g,y){var v=u?l.videoConstraints:f.createVideoConstraints(e);if(!v){x.cancel(),y("videoConstraints should be defined");return}var C={};(!u||l.aspectRatio)&&(C.aspectRatio=l.aspectRatio);var N={onRenderSurfaceReady:function(P,T){f.setupUi(P,T,l),f.isScanning=!0,f.foreverScan(l,r,o)}};C$t.failIfNotSupported().then(function(P){P.create(v).then(function(T){return T.render(a.element,C,N).then(function(M){f.renderedCamera=M,x.execute(),g(null)}).catch(function(M){x.cancel(),y(M)})}).catch(function(T){x.cancel(),y(a4.errorGettingUserMedia(T))})}).catch(function(P){x.cancel(),y(a4.cameraStreamingNotSupported())})})},t.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(rl.PAUSED),this.showPausedState(),(mg(e)||e!==!0)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},t.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,n=function(){e.stateManagerProxy.directTransition(rl.SCANNING),e.hidePausedState()};if(!this.renderedCamera.isPaused()){n();return}this.renderedCamera.resume(function(){n()})},t.prototype.getState=function(){return this.stateManagerProxy.getState()},t.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var n=this.stateManagerProxy.startTransition(rl.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var a=document.getElementById(Df.SHADED_REGION_ELEMENT_ID);a&&e.element.removeChild(a)}},s=this;return this.renderedCamera.close().then(function(){return s.renderedCamera=null,s.element&&(s.element.removeChild(s.canvasElement),s.canvasElement=null),r(),s.qrRegion&&(s.qrRegion=null),s.context&&(s.context=null),n.execute(),s.hidePausedState(),s.isScanning=!1,Promise.resolve()})},t.prototype.scanFile=function(e,n){return this.scanFileV2(e,n).then(function(r){return r.decodedText})},t.prototype.scanFileV2=function(e,n){var r=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(mg(n)&&(n=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(s,a){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var l=o.width,c=o.height,u=document.getElementById(r.elementId),d=u.clientWidth?u.clientWidth:Df.DEFAULT_WIDTH,f=Math.max(u.clientHeight?u.clientHeight:c,Df.FILE_SCAN_MIN_HEIGHT),x=r.computeCanvasDrawConfig(l,c,d,f);if(n){var g=r.createCanvasElement(d,f,"qr-canvas-visible");g.style.display="inline-block",u.appendChild(g);var y=g.getContext("2d");if(!y)throw"Unable to get 2d context from canvas";y.canvas.width=d,y.canvas.height=f,y.drawImage(o,0,0,l,c,x.x,x.y,x.width,x.height)}var v=Df.FILE_SCAN_HIDDEN_CANVAS_PADDING,C=Math.max(o.width,x.width),N=Math.max(o.height,x.height),P=C+2*v,T=N+2*v,M=r.createCanvasElement(P,T);u.appendChild(M);var F=M.getContext("2d");if(!F)throw"Unable to get 2d context from canvas";F.canvas.width=P,F.canvas.height=T,F.drawImage(o,0,0,l,c,v,v,C,N);try{r.qrcode.decodeRobustlyAsync(M).then(function($){s(y2e.createFromQrcodeResult($))}).catch(a)}catch($){a("QR code parse error, error = ".concat($))}},o.onerror=a,o.onabort=a,o.onstalled=a,o.onsuspend=a,o.src=URL.createObjectURL(e)})},t.prototype.clear=function(){this.clearElement()},t.getCameras=function(){return A$t.retrieve()},t.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},t.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},t.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},t.prototype.applyVideoConstraints=function(e){if(e){if(!l$e.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},t.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},t.prototype.getSupportedFormats=function(e){var n=[js.QR_CODE,js.AZTEC,js.CODABAR,js.CODE_39,js.CODE_93,js.CODE_128,js.DATA_MATRIX,js.MAXICODE,js.ITF,js.EAN_13,js.EAN_8,js.PDF_417,js.RSS_14,js.RSS_EXPANDED,js.UPC_A,js.UPC_E,js.UPC_EAN_EXTENSION];if(!e||typeof e=="boolean"||!e.formatsToSupport)return n;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(e.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],s=0,a=e.formatsToSupport;s<a.length;s++){var o=a[s];i$t(o)?r.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(r.length===0)throw"None of formatsToSupport match supported values.";return r},t.prototype.getUseBarCodeDetectorIfSupported=function(e){if(mg(e))return!0;if(!mg(e.useBarCodeDetectorIfSupported))return e.useBarCodeDetectorIfSupported!==!1;if(mg(e.experimentalFeatures))return!0;var n=e.experimentalFeatures;return mg(n.useBarCodeDetectorIfSupported)?!0:n.useBarCodeDetectorIfSupported!==!1},t.prototype.validateQrboxSize=function(e,n,r){var s=this,a=r.qrbox;this.validateQrboxConfig(a);var o=this.toQrdimensions(e,n,a),l=function(u){if(u<Df.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Df.MIN_QR_BOX_SIZE,"px.")},c=function(u){return u>e&&(s.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),u=e),u};l(o.width),l(o.height),o.width=c(o.width)},t.prototype.validateQrboxConfig=function(e){if(typeof e!="number"&&typeof e!="function"&&(e.width===void 0||e.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},t.prototype.toQrdimensions=function(e,n,r){if(typeof r=="number")return{width:r,height:r};if(typeof r=="function")try{return r(e,n)}catch(s){throw new Error("qrbox config was passed as a function but it failed with unknown error"+s)}return r},t.prototype.setupUi=function(e,n,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(e,n,r);var s=mg(r.qrbox)?{width:e,height:n}:r.qrbox;this.validateQrboxConfig(s);var a=this.toQrdimensions(e,n,s);a.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=r.isShadedBoxEnabled()&&a.height<=n,l={x:0,y:0,width:e,height:n},c=o?this.getShadedRegionBounds(e,n,a):l,u=this.createCanvasElement(c.width,c.height),d={willReadFrequently:!0},f=u.getContext("2d",d);f.canvas.width=c.width,f.canvas.height=c.height,this.element.append(u),o&&this.possiblyInsertShadingElement(this.element,e,n,a),this.createScannerPausedUiElement(this.element),this.qrRegion=c,this.context=f,this.canvasElement=u},t.prototype.createScannerPausedUiElement=function(e){var n=document.createElement("div");n.innerText=a4.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",e.appendChild(n),this.scannerPausedUiElement=n},t.prototype.scanContext=function(e,n){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(s){return e(s.text,y2e.createFromQrcodeResult(s)),r.possiblyUpdateShaders(!0),!0}).catch(function(s){r.possiblyUpdateShaders(!1);var a=a4.codeParseError(s);return n(a,o$t.createFrom(a)),!1})},t.prototype.foreverScan=function(e,n,r){var s=this;if(this.shouldScan&&this.renderedCamera){var a=this.renderedCamera.getSurface(),o=a.videoWidth/a.clientWidth,l=a.videoHeight/a.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var c=this.qrRegion.width*o,u=this.qrRegion.height*l,d=this.qrRegion.x*o,f=this.qrRegion.y*l;this.context.drawImage(a,d,f,c,u,0,0,this.qrRegion.width,this.qrRegion.height);var x=function(){s.foreverScanTimeout=setTimeout(function(){s.foreverScan(e,n,r)},s.getTimeoutFps(e.fps))};this.scanContext(n,r).then(function(g){!g&&e.disableFlip!==!0?(s.context.translate(s.context.canvas.width,0),s.context.scale(-1,1),s.scanContext(n,r).finally(function(){x()})):x()}).catch(function(g){s.logger.logError("Error happend while scanning context",g),x()})}},t.prototype.createVideoConstraints=function(e){if(typeof e=="string")return{deviceId:{exact:e}};if(typeof e=="object"){var n="facingMode",r="deviceId",s={user:!0,environment:!0},a="exact",o=function(y){if(y in s)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(y,"'")},l=Object.keys(e);if(l.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(l.length," keys");var c=Object.keys(e)[0];if(c!==n&&c!==r)throw"Only '".concat(n,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(c===n){var u=e.facingMode;if(typeof u=="string"){if(o(u))return{facingMode:u}}else if(typeof u=="object")if(a in u){if(o(u["".concat(a)]))return{facingMode:{exact:u["".concat(a)]}}}else throw"'facingMode' should be string or object with"+" ".concat(a," as key.");else{var d=typeof u;throw"Invalid type of 'facingMode' = ".concat(d)}}else{var f=e.deviceId;if(typeof f=="string")return{deviceId:f};if(typeof f=="object"){if(a in f)return{deviceId:{exact:f["".concat(a)]}};throw"'deviceId' should be string or object with"+" ".concat(a," as key.")}else{var x=typeof f;throw"Invalid type of 'deviceId' = ".concat(x)}}}var g=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(g)},t.prototype.computeCanvasDrawConfig=function(e,n,r,s){if(e<=r&&n<=s){var a=(r-e)/2,o=(s-n)/2;return{x:a,y:o,width:e,height:n}}else{var l=e,c=n;return e>r&&(n=r/e*n,e=r),n>s&&(e=s/n*e,n=s),this.logger.log("Image downsampled from "+"".concat(l,"X").concat(c)+" to ".concat(e,"X").concat(n,".")),this.computeCanvasDrawConfig(e,n,r,s)}},t.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},t.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=e?Df.BORDER_SHADER_MATCH_COLOR:Df.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},t.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},t.prototype.createCanvasElement=function(e,n,r){var s=e,a=n,o=document.createElement("canvas");return o.style.width="".concat(s,"px"),o.style.height="".concat(a,"px"),o.style.display="none",o.id=mg(r)?"qr-canvas":r,o},t.prototype.getShadedRegionBounds=function(e,n,r){if(r.width>e||r.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(n-r.height)/2,width:r.width,height:r.height}},t.prototype.possiblyInsertShadingElement=function(e,n,r,s){if(!(n-s.width<1||r-s.height<1)){var a=document.createElement("div");a.style.position="absolute";var o=(n-s.width)/2,l=(r-s.height)/2;if(a.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderTop="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.borderBottom="".concat(l,"px solid rgba(0, 0, 0, 0.48)"),a.style.boxSizing="border-box",a.style.top="0px",a.style.bottom="0px",a.style.left="0px",a.style.right="0px",a.id="".concat(Df.SHADED_REGION_ELEMENT_ID),n-s.width<11||r-s.height<11)this.hasBorderShaders=!1;else{var c=5,u=40;this.insertShaderBorders(a,u,c,-c,null,0,!0),this.insertShaderBorders(a,u,c,-c,null,0,!1),this.insertShaderBorders(a,u,c,null,-c,0,!0),this.insertShaderBorders(a,u,c,null,-c,0,!1),this.insertShaderBorders(a,c,u+c,-c,null,-c,!0),this.insertShaderBorders(a,c,u+c,null,-c,-c,!0),this.insertShaderBorders(a,c,u+c,-c,null,-c,!1),this.insertShaderBorders(a,c,u+c,null,-c,-c,!1),this.hasBorderShaders=!0}e.append(a)}},t.prototype.insertShaderBorders=function(e,n,r,s,a,o,l){var c=document.createElement("div");c.style.position="absolute",c.style.backgroundColor=Df.BORDER_SHADER_DEFAULT_COLOR,c.style.width="".concat(n,"px"),c.style.height="".concat(r,"px"),s!==null&&(c.style.top="".concat(s,"px")),a!==null&&(c.style.bottom="".concat(a,"px")),l?c.style.left="".concat(o,"px"):c.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(c),e.appendChild(c)},t.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},t.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},t.prototype.getTimeoutFps=function(e){return 1e3/e},t}(),_2e;(function(t){t[t.STATUS_DEFAULT=0]="STATUS_DEFAULT",t[t.STATUS_SUCCESS=1]="STATUS_SUCCESS",t[t.STATUS_WARNING=2]="STATUS_WARNING",t[t.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(_2e||(_2e={}));function D_(){const[t,e]=m.useState(!1),[n,r]=m.useState([]),[s,a]=m.useState(null),[o,l]=m.useState(null),c=m.useRef(null);m.useEffect(()=>{l(localStorage.getItem("hyperAddress"))},[]),m.useEffect(()=>{t&&E2e.getCameras().then(d=>{r(d||[]);const x=d.find(g=>/back|environment/i.test(g.label))||d[0];x&&a(x.id)})},[t]),m.useEffect(()=>{if(!t||!s)return;const d=new E2e("reader"),f={deviceId:{exact:s}},x={fps:10,qrbox:250};return d.start(f,x,g=>window.location.href=g,console.error),()=>d.stop().then(()=>d.clear())},[t,s]);const u=()=>{l(null),window.localStorage.removeItem("hyperAddress"),window.localStorage.removeItem("hyperToken"),setHyperToken(""),setHyperAddress(""),window.location.reload()};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:o?u:()=>e(!0),className:"font-bold w-full",children:o?i.jsx("span",{className:"text-red-400",children:"Logout"}):i.jsx("span",{className:"text-white",children:"Connect"})}),t&&i.jsx("div",{className:"fixed inset-0 grid place-items-center bg-black/60",children:i.jsxs("div",{className:"bg-[#1b1b1b] p-4 rounded-xl space-y-4",children:[i.jsx("select",{value:s||"",onChange:d=>a(d.target.value),className:"w-full p-2 rounded text-sm bg-slate-950 font-manrope font-bold",children:n.map(d=>i.jsx("option",{value:d.id,children:d.label||d.id},d.id))}),i.jsx("div",{id:"reader",ref:c,className:"w-[300px]"}),i.jsx("button",{onClick:()=>e(!1),className:"w-full p-2 rounded text-sm bg-red-400 text-black font-bold font-manrope",children:"Close"})]})})]})}const P$t=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState(!1),[s,a]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(!1),[x,g]=m.useState(!1),[y,v]=m.useState(!1),[C,N]=m.useState(!1),P=()=>{e(!t)};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"bg-[#171717] w-full px-2 sm:px-6 flex justify-between items-center border-b border-[#2a2a2a] z-50 h-[60px]",children:[i.jsx(Ho,{to:"/",className:"cursor-pointer",children:i.jsx("div",{className:"flex justify-start items-center gap-[8.09px] font-manrope",children:i.jsxs("div",{className:"flex justify-start items-center min-w-max",children:[i.jsx("img",{src:Yi,alt:"Dextrabot",className:"w-[30.91321px] h-8"}),i.jsx("span",{className:"text-white font-manrope text-sm ml-2 font-semibold",children:"Dextrabot"})]})})}),i.jsxs("div",{className:"w-[84px] h-6 p-2 bg-[#232323] rounded-[256px] justify-start items-center gap-2.5 hidden sm:inline-flex cursor-not-allowed",children:[i.jsxs("div",{className:"h-4 justify-start items-center gap-[5px] flex",children:[i.jsx("img",{src:I1,alt:"Dextrabot",className:"w-3.5 h-3.5"}),i.jsx("div",{className:"text-white text-[11px] font-extrabold font-manrope leading-none",children:"HYPE"})]}),i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx(ld,{className:"text-white w-3 h-3"})})]}),i.jsx("div",{onClick:P,className:"p-2 bg-[#171717] cursor-pointer",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 fill-current text-white",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),t&&i.jsxs("div",{className:"fixed inset-0 w-screen h-screen bg-[#171717]/10 z-50 backdrop-blur-xl overflow-hidden",children:[i.jsx("div",{onClick:P,className:"absolute top-3 right-2 p-2 bg-transparent cursor-pointer",children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 fill-current text-white",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),i.jsx("div",{className:"w-full h-full px-4 pt-5 pb-16 overflow-y-auto",children:i.jsxs("div",{className:"flex flex-col gap-2 w-full text-xl font-manrope items-start text-left [&>a]:text-white [&>a]:font-bold",children:[i.jsx(D_,{}),i.jsx(Ho,{to:"/terminal/BTC",onClick:()=>e(!1),children:"Terminal"}),i.jsx(Ho,{to:"/discover-wallets",onClick:()=>e(!1),children:"Discover Wallets"}),i.jsx(Ho,{to:"/hyperliquid-vaults",onClick:()=>e(!1),children:"Discover Vaults"}),i.jsx(Ho,{to:"/copy-trade",onClick:()=>e(!1),children:"My Copy Trading"}),i.jsx(Ho,{to:"/wallet-management",onClick:()=>e(!1),children:"Wallet Management"}),i.jsx(Ho,{to:"/ticker",onClick:()=>e(!1),children:"Ticker"}),i.jsx(Ho,{to:"/leaderboard",onClick:()=>e(!1),children:"Leaderboard"}),i.jsx(Ho,{to:"/referral",onClick:()=>e(!1),children:"Referral"}),i.jsx(Ho,{to:"/tracked-wallets",onClick:()=>e(!1),children:"Tracked Wallets"}),i.jsx(Ho,{to:"/tracker",onClick:()=>e(!1),children:"My Activities"}),i.jsx(Ho,{to:"/hyperliquid-whale-trades",onClick:()=>e(!1),children:"Whale trades"}),i.jsx(Ho,{to:"/back-testing",onClick:()=>e(!1),children:"Backtest"}),i.jsx(Ho,{to:"/hyperliquid-fee-calculator ",onClick:()=>e(!1),children:"HL Fee Calculator"}),i.jsxs(Ho,{to:"/terminal/extended/BTC#gridbot",onClick:()=>e(!1),children:["Extended Grid Bot ",i.jsx(Lg,{})]}),i.jsxs(Ho,{to:"/dca-bot",onClick:()=>e(!1),children:["Extended DCA Bot ",i.jsx(Lg,{})]}),i.jsxs("div",{onClick:()=>g(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:["Extended Farming ",i.jsx(Lg,{tone:"emerald",label:"SMART"})]}),i.jsxs(Ho,{to:"/terminal/lighter/BTC#gridbot",onClick:()=>e(!1),children:["Lighter Grid Bot ",i.jsx(Lg,{})]}),i.jsxs(Ho,{to:"/terminal/hyperliquid/BTC#gridbot",onClick:()=>e(!1),children:["HL Grid Bot ",i.jsx(Lg,{})]}),i.jsx(Ho,{to:"/market-maker",onClick:()=>e(!1),children:"HL Market Maker"}),i.jsx("div",{onClick:()=>a(!0),className:"text-white font-bold cursor-pointer",children:"Aster Farming"}),i.jsx("div",{onClick:()=>l(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Lighter Farming"}),i.jsx("div",{onClick:()=>u(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Apex Farming"}),i.jsx("div",{onClick:()=>f(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Variational Farming"}),i.jsx("div",{onClick:()=>v(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Paradex Farming"}),i.jsx("div",{onClick:()=>N(!0),className:"text-white font-bold cursor-pointer inline-flex items-center",children:"Pacifica Farming"})]})})]}),i.jsx(gce,{open:n,setOpen:r}),i.jsx(bce,{open:s,setOpen:a}),i.jsx(yce,{open:o,setOpen:l}),i.jsx(vce,{open:c,setOpen:u}),i.jsx(wce,{open:d,setOpen:f}),i.jsx(wU,{open:x,setOpen:g}),i.jsx(Cce,{open:y,setOpen:v}),i.jsx(Sce,{open:C,setOpen:N})]})},u$e=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:t,children:[i.jsx("path",{d:"M1 9L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9 9L1 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),I$t=()=>{var fe,q,se,ae,W,V;const t=m.useRef(null),[e,n]=m.useState(!1),[r,s]=m.useState([]),[a,o]=m.useState([]),[l,c]=m.useState(!1),[u,d]=m.useState(!1),[f,x]=m.useState(()=>{const ee=localStorage.getItem("isToasterMinimized");return ee===null?!1:ee==="true"});m.useEffect(()=>{localStorage.setItem("isToasterMinimized",f)},[f]);const[g,y]=m.useState([]),C=localStorage.getItem("isDateToasterFormat")||"date",[N,P]=m.useState(C);m.useEffect(()=>{localStorage.setItem("isDateToasterFormat",N)},[N]);const[T,M]=m.useState(0),F=m.useRef(null),[$,L]=m.useState(null),[z,X]=m.useState(0),ne=1e4;m.useEffect(()=>{if(l||r.length===0||e){clearInterval(F.current);return}const ee=Date.now();return L(ee),F.current=setTimeout(()=>{M(oe=>(oe+1)%r.length),X(0)},ne-z),()=>clearTimeout(F.current)},[l,r.length,e,T,z]),m.useEffect(()=>{T>=(r==null?void 0:r.length)&&M(0)},[r]);async function J(){try{d(!0);const ee=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/analysis/getallmetrics/");if(!ee.ok)throw new Error(`Server responded with status ${ee.status}`);const oe=await ee.json();oe&&s(oe.refcodes)}catch(ee){return console.error("Error fetching metrics:",ee.message),null}finally{d(!1)}}m.useEffect(()=>{let ee;return f||(J(),ee=setInterval(()=>{J()},6e4)),()=>{ee&&clearInterval(ee)}},[f]),m.useEffect(()=>{var ee;if((r==null?void 0:r.length)>0)if((a==null?void 0:a.length)<(r==null?void 0:r.length)){const oe=[...a??[]],de=Array.from({length:(r==null?void 0:r.length)-((a==null?void 0:a.length)??0)},(xe,be)=>be+((a==null?void 0:a.length)??0)),Ce=de==null?void 0:de.sort(()=>Math.random()-.5),me=[...oe,...Ce??[]];o(me);const we=me==null?void 0:me.map(xe=>r==null?void 0:r[xe]);y(we)}else{const oe=(ee=a==null?void 0:a.map(de=>r==null?void 0:r[de]))==null?void 0:ee.filter(Boolean);y(oe)}},[r]);const[K,te]=m.useState(!1);return i.jsxs("div",{className:"absolute right-6 bottom-[72px] sm:bottom-6 rounded-[20px] z-50",children:[f&&i.jsx("div",{onClick:()=>{x(ee=>{const oe=!ee;return localStorage.setItem("isToasterMinimized",oe?"true":"false"),oe})},className:"fixed bottom-10 right-4 z-50 cursor-pointer bg-[#2a2a2a]/60 hover:bg-[#2a2a2a] rounded-full w-12 h-12 flex items-center justify-center shadow-md group",children:i.jsx("img",{src:SEe,alt:"Toggle",className:"w-8 h-8 opacity-90 group-hover:opacity-100"})}),(!f||K)&&i.jsxs("div",{style:{background:"rgba(32, 32, 32, 0.86)",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"},className:`${K?"bounceShrink-Close-Toaster-Close":""} w-full h-full min-h-full relative rounded-[20px]`,children:[i.jsxs("div",{onClick:()=>{c(!l)},style:{backgroundColor:"rgba(40, 40, 42, 0.75)",backdropFilter:"blur(10px)"},className:`${(r==null?void 0:r.length)>0?"":"hidden"} cursor-pointer w-full h-[20px] rounded-t-full flex justify-center items-center relative`,children:[i.jsx("div",{className:"w-[36px] h-[4px] bg-[rgba(255,255,255,0.3)] rounded-[2px]"}),i.jsx("div",{onClick:ee=>{ee.stopPropagation(),te(!0),setTimeout(()=>{x(oe=>{const de=!oe;return localStorage.setItem("isToasterMinimized",de?"true":"false"),de}),te(!1)},600)},className:"w-6 h-4 rounded-[2px] absolute group right-[14px]",children:i.jsx("span",{className:"flex items-center justify-center h-full",children:i.jsx(u$e,{className:"w-2 h-2 text-[#7A7A7A] group-hover:text-white"})})})]}),i.jsx("div",{className:`${l?"max-h-[70vh] lg:max-h-[75vh] min-h-[100px] overflow-y-scroll pl-2 py-2 pr-1 rounded-[20px]":"min-h-full h-full p-0 rounded-b-[20px]"} flex flex-col items-start gap-2 bg-transparent max-w-[356px] transition-all duration-300 overflow-hidden`,children:!l&&(r==null?void 0:r.length)>0?i.jsx("div",{style:{backgroundColor:" rgba(32, 32, 32, 0.86)",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.64)",backdropFilter:"blur(16px)"},onMouseEnter:()=>{t.current&&(t.current.style.animationPlayState="paused"),n(!0),$&&X(ee=>ee+(Date.now()-$))},onMouseLeave:()=>{t.current&&(t.current.style.animationPlayState="running"),n(!1)},className:"relative h-full w-full overflow-hidden",children:i.jsx("div",{className:"w-full h-full flex flex-col justify-start items-start animate-fade-slide transition-all duration-500",children:i.jsx(k2e,{content:(fe=g[T])==null?void 0:fe.result,createdAt:(q=g[T])==null?void 0:q.created_at,category:(se=g[T])==null?void 0:se.category,metric:(ae=g[T])==null?void 0:ae.metric,metricId:(W=g[T])==null?void 0:W.metric_definition_id,isDeleted:(V=g[T])==null?void 0:V.is_deleted,isDateToasterFormat:N,setIsDateToasterFormat:P,isDropdownOpen:l,activeIndex:T,progressRef:t})},`toast-${T}`)}):g==null?void 0:g.map((ee,oe)=>i.jsx(k2e,{content:ee==null?void 0:ee.result,createdAt:ee==null?void 0:ee.created_at,category:ee==null?void 0:ee.category,metric:ee==null?void 0:ee.metric,metricId:ee==null?void 0:ee.metric_definition_id,isDeleted:ee==null?void 0:ee.is_deleted,isDateToasterFormat:N,setIsDateToasterFormat:P,isDropdownOpen:l,progressRef:t},oe))})]})]})},k2e=({content:t,createdAt:e,category:n,metric:r,metricId:s,isDeleted:a,isDateToasterFormat:o,setIsDateToasterFormat:l,isDropdownOpen:c,activeIndex:u,progressRef:d})=>{var P,T;function f({date:M}){const[F,$]=m.useState($o(M));return m.useEffect(()=>{const L=setInterval(()=>{$($o(M))},1e3);return()=>clearInterval(L)},[M]),i.jsxs("span",{className:"text-[#989898] text-[11px] font-normal font-inter leading-[13px] tracking-tight italic",children:["updated ",F==null?void 0:F.dateTime]})}const x=s===1||s===2||s===3,g=s===4||s===5||s===6,y=s===7||s===8||s===9,v=s===1||s===4||s===7,C=s===2||s===5||s===8,N=s===3||s===6||s===9;return i.jsxs("div",{onClick:M=>{M.preventDefault(),window.open(`/wallet-details/${(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress)}`,"_blank")},style:x?{background:"rgba(32, 32, 32, 0.86)",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:g?{background:"#FF42170A",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:y?{background:"#00FF910A",boxShadow:"0px 4px 16px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"}:{},className:`${c?"rounded-[20px]":"rounded-b-[20px]"} ${x||y?"min-h-[107px]":g?"min-h-[123px]":""}
w-full flex gap-2 items-start justify-start px-3 pt-3 pb-2 bg-[#2b2b2b] hover:bg-[#404040] relative overflow-hidden cursor-pointer`,children:[i.jsx("div",{className:"w-10 h-10 rounded-[256px] blur-xl absolute -z-10 top-2 left-2"}),i.jsx("div",{style:x?{backgroundColor:"#FFC526"}:g?{background:"linear-gradient(180deg, #FF7300 0%, #FF2525 100%)",backgroundBlendMode:"lighten, normal, normal",boxShadow:"0px 4px 24px 0px rgba(255, 96, 10, 0.32), 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"}:y?{background:"linear-gradient(180deg, #00FF90 0%, #00FF4D 100%)",boxShadow:"0px 4px 24px 0px rgba(44, 255, 163, 0.32), 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"}:{},className:`${c?"":"toaster-animation-shake-animate"} flex justify-center items-center overflow-hidden w-10 h-10 min-w-10 min-h-10 rounded-full`,children:i.jsx("img",{src:`${x?SEe:g?wEe:y?Ylt:""}`,alt:"",className:`${x?"w-[40px] h-[40px] min-w-[40px] min-h-[40px]":"w-[24px] h-[24px] min-w-[24px] min-h-[24px]"}`,loading:"lazy",onError:M=>wm(M)})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[3px] w-full",children:[i.jsxs("div",{className:"flex justify-between items-center gap-1",children:[i.jsxs("p",{className:"text-white text-[13px] font-semibold font-['Manrope'] leading-[16px]",children:[i.jsxs("span",{className:"inline-flex justify-start items-center gap-1 cursor-pointer min-w-max max-w-max h-[18px] p-1 mr-1 bg-white/[0.06] rounded-md",children:[i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope leading-none ",children:t!=null&&t.dextraaddress||t!=null&&t.sourceaddress?((P=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:P.slice(0,5))+".."+((T=(t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress))==null?void 0:T.slice(-4)):"--"}),i.jsx("img",{onClick:M=>{M.stopPropagation(),navigator.clipboard.writeText((t==null?void 0:t.dextraaddress)||(t==null?void 0:t.sourceaddress)),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),x?`is one of ${v?"today's":C?"week's":N?"month's":""} most profitable Top Follower Wallets!`:g?`has generated $${t!=null&&t.earned_rpnl?_r(t==null?void 0:t.earned_rpnl):"-"} in profits for its followers ${v?"today":C?"this week":N?"this month":""} - a wallet you’ll want to watch!`:y?`is one of ${v?"today's":C?"this week's":N?"this month's":""} most copied wallets!`:""]}),i.jsx("div",{className:`${x?"-mt-[18px]":g?"-mt-[30px]":y?"-mt-[16px]":""} w-[18px] h-[18px] min-w-[18px] min-h-[18px] flex justify-center items-start rounded `,children:i.jsx("img",{src:pae,alt:""})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1 mt-2",children:[i.jsxs("div",{className:`${c?"":"toaster-animation-shake-new-profit-animate"} p-1.5 bg-[#67ffbd]/20 rounded-md inline-flex justify-center items-center gap-1 max-h-5`,children:[y&&i.jsx("img",{src:Xlt,alt:"",className:"w-[14px] h-[14px]"}),g&&i.jsx("img",{src:Qlt,alt:"",className:"w-[14px] h-[10px]"}),i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-['Manrope'] leading-[8px]",children:x?`+$${t!=null&&t.rpnl?_r(t==null?void 0:t.rpnl):"-"}`:g?`+$${t!=null&&t.earned_rpnl?_r(t==null?void 0:t.earned_rpnl):"-"}`:y?_r(t==null?void 0:t.copier_count):""})]}),i.jsx("div",{className:`${x?"bg-white/20":g?"bg-[#FF670029]":y?"bg-[#67FFBD29]":""} p-1.5 rounded-md inline-flex justify-center items-center gap-1`,children:i.jsx("div",{className:`${x?"text-white":g?"text-[#FF6700]":y?"text-[#67FFBD]":""} justify-start text-[11px] font-semibold font-['Manrope'] leading-[8px]`,children:x?"Top Follower Wallets":g?"Top Source Wallets":y?"Most Copied Wallets":""})}),i.jsx("div",{className:`${x?"bg-white/20":g?"bg-[#FF670029]":y?"bg-[#67FFBD29]":""} w-max p-1.5 rounded-md inline-flex justify-center items-center gap-1"
`,children:i.jsx("div",{className:`${x?"text-white":g?"text-[#FF6700]":y?"text-[#67FFBD]":""} justify-start text-[11px] font-semibold font-['Manrope'] leading-[8px]`,children:v?"1D":C?"7D":N?"30D":""})})]}),i.jsxs("div",{className:`${c?"justify-start":"justify-between"} flex items-center w-full mt-1.5`,children:[i.jsx("div",{onClick:M=>{M.stopPropagation(),l(o=="date"?"time":"date")},className:"flex justify-end items-center text-[#989898] text-[11px] font-medium font-['Inter'] leading-[13px] tracking-tight cursor-pointer min-w-max w-max italic",children:o=="date"?i.jsx(f,{date:e}):cu(e)}),!c&&i.jsx("div",{className:"w-[26px] h-[3px] bg-[#3a3a3a] rounded overflow-hidden",children:!c&&i.jsx("div",{ref:d,className:"h-full bg-white progress-bar-animate"},`progress-${u}`)})]})]})]})},F$t=()=>i.jsx("div",{onClick:()=>{window.open("https://x.com/dextrabot","_blank")},className:"flex justify-center items-center bg-transparent rounded-full cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:Glt,alt:"",className:"w-[14px] h-[14px]"})}),O$t=()=>i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank")},className:"flex justify-center items-center gap-2.5 bg-transparent rounded-2xl cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:CEe,alt:"",className:"w-[14px] h-[14px]"})}),M$t=()=>i.jsx("div",{onClick:()=>{window.open("https://t.me/Dextrabot_Official","_blank")},className:"flex justify-center items-center gap-2.5 bg-transparent rounded-2xl cursor-pointer h-6 w-6 min-h-6",children:i.jsx("img",{src:Klt,alt:"",className:"w-[14px] h-[14px]"})}),R$t=()=>i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/","_blank"),className:"h-6 w-max min-h-6 py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]}),L$t=({open:t,setOpen:e,favoriteName:n,setFavoriteName:r,likeError:s,like:a,setLikeError:o})=>i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-[34px]",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(""),o("")},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:wlt,alt:"",className:"w-[64px h-[64px]"})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-4",children:[i.jsx("div",{className:"w-80 text-center text-white text-2xl font-semibold font-manrope leading-7 pt-[3px]",children:"Track Wallet"}),i.jsx("div",{className:"w-[248px] text-center text-white/60 text-sm font-medium font-manrope leading-none tracking-tight -mt-[8px]",children:"Enter tag for your wallet"}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-full pt-[39px] pl-[20px]",children:[i.jsx("div",{className:"text-[#b7b7b7] text-[13px] font-semibold font-manrope leading-[8px]",children:"Tag"}),i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"(ex:twain_wallet)"})]}),i.jsx("input",{type:"text",value:n,onChange:l=>r(l.target.value),placeholder:"Wallet Tag",className:"px-2.5 py-3 focus:outline-none focus:ring-0 outline-none w-[286px] min-w-[286px] h-8 bg-[#1b1b1b] rounded-[10px] border border-[#303030] text-white placeholder:text-[#7b7b7b] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px] -mt-[2px]"}),i.jsxs("div",{onClick:()=>{a(n)},className:"w-[285px] h-8 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer -mt-[2px]",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Track"})]}),i.jsx("div",{className:"text-[#ff6e67] text-xs font-semibold font-manrope absolute bottom-2.5 mx-auto w-full pl-[58px]",children:s&&s})]})]})})})})})]});function B5({walletAddress:t,children:e}){const{isConnected:n,address:r}=ns(),{trackedWatchList:s,getTrackedWatchList:a,setSignModalOpen:o}=m.useContext(Qr),[l,c]=m.useState(""),[u,d]=m.useState(!1),[f,x]=m.useState(""),g=async C=>{try{const N=window.localStorage.getItem("hyperToken"),P="https://dextrabothypev2.nftinit.io/api/hyper/tracker/save/",T=window.localStorage.getItem("hyperAddress");if(N||o(!0),!C){x("Please enter a wallet label.");return}const M=await fetch(P,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():T,token:N,track_address:t,tag:C})});M.ok;const F=await M.json();F.success?(a(),c(""),d(!1),x(""),tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:t.slice(0,5)+"..."+t.slice(-3)}),i.jsxs("span",{style:{color:"#67ffbd",paddingLeft:"5px"},children:[" ","added to tracked wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.32)",width:"380px",minWidth:"380px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})):(console.log(F.error_message),tn.error(F.error_message),x(F.error_message))}catch(N){console.error("Error in like function:",N),tn.error(N.message||"Something went wrong!"),x(N.message)}},y=async()=>{try{const C=window.localStorage.getItem("hyperToken"),N=window.localStorage.getItem("hyperAddress"),P="https://dextrabothypev2.nftinit.io/api/hyper/tracker/unfollow/";C||o(!0);const T=await fetch(P,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:r?r.toLowerCase():N,token:C,track_address:t})});if(!T.ok)throw new Error(`Failed to unlike: ${T.status} ${T.statusText}`);const M=await T.json();M.success?(a(),tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:t.slice(0,5)+"..."+t.slice(-3)}),i.jsxs("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:[" ","removed from tracked wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.error(M.error_message),tn.error(M.error_message))}catch(C){console.error("Error in unlike function:",C),tn.error(C.message||"Something went wrong!")}},v=()=>{window.localStorage.getItem("hyperToken")?d(!0):o(!0)};return i.jsxs(i.Fragment,{children:[i.jsx(L$t,{open:u,setOpen:d,like:g,favoriteName:l,setFavoriteName:c,likeError:f,setLikeError:x}),i.jsx("div",{className:"",onClick:()=>{s!=null&&s.some(C=>C.wallet_address===t)?y():v()},children:e})]})}function D$t({open:t,setOpen:e,copyTradeSave:n}){return i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:"w-80 text-center text-white text-2xl font-semibold font-manropeleading-7",children:"Are you sure?"}),i.jsx("div",{className:"w-[348px] text-center text-white/60 text-[16px] font-medium font-manrope leading-5",children:"You have not set a Stop Loss or Take Profit for this trade. In order to set a secondary security option for potential Hyperliquid data delays, server issues, or other technical disruptions, you may want to set up your own stop loss and take profit values."})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:()=>{n()},className:"h-8 px-2.5 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Yes"})})]})]})})})})})]})}const oa=(t,e=null)=>{e&&t.target.src===e?t.target.src=qa:e&&t.target.src!==e?t.target.src=e:t.target.src!==qa&&(t.target.src=qa)};function B$t({positions:t,loading:e}){const[n,r]=m.useState(!1),[s,a]=m.useState("upnl"),[o,l]=m.useState("desc"),c=d=>{s===d?l(o==="asc"?"desc":"asc"):(a(d),l("asc"))},u=m.useMemo(()=>{if(!t||t.length===0)return[];const d=[...t];return s&&d.sort((f,x)=>{var g,y;if(s==="coin"){const v=((g=f.asset)==null?void 0:g.toLowerCase())||"",C=((y=x.asset)==null?void 0:y.toLowerCase())||"";return v<C?o==="asc"?-1:1:v>C?o==="asc"?1:-1:0}if(s==="upnl"){const v=parseFloat(f.unrealizedPnl)||0,C=parseFloat(x.unrealizedPnl)||0;return v<C?o==="asc"?-1:1:v>C?o==="asc"?1:-1:0}return 0}),d},[t,s,o]);return m.useEffect(()=>{if(e)r(!1);else{r(!1);const d=setTimeout(()=>{r(!0)},500);return()=>clearTimeout(d)}},[e]),e||!n?i.jsx("div",{className:"flex w-full justify-center items-center text-center h-[36vh] max-h-[170px]",children:i.jsx($a,{})}):!u||u.length===0?i.jsx("div",{className:"flex w-full justify-center items-center text-center h-[36vh] max-h-[170px]",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No open positions are currently available"})})]})}):i.jsx("div",{className:"relative w-full",children:i.jsx("div",{className:"w-full overflow-y-auto max-h-[156px] h-full flex-grow mt-[1px] mb-3 pb-24",children:i.jsxs("table",{className:"w-full relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 z-[3] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] bg-[#242424] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky left-0 h-10 pl-2 sm:pl-6 min-w-[80px] z-[8] cursor-pointer",onClick:()=>c("coin"),children:i.jsxs("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max",children:["Coin",s==="coin"?o==="asc"?i.jsx(i2,{}):i.jsx(s2,{}):i.jsx(a2,{})]})}),i.jsx("th",{scope:"col",className:"px-1",children:i.jsx("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max",children:"Type"})}),i.jsx("th",{scope:"col",className:"px-4 text-right cursor-pointer",onClick:()=>c("upnl"),children:i.jsxs("div",{className:"inline-flex items-center justify-end w-full gap-1",children:[i.jsx("span",{children:"uPnL"}),s==="upnl"?o==="asc"?i.jsx(i2,{}):i.jsx(s2,{}):i.jsx(a2,{})]})})]})}),i.jsx("tbody",{children:u.map((d,f)=>{const x=parseFloat(d.unrealizedPnl)>=0,g=d.type==="Long"?"text-[#67FFBD] rotate-180":"text-[#FF797C]";return i.jsxs("tr",{className:`relative group hover:bg-[#222222] text-white h-[32px] max-h-[32px] rounded-2xl ${f%2===0?"bg-[#202020]":"bg-[#2D2D2D]"}`,children:[i.jsx("td",{scope:"row",className:"sticky left-0 z-[2] rounded-l-xl",children:i.jsx("div",{onClick:()=>{window.open(`/terminal/${d==null?void 0:d.asset}`,"_blank")},className:"flex justify-start items-center gap-2 pl-2 sm:pl-6 h-8 max-h-14 cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${d==null?void 0:d.asset}.svg`,alt:d==null?void 0:d.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:y=>oa(y)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:d.asset})]})})}),i.jsx("td",{children:i.jsx("div",{className:"flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${d.type==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:i.jsx(Os,{className:`${g} w-3 h-3`})})}),i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:d.type})]})})}),i.jsx("td",{className:"rounded-r-xl text-right pr-2",children:i.jsx("div",{className:`${x?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-tight`,children:`$${_r(d.unrealizedPnl||0)}`})})]},f)})})]})})})}const{min:$$t,max:U$t}=Math,S3=(t,e=0,n=1)=>$$t(U$t(e,t),n),Gce=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=S3(t[e],0,255)):e===3&&(t[e]=S3(t[e],0,1));return t},d$e={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])d$e[`[object ${t}]`]=t.toLowerCase();function qi(t){return d$e[Object.prototype.toString.call(t)]||"object"}const Fi=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):qi(t[0])=="object"&&e?e.split("").filter(n=>t[0][n]!==void 0).map(n=>t[0][n]):t[0].slice(0),bj=t=>{if(t.length<2)return null;const e=t.length-1;return qi(t[e])=="string"?t[e].toLowerCase():null},{PI:kU,min:f$e,max:h$e}=Math,up=t=>Math.round(t*100)/100,Sne=t=>Math.round(t*100)/100,Sg=kU*2,Iq=kU/3,z$t=kU/180,H$t=180/kU;function p$e(t){return[...t.slice(0,3).reverse(),...t.slice(3)]}const _i={format:{},autodetect:[]};let Zr=class{constructor(...e){const n=this;if(qi(e[0])==="object"&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let r=bj(e),s=!1;if(!r){s=!0,_i.sorted||(_i.autodetect=_i.autodetect.sort((a,o)=>o.p-a.p),_i.sorted=!0);for(let a of _i.autodetect)if(r=a.test(...e),r)break}if(_i.format[r]){const a=_i.format[r].apply(null,s?e:e.slice(0,-1));n._rgb=Gce(a)}else throw new Error("unknown format: "+e);n._rgb.length===3&&n._rgb.push(1)}toString(){return qi(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const V$t="3.1.2",bi=(...t)=>new Zr(...t);bi.version=V$t;const HN={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},W$t=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,q$t=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,m$e=t=>{if(t.match(W$t)){(t.length===4||t.length===7)&&(t=t.substr(1)),t.length===3&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16),n=e>>16,r=e>>8&255,s=e&255;return[n,r,s,1]}if(t.match(q$t)){(t.length===5||t.length===9)&&(t=t.substr(1)),t.length===4&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16),n=e>>24&255,r=e>>16&255,s=e>>8&255,a=Math.round((e&255)/255*100)/100;return[n,r,s,a]}throw new Error(`unknown hex color: ${t}`)},{round:oF}=Math,x$e=(...t)=>{let[e,n,r,s]=Fi(t,"rgba"),a=bj(t)||"auto";s===void 0&&(s=1),a==="auto"&&(a=s<1?"rgba":"rgb"),e=oF(e),n=oF(n),r=oF(r);let l="000000"+(e<<16|n<<8|r).toString(16);l=l.substr(l.length-6);let c="0"+oF(s*255).toString(16);switch(c=c.substr(c.length-2),a.toLowerCase()){case"rgba":return`#${l}${c}`;case"argb":return`#${c}${l}`;default:return`#${l}`}};Zr.prototype.name=function(){const t=x$e(this._rgb,"rgb");for(let e of Object.keys(HN))if(HN[e]===t)return e.toLowerCase();return t};_i.format.named=t=>{if(t=t.toLowerCase(),HN[t])return m$e(HN[t]);throw new Error("unknown color name: "+t)};_i.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&HN[t.toLowerCase()])return"named"}});Zr.prototype.alpha=function(t,e=!1){return t!==void 0&&qi(t)==="number"?e?(this._rgb[3]=t,this):new Zr([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]};Zr.prototype.clipped=function(){return this._rgb._clipped||!1};const X0={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},G$t=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function qg(t){const e=G$t.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);X0.labWhitePoint=t,X0.Xn=e[0],X0.Zn=e[1]}function B_(){return X0.labWhitePoint}const Kce=(...t)=>{t=Fi(t,"lab");const[e,n,r]=t,[s,a,o]=K$t(e,n,r),[l,c,u]=g$e(s,a,o);return[l,c,u,t.length>3?t[3]:1]},K$t=(t,e,n)=>{const{kE:r,kK:s,kKE:a,Xn:o,Yn:l,Zn:c}=X0,u=(t+16)/116,d=.002*e+u,f=u-.005*n,x=d*d*d,g=f*f*f,y=x>r?x:(116*d-16)/s,v=t>a?Math.pow((t+16)/116,3):t/s,C=g>r?g:(116*f-16)/s,N=y*o,P=v*l,T=C*c;return[N,P,T]},Fq=t=>{const e=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*e},g$e=(t,e,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:s,MtxXYZ2RGB:a,RefWhiteRGB:o,Xn:l,Yn:c,Zn:u}=X0,d=l*r.m00+c*r.m10+u*r.m20,f=l*r.m01+c*r.m11+u*r.m21,x=l*r.m02+c*r.m12+u*r.m22,g=o.X*r.m00+o.Y*r.m10+o.Z*r.m20,y=o.X*r.m01+o.Y*r.m11+o.Z*r.m21,v=o.X*r.m02+o.Y*r.m12+o.Z*r.m22,C=(t*r.m00+e*r.m10+n*r.m20)*(g/d),N=(t*r.m01+e*r.m11+n*r.m21)*(y/f),P=(t*r.m02+e*r.m12+n*r.m22)*(v/x),T=C*s.m00+N*s.m10+P*s.m20,M=C*s.m01+N*s.m11+P*s.m21,F=C*s.m02+N*s.m12+P*s.m22,$=Fq(T*a.m00+M*a.m10+F*a.m20),L=Fq(T*a.m01+M*a.m11+F*a.m21),z=Fq(T*a.m02+M*a.m12+F*a.m22);return[$*255,L*255,z*255]},Yce=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=b$e(e,n,r),[c,u,d]=Y$t(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function Y$t(t,e,n){const{Xn:r,Yn:s,Zn:a,kE:o,kK:l}=X0,c=t/r,u=e/s,d=n/a,f=c>o?Math.pow(c,1/3):(l*c+16)/116,x=u>o?Math.pow(u,1/3):(l*u+16)/116,g=d>o?Math.pow(d,1/3):(l*d+16)/116;return[116*x-16,500*(f-x),200*(x-g)]}function Oq(t){const e=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const b$e=(t,e,n)=>{t=Oq(t/255),e=Oq(e/255),n=Oq(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:s,MtxAdaptMaI:a,Xn:o,Yn:l,Zn:c,As:u,Bs:d,Cs:f}=X0;let x=t*r.m00+e*r.m10+n*r.m20,g=t*r.m01+e*r.m11+n*r.m21,y=t*r.m02+e*r.m12+n*r.m22;const v=o*s.m00+l*s.m10+c*s.m20,C=o*s.m01+l*s.m11+c*s.m21,N=o*s.m02+l*s.m12+c*s.m22;let P=x*s.m00+g*s.m10+y*s.m20,T=x*s.m01+g*s.m11+y*s.m21,M=x*s.m02+g*s.m12+y*s.m22;return P*=v/u,T*=C/d,M*=N/f,x=P*a.m00+T*a.m10+M*a.m20,g=P*a.m01+T*a.m11+M*a.m21,y=P*a.m02+T*a.m12+M*a.m22,[x,g,y]};Zr.prototype.lab=function(){return Yce(this._rgb)};const X$t=(...t)=>new Zr(...t,"lab");Object.assign(bi,{lab:X$t,getLabWhitePoint:B_,setLabWhitePoint:qg});_i.format.lab=Kce;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"lab"),qi(t)==="array"&&t.length===3)return"lab"}});Zr.prototype.darken=function(t=1){const e=this,n=e.lab();return n[0]-=X0.Kn*t,new Zr(n,"lab").alpha(e.alpha(),!0)};Zr.prototype.brighten=function(t=1){return this.darken(-t)};Zr.prototype.darker=Zr.prototype.darken;Zr.prototype.brighter=Zr.prototype.brighten;Zr.prototype.get=function(t){const[e,n]=t.split("."),r=this[e]();if(n){const s=e.indexOf(n)-(e.substr(0,2)==="ok"?2:0);if(s>-1)return r[s];throw new Error(`unknown channel ${n} in mode ${e}`)}else return r};const{pow:Q$t}=Math,Z$t=1e-7,J$t=20;Zr.prototype.luminance=function(t,e="rgb"){if(t!==void 0&&qi(t)==="number"){if(t===0)return new Zr([0,0,0,this._rgb[3]],"rgb");if(t===1)return new Zr([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=J$t;const s=(o,l)=>{const c=o.interpolate(l,.5,e),u=c.luminance();return Math.abs(t-u)<Z$t||!r--?c:u>t?s(o,c):s(c,l)},a=(n>t?s(new Zr([0,0,0]),this):s(this,new Zr([255,255,255]))).rgb();return new Zr([...a,this._rgb[3]])}return eUt(...this._rgb.slice(0,3))};const eUt=(t,e,n)=>(t=Mq(t),e=Mq(e),n=Mq(n),.2126*t+.7152*e+.0722*n),Mq=t=>(t/=255,t<=.03928?t/12.92:Q$t((t+.055)/1.055,2.4)),Bu={},VN=(t,e,n=.5,...r)=>{let s=r[0]||"lrgb";if(!Bu[s]&&!r.length&&(s=Object.keys(Bu)[0]),!Bu[s])throw new Error(`interpolation mode ${s} is not defined`);return qi(t)!=="object"&&(t=new Zr(t)),qi(e)!=="object"&&(e=new Zr(e)),Bu[s](t,e,n).alpha(t.alpha()+n*(e.alpha()-t.alpha()))};Zr.prototype.mix=Zr.prototype.interpolate=function(t,e=.5,...n){return VN(this,t,e,...n)};Zr.prototype.premultiply=function(t=!1){const e=this._rgb,n=e[3];return t?(this._rgb=[e[0]*n,e[1]*n,e[2]*n,n],this):new Zr([e[0]*n,e[1]*n,e[2]*n,n],"rgb")};const{sin:tUt,cos:nUt}=Math,y$e=(...t)=>{let[e,n,r]=Fi(t,"lch");return isNaN(r)&&(r=0),r=r*z$t,[e,nUt(r)*n,tUt(r)*n]},Xce=(...t)=>{t=Fi(t,"lch");const[e,n,r]=t,[s,a,o]=y$e(e,n,r),[l,c,u]=Kce(s,a,o);return[l,c,u,t.length>3?t[3]:1]},rUt=(...t)=>{const e=p$e(Fi(t,"hcl"));return Xce(...e)},{sqrt:sUt,atan2:iUt,round:aUt}=Math,v$e=(...t)=>{const[e,n,r]=Fi(t,"lab"),s=sUt(n*n+r*r);let a=(iUt(r,n)*H$t+360)%360;return aUt(s*1e4)===0&&(a=Number.NaN),[e,s,a]},Qce=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=Yce(e,n,r),[c,u,d]=v$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};Zr.prototype.lch=function(){return Qce(this._rgb)};Zr.prototype.hcl=function(){return p$e(Qce(this._rgb))};const oUt=(...t)=>new Zr(...t,"lch"),lUt=(...t)=>new Zr(...t,"hcl");Object.assign(bi,{lch:oUt,hcl:lUt});_i.format.lch=Xce;_i.format.hcl=rUt;["lch","hcl"].forEach(t=>_i.autodetect.push({p:2,test:(...e)=>{if(e=Fi(e,t),qi(e)==="array"&&e.length===3)return t}}));Zr.prototype.saturate=function(t=1){const e=this,n=e.lch();return n[1]+=X0.Kn*t,n[1]<0&&(n[1]=0),new Zr(n,"lch").alpha(e.alpha(),!0)};Zr.prototype.desaturate=function(t=1){return this.saturate(-t)};Zr.prototype.set=function(t,e,n=!1){const[r,s]=t.split("."),a=this[r]();if(s){const o=r.indexOf(s)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(qi(e)=="string")switch(e.charAt(0)){case"+":a[o]+=+e;break;case"-":a[o]+=+e;break;case"*":a[o]*=+e.substr(1);break;case"/":a[o]/=+e.substr(1);break;default:a[o]=+e}else if(qi(e)==="number")a[o]=e;else throw new Error("unsupported value for Color.set");const l=new Zr(a,r);return n?(this._rgb=l._rgb,this):l}throw new Error(`unknown channel ${s} in mode ${r}`)}else return a};Zr.prototype.tint=function(t=.5,...e){return VN(this,"white",t,...e)};Zr.prototype.shade=function(t=.5,...e){return VN(this,"black",t,...e)};const cUt=(t,e,n)=>{const r=t._rgb,s=e._rgb;return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};Bu.rgb=cUt;const{sqrt:Rq,pow:gC}=Math,uUt=(t,e,n)=>{const[r,s,a]=t._rgb,[o,l,c]=e._rgb;return new Zr(Rq(gC(r,2)*(1-n)+gC(o,2)*n),Rq(gC(s,2)*(1-n)+gC(l,2)*n),Rq(gC(a,2)*(1-n)+gC(c,2)*n),"rgb")};Bu.lrgb=uUt;const dUt=(t,e,n)=>{const r=t.lab(),s=e.lab();return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};Bu.lab=dUt;const yj=(t,e,n,r)=>{let s,a;r==="hsl"?(s=t.hsl(),a=e.hsl()):r==="hsv"?(s=t.hsv(),a=e.hsv()):r==="hcg"?(s=t.hcg(),a=e.hcg()):r==="hsi"?(s=t.hsi(),a=e.hsi()):r==="lch"||r==="hcl"?(r="hcl",s=t.hcl(),a=e.hcl()):r==="oklch"&&(s=t.oklch().reverse(),a=e.oklch().reverse());let o,l,c,u,d,f;(r.substr(0,1)==="h"||r==="oklch")&&([o,c,d]=s,[l,u,f]=a);let x,g,y,v;return!isNaN(o)&&!isNaN(l)?(l>o&&l-o>180?v=l-(o+360):l<o&&o-l>180?v=l+360-o:v=l-o,g=o+n*v):isNaN(o)?isNaN(l)?g=Number.NaN:(g=l,(d==1||d==0)&&r!="hsv"&&(x=u)):(g=o,(f==1||f==0)&&r!="hsv"&&(x=c)),x===void 0&&(x=c+n*(u-c)),y=d+n*(f-d),r==="oklch"?new Zr([y,x,g],r):new Zr([g,x,y],r)},w$e=(t,e,n)=>yj(t,e,n,"lch");Bu.lch=w$e;Bu.hcl=w$e;const fUt=t=>{if(qi(t)=="number"&&t>=0&&t<=16777215){const e=t>>16,n=t>>8&255,r=t&255;return[e,n,r,1]}throw new Error("unknown num color: "+t)},hUt=(...t)=>{const[e,n,r]=Fi(t,"rgb");return(e<<16)+(n<<8)+r};Zr.prototype.num=function(){return hUt(this._rgb)};const pUt=(...t)=>new Zr(...t,"num");Object.assign(bi,{num:pUt});_i.format.num=fUt;_i.autodetect.push({p:5,test:(...t)=>{if(t.length===1&&qi(t[0])==="number"&&t[0]>=0&&t[0]<=16777215)return"num"}});const mUt=(t,e,n)=>{const r=t.num(),s=e.num();return new Zr(r+n*(s-r),"num")};Bu.num=mUt;const{floor:xUt}=Math,gUt=(...t)=>{t=Fi(t,"hcg");let[e,n,r]=t,s,a,o;r=r*255;const l=n*255;if(n===0)s=a=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const c=xUt(e),u=e-c,d=r*(1-n),f=d+l*(1-u),x=d+l*u,g=d+l;switch(c){case 0:[s,a,o]=[g,x,d];break;case 1:[s,a,o]=[f,g,d];break;case 2:[s,a,o]=[d,g,x];break;case 3:[s,a,o]=[d,f,g];break;case 4:[s,a,o]=[x,d,g];break;case 5:[s,a,o]=[g,d,f];break}}return[s,a,o,t.length>3?t[3]:1]},bUt=(...t)=>{const[e,n,r]=Fi(t,"rgb"),s=f$e(e,n,r),a=h$e(e,n,r),o=a-s,l=o*100/255,c=s/(255-o)*100;let u;return o===0?u=Number.NaN:(e===a&&(u=(n-r)/o),n===a&&(u=2+(r-e)/o),r===a&&(u=4+(e-n)/o),u*=60,u<0&&(u+=360)),[u,l,c]};Zr.prototype.hcg=function(){return bUt(this._rgb)};const yUt=(...t)=>new Zr(...t,"hcg");bi.hcg=yUt;_i.format.hcg=gUt;_i.autodetect.push({p:1,test:(...t)=>{if(t=Fi(t,"hcg"),qi(t)==="array"&&t.length===3)return"hcg"}});const vUt=(t,e,n)=>yj(t,e,n,"hcg");Bu.hcg=vUt;const{cos:bC}=Math,wUt=(...t)=>{t=Fi(t,"hsi");let[e,n,r]=t,s,a,o;return isNaN(e)&&(e=0),isNaN(n)&&(n=0),e>360&&(e-=360),e<0&&(e+=360),e/=360,e<1/3?(o=(1-n)/3,s=(1+n*bC(Sg*e)/bC(Iq-Sg*e))/3,a=1-(o+s)):e<2/3?(e-=1/3,s=(1-n)/3,a=(1+n*bC(Sg*e)/bC(Iq-Sg*e))/3,o=1-(s+a)):(e-=2/3,a=(1-n)/3,o=(1+n*bC(Sg*e)/bC(Iq-Sg*e))/3,s=1-(a+o)),s=S3(r*s*3),a=S3(r*a*3),o=S3(r*o*3),[s*255,a*255,o*255,t.length>3?t[3]:1]},{min:CUt,sqrt:SUt,acos:NUt}=Math,AUt=(...t)=>{let[e,n,r]=Fi(t,"rgb");e/=255,n/=255,r/=255;let s;const a=CUt(e,n,r),o=(e+n+r)/3,l=o>0?1-a/o:0;return l===0?s=NaN:(s=(e-n+(e-r))/2,s/=SUt((e-n)*(e-n)+(e-r)*(n-r)),s=NUt(s),r>n&&(s=Sg-s),s/=Sg),[s*360,l,o]};Zr.prototype.hsi=function(){return AUt(this._rgb)};const jUt=(...t)=>new Zr(...t,"hsi");bi.hsi=jUt;_i.format.hsi=wUt;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsi"),qi(t)==="array"&&t.length===3)return"hsi"}});const EUt=(t,e,n)=>yj(t,e,n,"hsi");Bu.hsi=EUt;const Nne=(...t)=>{t=Fi(t,"hsl");const[e,n,r]=t;let s,a,o;if(n===0)s=a=o=r*255;else{const l=[0,0,0],c=[0,0,0],u=r<.5?r*(1+n):r+n-r*n,d=2*r-u,f=e/360;l[0]=f+1/3,l[1]=f,l[2]=f-1/3;for(let x=0;x<3;x++)l[x]<0&&(l[x]+=1),l[x]>1&&(l[x]-=1),6*l[x]<1?c[x]=d+(u-d)*6*l[x]:2*l[x]<1?c[x]=u:3*l[x]<2?c[x]=d+(u-d)*(2/3-l[x])*6:c[x]=d;[s,a,o]=[c[0]*255,c[1]*255,c[2]*255]}return t.length>3?[s,a,o,t[3]]:[s,a,o,1]},C$e=(...t)=>{t=Fi(t,"rgba");let[e,n,r]=t;e/=255,n/=255,r/=255;const s=f$e(e,n,r),a=h$e(e,n,r),o=(a+s)/2;let l,c;return a===s?(l=0,c=Number.NaN):l=o<.5?(a-s)/(a+s):(a-s)/(2-a-s),e==a?c=(n-r)/(a-s):n==a?c=2+(r-e)/(a-s):r==a&&(c=4+(e-n)/(a-s)),c*=60,c<0&&(c+=360),t.length>3&&t[3]!==void 0?[c,l,o,t[3]]:[c,l,o]};Zr.prototype.hsl=function(){return C$e(this._rgb)};const _Ut=(...t)=>new Zr(...t,"hsl");bi.hsl=_Ut;_i.format.hsl=Nne;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsl"),qi(t)==="array"&&t.length===3)return"hsl"}});const kUt=(t,e,n)=>yj(t,e,n,"hsl");Bu.hsl=kUt;const{floor:TUt}=Math,PUt=(...t)=>{t=Fi(t,"hsv");let[e,n,r]=t,s,a,o;if(r*=255,n===0)s=a=o=r;else{e===360&&(e=0),e>360&&(e-=360),e<0&&(e+=360),e/=60;const l=TUt(e),c=e-l,u=r*(1-n),d=r*(1-n*c),f=r*(1-n*(1-c));switch(l){case 0:[s,a,o]=[r,f,u];break;case 1:[s,a,o]=[d,r,u];break;case 2:[s,a,o]=[u,r,f];break;case 3:[s,a,o]=[u,d,r];break;case 4:[s,a,o]=[f,u,r];break;case 5:[s,a,o]=[r,u,d];break}}return[s,a,o,t.length>3?t[3]:1]},{min:IUt,max:FUt}=Math,OUt=(...t)=>{t=Fi(t,"rgb");let[e,n,r]=t;const s=IUt(e,n,r),a=FUt(e,n,r),o=a-s;let l,c,u;return u=a/255,a===0?(l=Number.NaN,c=0):(c=o/a,e===a&&(l=(n-r)/o),n===a&&(l=2+(r-e)/o),r===a&&(l=4+(e-n)/o),l*=60,l<0&&(l+=360)),[l,c,u]};Zr.prototype.hsv=function(){return OUt(this._rgb)};const MUt=(...t)=>new Zr(...t,"hsv");bi.hsv=MUt;_i.format.hsv=PUt;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"hsv"),qi(t)==="array"&&t.length===3)return"hsv"}});const RUt=(t,e,n)=>yj(t,e,n,"hsv");Bu.hsv=RUt;function LL(t,e){let n=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map(o=>[o]));let r=e[0].length,s=e[0].map((o,l)=>e.map(c=>c[l])),a=t.map(o=>s.map(l=>Array.isArray(o)?o.reduce((c,u,d)=>c+u*(l[d]||0),0):l.reduce((c,u)=>c+u*o,0)));return n===1&&(a=a[0]),r===1?a.map(o=>o[0]):a}const Zce=(...t)=>{t=Fi(t,"lab");const[e,n,r,...s]=t,[a,o,l]=LUt([e,n,r]),[c,u,d]=g$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]};function LUt(t){var e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=LL(n,t);return LL(e,r.map(s=>s**3))}const Jce=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),a=b$e(e,n,r);return[...DUt(a),...s.length>0&&s[0]<1?[s[0]]:[]]};function DUt(t){const e=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=LL(e,t);return LL(n,r.map(s=>Math.cbrt(s)))}Zr.prototype.oklab=function(){return Jce(this._rgb)};const BUt=(...t)=>new Zr(...t,"oklab");Object.assign(bi,{oklab:BUt});_i.format.oklab=Zce;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"oklab"),qi(t)==="array"&&t.length===3)return"oklab"}});const $Ut=(t,e,n)=>{const r=t.oklab(),s=e.oklab();return new Zr(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};Bu.oklab=$Ut;const UUt=(t,e,n)=>yj(t,e,n,"oklch");Bu.oklch=UUt;const{pow:Lq,sqrt:Dq,PI:Bq,cos:T2e,sin:P2e,atan2:zUt}=Math,HUt=(t,e="lrgb",n=null)=>{const r=t.length;n||(n=Array.from(new Array(r)).map(()=>1));const s=r/n.reduce(function(f,x){return f+x});if(n.forEach((f,x)=>{n[x]*=s}),t=t.map(f=>new Zr(f)),e==="lrgb")return VUt(t,n);const a=t.shift(),o=a.get(e),l=[];let c=0,u=0;for(let f=0;f<o.length;f++)if(o[f]=(o[f]||0)*n[0],l.push(isNaN(o[f])?0:n[0]),e.charAt(f)==="h"&&!isNaN(o[f])){const x=o[f]/180*Bq;c+=T2e(x)*n[0],u+=P2e(x)*n[0]}let d=a.alpha()*n[0];t.forEach((f,x)=>{const g=f.get(e);d+=f.alpha()*n[x+1];for(let y=0;y<o.length;y++)if(!isNaN(g[y]))if(l[y]+=n[x+1],e.charAt(y)==="h"){const v=g[y]/180*Bq;c+=T2e(v)*n[x+1],u+=P2e(v)*n[x+1]}else o[y]+=g[y]*n[x+1]});for(let f=0;f<o.length;f++)if(e.charAt(f)==="h"){let x=zUt(u/l[f],c/l[f])/Bq*180;for(;x<0;)x+=360;for(;x>=360;)x-=360;o[f]=x}else o[f]=o[f]/l[f];return d/=r,new Zr(o,e).alpha(d>.99999?1:d,!0)},VUt=(t,e)=>{const n=t.length,r=[0,0,0,0];for(let s=0;s<t.length;s++){const a=t[s],o=e[s]/n,l=a._rgb;r[0]+=Lq(l[0],2)*o,r[1]+=Lq(l[1],2)*o,r[2]+=Lq(l[2],2)*o,r[3]+=l[3]*o}return r[0]=Dq(r[0]),r[1]=Dq(r[1]),r[2]=Dq(r[2]),r[3]>.9999999&&(r[3]=1),new Zr(Gce(r))},{pow:WUt}=Math;function DL(t){let e="rgb",n=bi("#ccc"),r=0,s=[0,1],a=[],o=[0,0],l=!1,c=[],u=!1,d=0,f=1,x=!1,g={},y=!0,v=1;const C=function(L){if(L=L||["#fff","#000"],L&&qi(L)==="string"&&bi.brewer&&bi.brewer[L.toLowerCase()]&&(L=bi.brewer[L.toLowerCase()]),qi(L)==="array"){L.length===1&&(L=[L[0],L[0]]),L=L.slice(0);for(let z=0;z<L.length;z++)L[z]=bi(L[z]);a.length=0;for(let z=0;z<L.length;z++)a.push(z/(L.length-1))}return F(),c=L},N=function(L){if(l!=null){const z=l.length-1;let X=0;for(;X<z&&L>=l[X];)X++;return X-1}return 0};let P=L=>L,T=L=>L;const M=function(L,z){let X,ne;if(z==null&&(z=!1),isNaN(L)||L===null)return n;z?ne=L:l&&l.length>2?ne=N(L)/(l.length-2):f!==d?ne=(L-d)/(f-d):ne=1,ne=T(ne),z||(ne=P(ne)),v!==1&&(ne=WUt(ne,v)),ne=o[0]+ne*(1-o[0]-o[1]),ne=S3(ne,0,1);const J=Math.floor(ne*1e4);if(y&&g[J])X=g[J];else{if(qi(c)==="array")for(let K=0;K<a.length;K++){const te=a[K];if(ne<=te){X=c[K];break}if(ne>=te&&K===a.length-1){X=c[K];break}if(ne>te&&ne<a[K+1]){ne=(ne-te)/(a[K+1]-te),X=bi.interpolate(c[K],c[K+1],ne,e);break}}else qi(c)==="function"&&(X=c(ne));y&&(g[J]=X)}return X};var F=()=>g={};C(t);const $=function(L){const z=bi(M(L));return u&&z[u]?z[u]():z};return $.classes=function(L){if(L!=null){if(qi(L)==="array")l=L,s=[L[0],L[L.length-1]];else{const z=bi.analyze(s);L===0?l=[z.min,z.max]:l=bi.limits(z,"e",L)}return $}return l},$.domain=function(L){if(!arguments.length)return s;d=L[0],f=L[L.length-1],a=[];const z=c.length;if(L.length===z&&d!==f)for(let X of Array.from(L))a.push((X-d)/(f-d));else{for(let X=0;X<z;X++)a.push(X/(z-1));if(L.length>2){const X=L.map((J,K)=>K/(L.length-1)),ne=L.map(J=>(J-d)/(f-d));ne.every((J,K)=>X[K]===J)||(T=J=>{if(J<=0||J>=1)return J;let K=0;for(;J>=ne[K+1];)K++;const te=(J-ne[K])/(ne[K+1]-ne[K]);return X[K]+te*(X[K+1]-X[K])})}}return s=[d,f],$},$.mode=function(L){return arguments.length?(e=L,F(),$):e},$.range=function(L,z){return C(L),$},$.out=function(L){return u=L,$},$.spread=function(L){return arguments.length?(r=L,$):r},$.correctLightness=function(L){return L==null&&(L=!0),x=L,F(),x?P=function(z){const X=M(0,!0).lab()[0],ne=M(1,!0).lab()[0],J=X>ne;let K=M(z,!0).lab()[0];const te=X+(ne-X)*z;let fe=K-te,q=0,se=1,ae=20;for(;Math.abs(fe)>.01&&ae-- >0;)(function(){return J&&(fe*=-1),fe<0?(q=z,z+=(se-z)*.5):(se=z,z+=(q-z)*.5),K=M(z,!0).lab()[0],fe=K-te})();return z}:P=z=>z,$},$.padding=function(L){return L!=null?(qi(L)==="number"&&(L=[L,L]),o=L,$):o},$.colors=function(L,z){arguments.length<2&&(z="hex");let X=[];if(arguments.length===0)X=c.slice(0);else if(L===1)X=[$(.5)];else if(L>1){const ne=s[0],J=s[1]-ne;X=qUt(0,L).map(K=>$(ne+K/(L-1)*J))}else{t=[];let ne=[];if(l&&l.length>2)for(let J=1,K=l.length,te=1<=K;te?J<K:J>K;te?J++:J--)ne.push((l[J-1]+l[J])*.5);else ne=s;X=ne.map(J=>$(J))}return bi[z]&&(X=X.map(ne=>ne[z]())),X},$.cache=function(L){return L!=null?(y=L,$):y},$.gamma=function(L){return L!=null?(v=L,$):v},$.nodata=function(L){return L!=null?(n=bi(L),$):n},$}function qUt(t,e,n){let r=[],s=t<e,a=e;for(let o=t;s?o<a:o>a;s?o++:o--)r.push(o);return r}const GUt=function(t){let e=[1,1];for(let n=1;n<t;n++){let r=[1];for(let s=1;s<=e.length;s++)r[s]=(e[s]||0)+e[s-1];e=r}return e},KUt=function(t){let e,n,r,s;if(t=t.map(a=>new Zr(a)),t.length===2)[n,r]=t.map(a=>a.lab()),e=function(a){const o=[0,1,2].map(l=>n[l]+a*(r[l]-n[l]));return new Zr(o,"lab")};else if(t.length===3)[n,r,s]=t.map(a=>a.lab()),e=function(a){const o=[0,1,2].map(l=>(1-a)*(1-a)*n[l]+2*(1-a)*a*r[l]+a*a*s[l]);return new Zr(o,"lab")};else if(t.length===4){let a;[n,r,s,a]=t.map(o=>o.lab()),e=function(o){const l=[0,1,2].map(c=>(1-o)*(1-o)*(1-o)*n[c]+3*(1-o)*(1-o)*o*r[c]+3*(1-o)*o*o*s[c]+o*o*o*a[c]);return new Zr(l,"lab")}}else if(t.length>=5){let a,o,l;a=t.map(c=>c.lab()),l=t.length-1,o=GUt(l),e=function(c){const u=1-c,d=[0,1,2].map(f=>a.reduce((x,g,y)=>x+o[y]*u**(l-y)*c**y*g[f],0));return new Zr(d,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return e},YUt=t=>{const e=KUt(t);return e.scale=()=>DL(e),e},{round:S$e}=Math;Zr.prototype.rgb=function(t=!0){return t===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(S$e)};Zr.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map((e,n)=>n<3?t===!1?e:S$e(e):e)};const XUt=(...t)=>new Zr(...t,"rgb");Object.assign(bi,{rgb:XUt});_i.format.rgb=(...t)=>{const e=Fi(t,"rgba");return e[3]===void 0&&(e[3]=1),e};_i.autodetect.push({p:3,test:(...t)=>{if(t=Fi(t,"rgba"),qi(t)==="array"&&(t.length===3||t.length===4&&qi(t[3])=="number"&&t[3]>=0&&t[3]<=1))return"rgb"}});const Tm=(t,e,n)=>{if(!Tm[n])throw new Error("unknown blend mode "+n);return Tm[n](t,e)},P2=t=>(e,n)=>{const r=bi(n).rgb(),s=bi(e).rgb();return bi.rgb(t(r,s))},I2=t=>(e,n)=>{const r=[];return r[0]=t(e[0],n[0]),r[1]=t(e[1],n[1]),r[2]=t(e[2],n[2]),r},QUt=t=>t,ZUt=(t,e)=>t*e/255,JUt=(t,e)=>t>e?e:t,ezt=(t,e)=>t>e?t:e,tzt=(t,e)=>255*(1-(1-t/255)*(1-e/255)),nzt=(t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255)),rzt=(t,e)=>255*(1-(1-e/255)/(t/255)),szt=(t,e)=>t===255?255:(t=255*(e/255)/(1-t/255),t>255?255:t);Tm.normal=P2(I2(QUt));Tm.multiply=P2(I2(ZUt));Tm.screen=P2(I2(tzt));Tm.overlay=P2(I2(nzt));Tm.darken=P2(I2(JUt));Tm.lighten=P2(I2(ezt));Tm.dodge=P2(I2(szt));Tm.burn=P2(I2(rzt));const{pow:izt,sin:azt,cos:ozt}=Math;function lzt(t=300,e=-1.5,n=1,r=1,s=[0,1]){let a=0,o;qi(s)==="array"?o=s[1]-s[0]:(o=0,s=[s,s]);const l=function(c){const u=Sg*((t+120)/360+e*c),d=izt(s[0]+o*c,r),x=(a!==0?n[0]+c*a:n)*d*(1-d)/2,g=ozt(u),y=azt(u),v=d+x*(-.14861*g+1.78277*y),C=d+x*(-.29227*g-.90649*y),N=d+x*(1.97294*g);return bi(Gce([v*255,C*255,N*255,1]))};return l.start=function(c){return c==null?t:(t=c,l)},l.rotations=function(c){return c==null?e:(e=c,l)},l.gamma=function(c){return c==null?r:(r=c,l)},l.hue=function(c){return c==null?n:(n=c,qi(n)==="array"?(a=n[1]-n[0],a===0&&(n=n[1])):a=0,l)},l.lightness=function(c){return c==null?s:(qi(c)==="array"?(s=c,o=c[1]-c[0]):(s=[c,c],o=0),l)},l.scale=()=>bi.scale(l),l.hue(n),l}const czt="0123456789abcdef",{floor:uzt,random:dzt}=Math,fzt=()=>{let t="#";for(let e=0;e<6;e++)t+=czt.charAt(uzt(dzt()*16));return new Zr(t,"hex")},{log:I2e,pow:hzt,floor:pzt,abs:mzt}=Math;function N$e(t,e=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return qi(t)==="object"&&(t=Object.values(t)),t.forEach(r=>{e&&qi(r)==="object"&&(r=r[e]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,s)=>A$e(n,r,s),n}function A$e(t,e="equal",n=7){qi(t)=="array"&&(t=N$e(t));const{min:r,max:s}=t,a=t.values.sort((l,c)=>l-c);if(n===1)return[r,s];const o=[];if(e.substr(0,1)==="c"&&(o.push(r),o.push(s)),e.substr(0,1)==="e"){o.push(r);for(let l=1;l<n;l++)o.push(r+l/n*(s-r));o.push(s)}else if(e.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const l=Math.LOG10E*I2e(r),c=Math.LOG10E*I2e(s);o.push(r);for(let u=1;u<n;u++)o.push(hzt(10,l+u/n*(c-l)));o.push(s)}else if(e.substr(0,1)==="q"){o.push(r);for(let l=1;l<n;l++){const c=(a.length-1)*l/n,u=pzt(c);if(u===c)o.push(a[u]);else{const d=c-u;o.push(a[u]*(1-d)+a[u+1]*d)}}o.push(s)}else if(e.substr(0,1)==="k"){let l;const c=a.length,u=new Array(c),d=new Array(n);let f=!0,x=0,g=null;g=[],g.push(r);for(let C=1;C<n;C++)g.push(r+C/n*(s-r));for(g.push(s);f;){for(let N=0;N<n;N++)d[N]=0;for(let N=0;N<c;N++){const P=a[N];let T=Number.MAX_VALUE,M;for(let F=0;F<n;F++){const $=mzt(g[F]-P);$<T&&(T=$,M=F),d[M]++,u[N]=M}}const C=new Array(n);for(let N=0;N<n;N++)C[N]=null;for(let N=0;N<c;N++)l=u[N],C[l]===null?C[l]=a[N]:C[l]+=a[N];for(let N=0;N<n;N++)C[N]*=1/d[N];f=!1;for(let N=0;N<n;N++)if(C[N]!==g[N]){f=!0;break}g=C,x++,x>200&&(f=!1)}const y={};for(let C=0;C<n;C++)y[C]=[];for(let C=0;C<c;C++)l=u[C],y[l].push(a[C]);let v=[];for(let C=0;C<n;C++)v.push(y[C][0]),v.push(y[C][y[C].length-1]);v=v.sort((C,N)=>C-N),o.push(v[0]);for(let C=1;C<v.length;C+=2){const N=v[C];!isNaN(N)&&o.indexOf(N)===-1&&o.push(N)}}return o}const xzt=(t,e)=>{t=new Zr(t),e=new Zr(e);const n=t.luminance(),r=e.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)};/**
* @license
*
* The APCA contrast prediction algorithm is based of the formulas published
* in the APCA-1.0.98G specification by Myndex. The specification is available at:
* https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
*
* Note that the APCA implementation is still beta, so please update to
* future versions of chroma.js when they become available.
*
* You can read more about the APCA Readability Criterion at
* https://readtech.org/ARC/
*/const F2e=.027,gzt=5e-4,bzt=.1,O2e=1.14,lF=.022,M2e=1.414,yzt=(t,e)=>{t=new Zr(t),e=new Zr(e),t.alpha()<1&&(t=VN(e,t,t.alpha(),"rgb"));const n=R2e(...t.rgb()),r=R2e(...e.rgb()),s=n>=lF?n:n+Math.pow(lF-n,M2e),a=r>=lF?r:r+Math.pow(lF-r,M2e),o=Math.pow(a,.56)-Math.pow(s,.57),l=Math.pow(a,.65)-Math.pow(s,.62),c=Math.abs(a-s)<gzt?0:s<a?o*O2e:l*O2e;return(Math.abs(c)<bzt?0:c>0?c-F2e:c+F2e)*100};function R2e(t,e,n){return .2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:eg,pow:Ol,min:vzt,max:wzt,atan2:L2e,abs:D2e,cos:cF,sin:B2e,exp:Czt,PI:$2e}=Math;function Szt(t,e,n=1,r=1,s=1){var a=function(Ce){return 360*Ce/(2*$2e)},o=function(Ce){return 2*$2e*Ce/360};t=new Zr(t),e=new Zr(e);const[l,c,u]=Array.from(t.lab()),[d,f,x]=Array.from(e.lab()),g=(l+d)/2,y=eg(Ol(c,2)+Ol(u,2)),v=eg(Ol(f,2)+Ol(x,2)),C=(y+v)/2,N=.5*(1-eg(Ol(C,7)/(Ol(C,7)+Ol(25,7)))),P=c*(1+N),T=f*(1+N),M=eg(Ol(P,2)+Ol(u,2)),F=eg(Ol(T,2)+Ol(x,2)),$=(M+F)/2,L=a(L2e(u,P)),z=a(L2e(x,T)),X=L>=0?L:L+360,ne=z>=0?z:z+360,J=D2e(X-ne)>180?(X+ne+360)/2:(X+ne)/2,K=1-.17*cF(o(J-30))+.24*cF(o(2*J))+.32*cF(o(3*J+6))-.2*cF(o(4*J-63));let te=ne-X;te=D2e(te)<=180?te:ne<=X?te+360:te-360,te=2*eg(M*F)*B2e(o(te)/2);const fe=d-l,q=F-M,se=1+.015*Ol(g-50,2)/eg(20+Ol(g-50,2)),ae=1+.045*$,W=1+.015*$*K,V=30*Czt(-Ol((J-275)/25,2)),oe=-(2*eg(Ol($,7)/(Ol($,7)+Ol(25,7))))*B2e(2*o(V)),de=eg(Ol(fe/(n*se),2)+Ol(q/(r*ae),2)+Ol(te/(s*W),2)+oe*(q/(r*ae))*(te/(s*W)));return wzt(0,vzt(100,de))}function Nzt(t,e,n="lab"){t=new Zr(t),e=new Zr(e);const r=t.get(n),s=e.get(n);let a=0;for(let o in r){const l=(r[o]||0)-(s[o]||0);a+=l*l}return Math.sqrt(a)}const Azt=(...t)=>{try{return new Zr(...t),!0}catch{return!1}},jzt={cool(){return DL([bi.hsl(180,1,.9),bi.hsl(250,.7,.4)])},hot(){return DL(["#000","#f00","#ff0","#fff"]).mode("rgb")}},Ane={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},j$e=Object.keys(Ane),U2e=new Map(j$e.map(t=>[t.toLowerCase(),t])),Ezt=typeof Proxy=="function"?new Proxy(Ane,{get(t,e){const n=e.toLowerCase();if(U2e.has(n))return t[U2e.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(j$e)}}):Ane,_zt=(...t)=>{t=Fi(t,"cmyk");const[e,n,r,s]=t,a=t.length>4?t[4]:1;return s===1?[0,0,0,a]:[e>=1?0:255*(1-e)*(1-s),n>=1?0:255*(1-n)*(1-s),r>=1?0:255*(1-r)*(1-s),a]},{max:z2e}=Math,kzt=(...t)=>{let[e,n,r]=Fi(t,"rgb");e=e/255,n=n/255,r=r/255;const s=1-z2e(e,z2e(n,r)),a=s<1?1/(1-s):0,o=(1-e-s)*a,l=(1-n-s)*a,c=(1-r-s)*a;return[o,l,c,s]};Zr.prototype.cmyk=function(){return kzt(this._rgb)};const Tzt=(...t)=>new Zr(...t,"cmyk");Object.assign(bi,{cmyk:Tzt});_i.format.cmyk=_zt;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"cmyk"),qi(t)==="array"&&t.length===4)return"cmyk"}});const Pzt=(...t)=>{const e=Fi(t,"hsla");let n=bj(t)||"lsa";return e[0]=up(e[0]||0)+"deg",e[1]=up(e[1]*100)+"%",e[2]=up(e[2]*100)+"%",n==="hsla"||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),n="hsla"):e.length=3,`${n.substr(0,3)}(${e.join(" ")})`},Izt=(...t)=>{const e=Fi(t,"lab");let n=bj(t)||"lab";return e[0]=up(e[0])+"%",e[1]=up(e[1]),e[2]=up(e[2]),n==="laba"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`},Fzt=(...t)=>{const e=Fi(t,"lch");let n=bj(t)||"lab";return e[0]=up(e[0])+"%",e[1]=up(e[1]),e[2]=isNaN(e[2])?"none":up(e[2])+"deg",n==="lcha"||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`},Ozt=(...t)=>{const e=Fi(t,"lab");return e[0]=up(e[0]*100)+"%",e[1]=Sne(e[1]),e[2]=Sne(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`},E$e=(...t)=>{const[e,n,r,...s]=Fi(t,"rgb"),[a,o,l]=Jce(e,n,r),[c,u,d]=v$e(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},Mzt=(...t)=>{const e=Fi(t,"lch");return e[0]=up(e[0]*100)+"%",e[1]=Sne(e[1]),e[2]=isNaN(e[2])?"none":up(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`},{round:$q}=Math,Rzt=(...t)=>{const e=Fi(t,"rgba");let n=bj(t)||"rgb";if(n.substr(0,3)==="hsl")return Pzt(C$e(e),n);if(n.substr(0,3)==="lab"){const r=B_();qg("d50");const s=Izt(Yce(e),n);return qg(r),s}if(n.substr(0,3)==="lch"){const r=B_();qg("d50");const s=Fzt(Qce(e),n);return qg(r),s}return n.substr(0,5)==="oklab"?Ozt(Jce(e)):n.substr(0,5)==="oklch"?Mzt(E$e(e)):(e[0]=$q(e[0]),e[1]=$q(e[1]),e[2]=$q(e[2]),(n==="rgba"||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),n="rgba"),`${n.substr(0,3)}(${e.slice(0,n==="rgb"?3:4).join(" ")})`)},_$e=(...t)=>{t=Fi(t,"lch");const[e,n,r,...s]=t,[a,o,l]=y$e(e,n,r),[c,u,d]=Zce(a,o,l);return[c,u,d,...s.length>0&&s[0]<1?[s[0]]:[]]},a1=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,Cm=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,BL=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,vp=/\s*/.source,vj=/\s+/.source,eue=/\s*,\s*/.source,TU=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,wj=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,k$e=new RegExp("^rgba?\\("+vp+[a1,a1,a1].join(vj)+wj+"\\)$"),T$e=new RegExp("^rgb\\("+vp+[a1,a1,a1].join(eue)+vp+"\\)$"),P$e=new RegExp("^rgba\\("+vp+[a1,a1,a1,Cm].join(eue)+vp+"\\)$"),I$e=new RegExp("^hsla?\\("+vp+[TU,BL,BL].join(vj)+wj+"\\)$"),F$e=new RegExp("^hsl?\\("+vp+[TU,BL,BL].join(eue)+vp+"\\)$"),O$e=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,M$e=new RegExp("^lab\\("+vp+[Cm,Cm,Cm].join(vj)+wj+"\\)$"),R$e=new RegExp("^lch\\("+vp+[Cm,Cm,TU].join(vj)+wj+"\\)$"),L$e=new RegExp("^oklab\\("+vp+[Cm,Cm,Cm].join(vj)+wj+"\\)$"),D$e=new RegExp("^oklch\\("+vp+[Cm,Cm,TU].join(vj)+wj+"\\)$"),{round:B$e}=Math,yC=t=>t.map((e,n)=>n<=2?S3(B$e(e),0,255):e),Ml=(t,e=0,n=100,r=!1)=>(typeof t=="string"&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,r?t=e+(t+1)*.5*(n-e):t=e+t*(n-e)),+t),Ju=(t,e)=>t==="none"?e:t,tue=t=>{if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e;if(_i.format.named)try{return _i.format.named(t)}catch{}if((e=t.match(k$e))||(e=t.match(T$e))){let n=e.slice(1,4);for(let s=0;s<3;s++)n[s]=+Ml(Ju(n[s],0),0,255);n=yC(n);const r=e[4]!==void 0?+Ml(e[4],0,1):1;return n[3]=r,n}if(e=t.match(P$e)){const n=e.slice(1,5);for(let r=0;r<4;r++)n[r]=+Ml(n[r],0,255);return n}if((e=t.match(I$e))||(e=t.match(F$e))){const n=e.slice(1,4);n[0]=+Ju(n[0].replace("deg",""),0),n[1]=+Ml(Ju(n[1],0),0,100)*.01,n[2]=+Ml(Ju(n[2],0),0,100)*.01;const r=yC(Nne(n)),s=e[4]!==void 0?+Ml(e[4],0,1):1;return r[3]=s,r}if(e=t.match(O$e)){const n=e.slice(1,4);n[1]*=.01,n[2]*=.01;const r=Nne(n);for(let s=0;s<3;s++)r[s]=B$e(r[s]);return r[3]=+e[4],r}if(e=t.match(M$e)){const n=e.slice(1,4);n[0]=Ml(Ju(n[0],0),0,100),n[1]=Ml(Ju(n[1],0),-125,125,!0),n[2]=Ml(Ju(n[2],0),-125,125,!0);const r=B_();qg("d50");const s=yC(Kce(n));qg(r);const a=e[4]!==void 0?+Ml(e[4],0,1):1;return s[3]=a,s}if(e=t.match(R$e)){const n=e.slice(1,4);n[0]=Ml(n[0],0,100),n[1]=Ml(Ju(n[1],0),0,150,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=B_();qg("d50");const s=yC(Xce(n));qg(r);const a=e[4]!==void 0?+Ml(e[4],0,1):1;return s[3]=a,s}if(e=t.match(L$e)){const n=e.slice(1,4);n[0]=Ml(Ju(n[0],0),0,1),n[1]=Ml(Ju(n[1],0),-.4,.4,!0),n[2]=Ml(Ju(n[2],0),-.4,.4,!0);const r=yC(Zce(n)),s=e[4]!==void 0?+Ml(e[4],0,1):1;return r[3]=s,r}if(e=t.match(D$e)){const n=e.slice(1,4);n[0]=Ml(Ju(n[0],0),0,1),n[1]=Ml(Ju(n[1],0),0,.4,!1),n[2]=+Ju(n[2].replace("deg",""),0);const r=yC(_$e(n)),s=e[4]!==void 0?+Ml(e[4],0,1):1;return r[3]=s,r}};tue.test=t=>k$e.test(t)||I$e.test(t)||M$e.test(t)||R$e.test(t)||L$e.test(t)||D$e.test(t)||T$e.test(t)||P$e.test(t)||F$e.test(t)||O$e.test(t)||t==="transparent";Zr.prototype.css=function(t){return Rzt(this._rgb,t)};const Lzt=(...t)=>new Zr(...t,"css");bi.css=Lzt;_i.format.css=tue;_i.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&tue.test(t))return"css"}});_i.format.gl=(...t)=>{const e=Fi(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};const Dzt=(...t)=>new Zr(...t,"gl");bi.gl=Dzt;Zr.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};Zr.prototype.hex=function(t){return x$e(this._rgb,t)};const Bzt=(...t)=>new Zr(...t,"hex");bi.hex=Bzt;_i.format.hex=m$e;_i.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&qi(t)==="string"&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:uF}=Math,$$e=t=>{const e=t/100;let n,r,s;return e<66?(n=255,r=e<6?0:-155.25485562709179-.44596950469579133*(r=e-2)+104.49216199393888*uF(r),s=e<20?0:-254.76935184120902+.8274096064007395*(s=e-10)+115.67994401066147*uF(s)):(n=351.97690566805693+.114206453784165*(n=e-55)-40.25366309332127*uF(n),r=325.4494125711974+.07943456536662342*(r=e-50)-28.0852963507957*uF(r),s=255),[n,r,s,1]},{round:$zt}=Math,Uzt=(...t)=>{const e=Fi(t,"rgb"),n=e[0],r=e[2];let s=1e3,a=4e4;const o=.4;let l;for(;a-s>o;){l=(a+s)*.5;const c=$$e(l);c[2]/c[0]>=r/n?a=l:s=l}return $zt(l)};Zr.prototype.temp=Zr.prototype.kelvin=Zr.prototype.temperature=function(){return Uzt(this._rgb)};const Uq=(...t)=>new Zr(...t,"temp");Object.assign(bi,{temp:Uq,kelvin:Uq,temperature:Uq});_i.format.temp=_i.format.kelvin=_i.format.temperature=$$e;Zr.prototype.oklch=function(){return E$e(this._rgb)};const zzt=(...t)=>new Zr(...t,"oklch");Object.assign(bi,{oklch:zzt});_i.format.oklch=_$e;_i.autodetect.push({p:2,test:(...t)=>{if(t=Fi(t,"oklch"),qi(t)==="array"&&t.length===3)return"oklch"}});Object.assign(bi,{analyze:N$e,average:HUt,bezier:YUt,blend:Tm,brewer:Ezt,Color:Zr,colors:HN,contrast:xzt,contrastAPCA:yzt,cubehelix:lzt,deltaE:Szt,distance:Nzt,input:_i,interpolate:VN,limits:A$e,mix:VN,random:fzt,scale:DL,scales:jzt,valid:Azt});const Hzt=({className:t})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",className:t,children:i.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.875 3.67C7.875 3.025 7.315 2.5 6.625 2.5C5.935 2.5 5.375 3.025 5.375 3.67C5.375 4.316 5.935 4.84 6.625 4.84C7.315 4.84 7.875 4.316 7.875 3.67ZM7.875 12.33C7.875 11.684 7.315 11.16 6.625 11.16C5.935 11.16 5.375 11.684 5.375 12.33C5.375 12.975 5.935 13.5 6.625 13.5C7.315 13.5 7.875 12.975 7.875 12.33ZM6.625 6.83C7.315 6.83 7.875 7.355 7.875 8C7.875 8.645 7.315 9.17 6.625 9.17C5.935 9.17 5.375 8.645 5.375 8C5.375 7.355 5.935 6.83 6.625 6.83ZM11.625 3.67C11.625 3.025 11.065 2.5 10.375 2.5C9.685 2.5 9.125 3.025 9.125 3.67C9.125 4.316 9.685 4.84 10.375 4.84C11.065 4.84 11.625 4.316 11.625 3.67ZM10.375 11.16C11.065 11.16 11.625 11.684 11.625 12.33C11.625 12.975 11.065 13.5 10.375 13.5C9.685 13.5 9.125 12.975 9.125 12.33C9.125 11.684 9.685 11.16 10.375 11.16ZM11.625 8C11.625 7.355 11.065 6.83 10.375 6.83C9.685 6.83 9.125 7.355 9.125 8C9.125 8.645 9.685 9.17 10.375 9.17C11.065 9.17 11.625 8.645 11.625 8Z",fill:"currentColor"})}),ww=({className:t})=>i.jsxs("svg",{width:"7",height:"8",viewBox:"0 0 7 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M0.660034 6.83L6.32003 1.17",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M6.32003 6.83L0.660034 1.17",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),zq=({dataCoin:t,coinInclude:e,coinExclude:n,setCoinInclude:r,setCoinExclude:s,isLoadingCoin:a})=>{const[o,l]=m.useState(!1),[c,u]=m.useState(""),d=()=>{l(C=>!C)};m.useEffect(()=>{const C=t.filter(N=>!(n!=null&&n.includes(N.value))).map(N=>N.value);r(C)},[t,n]);const f=C=>{e!=null&&e.includes(C)?(r(e.filter(N=>N!==C)),s([...n,C])):(s(n.filter(N=>N!==C)),r([...e,C]))},x=()=>{const C=t.map(N=>N.value);r(C),s([])},g=()=>{const C=t.map(N=>N.value);s(C),r([])},y=t==null?void 0:t.filter(C=>{var N;return(N=C.label.toLowerCase())==null?void 0:N.includes(c.toLowerCase())}),v=()=>{u("")};return i.jsxs("div",{className:"col-span-1 flex flex-col gap-[4px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Asset Management"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"Choose which assets to include or exclude from copy trading. You can customize which coins you want to trade.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] mt-6"})})]})]}),i.jsxs("div",{className:"relative w-full max-w-full",children:[i.jsxs("div",{className:" flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8",onClick:d,children:[i.jsx("div",{className:"flex justify-start items-center text-[#7c7c7c] text-sm font-semibold font-manrope leading-[8px]",children:i.jsxs("div",{className:"flex justify-start items-center gap-[3px]",children:[i.jsx("div",{className:"w-1.5 h-1.5 bg-[#67ffbd] rounded-full"}),i.jsxs("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px]",children:["Include"," ",i.jsx("span",{className:`${(e==null?void 0:e.length)>0?"text-[#67ffbd]":"text-white"} text-[11px] font-semibold font-manrope leading-[8px]`,children:`(${e==null?void 0:e.length})`})]}),i.jsx("div",{className:"w-1.5 h-1.5 bg-[#ff787b] rounded-full ml-[6px]"}),i.jsxs("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px]",children:["Exclude"," ",i.jsx("span",{className:`${(n==null?void 0:n.length)>0?"text-[#ff787b]":"text-white"} text-[11px] font-semibold font-manrope leading-[8px]`,children:`(${n==null?void 0:n.length})`})]})]})}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${o?"rotate-180":""}`})]}),o&&i.jsxs("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:[i.jsxs("div",{className:"flex justify-between items-center space-x-4 mb-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{onClick:x,className:"h-4 p-1.5 rounded-md outline outline-1 outline-[#67ffbd] inline-flex justify-start items-center gap-2 cursor-pointer",children:i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-manrope leading-[8px]",children:"Select All Include"})}),i.jsx("div",{onClick:g,className:"h-4 p-1.5 rounded-md outline outline-1 outline-[#ff787b] inline-flex justify-start items-center gap-2 cursor-pointer",children:i.jsx("div",{className:"justify-start text-[#ff787b] text-[11px] font-semibold font-manrope leading-[8px]",children:"Select All Exclude"})})]}),i.jsxs("div",{className:"flex items-center relative",children:[i.jsx("input",{type:"text",placeholder:"Search Coin",value:c,onChange:C=>u(C.target.value),className:`${c?"border border-[#7F7F7F]":""} py-[4px] bg-[#1B1B1B] border border-[#303030] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-full sm:w-[153px] lg:w-full pl-[30px] pr-6 focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[32px]`}),i.jsx(zy,{className:"text-[#646464] absolute left-1.5"}),c&&i.jsx("span",{onClick:v,className:"flex justify-center items-center cursor-pointer absolute right-2 w-[10px] h-[10px]",children:i.jsx(ww,{className:"hover:text-[#cdcdcd] text-[#7C7C7C] w-[10px] h-[10px]"})})]})]}),i.jsx("div",{className:"max-h-[230px] overflow-y-auto scrollbar-custom-scrollbar-dark",children:a?i.jsx("span",{className:"flex justify-center items-center w-full text-[#7e7e7e] text-sm font-medium font-inter leading-[8px] my-2",children:"Loading..."}):!y||y.length===0?i.jsx("span",{className:"flex justify-center items-center w-full text-[#7e7e7e] text-sm font-medium font-inter leading-[8px] my-4",children:c?"No coins match your search":"No data available at the moment. Please try again later."}):y==null?void 0:y.map((C,N)=>i.jsxs("div",{className:`${e!=null&&e.includes(C.value)?"bg-[#67ffbd]/20 hover:bg-[#67ffbd]/30":"bg-[#ff797c]/20 hover:bg-[#ff797c]/30"} flex justify-between items-center h-8 p-2 text-xs text-white rounded-md mb-[2px]`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-[26px]",children:[i.jsx(Hzt,{className:`${e!=null&&e.includes(C.value)?"text-[#67FFBD]":"text-[#FF797C]"} w-4 h-4`}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("img",{src:C==null?void 0:C.icon,alt:C==null?void 0:C.icon,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:P=>wm(P)}),i.jsx("span",{className:`${e!=null&&e.includes(C.value)?"text-[#67FFBD]":"text-[#FF797C]"} justify-start text-[11px] font-semibold font-manrope leading-[13px] tracking-tight`,children:C.label})]})]}),i.jsxs("div",{className:"flex space-x-2",children:[i.jsx("div",{onClick:()=>f(C.value),className:`${e!=null&&e.includes(C.value)?"bg-green-500 border-[#67ffbd]":"border-[#cdcdcd]"} h-4 p-1.5 rounded-md border inline-flex justify-start items-center gap-2 text-white cursor-pointer`,children:i.jsx("div",{className:"justify-start text-[11px] font-semibold font-manrope leading-[8px]",children:"Include"})}),i.jsx("div",{onClick:()=>f(C.value),className:`${e!=null&&e.includes(C.value)?"border-[#cdcdcd]":"bg-[#ff787b] border-[#ff787b]"} h-4 p-1.5 rounded-md border inline-flex justify-start items-center gap-2 text-white cursor-pointer`,children:i.jsx("div",{className:"justify-start text-[11px] font-semibold font-manrope leading-[8px]",children:"Exclude"})})]})]},N))})]})]})]})},Hq=new Map,Vzt=t=>{if(!t)return Math.floor(Math.random()*1240);const e=t.toLowerCase().replace(/^0x/,"");return parseInt(e.slice(0,8),16)%1240};function U$e({wallet:t,className:e=""}){const[n,r]=m.useState(()=>Hq.get(t)||null),[s,a]=m.useState(!1);return m.useEffect(()=>{if(Hq.has(t))return;const o=Vzt(t);ps.get(`https://apiv7.nftinit.io/api/f5WNdSBmQ/${o}`).then(({data:l})=>{let c=l==null?void 0:l.image;c!=null&&c.startsWith("ipfs://")&&(c=`https://ipfs.io/ipfs/${c.slice(7)}`),Hq.set(t,c),r(c)}).catch(console.error)},[t]),n?i.jsx("img",{src:n,alt:"NFT avatar",className:`${e} ${s?"":"invisible"}`,onLoad:()=>a(!0),onError:()=>a(!0)}):i.jsx("div",{className:`${e} bg-gray-800 rounded-full animate-pulse`})}const Wzt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsUnderstand:s})=>i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[320px] sm:w-[480px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-4",children:[i.jsx("div",{className:"w-80 sm:w-96 text-center text-white font-manrope text-[16px] sm:text-[20px] font-semibold leading-[8px]",children:"Potential Bot Wallet Detected"}),i.jsx("div",{className:"w-[270px] sm:w-[398px] text-center text-white/60 text-[13px] sm:text-[16px] font-medium font-manrope leading-5",children:"The wallet you're trying to copy trade appears to be likely operated by a bot. Following bot wallets may result in significant financial losses as they often use automated strategies that may not be profitable."})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1),r()},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:()=>{e(!1),s(!0)},className:"h-8 px-2.5 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"I Understand, Continue"})})]})]})})})})})]}),qzt=({open:t,setOpen:e,setCopyTradeModal:n,onClose:r,setIsLighterUnderstand:s})=>i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[320px] sm:w-[480px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-4",children:[i.jsx("div",{className:"w-80 sm:w-96 text-center text-white font-manrope text-[16px] sm:text-[20px] font-semibold leading-[8px]",children:"Rate Limit Warning"}),i.jsx("div",{className:"w-[270px] sm:w-[410px] text-center text-white/60 text-[13px] sm:text-[16px] font-medium font-manrope leading-5",children:"The wallet you’re trying to follow may execute frequent transactions. To ensure reliable copy-trading without rate-limit interruptions, please switch your account type to Premium before proceeding. Otherwise, trades may fail to execute due to API rate restrictions."}),i.jsxs("div",{onClick:()=>window.open("https://docs.lighter.xyz/perpetual-futures/account-types","_blank"),className:"flex justify-center items-center w-max gap-1.5 rounded-[10px] cursor-pointer",children:[i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-[18px] tracking-tight w-full sm:max-w-[500px] mb-2",children:"Learn more about Lighter account types here"}),i.jsx("img",{src:Am,alt:"routing",className:"w-3 h-3 mb-2"})]})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1),r()},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:()=>{e(!1),s(!0)},className:"h-8 px-2.5 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"I Understand, Continue"})})]})]})})})})})]}),Gzt=({checkAccountCopy:t,setIsLighterSub:e,setLighterSubError:n,setSlotCount:r,setSlotSubsCount:s,setSlotUsingCount:a,setSlotTotalCount:o,setSlotCountWallets:l})=>{const{setSignModalOpen:c,setTelegramChatId:u,setSubscriberRole:d,setSubsExpireDay:f,setMushboomerETH:x,setMushboomerSOL:g,setIsReferralCode:y,setIsReferralCodeName:v,setIsWhitelist:C,setHyperToken:N,setHyperAddress:P}=m.useContext(Qr),{address:T}=ns(),[M,F]=m.useState(!1),[$,L]=m.useState(!1),[z,X]=m.useState(""),[ne,J]=m.useState(""),[K,te]=m.useState(""),[fe,q]=m.useState(!1),se=async()=>{var de,Ce,me,we,xe,be;const ee=window.localStorage.getItem("hyperToken"),oe=window.localStorage.getItem("hyperAddress");if(!(!ee||!oe))try{q(!0);const je=await ki(oe.toLowerCase(),ee);je!=null&&je.success?(u(je==null?void 0:je.telegram_chat_id),d(je==null?void 0:je.subscriber_role),f(je==null?void 0:je.subs_expire_day),x((de=je==null?void 0:je.mushboomer_counts)==null?void 0:de.eth),g((Ce=je==null?void 0:je.mushboomer_counts)==null?void 0:Ce.sol),y(je==null?void 0:je.referral_code),v(je==null?void 0:je.refcode),C(je==null?void 0:je.whitelist),N(ee),P(oe),te(je==null?void 0:je.farming_tools),e(je==null?void 0:je.farming_tools),q(!1),je!=null&&je.farming_tools&&n(!1),r((me=je==null?void 0:je.copy_trade_slots_info)==null?void 0:me.extra_slot_count),s((we=je==null?void 0:je.copy_trade_slots_info)==null?void 0:we.subs_slot_count),a((xe=je==null?void 0:je.copy_trade_slots_info)==null?void 0:xe.using_slot_count),o((be=je==null?void 0:je.copy_trade_slots_info)==null?void 0:be.total_slot_count),l(je==null?void 0:je.copy_trade_slots_wallets)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),N(""),P(""),q(!1))}catch(je){console.error("Token verification error:",je),console.error(je.message||"An unknown error occurred."),q(!1)}},ae=async()=>new _l(window.ethereum).eth.getAccounts(oe=>oe),W=async(ee="farming",oe=24,de=5e3)=>{oe<=0||(await new Promise(Ce=>setTimeout(Ce,de)),await se(),ee==="farming"&&!K?W(ee,oe-1,de):t())},V=async()=>{J("");const ee=window.localStorage.getItem("hyperToken"),oe=window.localStorage.getItem("hyperAddress");if(!ee||!T){c(!0);return}L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(me){console.error("Failed to switch network",me),F(!1);return}const de=new _l(window.ethereum);var Ce=await ae();if(Ce.length>0?Ce=Ce[0]:Ce=void 0,Ce){const we={from:Ce,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await de.eth.sendTransaction(we).then(xe=>{console.log("txHash :>> ",xe),F(!1),X(xe.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:T?T.toLowerCase():oe,token:ee,payment_tx:xe.transactionHash,payment_role:"farming_tools"})}),se(),W("farming")}).catch(xe=>{console.log(xe),xe.code===-32003||xe.message.includes("insufficient funds")?J("Insufficient funds."):xe.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await de.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:K,errorFunds:ne,activeMethod:2}),i.jsx("div",{children:i.jsx("div",{onClick:()=>{V()},className:"flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Subscribe / 0.12 ETH"})})]})},nue=({open:t=!1,setOpen:e=()=>{},oldSlotCount:n,checkAccountTrade:r,tradeMarket:s})=>{const{address:a}=ns(),{setSignModalOpen:o,setTelegramChatId:l,setSubscriberRole:c,setSubsExpireDay:u,setMushboomerETH:d,setMushboomerSOL:f,setIsReferralCode:x,setIsReferralCodeName:g,setIsWhitelist:y,setHyperToken:v,setHyperAddress:C}=m.useContext(Qr),[N,P]=m.useState(1),[T,M]=m.useState(!1),[F,$]=m.useState(!1),[L,z]=m.useState(""),[X,ne]=m.useState(""),[J,K]=m.useState(""),te=oe=>/^\d*$/.test(oe),fe=oe=>{["e","E","+","-"].includes(oe.key)&&oe.preventDefault()};m.useEffect(()=>{t||P(1)},[t]);const q=m.useRef(J);m.useEffect(()=>{q.current=J},[J]);const se=m.useMemo(()=>{if(N==="")return!1;const oe=Number(N);return Number.isInteger(oe)&&oe>=1},[N]),ae=async()=>{var Ce,me,we;const oe=window.localStorage.getItem("hyperToken"),de=window.localStorage.getItem("hyperAddress");if(!(!oe||!de))try{const xe=await ki(de.toLowerCase(),oe);xe!=null&&xe.success?(l(xe==null?void 0:xe.telegram_chat_id),c(xe==null?void 0:xe.subscriber_role),u(xe==null?void 0:xe.subs_expire_day),d((Ce=xe==null?void 0:xe.mushboomer_counts)==null?void 0:Ce.eth),f((me=xe==null?void 0:xe.mushboomer_counts)==null?void 0:me.sol),x(xe==null?void 0:xe.referral_code),g(xe==null?void 0:xe.refcode),y(xe==null?void 0:xe.whitelist),v(oe),C(de),K((we=xe==null?void 0:xe.copy_trade_slots_info)==null?void 0:we.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(xe){console.error("Token verification error:",xe),console.error(xe.message||"An unknown error occurred.")}},W=async()=>new _l(window.ethereum).eth.getAccounts(de=>de),V=async(oe="slot",de=24,Ce=5e3)=>{de<=0||(await new Promise(me=>setTimeout(me,Ce)),await ae(),oe==="slot"&&q.current<=n?V(oe,de-1,Ce):r())},ee=async oe=>{ne("");const de=window.localStorage.getItem("hyperToken"),Ce=window.localStorage.getItem("hyperAddress");if(!de||!a){o(!0);return}$(!0),M(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(xe){console.error("Failed to switch network",xe),M(!1);return}const me=new _l(window.ethereum);var we=await W();if(we.length>0?we=we[0]:we=void 0,we){const be=oe*.012,je=me.utils.toWei(be.toString(),"ether"),Ie={from:we,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:je};await me.eth.sendTransaction(Ie).then(Re=>{console.log("txHash :>> ",Re),M(!1),z(Re.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/slots_payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Ce,token:de,payment_tx:Re.transactionHash,slot_role:"lighter_copy_trade",slot_qty:Number(N)})}),ae(),V("slot")}).catch(Re=>{console.log(Re),Re.code===-32003||Re.message.includes("insufficient funds")?ne("Insufficient funds."):Re.message==="MetaMask Tx Signature: User denied transaction signature."&&$(!1)})}else await me.eth.requestAccounts()};return t?i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:F,setOpen:$,transactionHash:L,transactionLoading:T,paymentPresaleRole:!(J<=n),errorFunds:X,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[51] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>e(!1)}),i.jsx("div",{className:"relative w-[380px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#404040] max-h-[97dvh] overflow-y-auto p-5",children:i.jsxs("div",{className:"flex flex-col w-full gap-4",children:[i.jsx("div",{className:"text-white/90 font-manrope text-[18px] font-semibold leading-4 mx-auto",children:"Get more slots"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-semibold",children:"Slot Count"}),i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>P(oe=>{const de=Number(oe||0);return de>1?String(de-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:N,onChange:oe=>{const de=oe.target.value.trim();if(de==="")return P("");te(de)&&P(de)},onKeyDown:fe,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>P(oe=>{const de=Number(oe||0);return String(de+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),N!==""&&!se&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),i.jsxs("div",{className:"text-[13px] text-[#7C7C7C] font-semibold flex items-center gap-1",children:["Total Price:",i.jsxs("span",{className:"bg-[#1E1E1E] text-[#F8D4AB] font-bold px-2 py-[2px] rounded-md border border-[#3A3A3A]",children:[(N*.012).toFixed(3)," ETH"]})]}),i.jsx("div",{onClick:oe=>{oe.preventDefault(),se&&ee(N)},className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] min-w-max font-semibold ${se?"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy"})]})})]})]}):null},Kzt=({normalizedCopyTradeList:t,selectedWmIndex:e,setSelectedWmIndex:n,getSettingList:r,setIsNewSetting:s})=>i.jsxs("div",{children:[i.jsx("span",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px]",children:"ACTIVE BOTS"}),(t==null?void 0:t.length)>0?i.jsxs("div",{className:"flex flex-col gap-2.5 p-2.5 mt-1.5 border border-white/5 rounded-xl bg-gradient-to-b from-[#1a1a1a] to-[#141414] shadow-lg",children:[i.jsxs("button",{onClick:r,className:`${e===null?"bg-[#2d4a3e] border border-[#3a6b5a] text-white shadow-[0_0_0_1px_rgba(116,70,255,0.3)]":"bg-[#181818] border border-[#7446FF40] text-white hover:bg-[#5834C320] hover:border-[#5834C370]"} px-3 py-2 rounded-lg text-left text-[12px] font-semibold transition-all duration-200 flex items-center justify-start gap-2 relative group`,children:[i.jsx("div",{className:`${e===null?"bg-[#3a6b5a] group-hover:bg-[#2d4a3e]":"bg-[#7446FF30] group-hover:bg-[#5834C350]"} flex items-center justify-center w-4 h-4 rounded transition-colors`,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`${e===null?"text-[#fff]":"text-[#7446FF]"} w-3 h-3 `,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})}),i.jsx("span",{children:"Copy with Another Wallet"}),i.jsx("span",{className:`${e===null?"text-white bg-[#3a6b5a]":"text-white bg-[#7446FF]"} ml-auto px-1.5 py-0.5 rounded text-[9px] font-bold `,children:"NEW"})]}),i.jsx("div",{className:"w-full h-px bg-white/5"}),i.jsx("div",{className:"flex flex-col gap-2 max-h-[21vh] overflow-y-scroll scrollbar-custom-scrollbar-dark",children:t==null?void 0:t.map((a,o)=>{var l,c,u,d;return i.jsxs("button",{onClick:()=>{n(o),s(!1)},className:`px-3 py-2 rounded-lg text-left text-[12px] font-medium transition-all duration-200
${e===o?"bg-[#2d4a3e] border border-[#3a6b5a] text-white shadow-[0_0_0_1px_rgba(58,107,90,0.3)]":"bg-[#181818] border border-[#2a2a2a] text-white hover:bg-[#1f1f1f] hover:border-[#353535]"} flex justify-between items-center gap-2`,children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:(a==null?void 0:a.target_platform)==="hyper"?i.jsx(i.Fragment,{children:i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"})}):i.jsx(i.Fragment,{children:i.jsx(M0,{className:"w-4 h-4 text-white"})})}),i.jsx("span",{className:`min-w-max ${e===o?"text-white":"text-[#d3d3d3]"}`,children:((l=a==null?void 0:a.wm_name)==null?void 0:l.length)>15?`${(c=a==null?void 0:a.wm_name)==null?void 0:c.slice(0,15)}...`:a==null?void 0:a.wm_name}),i.jsx("span",{className:"text-[#9b9b9b]",children:"-"}),i.jsx("span",{className:e===o?"text-white":"text-[#d3d3d3]",children:((u=a==null?void 0:a.tag)==null?void 0:u.length)>18?`${(d=a==null?void 0:a.tag)==null?void 0:d.slice(0,18)}...`:a==null?void 0:a.tag})]}),i.jsx(gi,{content:`${a!=null&&a.copy_trait_mode?"Run: ON":"Run: OFF"}`,children:i.jsx("div",{className:"flex justify-start items-center has-tooltip relative",children:i.jsx("span",{className:"flex items-center gap-2",children:i.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${a!=null&&a.copy_trait_mode?"bg-green-500":"bg-red-500"}`})})})})]},o)})})]}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No trades have been made with this wallet."})})]})]});function $5({open:t,setOpen:e,copyTradeData:n,copyTradeWallet:r,setCopyTradeWallet:s,isScalper:a,setCopyTradeData:o,sourcePage:l="default"}){var Wn,Or,Pr,ts,Ls;const{getCopyTradeWatchList:c,copyTradeWatchList:u,mushboomerETH:d,mushboomerSOL:f,trackedWatchList:x,isWhitelist:g,setTelegramChatId:y,setSubscriberRole:v,setSubsExpireDay:C,setMushboomerETH:N,setMushboomerSOL:P,setIsReferralCode:T,setIsReferralCodeName:M,setIsWhitelist:F,setHyperToken:$,setHyperAddress:L}=m.useContext(Qr),{address:z}=ns(),[X,ne]=m.useState(!1),[J,K]=m.useState(!1),[te,fe]=m.useState("method_two"),[q,se]=m.useState("All"),[ae,W]=m.useState([]),[V,ee]=m.useState(!1),[oe,de]=m.useState(null),[Ce,me]=m.useState(!1),[we,xe]=m.useState(!1),[be,je]=m.useState(!1),[Ie,Re]=m.useState(!1),[Qe,Ke]=m.useState(!1),[dt,tt]=m.useState(!1),[nt,Le]=m.useState(!1),[Be,ht]=m.useState(!1),[pt,Gt]=m.useState(""),[wt,nn]=m.useState(""),[cn,Un]=m.useState(""),[Xt,an]=m.useState(""),[Jt,Ye]=m.useState(""),[Je,It]=m.useState(""),[hn,Yt]=m.useState(""),[Rt,ot]=m.useState(""),[De,At]=m.useState(100),[ze,rt]=m.useState(!0),[mt,Lt]=m.useState(!0),[kt,dn]=m.useState(!1),[rn,gn]=m.useState(!0),[An,kn]=m.useState(!0),[yn,Vn]=m.useState(null),[Kn,Dn]=m.useState(null),[Xn,Nn]=m.useState(""),[on,Oe]=m.useState(""),[Zt,sn]=m.useState({inputValue:"",selectValue:"%"}),[jt,Qn]=m.useState({inputValue:"",selectValue:"%"}),[bn,Dt]=m.useState([]),[en,Pn]=m.useState(!0),[tr,ar]=m.useState([]),[hr,qt]=m.useState([]);m.useState(!1),m.useState(!1);const[zn,Zn]=m.useState(!1),[Ft,En]=m.useState(null),[Ee,h]=m.useState(null),[p,S]=m.useState(null),[_,k]=m.useState(null),[I,B]=m.useState(!1),[G,re]=m.useState(!1),[ce,ue]=m.useState(!1),[ge,Ae]=m.useState(!1),[ke,Me]=m.useState(!1),qe=m.useRef(null),[Fe,at]=m.useState(null),[ie,Se]=m.useState(!1),$e=m.useRef(null),[Ue,_e]=m.useState(!1),[st,ut]=m.useState(!1),[yt,Mt]=m.useState(!1),[Kt,un]=m.useState([]),[Xe,Pt]=m.useState([]),[Wt,ct]=m.useState(!1),[Ge,Tt]=m.useState(!1),[fn,Yn]=m.useState(!1),[Fn,Gn]=m.useState(0),[Sr,ur]=m.useState(0),[kr,Bn]=m.useState(0),[Sn,Mn]=m.useState(0),[rr,ls]=m.useState(null),[cs,et]=m.useState(!1),[gt,Tn]=m.useState(!1),[sr,Tr]=m.useState([]),[Lr,$r]=m.useState(null),[lr,wr]=m.useState(!1),ss=async Et=>{var us,as,xs,bs,zi,Us;if(!t)return;const or=Et||Fe,Hn=window.localStorage.getItem("hyperToken"),Vr=window.localStorage.getItem("hyperAddress");if(!(!Hn||!Vr))try{Yn(!0);const ys=await ki(Vr.toLowerCase(),Hn);ys!=null&&ys.success?(y(ys==null?void 0:ys.telegram_chat_id),v(ys==null?void 0:ys.subscriber_role),C(ys==null?void 0:ys.subs_expire_day),N((us=ys==null?void 0:ys.mushboomer_counts)==null?void 0:us.eth),P((as=ys==null?void 0:ys.mushboomer_counts)==null?void 0:as.sol),T(ys==null?void 0:ys.referral_code),M(ys==null?void 0:ys.refcode),F(ys==null?void 0:ys.whitelist),$(Hn),L(Vr),Gn((xs=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:xs.extra_slot_count),ur((bs=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:bs.subs_slot_count),Bn((zi=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:zi.using_slot_count),Mn((Us=ys==null?void 0:ys.copy_trade_slots_info)==null?void 0:Us.total_slot_count),Tr(ys==null?void 0:ys.copy_trade_slots_wallets),ct(ys==null?void 0:ys.farming_tools),or==="lighter"?ys!=null&&ys.farming_tools?Tt(!1):Tt(!0):Tt(!1),Yn(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),$(""),L(""),Yn(!1))}catch(ys){console.error("Token verification error:",ys),console.error(ys.message||"An unknown error occurred."),Yn(!1)}};m.useEffect(()=>{if(t)if(Wt&&Sn==0&&Fe==="lighter"&&yn){const Et=sr==null?void 0:sr.includes(yn);Tn(!Et)}else Tn(!1)},[yn,Fe,Sn,Wt,t]);const mr=m.useMemo(()=>n?Array.isArray(n)?n:[]:[],[n]);m.useEffect(()=>{if(l==="default"||!l||!mr.length)return;const Et=mr.findIndex(or=>(or==null?void 0:or.wallet_id)===l);Et!==-1&&$r(Et)},[l,mr]),m.useEffect(()=>{l!=="default"||!mr.length||Lr===null&&$r(0)},[mr,l]);const es=mr[Lr]||null,Ys=m.useMemo(()=>!lr||!yn?!1:mr.some(Et=>(Et==null?void 0:Et.wallet_id)===yn),[lr,yn,mr,Fe]);function _s(Et){return String(Et).trim().toUpperCase()}const br=Et=>{Et&&(Gt(Et==null?void 0:Et.margin_used_rate),nn(Et==null?void 0:Et.min_usd_per_order),Un(Et==null?void 0:Et.max_usd_per_order),an(Et==null?void 0:Et.max_usd_per_positions),Ye(Et==null?void 0:Et.initial_order_max_usd),It(Et==null?void 0:Et.margin_used_amount),Yt(Et==null?void 0:Et.increase_limit),ot(Et==null?void 0:Et.copy_current_percentage),At((Et==null?void 0:Et.scaling)==null?100:Et==null?void 0:Et.scaling),se((Et==null?void 0:Et.position_type)===0?"All":(Et==null?void 0:Et.position_type)===1?"LONG":(Et==null?void 0:Et.position_type)===2?"SHORT":"All"),at(Et!=null&&Et.target_platform?(Et==null?void 0:Et.target_platform)==="hyper"?"hyper":Et==null?void 0:Et.target_platform:"hyper"),fe((Et==null?void 0:Et.method_type)===1?"method_one":(Et==null?void 0:Et.method_type)===2?"method_two":(Et==null?void 0:Et.method_type)===2e3?"method_twothousand":"method_two"),rt((Et==null?void 0:Et.copy_trait_mode)==null?!0:Et==null?void 0:Et.copy_trait_mode),Lt((Et==null?void 0:Et.open_with_increase)!==null?Et==null?void 0:Et.open_with_increase:!0),dn((Et==null?void 0:Et.included_twaps)!==null?Et==null?void 0:Et.included_twaps:!1),gn((Et==null?void 0:Et.future_listed_tokens)!==null?Et==null?void 0:Et.future_listed_tokens:!0),kn((Et==null?void 0:Et.copy_current)!==null?Et==null?void 0:Et.copy_current:!0),Vn(Et==null?void 0:Et.wallet_id),Dn(Et==null?void 0:Et.wallet_id),Nn(Et==null?void 0:Et.tag),Oe(Et==null?void 0:Et.comments),sn({inputValue:Et==null?void 0:Et.stop_loss_amount,selectValue:(Et==null?void 0:Et.stop_loss_type)??"%"}),Qn({inputValue:Et==null?void 0:Et.target_price_amount,selectValue:Et==null?void 0:Et.target_price_type}),ar((Et==null?void 0:Et.include_coins)||[]),qt((Et==null?void 0:Et.exclude_coins)||[]),gs(Et!=null&&Et.target_platform?(Et==null?void 0:Et.target_platform)==="hyper"?"hyper":Et==null?void 0:Et.target_platform:"hyper"))};m.useEffect(()=>{es===null&&n!==null?lr||br(Array.isArray(n)?n[0]:n):br(es)},[es,n]),m.useEffect(()=>{t&&n===null&&(async()=>{try{const Et=window.localStorage.getItem("hyperToken"),or=window.localStorage.getItem("hyperAddress");if(!Et)return;const[Hn,Vr]=await Promise.all([fetch("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():or,token:Et})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():or,token:Et})})]),[us,as]=await Promise.all([Hn.json(),Vr.json()]),xs=us!=null&&us.success?us.data:[],bs=as!=null&&as.success?as.data:[];xs.length>0?at("hyper"):bs.length>0?at("lighter"):at("hyper")}catch(Et){console.error("Wallet auto-select error:",Et)}})()},[t,n]);const zt=u==null?void 0:u.some(Et=>(Et==null?void 0:Et.wallet_address)===r),he=async()=>{try{const Et=window.localStorage.getItem("hyperToken"),or=window.localStorage.getItem("hyperAddress");if(!Et){setSignModalOpen(!0);return}const Hn="https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",Vr={address:z?z.toLowerCase():or,token:Et},us=await fetch(Hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Vr)});if(!us.ok)throw new Error(`Server responded with status ${us.status}`);const as=await us.json();if(as.success){wr(!0);const xs=as==null?void 0:as.data;br(xs),$r(null)}else console.log(as.error_message),tn.error(as.error_message)}catch(Et){console.error("Error in like function:",Et),tn.error(Et.message||"Something went wrong!")}},it=Et=>{let or=Et.target.value;if(or===""){sn(Hn=>({...Hn,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(or)&&sn(Hn=>({...Hn,inputValue:or}))},Ct=Et=>{let or=Et.target.value;if(or===""){Qn(Hn=>({...Hn,inputValue:""}));return}/^\d*\.?\d{0,2}$/.test(or)&&Qn(Hn=>({...Hn,inputValue:or}))},vt=Et=>{let or=Et.target.value.trim();if(or===""){Gt(null);return}/^\d*\.?\d{0,2}$/.test(or)&&Gt(or)},ln=Et=>{let or=Et.target.value.trim();if(or===""){nn(null);return}if(/^\d*\.?\d{0,2}$/.test(or)){nn(or);const Hn=parseFloat(or),Vr=te==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&Hn>Number(cn)||Xt!=null&&!isNaN(Xt)&&Xt&&Hn>Number(Xt));tt(Vr);const us=te==="method_twothousand"&&cn!=null&&!isNaN(cn)&&cn&&Hn!=null&&!isNaN(Hn)&&Hn&&Hn>Number(cn);Ke(us);const as=te==="method_twothousand"&&Xt!=null&&!isNaN(Xt)&&Xt&&Hn>Number(Xt);ht(as)}},xn=Et=>{let or=Et.target.value.trim();if(or===""){Un(null);return}if(/^\d*\.?\d{0,2}$/.test(or)){Un(or);const Hn=parseFloat(or),Vr=te==="method_twothousand"&&(Hn==null||isNaN(Hn)||!Hn||wt!=null&&!isNaN(wt)&&wt&&Hn<Number(wt)||Hn!=null&&!isNaN(Hn)&&Hn&&Xt!=null&&!isNaN(Xt)&&Xt&&Hn>Number(Xt));Ke(Vr);const us=te==="method_twothousand"&&wt!=null&&!isNaN(wt)&&wt&&Hn<Number(wt);tt(us);const as=te==="method_twothousand"&&Hn!=null&&!isNaN(Hn)&&Hn&&Xt!=null&&!isNaN(Xt)&&Xt&&Hn>Number(Xt);ht(as)}},dr=Et=>{let or=Et.target.value.trim();if(or===""){Ye(null);return}if(/^\d*\.?\d{0,2}$/.test(or)){Ye(or);const Hn=parseFloat(or),Vr=te==="method_twothousand"&&Xt!=null&&!isNaN(Xt)&&Xt&&Hn&&Hn>Number(Xt);Le(Vr),ht(Vr)}},Er=Et=>{let or=Et.target.value.trim();if(or===""){an(null);return}if(/^\d*\.?\d{0,2}$/.test(or)){an(or);const Hn=parseFloat(or),Vr=te==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&Hn<Number(cn)||wt!=null&&!isNaN(wt)&&wt&&Hn<Number(wt)||Jt!=null&&!isNaN(Jt)&&Jt&&Hn<Number(Jt));ht(Vr);const us=te==="method_twothousand"&&cn!=null&&!isNaN(cn)&&cn&&Hn!=null&&!isNaN(Hn)&&Hn&&Hn<Number(cn);Ke(us);const as=te==="method_twothousand"&&wt!=null&&!isNaN(wt)&&wt&&Hn<Number(wt);tt(as);const xs=te==="method_twothousand"&&Jt!=null&&!isNaN(Jt)&&Jt&&Hn<Number(Jt);Le(xs)}},pr=Et=>{Nn(Et.target.value),je(!1)},fr=Et=>{let or=Et.target.value;if(or===""){It("");return}/^\d*\.?\d{0,2}$/.test(or)&&It(or),xe(!1)},Yr=Et=>{let or=Et.target.value;if(or===""){Yt("");return}/^\d*\.?\d{0,2}$/.test(or)&&Yt(or)},is=Et=>{let or=Et.target.value;if(or===""){At("");return}/^\d*\.?\d{0,2}$/.test(or)&&At(or)},Ir=Et=>{["-","+","e"].includes(Et.key)&&Et.preventDefault()};async function yr(){try{K(!0);const Et=yn,or=window.localStorage.getItem("hyperToken"),Hn="https://dextrabothypev2.nftinit.io/",Vr=window.localStorage.getItem("hyperAddress");if(!or||!r)throw new Error("Authentication token is missing. Please log in again.");const as=await(await fetch(Hn+"api/test_app/following/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Vr,token:or,follow_address:r.toLowerCase(),copy_trait_mode:ze??!1,open_with_increase:mt??!1,included_twaps:kt??!1,future_listed_tokens:rn??!1,copy_current:An??!1,margin_used_rate:pt??null,min_usd_per_order:wt??null,max_usd_per_order:cn??null,max_usd_per_positions:Xt??null,initial_order_max_usd:Jt||null,margin_used_amount:Je||null,increase_limit:hn||null,copy_current_percentage:Rt||null,scaling:De||null,method_type:te=="method_two"?2:te=="method_twothousand"?2e3:te=="method_one"?1:null,position_type:q=="All"?0:q=="LONG"?1:q=="SHORT"?2:null,tag:Xn??null,comments:on??null,stop_loss_amount:Zt.inputValue?Zt.inputValue:null,stop_loss_type:Zt.selectValue??"%",target_price_amount:jt.inputValue?jt.inputValue:null,target_price_type:jt.selectValue??"%",wallet_id:yn??null,include_coins:Array.isArray(tr)&&(tr==null?void 0:tr.length)>0?tr:null,exclude_coins:Array.isArray(hr)&&(hr==null?void 0:hr.length)>0?hr:null,target_platform:Fe??"hyper"})})).json();if(as.success){K(!1),c();const xs=Array.isArray(as.data)?as.data.filter(Us=>{var ys;return((ys=Us==null?void 0:Us.wallet_address)==null?void 0:ys.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],bs=xs==null?void 0:xs.sort((Us,ys)=>new Date(ys.created_at)-new Date(Us.created_at));o(bs);const zi=bs==null?void 0:bs.findIndex(Us=>(Us==null?void 0:Us.wallet_id)===Et);$r(zi!==-1?zi:0),ss(Fe),Zn(!1),tn.success(`${(r==null?void 0:r.slice(0,5))+"..."+(r==null?void 0:r.slice(-3))} ${zt?"Copy Trade settings saved":"Successfully added to Copy Trade"}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"440px",minWidth:"440px",whiteSpace:"nowrap"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),wr(!1)}else K(!1),tn.error(as.error_message||"Registration failed.")}catch(Et){console.error("Error in copyTradeSave:",Et),tn.error(Et.message||"An unexpected error occurred."),K(!1)}}const Jn=async()=>{try{ne(!0);const Et=window.localStorage.getItem("hyperToken"),or="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/",Hn=window.localStorage.getItem("hyperAddress");if(!Et||!r)throw new Error("Required information is missing. Please log in or connect your wallet.");const Vr=await fetch(or,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Hn,token:Et,follow_address:r,target_platform:Fe??"hyper",wallet_id:yn??null})});if(!Vr.ok)throw new Error(`Failed to unlike: ${Vr.status} ${Vr.statusText}`);const us=await Vr.json();if(us.success){ne(!1),c();const as=Array.isArray(us.data)?us.data.filter(bs=>{var zi;return((zi=bs==null?void 0:bs.wallet_address)==null?void 0:zi.toLowerCase())===(r==null?void 0:r.toLowerCase())}):[],xs=Array.isArray(as)?[...as].sort((bs,zi)=>new Date(zi.created_at)-new Date(bs.created_at)):[];o(xs),xs.length>0?$r(0):$r(null),ss(Fe),as&&as.length===0&&he(),tn.success(`${r.slice(0,5)+"..."+r.slice(-3)} Successfully removed from Copy Trade`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"480px",minWidth:"480px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})}else console.error(us.error_message),tn.error(us.error_message),ne(!1)}catch(Et){console.error("Error in unlike function:",Et),tn.error(Et.message||"Something went wrong!"),ne(!1)}},gs=async Et=>{if(!t)return;const or=Et||Fe;try{ee(!0);const Hn=window.localStorage.getItem("hyperToken"),Vr=window.localStorage.getItem("hyperAddress"),us=or==="hyper"?"https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list":"https://dextrabothypev2.nftinit.io/api/wallet/list-lighter";if(!Hn)return;const xs=await(await fetch(us,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():Vr,token:Hn})})).json();xs.success?(W(xs==null?void 0:xs.data),ee(!1)):(console.log(xs.error_message),ee(!1),de(xs.error_message))}catch(Hn){console.error("Error generate wallet list:",Hn),ee(!1),de(Hn.message)}},Zs=async()=>{try{const Et=window.localStorage.getItem("hyperToken"),or=window.localStorage.getItem("hyperAddress");if(!Et)return;const[Hn,Vr]=await Promise.all([fetch("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():or,token:Et})}),fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:z?z.toLowerCase():or,token:Et})})]),[us,as]=await Promise.all([Hn.json(),Vr.json()]);us.success&&un(us.data),as!=null&&as.success&&Pt(as.data)}catch(Et){console.error("Error fetching wallet lists:",Et)}},oi=Et=>Et!=null&&Et.assetPositions?Et.assetPositions.filter(or=>{if(!or.position||!or.position.szi)return!1;const Hn=parseFloat(or.position.szi);return!isNaN(Hn)&&Hn!==0}).map(or=>{const Hn=or.position,Vr=parseFloat(Hn.szi),us=parseFloat(Hn.entryPx),as=parseFloat(Hn.positionValue),xs=parseFloat(Hn.unrealizedPnl),bs=parseFloat(Hn.returnOnEquity)*100,zi=parseFloat(Hn.marginUsed),Us=Hn.leverage.value,ys=parseFloat(Hn.cumFunding.sinceOpen),Ss=Vr>0?"Long":"Short";return{asset:Hn.coin,type:Ss,size:Math.abs(Vr),entryPrice:us.toFixed(2),currentPrice:(as/Math.abs(Vr)).toFixed(2),leverage:Us,positionValue:as.toFixed(2),marginUsed:zi.toFixed(2),unrealizedPnl:xs.toFixed(2),roe:bs.toFixed(2),funding:ys.toFixed(4),liquidationPrice:Hn.liquidationPx?parseFloat(Hn.liquidationPx).toFixed(2):"N/A"}}):[];m.useEffect(()=>{const Et=async()=>{const Vr=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:r});if(Vr.data){En(Vr.data);const us=oi(Vr.data);h(us)}},or=async()=>{var us,as,xs;const Vr=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:r});if(Vr.data){const bs=((as=(us=Vr.data.find(Us=>Us[0]==="perpMonth"))==null?void 0:us[1])==null?void 0:as.pnlHistory)||[],zi=((xs=bs[bs.length-1])==null?void 0:xs[1])??0;S(zi)}},Hn=async()=>{var as;const us=await(await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=30&order=-perp_pnl&offset=0&limit=50&user_token=${r}`)).json();k(((as=us==null?void 0:us.results[0])==null?void 0:as.win_complated_rate)||"-")};r&&(Et(),or(),Hn())},[r]),m.useEffect(()=>{if(!t)return;let Et=!1;async function or(){var Hn,Vr;try{Pn(!0);const as=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),xs=()=>bi.random().hex(),bs={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},zi=(Vr=(Hn=as.coins)==null?void 0:Hn.filter(Us=>!Us.startsWith("@")&&!Us.endsWith("/USDC")))==null?void 0:Vr.map(Us=>({value:Us,label:Us.endsWith("/USDC")?Us+" (Spot)":Us,color:xs(),icon:`https://app.hyperliquid.xyz/coins/${bs[Us]||Us.split("/")[0]}.svg`}));Et||(Dt(zi),Pn(!1))}catch(us){Et||(console.error("Data retrieval error:",us),Pn(!1))}}return or(),()=>{Et=!0}},[t]),m.useEffect(()=>{t&&(gs(Fe),ss(Fe))},[Fe,t]),m.useEffect(()=>{t&&Zs()},[t]),m.useEffect(()=>{if(!t||!zt||!es||!Array.isArray(bn)||bn.length===0)return;const Et=bn.map(xs=>typeof xs=="string"?xs:xs.value).filter(Boolean),or=new Map(Et.map(xs=>[_s(xs),xs])),Hn=Et.map(_s),Vr=new Set([...(es.include_coins||[]).map(_s),...(es.exclude_coins||[]).map(_s)]),us=Hn.filter(xs=>!Vr.has(xs));if(us.length===0)return;const as=us.map(xs=>or.get(xs)||xs);es.future_listed_tokens?ar(xs=>Array.from(new Set([...xs||[],...as]))):qt(xs=>Array.from(new Set([...xs||[],...as])))},[t,zt,bn,es]),m.useEffect(()=>{t||(e(!1),Gt(null),nn(null),Un(null),an(null),Ye(null),It(null),Yt(null),ot(null),At(100),fe("method_two"),at(null),se("All"),rt(!0),Lt(!0),dn(!1),gn(!0),kn(!0),Vn(null),Dn(null),Nn(null),Oe(null),sn({inputValue:null,selectValue:"%"}),Qn({inputValue:null,selectValue:"%"}),ar(null),qt(null),me(!1),xe(!1),Ke(!1),tt(!1),Le(!1),ht(!1),je(!1),Re(!1),ue(!1),Mt(!1),Me(!1),Se(!1),ct(!1),Tt(!1),Tn(!1),wr(!1),W([]),o(null),$r(null))},[t]),m.useEffect(()=>{const Et=ae.find(or=>(or==null?void 0:or.wallet_id)===(n==null?void 0:n.wallet_id));Et&&Vn(Et==null?void 0:Et.wallet_id)},[ae,n]),m.useEffect(()=>{Fe==="lighter"?(De!==""&&Number(De)>100?Re(!0):Re(!1),Tt(!Wt)):(Re(!1),Tt(!1))},[De,Fe]);const Fr=Et=>{Vn(Et??null),me(!1),Me(!1)},wn=Et=>{at(Et),Se(!1),kn(!1),Et==="lighter"&&(te=="method_twothousand"||te=="method_one")&&fe("method_two"),Vn(null)},On=()=>{gs(Fe)};m.useEffect(()=>{const Et=or=>{qe.current&&!qe.current.contains(or.target)&&Me(!1),$e.current&&!$e.current.contains(or.target)&&Se(!1)};return document.addEventListener("mousedown",Et),()=>{document.removeEventListener("mousedown",Et)}},[]);const lt=[Ce,we,Qe,dt,nt,Be,be,Ge,gt].filter(Boolean).length;m.useEffect(()=>{t&&a&&!G&&(u!=null&&u.some(Et=>(Et==null?void 0:Et.wallet_address)===r)||B(!0),re(!0)),t||re(!1)},[t,a]),m.useEffect(()=>{t&&a&&!st&&Fe!==null&&!I&&(u!=null&&u.some(Et=>(Et==null?void 0:Et.wallet_address)===r)||Fe==="lighter"&&_e(!0),ut(!0)),t||ut(!1)},[t,a,Fe,I]);const Bt=()=>{_e(!1),B(!1),e(!1)},nr=[{id:1,label:"Hyperliquid",value:"hyper"},{id:2,label:"Lighter",value:"lighter"}];return i.jsxs(i.Fragment,{children:[i.jsx(D$t,{open:zn,setOpen:Zn,copyTradeSave:yr}),i.jsx(Wzt,{open:I,setOpen:B,setCopyTradeModal:e,onClose:Bt,setIsUnderstand:ue}),i.jsx(P5,{open:ge,setOpen:Ae,handleListRequest:gs,handlePageChange:()=>{}}),i.jsx(qzt,{open:Ue,setOpen:_e,setCopyTradeModal:e,onClose:Bt,setIsLighterUnderstand:Mt}),cs&&Aa.createPortal(i.jsx(nue,{open:cs,setOpen:et,oldSlotCount:rr,checkAccountTrade:ss,tradeMarket:"copyTrade"}),document.body),i.jsxs(_a,{open:t,onClose:Bt,className:"relative z-50",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#1B1B1B] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl w-full lg:w-[70%]",children:i.jsx("div",{className:`${a&&!ce&&I&&!(u!=null&&u.some(Et=>(Et==null?void 0:Et.wallet_address)===r))?"blur-3xl":""} flex flex-col justify-start items-center gap-8 w-full h-max relative bg-[#1B1B1B] rounded-3xl py-2 text-white font-manrope px-2`,children:i.jsx(i.Fragment,{children:V?i.jsx("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:i.jsx($a,{})}):g||d>0||f>0?(ae==null?void 0:ae.length)>0||(Kt==null?void 0:Kt.length)>0||(Xe==null?void 0:Xe.length)>0?i.jsxs("div",{className:"flex flex-col lg:flex-row w-full",children:[i.jsxs("div",{className:"w-full lg:w-2/5 min-h-full bg-[#242424] rounded-2xl",children:[i.jsx("div",{className:"absolute right-5 top-5 z-50 bg-black/70 backdrop-blur-md rounded-full w-6 h-6 flex lg:hidden justify-center items-center font-bold font-manrope text-xs",onClick:()=>e(!1),children:i.jsx(NOe,{})}),i.jsx("div",{style:{backgroundImage:`url(${jlt})`,backgroundSize:"cover",backgroundPosition:"center"},className:"h-24 p-4 rounded-t-xl relative",children:i.jsx("div",{className:"absolute top-16 w-[64px] h-[64px] rounded-full bg-[#53BAA1] border-4 border-[#242424] flex items-center justify-center",children:i.jsx(U$e,{wallet:r,className:"w-full h-full rounded-full object-cover"})})}),i.jsxs("div",{className:"p-4 mt-6 ml-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("a",{className:"text-white font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px] cursor-pointer hover:text-white",href:`/wallet-details/${r}`,target:"_blank",rel:"noreferrer",children:r?r.slice(0,6)+"..."+r.slice(-4):"-"}),i.jsx("span",{children:i.jsx("img",{onClick:Et=>{Et.stopPropagation(),navigator.clipboard.writeText(r),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})}),i.jsx("span",{className:"ml-auto cursor-pointer",children:i.jsx(B5,{walletAddress:r,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:x.some(Et=>Et.wallet_address===r)?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})})]}),i.jsxs("div",{className:"w-full mt-0.5",children:[i.jsxs("div",{className:"w-full border-b border-[#353535] flex relative",children:[i.jsxs("div",{className:"w-1/2 relative py-3 after:content-[''] after:absolute after:top-1/2 after:-translate-y-1/2 after:right-0 after:h-2/4 after:w-[1px] after:bg-[#353535]",children:[i.jsx("div",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px] mb-[8px]",children:"PERP EQUITY"}),i.jsxs("div",{className:"text-[#67FFBD] font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]",children:["$",Ft?_r(Ft==null?void 0:Ft.marginSummary.accountValue):"-"]})]}),i.jsxs("div",{className:"w-1/2 flex flex-col justify-center items-end py-3",children:[i.jsx("div",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px] mb-[8px]",children:"uPnL"}),i.jsxs("div",{className:`${Ft&&Ee&&Ee.reduce((Et,or)=>Et+parseFloat(or.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]`,children:["$",Ft&&Ee?_r(Math.abs(Ee.reduce((Et,or)=>Et+parseFloat(or.unrealizedPnl||0),0))):"-"]})]})]}),i.jsxs("div",{className:"w-full border-b border-[#353535] flex relative",children:[i.jsxs("div",{className:"w-1/2 relative py-3 after:content-[''] after:absolute after:top-1/2 after:-translate-y-1/2 after:right-0 after:h-2/4 after:w-[1px] after:bg-[#353535]",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px] mb-[8px]",children:"WIN RATE"}),i.jsx("div",{className:"text-[#67FFBD] bg-[rgba(103,255,189,0.16)] h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer relative -top-1",children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})})]}),i.jsxs("div",{className:"text-white font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]",children:[_,"%"]})]}),i.jsxs("div",{className:"w-1/2 flex flex-col justify-center items-end py-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px] mb-[8px]",children:"PnL"}),i.jsx("div",{className:"text-[#67FFBD] bg-[rgba(103,255,189,0.16)] h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer relative -top-1",children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})})]}),i.jsxs("div",{className:`${p&&p>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-manrope text-[16px] font-semibold leading-[13px] tracking-[0.32px]`,children:["$",p?_r(Math.abs(p)):"-"]})]})]}),i.jsxs("div",{className:"mt-3",children:[i.jsx("div",{className:"text-[#9B9B9B] font-manrope text-[10px] font-semibold leading-[13px] tracking-[0.8px]",children:"OPEN POSITIONS"}),i.jsx(B$t,{positions:Ee})]}),i.jsx("div",{className:"w-full h-px bg-[#353535] mb-1"}),i.jsx("div",{className:"mt-2",children:i.jsx(Kzt,{normalizedCopyTradeList:mr,selectedWmIndex:Lr,setSelectedWmIndex:$r,getSettingList:he,setIsNewSetting:wr})})]})]})]}),i.jsxs("div",{className:"flex w-full lg:w-3/5 flex-col justify-start items-center gap-2 p-4 rounded-2xl bg-[#242424] ml-0 lg:ml-4 mt-4 lg:mt-0 relative",children:[i.jsx("div",{role:"status",className:`${J||X?"block":"hidden"} flex justify-center items-center w-full h-full absolute bg-[#101010]/80 z-50 -mt-[64px] rounded-3xl`,children:i.jsx($a,{})}),i.jsxs("div",{className:"flex-col justify-between items-center gap-4 w-full border-b border-[#353535] pb-3",children:[lt>0&&i.jsxs("div",{className:"absolute right-4 flex sm:hidden rounded-[8px] bg-[rgba(255,121,124,0.16)] backdrop-blur-[16px] w-12 h-10 justify-center items-center text-[#FF797C] font-manrope text-[12px] font-semibold leading-[12px] tracking-[0.22px] gap-2",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),lt]}),i.jsxs("div",{className:"flex flex-col items-baseline justify-start sm:flex-row sm:justify-between sm:items-start lg:flex-col lg:items-baseline lg:justify-start xl:flex-row xl:items-start xl:justify-between gap-3 sm:gap-1 lg:gap-3 xl:gap-1 space-y-3",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start space-y-2",children:[i.jsxs("span",{className:"text-[#7C7C7C] font-manrope text-[13px] font-semibold leading-[8px] min-w-max max-h-[12px] flex items-center gap-1",children:[i.jsxs("div",{className:"flex items-center gap-1",children:["Select target platform",i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5"}),i.jsx("span",{children:i.jsx(oo,{content:i.jsxs("div",{className:"text-[9px] flex flex-col gap-1 text-white",children:[i.jsx("span",{className:"uppercase",children:"Hyperliquid"}),i.jsxs("ul",{className:"list-disc pl-4",children:[i.jsx("li",{children:"Method II"}),i.jsx("li",{children:"Method III"})]}),i.jsx("span",{className:"text-[#fff] uppercase mt-2",children:"Lighter"}),i.jsx("ul",{className:"list-disc pl-4",children:i.jsx("li",{children:"Method III"})})]}),positionTop:!1,alignRight:!0,tooltipCss:"max-w-[100px] min-w-[100px] mt-10 leading-[16px]"})})]})]}),i.jsx(Lg,{})]}),i.jsxs("div",{ref:$e,className:"relative w-full max-w-[250px]",children:[i.jsxs("div",{className:`${zt&&!lr?"cursor-not-allowed":"cursor-pointer"} rounded-md bg-[#353535] text-white px-2 h-8 flex items-center justify-between`,onClick:Et=>{Et.preventDefault(),(!zt&&lr||zt&&lr||!zt&&!lr)&&Se(!ie)},children:[i.jsxs("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] flex items-center gap-2",children:[Fe==="hyper"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(M0,{className:"w-4 h-4 text-white"}),Fe==="hyper"?"Hyperliquid":"Lighter"]}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${ie?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),ie&&i.jsx("div",{className:"absolute z-10 mt-1 w-full bg-[#353535] rounded-md shadow-lg overflow-hidden p-1",children:i.jsx("div",{className:"flex flex-col gap-[2px] max-h-[170px] overflow-y-auto",children:nr==null?void 0:nr.map(Et=>i.jsxs("div",{onClick:or=>{or.preventDefault(),(!zt&&lr||zt&&lr||!zt&&!lr)&&(wn(Et.value),Et.value==="lighter"&&!yt&&a&&_e(!0))},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] ${Et.value===Fe?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white ${zt&&!lr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsxs("span",{className:"text-white flex items-center gap-2",children:[Et.label==="Hyperliquid"?i.jsx("img",{src:"https://app.hyperliquid.xyz/coins/HYPE.svg",className:"w-4 h-4"}):i.jsx(M0,{className:"w-4 h-4 text-white"}),Et.label]}),Et.value===Fe&&i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-[#1de674]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},Et.id))})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{onClick:()=>{On()},className:"hidden sm:flex lg:hidden xl:flex justify-center items-center cursor-pointer",children:i.jsx(n2e,{className:"w-4 h-4 text-[#929292] hover:text-white"})}),i.jsxs("div",{className:"flex flex-col items-start justify-start space-y-2",children:[i.jsx("span",{className:"text-[#7C7C7C] font-manrope text-[13px] font-semibold leading-[8px] -mt-2",children:"Select your wallet"}),i.jsxs("div",{ref:qe,className:"relative w-full min-w-[240px] max-w-[260px]",children:[i.jsxs("div",{className:"rounded-md bg-[#353535] text-white px-2 h-8 flex items-center justify-between cursor-pointer min-w-max sm:min-w-[260px]",onClick:()=>Me(!ke),children:[i.jsx("span",{className:"text-white font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px]",children:yn?((Wn=ae==null?void 0:ae.find(Et=>(Et==null?void 0:Et.wallet_id)===yn))==null?void 0:Wn.wallet_name)==="Dextrabot"&&((Or=ae==null?void 0:ae.find(Et=>(Et==null?void 0:Et.wallet_id)===yn))==null?void 0:Or.version)===3?((Pr=ae==null?void 0:ae.find(Et=>(Et==null?void 0:Et.wallet_id)===yn))==null?void 0:Pr.wallet_name)+" (API-AGENT) Wallet":(ts=ae==null?void 0:ae.find(Et=>(Et==null?void 0:Et.wallet_id)===yn))==null?void 0:ts.wallet_name:"Select"}),i.jsx("svg",{className:`w-4 h-4 ml-2 transform transition ${ke?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),ke&&i.jsxs("div",{className:"absolute z-10 mt-1 w-full bg-[#353535] rounded-md shadow-lg overflow-hidden px-2.5 py-1.5",children:[i.jsxs("div",{onClick:()=>{const Et=Fe==="hyper"?"hyperliquid":"lighter";window.open(`/wallet-management#${Et}#add-account#${Et}`,"_blank"),Me(!1)},className:"px-3 py-2 text-[#1de674] font-semibold text-sm cursor-pointer flex justify-start items-center gap-1.5 border border-[#8860ff] rounded-md my-1 bg-[#7445ff]",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Add Account"})]}),i.jsx("div",{className:"flex flex-col gap-[2px] max-h-[170px] overflow-y-auto",children:ae&&((Ls=[...ae].sort((Et,or)=>{var us,as;const Hn=(us=Et==null?void 0:Et.wallet_name)==null?void 0:us.includes("Dextrabot"),Vr=(as=or==null?void 0:or.wallet_name)==null?void 0:as.includes("Dextrabot");return Hn&&!Vr?-1:!Hn&&Vr?1:0}))==null?void 0:Ls.map((Et,or)=>i.jsxs("div",{onClick:Hn=>{Hn.preventDefault(),(!zt&&lr||zt&&lr||!zt&&!lr)&&Fr(Et==null?void 0:Et.wallet_id)},className:`py-2 px-2 h-8 min-h-8 flex justify-between items-center rounded-md font-inter text-[14px] font-medium leading-[8px] tracking-[-0.28px] ${zt&&!lr?"cursor-not-allowed":"cursor-pointer"} ${(Et==null?void 0:Et.wallet_id)===yn?"bg-[#2c2c2c]":"hover:bg-[#2c2c2c]"} text-white`,children:[i.jsx("span",{className:"text-white",children:(Et==null?void 0:Et.wallet_name)==="Dextrabot"&&(Et==null?void 0:Et.version)===3?(Et==null?void 0:Et.wallet_name)+" (API-AGENT) Wallet":Et==null?void 0:Et.wallet_name}),(Et==null?void 0:Et.wallet_id)===yn&&i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-[#1de674]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},(Et==null?void 0:Et.wallet_id)??or)))})]}),Ce&&i.jsx("div",{className:"absolute top-8 left-0 px-3 py-1 bg-[#3b2626] rounded-md h-7",children:i.jsx("div",{className:"text-[#ff787b] text-xs font-semibold font-manrope",children:"You need to choose a wallet"})})]})]}),i.jsx("div",{onClick:()=>{On()},className:"flex sm:hidden lg:flex xl:hidden justify-center items-center cursor-pointer",children:i.jsx(n2e,{className:"w-4 h-4 text-[#929292] hover:text-white"})})]})]})]}),i.jsxs("div",{className:"flex flex-row items-center justify-between rounded-md w-full",children:[i.jsxs("div",{className:"flex flex-col items-start justify-between rounded-md",children:[i.jsxs("div",{className:"flex items-center space-x-3",children:[i.jsx("div",{className:"w-8 lg:w-12 h-8 lg:h-12 flex items-center justify-center rounded-full bg-[rgba(255,217,121,0.16)]",children:i.jsx("span",{className:"text-[#F2C94C] text-xl",children:i.jsx("img",{src:Elt,alt:"Dextrabot",className:"w-[18px] h-[18px]"})})}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-white font-manrope text-[14px] font-semibold leading-[8px]",children:"Trade Settings"}),i.jsx("div",{className:"text-[#979797] font-manrope text-[12px] font-normal leading-[8px] tracking-[0.24px]",children:"Make your settings for this Trader"})]})]}),i.jsx("div",{className:`${Ge||Fe==="hyper"?"hidden":""} flex justify-center items-center space-x-4 mt-1 ml-10 lg:ml-[60px]`,children:i.jsxs("a",{href:"https://docs.dextrabot.com/copy-trade/methodology",target:"_blank",rel:"noopener noreferrer",className:"flex items-center bg-[#4A4A4A] rounded-lg text-[#CECECE] font-manrope text-[11px] font-semibold leading-[8px] px-3 py-2 hover:text-white",children:[i.jsx("img",{src:sme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})})]}),Ge||Fe==="hyper"?i.jsx("div",{className:"flex justify-center items-center space-x-4 mt-2 ml-10 lg:ml-[60px]",children:i.jsxs("a",{href:"https://docs.dextrabot.com/copy-trade/methodology",target:"_blank",rel:"noopener noreferrer",className:"flex items-center bg-[#4A4A4A] rounded-lg text-[#CECECE] font-manrope text-[11px] font-semibold leading-[8px] px-3 py-2 hover:text-white",children:[i.jsx("img",{src:sme,alt:"Dextrabot",className:"w-4 h-4 mr-2"}),"Methodology"]})}):Fe==="lighter"&&i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between text-[13px] text-[#7C7C7C] font-semibold w-full",children:[i.jsx("span",{className:"pl-[2px]",children:"Slot"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(S5,{className:"w-3 h-3 text-[#67FFBD] fill-[#67FFBD]"}),i.jsxs("span",{className:"text-[#67FFBD] font-medium",children:[kr||0,"/",Sn+kr||0]})]})]}),i.jsx("div",{onClick:()=>{ls(Fn),et(!0)},className:"flex items-center justify-center h-8 px-2 sm:px-6 rounded-[10px] text-[11px] sm:text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Get more slots"})]})]}),i.jsx("div",{className:`${Ge?"mt-2":""} flex flex-col justify-start items-start w-full`,children:i.jsxs("div",{className:"flex justify-stretch w-full gap-[5px] xl:gap-[14px] pt-[2px] border-b border-[#353535]",children:[i.jsxs("div",{onClick:()=>{(te!=="method_two"&&te!=="method_twothousand"&&Fe==="hyper"||(te=="method_two"||te=="method_twothousand")&&(!zt||zt&&lr)&&Fe==="hyper")&&fe("method_one")},className:`relative ${te==="method_one"?"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]":"text-[#7C7C7C]"} flex-1 h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[14px] font-medium leading-[8px] tracking-[-0.28px] rounded-tl-lg rounded-tr-lg ${(te==="method_two"||te==="method_twothousand")&&zt&&!lr||Fe!=="hyper"?"cursor-not-allowed":"cursor-pointer"} min-w-max`,children:[i.jsxs("span",{className:"relative",children:["Method I"," ",i.jsx("div",{className:"text-[#ff787b] bg-[#ff797c]/20 text-[9px] font-semibold font-manrope leading-[8px] rounded-md p-1 absolute -top-4 left-[45px] lg:hidden animate-bounce",children:"LEGACY"})]}),i.jsx("div",{className:"text-[#ff787b] bg-[#ff797c]/20 text-[11px] font-semibold font-manrope leading-[8px] rounded-md p-2 hidden lg:flex",children:"LEGACY"}),te==="method_one"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]}),i.jsxs("div",{onClick:()=>{(te!=="method_one"&&te!=="method_two"&&Fe==="hyper"||(te=="method_one"||te=="method_two")&&(!zt||zt&&lr)&&Fe==="hyper")&&fe("method_twothousand")},className:`relative ${te==="method_twothousand"?"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]":"text-[#7C7C7C]"} flex-1 h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[14px] font-medium leading-[8px] tracking-[-0.28px] ${(te==="method_one"||te==="method_two")&&zt&&!lr||Fe!=="hyper"?"cursor-not-allowed":"cursor-pointer"} rounded-tl-lg rounded-tr-lg min-w-max`,children:["Method II",te==="method_twothousand"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]}),i.jsxs("div",{onClick:()=>{(te!=="method_one"&&te!=="method_twothousand"||(te=="method_one"||te=="method_twothousand")&&(!zt||zt&&lr))&&fe("method_two")},className:`relative ${te==="method_two"?"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]":"text-[#7C7C7C]"} flex-1 h-[37px] px-2 py-1.5 justify-center items-center gap-x-2 inline-flex text-[14px] font-medium leading-[8px] tracking-[-0.28px] rounded-tl-lg rounded-tr-lg ${(te==="method_one"||te==="method_twothousand")&&zt&&!lr?"cursor-not-allowed":"cursor-pointer"}`,children:[i.jsxs("div",{className:"flex justify-center flex-grow whitespace-nowrap text-center gap-2",children:["Method III"," ",i.jsx("span",{className:"hidden lg:block",children:"(Mirror)"})]}),i.jsx("div",{className:"bg-[rgba(103,255,189,0.16)] text-[#67FFBD] text-[11px] font-semibold font-manrope leading-[8px] rounded-md p-2 hidden lg:flex",children:"Preferred"}),te==="method_two"&&i.jsx("div",{className:"absolute bottom-0 left-0 w-full h-[1px] bg-[#67FFBD]"})]})]})}),te==="method_one"&&i.jsxs("div",{className:"w-full space-y-4 mt-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] hidden lg:block",children:"Use % of Trader margin per position"}),i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] block lg:hidden",children:"Use % of Trader Margin"}),i.jsx("div",{className:"flex mt-2 relative",children:i.jsxs("div",{className:"relative w-full",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{value:pt||"",onChange:vt,type:"text",name:"marginUsedRate",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Used Rate",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${pt?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})})]}),i.jsxs("div",{className:"flex flex-col justify-start relative",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Initial Margin Cap"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:Je||"",onChange:fr,type:"text",name:"marginUsedAmount",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Amount",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-7
${we?"border border-[#FF797C]":Je?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Margin Increase Limit"}),i.jsxs("div",{className:"flex mt-2 relative w-full",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:hn||"",onChange:Yr,type:"text",name:"marginIncreaseLimit",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Increase Limit",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-7
${hn?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] hidden lg:block",children:"Copy Increase as Open Position"}),i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] block lg:hidden",children:"Copy Inc. as Open Pos."}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:mt?"On":"Off"}),i.jsx(Io,{checked:mt,onChange:Lt,className:`${mt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Stop Loss"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:Zt.inputValue||"",onChange:it,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Stop Loss",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-14
${Zt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Take Profit"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:jt.inputValue||"",onChange:Ct,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Take Profit",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-14
${jt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Include TWAP Orders"}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:kt?"On":"Off"}),i.jsx(Io,{checked:kt,onChange:dn,className:`${kt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Direction Filter"}),i.jsxs("div",{className:"hidden items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>se("All"),isPositionType:q}),i.jsx(tg,{title:"LONG",set_click:()=>se("LONG"),isPositionType:q}),i.jsx(tg,{title:"SHORT",set_click:()=>se("SHORT"),isPositionType:q})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Copy Current"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:An?"On":"Off"}),i.jsx(Io,{checked:An,onChange:Et=>{(!zt||zt&&lr)&&ze&&kn(Et)},className:`${An?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${zt&&!lr||!ze?"cursor-not-allowed opacity-50":"cursor-pointer"}
rounded-full p-1 transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
${An?"translate-x-3":""}`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Future Listed Tokens"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:rn?"On":"Off"}),i.jsx(Io,{checked:rn,onChange:gn,className:`${rn?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4",children:i.jsx("div",{className:"flex flex-col items-start justify-start",children:i.jsx("div",{className:"flex relative w-full",children:i.jsx(zq,{dataCoin:bn,coinInclude:tr,coinExclude:hr,setCoinInclude:ar,setCoinExclude:qt,isLoadingCoin:en})})})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"relative flex flex-col justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Tag"}),i.jsx("div",{className:"flex mt-2 relative",children:i.jsx("input",{type:"text",value:Xn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${be?"border border-[#FF797C]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Run"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When ON, copy trading will start immediately after saving. When OFF, settings will be saved but trading remains paused.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] mt-6"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ze?"On":"Off"}),i.jsx(Io,{checked:ze,onChange:Et=>{rt(Et),Et||kn(!1)},className:`${ze?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px]
translate-x-0 rounded-full bg-white ring-0 shadow-lg
transition duration-200 ease-in-out group-data-[checked]:translate-x-3`})})]})]})]})]}),te==="method_twothousand"&&i.jsxs("div",{className:"w-full space-y-4 mt-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsxs("div",{className:`${Be?"-mt-1":""} flex items-center gap-2`,children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Max. Margin per Positions (Optional)"}),i.jsxs("div",{className:`${Be?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:rc,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:"Must be greater than or equal to Min Margin per Order, greater than or equal to Max Margin per Order, and greater than or equal to Initial Margin Cap.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:`${Be?"mt-1":"mt-2"} flex w-full relative`,children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:Xt||"",onChange:Er,type:"text",name:"maxUsdPerpPositions",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Amount",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${Be?"border border-[#FF797C] focus:outline-none focus:ring-0":Xt?"border border-[#C5C5C5] focus:outline-none focus:ring-0":"outline-[#404040]"}
placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-1",children:[i.jsxs("div",{className:`${nt?"-mt-1":""} flex items-center gap-2`,children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Initial Margin Cap (Optional)"}),i.jsxs("div",{className:`${nt?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:rc,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:"Must be less than or equal to Max Margin per Position.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:`${nt?"":"mt-1"} flex w-full relative`,children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:Jt||"",onChange:dr,type:"text",name:"initialOrderMaxUsd",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Amount",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope leading-none rounded-md w-full h-8 pl-6 pr-7
${nt?"border border-[#FF797C] focus:outline-none focus:ring-0":Jt?"border border-[#C5C5C5] focus:outline-none focus:ring-0":"outline-[#404040]"} placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsxs("div",{className:`${dt?"-mt-1":""} flex items-center gap-2`,children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Min. Margin per Order (Optional)"}),i.jsxs("div",{className:`${dt?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:rc,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:"Must be less than or equal to Max Margin per Order and less than or equal to Max Margin per Position.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:`${dt?"mt-1":"mt-2"} flex w-full relative`,children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:wt||"",onChange:ln,type:"text",name:"minUsdPerOrder",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Amount",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${dt?"border border-[#FF797C] focus:outline-none focus:ring-0":wt?"border border-[#C5C5C5] focus:outline-none focus:ring-0":"outline-[#404040]"}
placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-1",children:[i.jsxs("div",{className:`${Qe&&(Xt||wt)?"-mt-1":""} flex items-center gap-2`,children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Max. Margin per Order"}),i.jsxs("div",{className:`${Qe&&(Xt||wt)?"flex":"hidden"} items-center has-tooltip relative`,children:[i.jsx("img",{src:rc,alt:"Dextrabot",className:"w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:"Must be greater than or equal to Min Margin per Order and less than or equal to Max Margin per Position.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:`${Qe&&(Xt||wt)?"":"mt-1"} flex w-full relative`,children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"$"}),i.jsx("input",{value:cn||"",onChange:xn,type:"text",name:"maxUsdPerOrder",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Amount",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${Qe?"border border-[#FF797C] focus:outline-none focus:ring-0":cn?"border border-[#C5C5C5] focus:outline-none focus:ring-0":"outline-[#404040]"}
placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Copy Current"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[300px] min-w-[120px] mt-8 leading-[16px]"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:An?"On":"Off"}),i.jsx(Io,{checked:An,onChange:Et=>{(!zt||zt&&lr)&&ze&&kn(Et)},className:`${An?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${zt&&!lr||!ze?"cursor-not-allowed opacity-50":"cursor-pointer"}
rounded-full p-1 transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
${An?"translate-x-3":""}`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] hidden lg:block",children:"Copy Increase as Open Position"}),i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] block lg:hidden",children:"Copy Inc. as Open Pos."}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:mt?"On":"Off"}),i.jsx(Io,{checked:mt,onChange:Lt,className:`${mt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex items-center justify-start gap-1",children:[i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Stop Loss"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:Zt.inputValue||"",onChange:it,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Stop Loss",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${Zt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Take Profit"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:jt.inputValue||"",onChange:Ct,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Take Profit",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-2
${jt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2 mt-[6px]",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Direction Filter"}),i.jsxs("div",{className:"hidden items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>se("All"),isPositionType:q}),i.jsx(tg,{title:"LONG",set_click:()=>se("LONG"),isPositionType:q}),i.jsx(tg,{title:"SHORT",set_click:()=>se("SHORT"),isPositionType:q})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Include TWAP Orders"}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:kt?"On":"Off"}),i.jsx(Io,{checked:kt,onChange:dn,className:`${kt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Future Listed Tokens"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:rn?"On":"Off"}),i.jsx(Io,{checked:rn,onChange:gn,className:`${rn?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4",children:i.jsx("div",{className:"flex flex-col items-start justify-start",children:i.jsx("div",{className:"flex relative w-full",children:i.jsx(zq,{dataCoin:bn,coinInclude:tr,coinExclude:hr,setCoinInclude:ar,setCoinExclude:qt,isLoadingCoin:en})})})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"relative flex flex-col justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Tag"}),i.jsx("div",{className:"flex mt-2 relative",children:i.jsx("input",{type:"text",value:Xn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${be?"border border-[#FF797C]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Run"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When ON, copy trading will start immediately after saving. When OFF, settings will be saved but trading remains paused.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] mt-6"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ze?"On":"Off"}),i.jsx(Io,{checked:ze,onChange:Et=>{rt(Et),Et||kn(!1)},className:`${ze?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px]
translate-x-0 rounded-full bg-white ring-0 shadow-lg
transition duration-200 ease-in-out group-data-[checked]:translate-x-3`})})]})]})]})]}),te==="method_two"&&i.jsxs("div",{className:"w-full space-y-4 mt-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Scaling"}),i.jsxs("div",{className:"flex mt-2 w-full relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{value:De||"",onChange:is,type:"text",name:"scalingPercentage",onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Scaling",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-7 ${De?Ie?"border border-[#D97706]":"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`}),Ie&&i.jsxs("span",{className:"absolute left-0 top-11 -translate-y-1/2 text-[#F59E0B] font-semibold text-[9px] leading-2 flex",children:[i.jsx(ER,{className:"w-4 h-4 text-[#F59E0B]"}),i.jsx("span",{className:"text-[9px] leading-[10px] ml-1",children:"If scaling produces sizes above your available margin, orders will fail."})]})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] hidden lg:block",children:"Copy Increase as Open Position"}),i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px] block lg:hidden",children:"Copy Inc. as Open Pos."}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:mt?"On":"Off"}),i.jsx(Io,{checked:mt,onChange:Lt,className:`${mt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Stop Loss"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:Zt.inputValue||"",onChange:it,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Stop Loss",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-14
${Zt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]}),i.jsxs("div",{className:"flex flex-col justify-start my-1 sm:my-1.5",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Take Profit"}),i.jsxs("div",{className:"flex mt-2 relative",children:[i.jsx("span",{className:"absolute left-1 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold mr-2",children:"%"}),i.jsx("input",{type:"text",value:jt.inputValue||"",onChange:Ct,onKeyDown:Ir,autoComplete:"off",min:"0",placeholder:"Take Profit",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-6 pr-14
${jt.inputValue?"border border-[#C5C5C5]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Include TWAP Orders"}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:kt?"On":"Off"}),i.jsx(Io,{checked:kt,onChange:dn,className:`${kt?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Direction Filter"}),i.jsxs("div",{className:"hidden items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(tg,{title:"All",set_click:()=>se("All"),isPositionType:q}),i.jsx(tg,{title:"LONG",set_click:()=>se("LONG"),isPositionType:q}),i.jsx(tg,{title:"SHORT",set_click:()=>se("SHORT"),isPositionType:q})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Copy Current"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(oo,{content:Fe==="lighter"?"Coming Soon":zt?"This option can only be set when starting copy trading. It cannot be changed later.":"If enabled, your wallet will immediately copy all currently open positions from the Source Wallet.",positionTop:!1,alignRight:!0,tooltipCss:`${Fe==="lighter"?"max-w-[120px]":"mt-8 max-w-[300px]"} min-w-[120px] leading-[16px]`})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:An?"On":"Off"}),i.jsx(Io,{checked:An,onChange:Et=>{(!zt||zt&&lr)&&ze&&Fe==="hyper"&&kn(Et)},className:`${An?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9
${zt&&!lr||!ze||Fe==="lighter"?"cursor-not-allowed opacity-50":"cursor-pointer"}
rounded-full p-1 transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
${An?"translate-x-3":""}`})})]})]}),i.jsxs("div",{className:"flex flex-col justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Future Listed Tokens"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When enabled, automatically copy trades for new tokens when they get listed on the exchange.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[120px] min-w-[120px] leading-[16px] mt-8"})})]})]}),i.jsxs("span",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:rn?"On":"Off"}),i.jsx(Io,{checked:rn,onChange:gn,className:`${rn?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px] translate-x-0
rounded-full bg-white ring-0 shadow-lg transition duration-200 ease-in-out
group-data-[checked]:translate-x-3`})})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4",children:i.jsx("div",{className:"flex flex-col items-start justify-start",children:i.jsx("div",{className:"flex relative w-full",children:i.jsx(zq,{dataCoin:bn,coinInclude:tr,coinExclude:hr,setCoinInclude:ar,setCoinExclude:qt,isLoadingCoin:en})})})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"relative flex flex-col justify-start",children:[i.jsx("p",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Tag"}),i.jsx("div",{className:"flex mt-2 relative",children:i.jsx("input",{type:"text",value:Xn||"",onChange:pr,placeholder:"Tag",className:`shadow-sm py-0.5 bg-[#303030] block text-xs sm:text-sm font-semibold font-manrope
leading-none rounded-md w-full h-8 pl-2 pr-7
${be?"border border-[#FF797C]":""}
outline-[#404040] placeholder:text-[#7F7F7F]`})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 -mt-1",children:[i.jsx("span",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Run"}),i.jsxs("div",{className:"flex items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 relative"}),i.jsx("span",{children:i.jsx(oo,{content:"When ON, copy trading will start immediately after saving. When OFF, settings will be saved but trading remains paused.",positionTop:!1,alignRight:!0,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] mt-6"})})]})]}),i.jsxs("div",{className:"flex justify-between w-full items-center gap-2 bg-[#353535] p-1 rounded-md px-2 h-8",children:[i.jsx("span",{className:"text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px]",children:ze?"On":"Off"}),i.jsx(Io,{checked:ze,onChange:Et=>{rt(Et),Et||kn(!1)},className:`${ze?"bg-[#1DE674]":"bg-white/10"} group relative flex h-5 w-9 cursor-pointer rounded-full p-1
transition-colors duration-200 ease-in-out focus:outline-none`,children:i.jsx("span",{"aria-hidden":"true",className:`pointer-events-none inline-block size-4 -mt-[3px]
translate-x-0 rounded-full bg-white ring-0 shadow-lg
transition duration-200 ease-in-out group-data-[checked]:translate-x-3`})})]})]})]}),Fe==="lighter"?Ge?i.jsx("div",{className:"text-[#FF797C] font-semibold text-[10px] leading-4 border border-[#ff797c]/30 rounded-md px-3 py-1",children:"Copy Trading on Lighter requires an active Dextrabot subscription. Get access to copy this trader and more."}):gt?i.jsx("div",{className:"text-[#FF797C] font-semibold text-[10px] leading-4 border border-[#ff797c]/30 rounded-md px-3 py-1",children:"Your current slot count is not sufficient for this action. To proceed, please purchase additional slots using the ‘Get more slots’ button."}):Ys?i.jsx("div",{className:"text-[#FF797C] font-semibold text-[10px] leading-4 border border-[#ff797c]/30 rounded-md px-3 py-1",children:"This wallet already has an active Copy Trade. Please select a different wallet to create a new Copy Trade."}):i.jsx("div",{className:"text-[#F59E0B] font-semibold text-[10px] leading-4 border border-[#D97706] rounded-md px-3 py-1",children:"All positions opened via Lighter Copy Trade are executed in Cross Margin Mode."}):Ys&&i.jsx("div",{className:"text-[#FF797C] font-semibold text-[10px] leading-4 border border-[#ff797c]/30 rounded-md px-3 py-1",children:"This wallet already has an active Copy Trade. Please select a different wallet to create a new Copy Trade."})]}),i.jsxs("div",{className:"flex items-center w-full mt-auto h-16 border-t border-t-[#353535] bg-[rgba(27,27,27,0.32)] backdrop-blur-[16px] p-2 rounded-b-2xl",children:[lt>0&&!Ge&&i.jsxs("div",{className:"hidden sm:flex rounded-[8px] bg-[rgba(255,121,124,0.16)] backdrop-blur-[16px] w-12 h-10 justify-center items-center text-[#FF797C] font-manrope text-[12px] font-semibold leading-[12px] tracking-[0.22px] gap-2",children:[i.jsx("img",{src:rc,alt:"Dextrabot"}),lt]}),i.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.jsx("button",{onClick:()=>e(!1),className:"rounded-[12px] border bg-black/5 border-[#353535] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] hover:border-white px-[24px] py-[12px] font-inter font-[13px] mr-2 h-[32px] flex items-center justify-center text-medium leading-[8px] tracking-[-0.26px]",children:"Cancel"}),i.jsx("button",{onClick:Et=>{yn!=null&&!isNaN(yn)&&(te!=="method_one"||Je!=null&&!isNaN(Je)&&Je)&&(te!=="method_twothousand"||cn!=null&&!isNaN(cn)&&cn&&(!(Xt!=null&&!isNaN(Xt)&&Xt)||Number(Xt)>=Number(cn)&&(!(wt!=null&&!isNaN(wt)&&wt)||Number(Xt)>=Number(wt))&&(!(Jt!=null&&!isNaN(Jt)&&Jt)||Number(Xt)>=Number(Jt)))&&(!(wt!=null&&!isNaN(wt)&&wt)||Number(cn)>=Number(wt)))&&Xn&&(Fe!=="lighter"||Wt)&&(Fe!=="lighter"||!gt)?!Zt.inputValue||!jt.inputValue?Zn(!0):yr():(me(yn==null||isNaN(yn)),xe(te==="method_one"&&(Je==null||isNaN(Je)||!Je)),Ke(te==="method_twothousand"&&(cn==null||isNaN(cn)||!cn||cn!=null&&!isNaN(cn)&&cn&&wt!=null&&!isNaN(wt)&&wt&&Number(wt)>Number(cn)||cn!=null&&!isNaN(cn)&&cn&&Xt!=null&&!isNaN(Xt)&&Xt&&Number(cn)>Number(Xt))),tt(te==="method_twothousand"&&(cn!=null&&!isNaN(cn)&&cn&&wt!=null&&!isNaN(wt)&&wt&&Number(wt)>Number(cn)||Xt!=null&&!isNaN(Xt)&&Xt&&wt!=null&&!isNaN(wt)&&wt&&Number(wt)>Number(Xt))),Le(te==="method_twothousand"&&Xt!=null&&!isNaN(Xt)&&Xt&&Jt!=null&&!isNaN(Jt)&&Jt&&Number(Jt)>Number(Xt)),ht(te==="method_twothousand"&&Xt!=null&&!isNaN(Xt)&&Xt&&(cn!=null&&!isNaN(cn)&&cn&&Number(cn)>Number(Xt)||wt!=null&&!isNaN(wt)&&wt&&Number(wt)>Number(Xt)||Jt!=null&&!isNaN(Jt)&&Jt&&Number(Jt)>Number(Xt))),je(!Xn||Xn===""),Re(Fe==="lighter"&&De&&De>100),Tt(Fe==="lighter"&&!Wt))},type:"button",className:`${te==="method_one"||Fe==="lighter"&&Ge||Fe==="lighter"&>||Ys?"hidden":""} rounded-[10px] border border-[#8861FF] bg-[#7446FF] hover:bg-[#5834C3] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] font-inter px-[24px] py-[12px] font-[13px] h-[32px] flex items-center justify-center text-medium mr-2 leading-[8px] tracking-[-0.26px]`,children:"Apply"}),lt>0&&Fe==="lighter"&&Ge&&i.jsx(Gzt,{checkAccountCopy:ss,setIsLighterSub:ct,setLighterSubError:Tt,setSlotCount:Gn,setSlotSubsCount:ur,setSlotUsingCount:Bn,setSlotTotalCount:Mn,setSlotCountWallets:Tr}),lt>0&&!Ge&>&&Fe==="lighter"&&i.jsx("div",{onClick:()=>{ls(Fn),et(!0)},className:"flex items-center justify-center h-8 px-2 sm:px-6 rounded-[10px] text-[11px] sm:text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Get more slots"}),i.jsx("button",{onClick:Et=>{Et.preventDefault(),u!=null&&u.some(or=>or.wallet_address===r)&&Jn()},type:"button",className:`rounded-[12px] border border-[#353535] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] hover:border-[#FF797C] font-inter px-[24px] py-[12px] font-[13px] h-[32px] text-medium leading-[8px] tracking-[-0.26px] flex !text-[#FF797C] items-center justify-center bg-[rgba(27,27,27,0.32)]" ${u!=null&&u.some(Et=>Et.wallet_address===r)&&!lr?"":"hidden"}`,children:"Delete"})]})]})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 my-16 px-4",children:[i.jsx("div",{className:"py-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsx("span",{className:"text-center mb-5 font-bold mt-3 text-[21px]",children:"Wallet Required!"}),i.jsx("span",{className:"text-center mb-5 font-medium px-10 -mt-6",children:"You need to create and fund at least one wallet before starting copy trading."}),i.jsx("div",{onClick:()=>{window.location.href="/wallet-management"},className:"w-[284px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer ",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Go to Wallet Management"})})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 mt-16 mb-8 px-4 text-white",children:[i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsx("span",{className:"text-center mb-5 font-bold mt-10 text-[21px]",children:"Closed Beta Has Started! 🚀"}),i.jsx("span",{className:"text-center mb-5 font-medium px-10 -mt-6",children:"Follow our Discord to stay updated and be ready for the full launch!"}),i.jsx("span",{className:"text-center mb-5 font-medium px-10 -mt-6",children:"Early access requirements:"}),i.jsx("div",{onClick:()=>{window.open("https://www.tensor.trade/trade/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Sol"})}),i.jsx("div",{onClick:()=>{window.open("https://blur.io/collection/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Eth"})}),i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Join Our Discord"})})]})})})})})})]})]})}const tg=({title:t,set_click:e,isPositionType:n})=>i.jsx("div",{onClick:e,className:`${n==t?n=="LONG"?"bg-[#67ffbd]/20 text-[#67FFBD]":n=="SHORT"?"bg-[#ff797c]/20 text-[#FF797C]":(n=="All","bg-[#3d3d3d] text-white"):"bg-transparent text-[#9b9b9b]"} text-[13px] font-medium font-manrope leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-[22px]`,children:t});function z$e(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=z$e(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function la(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=z$e(t))&&(r&&(r+=" "),r+=e);return r}var Vq,H2e;function wf(){if(H2e)return Vq;H2e=1;var t=Array.isArray;return Vq=t,Vq}var Wq,V2e;function H$e(){if(V2e)return Wq;V2e=1;var t=typeof Ru=="object"&&Ru&&Ru.Object===Object&&Ru;return Wq=t,Wq}var qq,W2e;function Cx(){if(W2e)return qq;W2e=1;var t=H$e(),e=typeof self=="object"&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return qq=n,qq}var Gq,q2e;function KT(){if(q2e)return Gq;q2e=1;var t=Cx(),e=t.Symbol;return Gq=e,Gq}var Kq,G2e;function Yzt(){if(G2e)return Kq;G2e=1;var t=KT(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,s=t?t.toStringTag:void 0;function a(o){var l=n.call(o,s),c=o[s];try{o[s]=void 0;var u=!0}catch{}var d=r.call(o);return u&&(l?o[s]=c:delete o[s]),d}return Kq=a,Kq}var Yq,K2e;function Xzt(){if(K2e)return Yq;K2e=1;var t=Object.prototype,e=t.toString;function n(r){return e.call(r)}return Yq=n,Yq}var Xq,Y2e;function U1(){if(Y2e)return Xq;Y2e=1;var t=KT(),e=Yzt(),n=Xzt(),r="[object Null]",s="[object Undefined]",a=t?t.toStringTag:void 0;function o(l){return l==null?l===void 0?s:r:a&&a in Object(l)?e(l):n(l)}return Xq=o,Xq}var Qq,X2e;function z1(){if(X2e)return Qq;X2e=1;function t(e){return e!=null&&typeof e=="object"}return Qq=t,Qq}var Zq,Q2e;function Cj(){if(Q2e)return Zq;Q2e=1;var t=U1(),e=z1(),n="[object Symbol]";function r(s){return typeof s=="symbol"||e(s)&&t(s)==n}return Zq=r,Zq}var Jq,Z2e;function rue(){if(Z2e)return Jq;Z2e=1;var t=wf(),e=Cj(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function s(a,o){if(t(a))return!1;var l=typeof a;return l=="number"||l=="symbol"||l=="boolean"||a==null||e(a)?!0:r.test(a)||!n.test(a)||o!=null&&a in Object(o)}return Jq=s,Jq}var eG,J2e;function F2(){if(J2e)return eG;J2e=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return eG=t,eG}var tG,eve;function sue(){if(eve)return tG;eve=1;var t=U1(),e=F2(),n="[object AsyncFunction]",r="[object Function]",s="[object GeneratorFunction]",a="[object Proxy]";function o(l){if(!e(l))return!1;var c=t(l);return c==r||c==s||c==n||c==a}return tG=o,tG}var nG,tve;function Qzt(){if(tve)return nG;tve=1;var t=Cx(),e=t["__core-js_shared__"];return nG=e,nG}var rG,nve;function Zzt(){if(nve)return rG;nve=1;var t=Qzt(),e=function(){var r=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!e&&e in r}return rG=n,rG}var sG,rve;function V$e(){if(rve)return sG;rve=1;var t=Function.prototype,e=t.toString;function n(r){if(r!=null){try{return e.call(r)}catch{}try{return r+""}catch{}}return""}return sG=n,sG}var iG,sve;function Jzt(){if(sve)return iG;sve=1;var t=sue(),e=Zzt(),n=F2(),r=V$e(),s=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,l=Object.prototype,c=o.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(x){if(!n(x)||e(x))return!1;var g=t(x)?d:a;return g.test(r(x))}return iG=f,iG}var aG,ive;function eHt(){if(ive)return aG;ive=1;function t(e,n){return e==null?void 0:e[n]}return aG=t,aG}var oG,ave;function U5(){if(ave)return oG;ave=1;var t=Jzt(),e=eHt();function n(r,s){var a=e(r,s);return t(a)?a:void 0}return oG=n,oG}var lG,ove;function PU(){if(ove)return lG;ove=1;var t=U5(),e=t(Object,"create");return lG=e,lG}var cG,lve;function tHt(){if(lve)return cG;lve=1;var t=PU();function e(){this.__data__=t?t(null):{},this.size=0}return cG=e,cG}var uG,cve;function nHt(){if(cve)return uG;cve=1;function t(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}return uG=t,uG}var dG,uve;function rHt(){if(uve)return dG;uve=1;var t=PU(),e="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function s(a){var o=this.__data__;if(t){var l=o[a];return l===e?void 0:l}return r.call(o,a)?o[a]:void 0}return dG=s,dG}var fG,dve;function sHt(){if(dve)return fG;dve=1;var t=PU(),e=Object.prototype,n=e.hasOwnProperty;function r(s){var a=this.__data__;return t?a[s]!==void 0:n.call(a,s)}return fG=r,fG}var hG,fve;function iHt(){if(fve)return hG;fve=1;var t=PU(),e="__lodash_hash_undefined__";function n(r,s){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=t&&s===void 0?e:s,this}return hG=n,hG}var pG,hve;function aHt(){if(hve)return pG;hve=1;var t=tHt(),e=nHt(),n=rHt(),r=sHt(),s=iHt();function a(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var u=o[l];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=n,a.prototype.has=r,a.prototype.set=s,pG=a,pG}var mG,pve;function oHt(){if(pve)return mG;pve=1;function t(){this.__data__=[],this.size=0}return mG=t,mG}var xG,mve;function iue(){if(mve)return xG;mve=1;function t(e,n){return e===n||e!==e&&n!==n}return xG=t,xG}var gG,xve;function IU(){if(xve)return gG;xve=1;var t=iue();function e(n,r){for(var s=n.length;s--;)if(t(n[s][0],r))return s;return-1}return gG=e,gG}var bG,gve;function lHt(){if(gve)return bG;gve=1;var t=IU(),e=Array.prototype,n=e.splice;function r(s){var a=this.__data__,o=t(a,s);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():n.call(a,o,1),--this.size,!0}return bG=r,bG}var yG,bve;function cHt(){if(bve)return yG;bve=1;var t=IU();function e(n){var r=this.__data__,s=t(r,n);return s<0?void 0:r[s][1]}return yG=e,yG}var vG,yve;function uHt(){if(yve)return vG;yve=1;var t=IU();function e(n){return t(this.__data__,n)>-1}return vG=e,vG}var wG,vve;function dHt(){if(vve)return wG;vve=1;var t=IU();function e(n,r){var s=this.__data__,a=t(s,n);return a<0?(++this.size,s.push([n,r])):s[a][1]=r,this}return wG=e,wG}var CG,wve;function FU(){if(wve)return CG;wve=1;var t=oHt(),e=lHt(),n=cHt(),r=uHt(),s=dHt();function a(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var u=o[l];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=n,a.prototype.has=r,a.prototype.set=s,CG=a,CG}var SG,Cve;function aue(){if(Cve)return SG;Cve=1;var t=U5(),e=Cx(),n=t(e,"Map");return SG=n,SG}var NG,Sve;function fHt(){if(Sve)return NG;Sve=1;var t=aHt(),e=FU(),n=aue();function r(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}return NG=r,NG}var AG,Nve;function hHt(){if(Nve)return AG;Nve=1;function t(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}return AG=t,AG}var jG,Ave;function OU(){if(Ave)return jG;Ave=1;var t=hHt();function e(n,r){var s=n.__data__;return t(r)?s[typeof r=="string"?"string":"hash"]:s.map}return jG=e,jG}var EG,jve;function pHt(){if(jve)return EG;jve=1;var t=OU();function e(n){var r=t(this,n).delete(n);return this.size-=r?1:0,r}return EG=e,EG}var _G,Eve;function mHt(){if(Eve)return _G;Eve=1;var t=OU();function e(n){return t(this,n).get(n)}return _G=e,_G}var kG,_ve;function xHt(){if(_ve)return kG;_ve=1;var t=OU();function e(n){return t(this,n).has(n)}return kG=e,kG}var TG,kve;function gHt(){if(kve)return TG;kve=1;var t=OU();function e(n,r){var s=t(this,n),a=s.size;return s.set(n,r),this.size+=s.size==a?0:1,this}return TG=e,TG}var PG,Tve;function oue(){if(Tve)return PG;Tve=1;var t=fHt(),e=pHt(),n=mHt(),r=xHt(),s=gHt();function a(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var u=o[l];this.set(u[0],u[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=n,a.prototype.has=r,a.prototype.set=s,PG=a,PG}var IG,Pve;function W$e(){if(Pve)return IG;Pve=1;var t=oue(),e="Expected a function";function n(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new TypeError(e);var a=function(){var o=arguments,l=s?s.apply(this,o):o[0],c=a.cache;if(c.has(l))return c.get(l);var u=r.apply(this,o);return a.cache=c.set(l,u)||c,u};return a.cache=new(n.Cache||t),a}return n.Cache=t,IG=n,IG}var FG,Ive;function bHt(){if(Ive)return FG;Ive=1;var t=W$e(),e=500;function n(r){var s=t(r,function(o){return a.size===e&&a.clear(),o}),a=s.cache;return s}return FG=n,FG}var OG,Fve;function yHt(){if(Fve)return OG;Fve=1;var t=bHt(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t(function(s){var a=[];return s.charCodeAt(0)===46&&a.push(""),s.replace(e,function(o,l,c,u){a.push(c?u.replace(n,"$1"):l||o)}),a});return OG=r,OG}var MG,Ove;function lue(){if(Ove)return MG;Ove=1;function t(e,n){for(var r=-1,s=e==null?0:e.length,a=Array(s);++r<s;)a[r]=n(e[r],r,e);return a}return MG=t,MG}var RG,Mve;function vHt(){if(Mve)return RG;Mve=1;var t=KT(),e=lue(),n=wf(),r=Cj(),s=t?t.prototype:void 0,a=s?s.toString:void 0;function o(l){if(typeof l=="string")return l;if(n(l))return e(l,o)+"";if(r(l))return a?a.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return RG=o,RG}var LG,Rve;function q$e(){if(Rve)return LG;Rve=1;var t=vHt();function e(n){return n==null?"":t(n)}return LG=e,LG}var DG,Lve;function G$e(){if(Lve)return DG;Lve=1;var t=wf(),e=rue(),n=yHt(),r=q$e();function s(a,o){return t(a)?a:e(a,o)?[a]:n(r(a))}return DG=s,DG}var BG,Dve;function MU(){if(Dve)return BG;Dve=1;var t=Cj();function e(n){if(typeof n=="string"||t(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return BG=e,BG}var $G,Bve;function cue(){if(Bve)return $G;Bve=1;var t=G$e(),e=MU();function n(r,s){s=t(s,r);for(var a=0,o=s.length;r!=null&&a<o;)r=r[e(s[a++])];return a&&a==o?r:void 0}return $G=n,$G}var UG,$ve;function K$e(){if($ve)return UG;$ve=1;var t=cue();function e(n,r,s){var a=n==null?void 0:t(n,r);return a===void 0?s:a}return UG=e,UG}var wHt=K$e();const dp=Ii(wHt);var zG,Uve;function CHt(){if(Uve)return zG;Uve=1;function t(e){return e==null}return zG=t,zG}var SHt=CHt();const Si=Ii(SHt);var HG,zve;function NHt(){if(zve)return HG;zve=1;var t=U1(),e=wf(),n=z1(),r="[object String]";function s(a){return typeof a=="string"||!e(a)&&n(a)&&t(a)==r}return HG=s,HG}var AHt=NHt();const c5=Ii(AHt);var jHt=sue();const Ei=Ii(jHt);var EHt=F2();const Sj=Ii(EHt);var VG={exports:{}},Fa={};/**
* @license React
* react-is.production.min.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.
*/var Hve;function _Ht(){if(Hve)return Fa;Hve=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function v(C){if(typeof C=="object"&&C!==null){var N=C.$$typeof;switch(N){case t:switch(C=C.type,C){case n:case s:case r:case u:case d:return C;default:switch(C=C&&C.$$typeof,C){case l:case o:case c:case x:case f:case a:return C;default:return N}}case e:return N}}}return Fa.ContextConsumer=o,Fa.ContextProvider=a,Fa.Element=t,Fa.ForwardRef=c,Fa.Fragment=n,Fa.Lazy=x,Fa.Memo=f,Fa.Portal=e,Fa.Profiler=s,Fa.StrictMode=r,Fa.Suspense=u,Fa.SuspenseList=d,Fa.isAsyncMode=function(){return!1},Fa.isConcurrentMode=function(){return!1},Fa.isContextConsumer=function(C){return v(C)===o},Fa.isContextProvider=function(C){return v(C)===a},Fa.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},Fa.isForwardRef=function(C){return v(C)===c},Fa.isFragment=function(C){return v(C)===n},Fa.isLazy=function(C){return v(C)===x},Fa.isMemo=function(C){return v(C)===f},Fa.isPortal=function(C){return v(C)===e},Fa.isProfiler=function(C){return v(C)===s},Fa.isStrictMode=function(C){return v(C)===r},Fa.isSuspense=function(C){return v(C)===u},Fa.isSuspenseList=function(C){return v(C)===d},Fa.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===n||C===s||C===r||C===u||C===d||C===g||typeof C=="object"&&C!==null&&(C.$$typeof===x||C.$$typeof===f||C.$$typeof===a||C.$$typeof===o||C.$$typeof===c||C.$$typeof===y||C.getModuleId!==void 0)},Fa.typeOf=v,Fa}var Vve;function kHt(){return Vve||(Vve=1,VG.exports=_Ht()),VG.exports}var THt=kHt(),WG,Wve;function Y$e(){if(Wve)return WG;Wve=1;var t=U1(),e=z1(),n="[object Number]";function r(s){return typeof s=="number"||e(s)&&t(s)==n}return WG=r,WG}var qG,qve;function PHt(){if(qve)return qG;qve=1;var t=Y$e();function e(n){return t(n)&&n!=+n}return qG=e,qG}var IHt=PHt();const Nj=Ii(IHt);var FHt=Y$e();const OHt=Ii(FHt);var gm=function(e){return e===0?0:e>0?1:-1},Cw=function(e){return c5(e)&&e.indexOf("%")===e.length-1},rs=function(e){return OHt(e)&&!Nj(e)},oc=function(e){return rs(e)||c5(e)},MHt=0,z5=function(e){var n=++MHt;return"".concat(e||"").concat(n)},u5=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!rs(e)&&!c5(e))return r;var a;if(Cw(e)){var o=e.indexOf("%");a=n*parseFloat(e.slice(0,o))/100}else a=+e;return Nj(a)&&(a=r),s&&a>n&&(a=n),a},Kb=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},RHt=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},s=0;s<n;s++)if(!r[e[s]])r[e[s]]=!0;else return!0;return!1},Al=function(e,n){return rs(e)&&rs(n)?function(r){return e+r*(n-e)}:function(){return n}};function $L(t,e,n){return!t||!t.length?null:t.find(function(r){return r&&(typeof e=="function"?e(r):dp(r,e))===n})}var LHt=function(e){if(!e||!e.length)return null;for(var n=e.length,r=0,s=0,a=0,o=0,l=1/0,c=-1/0,u=0,d=0,f=0;f<n;f++)u=e[f].cx||0,d=e[f].cy||0,r+=u,s+=d,a+=u*d,o+=u*u,l=Math.min(l,u),c=Math.max(c,u);var x=n*o!==r*r?(n*a-r*s)/(n*o-r*r):0;return{xmin:l,xmax:c,a:x,b:(s-x*r)/n}},DHt=function(e,n){return rs(e)&&rs(n)?e-n:c5(e)&&c5(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function R4(t,e){for(var n in t)if({}.hasOwnProperty.call(t,n)&&(!{}.hasOwnProperty.call(e,n)||t[n]!==e[n]))return!1;for(var r in e)if({}.hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(t,r))return!1;return!0}function jne(t){"@babel/helpers - typeof";return jne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jne(t)}var BHt=["viewBox","children"],$Ht=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Gve=["points","pathLength"],GG={svg:BHt,polygon:Gve,polyline:Gve},uue=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],UL=function(e,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(m.isValidElement(e)&&(r=e.props),!Sj(r))return null;var s={};return Object.keys(r).forEach(function(a){uue.includes(a)&&(s[a]=n||function(o){return r[a](r,o)})}),s},UHt=function(e,n,r){return function(s){return e(n,r,s),null}},$_=function(e,n,r){if(!Sj(e)||jne(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(a){var o=e[a];uue.includes(a)&&typeof o=="function"&&(s||(s={}),s[a]=UHt(o,n,r))}),s},zHt=["children"],HHt=["children"];function Kve(t,e){if(t==null)return{};var n=VHt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function VHt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ene(t){"@babel/helpers - typeof";return Ene=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ene(t)}var Yve={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},o1=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},Xve=null,KG=null,due=function t(e){if(e===Xve&&Array.isArray(KG))return KG;var n=[];return m.Children.forEach(e,function(r){Si(r)||(THt.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),KG=n,Xve=e,n};function hf(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(s){return o1(s)}):r=[o1(e)],due(t).forEach(function(s){var a=dp(s,"type.displayName")||dp(s,"type.name");r.indexOf(a)!==-1&&n.push(s)}),n}function Wf(t,e){var n=hf(t,e);return n[0]}var Qve=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,s=n.height;return!(!rs(r)||r<=0||!rs(s)||s<=0)},WHt=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],qHt=function(e){return e&&e.type&&c5(e.type)&&WHt.indexOf(e.type)>=0},X$e=function(e){return e&&Ene(e)==="object"&&"clipDot"in e},GHt=function(e,n,r,s){var a,o=(a=GG==null?void 0:GG[s])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Ei(e)&&(s&&o.includes(n)||$Ht.includes(n))||r&&uue.includes(n)},Ci=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(m.isValidElement(e)&&(s=e.props),!Sj(s))return null;var a={};return Object.keys(s).forEach(function(o){var l;GHt((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(a[o]=s[o])}),a},_ne=function t(e,n){if(e===n)return!0;var r=m.Children.count(e);if(r!==m.Children.count(n))return!1;if(r===0)return!0;if(r===1)return Zve(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var s=0;s<r;s++){var a=e[s],o=n[s];if(Array.isArray(a)||Array.isArray(o)){if(!t(a,o))return!1}else if(!Zve(a,o))return!1}return!0},Zve=function(e,n){if(Si(e)&&Si(n))return!0;if(!Si(e)&&!Si(n)){var r=e.props||{},s=r.children,a=Kve(r,zHt),o=n.props||{},l=o.children,c=Kve(o,HHt);return s&&l?R4(a,c)&&_ne(s,l):!s&&!l?R4(a,c):!1}return!1},Jve=function(e,n){var r=[],s={};return due(e).forEach(function(a,o){if(qHt(a))r.push(a);else if(a){var l=o1(a.type),c=n[l]||{},u=c.handler,d=c.once;if(u&&(!d||!s[l])){var f=u(a,l,o);r.push(f),s[l]=!0}}}),r},KHt=function(e){var n=e&&e.type;return n&&Yve[n]?Yve[n]:null},YHt=function(e,n){return due(n).indexOf(e)},XHt=["children","width","height","viewBox","className","style","title","desc"];function kne(){return kne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kne.apply(this,arguments)}function QHt(t,e){if(t==null)return{};var n=ZHt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ZHt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Tne(t){var e=t.children,n=t.width,r=t.height,s=t.viewBox,a=t.className,o=t.style,l=t.title,c=t.desc,u=QHt(t,XHt),d=s||{width:n,height:r,x:0,y:0},f=la("recharts-surface",a);return Ne.createElement("svg",kne({},Ci(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),Ne.createElement("title",null,l),Ne.createElement("desc",null,c),e)}var JHt=["children","className"];function Pne(){return Pne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pne.apply(this,arguments)}function eVt(t,e){if(t==null)return{};var n=tVt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function tVt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Na=Ne.forwardRef(function(t,e){var n=t.children,r=t.className,s=eVt(t,JHt),a=la("recharts-layer",r);return Ne.createElement("g",Pne({className:a},Ci(s,!0),{ref:e}),n)}),l1=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),a=2;a<r;a++)s[a-2]=arguments[a]},YG,ewe;function nVt(){if(ewe)return YG;ewe=1;function t(e,n,r){var s=-1,a=e.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(a);++s<a;)o[s]=e[s+n];return o}return YG=t,YG}var XG,twe;function rVt(){if(twe)return XG;twe=1;var t=nVt();function e(n,r,s){var a=n.length;return s=s===void 0?a:s,!r&&s>=a?n:t(n,r,s)}return XG=e,XG}var QG,nwe;function Q$e(){if(nwe)return QG;nwe=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=e+n+r,a="\\ufe0e\\ufe0f",o="\\u200d",l=RegExp("["+o+t+s+a+"]");function c(u){return l.test(u)}return QG=c,QG}var ZG,rwe;function sVt(){if(rwe)return ZG;rwe=1;function t(e){return e.split("")}return ZG=t,ZG}var JG,swe;function iVt(){if(swe)return JG;swe=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",s=e+n+r,a="\\ufe0e\\ufe0f",o="["+t+"]",l="["+s+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",x="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",y=u+"?",v="["+a+"]?",C="(?:"+g+"(?:"+[d,f,x].join("|")+")"+v+y+")*",N=v+y+C,P="(?:"+[d+l+"?",l,f,x,o].join("|")+")",T=RegExp(c+"(?="+c+")|"+P+N,"g");function M(F){return F.match(T)||[]}return JG=M,JG}var eK,iwe;function aVt(){if(iwe)return eK;iwe=1;var t=sVt(),e=Q$e(),n=iVt();function r(s){return e(s)?n(s):t(s)}return eK=r,eK}var tK,awe;function oVt(){if(awe)return tK;awe=1;var t=rVt(),e=Q$e(),n=aVt(),r=q$e();function s(a){return function(o){o=r(o);var l=e(o)?n(o):void 0,c=l?l[0]:o.charAt(0),u=l?t(l,1).join(""):o.slice(1);return c[a]()+u}}return tK=s,tK}var nK,owe;function lVt(){if(owe)return nK;owe=1;var t=oVt(),e=t("toUpperCase");return nK=e,nK}var cVt=lVt();const RU=Ii(cVt);function co(t){return function(){return t}}const Z$e=Math.cos,zL=Math.sin,Rm=Math.sqrt,HL=Math.PI,LU=2*HL,Ine=Math.PI,Fne=2*Ine,Kv=1e-6,uVt=Fne-Kv;function J$e(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function dVt(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return J$e;const n=10**e;return function(r){this._+=r[0];for(let s=1,a=r.length;s<a;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class fVt{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?J$e:dVt(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,s){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(e,n,r,s,a,o){this._append`C${+e},${+n},${+r},${+s},${this._x1=+a},${this._y1=+o}`}arcTo(e,n,r,s,a){if(e=+e,n=+n,r=+r,s=+s,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,l=this._y1,c=r-e,u=s-n,d=o-e,f=l-n,x=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(x>Kv)if(!(Math.abs(f*c-u*d)>Kv)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let g=r-o,y=s-l,v=c*c+u*u,C=g*g+y*y,N=Math.sqrt(v),P=Math.sqrt(x),T=a*Math.tan((Ine-Math.acos((v+x-C)/(2*N*P)))/2),M=T/P,F=T/N;Math.abs(M-1)>Kv&&this._append`L${e+M*d},${n+M*f}`,this._append`A${a},${a},0,0,${+(f*g>d*y)},${this._x1=e+F*c},${this._y1=n+F*u}`}}arc(e,n,r,s,a,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=e+l,d=n+c,f=1^o,x=o?s-a:a-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Kv||Math.abs(this._y1-d)>Kv)&&this._append`L${u},${d}`,r&&(x<0&&(x=x%Fne+Fne),x>uVt?this._append`A${r},${r},0,1,${f},${e-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:x>Kv&&this._append`A${r},${r},0,${+(x>=Ine)},${f},${this._x1=e+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(e,n,r,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function fue(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new fVt(e)}function hue(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function eUe(t){this._context=t}eUe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function DU(t){return new eUe(t)}function tUe(t){return t[0]}function nUe(t){return t[1]}function rUe(t,e){var n=co(!0),r=null,s=DU,a=null,o=fue(l);t=typeof t=="function"?t:t===void 0?tUe:co(t),e=typeof e=="function"?e:e===void 0?nUe:co(e);function l(c){var u,d=(c=hue(c)).length,f,x=!1,g;for(r==null&&(a=s(g=o())),u=0;u<=d;++u)!(u<d&&n(f=c[u],u,c))===x&&((x=!x)?a.lineStart():a.lineEnd()),x&&a.point(+t(f,u,c),+e(f,u,c));if(g)return a=null,g+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:co(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:co(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:co(!!c),l):n},l.curve=function(c){return arguments.length?(s=c,r!=null&&(a=s(r)),l):s},l.context=function(c){return arguments.length?(c==null?r=a=null:a=s(r=c),l):r},l}function dF(t,e,n){var r=null,s=co(!0),a=null,o=DU,l=null,c=fue(u);t=typeof t=="function"?t:t===void 0?tUe:co(+t),e=typeof e=="function"?e:co(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?nUe:co(+n);function u(f){var x,g,y,v=(f=hue(f)).length,C,N=!1,P,T=new Array(v),M=new Array(v);for(a==null&&(l=o(P=c())),x=0;x<=v;++x){if(!(x<v&&s(C=f[x],x,f))===N)if(N=!N)g=x,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=x-1;y>=g;--y)l.point(T[y],M[y]);l.lineEnd(),l.areaEnd()}N&&(T[x]=+t(C,x,f),M[x]=+e(C,x,f),l.point(r?+r(C,x,f):T[x],n?+n(C,x,f):M[x]))}if(P)return l=null,P+""||null}function d(){return rUe().defined(s).curve(o).context(a)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:co(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:co(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:co(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:co(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:co(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:co(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:co(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class sUe{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function hVt(t){return new sUe(t,!0)}function pVt(t){return new sUe(t,!1)}const pue={draw(t,e){const n=Rm(e/HL);t.moveTo(n,0),t.arc(0,0,n,0,LU)}},mVt={draw(t,e){const n=Rm(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},iUe=Rm(1/3),xVt=iUe*2,gVt={draw(t,e){const n=Rm(e/xVt),r=n*iUe;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},bVt={draw(t,e){const n=Rm(e),r=-n/2;t.rect(r,r,n,n)}},yVt=.8908130915292852,aUe=zL(HL/10)/zL(7*HL/10),vVt=zL(LU/10)*aUe,wVt=-Z$e(LU/10)*aUe,CVt={draw(t,e){const n=Rm(e*yVt),r=vVt*n,s=wVt*n;t.moveTo(0,-n),t.lineTo(r,s);for(let a=1;a<5;++a){const o=LU*a/5,l=Z$e(o),c=zL(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*s,c*r+l*s)}t.closePath()}},rK=Rm(3),SVt={draw(t,e){const n=-Rm(e/(rK*3));t.moveTo(0,n*2),t.lineTo(-rK*n,-n),t.lineTo(rK*n,-n),t.closePath()}},Ph=-.5,Ih=Rm(3)/2,One=1/Rm(12),NVt=(One/2+1)*3,AVt={draw(t,e){const n=Rm(e/NVt),r=n/2,s=n*One,a=r,o=n*One+n,l=-a,c=o;t.moveTo(r,s),t.lineTo(a,o),t.lineTo(l,c),t.lineTo(Ph*r-Ih*s,Ih*r+Ph*s),t.lineTo(Ph*a-Ih*o,Ih*a+Ph*o),t.lineTo(Ph*l-Ih*c,Ih*l+Ph*c),t.lineTo(Ph*r+Ih*s,Ph*s-Ih*r),t.lineTo(Ph*a+Ih*o,Ph*o-Ih*a),t.lineTo(Ph*l+Ih*c,Ph*c-Ih*l),t.closePath()}};function jVt(t,e){let n=null,r=fue(s);t=typeof t=="function"?t:co(t||pue),e=typeof e=="function"?e:co(e===void 0?64:+e);function s(){let a;if(n||(n=a=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),a)return n=null,a+""||null}return s.type=function(a){return arguments.length?(t=typeof a=="function"?a:co(a),s):t},s.size=function(a){return arguments.length?(e=typeof a=="function"?a:co(+a),s):e},s.context=function(a){return arguments.length?(n=a??null,s):n},s}function VL(){}function WL(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function oUe(t){this._context=t}oUe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:WL(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:WL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function EVt(t){return new oUe(t)}function lUe(t){this._context=t}lUe.prototype={areaStart:VL,areaEnd:VL,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:WL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function _Vt(t){return new lUe(t)}function cUe(t){this._context=t}cUe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:WL(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function kVt(t){return new cUe(t)}function uUe(t){this._context=t}uUe.prototype={areaStart:VL,areaEnd:VL,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function TVt(t){return new uUe(t)}function lwe(t){return t<0?-1:1}function cwe(t,e,n){var r=t._x1-t._x0,s=e-t._x1,a=(t._y1-t._y0)/(r||s<0&&-0),o=(n-t._y1)/(s||r<0&&-0),l=(a*s+o*r)/(r+s);return(lwe(a)+lwe(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function uwe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function sK(t,e,n){var r=t._x0,s=t._y0,a=t._x1,o=t._y1,l=(a-r)/3;t._context.bezierCurveTo(r+l,s+l*e,a-l,o-l*n,a,o)}function qL(t){this._context=t}qL.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sK(this,this._t0,uwe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,sK(this,uwe(this,n=cwe(this,t,e)),n);break;default:sK(this,this._t0,n=cwe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function dUe(t){this._context=new fUe(t)}(dUe.prototype=Object.create(qL.prototype)).point=function(t,e){qL.prototype.point.call(this,e,t)};function fUe(t){this._context=t}fUe.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,s,a){this._context.bezierCurveTo(e,t,r,n,a,s)}};function PVt(t){return new qL(t)}function IVt(t){return new dUe(t)}function hUe(t){this._context=t}hUe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=dwe(t),s=dwe(e),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],s[0][a],r[1][a],s[1][a],t[o],e[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function dwe(t){var e,n=t.length-1,r,s=new Array(n),a=new Array(n),o=new Array(n);for(s[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)s[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(s[n-1]=2,a[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=s[e]/a[e-1],a[e]-=r,o[e]-=r*o[e-1];for(s[n-1]=o[n-1]/a[n-1],e=n-2;e>=0;--e)s[e]=(o[e]-s[e+1])/a[e];for(a[n-1]=(t[n]+s[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-s[e+1];return[s,a]}function FVt(t){return new hUe(t)}function BU(t,e){this._context=t,this._t=e}BU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function OVt(t){return new BU(t,.5)}function MVt(t){return new BU(t,0)}function RVt(t){return new BU(t,1)}function WN(t,e){if((o=t.length)>1)for(var n=1,r,s,a=t[e[0]],o,l=a.length;n<o;++n)for(s=a,a=t[e[n]],r=0;r<l;++r)a[r][1]+=a[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function Mne(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function LVt(t,e){return t[e]}function DVt(t){const e=[];return e.key=t,e}function BVt(){var t=co([]),e=Mne,n=WN,r=LVt;function s(a){var o=Array.from(t.apply(this,arguments),DVt),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l<c;++l)(o[l][u]=[0,+r(f,o[l].key,u,a)]).data=f;for(l=0,d=hue(e(o));l<c;++l)o[d[l]].index=l;return n(o,d),o}return s.keys=function(a){return arguments.length?(t=typeof a=="function"?a:co(Array.from(a)),s):t},s.value=function(a){return arguments.length?(r=typeof a=="function"?a:co(+a),s):r},s.order=function(a){return arguments.length?(e=a==null?Mne:typeof a=="function"?a:co(Array.from(a)),s):e},s.offset=function(a){return arguments.length?(n=a??WN,s):n},s}function $Vt(t,e){if((r=t.length)>0){for(var n,r,s=0,a=t[0].length,o;s<a;++s){for(o=n=0;n<r;++n)o+=t[n][s][1]||0;if(o)for(n=0;n<r;++n)t[n][s][1]/=o}WN(t,e)}}function UVt(t,e){if((s=t.length)>0){for(var n=0,r=t[e[0]],s,a=r.length;n<a;++n){for(var o=0,l=0;o<s;++o)l+=t[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}WN(t,e)}}function zVt(t,e){if(!(!((o=t.length)>0)||!((a=(s=t[e[0]]).length)>0))){for(var n=0,r=1,s,a,o;r<a;++r){for(var l=0,c=0,u=0;l<o;++l){for(var d=t[e[l]],f=d[r][1]||0,x=d[r-1][1]||0,g=(f-x)/2,y=0;y<l;++y){var v=t[e[y]],C=v[r][1]||0,N=v[r-1][1]||0;g+=C-N}c+=f,u+=g*f}s[r-1][1]+=s[r-1][0]=n,c&&(n-=u/c)}s[r-1][1]+=s[r-1][0]=n,WN(t,e)}}function U_(t){"@babel/helpers - typeof";return U_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U_(t)}var HVt=["type","size","sizeType"];function Rne(){return Rne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Rne.apply(this,arguments)}function fwe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hwe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fwe(Object(n),!0).forEach(function(r){VVt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fwe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function VVt(t,e,n){return e=WVt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WVt(t){var e=qVt(t,"string");return U_(e)=="symbol"?e:e+""}function qVt(t,e){if(U_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(U_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GVt(t,e){if(t==null)return{};var n=KVt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function KVt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var pUe={symbolCircle:pue,symbolCross:mVt,symbolDiamond:gVt,symbolSquare:bVt,symbolStar:CVt,symbolTriangle:SVt,symbolWye:AVt},YVt=Math.PI/180,XVt=function(e){var n="symbol".concat(RU(e));return pUe[n]||pue},QVt=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var s=18*YVt;return 1.25*e*e*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},ZVt=function(e,n){pUe["symbol".concat(RU(e))]=n},$U=function(e){var n=e.type,r=n===void 0?"circle":n,s=e.size,a=s===void 0?64:s,o=e.sizeType,l=o===void 0?"area":o,c=GVt(e,HVt),u=hwe(hwe({},c),{},{type:r,size:a,sizeType:l}),d=function(){var C=XVt(r),N=jVt().type(C).size(QVt(a,l,r));return N()},f=u.className,x=u.cx,g=u.cy,y=Ci(u,!0);return x===+x&&g===+g&&a===+a?Ne.createElement("path",Rne({},y,{className:la("recharts-symbols",f),transform:"translate(".concat(x,", ").concat(g,")"),d:d()})):null};$U.registerSymbol=ZVt;function qN(t){"@babel/helpers - typeof";return qN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qN(t)}function Lne(){return Lne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Lne.apply(this,arguments)}function pwe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function JVt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pwe(Object(n),!0).forEach(function(r){z_(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pwe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function eWt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tWt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xUe(r.key),r)}}function nWt(t,e,n){return tWt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function rWt(t,e,n){return e=GL(e),sWt(t,mUe()?Reflect.construct(e,n||[],GL(t).constructor):e.apply(t,n))}function sWt(t,e){if(e&&(qN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iWt(t)}function iWt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mUe=function(){return!!t})()}function GL(t){return GL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},GL(t)}function aWt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dne(t,e)}function Dne(t,e){return Dne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Dne(t,e)}function z_(t,e,n){return e=xUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xUe(t){var e=oWt(t,"string");return qN(e)=="symbol"?e:e+""}function oWt(t,e){if(qN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(qN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $p=32,mue=function(t){function e(){return eWt(this,e),rWt(this,e,arguments)}return aWt(e,t),nWt(e,[{key:"renderIcon",value:function(r){var s=this.props.inactiveColor,a=$p/2,o=$p/6,l=$p/3,c=r.inactive?s:r.color;if(r.type==="plainline")return Ne.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:$p,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return Ne.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(a,"h").concat(l,`
A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(a,`
H`).concat($p,"M").concat(2*l,",").concat(a,`
A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return Ne.createElement("path",{stroke:"none",fill:c,d:"M0,".concat($p/8,"h").concat($p,"v").concat($p*3/4,"h").concat(-32,"z"),className:"recharts-legend-icon"});if(Ne.isValidElement(r.legendIcon)){var u=JVt({},r);return delete u.legendIcon,Ne.cloneElement(r.legendIcon,u)}return Ne.createElement($U,{fill:c,cx:a,cy:a,size:$p,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,s=this.props,a=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,u=s.inactiveColor,d={x:0,y:0,width:$p,height:$p},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},x={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(g,y){var v=g.formatter||c,C=la(z_(z_({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",g.inactive));if(g.type==="none")return null;var N=Ei(g.value)?null:g.value;l1(!Ei(g.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var P=g.inactive?u:g.color;return Ne.createElement("li",Lne({className:C,style:f,key:"legend-item-".concat(y)},$_(r.props,g,y)),Ne.createElement(Tne,{width:o,height:o,viewBox:d,style:x},r.renderIcon(g)),Ne.createElement("span",{className:"recharts-legend-item-text",style:{color:P}},v?v(N,g,y):N))})}},{key:"render",value:function(){var r=this.props,s=r.payload,a=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return Ne.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(m.PureComponent);z_(mue,"displayName","Legend");z_(mue,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var iK,mwe;function lWt(){if(mwe)return iK;mwe=1;var t=FU();function e(){this.__data__=new t,this.size=0}return iK=e,iK}var aK,xwe;function cWt(){if(xwe)return aK;xwe=1;function t(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r}return aK=t,aK}var oK,gwe;function uWt(){if(gwe)return oK;gwe=1;function t(e){return this.__data__.get(e)}return oK=t,oK}var lK,bwe;function dWt(){if(bwe)return lK;bwe=1;function t(e){return this.__data__.has(e)}return lK=t,lK}var cK,ywe;function fWt(){if(ywe)return cK;ywe=1;var t=FU(),e=aue(),n=oue(),r=200;function s(a,o){var l=this.__data__;if(l instanceof t){var c=l.__data__;if(!e||c.length<r-1)return c.push([a,o]),this.size=++l.size,this;l=this.__data__=new n(c)}return l.set(a,o),this.size=l.size,this}return cK=s,cK}var uK,vwe;function gUe(){if(vwe)return uK;vwe=1;var t=FU(),e=lWt(),n=cWt(),r=uWt(),s=dWt(),a=fWt();function o(l){var c=this.__data__=new t(l);this.size=c.size}return o.prototype.clear=e,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=s,o.prototype.set=a,uK=o,uK}var dK,wwe;function hWt(){if(wwe)return dK;wwe=1;var t="__lodash_hash_undefined__";function e(n){return this.__data__.set(n,t),this}return dK=e,dK}var fK,Cwe;function pWt(){if(Cwe)return fK;Cwe=1;function t(e){return this.__data__.has(e)}return fK=t,fK}var hK,Swe;function bUe(){if(Swe)return hK;Swe=1;var t=oue(),e=hWt(),n=pWt();function r(s){var a=-1,o=s==null?0:s.length;for(this.__data__=new t;++a<o;)this.add(s[a])}return r.prototype.add=r.prototype.push=e,r.prototype.has=n,hK=r,hK}var pK,Nwe;function yUe(){if(Nwe)return pK;Nwe=1;function t(e,n){for(var r=-1,s=e==null?0:e.length;++r<s;)if(n(e[r],r,e))return!0;return!1}return pK=t,pK}var mK,Awe;function vUe(){if(Awe)return mK;Awe=1;function t(e,n){return e.has(n)}return mK=t,mK}var xK,jwe;function wUe(){if(jwe)return xK;jwe=1;var t=bUe(),e=yUe(),n=vUe(),r=1,s=2;function a(o,l,c,u,d,f){var x=c&r,g=o.length,y=l.length;if(g!=y&&!(x&&y>g))return!1;var v=f.get(o),C=f.get(l);if(v&&C)return v==l&&C==o;var N=-1,P=!0,T=c&s?new t:void 0;for(f.set(o,l),f.set(l,o);++N<g;){var M=o[N],F=l[N];if(u)var $=x?u(F,M,N,l,o,f):u(M,F,N,o,l,f);if($!==void 0){if($)continue;P=!1;break}if(T){if(!e(l,function(L,z){if(!n(T,z)&&(M===L||d(M,L,c,u,f)))return T.push(z)})){P=!1;break}}else if(!(M===F||d(M,F,c,u,f))){P=!1;break}}return f.delete(o),f.delete(l),P}return xK=a,xK}var gK,Ewe;function mWt(){if(Ewe)return gK;Ewe=1;var t=Cx(),e=t.Uint8Array;return gK=e,gK}var bK,_we;function xWt(){if(_we)return bK;_we=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s,a){r[++n]=[a,s]}),r}return bK=t,bK}var yK,kwe;function xue(){if(kwe)return yK;kwe=1;function t(e){var n=-1,r=Array(e.size);return e.forEach(function(s){r[++n]=s}),r}return yK=t,yK}var vK,Twe;function gWt(){if(Twe)return vK;Twe=1;var t=KT(),e=mWt(),n=iue(),r=wUe(),s=xWt(),a=xue(),o=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",x="[object Number]",g="[object RegExp]",y="[object Set]",v="[object String]",C="[object Symbol]",N="[object ArrayBuffer]",P="[object DataView]",T=t?t.prototype:void 0,M=T?T.valueOf:void 0;function F($,L,z,X,ne,J,K){switch(z){case P:if($.byteLength!=L.byteLength||$.byteOffset!=L.byteOffset)return!1;$=$.buffer,L=L.buffer;case N:return!($.byteLength!=L.byteLength||!J(new e($),new e(L)));case c:case u:case x:return n(+$,+L);case d:return $.name==L.name&&$.message==L.message;case g:case v:return $==L+"";case f:var te=s;case y:var fe=X&o;if(te||(te=a),$.size!=L.size&&!fe)return!1;var q=K.get($);if(q)return q==L;X|=l,K.set($,L);var se=r(te($),te(L),X,ne,J,K);return K.delete($),se;case C:if(M)return M.call($)==M.call(L)}return!1}return vK=F,vK}var wK,Pwe;function CUe(){if(Pwe)return wK;Pwe=1;function t(e,n){for(var r=-1,s=n.length,a=e.length;++r<s;)e[a+r]=n[r];return e}return wK=t,wK}var CK,Iwe;function bWt(){if(Iwe)return CK;Iwe=1;var t=CUe(),e=wf();function n(r,s,a){var o=s(r);return e(r)?o:t(o,a(r))}return CK=n,CK}var SK,Fwe;function yWt(){if(Fwe)return SK;Fwe=1;function t(e,n){for(var r=-1,s=e==null?0:e.length,a=0,o=[];++r<s;){var l=e[r];n(l,r,e)&&(o[a++]=l)}return o}return SK=t,SK}var NK,Owe;function vWt(){if(Owe)return NK;Owe=1;function t(){return[]}return NK=t,NK}var AK,Mwe;function wWt(){if(Mwe)return AK;Mwe=1;var t=yWt(),e=vWt(),n=Object.prototype,r=n.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(o){return o==null?[]:(o=Object(o),t(s(o),function(l){return r.call(o,l)}))}:e;return AK=a,AK}var jK,Rwe;function CWt(){if(Rwe)return jK;Rwe=1;function t(e,n){for(var r=-1,s=Array(e);++r<e;)s[r]=n(r);return s}return jK=t,jK}var EK,Lwe;function SWt(){if(Lwe)return EK;Lwe=1;var t=U1(),e=z1(),n="[object Arguments]";function r(s){return e(s)&&t(s)==n}return EK=r,EK}var _K,Dwe;function gue(){if(Dwe)return _K;Dwe=1;var t=SWt(),e=z1(),n=Object.prototype,r=n.hasOwnProperty,s=n.propertyIsEnumerable,a=t(function(){return arguments}())?t:function(o){return e(o)&&r.call(o,"callee")&&!s.call(o,"callee")};return _K=a,_K}var s9={exports:{}},kK,Bwe;function NWt(){if(Bwe)return kK;Bwe=1;function t(){return!1}return kK=t,kK}s9.exports;var $we;function SUe(){return $we||($we=1,function(t,e){var n=Cx(),r=NWt(),s=e&&!e.nodeType&&e,a=s&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===s,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;t.exports=u}(s9,s9.exports)),s9.exports}var TK,Uwe;function bue(){if(Uwe)return TK;Uwe=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function n(r,s){var a=typeof r;return s=s??t,!!s&&(a=="number"||a!="symbol"&&e.test(r))&&r>-1&&r%1==0&&r<s}return TK=n,TK}var PK,zwe;function yue(){if(zwe)return PK;zwe=1;var t=9007199254740991;function e(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=t}return PK=e,PK}var IK,Hwe;function AWt(){if(Hwe)return IK;Hwe=1;var t=U1(),e=yue(),n=z1(),r="[object Arguments]",s="[object Array]",a="[object Boolean]",o="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",x="[object RegExp]",g="[object Set]",y="[object String]",v="[object WeakMap]",C="[object ArrayBuffer]",N="[object DataView]",P="[object Float32Array]",T="[object Float64Array]",M="[object Int8Array]",F="[object Int16Array]",$="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",X="[object Uint16Array]",ne="[object Uint32Array]",J={};J[P]=J[T]=J[M]=J[F]=J[$]=J[L]=J[z]=J[X]=J[ne]=!0,J[r]=J[s]=J[C]=J[a]=J[N]=J[o]=J[l]=J[c]=J[u]=J[d]=J[f]=J[x]=J[g]=J[y]=J[v]=!1;function K(te){return n(te)&&e(te.length)&&!!J[t(te)]}return IK=K,IK}var FK,Vwe;function NUe(){if(Vwe)return FK;Vwe=1;function t(e){return function(n){return e(n)}}return FK=t,FK}var i9={exports:{}};i9.exports;var Wwe;function jWt(){return Wwe||(Wwe=1,function(t,e){var n=H$e(),r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,a=s&&s.exports===r,o=a&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=l}(i9,i9.exports)),i9.exports}var OK,qwe;function AUe(){if(qwe)return OK;qwe=1;var t=AWt(),e=NUe(),n=jWt(),r=n&&n.isTypedArray,s=r?e(r):t;return OK=s,OK}var MK,Gwe;function EWt(){if(Gwe)return MK;Gwe=1;var t=CWt(),e=gue(),n=wf(),r=SUe(),s=bue(),a=AUe(),o=Object.prototype,l=o.hasOwnProperty;function c(u,d){var f=n(u),x=!f&&e(u),g=!f&&!x&&r(u),y=!f&&!x&&!g&&a(u),v=f||x||g||y,C=v?t(u.length,String):[],N=C.length;for(var P in u)(d||l.call(u,P))&&!(v&&(P=="length"||g&&(P=="offset"||P=="parent")||y&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||s(P,N)))&&C.push(P);return C}return MK=c,MK}var RK,Kwe;function _Wt(){if(Kwe)return RK;Kwe=1;var t=Object.prototype;function e(n){var r=n&&n.constructor,s=typeof r=="function"&&r.prototype||t;return n===s}return RK=e,RK}var LK,Ywe;function jUe(){if(Ywe)return LK;Ywe=1;function t(e,n){return function(r){return e(n(r))}}return LK=t,LK}var DK,Xwe;function kWt(){if(Xwe)return DK;Xwe=1;var t=jUe(),e=t(Object.keys,Object);return DK=e,DK}var BK,Qwe;function TWt(){if(Qwe)return BK;Qwe=1;var t=_Wt(),e=kWt(),n=Object.prototype,r=n.hasOwnProperty;function s(a){if(!t(a))return e(a);var o=[];for(var l in Object(a))r.call(a,l)&&l!="constructor"&&o.push(l);return o}return BK=s,BK}var $K,Zwe;function YT(){if(Zwe)return $K;Zwe=1;var t=sue(),e=yue();function n(r){return r!=null&&e(r.length)&&!t(r)}return $K=n,$K}var UK,Jwe;function UU(){if(Jwe)return UK;Jwe=1;var t=EWt(),e=TWt(),n=YT();function r(s){return n(s)?t(s):e(s)}return UK=r,UK}var zK,e3e;function PWt(){if(e3e)return zK;e3e=1;var t=bWt(),e=wWt(),n=UU();function r(s){return t(s,n,e)}return zK=r,zK}var HK,t3e;function IWt(){if(t3e)return HK;t3e=1;var t=PWt(),e=1,n=Object.prototype,r=n.hasOwnProperty;function s(a,o,l,c,u,d){var f=l&e,x=t(a),g=x.length,y=t(o),v=y.length;if(g!=v&&!f)return!1;for(var C=g;C--;){var N=x[C];if(!(f?N in o:r.call(o,N)))return!1}var P=d.get(a),T=d.get(o);if(P&&T)return P==o&&T==a;var M=!0;d.set(a,o),d.set(o,a);for(var F=f;++C<g;){N=x[C];var $=a[N],L=o[N];if(c)var z=f?c(L,$,N,o,a,d):c($,L,N,a,o,d);if(!(z===void 0?$===L||u($,L,l,c,d):z)){M=!1;break}F||(F=N=="constructor")}if(M&&!F){var X=a.constructor,ne=o.constructor;X!=ne&&"constructor"in a&&"constructor"in o&&!(typeof X=="function"&&X instanceof X&&typeof ne=="function"&&ne instanceof ne)&&(M=!1)}return d.delete(a),d.delete(o),M}return HK=s,HK}var VK,n3e;function FWt(){if(n3e)return VK;n3e=1;var t=U5(),e=Cx(),n=t(e,"DataView");return VK=n,VK}var WK,r3e;function OWt(){if(r3e)return WK;r3e=1;var t=U5(),e=Cx(),n=t(e,"Promise");return WK=n,WK}var qK,s3e;function EUe(){if(s3e)return qK;s3e=1;var t=U5(),e=Cx(),n=t(e,"Set");return qK=n,qK}var GK,i3e;function MWt(){if(i3e)return GK;i3e=1;var t=U5(),e=Cx(),n=t(e,"WeakMap");return GK=n,GK}var KK,a3e;function RWt(){if(a3e)return KK;a3e=1;var t=FWt(),e=aue(),n=OWt(),r=EUe(),s=MWt(),a=U1(),o=V$e(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",x="[object DataView]",g=o(t),y=o(e),v=o(n),C=o(r),N=o(s),P=a;return(t&&P(new t(new ArrayBuffer(1)))!=x||e&&P(new e)!=l||n&&P(n.resolve())!=u||r&&P(new r)!=d||s&&P(new s)!=f)&&(P=function(T){var M=a(T),F=M==c?T.constructor:void 0,$=F?o(F):"";if($)switch($){case g:return x;case y:return l;case v:return u;case C:return d;case N:return f}return M}),KK=P,KK}var YK,o3e;function LWt(){if(o3e)return YK;o3e=1;var t=gUe(),e=wUe(),n=gWt(),r=IWt(),s=RWt(),a=wf(),o=SUe(),l=AUe(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",x=Object.prototype,g=x.hasOwnProperty;function y(v,C,N,P,T,M){var F=a(v),$=a(C),L=F?d:s(v),z=$?d:s(C);L=L==u?f:L,z=z==u?f:z;var X=L==f,ne=z==f,J=L==z;if(J&&o(v)){if(!o(C))return!1;F=!0,X=!1}if(J&&!X)return M||(M=new t),F||l(v)?e(v,C,N,P,T,M):n(v,C,L,N,P,T,M);if(!(N&c)){var K=X&&g.call(v,"__wrapped__"),te=ne&&g.call(C,"__wrapped__");if(K||te){var fe=K?v.value():v,q=te?C.value():C;return M||(M=new t),T(fe,q,N,P,M)}}return J?(M||(M=new t),r(v,C,N,P,T,M)):!1}return YK=y,YK}var XK,l3e;function vue(){if(l3e)return XK;l3e=1;var t=LWt(),e=z1();function n(r,s,a,o,l){return r===s?!0:r==null||s==null||!e(r)&&!e(s)?r!==r&&s!==s:t(r,s,a,o,n,l)}return XK=n,XK}var QK,c3e;function DWt(){if(c3e)return QK;c3e=1;var t=gUe(),e=vue(),n=1,r=2;function s(a,o,l,c){var u=l.length,d=u,f=!c;if(a==null)return!d;for(a=Object(a);u--;){var x=l[u];if(f&&x[2]?x[1]!==a[x[0]]:!(x[0]in a))return!1}for(;++u<d;){x=l[u];var g=x[0],y=a[g],v=x[1];if(f&&x[2]){if(y===void 0&&!(g in a))return!1}else{var C=new t;if(c)var N=c(y,v,g,a,o,C);if(!(N===void 0?e(v,y,n|r,c,C):N))return!1}}return!0}return QK=s,QK}var ZK,u3e;function _Ue(){if(u3e)return ZK;u3e=1;var t=F2();function e(n){return n===n&&!t(n)}return ZK=e,ZK}var JK,d3e;function BWt(){if(d3e)return JK;d3e=1;var t=_Ue(),e=UU();function n(r){for(var s=e(r),a=s.length;a--;){var o=s[a],l=r[o];s[a]=[o,l,t(l)]}return s}return JK=n,JK}var eY,f3e;function kUe(){if(f3e)return eY;f3e=1;function t(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}return eY=t,eY}var tY,h3e;function $Wt(){if(h3e)return tY;h3e=1;var t=DWt(),e=BWt(),n=kUe();function r(s){var a=e(s);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(o){return o===s||t(o,s,a)}}return tY=r,tY}var nY,p3e;function UWt(){if(p3e)return nY;p3e=1;function t(e,n){return e!=null&&n in Object(e)}return nY=t,nY}var rY,m3e;function zWt(){if(m3e)return rY;m3e=1;var t=G$e(),e=gue(),n=wf(),r=bue(),s=yue(),a=MU();function o(l,c,u){c=t(c,l);for(var d=-1,f=c.length,x=!1;++d<f;){var g=a(c[d]);if(!(x=l!=null&&u(l,g)))break;l=l[g]}return x||++d!=f?x:(f=l==null?0:l.length,!!f&&s(f)&&r(g,f)&&(n(l)||e(l)))}return rY=o,rY}var sY,x3e;function HWt(){if(x3e)return sY;x3e=1;var t=UWt(),e=zWt();function n(r,s){return r!=null&&e(r,s,t)}return sY=n,sY}var iY,g3e;function VWt(){if(g3e)return iY;g3e=1;var t=vue(),e=K$e(),n=HWt(),r=rue(),s=_Ue(),a=kUe(),o=MU(),l=1,c=2;function u(d,f){return r(d)&&s(f)?a(o(d),f):function(x){var g=e(x,d);return g===void 0&&g===f?n(x,d):t(f,g,l|c)}}return iY=u,iY}var aY,b3e;function Aj(){if(b3e)return aY;b3e=1;function t(e){return e}return aY=t,aY}var oY,y3e;function WWt(){if(y3e)return oY;y3e=1;function t(e){return function(n){return n==null?void 0:n[e]}}return oY=t,oY}var lY,v3e;function qWt(){if(v3e)return lY;v3e=1;var t=cue();function e(n){return function(r){return t(r,n)}}return lY=e,lY}var cY,w3e;function GWt(){if(w3e)return cY;w3e=1;var t=WWt(),e=qWt(),n=rue(),r=MU();function s(a){return n(a)?t(r(a)):e(a)}return cY=s,cY}var uY,C3e;function O2(){if(C3e)return uY;C3e=1;var t=$Wt(),e=VWt(),n=Aj(),r=wf(),s=GWt();function a(o){return typeof o=="function"?o:o==null?n:typeof o=="object"?r(o)?e(o[0],o[1]):t(o):s(o)}return uY=a,uY}var dY,S3e;function TUe(){if(S3e)return dY;S3e=1;function t(e,n,r,s){for(var a=e.length,o=r+(s?1:-1);s?o--:++o<a;)if(n(e[o],o,e))return o;return-1}return dY=t,dY}var fY,N3e;function KWt(){if(N3e)return fY;N3e=1;function t(e){return e!==e}return fY=t,fY}var hY,A3e;function YWt(){if(A3e)return hY;A3e=1;function t(e,n,r){for(var s=r-1,a=e.length;++s<a;)if(e[s]===n)return s;return-1}return hY=t,hY}var pY,j3e;function XWt(){if(j3e)return pY;j3e=1;var t=TUe(),e=KWt(),n=YWt();function r(s,a,o){return a===a?n(s,a,o):t(s,e,o)}return pY=r,pY}var mY,E3e;function QWt(){if(E3e)return mY;E3e=1;var t=XWt();function e(n,r){var s=n==null?0:n.length;return!!s&&t(n,r,0)>-1}return mY=e,mY}var xY,_3e;function ZWt(){if(_3e)return xY;_3e=1;function t(e,n,r){for(var s=-1,a=e==null?0:e.length;++s<a;)if(r(n,e[s]))return!0;return!1}return xY=t,xY}var gY,k3e;function JWt(){if(k3e)return gY;k3e=1;function t(){}return gY=t,gY}var bY,T3e;function eqt(){if(T3e)return bY;T3e=1;var t=EUe(),e=JWt(),n=xue(),r=1/0,s=t&&1/n(new t([,-0]))[1]==r?function(a){return new t(a)}:e;return bY=s,bY}var yY,P3e;function tqt(){if(P3e)return yY;P3e=1;var t=bUe(),e=QWt(),n=ZWt(),r=vUe(),s=eqt(),a=xue(),o=200;function l(c,u,d){var f=-1,x=e,g=c.length,y=!0,v=[],C=v;if(d)y=!1,x=n;else if(g>=o){var N=u?null:s(c);if(N)return a(N);y=!1,x=r,C=new t}else C=u?[]:v;e:for(;++f<g;){var P=c[f],T=u?u(P):P;if(P=d||P!==0?P:0,y&&T===T){for(var M=C.length;M--;)if(C[M]===T)continue e;u&&C.push(T),v.push(P)}else x(C,T,d)||(C!==v&&C.push(T),v.push(P))}return v}return yY=l,yY}var vY,I3e;function nqt(){if(I3e)return vY;I3e=1;var t=O2(),e=tqt();function n(r,s){return r&&r.length?e(r,t(s,2)):[]}return vY=n,vY}var rqt=nqt();const F3e=Ii(rqt);function PUe(t,e,n){return e===!0?F3e(t,n):Ei(e)?F3e(t,e):t}function GN(t){"@babel/helpers - typeof";return GN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},GN(t)}var sqt=["ref"];function O3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ng(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?O3e(Object(n),!0).forEach(function(r){zU(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):O3e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function M3e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,FUe(r.key),r)}}function aqt(t,e,n){return M3e(t.prototype,e),M3e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function oqt(t,e,n){return e=KL(e),lqt(t,IUe()?Reflect.construct(e,n,KL(t).constructor):e.apply(t,n))}function lqt(t,e){if(e&&(GN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cqt(t)}function cqt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function IUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IUe=function(){return!!t})()}function KL(t){return KL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},KL(t)}function uqt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bne(t,e)}function Bne(t,e){return Bne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Bne(t,e)}function zU(t,e,n){return e=FUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FUe(t){var e=dqt(t,"string");return GN(e)=="symbol"?e:e+""}function dqt(t,e){if(GN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(GN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fqt(t,e){if(t==null)return{};var n=hqt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hqt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function pqt(t){return t.value}function mqt(t,e){if(Ne.isValidElement(t))return Ne.cloneElement(t,e);if(typeof t=="function")return Ne.createElement(t,e);e.ref;var n=fqt(e,sqt);return Ne.createElement(mue,n)}var R3e=1,N3=function(t){function e(){var n;iqt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=oqt(this,e,[].concat(s)),zU(n,"lastBoundingBox",{width:-1,height:-1}),n}return uqt(e,t),aqt(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>R3e||Math.abs(s.height-this.lastBoundingBox.height)>R3e)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ng({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,a=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,x;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var g=this.getBBoxSnapshot();f={left:((u||0)-g.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var y=this.getBBoxSnapshot();x={top:((d||0)-y.height)/2}}else x=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return ng(ng({},f),x)}},{key:"render",value:function(){var r=this,s=this.props,a=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=ng(ng({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return Ne.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(g){r.wrapperNode=g}},mqt(a,ng(ng({},this.props),{},{payload:PUe(d,u,pqt)})))}}],[{key:"getWithHeight",value:function(r,s){var a=ng(ng({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&rs(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(m.PureComponent);zU(N3,"displayName","Legend");zU(N3,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var wY,L3e;function xqt(){if(L3e)return wY;L3e=1;var t=KT(),e=gue(),n=wf(),r=t?t.isConcatSpreadable:void 0;function s(a){return n(a)||e(a)||!!(r&&a&&a[r])}return wY=s,wY}var CY,D3e;function OUe(){if(D3e)return CY;D3e=1;var t=CUe(),e=xqt();function n(r,s,a,o,l){var c=-1,u=r.length;for(a||(a=e),l||(l=[]);++c<u;){var d=r[c];s>0&&a(d)?s>1?n(d,s-1,a,o,l):t(l,d):o||(l[l.length]=d)}return l}return CY=n,CY}var SY,B3e;function gqt(){if(B3e)return SY;B3e=1;function t(e){return function(n,r,s){for(var a=-1,o=Object(n),l=s(n),c=l.length;c--;){var u=l[e?c:++a];if(r(o[u],u,o)===!1)break}return n}}return SY=t,SY}var NY,$3e;function bqt(){if($3e)return NY;$3e=1;var t=gqt(),e=t();return NY=e,NY}var AY,U3e;function MUe(){if(U3e)return AY;U3e=1;var t=bqt(),e=UU();function n(r,s){return r&&t(r,s,e)}return AY=n,AY}var jY,z3e;function yqt(){if(z3e)return jY;z3e=1;var t=YT();function e(n,r){return function(s,a){if(s==null)return s;if(!t(s))return n(s,a);for(var o=s.length,l=r?o:-1,c=Object(s);(r?l--:++l<o)&&a(c[l],l,c)!==!1;);return s}}return jY=e,jY}var EY,H3e;function wue(){if(H3e)return EY;H3e=1;var t=MUe(),e=yqt(),n=e(t);return EY=n,EY}var _Y,V3e;function RUe(){if(V3e)return _Y;V3e=1;var t=wue(),e=YT();function n(r,s){var a=-1,o=e(r)?Array(r.length):[];return t(r,function(l,c,u){o[++a]=s(l,c,u)}),o}return _Y=n,_Y}var kY,W3e;function vqt(){if(W3e)return kY;W3e=1;function t(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}return kY=t,kY}var TY,q3e;function wqt(){if(q3e)return TY;q3e=1;var t=Cj();function e(n,r){if(n!==r){var s=n!==void 0,a=n===null,o=n===n,l=t(n),c=r!==void 0,u=r===null,d=r===r,f=t(r);if(!u&&!f&&!l&&n>r||l&&c&&d&&!u&&!f||a&&c&&d||!s&&d||!o)return 1;if(!a&&!l&&!f&&n<r||f&&s&&o&&!a&&!l||u&&s&&o||!c&&o||!d)return-1}return 0}return TY=e,TY}var PY,G3e;function Cqt(){if(G3e)return PY;G3e=1;var t=wqt();function e(n,r,s){for(var a=-1,o=n.criteria,l=r.criteria,c=o.length,u=s.length;++a<c;){var d=t(o[a],l[a]);if(d){if(a>=u)return d;var f=s[a];return d*(f=="desc"?-1:1)}}return n.index-r.index}return PY=e,PY}var IY,K3e;function Sqt(){if(K3e)return IY;K3e=1;var t=lue(),e=cue(),n=O2(),r=RUe(),s=vqt(),a=NUe(),o=Cqt(),l=Aj(),c=wf();function u(d,f,x){f.length?f=t(f,function(v){return c(v)?function(C){return e(C,v.length===1?v[0]:v)}:v}):f=[l];var g=-1;f=t(f,a(n));var y=r(d,function(v,C,N){var P=t(f,function(T){return T(v)});return{criteria:P,index:++g,value:v}});return s(y,function(v,C){return o(v,C,x)})}return IY=u,IY}var FY,Y3e;function Nqt(){if(Y3e)return FY;Y3e=1;function t(e,n,r){switch(r.length){case 0:return e.call(n);case 1:return e.call(n,r[0]);case 2:return e.call(n,r[0],r[1]);case 3:return e.call(n,r[0],r[1],r[2])}return e.apply(n,r)}return FY=t,FY}var OY,X3e;function Aqt(){if(X3e)return OY;X3e=1;var t=Nqt(),e=Math.max;function n(r,s,a){return s=e(s===void 0?r.length-1:s,0),function(){for(var o=arguments,l=-1,c=e(o.length-s,0),u=Array(c);++l<c;)u[l]=o[s+l];l=-1;for(var d=Array(s+1);++l<s;)d[l]=o[l];return d[s]=a(u),t(r,this,d)}}return OY=n,OY}var MY,Q3e;function jqt(){if(Q3e)return MY;Q3e=1;function t(e){return function(){return e}}return MY=t,MY}var RY,Z3e;function LUe(){if(Z3e)return RY;Z3e=1;var t=U5(),e=function(){try{var n=t(Object,"defineProperty");return n({},"",{}),n}catch{}}();return RY=e,RY}var LY,J3e;function Eqt(){if(J3e)return LY;J3e=1;var t=jqt(),e=LUe(),n=Aj(),r=e?function(s,a){return e(s,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:n;return LY=r,LY}var DY,e5e;function _qt(){if(e5e)return DY;e5e=1;var t=800,e=16,n=Date.now;function r(s){var a=0,o=0;return function(){var l=n(),c=e-(l-o);if(o=l,c>0){if(++a>=t)return arguments[0]}else a=0;return s.apply(void 0,arguments)}}return DY=r,DY}var BY,t5e;function kqt(){if(t5e)return BY;t5e=1;var t=Eqt(),e=_qt(),n=e(t);return BY=n,BY}var $Y,n5e;function Tqt(){if(n5e)return $Y;n5e=1;var t=Aj(),e=Aqt(),n=kqt();function r(s,a){return n(e(s,a,t),s+"")}return $Y=r,$Y}var UY,r5e;function HU(){if(r5e)return UY;r5e=1;var t=iue(),e=YT(),n=bue(),r=F2();function s(a,o,l){if(!r(l))return!1;var c=typeof o;return(c=="number"?e(l)&&n(o,l.length):c=="string"&&o in l)?t(l[o],a):!1}return UY=s,UY}var zY,s5e;function Pqt(){if(s5e)return zY;s5e=1;var t=OUe(),e=Sqt(),n=Tqt(),r=HU(),s=n(function(a,o){if(a==null)return[];var l=o.length;return l>1&&r(a,o[0],o[1])?o=[]:l>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),e(a,t(o,1),[])});return zY=s,zY}var Iqt=Pqt();const Cue=Ii(Iqt);function H_(t){"@babel/helpers - typeof";return H_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H_(t)}function $ne(){return $ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$ne.apply(this,arguments)}function Fqt(t,e){return Lqt(t)||Rqt(t,e)||Mqt(t,e)||Oqt()}function Oqt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mqt(t,e){if(t){if(typeof t=="string")return i5e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i5e(t,e)}}function i5e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Rqt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Lqt(t){if(Array.isArray(t))return t}function a5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function HY(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?a5e(Object(n),!0).forEach(function(r){Dqt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Dqt(t,e,n){return e=Bqt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bqt(t){var e=$qt(t,"string");return H_(e)=="symbol"?e:e+""}function $qt(t,e){if(H_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(H_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uqt(t){return Array.isArray(t)&&oc(t[0])&&oc(t[1])?t.join(" ~ "):t}var zqt=function(e){var n=e.separator,r=n===void 0?" : ":n,s=e.contentStyle,a=s===void 0?{}:s,o=e.itemStyle,l=o===void 0?{}:o,c=e.labelStyle,u=c===void 0?{}:c,d=e.payload,f=e.formatter,x=e.itemSorter,g=e.wrapperClassName,y=e.labelClassName,v=e.label,C=e.labelFormatter,N=e.accessibilityLayer,P=N===void 0?!1:N,T=function(){if(d&&d.length){var K={padding:0,margin:0},te=(x?Cue(d,x):d).map(function(fe,q){if(fe.type==="none")return null;var se=HY({display:"block",paddingTop:4,paddingBottom:4,color:fe.color||"#000"},l),ae=fe.formatter||f||Uqt,W=fe.value,V=fe.name,ee=W,oe=V;if(ee!=null&&oe!=null){var de=ae(W,V,fe,q,d);if(Array.isArray(de)){var Ce=Fqt(de,2);ee=Ce[0],oe=Ce[1]}else ee=de}return Ne.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(q),style:se},oc(oe)?Ne.createElement("span",{className:"recharts-tooltip-item-name"},oe):null,oc(oe)?Ne.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,Ne.createElement("span",{className:"recharts-tooltip-item-value"},ee),Ne.createElement("span",{className:"recharts-tooltip-item-unit"},fe.unit||""))});return Ne.createElement("ul",{className:"recharts-tooltip-item-list",style:K},te)}return null},M=HY({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),F=HY({margin:0},u),$=!Si(v),L=$?v:"",z=la("recharts-default-tooltip",g),X=la("recharts-tooltip-label",y);$&&C&&d!==void 0&&d!==null&&(L=C(v,d));var ne=P?{role:"status","aria-live":"assertive"}:{};return Ne.createElement("div",$ne({className:z,style:M},ne),Ne.createElement("p",{className:X,style:F},Ne.isValidElement(L)?L:"".concat(L)),T())};function V_(t){"@babel/helpers - typeof";return V_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},V_(t)}function fF(t,e,n){return e=Hqt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hqt(t){var e=Vqt(t,"string");return V_(e)=="symbol"?e:e+""}function Vqt(t,e){if(V_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(V_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var c7="recharts-tooltip-wrapper",Wqt={visibility:"hidden"};function qqt(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return la(c7,fF(fF(fF(fF({},"".concat(c7,"-right"),rs(n)&&e&&rs(e.x)&&n>=e.x),"".concat(c7,"-left"),rs(n)&&e&&rs(e.x)&&n<e.x),"".concat(c7,"-bottom"),rs(r)&&e&&rs(e.y)&&r>=e.y),"".concat(c7,"-top"),rs(r)&&e&&rs(e.y)&&r<e.y))}function o5e(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,s=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,u=t.viewBoxDimension;if(a&&rs(a[r]))return a[r];var d=n[r]-l-s,f=n[r]+s;if(e[r])return o[r]?d:f;if(o[r]){var x=d,g=c[r];return x<g?Math.max(f,c[r]):Math.max(d,c[r])}var y=f+l,v=c[r]+u;return y>v?Math.max(d,c[r]):Math.max(f,c[r])}function Gqt(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function Kqt(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,s=t.position,a=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=o5e({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=o5e({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Gqt({translateX:d,translateY:f,useTranslate3d:l})):u=Wqt,{cssProperties:u,cssClasses:qqt({translateX:d,translateY:f,coordinate:n})}}function KN(t){"@babel/helpers - typeof";return KN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},KN(t)}function l5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function c5e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l5e(Object(n),!0).forEach(function(r){zne(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xqt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,BUe(r.key),r)}}function Qqt(t,e,n){return Xqt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Zqt(t,e,n){return e=YL(e),Jqt(t,DUe()?Reflect.construct(e,n,YL(t).constructor):e.apply(t,n))}function Jqt(t,e){if(e&&(KN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eGt(t)}function eGt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function DUe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DUe=function(){return!!t})()}function YL(t){return YL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},YL(t)}function tGt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Une(t,e)}function Une(t,e){return Une=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Une(t,e)}function zne(t,e,n){return e=BUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BUe(t){var e=nGt(t,"string");return KN(e)=="symbol"?e:e+""}function nGt(t,e){if(KN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(KN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var u5e=1,rGt=function(t){function e(){var n;Yqt(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Zqt(this,e,[].concat(s)),zne(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),zne(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=n.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),n}return tGt(e,t),Qqt(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>u5e||Math.abs(r.height-this.state.lastBoundingBox.height)>u5e)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,a=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,x=s.isAnimationActive,g=s.offset,y=s.position,v=s.reverseDirection,C=s.useTranslate3d,N=s.viewBox,P=s.wrapperStyle,T=Kqt({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:g,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:C,viewBox:N}),M=T.cssClasses,F=T.cssProperties,$=c5e(c5e({transition:x&&a?"transform ".concat(l,"ms ").concat(c):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},P);return Ne.createElement("div",{tabIndex:-1,className:M,style:$,ref:function(z){r.wrapperNode=z}},u)}}])}(m.PureComponent),sGt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Sm={isSsr:sGt(),get:function(e){return Sm[e]},set:function(e,n){if(typeof e=="string")Sm[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(s){Sm[s]=e[s]})}}};function YN(t){"@babel/helpers - typeof";return YN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YN(t)}function d5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function f5e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?d5e(Object(n),!0).forEach(function(r){Sue(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aGt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,UUe(r.key),r)}}function oGt(t,e,n){return aGt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lGt(t,e,n){return e=XL(e),cGt(t,$Ue()?Reflect.construct(e,n||[],XL(t).constructor):e.apply(t,n))}function cGt(t,e){if(e&&(YN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uGt(t)}function uGt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $Ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Ue=function(){return!!t})()}function XL(t){return XL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},XL(t)}function dGt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hne(t,e)}function Hne(t,e){return Hne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Hne(t,e)}function Sue(t,e,n){return e=UUe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UUe(t){var e=fGt(t,"string");return YN(e)=="symbol"?e:e+""}function fGt(t,e){if(YN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(YN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hGt(t){return t.dataKey}function pGt(t,e){return Ne.isValidElement(t)?Ne.cloneElement(t,e):typeof t=="function"?Ne.createElement(t,e):Ne.createElement(zqt,e)}var sm=function(t){function e(){return iGt(this,e),lGt(this,e,arguments)}return dGt(e,t),oGt(e,[{key:"render",value:function(){var r=this,s=this.props,a=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.content,d=s.coordinate,f=s.filterNull,x=s.isAnimationActive,g=s.offset,y=s.payload,v=s.payloadUniqBy,C=s.position,N=s.reverseDirection,P=s.useTranslate3d,T=s.viewBox,M=s.wrapperStyle,F=y??[];f&&F.length&&(F=PUe(y.filter(function(L){return L.value!=null&&(L.hide!==!0||r.props.includeHidden)}),v,hGt));var $=F.length>0;return Ne.createElement(rGt,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:x,active:a,coordinate:d,hasPayload:$,offset:g,position:C,reverseDirection:N,useTranslate3d:P,viewBox:T,wrapperStyle:M},pGt(u,f5e(f5e({},this.props),{},{payload:F})))}}])}(m.PureComponent);Sue(sm,"displayName","Tooltip");Sue(sm,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Sm.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var VY,h5e;function mGt(){if(h5e)return VY;h5e=1;var t=Cx(),e=function(){return t.Date.now()};return VY=e,VY}var WY,p5e;function xGt(){if(p5e)return WY;p5e=1;var t=/\s/;function e(n){for(var r=n.length;r--&&t.test(n.charAt(r)););return r}return WY=e,WY}var qY,m5e;function gGt(){if(m5e)return qY;m5e=1;var t=xGt(),e=/^\s+/;function n(r){return r&&r.slice(0,t(r)+1).replace(e,"")}return qY=n,qY}var GY,x5e;function zUe(){if(x5e)return GY;x5e=1;var t=gGt(),e=F2(),n=Cj(),r=NaN,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(n(u))return r;if(e(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=e(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=t(u);var f=a.test(u);return f||o.test(u)?l(u.slice(2),f?2:8):s.test(u)?r:+u}return GY=c,GY}var KY,g5e;function HUe(){if(g5e)return KY;g5e=1;var t=F2(),e=mGt(),n=zUe(),r="Expected a function",s=Math.max,a=Math.min;function o(l,c,u){var d,f,x,g,y,v,C=0,N=!1,P=!1,T=!0;if(typeof l!="function")throw new TypeError(r);c=n(c)||0,t(u)&&(N=!!u.leading,P="maxWait"in u,x=P?s(n(u.maxWait)||0,c):x,T="trailing"in u?!!u.trailing:T);function M(te){var fe=d,q=f;return d=f=void 0,C=te,g=l.apply(q,fe),g}function F(te){return C=te,y=setTimeout(z,c),N?M(te):g}function $(te){var fe=te-v,q=te-C,se=c-fe;return P?a(se,x-q):se}function L(te){var fe=te-v,q=te-C;return v===void 0||fe>=c||fe<0||P&&q>=x}function z(){var te=e();if(L(te))return X(te);y=setTimeout(z,$(te))}function X(te){return y=void 0,T&&d?M(te):(d=f=void 0,g)}function ne(){y!==void 0&&clearTimeout(y),C=0,d=v=f=y=void 0}function J(){return y===void 0?g:X(e())}function K(){var te=e(),fe=L(te);if(d=arguments,f=this,v=te,fe){if(y===void 0)return F(v);if(P)return clearTimeout(y),y=setTimeout(z,c),M(v)}return y===void 0&&(y=setTimeout(z,c)),g}return K.cancel=ne,K.flush=J,K}return KY=o,KY}var YY,b5e;function bGt(){if(b5e)return YY;b5e=1;var t=HUe(),e=F2(),n="Expected a function";function r(s,a,o){var l=!0,c=!0;if(typeof s!="function")throw new TypeError(n);return e(o)&&(l="leading"in o?!!o.leading:l,c="trailing"in o?!!o.trailing:c),t(s,a,{leading:l,maxWait:a,trailing:c})}return YY=r,YY}var yGt=bGt();const VUe=Ii(yGt);function W_(t){"@babel/helpers - typeof";return W_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W_(t)}function y5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function hF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?y5e(Object(n),!0).forEach(function(r){vGt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vGt(t,e,n){return e=wGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wGt(t){var e=CGt(t,"string");return W_(e)=="symbol"?e:e+""}function CGt(t,e){if(W_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(W_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function SGt(t,e){return EGt(t)||jGt(t,e)||AGt(t,e)||NGt()}function NGt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AGt(t,e){if(t){if(typeof t=="string")return v5e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v5e(t,e)}}function v5e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function jGt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function EGt(t){if(Array.isArray(t))return t}var WUe=m.forwardRef(function(t,e){var n=t.aspect,r=t.initialDimension,s=r===void 0?{width:-1,height:-1}:r,a=t.width,o=a===void 0?"100%":a,l=t.height,c=l===void 0?"100%":l,u=t.minWidth,d=u===void 0?0:u,f=t.minHeight,x=t.maxHeight,g=t.children,y=t.debounce,v=y===void 0?0:y,C=t.id,N=t.className,P=t.onResize,T=t.style,M=T===void 0?{}:T,F=m.useRef(null),$=m.useRef();$.current=P,m.useImperativeHandle(e,function(){return Object.defineProperty(F.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),F.current},configurable:!0})});var L=m.useState({containerWidth:s.width,containerHeight:s.height}),z=SGt(L,2),X=z[0],ne=z[1],J=m.useCallback(function(te,fe){ne(function(q){var se=Math.round(te),ae=Math.round(fe);return q.containerWidth===se&&q.containerHeight===ae?q:{containerWidth:se,containerHeight:ae}})},[]);m.useEffect(function(){var te=function(V){var ee,oe=V[0].contentRect,de=oe.width,Ce=oe.height;J(de,Ce),(ee=$.current)===null||ee===void 0||ee.call($,de,Ce)};v>0&&(te=VUe(te,v,{trailing:!0,leading:!1}));var fe=new ResizeObserver(te),q=F.current.getBoundingClientRect(),se=q.width,ae=q.height;return J(se,ae),fe.observe(F.current),function(){fe.disconnect()}},[J,v]);var K=m.useMemo(function(){var te=X.containerWidth,fe=X.containerHeight;if(te<0||fe<0)return null;l1(Cw(o)||Cw(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),l1(!n||n>0,"The aspect(%s) must be greater than zero.",n);var q=Cw(o)?te:o,se=Cw(c)?fe:c;n&&n>0&&(q?se=q/n:se&&(q=se*n),x&&se>x&&(se=x)),l1(q>0||se>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,q,se,o,c,d,f,n);var ae=!Array.isArray(g)&&o1(g.type).endsWith("Chart");return Ne.Children.map(g,function(W){return Ne.isValidElement(W)?m.cloneElement(W,hF({width:q,height:se},ae?{style:hF({height:"100%",width:"100%",maxHeight:se,maxWidth:q},W.props.style)}:{})):W})},[n,g,c,x,f,d,X,o]);return Ne.createElement("div",{id:C?"".concat(C):void 0,className:la("recharts-responsive-container",N),style:hF(hF({},M),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:x}),ref:F},K)}),Nue=function(e){return null};Nue.displayName="Cell";function q_(t){"@babel/helpers - typeof";return q_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q_(t)}function w5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vne(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?w5e(Object(n),!0).forEach(function(r){_Gt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w5e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _Gt(t,e,n){return e=kGt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kGt(t){var e=TGt(t,"string");return q_(e)=="symbol"?e:e+""}function TGt(t,e){if(q_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(q_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vC={widthCache:{},cacheCount:0},PGt=2e3,IGt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},C5e="recharts_measurement_span";function FGt(t){var e=Vne({},t);return Object.keys(e).forEach(function(n){e[n]||delete e[n]}),e}var R9=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Sm.isSsr)return{width:0,height:0};var r=FGt(n),s=JSON.stringify({text:e,copyStyle:r});if(vC.widthCache[s])return vC.widthCache[s];try{var a=document.getElementById(C5e);a||(a=document.createElement("span"),a.setAttribute("id",C5e),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=Vne(Vne({},IGt),r);Object.assign(a.style,o),a.textContent="".concat(e);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return vC.widthCache[s]=c,++vC.cacheCount>PGt&&(vC.cacheCount=0,vC.widthCache={}),c}catch{return{width:0,height:0}}},OGt=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function G_(t){"@babel/helpers - typeof";return G_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G_(t)}function QL(t,e){return DGt(t)||LGt(t,e)||RGt(t,e)||MGt()}function MGt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RGt(t,e){if(t){if(typeof t=="string")return S5e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S5e(t,e)}}function S5e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function LGt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function DGt(t){if(Array.isArray(t))return t}function BGt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function N5e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,UGt(r.key),r)}}function $Gt(t,e,n){return N5e(t.prototype,e),N5e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function UGt(t){var e=zGt(t,"string");return G_(e)=="symbol"?e:e+""}function zGt(t,e){if(G_(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(G_(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var A5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,j5e=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,HGt=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,VGt=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,qUe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},WGt=Object.keys(qUe),o4="NaN";function qGt(t,e){return t*qUe[e]}var pF=function(){function t(e,n){BGt(this,t),this.num=e,this.unit=n,this.num=e,this.unit=n,Number.isNaN(e)&&(this.unit=""),n!==""&&!HGt.test(n)&&(this.num=NaN,this.unit=""),WGt.includes(n)&&(this.num=qGt(e,n),this.unit="px")}return $Gt(t,[{key:"add",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,s=(r=VGt.exec(n))!==null&&r!==void 0?r:[],a=QL(s,3),o=a[1],l=a[2];return new t(parseFloat(o),l??"")}}])}();function GUe(t){if(t.includes(o4))return o4;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=A5e.exec(e))!==null&&n!==void 0?n:[],s=QL(r,4),a=s[1],o=s[2],l=s[3],c=pF.parse(a??""),u=pF.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return o4;e=e.replace(A5e,d.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,x=(f=j5e.exec(e))!==null&&f!==void 0?f:[],g=QL(x,4),y=g[1],v=g[2],C=g[3],N=pF.parse(y??""),P=pF.parse(C??""),T=v==="+"?N.add(P):N.subtract(P);if(T.isNaN())return o4;e=e.replace(j5e,T.toString())}return e}var E5e=/\(([^()]*)\)/;function GGt(t){for(var e=t;e.includes("(");){var n=E5e.exec(e),r=QL(n,2),s=r[1];e=e.replace(E5e,GUe(s))}return e}function KGt(t){var e=t.replace(/\s+/g,"");return e=GGt(e),e=GUe(e),e}function YGt(t){try{return KGt(t)}catch{return o4}}function XY(t){var e=YGt(t.slice(5,-1));return e===o4?"":e}var XGt=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],QGt=["dx","dy","angle","className","breakAll"];function Wne(){return Wne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wne.apply(this,arguments)}function _5e(t,e){if(t==null)return{};var n=ZGt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ZGt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function k5e(t,e){return nKt(t)||tKt(t,e)||eKt(t,e)||JGt()}function JGt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eKt(t,e){if(t){if(typeof t=="string")return T5e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T5e(t,e)}}function T5e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function tKt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function nKt(t){if(Array.isArray(t))return t}var KUe=/[ \f\n\r\t\v\u2028\u2029]+/,YUe=function(e){var n=e.children,r=e.breakAll,s=e.style;try{var a=[];Si(n)||(r?a=n.toString().split(""):a=n.toString().split(KUe));var o=a.map(function(c){return{word:c,width:R9(c,s).width}}),l=r?0:R9(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},rKt=function(e,n,r,s,a){var o=e.maxLines,l=e.children,c=e.style,u=e.breakAll,d=rs(o),f=l,x=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return q.reduce(function(se,ae){var W=ae.word,V=ae.width,ee=se[se.length-1];if(ee&&(s==null||a||ee.width+V+r<Number(s)))ee.words.push(W),ee.width+=V+r;else{var oe={words:[W],width:V};se.push(oe)}return se},[])},g=x(n),y=function(q){return q.reduce(function(se,ae){return se.width>ae.width?se:ae})};if(!d)return g;for(var v="…",C=function(q){var se=f.slice(0,q),ae=YUe({breakAll:u,style:c,children:se+v}).wordsWithComputedWidth,W=x(ae),V=W.length>o||y(W).width>Number(s);return[V,W]},N=0,P=f.length-1,T=0,M;N<=P&&T<=f.length-1;){var F=Math.floor((N+P)/2),$=F-1,L=C($),z=k5e(L,2),X=z[0],ne=z[1],J=C(F),K=k5e(J,1),te=K[0];if(!X&&!te&&(N=F+1),X&&te&&(P=F-1),!X&&te){M=ne;break}T++}return M||g},P5e=function(e){var n=Si(e)?[]:e.toString().split(KUe);return[{words:n}]},sKt=function(e){var n=e.width,r=e.scaleToFit,s=e.children,a=e.style,o=e.breakAll,l=e.maxLines;if((n||r)&&!Sm.isSsr){var c,u,d=YUe({breakAll:o,children:s,style:a});if(d){var f=d.wordsWithComputedWidth,x=d.spaceWidth;c=f,u=x}else return P5e(s);return rKt({breakAll:o,children:s,maxLines:l,style:a},c,u,n,r)}return P5e(s)},I5e="#808080",ZL=function(e){var n=e.x,r=n===void 0?0:n,s=e.y,a=s===void 0?0:s,o=e.lineHeight,l=o===void 0?"1em":o,c=e.capHeight,u=c===void 0?"0.71em":c,d=e.scaleToFit,f=d===void 0?!1:d,x=e.textAnchor,g=x===void 0?"start":x,y=e.verticalAnchor,v=y===void 0?"end":y,C=e.fill,N=C===void 0?I5e:C,P=_5e(e,XGt),T=m.useMemo(function(){return sKt({breakAll:P.breakAll,children:P.children,maxLines:P.maxLines,scaleToFit:f,style:P.style,width:P.width})},[P.breakAll,P.children,P.maxLines,f,P.style,P.width]),M=P.dx,F=P.dy,$=P.angle,L=P.className,z=P.breakAll,X=_5e(P,QGt);if(!oc(r)||!oc(a))return null;var ne=r+(rs(M)?M:0),J=a+(rs(F)?F:0),K;switch(v){case"start":K=XY("calc(".concat(u,")"));break;case"middle":K=XY("calc(".concat((T.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:K=XY("calc(".concat(T.length-1," * -").concat(l,")"));break}var te=[];if(f){var fe=T[0].width,q=P.width;te.push("scale(".concat((rs(q)?q/fe:1)/fe,")"))}return $&&te.push("rotate(".concat($,", ").concat(ne,", ").concat(J,")")),te.length&&(X.transform=te.join(" ")),Ne.createElement("text",Wne({},Ci(X,!0),{x:ne,y:J,className:la("recharts-text",L),textAnchor:g,fill:N.includes("url")?I5e:N}),T.map(function(se,ae){var W=se.words.join(z?"":" ");return Ne.createElement("tspan",{x:ne,dy:ae===0?K:l,key:"".concat(W,"-").concat(ae)},W)}))};function Hy(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function iKt(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Aue(t){let e,n,r;t.length!==2?(e=Hy,n=(l,c)=>Hy(t(l),c),r=(l,c)=>t(l)-c):(e=t===Hy||t===iKt?t:aKt,n=t,r=t);function s(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){if(u<d){if(e(c,c)!==0)return d;do{const f=u+d>>>1;n(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function o(l,c,u=0,d=l.length){const f=s(l,c,u,d-1);return f>u&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:a}}function aKt(){return 0}function XUe(t){return t===null?NaN:+t}function*oKt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const lKt=Aue(Hy),XT=lKt.right;Aue(XUe).center;class F5e extends Map{constructor(e,n=dKt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,s]of e)this.set(r,s)}get(e){return super.get(O5e(this,e))}has(e){return super.has(O5e(this,e))}set(e,n){return super.set(cKt(this,e),n)}delete(e){return super.delete(uKt(this,e))}}function O5e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function cKt({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function uKt({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function dKt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function fKt(t=Hy){if(t===Hy)return QUe;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function QUe(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const hKt=Math.sqrt(50),pKt=Math.sqrt(10),mKt=Math.sqrt(2);function JL(t,e,n){const r=(e-t)/Math.max(0,n),s=Math.floor(Math.log10(r)),a=r/Math.pow(10,s),o=a>=hKt?10:a>=pKt?5:a>=mKt?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(t*u),c=Math.round(e*u),l/u<t&&++l,c/u>e&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(t/u),c=Math.round(e/u),l*u<t&&++l,c*u>e&&--c),c<l&&.5<=n&&n<2?JL(t,e,n*2):[l,c,u]}function qne(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[s,a,o]=r?JL(e,t,n):JL(t,e,n);if(!(a>=s))return[];const l=a-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u<l;++u)c[u]=(a-u)/-o;else for(let u=0;u<l;++u)c[u]=(a-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(s+u)/-o;else for(let u=0;u<l;++u)c[u]=(s+u)*o;return c}function Gne(t,e,n){return e=+e,t=+t,n=+n,JL(t,e,n)[2]}function Kne(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?Gne(e,t,n):Gne(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function M5e(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function R5e(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function ZUe(t,e,n=0,r=1/0,s){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(s=s===void 0?QUe:fKt(s);r>n;){if(r-n>600){const c=r-n+1,u=e-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),x=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),g=Math.max(n,Math.floor(e-u*f/c+x)),y=Math.min(r,Math.floor(e+(c-u)*f/c+x));ZUe(t,e,g,y,s)}const a=t[e];let o=n,l=r;for(u7(t,n,e),s(t[r],a)>0&&u7(t,n,r);o<l;){for(u7(t,o,l),++o,--l;s(t[o],a)<0;)++o;for(;s(t[l],a)>0;)--l}s(t[n],a)===0?u7(t,n,l):(++l,u7(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function u7(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function xKt(t,e,n){if(t=Float64Array.from(oKt(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return R5e(t);if(e>=1)return M5e(t);var r,s=(r-1)*e,a=Math.floor(s),o=M5e(ZUe(t,a).subarray(0,a+1)),l=R5e(t.subarray(a+1));return o+(l-o)*(s-a)}}function gKt(t,e,n=XUe){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,s=(r-1)*e,a=Math.floor(s),o=+n(t[a],a,t),l=+n(t[a+1],a+1,t);return o+(l-o)*(s-a)}}function bKt(t,e,n){t=+t,e=+e,n=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((e-t)/n))|0,a=new Array(s);++r<s;)a[r]=t+r*n;return a}function Sp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function H1(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Yne=Symbol("implicit");function jue(){var t=new F5e,e=[],n=[],r=Yne;function s(a){let o=t.get(a);if(o===void 0){if(r!==Yne)return r;t.set(a,o=e.push(a)-1)}return n[o%n.length]}return s.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new F5e;for(const o of a)t.has(o)||t.set(o,e.push(o)-1);return s},s.range=function(a){return arguments.length?(n=Array.from(a),s):n.slice()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.copy=function(){return jue(e,n).unknown(r)},Sp.apply(s,arguments),s}function K_(){var t=jue().unknown(void 0),e=t.domain,n=t.range,r=0,s=1,a,o,l=!1,c=0,u=0,d=.5;delete t.unknown;function f(){var x=e().length,g=s<r,y=g?s:r,v=g?r:s;a=(v-y)/Math.max(1,x-c+u*2),l&&(a=Math.floor(a)),y+=(v-y-a*(x-c))*d,o=a*(1-c),l&&(y=Math.round(y),o=Math.round(o));var C=bKt(x).map(function(N){return y+a*N});return n(g?C.reverse():C)}return t.domain=function(x){return arguments.length?(e(x),f()):e()},t.range=function(x){return arguments.length?([r,s]=x,r=+r,s=+s,f()):[r,s]},t.rangeRound=function(x){return[r,s]=x,r=+r,s=+s,l=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(x){return arguments.length?(l=!!x,f()):l},t.padding=function(x){return arguments.length?(c=Math.min(1,u=+x),f()):c},t.paddingInner=function(x){return arguments.length?(c=Math.min(1,x),f()):c},t.paddingOuter=function(x){return arguments.length?(u=+x,f()):u},t.align=function(x){return arguments.length?(d=Math.max(0,Math.min(1,x)),f()):d},t.copy=function(){return K_(e(),[r,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Sp.apply(f(),arguments)}function JUe(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return JUe(e())},t}function L9(){return JUe(K_.apply(null,arguments).paddingInner(1))}function Eue(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function eze(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function QT(){}var Y_=.7,eD=1/Y_,L4="\\s*([+-]?\\d+)\\s*",X_="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Q0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yKt=/^#([0-9a-f]{3,8})$/,vKt=new RegExp(`^rgb\\(${L4},${L4},${L4}\\)$`),wKt=new RegExp(`^rgb\\(${Q0},${Q0},${Q0}\\)$`),CKt=new RegExp(`^rgba\\(${L4},${L4},${L4},${X_}\\)$`),SKt=new RegExp(`^rgba\\(${Q0},${Q0},${Q0},${X_}\\)$`),NKt=new RegExp(`^hsl\\(${X_},${Q0},${Q0}\\)$`),AKt=new RegExp(`^hsla\\(${X_},${Q0},${Q0},${X_}\\)$`),L5e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Eue(QT,Q_,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:D5e,formatHex:D5e,formatHex8:jKt,formatHsl:EKt,formatRgb:B5e,toString:B5e});function D5e(){return this.rgb().formatHex()}function jKt(){return this.rgb().formatHex8()}function EKt(){return tze(this).formatHsl()}function B5e(){return this.rgb().formatRgb()}function Q_(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=yKt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?$5e(e):n===3?new of(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?mF(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?mF(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=vKt.exec(t))?new of(e[1],e[2],e[3],1):(e=wKt.exec(t))?new of(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=CKt.exec(t))?mF(e[1],e[2],e[3],e[4]):(e=SKt.exec(t))?mF(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=NKt.exec(t))?H5e(e[1],e[2]/100,e[3]/100,1):(e=AKt.exec(t))?H5e(e[1],e[2]/100,e[3]/100,e[4]):L5e.hasOwnProperty(t)?$5e(L5e[t]):t==="transparent"?new of(NaN,NaN,NaN,0):null}function $5e(t){return new of(t>>16&255,t>>8&255,t&255,1)}function mF(t,e,n,r){return r<=0&&(t=e=n=NaN),new of(t,e,n,r)}function _Kt(t){return t instanceof QT||(t=Q_(t)),t?(t=t.rgb(),new of(t.r,t.g,t.b,t.opacity)):new of}function Xne(t,e,n,r){return arguments.length===1?_Kt(t):new of(t,e,n,r??1)}function of(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Eue(of,Xne,eze(QT,{brighter(t){return t=t==null?eD:Math.pow(eD,t),new of(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Y_:Math.pow(Y_,t),new of(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new of(A3(this.r),A3(this.g),A3(this.b),tD(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:U5e,formatHex:U5e,formatHex8:kKt,formatRgb:z5e,toString:z5e}));function U5e(){return`#${Sw(this.r)}${Sw(this.g)}${Sw(this.b)}`}function kKt(){return`#${Sw(this.r)}${Sw(this.g)}${Sw(this.b)}${Sw((isNaN(this.opacity)?1:this.opacity)*255)}`}function z5e(){const t=tD(this.opacity);return`${t===1?"rgb(":"rgba("}${A3(this.r)}, ${A3(this.g)}, ${A3(this.b)}${t===1?")":`, ${t})`}`}function tD(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function A3(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Sw(t){return t=A3(t),(t<16?"0":"")+t.toString(16)}function H5e(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new hm(t,e,n,r)}function tze(t){if(t instanceof hm)return new hm(t.h,t.s,t.l,t.opacity);if(t instanceof QT||(t=Q_(t)),!t)return new hm;if(t instanceof hm)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,l=a-s,c=(a+s)/2;return l?(e===a?o=(n-r)/l+(n<r)*6:n===a?o=(r-e)/l+2:o=(e-n)/l+4,l/=c<.5?a+s:2-a-s,o*=60):l=c>0&&c<1?0:o,new hm(o,l,c,t.opacity)}function TKt(t,e,n,r){return arguments.length===1?tze(t):new hm(t,e,n,r??1)}function hm(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Eue(hm,TKt,eze(QT,{brighter(t){return t=t==null?eD:Math.pow(eD,t),new hm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Y_:Math.pow(Y_,t),new hm(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new of(QY(t>=240?t-240:t+120,s,r),QY(t,s,r),QY(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new hm(V5e(this.h),xF(this.s),xF(this.l),tD(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=tD(this.opacity);return`${t===1?"hsl(":"hsla("}${V5e(this.h)}, ${xF(this.s)*100}%, ${xF(this.l)*100}%${t===1?")":`, ${t})`}`}}));function V5e(t){return t=(t||0)%360,t<0?t+360:t}function xF(t){return Math.max(0,Math.min(1,t||0))}function QY(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const _ue=t=>()=>t;function PKt(t,e){return function(n){return t+n*e}}function IKt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function FKt(t){return(t=+t)==1?nze:function(e,n){return n-e?IKt(e,n,t):_ue(isNaN(e)?n:e)}}function nze(t,e){var n=e-t;return n?PKt(t,n):_ue(isNaN(t)?e:t)}const W5e=function t(e){var n=FKt(e);function r(s,a){var o=n((s=Xne(s)).r,(a=Xne(a)).r),l=n(s.g,a.g),c=n(s.b,a.b),u=nze(s.opacity,a.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=t,r}(1);function OKt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(a){for(s=0;s<n;++s)r[s]=t[s]*(1-a)+e[s]*a;return r}}function MKt(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function RKt(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),a=new Array(n),o;for(o=0;o<r;++o)s[o]=jj(t[o],e[o]);for(;o<n;++o)a[o]=e[o];return function(l){for(o=0;o<r;++o)a[o]=s[o](l);return a}}function LKt(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function nD(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function DKt(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=jj(t[s],e[s]):r[s]=e[s];return function(a){for(s in n)r[s]=n[s](a);return r}}var Qne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ZY=new RegExp(Qne.source,"g");function BKt(t){return function(){return t}}function $Kt(t){return function(e){return t(e)+""}}function UKt(t,e){var n=Qne.lastIndex=ZY.lastIndex=0,r,s,a,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=Qne.exec(t))&&(s=ZY.exec(e));)(a=s.index)>n&&(a=e.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:nD(r,s)})),n=ZY.lastIndex;return n<e.length&&(a=e.slice(n),l[o]?l[o]+=a:l[++o]=a),l.length<2?c[0]?$Kt(c[0].x):BKt(e):(e=c.length,function(u){for(var d=0,f;d<e;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function jj(t,e){var n=typeof e,r;return e==null||n==="boolean"?_ue(e):(n==="number"?nD:n==="string"?(r=Q_(e))?(e=r,W5e):UKt:e instanceof Q_?W5e:e instanceof Date?LKt:MKt(e)?OKt:Array.isArray(e)?RKt:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?DKt:nD)(t,e)}function kue(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function zKt(t,e){e===void 0&&(e=t,t=jj);for(var n=0,r=e.length-1,s=e[0],a=new Array(r<0?0:r);n<r;)a[n]=t(s,s=e[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return a[l](o-l)}}function HKt(t){return function(){return t}}function rD(t){return+t}var q5e=[0,1];function md(t){return t}function Zne(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:HKt(isNaN(e)?NaN:.5)}function VKt(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function WKt(t,e,n){var r=t[0],s=t[1],a=e[0],o=e[1];return s<r?(r=Zne(s,r),a=n(o,a)):(r=Zne(r,s),a=n(a,o)),function(l){return a(r(l))}}function qKt(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)s[o]=Zne(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(l){var c=XT(t,l,1,r)-1;return a[c](s[c](l))}}function ZT(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function VU(){var t=q5e,e=q5e,n=jj,r,s,a,o=md,l,c,u;function d(){var x=Math.min(t.length,e.length);return o!==md&&(o=VKt(t[0],t[x-1])),l=x>2?qKt:WKt,c=u=null,f}function f(x){return x==null||isNaN(x=+x)?a:(c||(c=l(t.map(r),e,n)))(r(o(x)))}return f.invert=function(x){return o(s((u||(u=l(e,t.map(r),nD)))(x)))},f.domain=function(x){return arguments.length?(t=Array.from(x,rD),d()):t.slice()},f.range=function(x){return arguments.length?(e=Array.from(x),d()):e.slice()},f.rangeRound=function(x){return e=Array.from(x),n=kue,d()},f.clamp=function(x){return arguments.length?(o=x?!0:md,d()):o!==md},f.interpolate=function(x){return arguments.length?(n=x,d()):n},f.unknown=function(x){return arguments.length?(a=x,f):a},function(x,g){return r=x,s=g,d()}}function Tue(){return VU()(md,md)}function GKt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function sD(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function XN(t){return t=sD(Math.abs(t)),t?t[1]:NaN}function KKt(t,e){return function(n,r){for(var s=n.length,a=[],o=0,l=t[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=t[o=(o+1)%t.length];return a.reverse().join(e)}}function YKt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var XKt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Z_(t){if(!(e=XKt.exec(t)))throw new Error("invalid format: "+t);var e;return new Pue({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Z_.prototype=Pue.prototype;function Pue(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Pue.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function QKt(t){e:for(var e=t.length,n=1,r=-1,s;n<e;++n)switch(t[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(s+1):t}var rze;function ZKt(t,e){var n=sD(t,e);if(!n)return t+"";var r=n[0],s=n[1],a=s-(rze=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+sD(t,Math.max(0,e+a-1))[0]}function G5e(t,e){var n=sD(t,e);if(!n)return t+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const K5e={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:GKt,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>G5e(t*100,e),r:G5e,s:ZKt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Y5e(t){return t}var X5e=Array.prototype.map,Q5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function JKt(t){var e=t.grouping===void 0||t.thousands===void 0?Y5e:KKt(X5e.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?Y5e:YKt(X5e.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Z_(f);var x=f.fill,g=f.align,y=f.sign,v=f.symbol,C=f.zero,N=f.width,P=f.comma,T=f.precision,M=f.trim,F=f.type;F==="n"?(P=!0,F="g"):K5e[F]||(T===void 0&&(T=12),M=!0,F="g"),(C||x==="0"&&g==="=")&&(C=!0,x="0",g="=");var $=v==="$"?n:v==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",L=v==="$"?r:/[%p]/.test(F)?o:"",z=K5e[F],X=/[defgprs%]/.test(F);T=T===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,T)):Math.max(0,Math.min(20,T));function ne(J){var K=$,te=L,fe,q,se;if(F==="c")te=z(J)+te,J="";else{J=+J;var ae=J<0||1/J<0;if(J=isNaN(J)?c:z(Math.abs(J),T),M&&(J=QKt(J)),ae&&+J==0&&y!=="+"&&(ae=!1),K=(ae?y==="("?y:l:y==="-"||y==="("?"":y)+K,te=(F==="s"?Q5e[8+rze/3]:"")+te+(ae&&y==="("?")":""),X){for(fe=-1,q=J.length;++fe<q;)if(se=J.charCodeAt(fe),48>se||se>57){te=(se===46?s+J.slice(fe+1):J.slice(fe))+te,J=J.slice(0,fe);break}}}P&&!C&&(J=e(J,1/0));var W=K.length+J.length+te.length,V=W<N?new Array(N-W+1).join(x):"";switch(P&&C&&(J=e(V+J,V.length?N-te.length:1/0),V=""),g){case"<":J=K+J+te+V;break;case"=":J=K+V+J+te;break;case"^":J=V.slice(0,W=V.length>>1)+K+J+te+V.slice(W);break;default:J=V+K+J+te;break}return a(J)}return ne.toString=function(){return f+""},ne}function d(f,x){var g=u((f=Z_(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(XN(x)/3)))*3,v=Math.pow(10,-y),C=Q5e[8+y/3];return function(N){return g(v*N)+C}}return{format:u,formatPrefix:d}}var gF,Iue,sze;eYt({thousands:",",grouping:[3],currency:["$",""]});function eYt(t){return gF=JKt(t),Iue=gF.format,sze=gF.formatPrefix,gF}function tYt(t){return Math.max(0,-XN(Math.abs(t)))}function nYt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(XN(e)/3)))*3-XN(Math.abs(t)))}function rYt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,XN(e)-XN(t))+1}function ize(t,e,n,r){var s=Kne(t,e,n),a;switch(r=Z_(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=nYt(s,o))&&(r.precision=a),sze(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=rYt(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=tYt(s))&&(r.precision=a-(r.type==="%")*2);break}}return Iue(r)}function M2(t){var e=t.domain;return t.ticks=function(n){var r=e();return qne(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return ize(s[0],s[s.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),s=0,a=r.length-1,o=r[s],l=r[a],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=s,s=a,a=u);d-- >0;){if(u=Gne(o,l,n),u===c)return r[s]=o,r[a]=l,e(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return t},t}function iD(){var t=Tue();return t.copy=function(){return ZT(t,iD())},Sp.apply(t,arguments),M2(t)}function aze(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,rD),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return aze(t).unknown(e)},t=arguments.length?Array.from(t,rD):[0,1],M2(n)}function oze(t,e){t=t.slice();var n=0,r=t.length-1,s=t[n],a=t[r],o;return a<s&&(o=n,n=r,r=o,o=s,s=a,a=o),t[n]=e.floor(s),t[r]=e.ceil(a),t}function Z5e(t){return Math.log(t)}function J5e(t){return Math.exp(t)}function sYt(t){return-Math.log(-t)}function iYt(t){return-Math.exp(-t)}function aYt(t){return isFinite(t)?+("1e"+t):t<0?0:t}function oYt(t){return t===10?aYt:t===Math.E?Math.exp:e=>Math.pow(t,e)}function lYt(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function e6e(t){return(e,n)=>-t(-e,n)}function Fue(t){const e=t(Z5e,J5e),n=e.domain;let r=10,s,a;function o(){return s=lYt(r),a=oYt(r),n()[0]<0?(s=e6e(s),a=e6e(a),t(sYt,iYt)):t(Z5e,J5e),e}return e.base=function(l){return arguments.length?(r=+l,o()):r},e.domain=function(l){return arguments.length?(n(l),o()):n()},e.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let x=s(u),g=s(d),y,v;const C=l==null?10:+l;let N=[];if(!(r%1)&&g-x<C){if(x=Math.floor(x),g=Math.ceil(g),u>0){for(;x<=g;++x)for(y=1;y<r;++y)if(v=x<0?y/a(-x):y*a(x),!(v<u)){if(v>d)break;N.push(v)}}else for(;x<=g;++x)for(y=r-1;y>=1;--y)if(v=x>0?y/a(-x):y*a(x),!(v<u)){if(v>d)break;N.push(v)}N.length*2<C&&(N=qne(u,d,C))}else N=qne(x,g,Math.min(g-x,C)).map(a);return f?N.reverse():N},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Z_(c)).precision==null&&(c.trim=!0),c=Iue(c)),l===1/0)return c;const u=Math.max(1,r*l/e.ticks().length);return d=>{let f=d/a(Math.round(s(d)));return f*r<r-.5&&(f*=r),f<=u?c(d):""}},e.nice=()=>n(oze(n(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),e}function lze(){const t=Fue(VU()).domain([1,10]);return t.copy=()=>ZT(t,lze()).base(t.base()),Sp.apply(t,arguments),t}function t6e(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function n6e(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Oue(t){var e=1,n=t(t6e(e),n6e(e));return n.constant=function(r){return arguments.length?t(t6e(e=+r),n6e(e)):e},M2(n)}function cze(){var t=Oue(VU());return t.copy=function(){return ZT(t,cze()).constant(t.constant())},Sp.apply(t,arguments)}function r6e(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function cYt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function uYt(t){return t<0?-t*t:t*t}function Mue(t){var e=t(md,md),n=1;function r(){return n===1?t(md,md):n===.5?t(cYt,uYt):t(r6e(n),r6e(1/n))}return e.exponent=function(s){return arguments.length?(n=+s,r()):n},M2(e)}function Rue(){var t=Mue(VU());return t.copy=function(){return ZT(t,Rue()).exponent(t.exponent())},Sp.apply(t,arguments),t}function dYt(){return Rue.apply(null,arguments).exponent(.5)}function s6e(t){return Math.sign(t)*t*t}function fYt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function uze(){var t=Tue(),e=[0,1],n=!1,r;function s(a){var o=fYt(t(a));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(a){return t.invert(s6e(a))},s.domain=function(a){return arguments.length?(t.domain(a),s):t.domain()},s.range=function(a){return arguments.length?(t.range((e=Array.from(a,rD)).map(s6e)),s):e.slice()},s.rangeRound=function(a){return s.range(a).round(!0)},s.round=function(a){return arguments.length?(n=!!a,s):n},s.clamp=function(a){return arguments.length?(t.clamp(a),s):t.clamp()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.copy=function(){return uze(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Sp.apply(s,arguments),M2(s)}function dze(){var t=[],e=[],n=[],r;function s(){var o=0,l=Math.max(1,e.length);for(n=new Array(l-1);++o<l;)n[o-1]=gKt(t,o/l);return a}function a(o){return o==null||isNaN(o=+o)?r:e[XT(n,o)]}return a.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(Hy),s()},a.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},a.unknown=function(o){return arguments.length?(r=o,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return dze().domain(t).range(e).unknown(r)},Sp.apply(a,arguments)}function fze(){var t=0,e=1,n=1,r=[.5],s=[0,1],a;function o(c){return c!=null&&c<=c?s[XT(r,c,0,n)]:a}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(n=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[t,r[0]]:u>=n?[r[n-1],e]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return fze().domain([t,e]).range(s).unknown(a)},Sp.apply(M2(o),arguments)}function hze(){var t=[.5],e=[0,1],n,r=1;function s(a){return a!=null&&a<=a?e[XT(t,a,0,r)]:n}return s.domain=function(a){return arguments.length?(t=Array.from(a),r=Math.min(t.length,e.length-1),s):t.slice()},s.range=function(a){return arguments.length?(e=Array.from(a),r=Math.min(t.length,e.length-1),s):e.slice()},s.invertExtent=function(a){var o=e.indexOf(a);return[t[o-1],t[o]]},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return hze().domain(t).range(e).unknown(n)},Sp.apply(s,arguments)}const JY=new Date,eX=new Date;function hc(t,e,n,r){function s(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(t(a=new Date(+a)),a),s.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),s.round=a=>{const o=s(a),l=s.ceil(a);return a-o<l-a?o:l},s.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),s.range=(a,o,l)=>{const c=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a<o)||!(l>0))return c;let u;do c.push(u=new Date(+a)),e(a,l),t(a);while(u<a&&a<o);return c},s.filter=a=>hc(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!a(o););else for(;--l>=0;)for(;e(o,1),!a(o););}),n&&(s.count=(a,o)=>(JY.setTime(+a),eX.setTime(+o),t(JY),t(eX),Math.floor(n(JY,eX))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(r?o=>r(o)%a===0:o=>s.count(0,o)%a===0):s)),s}const aD=hc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);aD.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?hc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):aD);aD.range;const Gg=1e3,op=Gg*60,Kg=op*60,E1=Kg*24,Lue=E1*7,i6e=E1*30,tX=E1*365,Nw=hc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getUTCSeconds());Nw.range;const Due=hc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Gg)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getMinutes());Due.range;const Bue=hc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*op)},(t,e)=>(e-t)/op,t=>t.getUTCMinutes());Bue.range;const $ue=hc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Gg-t.getMinutes()*op)},(t,e)=>{t.setTime(+t+e*Kg)},(t,e)=>(e-t)/Kg,t=>t.getHours());$ue.range;const Uue=hc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Kg)},(t,e)=>(e-t)/Kg,t=>t.getUTCHours());Uue.range;const JT=hc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*op)/E1,t=>t.getDate()-1);JT.range;const WU=hc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/E1,t=>t.getUTCDate()-1);WU.range;const pze=hc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/E1,t=>Math.floor(t/E1));pze.range;function H5(t){return hc(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*op)/Lue)}const qU=H5(0),oD=H5(1),hYt=H5(2),pYt=H5(3),QN=H5(4),mYt=H5(5),xYt=H5(6);qU.range;oD.range;hYt.range;pYt.range;QN.range;mYt.range;xYt.range;function V5(t){return hc(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Lue)}const GU=V5(0),lD=V5(1),gYt=V5(2),bYt=V5(3),ZN=V5(4),yYt=V5(5),vYt=V5(6);GU.range;lD.range;gYt.range;bYt.range;ZN.range;yYt.range;vYt.range;const zue=hc(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());zue.range;const Hue=hc(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Hue.range;const _1=hc(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());_1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:hc(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});_1.range;const k1=hc(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());k1.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:hc(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});k1.range;function mze(t,e,n,r,s,a){const o=[[Nw,1,Gg],[Nw,5,5*Gg],[Nw,15,15*Gg],[Nw,30,30*Gg],[a,1,op],[a,5,5*op],[a,15,15*op],[a,30,30*op],[s,1,Kg],[s,3,3*Kg],[s,6,6*Kg],[s,12,12*Kg],[r,1,E1],[r,2,2*E1],[n,1,Lue],[e,1,i6e],[e,3,3*i6e],[t,1,tX]];function l(u,d,f){const x=d<u;x&&([u,d]=[d,u]);const g=f&&typeof f.range=="function"?f:c(u,d,f),y=g?g.range(u,+d+1):[];return x?y.reverse():y}function c(u,d,f){const x=Math.abs(d-u)/f,g=Aue(([,,C])=>C).right(o,x);if(g===o.length)return t.every(Kne(u/tX,d/tX,f));if(g===0)return aD.every(Math.max(Kne(u,d,f),1));const[y,v]=o[x/o[g-1][2]<o[g][2]/x?g-1:g];return y.every(v)}return[l,c]}const[wYt,CYt]=mze(k1,Hue,GU,pze,Uue,Bue),[SYt,NYt]=mze(_1,zue,qU,JT,$ue,Due);function nX(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function rX(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function d7(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function AYt(t){var e=t.dateTime,n=t.date,r=t.time,s=t.periods,a=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,u=f7(s),d=h7(s),f=f7(a),x=h7(a),g=f7(o),y=h7(o),v=f7(l),C=h7(l),N=f7(c),P=h7(c),T={a:ae,A:W,b:V,B:ee,c:null,d:d6e,e:d6e,f:KYt,g:sXt,G:aXt,H:WYt,I:qYt,j:GYt,L:xze,m:YYt,M:XYt,p:oe,q:de,Q:p6e,s:m6e,S:QYt,u:ZYt,U:JYt,V:eXt,w:tXt,W:nXt,x:null,X:null,y:rXt,Y:iXt,Z:oXt,"%":h6e},M={a:Ce,A:me,b:we,B:xe,c:null,d:f6e,e:f6e,f:dXt,g:wXt,G:SXt,H:lXt,I:cXt,j:uXt,L:bze,m:fXt,M:hXt,p:be,q:je,Q:p6e,s:m6e,S:pXt,u:mXt,U:xXt,V:gXt,w:bXt,W:yXt,x:null,X:null,y:vXt,Y:CXt,Z:NXt,"%":h6e},F={a:ne,A:J,b:K,B:te,c:fe,d:c6e,e:c6e,f:UYt,g:l6e,G:o6e,H:u6e,I:u6e,j:LYt,L:$Yt,m:RYt,M:DYt,p:X,q:MYt,Q:HYt,s:VYt,S:BYt,u:TYt,U:PYt,V:IYt,w:kYt,W:FYt,x:q,X:se,y:l6e,Y:o6e,Z:OYt,"%":zYt};T.x=$(n,T),T.X=$(r,T),T.c=$(e,T),M.x=$(n,M),M.X=$(r,M),M.c=$(e,M);function $(Ie,Re){return function(Qe){var Ke=[],dt=-1,tt=0,nt=Ie.length,Le,Be,ht;for(Qe instanceof Date||(Qe=new Date(+Qe));++dt<nt;)Ie.charCodeAt(dt)===37&&(Ke.push(Ie.slice(tt,dt)),(Be=a6e[Le=Ie.charAt(++dt)])!=null?Le=Ie.charAt(++dt):Be=Le==="e"?" ":"0",(ht=Re[Le])&&(Le=ht(Qe,Be)),Ke.push(Le),tt=dt+1);return Ke.push(Ie.slice(tt,dt)),Ke.join("")}}function L(Ie,Re){return function(Qe){var Ke=d7(1900,void 0,1),dt=z(Ke,Ie,Qe+="",0),tt,nt;if(dt!=Qe.length)return null;if("Q"in Ke)return new Date(Ke.Q);if("s"in Ke)return new Date(Ke.s*1e3+("L"in Ke?Ke.L:0));if(Re&&!("Z"in Ke)&&(Ke.Z=0),"p"in Ke&&(Ke.H=Ke.H%12+Ke.p*12),Ke.m===void 0&&(Ke.m="q"in Ke?Ke.q:0),"V"in Ke){if(Ke.V<1||Ke.V>53)return null;"w"in Ke||(Ke.w=1),"Z"in Ke?(tt=rX(d7(Ke.y,0,1)),nt=tt.getUTCDay(),tt=nt>4||nt===0?lD.ceil(tt):lD(tt),tt=WU.offset(tt,(Ke.V-1)*7),Ke.y=tt.getUTCFullYear(),Ke.m=tt.getUTCMonth(),Ke.d=tt.getUTCDate()+(Ke.w+6)%7):(tt=nX(d7(Ke.y,0,1)),nt=tt.getDay(),tt=nt>4||nt===0?oD.ceil(tt):oD(tt),tt=JT.offset(tt,(Ke.V-1)*7),Ke.y=tt.getFullYear(),Ke.m=tt.getMonth(),Ke.d=tt.getDate()+(Ke.w+6)%7)}else("W"in Ke||"U"in Ke)&&("w"in Ke||(Ke.w="u"in Ke?Ke.u%7:"W"in Ke?1:0),nt="Z"in Ke?rX(d7(Ke.y,0,1)).getUTCDay():nX(d7(Ke.y,0,1)).getDay(),Ke.m=0,Ke.d="W"in Ke?(Ke.w+6)%7+Ke.W*7-(nt+5)%7:Ke.w+Ke.U*7-(nt+6)%7);return"Z"in Ke?(Ke.H+=Ke.Z/100|0,Ke.M+=Ke.Z%100,rX(Ke)):nX(Ke)}}function z(Ie,Re,Qe,Ke){for(var dt=0,tt=Re.length,nt=Qe.length,Le,Be;dt<tt;){if(Ke>=nt)return-1;if(Le=Re.charCodeAt(dt++),Le===37){if(Le=Re.charAt(dt++),Be=F[Le in a6e?Re.charAt(dt++):Le],!Be||(Ke=Be(Ie,Qe,Ke))<0)return-1}else if(Le!=Qe.charCodeAt(Ke++))return-1}return Ke}function X(Ie,Re,Qe){var Ke=u.exec(Re.slice(Qe));return Ke?(Ie.p=d.get(Ke[0].toLowerCase()),Qe+Ke[0].length):-1}function ne(Ie,Re,Qe){var Ke=g.exec(Re.slice(Qe));return Ke?(Ie.w=y.get(Ke[0].toLowerCase()),Qe+Ke[0].length):-1}function J(Ie,Re,Qe){var Ke=f.exec(Re.slice(Qe));return Ke?(Ie.w=x.get(Ke[0].toLowerCase()),Qe+Ke[0].length):-1}function K(Ie,Re,Qe){var Ke=N.exec(Re.slice(Qe));return Ke?(Ie.m=P.get(Ke[0].toLowerCase()),Qe+Ke[0].length):-1}function te(Ie,Re,Qe){var Ke=v.exec(Re.slice(Qe));return Ke?(Ie.m=C.get(Ke[0].toLowerCase()),Qe+Ke[0].length):-1}function fe(Ie,Re,Qe){return z(Ie,e,Re,Qe)}function q(Ie,Re,Qe){return z(Ie,n,Re,Qe)}function se(Ie,Re,Qe){return z(Ie,r,Re,Qe)}function ae(Ie){return o[Ie.getDay()]}function W(Ie){return a[Ie.getDay()]}function V(Ie){return c[Ie.getMonth()]}function ee(Ie){return l[Ie.getMonth()]}function oe(Ie){return s[+(Ie.getHours()>=12)]}function de(Ie){return 1+~~(Ie.getMonth()/3)}function Ce(Ie){return o[Ie.getUTCDay()]}function me(Ie){return a[Ie.getUTCDay()]}function we(Ie){return c[Ie.getUTCMonth()]}function xe(Ie){return l[Ie.getUTCMonth()]}function be(Ie){return s[+(Ie.getUTCHours()>=12)]}function je(Ie){return 1+~~(Ie.getUTCMonth()/3)}return{format:function(Ie){var Re=$(Ie+="",T);return Re.toString=function(){return Ie},Re},parse:function(Ie){var Re=L(Ie+="",!1);return Re.toString=function(){return Ie},Re},utcFormat:function(Ie){var Re=$(Ie+="",M);return Re.toString=function(){return Ie},Re},utcParse:function(Ie){var Re=L(Ie+="",!0);return Re.toString=function(){return Ie},Re}}}var a6e={"-":"",_:" ",0:"0"},$c=/^\s*\d+/,jYt=/^%/,EYt=/[\\^$*+?|[\]().{}]/g;function ba(t,e,n){var r=t<0?"-":"",s=(r?-t:t)+"",a=s.length;return r+(a<n?new Array(n-a+1).join(e)+s:s)}function _Yt(t){return t.replace(EYt,"\\$&")}function f7(t){return new RegExp("^(?:"+t.map(_Yt).join("|")+")","i")}function h7(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function kYt(t,e,n){var r=$c.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function TYt(t,e,n){var r=$c.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function PYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function IYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function FYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function o6e(t,e,n){var r=$c.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function l6e(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function OYt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function MYt(t,e,n){var r=$c.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function RYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function c6e(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function LYt(t,e,n){var r=$c.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function u6e(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function DYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function BYt(t,e,n){var r=$c.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function $Yt(t,e,n){var r=$c.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function UYt(t,e,n){var r=$c.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function zYt(t,e,n){var r=jYt.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function HYt(t,e,n){var r=$c.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function VYt(t,e,n){var r=$c.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function d6e(t,e){return ba(t.getDate(),e,2)}function WYt(t,e){return ba(t.getHours(),e,2)}function qYt(t,e){return ba(t.getHours()%12||12,e,2)}function GYt(t,e){return ba(1+JT.count(_1(t),t),e,3)}function xze(t,e){return ba(t.getMilliseconds(),e,3)}function KYt(t,e){return xze(t,e)+"000"}function YYt(t,e){return ba(t.getMonth()+1,e,2)}function XYt(t,e){return ba(t.getMinutes(),e,2)}function QYt(t,e){return ba(t.getSeconds(),e,2)}function ZYt(t){var e=t.getDay();return e===0?7:e}function JYt(t,e){return ba(qU.count(_1(t)-1,t),e,2)}function gze(t){var e=t.getDay();return e>=4||e===0?QN(t):QN.ceil(t)}function eXt(t,e){return t=gze(t),ba(QN.count(_1(t),t)+(_1(t).getDay()===4),e,2)}function tXt(t){return t.getDay()}function nXt(t,e){return ba(oD.count(_1(t)-1,t),e,2)}function rXt(t,e){return ba(t.getFullYear()%100,e,2)}function sXt(t,e){return t=gze(t),ba(t.getFullYear()%100,e,2)}function iXt(t,e){return ba(t.getFullYear()%1e4,e,4)}function aXt(t,e){var n=t.getDay();return t=n>=4||n===0?QN(t):QN.ceil(t),ba(t.getFullYear()%1e4,e,4)}function oXt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ba(e/60|0,"0",2)+ba(e%60,"0",2)}function f6e(t,e){return ba(t.getUTCDate(),e,2)}function lXt(t,e){return ba(t.getUTCHours(),e,2)}function cXt(t,e){return ba(t.getUTCHours()%12||12,e,2)}function uXt(t,e){return ba(1+WU.count(k1(t),t),e,3)}function bze(t,e){return ba(t.getUTCMilliseconds(),e,3)}function dXt(t,e){return bze(t,e)+"000"}function fXt(t,e){return ba(t.getUTCMonth()+1,e,2)}function hXt(t,e){return ba(t.getUTCMinutes(),e,2)}function pXt(t,e){return ba(t.getUTCSeconds(),e,2)}function mXt(t){var e=t.getUTCDay();return e===0?7:e}function xXt(t,e){return ba(GU.count(k1(t)-1,t),e,2)}function yze(t){var e=t.getUTCDay();return e>=4||e===0?ZN(t):ZN.ceil(t)}function gXt(t,e){return t=yze(t),ba(ZN.count(k1(t),t)+(k1(t).getUTCDay()===4),e,2)}function bXt(t){return t.getUTCDay()}function yXt(t,e){return ba(lD.count(k1(t)-1,t),e,2)}function vXt(t,e){return ba(t.getUTCFullYear()%100,e,2)}function wXt(t,e){return t=yze(t),ba(t.getUTCFullYear()%100,e,2)}function CXt(t,e){return ba(t.getUTCFullYear()%1e4,e,4)}function SXt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?ZN(t):ZN.ceil(t),ba(t.getUTCFullYear()%1e4,e,4)}function NXt(){return"+0000"}function h6e(){return"%"}function p6e(t){return+t}function m6e(t){return Math.floor(+t/1e3)}var wC,vze,wze;AXt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function AXt(t){return wC=AYt(t),vze=wC.format,wC.parse,wze=wC.utcFormat,wC.utcParse,wC}function jXt(t){return new Date(t)}function EXt(t){return t instanceof Date?+t:+new Date(+t)}function Vue(t,e,n,r,s,a,o,l,c,u){var d=Tue(),f=d.invert,x=d.domain,g=u(".%L"),y=u(":%S"),v=u("%I:%M"),C=u("%I %p"),N=u("%a %d"),P=u("%b %d"),T=u("%B"),M=u("%Y");function F($){return(c($)<$?g:l($)<$?y:o($)<$?v:a($)<$?C:r($)<$?s($)<$?N:P:n($)<$?T:M)($)}return d.invert=function($){return new Date(f($))},d.domain=function($){return arguments.length?x(Array.from($,EXt)):x().map(jXt)},d.ticks=function($){var L=x();return t(L[0],L[L.length-1],$??10)},d.tickFormat=function($,L){return L==null?F:u(L)},d.nice=function($){var L=x();return(!$||typeof $.range!="function")&&($=e(L[0],L[L.length-1],$??10)),$?x(oze(L,$)):d},d.copy=function(){return ZT(d,Vue(t,e,n,r,s,a,o,l,c,u))},d}function _Xt(){return Sp.apply(Vue(SYt,NYt,_1,zue,qU,JT,$ue,Due,Nw,vze).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function kXt(){return Sp.apply(Vue(wYt,CYt,k1,Hue,GU,WU,Uue,Bue,Nw,wze).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function KU(){var t=0,e=1,n,r,s,a,o=md,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:o(s===0?.5:(f=(a(f)-n)*s,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=a(t=+t),r=a(e=+e),s=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(x){var g,y;return arguments.length?([g,y]=x,o=f(g,y),u):[o(0),o(1)]}}return u.range=d(jj),u.rangeRound=d(kue),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,n=f(t),r=f(e),s=n===r?0:1/(r-n),u}}function R2(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Cze(){var t=M2(KU()(md));return t.copy=function(){return R2(t,Cze())},H1.apply(t,arguments)}function Sze(){var t=Fue(KU()).domain([1,10]);return t.copy=function(){return R2(t,Sze()).base(t.base())},H1.apply(t,arguments)}function Nze(){var t=Oue(KU());return t.copy=function(){return R2(t,Nze()).constant(t.constant())},H1.apply(t,arguments)}function Wue(){var t=Mue(KU());return t.copy=function(){return R2(t,Wue()).exponent(t.exponent())},H1.apply(t,arguments)}function TXt(){return Wue.apply(null,arguments).exponent(.5)}function Aze(){var t=[],e=md;function n(r){if(r!=null&&!isNaN(r=+r))return e((XT(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let s of r)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(Hy),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,s)=>e(s/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,a)=>xKt(t,a/r))},n.copy=function(){return Aze(e).domain(t)},H1.apply(n,arguments)}function YU(){var t=0,e=.5,n=1,r=1,s,a,o,l,c,u=md,d,f=!1,x;function g(v){return isNaN(v=+v)?x:(v=.5+((v=+d(v))-a)*(r*v<r*a?l:c),u(f?Math.max(0,Math.min(1,v)):v))}g.domain=function(v){return arguments.length?([t,e,n]=v,s=d(t=+t),a=d(e=+e),o=d(n=+n),l=s===a?0:.5/(a-s),c=a===o?0:.5/(o-a),r=a<s?-1:1,g):[t,e,n]},g.clamp=function(v){return arguments.length?(f=!!v,g):f},g.interpolator=function(v){return arguments.length?(u=v,g):u};function y(v){return function(C){var N,P,T;return arguments.length?([N,P,T]=C,u=zKt(v,[N,P,T]),g):[u(0),u(.5),u(1)]}}return g.range=y(jj),g.rangeRound=y(kue),g.unknown=function(v){return arguments.length?(x=v,g):x},function(v){return d=v,s=v(t),a=v(e),o=v(n),l=s===a?0:.5/(a-s),c=a===o?0:.5/(o-a),r=a<s?-1:1,g}}function jze(){var t=M2(YU()(md));return t.copy=function(){return R2(t,jze())},H1.apply(t,arguments)}function Eze(){var t=Fue(YU()).domain([.1,1,10]);return t.copy=function(){return R2(t,Eze()).base(t.base())},H1.apply(t,arguments)}function _ze(){var t=Oue(YU());return t.copy=function(){return R2(t,_ze()).constant(t.constant())},H1.apply(t,arguments)}function que(){var t=Mue(YU());return t.copy=function(){return R2(t,que()).exponent(t.exponent())},H1.apply(t,arguments)}function PXt(){return que.apply(null,arguments).exponent(.5)}const x6e=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:K_,scaleDiverging:jze,scaleDivergingLog:Eze,scaleDivergingPow:que,scaleDivergingSqrt:PXt,scaleDivergingSymlog:_ze,scaleIdentity:aze,scaleImplicit:Yne,scaleLinear:iD,scaleLog:lze,scaleOrdinal:jue,scalePoint:L9,scalePow:Rue,scaleQuantile:dze,scaleQuantize:fze,scaleRadial:uze,scaleSequential:Cze,scaleSequentialLog:Sze,scaleSequentialPow:Wue,scaleSequentialQuantile:Aze,scaleSequentialSqrt:TXt,scaleSequentialSymlog:Nze,scaleSqrt:dYt,scaleSymlog:cze,scaleThreshold:hze,scaleTime:_Xt,scaleUtc:kXt,tickFormat:ize},Symbol.toStringTag,{value:"Module"}));var sX,g6e;function kze(){if(g6e)return sX;g6e=1;var t=Cj();function e(n,r,s){for(var a=-1,o=n.length;++a<o;){var l=n[a],c=r(l);if(c!=null&&(u===void 0?c===c&&!t(c):s(c,u)))var u=c,d=l}return d}return sX=e,sX}var iX,b6e;function IXt(){if(b6e)return iX;b6e=1;function t(e,n){return e>n}return iX=t,iX}var aX,y6e;function FXt(){if(y6e)return aX;y6e=1;var t=kze(),e=IXt(),n=Aj();function r(s){return s&&s.length?t(s,n,e):void 0}return aX=r,aX}var OXt=FXt();const Ty=Ii(OXt);var oX,v6e;function MXt(){if(v6e)return oX;v6e=1;function t(e,n){return e<n}return oX=t,oX}var lX,w6e;function RXt(){if(w6e)return lX;w6e=1;var t=kze(),e=MXt(),n=Aj();function r(s){return s&&s.length?t(s,n,e):void 0}return lX=r,lX}var LXt=RXt();const XU=Ii(LXt);var cX,C6e;function DXt(){if(C6e)return cX;C6e=1;var t=lue(),e=O2(),n=RUe(),r=wf();function s(a,o){var l=r(a)?t:n;return l(a,e(o,3))}return cX=s,cX}var uX,S6e;function BXt(){if(S6e)return uX;S6e=1;var t=OUe(),e=DXt();function n(r,s){return t(e(r,s),1)}return uX=n,uX}var $Xt=BXt();const UXt=Ii($Xt);var dX,N6e;function zXt(){if(N6e)return dX;N6e=1;var t=vue();function e(n,r){return t(n,r)}return dX=e,dX}var HXt=zXt();const d5=Ii(HXt);var Ej=1e9,VXt={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Kue,Do=!0,wp="[DecimalError] ",j3=wp+"Invalid argument: ",Gue=wp+"Exponent out of range: ",_j=Math.floor,Yv=Math.pow,WXt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Kf,_c=1e7,No=7,Tze=9007199254740991,cD=_j(Tze/No),Ps={};Ps.absoluteValue=Ps.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Ps.comparedTo=Ps.cmp=function(t){var e,n,r,s,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(r=a.d.length,s=t.d.length,e=0,n=r<s?r:s;e<n;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return r===s?0:r>s^a.s<0?1:-1};Ps.decimalPlaces=Ps.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*No;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Ps.dividedBy=Ps.div=function(t){return c1(this,new this.constructor(t))};Ps.dividedToIntegerBy=Ps.idiv=function(t){var e=this,n=e.constructor;return Za(c1(e,new n(t),0,1),n.precision)};Ps.equals=Ps.eq=function(t){return!this.cmp(t)};Ps.exponent=function(){return ql(this)};Ps.greaterThan=Ps.gt=function(t){return this.cmp(t)>0};Ps.greaterThanOrEqualTo=Ps.gte=function(t){return this.cmp(t)>=0};Ps.isInteger=Ps.isint=function(){return this.e>this.d.length-2};Ps.isNegative=Ps.isneg=function(){return this.s<0};Ps.isPositive=Ps.ispos=function(){return this.s>0};Ps.isZero=function(){return this.s===0};Ps.lessThan=Ps.lt=function(t){return this.cmp(t)<0};Ps.lessThanOrEqualTo=Ps.lte=function(t){return this.cmp(t)<1};Ps.logarithm=Ps.log=function(t){var e,n=this,r=n.constructor,s=r.precision,a=s+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Kf))throw Error(wp+"NaN");if(n.s<1)throw Error(wp+(n.s?"NaN":"-Infinity"));return n.eq(Kf)?new r(0):(Do=!1,e=c1(J_(n,a),J_(t,a),a),Do=!0,Za(e,s))};Ps.minus=Ps.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Fze(e,t):Pze(e,(t.s=-t.s,t))};Ps.modulo=Ps.mod=function(t){var e,n=this,r=n.constructor,s=r.precision;if(t=new r(t),!t.s)throw Error(wp+"NaN");return n.s?(Do=!1,e=c1(n,t,0,1).times(t),Do=!0,n.minus(e)):Za(new r(n),s)};Ps.naturalExponential=Ps.exp=function(){return Ize(this)};Ps.naturalLogarithm=Ps.ln=function(){return J_(this)};Ps.negated=Ps.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Ps.plus=Ps.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Pze(e,t):Fze(e,(t.s=-t.s,t))};Ps.precision=Ps.sd=function(t){var e,n,r,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(j3+t);if(e=ql(s)+1,r=s.d.length-1,n=r*No+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Ps.squareRoot=Ps.sqrt=function(){var t,e,n,r,s,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(wp+"NaN")}for(t=ql(l),Do=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=B0(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=_j((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(a=r,r=a.plus(c1(l,a,o+2)).times(.5),B0(a.d).slice(0,o)===(e=B0(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(Za(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(e!="9999")break;o+=4}return Do=!0,Za(r,n)};Ps.times=Ps.mul=function(t){var e,n,r,s,a,o,l,c,u,d=this,f=d.constructor,x=d.d,g=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,c=x.length,u=g.length,c<u&&(a=x,x=g,g=a,o=c,c=u,u=o),a=[],o=c+u,r=o;r--;)a.push(0);for(r=u;--r>=0;){for(e=0,s=c+r;s>r;)l=a[s]+g[r]*x[s-r-1]+e,a[s--]=l%_c|0,e=l/_c|0;a[s]=(a[s]+e)%_c|0}for(;!a[--o];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,Do?Za(t,f.precision):t};Ps.toDecimalPlaces=Ps.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(mx(t,0,Ej),e===void 0?e=r.rounding:mx(e,0,8),Za(n,t+ql(n)+1,e))};Ps.toExponential=function(t,e){var n,r=this,s=r.constructor;return t===void 0?n=f5(r,!0):(mx(t,0,Ej),e===void 0?e=s.rounding:mx(e,0,8),r=Za(new s(r),t+1,e),n=f5(r,!0,t+1)),n};Ps.toFixed=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?f5(s):(mx(t,0,Ej),e===void 0?e=a.rounding:mx(e,0,8),r=Za(new a(s),t+ql(s)+1,e),n=f5(r.abs(),!1,t+ql(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Ps.toInteger=Ps.toint=function(){var t=this,e=t.constructor;return Za(new e(t),ql(t)+1,e.rounding)};Ps.toNumber=function(){return+this};Ps.toPower=Ps.pow=function(t){var e,n,r,s,a,o,l=this,c=l.constructor,u=12,d=+(t=new c(t));if(!t.s)return new c(Kf);if(l=new c(l),!l.s){if(t.s<1)throw Error(wp+"Infinity");return l}if(l.eq(Kf))return l;if(r=c.precision,t.eq(Kf))return Za(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,a=l.s,o){if((n=d<0?-d:d)<=Tze){for(s=new c(Kf),e=Math.ceil(r/No+4),Do=!1;n%2&&(s=s.times(l),j6e(s.d,e)),n=_j(n/2),n!==0;)l=l.times(l),j6e(l.d,e);return Do=!0,t.s<0?new c(Kf).div(s):Za(s,r)}}else if(a<0)throw Error(wp+"NaN");return a=a<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Do=!1,s=t.times(J_(l,r+u)),Do=!0,s=Ize(s),s.s=a,s};Ps.toPrecision=function(t,e){var n,r,s=this,a=s.constructor;return t===void 0?(n=ql(s),r=f5(s,n<=a.toExpNeg||n>=a.toExpPos)):(mx(t,1,Ej),e===void 0?e=a.rounding:mx(e,0,8),s=Za(new a(s),t,e),n=ql(s),r=f5(s,t<=n||n<=a.toExpNeg,t)),r};Ps.toSignificantDigits=Ps.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(mx(t,1,Ej),e===void 0?e=r.rounding:mx(e,0,8)),Za(new r(n),t,e)};Ps.toString=Ps.valueOf=Ps.val=Ps.toJSON=Ps[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=ql(t),n=t.constructor;return f5(t,e<=n.toExpNeg||e>=n.toExpPos)};function Pze(t,e){var n,r,s,a,o,l,c,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Do?Za(e,f):e;if(c=t.d,u=e.d,o=t.e,s=e.e,c=c.slice(),a=o-s,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/No),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/_c|0,c[a]%=_c;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,Do?Za(e,f):e}function mx(t,e,n){if(t!==~~t||t<e||t>n)throw Error(j3+t)}function B0(t){var e,n,r,s=t.length-1,a="",o=t[0];if(s>0){for(a+=o,e=1;e<s;e++)r=t[e]+"",n=No-r.length,n&&(a+=Vb(n)),a+=r;o=t[e],r=o+"",n=No-r.length,n&&(a+=Vb(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var c1=function(){function t(r,s){var a,o=0,l=r.length;for(r=r.slice();l--;)a=r[l]*s+o,r[l]=a%_c|0,o=a/_c|0;return o&&r.unshift(o),r}function e(r,s,a,o){var l,c;if(a!=o)c=a>o?1:-1;else for(l=c=0;l<a;l++)if(r[l]!=s[l]){c=r[l]>s[l]?1:-1;break}return c}function n(r,s,a){for(var o=0;a--;)r[a]-=o,o=r[a]<s[a]?1:0,r[a]=o*_c+r[a]-s[a];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,a,o){var l,c,u,d,f,x,g,y,v,C,N,P,T,M,F,$,L,z,X=r.constructor,ne=r.s==s.s?1:-1,J=r.d,K=s.d;if(!r.s)return new X(r);if(!s.s)throw Error(wp+"Division by zero");for(c=r.e-s.e,L=K.length,F=J.length,g=new X(ne),y=g.d=[],u=0;K[u]==(J[u]||0);)++u;if(K[u]>(J[u]||0)&&--c,a==null?P=a=X.precision:o?P=a+(ql(r)-ql(s))+1:P=a,P<0)return new X(0);if(P=P/No+2|0,u=0,L==1)for(d=0,K=K[0],P++;(u<F||d)&&P--;u++)T=d*_c+(J[u]||0),y[u]=T/K|0,d=T%K|0;else{for(d=_c/(K[0]+1)|0,d>1&&(K=t(K,d),J=t(J,d),L=K.length,F=J.length),M=L,v=J.slice(0,L),C=v.length;C<L;)v[C++]=0;z=K.slice(),z.unshift(0),$=K[0],K[1]>=_c/2&&++$;do d=0,l=e(K,v,L,C),l<0?(N=v[0],L!=C&&(N=N*_c+(v[1]||0)),d=N/$|0,d>1?(d>=_c&&(d=_c-1),f=t(K,d),x=f.length,C=v.length,l=e(f,v,x,C),l==1&&(d--,n(f,L<x?z:K,x))):(d==0&&(l=d=1),f=K.slice()),x=f.length,x<C&&f.unshift(0),n(v,f,C),l==-1&&(C=v.length,l=e(K,v,L,C),l<1&&(d++,n(v,L<C?z:K,C))),C=v.length):l===0&&(d++,v=[0]),y[u++]=d,l&&v[0]?v[C++]=J[M]||0:(v=[J[M]],C=1);while((M++<F||v[0]!==void 0)&&P--)}return y[0]||y.shift(),g.e=c,Za(g,o?a+ql(g)+1:a)}}();function Ize(t,e){var n,r,s,a,o,l,c=0,u=0,d=t.constructor,f=d.precision;if(ql(t)>16)throw Error(Gue+ql(t));if(!t.s)return new d(Kf);for(e==null?(Do=!1,l=f):l=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(r=Math.log(Yv(2,u))/Math.LN10*2+5|0,l+=r,n=s=a=new d(Kf),d.precision=l;;){if(s=Za(s.times(t),l),n=n.times(++c),o=a.plus(c1(s,n,l)),B0(o.d).slice(0,l)===B0(a.d).slice(0,l)){for(;u--;)a=Za(a.times(a),l);return d.precision=f,e==null?(Do=!0,Za(a,f)):a}a=o}}function ql(t){for(var e=t.e*No,n=t.d[0];n>=10;n/=10)e++;return e}function fX(t,e,n){if(e>t.LN10.sd())throw Do=!0,n&&(t.precision=n),Error(wp+"LN10 precision limit exceeded");return Za(new t(t.LN10),e)}function Vb(t){for(var e="";t--;)e+="0";return e}function J_(t,e){var n,r,s,a,o,l,c,u,d,f=1,x=10,g=t,y=g.d,v=g.constructor,C=v.precision;if(g.s<1)throw Error(wp+(g.s?"NaN":"-Infinity"));if(g.eq(Kf))return new v(0);if(e==null?(Do=!1,u=C):u=e,g.eq(10))return e==null&&(Do=!0),fX(v,u);if(u+=x,v.precision=u,n=B0(y),r=n.charAt(0),a=ql(g),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(t),n=B0(g.d),r=n.charAt(0),f++;a=ql(g),r>1?(g=new v("0."+n),a++):g=new v(r+"."+n.slice(1))}else return c=fX(v,u+2,C).times(a+""),g=J_(new v(r+"."+n.slice(1)),u-x).plus(c),v.precision=C,e==null?(Do=!0,Za(g,C)):g;for(l=o=g=c1(g.minus(Kf),g.plus(Kf),u),d=Za(g.times(g),u),s=3;;){if(o=Za(o.times(d),u),c=l.plus(c1(o,new v(s),u)),B0(c.d).slice(0,u)===B0(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(fX(v,u+2,C).times(a+""))),l=c1(l,new v(f),u),v.precision=C,e==null?(Do=!0,Za(l,C)):l;l=c,s+=2}}function A6e(t,e){var n,r,s;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(r,s),e){if(s-=r,n=n-r-1,t.e=_j(n/No),t.d=[],r=(n+1)%No,n<0&&(r+=No),r<s){for(r&&t.d.push(+e.slice(0,r)),s-=No;r<s;)t.d.push(+e.slice(r,r+=No));e=e.slice(r),r=No-e.length}else r-=s;for(;r--;)e+="0";if(t.d.push(+e),Do&&(t.e>cD||t.e<-cD))throw Error(Gue+n)}else t.s=0,t.e=0,t.d=[0];return t}function Za(t,e,n){var r,s,a,o,l,c,u,d,f=t.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=e-o,r<0)r+=No,s=e,u=f[d=0];else{if(d=Math.ceil((r+1)/No),a=f.length,d>=a)return t;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=No,s=r-No+o}if(n!==void 0&&(a=Yv(10,o-s-1),l=u/a%10|0,c=e<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Yv(10,o-s):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return c?(a=ql(t),f.length=1,e=e-a-1,f[0]=Yv(10,(No-e%No)%No),t.e=_j(-e/No)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Yv(10,No-r),f[d]=s>0?(u/Yv(10,o-s)%Yv(10,s)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==_c&&(f[0]=1,++t.e);break}else{if(f[d]+=a,f[d]!=_c)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(Do&&(t.e>cD||t.e<-cD))throw Error(Gue+ql(t));return t}function Fze(t,e){var n,r,s,a,o,l,c,u,d,f,x=t.constructor,g=x.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new x(t),Do?Za(e,g):e;if(c=t.d,f=e.d,r=e.e,u=t.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(g/No),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=f[s]){d=c[s]<f[s];break}o=0}for(d&&(n=c,c=f,f=n,e.s=-e.s),l=c.length,s=f.length-l;s>0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]<f[s]){for(a=s;a&&c[--a]===0;)c[a]=_c-1;--c[a],c[s]+=_c}c[s]-=f[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,Do?Za(e,g):e):new x(0)}function f5(t,e,n){var r,s=ql(t),a=B0(t.d),o=a.length;return e?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+Vb(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+Vb(-s-1)+a,n&&(r=n-o)>0&&(a+=Vb(r))):s>=o?(a+=Vb(s+1-o),n&&(r=n-s-1)>0&&(a=a+"."+Vb(r))):((r=s+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(a+="."),a+=Vb(r))),t.s<0?"-"+a:a}function j6e(t,e){if(t.length>e)return t.length=e,!0}function Oze(t){var e,n,r;function s(a){var o=this;if(!(o instanceof s))return new s(a);if(o.constructor=s,a instanceof s){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(j3+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return A6e(o,a.toString())}else if(typeof a!="string")throw Error(j3+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,WXt.test(a))A6e(o,a);else throw Error(j3+a)}if(s.prototype=Ps,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=Oze,s.config=s.set=qXt,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return s.config(t),s}function qXt(t){if(!t||typeof t!="object")throw Error(wp+"Object expected");var e,n,r,s=["precision",1,Ej,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((r=t[n=s[e]])!==void 0)if(_j(r)===r&&r>=s[e+1]&&r<=s[e+2])this[n]=r;else throw Error(j3+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(j3+n+": "+r);return this}var Kue=Oze(VXt);Kf=new Kue(1);const Va=Kue;function GXt(t){return QXt(t)||XXt(t)||YXt(t)||KXt()}function KXt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YXt(t,e){if(t){if(typeof t=="string")return Jne(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jne(t,e)}}function XXt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function QXt(t){if(Array.isArray(t))return Jne(t)}function Jne(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ZXt=function(e){return e},Mze={"@@functional/placeholder":!0},Rze=function(e){return e===Mze},E6e=function(e){return function n(){return arguments.length===0||arguments.length===1&&Rze(arguments.length<=0?void 0:arguments[0])?n:e.apply(void 0,arguments)}},JXt=function t(e,n){return e===1?n:E6e(function(){for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];var o=s.filter(function(l){return l!==Mze}).length;return o>=e?n.apply(void 0,s):t(e-o,E6e(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=s.map(function(f){return Rze(f)?c.shift():f});return n.apply(void 0,GXt(d).concat(c))}))})},QU=function(e){return JXt(e.length,e)},ere=function(e,n){for(var r=[],s=e;s<n;++s)r[s-e]=s;return r},eQt=QU(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(n){return e[n]}).map(t)}),tQt=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(!n.length)return ZXt;var s=n.reverse(),a=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},a.apply(void 0,arguments))}},tre=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},Lze=function(e){var n=null,r=null;return function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return n&&a.every(function(l,c){return l===n[c]})||(n=a,r=e.apply(void 0,a)),r}};function nQt(t){var e;return t===0?e=1:e=Math.floor(new Va(t).abs().log(10).toNumber())+1,e}function rQt(t,e,n){for(var r=new Va(t),s=0,a=[];r.lt(e)&&s<1e5;)a.push(r.toNumber()),r=r.add(n),s++;return a}var sQt=QU(function(t,e,n){var r=+t,s=+e;return r+n*(s-r)}),iQt=QU(function(t,e,n){var r=e-+t;return r=r||1/0,(n-t)/r}),aQt=QU(function(t,e,n){var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});const ZU={rangeStep:rQt,getDigitCount:nQt,interpolateNumber:sQt,uninterpolateNumber:iQt,uninterpolateTruncation:aQt};function nre(t){return cQt(t)||lQt(t)||Dze(t)||oQt()}function oQt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lQt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function cQt(t){if(Array.isArray(t))return rre(t)}function ek(t,e){return fQt(t)||dQt(t,e)||Dze(t,e)||uQt()}function uQt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dze(t,e){if(t){if(typeof t=="string")return rre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rre(t,e)}}function rre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function dQt(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,s=!1,a=void 0;try{for(var o=t[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(c){s=!0,a=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw a}}return n}}function fQt(t){if(Array.isArray(t))return t}function Bze(t){var e=ek(t,2),n=e[0],r=e[1],s=n,a=r;return n>r&&(s=r,a=n),[s,a]}function $ze(t,e,n){if(t.lte(0))return new Va(0);var r=ZU.getDigitCount(t.toNumber()),s=new Va(10).pow(r),a=t.div(s),o=r!==1?.05:.1,l=new Va(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return e?c:new Va(Math.ceil(c))}function hQt(t,e,n){var r=1,s=new Va(t);if(!s.isint()&&n){var a=Math.abs(t);a<1?(r=new Va(10).pow(ZU.getDigitCount(t)-1),s=new Va(Math.floor(s.div(r).toNumber())).mul(r)):a>1&&(s=new Va(Math.floor(t)))}else t===0?s=new Va(Math.floor((e-1)/2)):n||(s=new Va(Math.floor(t)));var o=Math.floor((e-1)/2),l=tQt(eQt(function(c){return s.add(new Va(c-o).mul(r)).toNumber()}),ere);return l(0,e)}function Uze(t,e,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Va(0),tickMin:new Va(0),tickMax:new Va(0)};var a=$ze(new Va(e).sub(t).div(n-1),r,s),o;t<=0&&e>=0?o=new Va(0):(o=new Va(t).add(e).div(2),o=o.sub(new Va(o).mod(a)));var l=Math.ceil(o.sub(t).div(a).toNumber()),c=Math.ceil(new Va(e).sub(o).div(a).toNumber()),u=l+c+1;return u>n?Uze(t,e,n,r,s+1):(u<n&&(c=e>0?c+(n-u):c,l=e>0?l:l+(n-u)),{step:a,tickMin:o.sub(new Va(l).mul(a)),tickMax:o.add(new Va(c).mul(a))})}function pQt(t){var e=ek(t,2),n=e[0],r=e[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=Bze([n,r]),c=ek(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(nre(ere(0,s-1).map(function(){return 1/0}))):[].concat(nre(ere(0,s-1).map(function(){return-1/0})),[d]);return n>r?tre(f):f}if(u===d)return hQt(u,s,a);var x=Uze(u,d,o,a),g=x.step,y=x.tickMin,v=x.tickMax,C=ZU.rangeStep(y,v.add(new Va(.1).mul(g)),g);return n>r?tre(C):C}function mQt(t,e){var n=ek(t,2),r=n[0],s=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Bze([r,s]),l=ek(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(e,2),f=$ze(new Va(u).sub(c).div(d-1),a,0),x=[].concat(nre(ZU.rangeStep(new Va(c),new Va(u).sub(new Va(.99).mul(f)),f)),[u]);return r>s?tre(x):x}var xQt=Lze(pQt),gQt=Lze(mQt),bQt="Invariant failed";function h5(t,e){throw new Error(bQt)}var yQt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function JN(t){"@babel/helpers - typeof";return JN=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},JN(t)}function uD(){return uD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},uD.apply(this,arguments)}function vQt(t,e){return NQt(t)||SQt(t,e)||CQt(t,e)||wQt()}function wQt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CQt(t,e){if(t){if(typeof t=="string")return _6e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _6e(t,e)}}function _6e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function SQt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function NQt(t){if(Array.isArray(t))return t}function AQt(t,e){if(t==null)return{};var n=jQt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jQt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function EQt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _Qt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vze(r.key),r)}}function kQt(t,e,n){return _Qt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function TQt(t,e,n){return e=dD(e),PQt(t,zze()?Reflect.construct(e,n||[],dD(t).constructor):e.apply(t,n))}function PQt(t,e){if(e&&(JN(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IQt(t)}function IQt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zze=function(){return!!t})()}function dD(t){return dD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},dD(t)}function FQt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sre(t,e)}function sre(t,e){return sre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},sre(t,e)}function Hze(t,e,n){return e=Vze(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vze(t){var e=OQt(t,"string");return JN(e)=="symbol"?e:e+""}function OQt(t,e){if(JN(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(JN(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kj=function(t){function e(){return EQt(this,e),TQt(this,e,arguments)}return FQt(e,t),kQt(e,[{key:"render",value:function(){var r=this.props,s=r.offset,a=r.layout,o=r.width,l=r.dataKey,c=r.data,u=r.dataPointFormatter,d=r.xAxis,f=r.yAxis,x=AQt(r,yQt),g=Ci(x,!1);this.props.direction==="x"&&d.type!=="number"&&h5();var y=c.map(function(v){var C=u(v,l),N=C.x,P=C.y,T=C.value,M=C.errorVal;if(!M)return null;var F=[],$,L;if(Array.isArray(M)){var z=vQt(M,2);$=z[0],L=z[1]}else $=L=M;if(a==="vertical"){var X=d.scale,ne=P+s,J=ne+o,K=ne-o,te=X(T-$),fe=X(T+L);F.push({x1:fe,y1:J,x2:fe,y2:K}),F.push({x1:te,y1:ne,x2:fe,y2:ne}),F.push({x1:te,y1:J,x2:te,y2:K})}else if(a==="horizontal"){var q=f.scale,se=N+s,ae=se-o,W=se+o,V=q(T-$),ee=q(T+L);F.push({x1:ae,y1:ee,x2:W,y2:ee}),F.push({x1:se,y1:V,x2:se,y2:ee}),F.push({x1:ae,y1:V,x2:W,y2:V})}return Ne.createElement(Na,uD({className:"recharts-errorBar",key:"bar-".concat(F.map(function(oe){return"".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))},g),F.map(function(oe){return Ne.createElement("line",uD({},oe,{key:"line-".concat(oe.x1,"-").concat(oe.x2,"-").concat(oe.y1,"-").concat(oe.y2)}))}))});return Ne.createElement(Na,{className:"recharts-errorBars"},y)}}])}(Ne.Component);Hze(kj,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});Hze(kj,"displayName","ErrorBar");function tk(t){"@babel/helpers - typeof";return tk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tk(t)}function k6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function kv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?k6e(Object(n),!0).forEach(function(r){MQt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MQt(t,e,n){return e=RQt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RQt(t){var e=LQt(t,"string");return tk(e)=="symbol"?e:e+""}function LQt(t,e){if(tk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(tk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Wze=function(e){var n=e.children,r=e.formattedGraphicalItems,s=e.legendWidth,a=e.legendContent,o=Wf(n,N3);if(!o)return null;var l=N3.defaultProps,c=l!==void 0?kv(kv({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:a==="children"?u=(r||[]).reduce(function(d,f){var x=f.item,g=f.props,y=g.sectors||g.data||[];return d.concat(y.map(function(v){return{type:o.props.iconType||x.props.legendType,value:v.name,color:v.fill,payload:v}}))},[]):u=(r||[]).map(function(d){var f=d.item,x=f.type.defaultProps,g=x!==void 0?kv(kv({},x),f.props):{},y=g.dataKey,v=g.name,C=g.legendType,N=g.hide;return{inactive:N,dataKey:y,type:c.iconType||C||"square",color:Yue(f),value:v||y,payload:g}}),kv(kv(kv({},c),N3.getWithHeight(o,s)),{},{payload:u,item:o})};function nk(t){"@babel/helpers - typeof";return nk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nk(t)}function T6e(t){return UQt(t)||$Qt(t)||BQt(t)||DQt()}function DQt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BQt(t,e){if(t){if(typeof t=="string")return ire(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ire(t,e)}}function $Qt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function UQt(t){if(Array.isArray(t))return ire(t)}function ire(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function P6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function al(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?P6e(Object(n),!0).forEach(function(r){D4(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function D4(t,e,n){return e=zQt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zQt(t){var e=HQt(t,"string");return nk(e)=="symbol"?e:e+""}function HQt(t,e){if(nk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(nk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lc(t,e,n){return Si(t)||Si(e)?n:oc(e)?dp(t,e,n):Ei(e)?e(t):n}function D9(t,e,n,r){var s=UXt(t,function(l){return lc(l,e)});if(n==="number"){var a=s.filter(function(l){return rs(l)||parseFloat(l)});return a.length?[XU(a),Ty(a)]:[1/0,-1/0]}var o=r?s.filter(function(l){return!Si(l)}):s;return o.map(function(l){return oc(l)||l instanceof Date?l:""})}var VQt=function(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u<l;u++){var d=u>0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,x=u>=l-1?s[0].coordinate:s[u+1].coordinate,g=void 0;if(gm(f-d)!==gm(x-f)){var y=[];if(gm(x-f)===gm(c[1]-c[0])){g=x;var v=f+c[1]-c[0];y[0]=Math.min(v,(v+d)/2),y[1]=Math.max(v,(v+d)/2)}else{g=d;var C=x+c[1]-c[0];y[0]=Math.min(f,(C+f)/2),y[1]=Math.max(f,(C+f)/2)}var N=[Math.min(f,(g+f)/2),Math.max(f,(g+f)/2)];if(e>N[0]&&e<=N[1]||e>=y[0]&&e<=y[1]){o=s[u].index;break}}else{var P=Math.min(d,x),T=Math.max(d,x);if(e>(P+f)/2&&e<=(T+f)/2){o=s[u].index;break}}}else for(var M=0;M<l;M++)if(M===0&&e<=(r[M].coordinate+r[M+1].coordinate)/2||M>0&&M<l-1&&e>(r[M].coordinate+r[M-1].coordinate)/2&&e<=(r[M].coordinate+r[M+1].coordinate)/2||M===l-1&&e>(r[M].coordinate+r[M-1].coordinate)/2){o=r[M].index;break}return o},Yue=function(e){var n,r=e,s=r.type.displayName,a=(n=e.type)!==null&&n!==void 0&&n.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,o=a.stroke,l=a.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},WQt=function(e){var n=e.barSize,r=e.totalSize,s=e.stackGroups,a=s===void 0?{}:s;if(!a)return{};for(var o={},l=Object.keys(a),c=0,u=l.length;c<u;c++)for(var d=a[l[c]].stackGroups,f=Object.keys(d),x=0,g=f.length;x<g;x++){var y=d[f[x]],v=y.items,C=y.cateAxisId,N=v.filter(function(L){return o1(L.type).indexOf("Bar")>=0});if(N&&N.length){var P=N[0].type.defaultProps,T=P!==void 0?al(al({},P),N[0].props):N[0].props,M=T.barSize,F=T[C];o[F]||(o[F]=[]);var $=Si(M)?n:M;o[F].push({item:N[0],stackList:N.slice(1),barSize:Si($)?void 0:u5($,r,0)})}}return o},qQt=function(e){var n=e.barGap,r=e.barCategoryGap,s=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,l=e.maxBarSize,c=o.length;if(c<1)return null;var u=u5(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var x=!1,g=s/c,y=o.reduce(function(M,F){return M+F.barSize||0},0);y+=(c-1)*u,y>=s&&(y-=(c-1)*u,u=0),y>=s&&g>0&&(x=!0,g*=.9,y=c*g);var v=(s-y)/2>>0,C={offset:v-u,size:0};d=o.reduce(function(M,F){var $={item:F.item,position:{offset:C.offset+C.size+u,size:x?g:F.barSize}},L=[].concat(T6e(M),[$]);return C=L[L.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(z){L.push({item:z,position:C})}),L},f)}else{var N=u5(r,s,0,!0);s-2*N-(c-1)*u<=0&&(u=0);var P=(s-2*N-(c-1)*u)/c;P>1&&(P>>=0);var T=l===+l?Math.min(P,l):P;d=o.reduce(function(M,F,$){var L=[].concat(T6e(M),[{item:F.item,position:{offset:N+(P+u)*$+(P-T)/2,size:T}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(z){L.push({item:z,position:L[L.length-1].position})}),L},f)}return d},GQt=function(e,n,r,s){var a=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=Wze({children:a,legendWidth:c});if(u){var d=s||{},f=d.width,x=d.height,g=u.align,y=u.verticalAlign,v=u.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&g!=="center"&&rs(e[g]))return al(al({},e),{},D4({},g,e[g]+(f||0)));if((v==="horizontal"||v==="vertical"&&g==="center")&&y!=="middle"&&rs(e[y]))return al(al({},e),{},D4({},y,e[y]+(x||0)))}return e},KQt=function(e,n,r){return Si(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},qze=function(e,n,r,s,a){var o=n.props.children,l=hf(o,kj).filter(function(u){return KQt(s,a,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=lc(d,r);if(Si(f))return u;var x=Array.isArray(f)?[XU(f),Ty(f)]:[f,f],g=c.reduce(function(y,v){var C=lc(d,v,0),N=x[0]-Math.abs(Array.isArray(C)?C[0]:C),P=x[1]+Math.abs(Array.isArray(C)?C[1]:C);return[Math.min(N,y[0]),Math.max(P,y[1])]},[1/0,-1/0]);return[Math.min(g[0],u[0]),Math.max(g[1],u[1])]},[1/0,-1/0])}return null},YQt=function(e,n,r,s,a){var o=n.map(function(l){return qze(e,l,r,a,s)}).filter(function(l){return!Si(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},Gze=function(e,n,r,s,a){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&qze(e,c,u,s)||D9(e,u,r,a)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},Kze=function(e,n){return e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis"},Yze=function(e,n,r,s){if(s)return e.map(function(c){return c.coordinate});var a,o,l=e.map(function(c){return c.coordinate===n&&(a=!0),c.coordinate===r&&(o=!0),c.coordinate});return a||l.push(n),o||l.push(r),l},Yg=function(e,n,r){if(!e)return null;var s=e.scale,a=e.duplicateDomain,o=e.type,l=e.range,c=e.realScaleType==="scaleBand"?s.bandwidth()/2:2,u=(n||r)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(u=e.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?gm(l[0]-l[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var x=a?a.indexOf(f):f;return{coordinate:s(x)+u,value:f,offset:u}});return d.filter(function(f){return!Nj(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,x){return{coordinate:s(f)+u,value:f,index:x,offset:u}}):s.ticks&&!r?s.ticks(e.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,x){return{coordinate:s(f)+u,value:a?a[f]:f,index:x,offset:u}})},hX=new WeakMap,bF=function(e,n){if(typeof n!="function")return e;hX.has(e)||hX.set(e,new WeakMap);var r=hX.get(e);if(r.has(n))return r.get(n);var s=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},XQt=function(e,n,r){var s=e.scale,a=e.type,o=e.layout,l=e.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:K_(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:iD(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:L9(),realScaleType:"point"}:a==="category"?{scale:K_(),realScaleType:"band"}:{scale:iD(),realScaleType:"linear"};if(c5(s)){var c="scale".concat(RU(s));return{scale:(x6e[c]||L9)(),realScaleType:x6e[c]?c:"point"}}return Ei(s)?{scale:s}:{scale:L9(),realScaleType:"point"}},I6e=1e-4,QQt=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,s=e.range(),a=Math.min(s[0],s[1])-I6e,o=Math.max(s[0],s[1])+I6e,l=e(n[0]),c=e(n[r-1]);(l<a||l>o||c<a||c>o)&&e.domain([n[0],n[r-1]])}},ZQt=function(e,n){if(!e)return null;for(var r=0,s=e.length;r<s;r++)if(e[r].item===n)return e[r].position;return null},JQt=function(e,n){if(!n||n.length!==2||!rs(n[0])||!rs(n[1]))return e;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),a=[e[0],e[1]];return(!rs(e[0])||e[0]<r)&&(a[0]=r),(!rs(e[1])||e[1]>s)&&(a[1]=s),a[0]>s&&(a[0]=s),a[1]<r&&(a[1]=r),a},eZt=function(e){var n=e.length;if(!(n<=0))for(var r=0,s=e[0].length;r<s;++r)for(var a=0,o=0,l=0;l<n;++l){var c=Nj(e[l][r][1])?e[l][r][0]:e[l][r][1];c>=0?(e[l][r][0]=a,e[l][r][1]=a+c,a=e[l][r][1]):(e[l][r][0]=o,e[l][r][1]=o+c,o=e[l][r][1])}},tZt=function(e){var n=e.length;if(!(n<=0))for(var r=0,s=e[0].length;r<s;++r)for(var a=0,o=0;o<n;++o){var l=Nj(e[o][r][1])?e[o][r][0]:e[o][r][1];l>=0?(e[o][r][0]=a,e[o][r][1]=a+l,a=e[o][r][1]):(e[o][r][0]=0,e[o][r][1]=0)}},nZt={sign:eZt,expand:$Vt,none:WN,silhouette:UVt,wiggle:zVt,positive:tZt},rZt=function(e,n,r){var s=n.map(function(l){return l.props.dataKey}),a=nZt[r],o=BVt().keys(s).value(function(l,c){return+lc(l,c,0)}).order(Mne).offset(a);return o(e)},sZt=function(e,n,r,s,a,o){if(!e)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,x){var g,y=(g=x.type)!==null&&g!==void 0&&g.defaultProps?al(al({},x.type.defaultProps),x.props):x.props,v=y.stackId,C=y.hide;if(C)return f;var N=y[r],P=f[N]||{hasStack:!1,stackGroups:{}};if(oc(v)){var T=P.stackGroups[v]||{numericAxisId:r,cateAxisId:s,items:[]};T.items.push(x),P.hasStack=!0,P.stackGroups[v]=T}else P.stackGroups[z5("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[x]};return al(al({},f),{},D4({},N,P))},c),d={};return Object.keys(u).reduce(function(f,x){var g=u[x];if(g.hasStack){var y={};g.stackGroups=Object.keys(g.stackGroups).reduce(function(v,C){var N=g.stackGroups[C];return al(al({},v),{},D4({},C,{numericAxisId:r,cateAxisId:s,items:N.items,stackedData:rZt(e,N.items,a)}))},y)}return al(al({},f),{},D4({},x,g))},d)},iZt=function(e,n){var r=n.realScaleType,s=n.type,a=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=xQt(u,a,l);return e.domain([XU(d),Ty(d)]),{niceTicks:d}}if(a&&s==="number"){var f=e.domain(),x=gQt(f,a,l);return{niceTicks:x}}return null};function eA(t){var e=t.axis,n=t.ticks,r=t.bandSize,s=t.entry,a=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Si(s[e.dataKey])){var l=$L(n,"value",s[e.dataKey]);if(l)return l.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=lc(s,Si(o)?e.dataKey:o);return Si(c)?null:e.scale(c)}var F6e=function(e){var n=e.axis,r=e.ticks,s=e.offset,a=e.bandSize,o=e.entry,l=e.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=lc(o,n.dataKey,n.domain[l]);return Si(c)?null:n.scale(c)-a/2+s},aZt=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return s<=0&&a>=0?0:a<0?a:s}return r[0]},oZt=function(e,n){var r,s=(r=e.type)!==null&&r!==void 0&&r.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,a=s.stackId;if(oc(a)){var o=n[a];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},lZt=function(e){return e.reduce(function(n,r){return[XU(r.concat([n[0]]).filter(rs)),Ty(r.concat([n[1]]).filter(rs))]},[1/0,-1/0])},Xze=function(e,n,r){return Object.keys(e).reduce(function(s,a){var o=e[a],l=o.stackedData,c=l.reduce(function(u,d){var f=lZt(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},O6e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,M6e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,are=function(e,n,r){if(Ei(e))return e(n,r);if(!Array.isArray(e))return n;var s=[];if(rs(e[0]))s[0]=r?e[0]:Math.min(e[0],n[0]);else if(O6e.test(e[0])){var a=+O6e.exec(e[0])[1];s[0]=n[0]-a}else Ei(e[0])?s[0]=e[0](n[0]):s[0]=n[0];if(rs(e[1]))s[1]=r?e[1]:Math.max(e[1],n[1]);else if(M6e.test(e[1])){var o=+M6e.exec(e[1])[1];s[1]=n[1]+o}else Ei(e[1])?s[1]=e[1](n[1]):s[1]=n[1];return s},fD=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var s=e.scale.bandwidth();if(!r||s>0)return s}if(e&&n&&n.length>=2){for(var a=Cue(n,function(f){return f.coordinate}),o=1/0,l=1,c=a.length;l<c;l++){var u=a[l],d=a[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},R6e=function(e,n,r){return!e||!e.length||d5(e,dp(r,"type.defaultProps.domain"))?n:e},Qze=function(e,n){var r=e.type.defaultProps?al(al({},e.type.defaultProps),e.props):e.props,s=r.dataKey,a=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,u=r.chartType,d=r.hide;return al(al({},Ci(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:a||s,color:Yue(e),value:lc(n,s),type:c,payload:n,chartType:u,hide:d})};function rk(t){"@babel/helpers - typeof";return rk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rk(t)}function L6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function D6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L6e(Object(n),!0).forEach(function(r){cZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cZt(t,e,n){return e=uZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uZt(t){var e=dZt(t,"string");return rk(e)=="symbol"?e:e+""}function dZt(t,e){if(rk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(rk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var hD=Math.PI/180,fZt=function(e){return e*180/Math.PI},au=function(e,n,r,s){return{x:e+Math.cos(-hD*s)*r,y:n+Math.sin(-hD*s)*r}},hZt=function(e,n){var r=e.x,s=e.y,a=n.x,o=n.y;return Math.sqrt(Math.pow(r-a,2)+Math.pow(s-o,2))},pZt=function(e,n){var r=e.x,s=e.y,a=n.cx,o=n.cy,l=hZt({x:r,y:s},{x:a,y:o});if(l<=0)return{radius:l};var c=(r-a)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:fZt(u),angleInRadian:u}},mZt=function(e){var n=e.startAngle,r=e.endAngle,s=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(s,a);return{startAngle:n-o*360,endAngle:r-o*360}},xZt=function(e,n){var r=n.startAngle,s=n.endAngle,a=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(a,o);return e+l*360},B6e=function(e,n){var r=e.x,s=e.y,a=pZt({x:r,y:s},n),o=a.radius,l=a.angle,c=n.innerRadius,u=n.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=mZt(n),f=d.startAngle,x=d.endAngle,g=l,y;if(f<=x){for(;g>x;)g-=360;for(;g<f;)g+=360;y=g>=f&&g<=x}else{for(;g>f;)g-=360;for(;g<x;)g+=360;y=g>=x&&g<=f}return y?D6e(D6e({},n),{},{radius:o,angle:xZt(g,n)}):null};function sk(t){"@babel/helpers - typeof";return sk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sk(t)}var gZt=["offset"];function bZt(t){return CZt(t)||wZt(t)||vZt(t)||yZt()}function yZt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vZt(t,e){if(t){if(typeof t=="string")return ore(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ore(t,e)}}function wZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function CZt(t){if(Array.isArray(t))return ore(t)}function ore(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function SZt(t,e){if(t==null)return{};var n=NZt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function NZt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function $6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function tc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$6e(Object(n),!0).forEach(function(r){AZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AZt(t,e,n){return e=jZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jZt(t){var e=EZt(t,"string");return sk(e)=="symbol"?e:e+""}function EZt(t,e){if(sk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(sk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ik(){return ik=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ik.apply(this,arguments)}var _Zt=function(e){var n=e.value,r=e.formatter,s=Si(e.children)?n:e.children;return Ei(r)?r(s):s},kZt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),360);return r*s},TZt=function(e,n,r){var s=e.position,a=e.viewBox,o=e.offset,l=e.className,c=a,u=c.cx,d=c.cy,f=c.innerRadius,x=c.outerRadius,g=c.startAngle,y=c.endAngle,v=c.clockWise,C=(f+x)/2,N=kZt(g,y),P=N>=0?1:-1,T,M;s==="insideStart"?(T=g+P*o,M=v):s==="insideEnd"?(T=y-P*o,M=!v):s==="end"&&(T=y+P*o,M=v),M=N<=0?M:!M;var F=au(u,d,C,T),$=au(u,d,C,T+(M?1:-1)*359),L="M".concat(F.x,",").concat(F.y,`
A`).concat(C,",").concat(C,",0,1,").concat(M?0:1,`,
`).concat($.x,",").concat($.y),z=Si(e.id)?z5("recharts-radial-line-"):e.id;return Ne.createElement("text",ik({},r,{dominantBaseline:"central",className:la("recharts-radial-bar-label",l)}),Ne.createElement("defs",null,Ne.createElement("path",{id:z,d:L})),Ne.createElement("textPath",{xlinkHref:"#".concat(z)},n))},PZt=function(e){var n=e.viewBox,r=e.offset,s=e.position,a=n,o=a.cx,l=a.cy,c=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,x=(d+f)/2;if(s==="outside"){var g=au(o,l,u+r,x),y=g.x,v=g.y;return{x:y,y:v,textAnchor:y>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var C=(c+u)/2,N=au(o,l,C,x),P=N.x,T=N.y;return{x:P,y:T,textAnchor:"middle",verticalAnchor:"middle"}},IZt=function(e){var n=e.viewBox,r=e.parentViewBox,s=e.offset,a=e.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,x=f*s,g=f>0?"end":"start",y=f>0?"start":"end",v=u>=0?1:-1,C=v*s,N=v>0?"end":"start",P=v>0?"start":"end";if(a==="top"){var T={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:g};return tc(tc({},T),r?{height:Math.max(c-r.y,0),width:u}:{})}if(a==="bottom"){var M={x:l+u/2,y:c+d+x,textAnchor:"middle",verticalAnchor:y};return tc(tc({},M),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(a==="left"){var F={x:l-C,y:c+d/2,textAnchor:N,verticalAnchor:"middle"};return tc(tc({},F),r?{width:Math.max(F.x-r.x,0),height:d}:{})}if(a==="right"){var $={x:l+u+C,y:c+d/2,textAnchor:P,verticalAnchor:"middle"};return tc(tc({},$),r?{width:Math.max(r.x+r.width-$.x,0),height:d}:{})}var L=r?{width:u,height:d}:{};return a==="insideLeft"?tc({x:l+C,y:c+d/2,textAnchor:P,verticalAnchor:"middle"},L):a==="insideRight"?tc({x:l+u-C,y:c+d/2,textAnchor:N,verticalAnchor:"middle"},L):a==="insideTop"?tc({x:l+u/2,y:c+x,textAnchor:"middle",verticalAnchor:y},L):a==="insideBottom"?tc({x:l+u/2,y:c+d-x,textAnchor:"middle",verticalAnchor:g},L):a==="insideTopLeft"?tc({x:l+C,y:c+x,textAnchor:P,verticalAnchor:y},L):a==="insideTopRight"?tc({x:l+u-C,y:c+x,textAnchor:N,verticalAnchor:y},L):a==="insideBottomLeft"?tc({x:l+C,y:c+d-x,textAnchor:P,verticalAnchor:g},L):a==="insideBottomRight"?tc({x:l+u-C,y:c+d-x,textAnchor:N,verticalAnchor:g},L):Sj(a)&&(rs(a.x)||Cw(a.x))&&(rs(a.y)||Cw(a.y))?tc({x:l+u5(a.x,u),y:c+u5(a.y,d),textAnchor:"end",verticalAnchor:"end"},L):tc({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},L)},FZt=function(e){return"cx"in e&&rs(e.cx)};function Pu(t){var e=t.offset,n=e===void 0?5:e,r=SZt(t,gZt),s=tc({offset:n},r),a=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,x=s.textBreakAll;if(!a||Si(l)&&Si(c)&&!m.isValidElement(u)&&!Ei(u))return null;if(m.isValidElement(u))return m.cloneElement(u,s);var g;if(Ei(u)){if(g=m.createElement(u,s),m.isValidElement(g))return g}else g=_Zt(s);var y=FZt(a),v=Ci(s,!0);if(y&&(o==="insideStart"||o==="insideEnd"||o==="end"))return TZt(s,g,v);var C=y?PZt(s):IZt(s);return Ne.createElement(ZL,ik({className:la("recharts-label",f)},v,C,{breakAll:x}),g)}Pu.displayName="Label";var Zze=function(e){var n=e.cx,r=e.cy,s=e.angle,a=e.startAngle,o=e.endAngle,l=e.r,c=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,x=e.y,g=e.top,y=e.left,v=e.width,C=e.height,N=e.clockWise,P=e.labelViewBox;if(P)return P;if(rs(v)&&rs(C)){if(rs(f)&&rs(x))return{x:f,y:x,width:v,height:C};if(rs(g)&&rs(y))return{x:g,y,width:v,height:C}}return rs(f)&&rs(x)?{x:f,y:x,width:0,height:0}:rs(n)&&rs(r)?{cx:n,cy:r,startAngle:a||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:N}:e.viewBox?e.viewBox:{}},OZt=function(e,n){return e?e===!0?Ne.createElement(Pu,{key:"label-implicit",viewBox:n}):oc(e)?Ne.createElement(Pu,{key:"label-implicit",viewBox:n,value:e}):m.isValidElement(e)?e.type===Pu?m.cloneElement(e,{key:"label-implicit",viewBox:n}):Ne.createElement(Pu,{key:"label-implicit",content:e,viewBox:n}):Ei(e)?Ne.createElement(Pu,{key:"label-implicit",content:e,viewBox:n}):Sj(e)?Ne.createElement(Pu,ik({viewBox:n},e,{key:"label-implicit"})):null:null},MZt=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var s=e.children,a=Zze(e),o=hf(s,Pu).map(function(c,u){return m.cloneElement(c,{viewBox:n||a,key:"label-".concat(u)})});if(!r)return o;var l=OZt(e.label,n||a);return[l].concat(bZt(o))};Pu.parseViewBox=Zze;Pu.renderCallByParent=MZt;var pX,U6e;function RZt(){if(U6e)return pX;U6e=1;function t(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}return pX=t,pX}var LZt=RZt();const DZt=Ii(LZt);function ak(t){"@babel/helpers - typeof";return ak=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ak(t)}var BZt=["valueAccessor"],$Zt=["data","dataKey","clockWise","id","textBreakAll"];function UZt(t){return WZt(t)||VZt(t)||HZt(t)||zZt()}function zZt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HZt(t,e){if(t){if(typeof t=="string")return lre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lre(t,e)}}function VZt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function WZt(t){if(Array.isArray(t))return lre(t)}function lre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function pD(){return pD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pD.apply(this,arguments)}function z6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function H6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?z6e(Object(n),!0).forEach(function(r){qZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):z6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qZt(t,e,n){return e=GZt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GZt(t){var e=KZt(t,"string");return ak(e)=="symbol"?e:e+""}function KZt(t,e){if(ak(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ak(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V6e(t,e){if(t==null)return{};var n=YZt(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function YZt(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var XZt=function(e){return Array.isArray(e.value)?DZt(e.value):e.value};function Z0(t){var e=t.valueAccessor,n=e===void 0?XZt:e,r=V6e(t,BZt),s=r.data,a=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=V6e(r,$Zt);return!s||!s.length?null:Ne.createElement(Na,{className:"recharts-label-list"},s.map(function(d,f){var x=Si(a)?n(d,f):lc(d&&d.payload,a),g=Si(l)?{}:{id:"".concat(l,"-").concat(f)};return Ne.createElement(Pu,pD({},Ci(d,!0),u,g,{parentViewBox:d.parentViewBox,value:x,textBreakAll:c,viewBox:Pu.parseViewBox(Si(o)?d:H6e(H6e({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Z0.displayName="LabelList";function QZt(t,e){return t?t===!0?Ne.createElement(Z0,{key:"labelList-implicit",data:e}):Ne.isValidElement(t)||Ei(t)?Ne.createElement(Z0,{key:"labelList-implicit",data:e,content:t}):Sj(t)?Ne.createElement(Z0,pD({data:e},t,{key:"labelList-implicit"})):null:null}function ZZt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,s=hf(r,Z0).map(function(o,l){return m.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!n)return s;var a=QZt(t.label,e);return[a].concat(UZt(s))}Z0.renderCallByParent=ZZt;function ok(t){"@babel/helpers - typeof";return ok=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ok(t)}function cre(){return cre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cre.apply(this,arguments)}function W6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function q6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?W6e(Object(n),!0).forEach(function(r){JZt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):W6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JZt(t,e,n){return e=eJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eJt(t){var e=tJt(t,"string");return ok(e)=="symbol"?e:e+""}function tJt(t,e){if(ok(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ok(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nJt=function(e,n){var r=gm(n-e),s=Math.min(Math.abs(n-e),359.999);return r*s},yF=function(e){var n=e.cx,r=e.cy,s=e.radius,a=e.angle,o=e.sign,l=e.isExternal,c=e.cornerRadius,u=e.cornerIsExternal,d=c*(l?1:-1)+s,f=Math.asin(c/d)/hD,x=u?a:a+o*f,g=au(n,r,d,x),y=au(n,r,s,x),v=u?a-o*f:a,C=au(n,r,d*Math.cos(f*hD),v);return{center:g,circleTangency:y,lineTangency:C,theta:f}},Jze=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.startAngle,l=e.endAngle,c=nJt(o,l),u=o+c,d=au(n,r,a,o),f=au(n,r,a,u),x="M ".concat(d.x,",").concat(d.y,`
A `).concat(a,",").concat(a,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
`).concat(f.x,",").concat(f.y,`
`);if(s>0){var g=au(n,r,s,o),y=au(n,r,s,u);x+="L ".concat(y.x,",").concat(y.y,`
A `).concat(s,",").concat(s,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
`).concat(g.x,",").concat(g.y," Z")}else x+="L ".concat(n,",").concat(r," Z");return x},rJt=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=gm(d-u),x=yF({cx:n,cy:r,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),g=x.circleTangency,y=x.lineTangency,v=x.theta,C=yF({cx:n,cy:r,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),N=C.circleTangency,P=C.lineTangency,T=C.theta,M=c?Math.abs(u-d):Math.abs(u-d)-v-T;if(M<0)return l?"M ".concat(y.x,",").concat(y.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):Jze({cx:n,cy:r,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d});var F="M ".concat(y.x,",").concat(y.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(g.x,",").concat(g.y,`
A`).concat(a,",").concat(a,",0,").concat(+(M>180),",").concat(+(f<0),",").concat(N.x,",").concat(N.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,`
`);if(s>0){var $=yF({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),L=$.circleTangency,z=$.lineTangency,X=$.theta,ne=yF({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),J=ne.circleTangency,K=ne.lineTangency,te=ne.theta,fe=c?Math.abs(u-d):Math.abs(u-d)-X-te;if(fe<0&&o===0)return"".concat(F,"L").concat(n,",").concat(r,"Z");F+="L".concat(K.x,",").concat(K.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(J.x,",").concat(J.y,`
A`).concat(s,",").concat(s,",0,").concat(+(fe>180),",").concat(+(f>0),",").concat(L.x,",").concat(L.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(z.x,",").concat(z.y,"Z")}else F+="L".concat(n,",").concat(r,"Z");return F},sJt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},eHe=function(e){var n=q6e(q6e({},sJt),e),r=n.cx,s=n.cy,a=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,x=n.className;if(o<a||d===f)return null;var g=la("recharts-sector",x),y=o-a,v=u5(l,y,0,!0),C;return v>0&&Math.abs(d-f)<360?C=rJt({cx:r,cy:s,innerRadius:a,outerRadius:o,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):C=Jze({cx:r,cy:s,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),Ne.createElement("path",cre({},Ci(n,!0),{className:g,d:C,role:"img"}))};function lk(t){"@babel/helpers - typeof";return lk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lk(t)}function ure(){return ure=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ure.apply(this,arguments)}function G6e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function K6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?G6e(Object(n),!0).forEach(function(r){iJt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):G6e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iJt(t,e,n){return e=aJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aJt(t){var e=oJt(t,"string");return lk(e)=="symbol"?e:e+""}function oJt(t,e){if(lk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(lk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Y6e={curveBasisClosed:_Vt,curveBasisOpen:kVt,curveBasis:EVt,curveBumpX:hVt,curveBumpY:pVt,curveLinearClosed:TVt,curveLinear:DU,curveMonotoneX:PVt,curveMonotoneY:IVt,curveNatural:FVt,curveStep:OVt,curveStepAfter:RVt,curveStepBefore:MVt},vF=function(e){return e.x===+e.x&&e.y===+e.y},p7=function(e){return e.x},m7=function(e){return e.y},lJt=function(e,n){if(Ei(e))return e;var r="curve".concat(RU(e));return(r==="curveMonotone"||r==="curveBump")&&n?Y6e["".concat(r).concat(n==="vertical"?"Y":"X")]:Y6e[r]||DU},cJt=function(e){var n=e.type,r=n===void 0?"linear":n,s=e.points,a=s===void 0?[]:s,o=e.baseLine,l=e.layout,c=e.connectNulls,u=c===void 0?!1:c,d=lJt(r,l),f=u?a.filter(function(v){return vF(v)}):a,x;if(Array.isArray(o)){var g=u?o.filter(function(v){return vF(v)}):o,y=f.map(function(v,C){return K6e(K6e({},v),{},{base:g[C]})});return l==="vertical"?x=dF().y(m7).x1(p7).x0(function(v){return v.base.x}):x=dF().x(p7).y1(m7).y0(function(v){return v.base.y}),x.defined(vF).curve(d),x(y)}return l==="vertical"&&rs(o)?x=dF().y(m7).x1(p7).x0(o):rs(o)?x=dF().x(p7).y1(m7).y0(o):x=rUe().x(p7).y(m7),x.defined(vF).curve(d),x(f)},E3=function(e){var n=e.className,r=e.points,s=e.path,a=e.pathRef;if((!r||!r.length)&&!s)return null;var o=r&&r.length?cJt(e):s;return Ne.createElement("path",ure({},Ci(e,!1),UL(e),{className:la("recharts-curve",n),d:o,ref:a}))},uJt=_U();const Oa=Ii(uJt);var dJt=Object.getOwnPropertyNames,fJt=Object.getOwnPropertySymbols,hJt=Object.prototype.hasOwnProperty;function X6e(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function wF(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);var a=s.cache,o=a.get(n),l=a.get(r);if(o&&l)return o===r&&l===n;a.set(n,r),a.set(r,n);var c=t(n,r,s);return a.delete(n),a.delete(r),c}}function Q6e(t){return dJt(t).concat(fJt(t))}var pJt=Object.hasOwn||function(t,e){return hJt.call(t,e)};function W5(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var mJt="__v",xJt="__o",gJt="_owner",Z6e=Object.getOwnPropertyDescriptor,J6e=Object.keys;function bJt(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function yJt(t,e){return W5(t.getTime(),e.getTime())}function vJt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function wJt(t,e){return t===e}function eCe(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var s=new Array(r),a=t.entries(),o,l,c=0;(o=a.next())&&!o.done;){for(var u=e.entries(),d=!1,f=0;(l=u.next())&&!l.done;){if(s[f]){f++;continue}var x=o.value,g=l.value;if(n.equals(x[0],g[0],c,f,t,e,n)&&n.equals(x[1],g[1],x[0],g[0],t,e,n)){d=s[f]=!0;break}f++}if(!d)return!1;c++}return!0}var CJt=W5;function SJt(t,e,n){var r=J6e(t),s=r.length;if(J6e(e).length!==s)return!1;for(;s-- >0;)if(!tHe(t,e,n,r[s]))return!1;return!0}function x7(t,e,n){var r=Q6e(t),s=r.length;if(Q6e(e).length!==s)return!1;for(var a,o,l;s-- >0;)if(a=r[s],!tHe(t,e,n,a)||(o=Z6e(t,a),l=Z6e(e,a),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function NJt(t,e){return W5(t.valueOf(),e.valueOf())}function AJt(t,e){return t.source===e.source&&t.flags===e.flags}function tCe(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var s=new Array(r),a=t.values(),o,l;(o=a.next())&&!o.done;){for(var c=e.values(),u=!1,d=0;(l=c.next())&&!l.done;){if(!s[d]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1}return!0}function jJt(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function EJt(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function tHe(t,e,n,r){return(r===gJt||r===xJt||r===mJt)&&(t.$$typeof||e.$$typeof)?!0:pJt(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var _Jt="[object Arguments]",kJt="[object Boolean]",TJt="[object Date]",PJt="[object Error]",IJt="[object Map]",FJt="[object Number]",OJt="[object Object]",MJt="[object RegExp]",RJt="[object Set]",LJt="[object String]",DJt="[object URL]",BJt=Array.isArray,nCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,rCe=Object.assign,$Jt=Object.prototype.toString.call.bind(Object.prototype.toString);function UJt(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,s=t.areFunctionsEqual,a=t.areMapsEqual,o=t.areNumbersEqual,l=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,u=t.areRegExpsEqual,d=t.areSetsEqual,f=t.areTypedArraysEqual,x=t.areUrlsEqual;return function(y,v,C){if(y===v)return!0;if(y==null||v==null)return!1;var N=typeof y;if(N!==typeof v)return!1;if(N!=="object")return N==="number"?o(y,v,C):N==="function"?s(y,v,C):!1;var P=y.constructor;if(P!==v.constructor)return!1;if(P===Object)return l(y,v,C);if(BJt(y))return e(y,v,C);if(nCe!=null&&nCe(y))return f(y,v,C);if(P===Date)return n(y,v,C);if(P===RegExp)return u(y,v,C);if(P===Map)return a(y,v,C);if(P===Set)return d(y,v,C);var T=$Jt(y);return T===TJt?n(y,v,C):T===MJt?u(y,v,C):T===IJt?a(y,v,C):T===RJt?d(y,v,C):T===OJt?typeof y.then!="function"&&typeof v.then!="function"&&l(y,v,C):T===DJt?x(y,v,C):T===PJt?r(y,v,C):T===_Jt?l(y,v,C):T===kJt||T===FJt||T===LJt?c(y,v,C):!1}}function zJt(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,s={areArraysEqual:r?x7:bJt,areDatesEqual:yJt,areErrorsEqual:vJt,areFunctionsEqual:wJt,areMapsEqual:r?X6e(eCe,x7):eCe,areNumbersEqual:CJt,areObjectsEqual:r?x7:SJt,arePrimitiveWrappersEqual:NJt,areRegExpsEqual:AJt,areSetsEqual:r?X6e(tCe,x7):tCe,areTypedArraysEqual:r?x7:jJt,areUrlsEqual:EJt};if(n&&(s=rCe({},s,n(s))),e){var a=wF(s.areArraysEqual),o=wF(s.areMapsEqual),l=wF(s.areObjectsEqual),c=wF(s.areSetsEqual);s=rCe({},s,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function HJt(t){return function(e,n,r,s,a,o,l){return t(e,n,l)}}function VJt(t){var e=t.circular,n=t.comparator,r=t.createState,s=t.equals,a=t.strict;if(r)return function(c,u){var d=r(),f=d.cache,x=f===void 0?e?new WeakMap:void 0:f,g=d.meta;return n(c,u,{cache:x,equals:s,meta:g,strict:a})};if(e)return function(c,u){return n(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:a})};var o={cache:void 0,equals:s,meta:void 0,strict:a};return function(c,u){return n(c,u,o)}}var WJt=L2();L2({strict:!0});L2({circular:!0});L2({circular:!0,strict:!0});L2({createInternalComparator:function(){return W5}});L2({strict:!0,createInternalComparator:function(){return W5}});L2({circular:!0,createInternalComparator:function(){return W5}});L2({circular:!0,createInternalComparator:function(){return W5},strict:!0});function L2(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,s=t.createState,a=t.strict,o=a===void 0?!1:a,l=zJt(t),c=UJt(l),u=r?r(c):HJt(c);return VJt({circular:n,comparator:c,createState:s,equals:u,strict:o})}function qJt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function sCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(a){n<0&&(n=a),a-n>e?(t(a),n=-1):qJt(s)};requestAnimationFrame(r)}function dre(t){"@babel/helpers - typeof";return dre=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dre(t)}function GJt(t){return QJt(t)||XJt(t)||YJt(t)||KJt()}function KJt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YJt(t,e){if(t){if(typeof t=="string")return iCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iCe(t,e)}}function iCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function XJt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function QJt(t){if(Array.isArray(t))return t}function ZJt(){var t={},e=function(){return null},n=!1,r=function s(a){if(!n){if(Array.isArray(a)){if(!a.length)return;var o=a,l=GJt(o),c=l[0],u=l.slice(1);if(typeof c=="number"){sCe(s.bind(null,u),c);return}s(c),sCe(s.bind(null,u));return}dre(a)==="object"&&(t=a,e(t)),typeof a=="function"&&a()}};return{stop:function(){n=!0},start:function(a){n=!1,r(a)},subscribe:function(a){return e=a,function(){e=function(){return null}}}}}function ck(t){"@babel/helpers - typeof";return ck=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ck(t)}function aCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function oCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aCe(Object(n),!0).forEach(function(r){nHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nHe(t,e,n){return e=JJt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JJt(t){var e=een(t,"string");return ck(e)==="symbol"?e:String(e)}function een(t,e){if(ck(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ck(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ten=function(e,n){return[Object.keys(e),Object.keys(n)].reduce(function(r,s){return r.filter(function(a){return s.includes(a)})})},nen=function(e){return e},ren=function(e){return e.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},B9=function(e,n){return Object.keys(n).reduce(function(r,s){return oCe(oCe({},r),{},nHe({},s,e(s,n[s])))},{})},lCe=function(e,n,r){return e.map(function(s){return"".concat(ren(s)," ").concat(n,"ms ").concat(r)}).join(",")};function sen(t,e){return oen(t)||aen(t,e)||rHe(t,e)||ien()}function ien(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aen(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function oen(t){if(Array.isArray(t))return t}function len(t){return den(t)||uen(t)||rHe(t)||cen()}function cen(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rHe(t,e){if(t){if(typeof t=="string")return fre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fre(t,e)}}function uen(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function den(t){if(Array.isArray(t))return fre(t)}function fre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var mD=1e-4,sHe=function(e,n){return[0,3*e,3*n-6*e,3*e-3*n+1]},iHe=function(e,n){return e.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},cCe=function(e,n){return function(r){var s=sHe(e,n);return iHe(s,r)}},fen=function(e,n){return function(r){var s=sHe(e,n),a=[].concat(len(s.map(function(o,l){return o*l}).slice(1)),[0]);return iHe(a,r)}},uCe=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=n[0],a=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":s=0,a=0,o=1,l=1;break;case"ease":s=.25,a=.1,o=.25,l=1;break;case"ease-in":s=.42,a=0,o=1,l=1;break;case"ease-out":s=.42,a=0,o=.58,l=1;break;case"ease-in-out":s=0,a=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(C){return parseFloat(C)}),d=sen(u,4);s=d[0],a=d[1],o=d[2],l=d[3]}}}var f=cCe(s,o),x=cCe(a,l),g=fen(s,o),y=function(N){return N>1?1:N<0?0:N},v=function(N){for(var P=N>1?1:N,T=P,M=0;M<8;++M){var F=f(T)-P,$=g(T);if(Math.abs(F-P)<mD||$<mD)return x(T);T=y(T-F/$)}return x(T)};return v.isStepper=!1,v},hen=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,s=e.damping,a=s===void 0?8:s,o=e.dt,l=o===void 0?17:o,c=function(d,f,x){var g=-(d-f)*r,y=x*a,v=x+(g-y)*l/1e3,C=x*l/1e3+d;return Math.abs(C-f)<mD&&Math.abs(v)<mD?[f,0]:[C,v]};return c.isStepper=!0,c.dt=l,c},pen=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=n[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return uCe(s);case"spring":return hen();default:if(s.split("(")[0]==="cubic-bezier")return uCe(s)}return typeof s=="function"?s:null};function uk(t){"@babel/helpers - typeof";return uk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uk(t)}function dCe(t){return gen(t)||xen(t)||aHe(t)||men()}function men(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xen(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gen(t){if(Array.isArray(t))return pre(t)}function fCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Xc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fCe(Object(n),!0).forEach(function(r){hre(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hre(t,e,n){return e=ben(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ben(t){var e=yen(t,"string");return uk(e)==="symbol"?e:String(e)}function yen(t,e){if(uk(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(uk(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ven(t,e){return Sen(t)||Cen(t,e)||aHe(t,e)||wen()}function wen(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aHe(t,e){if(t){if(typeof t=="string")return pre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pre(t,e)}}function pre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Cen(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Sen(t){if(Array.isArray(t))return t}var xD=function(e,n,r){return e+(n-e)*r},mre=function(e){var n=e.from,r=e.to;return n!==r},Nen=function t(e,n,r){var s=B9(function(a,o){if(mre(o)){var l=e(o.from,o.to,o.velocity),c=ven(l,2),u=c[0],d=c[1];return Xc(Xc({},o),{},{from:u,velocity:d})}return o},n);return r<1?B9(function(a,o){return mre(o)?Xc(Xc({},o),{},{velocity:xD(o.velocity,s[a].velocity,r),from:xD(o.from,s[a].from,r)}):o},n):t(e,s,r-1)};const Aen=function(t,e,n,r,s){var a=ten(t,e),o=a.reduce(function(C,N){return Xc(Xc({},C),{},hre({},N,[t[N],e[N]]))},{}),l=a.reduce(function(C,N){return Xc(Xc({},C),{},hre({},N,{from:t[N],velocity:0,to:e[N]}))},{}),c=-1,u,d,f=function(){return null},x=function(){return B9(function(N,P){return P.from},l)},g=function(){return!Object.values(l).filter(mre).length},y=function(N){u||(u=N);var P=N-u,T=P/n.dt;l=Nen(n,l,T),s(Xc(Xc(Xc({},t),e),x())),u=N,g()||(c=requestAnimationFrame(f))},v=function(N){d||(d=N);var P=(N-d)/r,T=B9(function(F,$){return xD.apply(void 0,dCe($).concat([n(P)]))},o);if(s(Xc(Xc(Xc({},t),e),T)),P<1)c=requestAnimationFrame(f);else{var M=B9(function(F,$){return xD.apply(void 0,dCe($).concat([n(1)]))},o);s(Xc(Xc(Xc({},t),e),M))}};return f=n.isStepper?y:v,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function tA(t){"@babel/helpers - typeof";return tA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tA(t)}var jen=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function Een(t,e){if(t==null)return{};var n=_en(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _en(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,a;for(a=0;a<r.length;a++)s=r[a],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function mX(t){return Ien(t)||Pen(t)||Ten(t)||ken()}function ken(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ten(t,e){if(t){if(typeof t=="string")return xre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xre(t,e)}}function Pen(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ien(t){if(Array.isArray(t))return xre(t)}function xre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function hCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Up(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hCe(Object(n),!0).forEach(function(r){a9(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function a9(t,e,n){return e=oHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fen(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oen(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,oHe(r.key),r)}}function Men(t,e,n){return Oen(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function oHe(t){var e=Ren(t,"string");return tA(e)==="symbol"?e:String(e)}function Ren(t,e){if(tA(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(tA(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Len(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gre(t,e)}function gre(t,e){return gre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},gre(t,e)}function Den(t){var e=Ben();return function(){var r=gD(t),s;if(e){var a=gD(this).constructor;s=Reflect.construct(r,arguments,a)}else s=r.apply(this,arguments);return bre(this,s)}}function bre(t,e){if(e&&(tA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yre(t)}function yre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ben(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gD(t){return gD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gD(t)}var Pm=function(t){Len(n,t);var e=Den(n);function n(r,s){var a;Fen(this,n),a=e.call(this,r,s);var o=a.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,x=o.children,g=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(yre(a)),a.changeStyle=a.changeStyle.bind(yre(a)),!l||g<=0)return a.state={style:{}},typeof x=="function"&&(a.state={style:d}),bre(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof x=="function")return a.state={style:u},bre(a);a.state={style:c?a9({},c,u):u}}else a.state={style:{}};return a}return Men(n,[{key:"componentDidMount",value:function(){var s=this.props,a=s.isActive,o=s.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var a=this.props,o=a.isActive,l=a.canBegin,c=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,x=this.state.style;if(l){if(!o){var g={style:c?a9({},c,d):d};this.state&&x&&(c&&x[c]!==d||!c&&x!==d)&&this.setState(g);return}if(!(WJt(s.to,d)&&s.canBegin&&s.isActive)){var y=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||u?f:s.to;if(this.state&&x){var C={style:c?a9({},c,v):v};(c&&x[c]!==v||!c&&x!==v)&&this.setState(C)}this.runAnimation(Up(Up({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var a=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,x=s.onAnimationStart,g=Aen(o,l,pen(u),c,this.changeStyle),y=function(){a.stopJSAnimation=g()};this.manager.start([x,d,y,c,f])}},{key:"runStepAnimation",value:function(s){var a=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,x=f===void 0?0:f,g=function(v,C,N){if(N===0)return v;var P=C.duration,T=C.easing,M=T===void 0?"ease":T,F=C.style,$=C.properties,L=C.onAnimationEnd,z=N>0?o[N-1]:C,X=$||Object.keys(F);if(typeof M=="function"||M==="spring")return[].concat(mX(v),[a.runJSAnimation.bind(a,{from:z.style,to:F,duration:P,easing:M}),P]);var ne=lCe(X,P,M),J=Up(Up(Up({},z.style),F),{},{transition:ne});return[].concat(mX(v),[J,P,L]).filter(nen)};return this.manager.start([c].concat(mX(o.reduce(g,[d,Math.max(x,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=ZJt());var a=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,x=s.steps,g=s.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof u=="function"||typeof g=="function"||u==="spring"){this.runJSAnimation(s);return}if(x.length>1){this.runStepAnimation(s);return}var v=l?a9({},l,c):c,C=lCe(Object.keys(v),o,u);y.start([d,a,Up(Up({},v),{},{transition:C}),o,f])}},{key:"render",value:function(){var s=this.props,a=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=Een(s,jen),u=m.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!l||u===0||o<=0)return a;var f=function(g){var y=g.props,v=y.style,C=v===void 0?{}:v,N=y.className,P=m.cloneElement(g,Up(Up({},c),{},{style:Up(Up({},C),d),className:N}));return P};return u===1?f(m.Children.only(a)):Ne.createElement("div",null,m.Children.map(a,function(x){return f(x)}))}}]),n}(m.PureComponent);Pm.displayName="Animate";Pm.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Pm.propTypes={from:Oa.oneOfType([Oa.object,Oa.string]),to:Oa.oneOfType([Oa.object,Oa.string]),attributeName:Oa.string,duration:Oa.number,begin:Oa.number,easing:Oa.oneOfType([Oa.string,Oa.func]),steps:Oa.arrayOf(Oa.shape({duration:Oa.number.isRequired,style:Oa.object.isRequired,easing:Oa.oneOfType([Oa.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Oa.func]),properties:Oa.arrayOf("string"),onAnimationEnd:Oa.func})),children:Oa.oneOfType([Oa.node,Oa.func]),isActive:Oa.bool,canBegin:Oa.bool,onAnimationEnd:Oa.func,shouldReAnimate:Oa.bool,onAnimationStart:Oa.func,onAnimationReStart:Oa.func};function dk(t){"@babel/helpers - typeof";return dk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dk(t)}function bD(){return bD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bD.apply(this,arguments)}function $en(t,e){return Ven(t)||Hen(t,e)||zen(t,e)||Uen()}function Uen(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zen(t,e){if(t){if(typeof t=="string")return pCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pCe(t,e)}}function pCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Hen(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Ven(t){if(Array.isArray(t))return t}function mCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mCe(Object(n),!0).forEach(function(r){Wen(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wen(t,e,n){return e=qen(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qen(t){var e=Gen(t,"string");return dk(e)=="symbol"?e:e+""}function Gen(t,e){if(dk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(dk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gCe=function(e,n,r,s,a){var o=Math.min(Math.abs(r)/2,Math.abs(s)/2),l=s>=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],x=0,g=4;x<g;x++)f[x]=a[x]>o?o:a[x];d="M".concat(e,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+c*f[0],",").concat(n)),d+="L ".concat(e+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
`).concat(e+r,",").concat(n+l*f[1])),d+="L ".concat(e+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
`).concat(e+r-c*f[2],",").concat(n+s)),d+="L ".concat(e+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
`).concat(e,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&a===+a&&a>0){var y=Math.min(o,a);d="M ".concat(e,",").concat(n+l*y,`
A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(e+c*y,",").concat(n,`
L `).concat(e+r-c*y,",").concat(n,`
A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(e+r,",").concat(n+l*y,`
L `).concat(e+r,",").concat(n+s-l*y,`
A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(e+r-c*y,",").concat(n+s,`
L `).concat(e+c*y,",").concat(n+s,`
A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(e,",").concat(n+s-l*y," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},Ken=function(e,n){if(!e||!n)return!1;var r=e.x,s=e.y,a=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(a,a+l),d=Math.max(a,a+l),f=Math.min(o,o+c),x=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=x}return!1},Yen={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Xue=function(e){var n=xCe(xCe({},Yen),e),r=m.useRef(),s=m.useState(-1),a=$en(s,2),o=a[0],l=a[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var M=r.current.getTotalLength();M&&l(M)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,x=n.radius,g=n.className,y=n.animationEasing,v=n.animationDuration,C=n.animationBegin,N=n.isAnimationActive,P=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var T=la("recharts-rectangle",g);return P?Ne.createElement(Pm,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:v,animationEasing:y,isActive:P},function(M){var F=M.width,$=M.height,L=M.x,z=M.y;return Ne.createElement(Pm,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:C,duration:v,isActive:N,easing:y},Ne.createElement("path",bD({},Ci(n,!0),{className:T,d:gCe(L,z,F,$,x),ref:r})))}):Ne.createElement("path",bD({},Ci(n,!0),{className:T,d:gCe(c,u,d,f,x)}))};function vre(){return vre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vre.apply(this,arguments)}var JU=function(e){var n=e.cx,r=e.cy,s=e.r,a=e.className,o=la("recharts-dot",a);return n===+n&&r===+r&&s===+s?Ne.createElement("circle",vre({},Ci(e,!1),UL(e),{className:o,cx:n,cy:r,r:s})):null};function fk(t){"@babel/helpers - typeof";return fk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fk(t)}var Xen=["x","y","top","left","width","height","className"];function wre(){return wre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},wre.apply(this,arguments)}function bCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Qen(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bCe(Object(n),!0).forEach(function(r){Zen(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zen(t,e,n){return e=Jen(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jen(t){var e=etn(t,"string");return fk(e)=="symbol"?e:e+""}function etn(t,e){if(fk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(fk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ttn(t,e){if(t==null)return{};var n=ntn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ntn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var rtn=function(e,n,r,s,a,o){return"M".concat(e,",").concat(a,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},stn=function(e){var n=e.x,r=n===void 0?0:n,s=e.y,a=s===void 0?0:s,o=e.top,l=o===void 0?0:o,c=e.left,u=c===void 0?0:c,d=e.width,f=d===void 0?0:d,x=e.height,g=x===void 0?0:x,y=e.className,v=ttn(e,Xen),C=Qen({x:r,y:a,top:l,left:u,width:f,height:g},v);return!rs(r)||!rs(a)||!rs(f)||!rs(g)||!rs(l)||!rs(u)?null:Ne.createElement("path",wre({},Ci(C,!0),{className:la("recharts-cross",y),d:rtn(r,a,f,g,l,u)}))},xX,yCe;function itn(){if(yCe)return xX;yCe=1;var t=jUe(),e=t(Object.getPrototypeOf,Object);return xX=e,xX}var gX,vCe;function atn(){if(vCe)return gX;vCe=1;var t=U1(),e=itn(),n=z1(),r="[object Object]",s=Function.prototype,a=Object.prototype,o=s.toString,l=a.hasOwnProperty,c=o.call(Object);function u(d){if(!n(d)||t(d)!=r)return!1;var f=e(d);if(f===null)return!0;var x=l.call(f,"constructor")&&f.constructor;return typeof x=="function"&&x instanceof x&&o.call(x)==c}return gX=u,gX}var otn=atn();const ltn=Ii(otn);var bX,wCe;function ctn(){if(wCe)return bX;wCe=1;var t=U1(),e=z1(),n="[object Boolean]";function r(s){return s===!0||s===!1||e(s)&&t(s)==n}return bX=r,bX}var utn=ctn();const dtn=Ii(utn);function hk(t){"@babel/helpers - typeof";return hk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hk(t)}function yD(){return yD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yD.apply(this,arguments)}function ftn(t,e){return xtn(t)||mtn(t,e)||ptn(t,e)||htn()}function htn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ptn(t,e){if(t){if(typeof t=="string")return CCe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return CCe(t,e)}}function CCe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function mtn(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function xtn(t){if(Array.isArray(t))return t}function SCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function NCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SCe(Object(n),!0).forEach(function(r){gtn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gtn(t,e,n){return e=btn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function btn(t){var e=ytn(t,"string");return hk(e)=="symbol"?e:e+""}function ytn(t,e){if(hk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(hk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ACe=function(e,n,r,s,a){var o=r-s,l;return l="M ".concat(e,",").concat(n),l+="L ".concat(e+r,",").concat(n),l+="L ".concat(e+r-o/2,",").concat(n+a),l+="L ".concat(e+r-o/2-s,",").concat(n+a),l+="L ".concat(e,",").concat(n," Z"),l},vtn={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},wtn=function(e){var n=NCe(NCe({},vtn),e),r=m.useRef(),s=m.useState(-1),a=ftn(s,2),o=a[0],l=a[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var T=r.current.getTotalLength();T&&l(T)}catch{}},[]);var c=n.x,u=n.y,d=n.upperWidth,f=n.lowerWidth,x=n.height,g=n.className,y=n.animationEasing,v=n.animationDuration,C=n.animationBegin,N=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||x!==+x||d===0&&f===0||x===0)return null;var P=la("recharts-trapezoid",g);return N?Ne.createElement(Pm,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:x,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:x,x:c,y:u},duration:v,animationEasing:y,isActive:N},function(T){var M=T.upperWidth,F=T.lowerWidth,$=T.height,L=T.x,z=T.y;return Ne.createElement(Pm,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:C,duration:v,easing:y},Ne.createElement("path",yD({},Ci(n,!0),{className:P,d:ACe(L,z,M,F,$),ref:r})))}):Ne.createElement("g",null,Ne.createElement("path",yD({},Ci(n,!0),{className:P,d:ACe(c,u,d,f,x)})))},Ctn=["option","shapeType","propTransformer","activeClassName","isActive"];function pk(t){"@babel/helpers - typeof";return pk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pk(t)}function Stn(t,e){if(t==null)return{};var n=Ntn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ntn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function jCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jCe(Object(n),!0).forEach(function(r){Atn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Atn(t,e,n){return e=jtn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jtn(t){var e=Etn(t,"string");return pk(e)=="symbol"?e:e+""}function Etn(t,e){if(pk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(pk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _tn(t,e){return vD(vD({},e),t)}function ktn(t,e){return t==="symbols"}function ECe(t){var e=t.shapeType,n=t.elementProps;switch(e){case"rectangle":return Ne.createElement(Xue,n);case"trapezoid":return Ne.createElement(wtn,n);case"sector":return Ne.createElement(eHe,n);case"symbols":if(ktn(e))return Ne.createElement($U,n);break;default:return null}}function Ttn(t){return m.isValidElement(t)?t.props:t}function Cre(t){var e=t.option,n=t.shapeType,r=t.propTransformer,s=r===void 0?_tn:r,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,l=t.isActive,c=Stn(t,Ctn),u;if(m.isValidElement(e))u=m.cloneElement(e,vD(vD({},c),Ttn(e)));else if(Ei(e))u=e(c);else if(ltn(e)&&!dtn(e)){var d=s(e,c);u=Ne.createElement(ECe,{shapeType:n,elementProps:d})}else{var f=c;u=Ne.createElement(ECe,{shapeType:n,elementProps:f})}return l?Ne.createElement(Na,{className:o},u):u}function ez(t,e){return e!=null&&"trapezoids"in t.props}function tz(t,e){return e!=null&&"sectors"in t.props}function mk(t,e){return e!=null&&"points"in t.props}function Ptn(t,e){var n,r,s=t.x===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.x)||t.x===e.x,a=t.y===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.y)||t.y===e.y;return s&&a}function Itn(t,e){var n=t.endAngle===e.endAngle,r=t.startAngle===e.startAngle;return n&&r}function Ftn(t,e){var n=t.x===e.x,r=t.y===e.y,s=t.z===e.z;return n&&r&&s}function Otn(t,e){var n;return ez(t,e)?n=Ptn:tz(t,e)?n=Itn:mk(t,e)&&(n=Ftn),n}function Mtn(t,e){var n;return ez(t,e)?n="trapezoids":tz(t,e)?n="sectors":mk(t,e)&&(n="points"),n}function Rtn(t,e){if(ez(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(tz(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return mk(t,e)?e.payload:{}}function Ltn(t){var e=t.activeTooltipItem,n=t.graphicalItem,r=t.itemData,s=Mtn(n,e),a=Rtn(n,e),o=r.filter(function(c,u){var d=d5(a,c),f=n.props[s].filter(function(y){var v=Otn(n,e);return v(y,e)}),x=n.props[s].indexOf(f[f.length-1]),g=u===x;return d&&g}),l=r.indexOf(o[o.length-1]);return l}var yX,_Ce;function Dtn(){if(_Ce)return yX;_Ce=1;var t=Math.ceil,e=Math.max;function n(r,s,a,o){for(var l=-1,c=e(t((s-r)/(a||1)),0),u=Array(c);c--;)u[o?c:++l]=r,r+=a;return u}return yX=n,yX}var vX,kCe;function lHe(){if(kCe)return vX;kCe=1;var t=zUe(),e=1/0,n=17976931348623157e292;function r(s){if(!s)return s===0?s:0;if(s=t(s),s===e||s===-1/0){var a=s<0?-1:1;return a*n}return s===s?s:0}return vX=r,vX}var wX,TCe;function Btn(){if(TCe)return wX;TCe=1;var t=Dtn(),e=HU(),n=lHe();function r(s){return function(a,o,l){return l&&typeof l!="number"&&e(a,o,l)&&(o=l=void 0),a=n(a),o===void 0?(o=a,a=0):o=n(o),l=l===void 0?a<o?1:-1:n(l),t(a,o,l,s)}}return wX=r,wX}var CX,PCe;function $tn(){if(PCe)return CX;PCe=1;var t=Btn(),e=t();return CX=e,CX}var Utn=$tn();const wD=Ii(Utn);function xk(t){"@babel/helpers - typeof";return xk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xk(t)}function ICe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function FCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ICe(Object(n),!0).forEach(function(r){cHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ICe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function cHe(t,e,n){return e=ztn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ztn(t){var e=Htn(t,"string");return xk(e)=="symbol"?e:e+""}function Htn(t,e){if(xk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(xk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vtn=["Webkit","Moz","O","ms"],Wtn=function(e,n){var r=e.replace(/(\w)/,function(a){return a.toUpperCase()}),s=Vtn.reduce(function(a,o){return FCe(FCe({},a),{},cHe({},o+r,n))},{});return s[e]=n,s};function nA(t){"@babel/helpers - typeof";return nA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nA(t)}function CD(){return CD=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},CD.apply(this,arguments)}function OCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function SX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?OCe(Object(n),!0).forEach(function(r){$f(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):OCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qtn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MCe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dHe(r.key),r)}}function Gtn(t,e,n){return MCe(t.prototype,e),MCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ktn(t,e,n){return e=SD(e),Ytn(t,uHe()?Reflect.construct(e,n,SD(t).constructor):e.apply(t,n))}function Ytn(t,e){if(e&&(nA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xtn(t)}function Xtn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uHe=function(){return!!t})()}function SD(t){return SD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},SD(t)}function Qtn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sre(t,e)}function Sre(t,e){return Sre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Sre(t,e)}function $f(t,e,n){return e=dHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dHe(t){var e=Ztn(t,"string");return nA(e)=="symbol"?e:e+""}function Ztn(t,e){if(nA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(nA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Jtn=function(e){var n=e.data,r=e.startIndex,s=e.endIndex,a=e.x,o=e.width,l=e.travellerWidth;if(!n||!n.length)return{};var c=n.length,u=L9().domain(wD(0,c)).range([a,a+o-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(s),scale:u,scaleValues:d}},RCe=function(e){return e.changedTouches&&!!e.changedTouches.length},rA=function(t){function e(n){var r;return qtn(this,e),r=Ktn(this,e,[n]),$f(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),$f(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),$f(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,a=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:a,startIndex:l})}),r.detachDragEndListener()}),$f(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),$f(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),$f(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),$f(r,"handleSlideDragStart",function(s){var a=RCe(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return Qtn(e,t),Gtn(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,a=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,a),x=Math.max(s,a),g=e.getIndexInRange(o,f),y=e.getIndexInRange(o,x);return{startIndex:g-g%c,endIndex:y===d?d:y-y%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,a=s.data,o=s.tickFormatter,l=s.dataKey,c=lc(a[r],l,r);return Ei(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,a=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,x=c.startIndex,g=c.endIndex,y=c.onChange,v=r.pageX-a;v>0?v=Math.min(v,u+d-f-l,u+d-f-o):v<0&&(v=Math.max(v,u-o,u-l));var C=this.getIndex({startX:o+v,endX:l+v});(C.startIndex!==x||C.endIndex!==g)&&y&&y(C),this.setState({startX:o+v,endX:l+v,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var a=RCe(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,a=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,x=d.width,g=d.travellerWidth,y=d.onChange,v=d.gap,C=d.data,N={startX:this.state.startX,endX:this.state.endX},P=r.pageX-a;P>0?P=Math.min(P,f+x-g-u):P<0&&(P=Math.max(P,f-u)),N[o]=u+P;var T=this.getIndex(N),M=T.startIndex,F=T.endIndex,$=function(){var z=C.length-1;return o==="startX"&&(l>c?M%v===0:F%v===0)||l<c&&F===z||o==="endX"&&(l>c?F%v===0:M%v===0)||l>c&&F===z};this.setState($f($f({},o,u+P),"brushMoveStartX",r.pageX),function(){y&&$()&&y(T)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var a=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var x=f+r;if(!(x===-1||x>=l.length)){var g=l[x];s==="startX"&&g>=u||s==="endX"&&g<=c||this.setState($f({},s,g),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,a=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return Ne.createElement("rect",{stroke:u,fill:c,x:s,y:a,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,a=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=m.Children.only(u);return f?Ne.cloneElement(f,{x:s,y:a,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var a,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,x=c.traveller,g=c.ariaLabel,y=c.data,v=c.startIndex,C=c.endIndex,N=Math.max(r,this.props.x),P=SX(SX({},Ci(this.props,!1)),{},{x:N,y:u,width:d,height:f}),T=g||"Min value: ".concat((a=y[v])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=y[C])===null||o===void 0?void 0:o.name);return Ne.createElement(Na,{tabIndex:0,role:"slider","aria-label":T,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),l.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(x,P))}},{key:"renderSlide",value:function(r,s){var a=this.props,o=a.y,l=a.height,c=a.stroke,u=a.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return Ne.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,a=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,x=d.endX,g=5,y={pointerEvents:"none",fill:u};return Ne.createElement(Na,{className:"recharts-brush-texts"},Ne.createElement(ZL,CD({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,x)-g,y:o+l/2},y),this.getTextOfTick(s)),Ne.createElement(ZL,CD({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,x)+c+g,y:o+l/2},y),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,s=r.data,a=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,x=this.state,g=x.startX,y=x.endX,v=x.isTextActive,C=x.isSlideMoving,N=x.isTravellerMoving,P=x.isTravellerFocused;if(!s||!s.length||!rs(l)||!rs(c)||!rs(u)||!rs(d)||u<=0||d<=0)return null;var T=la("recharts-brush",a),M=Ne.Children.count(o)===1,F=Wtn("userSelect","none");return Ne.createElement(Na,{className:T,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),M&&this.renderPanorama(),this.renderSlide(g,y),this.renderTravellerLayer(g,"startX"),this.renderTravellerLayer(y,"endX"),(v||C||N||P||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,a=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(a+l/2)-1;return Ne.createElement(Ne.Fragment,null,Ne.createElement("rect",{x:s,y:a,width:o,height:l,fill:c,stroke:"none"}),Ne.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),Ne.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var a;return Ne.isValidElement(r)?a=Ne.cloneElement(r,s):Ei(r)?a=r(s):a=e.renderDefaultTraveller(s),a}},{key:"getDerivedStateFromProps",value:function(r,s){var a=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(a!==s.prevData||u!==s.prevUpdateId)return SX({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},a&&a.length?Jtn({data:a,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var x=s.scale.domain().map(function(g){return s.scale(g)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:x}}return null}},{key:"getIndexInRange",value:function(r,s){for(var a=r.length,o=0,l=a-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(m.PureComponent);$f(rA,"displayName","Brush");$f(rA,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var NX,LCe;function enn(){if(LCe)return NX;LCe=1;var t=wue();function e(n,r){var s;return t(n,function(a,o,l){return s=r(a,o,l),!s}),!!s}return NX=e,NX}var AX,DCe;function tnn(){if(DCe)return AX;DCe=1;var t=yUe(),e=O2(),n=enn(),r=wf(),s=HU();function a(o,l,c){var u=r(o)?t:n;return c&&s(o,l,c)&&(l=void 0),u(o,e(l,3))}return AX=a,AX}var nnn=tnn();const rnn=Ii(nnn);var J0=function(e,n){var r=e.alwaysShow,s=e.ifOverflow;return r&&(s="extendDomain"),s===n},jX,BCe;function snn(){if(BCe)return jX;BCe=1;var t=LUe();function e(n,r,s){r=="__proto__"&&t?t(n,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):n[r]=s}return jX=e,jX}var EX,$Ce;function inn(){if($Ce)return EX;$Ce=1;var t=snn(),e=MUe(),n=O2();function r(s,a){var o={};return a=n(a,3),e(s,function(l,c,u){t(o,c,a(l,c,u))}),o}return EX=r,EX}var ann=inn();const onn=Ii(ann);var _X,UCe;function lnn(){if(UCe)return _X;UCe=1;function t(e,n){for(var r=-1,s=e==null?0:e.length;++r<s;)if(!n(e[r],r,e))return!1;return!0}return _X=t,_X}var kX,zCe;function cnn(){if(zCe)return kX;zCe=1;var t=wue();function e(n,r){var s=!0;return t(n,function(a,o,l){return s=!!r(a,o,l),s}),s}return kX=e,kX}var TX,HCe;function unn(){if(HCe)return TX;HCe=1;var t=lnn(),e=cnn(),n=O2(),r=wf(),s=HU();function a(o,l,c){var u=r(o)?t:e;return c&&s(o,l,c)&&(l=void 0),u(o,n(l,3))}return TX=a,TX}var dnn=unn();const fHe=Ii(dnn);var fnn=["x","y"];function gk(t){"@babel/helpers - typeof";return gk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gk(t)}function Nre(){return Nre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Nre.apply(this,arguments)}function VCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function g7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?VCe(Object(n),!0).forEach(function(r){hnn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):VCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hnn(t,e,n){return e=pnn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pnn(t){var e=mnn(t,"string");return gk(e)=="symbol"?e:e+""}function mnn(t,e){if(gk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xnn(t,e){if(t==null)return{};var n=gnn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gnn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function bnn(t,e){var n=t.x,r=t.y,s=xnn(t,fnn),a="".concat(n),o=parseInt(a,10),l="".concat(r),c=parseInt(l,10),u="".concat(e.height||s.height),d=parseInt(u,10),f="".concat(e.width||s.width),x=parseInt(f,10);return g7(g7(g7(g7(g7({},e),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:x,name:e.name,radius:e.radius})}function WCe(t){return Ne.createElement(Cre,Nre({shapeType:"rectangle",propTransformer:bnn,activeClassName:"recharts-active-bar"},t))}var ynn=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof e=="number")return e;var a=typeof r=="number";return a?e(r,s):(a||h5(),n)}},vnn=["value","background"],hHe;function sA(t){"@babel/helpers - typeof";return sA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sA(t)}function wnn(t,e){if(t==null)return{};var n=Cnn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Cnn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function ND(){return ND=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ND.apply(this,arguments)}function qCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ll(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qCe(Object(n),!0).forEach(function(r){Py(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Snn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GCe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mHe(r.key),r)}}function Nnn(t,e,n){return GCe(t.prototype,e),GCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ann(t,e,n){return e=AD(e),jnn(t,pHe()?Reflect.construct(e,n,AD(t).constructor):e.apply(t,n))}function jnn(t,e){if(e&&(sA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Enn(t)}function Enn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pHe=function(){return!!t})()}function AD(t){return AD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},AD(t)}function _nn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Are(t,e)}function Are(t,e){return Are=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Are(t,e)}function Py(t,e,n){return e=mHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mHe(t){var e=knn(t,"string");return sA(e)=="symbol"?e:e+""}function knn(t,e){if(sA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(sA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tj=function(t){function e(){var n;Snn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Ann(this,e,[].concat(s)),Py(n,"state",{isAnimationFinished:!1}),Py(n,"id",z5("recharts-bar-")),Py(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),Py(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return _nn(e,t),Nnn(e,[{key:"renderRectanglesStatically",value:function(r){var s=this,a=this.props,o=a.shape,l=a.dataKey,c=a.activeIndex,u=a.activeBar,d=Ci(this.props,!1);return r&&r.map(function(f,x){var g=x===c,y=g?u:o,v=Ll(Ll(Ll({},d),f),{},{isActive:g,option:y,index:x,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return Ne.createElement(Na,ND({className:"recharts-bar-rectangle"},$_(s.props,f,x),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(x)}),Ne.createElement(WCe,v))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,s=this.props,a=s.data,o=s.layout,l=s.isAnimationActive,c=s.animationBegin,u=s.animationDuration,d=s.animationEasing,f=s.animationId,x=this.state.prevData;return Ne.createElement(Pm,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(g){var y=g.t,v=a.map(function(C,N){var P=x&&x[N];if(P){var T=Al(P.x,C.x),M=Al(P.y,C.y),F=Al(P.width,C.width),$=Al(P.height,C.height);return Ll(Ll({},C),{},{x:T(y),y:M(y),width:F(y),height:$(y)})}if(o==="horizontal"){var L=Al(0,C.height),z=L(y);return Ll(Ll({},C),{},{y:C.y+C.height-z,height:z})}var X=Al(0,C.width),ne=X(y);return Ll(Ll({},C),{},{width:ne})});return Ne.createElement(Na,null,r.renderRectanglesStatically(v))})}},{key:"renderRectangles",value:function(){var r=this.props,s=r.data,a=r.isAnimationActive,o=this.state.prevData;return a&&s&&s.length&&(!o||!d5(o,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var r=this,s=this.props,a=s.data,o=s.dataKey,l=s.activeIndex,c=Ci(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,x=wnn(u,vnn);if(!f)return null;var g=Ll(Ll(Ll(Ll(Ll({},x),{},{fill:"#eee"},f),c),$_(r.props,u,d)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return Ne.createElement(WCe,ND({key:"background-bar-".concat(d),option:r.props.background,isActive:d===l},g))})}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=hf(d,kj);if(!f)return null;var x=u==="vertical"?o[0].height/2:o[0].width/2,g=function(C,N){var P=Array.isArray(C.value)?C.value[1]:C.value;return{x:C.x,y:C.y,value:P,errorVal:lc(C,N)}},y={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Ne.createElement(Na,y,f.map(function(v){return Ne.cloneElement(v,{key:"error-bar-".concat(s,"-").concat(v.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:x,dataPointFormatter:g})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,a=r.data,o=r.className,l=r.xAxis,c=r.yAxis,u=r.left,d=r.top,f=r.width,x=r.height,g=r.isAnimationActive,y=r.background,v=r.id;if(s||!a||!a.length)return null;var C=this.state.isAnimationFinished,N=la("recharts-bar",o),P=l&&l.allowDataOverflow,T=c&&c.allowDataOverflow,M=P||T,F=Si(v)?this.id:v;return Ne.createElement(Na,{className:N},P||T?Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"clipPath-".concat(F)},Ne.createElement("rect",{x:P?u:u-f/2,y:T?d:d-x/2,width:P?f:f*2,height:T?x:x*2}))):null,Ne.createElement(Na,{className:"recharts-bar-rectangles",clipPath:M?"url(#clipPath-".concat(F,")"):null},y?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(M,F),(!g||C)&&Z0.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])}(m.PureComponent);hHe=Tj;Py(Tj,"displayName","Bar");Py(Tj,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Py(Tj,"getComposedData",function(t){var e=t.props,n=t.item,r=t.barPosition,s=t.bandSize,a=t.xAxis,o=t.yAxis,l=t.xAxisTicks,c=t.yAxisTicks,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,x=t.offset,g=ZQt(r,n);if(!g)return null;var y=e.layout,v=n.type.defaultProps,C=v!==void 0?Ll(Ll({},v),n.props):n.props,N=C.dataKey,P=C.children,T=C.minPointSize,M=y==="horizontal"?o:a,F=u?M.scale.domain():null,$=aZt({numericAxis:M}),L=hf(P,Nue),z=f.map(function(X,ne){var J,K,te,fe,q,se;u?J=JQt(u[d+ne],F):(J=lc(X,N),Array.isArray(J)||(J=[$,J]));var ae=ynn(T,hHe.defaultProps.minPointSize)(J[1],ne);if(y==="horizontal"){var W,V=[o.scale(J[0]),o.scale(J[1])],ee=V[0],oe=V[1];K=F6e({axis:a,ticks:l,bandSize:s,offset:g.offset,entry:X,index:ne}),te=(W=oe??ee)!==null&&W!==void 0?W:void 0,fe=g.size;var de=ee-oe;if(q=Number.isNaN(de)?0:de,se={x:K,y:o.y,width:fe,height:o.height},Math.abs(ae)>0&&Math.abs(q)<Math.abs(ae)){var Ce=gm(q||ae)*(Math.abs(ae)-Math.abs(q));te-=Ce,q+=Ce}}else{var me=[a.scale(J[0]),a.scale(J[1])],we=me[0],xe=me[1];if(K=we,te=F6e({axis:o,ticks:c,bandSize:s,offset:g.offset,entry:X,index:ne}),fe=xe-we,q=g.size,se={x:a.x,y:te,width:a.width,height:q},Math.abs(ae)>0&&Math.abs(fe)<Math.abs(ae)){var be=gm(fe||ae)*(Math.abs(ae)-Math.abs(fe));fe+=be}}return Ll(Ll(Ll({},X),{},{x:K,y:te,width:fe,height:q,value:u?J:J[1],payload:X,background:se},L[ne]&&L[ne].props),{},{tooltipPayload:[Qze(n,X)],tooltipPosition:{x:K+fe/2,y:te+q/2}})});return Ll({data:z,layout:y},x)});function bk(t){"@babel/helpers - typeof";return bk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bk(t)}function Tnn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function KCe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xHe(r.key),r)}}function Pnn(t,e,n){return KCe(t.prototype,e),KCe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function YCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function im(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?YCe(Object(n),!0).forEach(function(r){nz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):YCe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nz(t,e,n){return e=xHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xHe(t){var e=Inn(t,"string");return bk(e)=="symbol"?e:e+""}function Inn(t,e){if(bk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(bk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gHe=function(e,n,r,s,a){var o=e.width,l=e.height,c=e.layout,u=e.children,d=Object.keys(n),f={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},x=!!Wf(u,Tj);return d.reduce(function(g,y){var v=n[y],C=v.orientation,N=v.domain,P=v.padding,T=P===void 0?{}:P,M=v.mirror,F=v.reversed,$="".concat(C).concat(M?"Mirror":""),L,z,X,ne,J;if(v.type==="number"&&(v.padding==="gap"||v.padding==="no-gap")){var K=N[1]-N[0],te=1/0,fe=v.categoricalDomain.sort(DHt);if(fe.forEach(function(me,we){we>0&&(te=Math.min((me||0)-(fe[we-1]||0),te))}),Number.isFinite(te)){var q=te/K,se=v.layout==="vertical"?r.height:r.width;if(v.padding==="gap"&&(L=q*se/2),v.padding==="no-gap"){var ae=u5(e.barCategoryGap,q*se),W=q*se/2;L=W-ae-(W-ae)/se*ae}}}s==="xAxis"?z=[r.left+(T.left||0)+(L||0),r.left+r.width-(T.right||0)-(L||0)]:s==="yAxis"?z=c==="horizontal"?[r.top+r.height-(T.bottom||0),r.top+(T.top||0)]:[r.top+(T.top||0)+(L||0),r.top+r.height-(T.bottom||0)-(L||0)]:z=v.range,F&&(z=[z[1],z[0]]);var V=XQt(v,a,x),ee=V.scale,oe=V.realScaleType;ee.domain(N).range(z),QQt(ee);var de=iZt(ee,im(im({},v),{},{realScaleType:oe}));s==="xAxis"?(J=C==="top"&&!M||C==="bottom"&&M,X=r.left,ne=f[$]-J*v.height):s==="yAxis"&&(J=C==="left"&&!M||C==="right"&&M,X=f[$]-J*v.width,ne=r.top);var Ce=im(im(im({},v),de),{},{realScaleType:oe,x:X,y:ne,scale:ee,width:s==="xAxis"?r.width:v.width,height:s==="yAxis"?r.height:v.height});return Ce.bandSize=fD(Ce,de),!v.hide&&s==="xAxis"?f[$]+=(J?-1:1)*Ce.height:v.hide||(f[$]+=(J?-1:1)*Ce.width),im(im({},g),{},nz({},y,Ce))},{})},bHe=function(e,n){var r=e.x,s=e.y,a=n.x,o=n.y;return{x:Math.min(r,a),y:Math.min(s,o),width:Math.abs(a-r),height:Math.abs(o-s)}},Fnn=function(e){var n=e.x1,r=e.y1,s=e.x2,a=e.y2;return bHe({x:n,y:r},{x:s,y:a})},yHe=function(){function t(e){Tnn(this,t),this.scale=e}return Pnn(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,a=r.position;if(n!==void 0){if(a)switch(a){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],a=r[r.length-1];return s<=a?n>=s&&n<=a:n>=a&&n<=s}}],[{key:"create",value:function(n){return new t(n)}}])}();nz(yHe,"EPS",1e-4);var Que=function(e){var n=Object.keys(e).reduce(function(r,s){return im(im({},r),{},nz({},s,yHe.create(e[s])))},{});return im(im({},n),{},{apply:function(s){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,l=a.position;return onn(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return fHe(s,function(a,o){return n[o].isInRange(a)})}})};function Onn(t){return(t%180+180)%180}var Mnn=function(e){var n=e.width,r=e.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Onn(s),o=a*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},PX,XCe;function Rnn(){if(XCe)return PX;XCe=1;var t=O2(),e=YT(),n=UU();function r(s){return function(a,o,l){var c=Object(a);if(!e(a)){var u=t(o,3);a=n(a),o=function(f){return u(c[f],f,c)}}var d=s(a,o,l);return d>-1?c[u?a[d]:d]:void 0}}return PX=r,PX}var IX,QCe;function Lnn(){if(QCe)return IX;QCe=1;var t=lHe();function e(n){var r=t(n),s=r%1;return r===r?s?r-s:r:0}return IX=e,IX}var FX,ZCe;function Dnn(){if(ZCe)return FX;ZCe=1;var t=TUe(),e=O2(),n=Lnn(),r=Math.max;function s(a,o,l){var c=a==null?0:a.length;if(!c)return-1;var u=l==null?0:n(l);return u<0&&(u=r(c+u,0)),t(a,e(o,3),u)}return FX=s,FX}var OX,JCe;function Bnn(){if(JCe)return OX;JCe=1;var t=Rnn(),e=Dnn(),n=t(e);return OX=n,OX}var $nn=Bnn();const Unn=Ii($nn);var znn=W$e();const Hnn=Ii(znn);var Vnn=Hnn(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),Zue=m.createContext(void 0),Jue=m.createContext(void 0),vHe=m.createContext(void 0),wHe=m.createContext({}),CHe=m.createContext(void 0),SHe=m.createContext(0),NHe=m.createContext(0),e4e=function(e){var n=e.state,r=n.xAxisMap,s=n.yAxisMap,a=n.offset,o=e.clipPathId,l=e.children,c=e.width,u=e.height,d=Vnn(a);return Ne.createElement(Zue.Provider,{value:r},Ne.createElement(Jue.Provider,{value:s},Ne.createElement(wHe.Provider,{value:a},Ne.createElement(vHe.Provider,{value:d},Ne.createElement(CHe.Provider,{value:o},Ne.createElement(SHe.Provider,{value:u},Ne.createElement(NHe.Provider,{value:c},l)))))))},Wnn=function(){return m.useContext(CHe)},AHe=function(e){var n=m.useContext(Zue);n==null&&h5();var r=n[e];return r==null&&h5(),r},qnn=function(){var e=m.useContext(Zue);return Kb(e)},Gnn=function(){var e=m.useContext(Jue),n=Unn(e,function(r){return fHe(r.domain,Number.isFinite)});return n||Kb(e)},jHe=function(e){var n=m.useContext(Jue);n==null&&h5();var r=n[e];return r==null&&h5(),r},Knn=function(){var e=m.useContext(vHe);return e},Ynn=function(){return m.useContext(wHe)},ede=function(){return m.useContext(NHe)},tde=function(){return m.useContext(SHe)};function iA(t){"@babel/helpers - typeof";return iA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},iA(t)}function Xnn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qnn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_He(r.key),r)}}function Znn(t,e,n){return Qnn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jnn(t,e,n){return e=jD(e),ern(t,EHe()?Reflect.construct(e,n||[],jD(t).constructor):e.apply(t,n))}function ern(t,e){if(e&&(iA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return trn(t)}function trn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function EHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EHe=function(){return!!t})()}function jD(t){return jD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},jD(t)}function nrn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jre(t,e)}function jre(t,e){return jre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},jre(t,e)}function t4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function n4e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?t4e(Object(n),!0).forEach(function(r){nde(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):t4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nde(t,e,n){return e=_He(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _He(t){var e=rrn(t,"string");return iA(e)=="symbol"?e:e+""}function rrn(t,e){if(iA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(iA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function srn(t,e){return lrn(t)||orn(t,e)||arn(t,e)||irn()}function irn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function arn(t,e){if(t){if(typeof t=="string")return r4e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r4e(t,e)}}function r4e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function orn(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function lrn(t){if(Array.isArray(t))return t}function Ere(){return Ere=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ere.apply(this,arguments)}var crn=function(e,n){var r;return Ne.isValidElement(e)?r=Ne.cloneElement(e,n):Ei(e)?r=e(n):r=Ne.createElement("line",Ere({},n,{className:"recharts-reference-line-line"})),r},urn=function(e,n,r,s,a,o,l,c,u){var d=a.x,f=a.y,x=a.width,g=a.height;if(r){var y=u.y,v=e.y.apply(y,{position:o});if(J0(u,"discard")&&!e.y.isInRange(v))return null;var C=[{x:d+x,y:v},{x:d,y:v}];return c==="left"?C.reverse():C}if(n){var N=u.x,P=e.x.apply(N,{position:o});if(J0(u,"discard")&&!e.x.isInRange(P))return null;var T=[{x:P,y:f+g},{x:P,y:f}];return l==="top"?T.reverse():T}if(s){var M=u.segment,F=M.map(function($){return e.apply($,{position:o})});return J0(u,"discard")&&rnn(F,function($){return!e.isInRange($)})?null:F}return null};function drn(t){var e=t.x,n=t.y,r=t.segment,s=t.xAxisId,a=t.yAxisId,o=t.shape,l=t.className,c=t.alwaysShow,u=Wnn(),d=AHe(s),f=jHe(a),x=Knn();if(!u||!x)return null;l1(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var g=Que({x:d.scale,y:f.scale}),y=oc(e),v=oc(n),C=r&&r.length===2,N=urn(g,y,v,C,x,t.position,d.orientation,f.orientation,t);if(!N)return null;var P=srn(N,2),T=P[0],M=T.x,F=T.y,$=P[1],L=$.x,z=$.y,X=J0(t,"hidden")?"url(#".concat(u,")"):void 0,ne=n4e(n4e({clipPath:X},Ci(t,!0)),{},{x1:M,y1:F,x2:L,y2:z});return Ne.createElement(Na,{className:la("recharts-reference-line",l)},crn(o,ne),Pu.renderCallByParent(t,Fnn({x1:M,y1:F,x2:L,y2:z})))}var rde=function(t){function e(){return Xnn(this,e),Jnn(this,e,arguments)}return nrn(e,t),Znn(e,[{key:"render",value:function(){return Ne.createElement(drn,this.props)}}])}(Ne.Component);nde(rde,"displayName","ReferenceLine");nde(rde,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function _re(){return _re=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_re.apply(this,arguments)}function aA(t){"@babel/helpers - typeof";return aA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aA(t)}function s4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function i4e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?s4e(Object(n),!0).forEach(function(r){rz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function frn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hrn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,THe(r.key),r)}}function prn(t,e,n){return hrn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function mrn(t,e,n){return e=ED(e),xrn(t,kHe()?Reflect.construct(e,n||[],ED(t).constructor):e.apply(t,n))}function xrn(t,e){if(e&&(aA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return grn(t)}function grn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kHe=function(){return!!t})()}function ED(t){return ED=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ED(t)}function brn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&kre(t,e)}function kre(t,e){return kre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},kre(t,e)}function rz(t,e,n){return e=THe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function THe(t){var e=yrn(t,"string");return aA(e)=="symbol"?e:e+""}function yrn(t,e){if(aA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(aA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vrn=function(e){var n=e.x,r=e.y,s=e.xAxis,a=e.yAxis,o=Que({x:s.scale,y:a.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return J0(e,"discard")&&!o.isInRange(l)?null:l},sz=function(t){function e(){return frn(this,e),mrn(this,e,arguments)}return brn(e,t),prn(e,[{key:"render",value:function(){var r=this.props,s=r.x,a=r.y,o=r.r,l=r.alwaysShow,c=r.clipPathId,u=oc(s),d=oc(a);if(l1(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=vrn(this.props);if(!f)return null;var x=f.x,g=f.y,y=this.props,v=y.shape,C=y.className,N=J0(this.props,"hidden")?"url(#".concat(c,")"):void 0,P=i4e(i4e({clipPath:N},Ci(this.props,!0)),{},{cx:x,cy:g});return Ne.createElement(Na,{className:la("recharts-reference-dot",C)},e.renderDot(v,P),Pu.renderCallByParent(this.props,{x:x-o,y:g-o,width:2*o,height:2*o}))}}])}(Ne.Component);rz(sz,"displayName","ReferenceDot");rz(sz,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});rz(sz,"renderDot",function(t,e){var n;return Ne.isValidElement(t)?n=Ne.cloneElement(t,e):Ei(t)?n=t(e):n=Ne.createElement(JU,_re({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function Tre(){return Tre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tre.apply(this,arguments)}function oA(t){"@babel/helpers - typeof";return oA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oA(t)}function a4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function o4e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?a4e(Object(n),!0).forEach(function(r){iz(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wrn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Crn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,IHe(r.key),r)}}function Srn(t,e,n){return Crn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nrn(t,e,n){return e=_D(e),Arn(t,PHe()?Reflect.construct(e,n||[],_D(t).constructor):e.apply(t,n))}function Arn(t,e){if(e&&(oA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jrn(t)}function jrn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PHe=function(){return!!t})()}function _D(t){return _D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_D(t)}function Ern(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pre(t,e)}function Pre(t,e){return Pre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Pre(t,e)}function iz(t,e,n){return e=IHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IHe(t){var e=_rn(t,"string");return oA(e)=="symbol"?e:e+""}function _rn(t,e){if(oA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(oA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var krn=function(e,n,r,s,a){var o=a.x1,l=a.x2,c=a.y1,u=a.y2,d=a.xAxis,f=a.yAxis;if(!d||!f)return null;var x=Que({x:d.scale,y:f.scale}),g={x:e?x.x.apply(o,{position:"start"}):x.x.rangeMin,y:r?x.y.apply(c,{position:"start"}):x.y.rangeMin},y={x:n?x.x.apply(l,{position:"end"}):x.x.rangeMax,y:s?x.y.apply(u,{position:"end"}):x.y.rangeMax};return J0(a,"discard")&&(!x.isInRange(g)||!x.isInRange(y))?null:bHe(g,y)},az=function(t){function e(){return wrn(this,e),Nrn(this,e,arguments)}return Ern(e,t),Srn(e,[{key:"render",value:function(){var r=this.props,s=r.x1,a=r.x2,o=r.y1,l=r.y2,c=r.className,u=r.alwaysShow,d=r.clipPathId;l1(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=oc(s),x=oc(a),g=oc(o),y=oc(l),v=this.props.shape;if(!f&&!x&&!g&&!y&&!v)return null;var C=krn(f,x,g,y,this.props);if(!C&&!v)return null;var N=J0(this.props,"hidden")?"url(#".concat(d,")"):void 0;return Ne.createElement(Na,{className:la("recharts-reference-area",c)},e.renderRect(v,o4e(o4e({clipPath:N},Ci(this.props,!0)),C)),Pu.renderCallByParent(this.props,C))}}])}(Ne.Component);iz(az,"displayName","ReferenceArea");iz(az,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});iz(az,"renderRect",function(t,e){var n;return Ne.isValidElement(t)?n=Ne.cloneElement(t,e):Ei(t)?n=t(e):n=Ne.createElement(Xue,Tre({},e,{className:"recharts-reference-area-rect"})),n});function FHe(t,e,n){if(e<1)return[];if(e===1&&n===void 0)return t;for(var r=[],s=0;s<t.length;s+=e)r.push(t[s]);return r}function Trn(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return Mnn(r,n)}function Prn(t,e,n){var r=n==="width",s=t.x,a=t.y,o=t.width,l=t.height;return e===1?{start:r?s:a,end:r?s+o:a+l}:{start:r?s+o:a+l,end:r?s:a}}function kD(t,e,n,r,s){if(t*e<t*r||t*e>t*s)return!1;var a=n();return t*(e-t*a/2-r)>=0&&t*(e+t*a/2-s)<=0}function Irn(t,e){return FHe(t,e+1)}function Frn(t,e,n,r,s){for(var a=(r||[]).slice(),o=e.start,l=e.end,c=0,u=1,d=o,f=function(){var y=r==null?void 0:r[c];if(y===void 0)return{v:FHe(r,u)};var v=c,C,N=function(){return C===void 0&&(C=n(y,v)),C},P=y.coordinate,T=c===0||kD(t,P,N,d,l);T||(c=0,d=o,u+=1),T&&(d=P+t*(N()/2+s),c+=u)},x;u<=a.length;)if(x=f(),x)return x.v;return[]}function yk(t){"@babel/helpers - typeof";return yk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yk(t)}function l4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Eu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l4e(Object(n),!0).forEach(function(r){Orn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Orn(t,e,n){return e=Mrn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mrn(t){var e=Rrn(t,"string");return yk(e)=="symbol"?e:e+""}function Rrn(t,e){if(yk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(yk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Lrn(t,e,n,r,s){for(var a=(r||[]).slice(),o=a.length,l=e.start,c=e.end,u=function(x){var g=a[x],y,v=function(){return y===void 0&&(y=n(g,x)),y};if(x===o-1){var C=t*(g.coordinate+t*v()/2-c);a[x]=g=Eu(Eu({},g),{},{tickCoord:C>0?g.coordinate-C*t:g.coordinate})}else a[x]=g=Eu(Eu({},g),{},{tickCoord:g.coordinate});var N=kD(t,g.tickCoord,v,l,c);N&&(c=g.tickCoord-t*(v()/2+s),a[x]=Eu(Eu({},g),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return a}function Drn(t,e,n,r,s,a){var o=(r||[]).slice(),l=o.length,c=e.start,u=e.end;if(a){var d=r[l-1],f=n(d,l-1),x=t*(d.coordinate+t*f/2-u);o[l-1]=d=Eu(Eu({},d),{},{tickCoord:x>0?d.coordinate-x*t:d.coordinate});var g=kD(t,d.tickCoord,function(){return f},c,u);g&&(u=d.tickCoord-t*(f/2+s),o[l-1]=Eu(Eu({},d),{},{isShow:!0}))}for(var y=a?l-1:l,v=function(P){var T=o[P],M,F=function(){return M===void 0&&(M=n(T,P)),M};if(P===0){var $=t*(T.coordinate-t*F()/2-c);o[P]=T=Eu(Eu({},T),{},{tickCoord:$<0?T.coordinate-$*t:T.coordinate})}else o[P]=T=Eu(Eu({},T),{},{tickCoord:T.coordinate});var L=kD(t,T.tickCoord,F,c,u);L&&(c=T.tickCoord+t*(F()/2+s),o[P]=Eu(Eu({},T),{},{isShow:!0}))},C=0;C<y;C++)v(C);return o}function sde(t,e,n){var r=t.tick,s=t.ticks,a=t.viewBox,o=t.minTickGap,l=t.orientation,c=t.interval,u=t.tickFormatter,d=t.unit,f=t.angle;if(!s||!s.length||!r)return[];if(rs(c)||Sm.isSsr)return Irn(s,typeof c=="number"&&rs(c)?c:0);var x=[],g=l==="top"||l==="bottom"?"width":"height",y=d&&g==="width"?R9(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},v=function(T,M){var F=Ei(u)?u(T.value,M):T.value;return g==="width"?Trn(R9(F,{fontSize:e,letterSpacing:n}),y,f):R9(F,{fontSize:e,letterSpacing:n})[g]},C=s.length>=2?gm(s[1].coordinate-s[0].coordinate):1,N=Prn(a,C,g);return c==="equidistantPreserveStart"?Frn(C,N,v,s,o):(c==="preserveStart"||c==="preserveStartEnd"?x=Drn(C,N,v,s,o,c==="preserveStartEnd"):x=Lrn(C,N,v,s,o),x.filter(function(P){return P.isShow}))}var Brn=["viewBox"],$rn=["viewBox"],Urn=["ticks"];function lA(t){"@babel/helpers - typeof";return lA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lA(t)}function l4(){return l4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l4.apply(this,arguments)}function c4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ed(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c4e(Object(n),!0).forEach(function(r){ide(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MX(t,e){if(t==null)return{};var n=zrn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function zrn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Hrn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,MHe(r.key),r)}}function Vrn(t,e,n){return u4e(t.prototype,e),u4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wrn(t,e,n){return e=TD(e),qrn(t,OHe()?Reflect.construct(e,n,TD(t).constructor):e.apply(t,n))}function qrn(t,e){if(e&&(lA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Grn(t)}function Grn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OHe=function(){return!!t})()}function TD(t){return TD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},TD(t)}function Krn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ire(t,e)}function Ire(t,e){return Ire=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ire(t,e)}function ide(t,e,n){return e=MHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MHe(t){var e=Yrn(t,"string");return lA(e)=="symbol"?e:e+""}function Yrn(t,e){if(lA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(lA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Pj=function(t){function e(n){var r;return Hrn(this,e),r=Wrn(this,e,[n]),r.state={fontSize:"",letterSpacing:""},r}return Krn(e,t),Vrn(e,[{key:"shouldComponentUpdate",value:function(r,s){var a=r.viewBox,o=MX(r,Brn),l=this.props,c=l.viewBox,u=MX(l,$rn);return!R4(a,c)||!R4(o,u)||!R4(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,a=s.x,o=s.y,l=s.width,c=s.height,u=s.orientation,d=s.tickSize,f=s.mirror,x=s.tickMargin,g,y,v,C,N,P,T=f?-1:1,M=r.tickSize||d,F=rs(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":g=y=r.coordinate,C=o+ +!f*c,v=C-T*M,P=v-T*x,N=F;break;case"left":v=C=r.coordinate,y=a+ +!f*l,g=y-T*M,N=g-T*x,P=F;break;case"right":v=C=r.coordinate,y=a+ +f*l,g=y+T*M,N=g+T*x,P=F;break;default:g=y=r.coordinate,C=o+ +f*c,v=C+T*M,P=v+T*x,N=F;break}return{line:{x1:g,y1:v,x2:y,y2:C},tick:{x:N,y:P}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,s=r.orientation,a=r.mirror,o;switch(s){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,s=r.orientation,a=r.mirror,o="end";switch(s){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.x,a=r.y,o=r.width,l=r.height,c=r.orientation,u=r.mirror,d=r.axisLine,f=ed(ed(ed({},Ci(this.props,!1)),Ci(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var x=+(c==="top"&&!u||c==="bottom"&&u);f=ed(ed({},f),{},{x1:s,y1:a+x*l,x2:s+o,y2:a+x*l})}else{var g=+(c==="left"&&!u||c==="right"&&u);f=ed(ed({},f),{},{x1:s+g*o,y1:a,x2:s+g*o,y2:a+l})}return Ne.createElement("line",l4({},f,{className:la("recharts-cartesian-axis-line",dp(d,"className"))}))}},{key:"renderTicks",value:function(r,s,a){var o=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,x=l.unit,g=sde(ed(ed({},this.props),{},{ticks:r}),s,a),y=this.getTickTextAnchor(),v=this.getTickVerticalAnchor(),C=Ci(this.props,!1),N=Ci(d,!1),P=ed(ed({},C),{},{fill:"none"},Ci(c,!1)),T=g.map(function(M,F){var $=o.getTickLineCoord(M),L=$.line,z=$.tick,X=ed(ed(ed(ed({textAnchor:y,verticalAnchor:v},C),{},{stroke:"none",fill:u},N),z),{},{index:F,payload:M,visibleTicksCount:g.length,tickFormatter:f});return Ne.createElement(Na,l4({className:"recharts-cartesian-axis-tick",key:"tick-".concat(M.value,"-").concat(M.coordinate,"-").concat(M.tickCoord)},$_(o.props,M,F)),c&&Ne.createElement("line",l4({},P,L,{className:la("recharts-cartesian-axis-tick-line",dp(c,"className"))})),d&&e.renderTickItem(d,X,"".concat(Ei(f)?f(M.value,F):M.value).concat(x||"")))});return Ne.createElement("g",{className:"recharts-cartesian-axis-ticks"},T)}},{key:"render",value:function(){var r=this,s=this.props,a=s.axisLine,o=s.width,l=s.height,c=s.ticksGenerator,u=s.className,d=s.hide;if(d)return null;var f=this.props,x=f.ticks,g=MX(f,Urn),y=x;return Ei(c)&&(y=x&&x.length>0?c(this.props):c(g)),o<=0||l<=0||!y||!y.length?null:Ne.createElement(Na,{className:la("recharts-cartesian-axis",u),ref:function(C){r.layerReference=C}},a&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),Pu.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,a){var o;return Ne.isValidElement(r)?o=Ne.cloneElement(r,s):Ei(r)?o=r(s):o=Ne.createElement(ZL,l4({},s,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(m.Component);ide(Pj,"displayName","CartesianAxis");ide(Pj,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var Xrn=["x1","y1","x2","y2","key"],Qrn=["offset"];function p5(t){"@babel/helpers - typeof";return p5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p5(t)}function d4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Iu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?d4e(Object(n),!0).forEach(function(r){Zrn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Zrn(t,e,n){return e=Jrn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jrn(t){var e=esn(t,"string");return p5(e)=="symbol"?e:e+""}function esn(t,e){if(p5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(p5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Aw(){return Aw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Aw.apply(this,arguments)}function f4e(t,e){if(t==null)return{};var n=tsn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function tsn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var nsn=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,s=e.x,a=e.y,o=e.width,l=e.height,c=e.ry;return Ne.createElement("rect",{x:s,y:a,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function RHe(t,e){var n;if(Ne.isValidElement(t))n=Ne.cloneElement(t,e);else if(Ei(t))n=t(e);else{var r=e.x1,s=e.y1,a=e.x2,o=e.y2,l=e.key,c=f4e(e,Xrn),u=Ci(c,!1);u.offset;var d=f4e(u,Qrn);n=Ne.createElement("line",Aw({},d,{x1:r,y1:s,x2:a,y2:o,fill:"none",key:l}))}return n}function rsn(t){var e=t.x,n=t.width,r=t.horizontal,s=r===void 0?!0:r,a=t.horizontalPoints;if(!s||!a||!a.length)return null;var o=a.map(function(l,c){var u=Iu(Iu({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return RHe(s,u)});return Ne.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function ssn(t){var e=t.y,n=t.height,r=t.vertical,s=r===void 0?!0:r,a=t.verticalPoints;if(!s||!a||!a.length)return null;var o=a.map(function(l,c){var u=Iu(Iu({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return RHe(s,u)});return Ne.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function isn(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,s=t.y,a=t.width,o=t.height,l=t.horizontalPoints,c=t.horizontal,u=c===void 0?!0:c;if(!u||!e||!e.length)return null;var d=l.map(function(x){return Math.round(x+s-s)}).sort(function(x,g){return x-g});s!==d[0]&&d.unshift(0);var f=d.map(function(x,g){var y=!d[g+1],v=y?s+o-x:d[g+1]-x;if(v<=0)return null;var C=g%e.length;return Ne.createElement("rect",{key:"react-".concat(g),y:x,x:r,height:v,width:a,stroke:"none",fill:e[C],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return Ne.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function asn(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,s=t.fillOpacity,a=t.x,o=t.y,l=t.width,c=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(x){return Math.round(x+a-a)}).sort(function(x,g){return x-g});a!==d[0]&&d.unshift(0);var f=d.map(function(x,g){var y=!d[g+1],v=y?a+l-x:d[g+1]-x;if(v<=0)return null;var C=g%r.length;return Ne.createElement("rect",{key:"react-".concat(g),x,y:o,width:v,height:c,stroke:"none",fill:r[C],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return Ne.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var osn=function(e,n){var r=e.xAxis,s=e.width,a=e.height,o=e.offset;return Yze(sde(Iu(Iu(Iu({},Pj.defaultProps),r),{},{ticks:Yg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.left,o.left+o.width,n)},lsn=function(e,n){var r=e.yAxis,s=e.width,a=e.height,o=e.offset;return Yze(sde(Iu(Iu(Iu({},Pj.defaultProps),r),{},{ticks:Yg(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.top,o.top+o.height,n)},CC={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function LHe(t){var e,n,r,s,a,o,l=ede(),c=tde(),u=Ynn(),d=Iu(Iu({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:CC.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:CC.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:CC.horizontal,horizontalFill:(s=t.horizontalFill)!==null&&s!==void 0?s:CC.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:CC.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:CC.verticalFill,x:rs(t.x)?t.x:u.left,y:rs(t.y)?t.y:u.top,width:rs(t.width)?t.width:u.width,height:rs(t.height)?t.height:u.height}),f=d.x,x=d.y,g=d.width,y=d.height,v=d.syncWithTicks,C=d.horizontalValues,N=d.verticalValues,P=qnn(),T=Gnn();if(!rs(g)||g<=0||!rs(y)||y<=0||!rs(f)||f!==+f||!rs(x)||x!==+x)return null;var M=d.verticalCoordinatesGenerator||osn,F=d.horizontalCoordinatesGenerator||lsn,$=d.horizontalPoints,L=d.verticalPoints;if((!$||!$.length)&&Ei(F)){var z=C&&C.length,X=F({yAxis:T?Iu(Iu({},T),{},{ticks:z?C:T.ticks}):void 0,width:l,height:c,offset:u},z?!0:v);l1(Array.isArray(X),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(p5(X),"]")),Array.isArray(X)&&($=X)}if((!L||!L.length)&&Ei(M)){var ne=N&&N.length,J=M({xAxis:P?Iu(Iu({},P),{},{ticks:ne?N:P.ticks}):void 0,width:l,height:c,offset:u},ne?!0:v);l1(Array.isArray(J),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(p5(J),"]")),Array.isArray(J)&&(L=J)}return Ne.createElement("g",{className:"recharts-cartesian-grid"},Ne.createElement(nsn,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),Ne.createElement(rsn,Aw({},d,{offset:u,horizontalPoints:$,xAxis:P,yAxis:T})),Ne.createElement(ssn,Aw({},d,{offset:u,verticalPoints:L,xAxis:P,yAxis:T})),Ne.createElement(isn,Aw({},d,{horizontalPoints:$})),Ne.createElement(asn,Aw({},d,{verticalPoints:L})))}LHe.displayName="CartesianGrid";var csn=["type","layout","connectNulls","ref"],usn=["key"];function cA(t){"@babel/helpers - typeof";return cA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cA(t)}function h4e(t,e){if(t==null)return{};var n=dsn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dsn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function $9(){return $9=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$9.apply(this,arguments)}function p4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Lf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?p4e(Object(n),!0).forEach(function(r){am(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):p4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SC(t){return msn(t)||psn(t)||hsn(t)||fsn()}function fsn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hsn(t,e){if(t){if(typeof t=="string")return Fre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fre(t,e)}}function psn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function msn(t){if(Array.isArray(t))return Fre(t)}function Fre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function xsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,BHe(r.key),r)}}function gsn(t,e,n){return m4e(t.prototype,e),m4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bsn(t,e,n){return e=PD(e),ysn(t,DHe()?Reflect.construct(e,n,PD(t).constructor):e.apply(t,n))}function ysn(t,e){if(e&&(cA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vsn(t)}function vsn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function DHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DHe=function(){return!!t})()}function PD(t){return PD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},PD(t)}function wsn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ore(t,e)}function Ore(t,e){return Ore=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Ore(t,e)}function am(t,e,n){return e=BHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BHe(t){var e=Csn(t,"string");return cA(e)=="symbol"?e:e+""}function Csn(t,e){if(cA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(cA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $0=function(t){function e(){var n;xsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=bsn(this,e,[].concat(s)),am(n,"state",{isAnimationFinished:!0,totalLength:0}),am(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),am(n,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(N,P){return N+P});if(!u)return n.generateSimpleStrokeDasharray(l,o);for(var d=Math.floor(o/u),f=o%u,x=l-o,g=[],y=0,v=0;y<c.length;v+=c[y],++y)if(v+c[y]>f){g=[].concat(SC(c.slice(0,y)),[f-v]);break}var C=g.length%2===0?[0,x]:[x];return[].concat(SC(e.repeat(c,d)),SC(g),C).map(function(N){return"".concat(N,"px")}).join(", ")}),am(n,"id",z5("recharts-line-")),am(n,"pathRef",function(o){n.mainCurve=o}),am(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),am(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return wsn(e,t),gsn(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=hf(d,kj);if(!f)return null;var x=function(v,C){return{x:v.x,y:v.y,value:v.value,errorVal:lc(v.payload,C)}},g={clipPath:r?"url(#clipPath-".concat(s,")"):null};return Ne.createElement(Na,g,f.map(function(y){return Ne.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,dataPointFormatter:x})}))}},{key:"renderDots",value:function(r,s,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=Ci(this.props,!1),x=Ci(c,!0),g=u.map(function(v,C){var N=Lf(Lf(Lf({key:"dot-".concat(C),r:3},f),x),{},{index:C,cx:v.x,cy:v.y,value:v.value,dataKey:d,payload:v.payload,points:u});return e.renderDotItem(c,N)}),y={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return Ne.createElement(Na,$9({className:"recharts-line-dots",key:"dots"},y),g)}},{key:"renderCurveStatically",value:function(r,s,a,o){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=h4e(l,csn),x=Lf(Lf(Lf({},Ci(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(a,")"):null,points:r},o),{},{type:c,layout:u,connectNulls:d});return Ne.createElement(E3,$9({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var a=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,x=o.animationEasing,g=o.animationId,y=o.animateNewValues,v=o.width,C=o.height,N=this.state,P=N.prevPoints,T=N.totalLength;return Ne.createElement(Pm,{begin:d,duration:f,isActive:u,easing:x,from:{t:0},to:{t:1},key:"line-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(M){var F=M.t;if(P){var $=P.length/l.length,L=l.map(function(K,te){var fe=Math.floor(te*$);if(P[fe]){var q=P[fe],se=Al(q.x,K.x),ae=Al(q.y,K.y);return Lf(Lf({},K),{},{x:se(F),y:ae(F)})}if(y){var W=Al(v*2,K.x),V=Al(C/2,K.y);return Lf(Lf({},K),{},{x:W(F),y:V(F)})}return Lf(Lf({},K),{},{x:K.x,y:K.y})});return a.renderCurveStatically(L,r,s)}var z=Al(0,T),X=z(F),ne;if(c){var J="".concat(c).split(/[,\s]+/gim).map(function(K){return parseFloat(K)});ne=a.getStrokeDasharray(X,T,J)}else ne=a.generateSimpleStrokeDasharray(T,X);return a.renderCurveStatically(l,r,s,{strokeDasharray:ne})})}},{key:"renderCurve",value:function(r,s){var a=this.props,o=a.points,l=a.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&o&&o.length&&(!u&&d>0||!d5(u,o))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(o,r,s)}},{key:"render",value:function(){var r,s=this.props,a=s.hide,o=s.dot,l=s.points,c=s.className,u=s.xAxis,d=s.yAxis,f=s.top,x=s.left,g=s.width,y=s.height,v=s.isAnimationActive,C=s.id;if(a||!l||!l.length)return null;var N=this.state.isAnimationFinished,P=l.length===1,T=la("recharts-line",c),M=u&&u.allowDataOverflow,F=d&&d.allowDataOverflow,$=M||F,L=Si(C)?this.id:C,z=(r=Ci(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},X=z.r,ne=X===void 0?3:X,J=z.strokeWidth,K=J===void 0?2:J,te=X$e(o)?o:{},fe=te.clipDot,q=fe===void 0?!0:fe,se=ne*2+K;return Ne.createElement(Na,{className:T},M||F?Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"clipPath-".concat(L)},Ne.createElement("rect",{x:M?x:x-g/2,y:F?f:f-y/2,width:M?g:g*2,height:F?y:y*2})),!q&&Ne.createElement("clipPath",{id:"clipPath-dots-".concat(L)},Ne.createElement("rect",{x:x-se/2,y:f-se/2,width:g+se,height:y+se}))):null,!P&&this.renderCurve($,L),this.renderErrorBar($,L),(P||o)&&this.renderDots($,q,L),(!v||N)&&Z0.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var a=r.length%2!==0?[].concat(SC(r),[0]):r,o=[],l=0;l<s;++l)o=[].concat(SC(o),SC(a));return o}},{key:"renderDotItem",value:function(r,s){var a;if(Ne.isValidElement(r))a=Ne.cloneElement(r,s);else if(Ei(r))a=r(s);else{var o=s.key,l=h4e(s,usn),c=la("recharts-line-dot",typeof r!="boolean"?r.className:"");a=Ne.createElement(JU,$9({key:o},l,{className:c}))}return a}}])}(m.PureComponent);am($0,"displayName","Line");am($0,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Sm.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});am($0,"getComposedData",function(t){var e=t.props,n=t.xAxis,r=t.yAxis,s=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,l=t.bandSize,c=t.displayedData,u=t.offset,d=e.layout,f=c.map(function(x,g){var y=lc(x,o);return d==="horizontal"?{x:eA({axis:n,ticks:s,bandSize:l,entry:x,index:g}),y:Si(y)?null:r.scale(y),value:y,payload:x}:{x:Si(y)?null:n.scale(y),y:eA({axis:r,ticks:a,bandSize:l,entry:x,index:g}),value:y,payload:x}});return Lf({points:f,layout:d},u)});var Ssn=["layout","type","stroke","connectNulls","isRange","ref"],Nsn=["key"],$He;function uA(t){"@babel/helpers - typeof";return uA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uA(t)}function UHe(t,e){if(t==null)return{};var n=Asn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Asn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function jw(){return jw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jw.apply(this,arguments)}function x4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Bb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?x4e(Object(n),!0).forEach(function(r){U0(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,HHe(r.key),r)}}function Esn(t,e,n){return g4e(t.prototype,e),g4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _sn(t,e,n){return e=ID(e),ksn(t,zHe()?Reflect.construct(e,n,ID(t).constructor):e.apply(t,n))}function ksn(t,e){if(e&&(uA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tsn(t)}function Tsn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zHe=function(){return!!t})()}function ID(t){return ID=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ID(t)}function Psn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mre(t,e)}function Mre(t,e){return Mre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Mre(t,e)}function U0(t,e,n){return e=HHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HHe(t){var e=Isn(t,"string");return uA(e)=="symbol"?e:e+""}function Isn(t,e){if(uA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(uA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var q5=function(t){function e(){var n;jsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=_sn(this,e,[].concat(s)),U0(n,"state",{isAnimationFinished:!0}),U0(n,"id",z5("recharts-area-")),U0(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ei(o)&&o()}),U0(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ei(o)&&o()}),n}return Psn(e,t),Esn(e,[{key:"renderDots",value:function(r,s,a){var o=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(o&&!l)return null;var c=this.props,u=c.dot,d=c.points,f=c.dataKey,x=Ci(this.props,!1),g=Ci(u,!0),y=d.map(function(C,N){var P=Bb(Bb(Bb({key:"dot-".concat(N),r:3},x),g),{},{index:N,cx:C.x,cy:C.y,dataKey:f,value:C.value,payload:C.payload,points:d});return e.renderDotItem(u,P)}),v={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(a,")"):null};return Ne.createElement(Na,jw({className:"recharts-area-dots"},v),y)}},{key:"renderHorizontalRect",value:function(r){var s=this.props,a=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].x,u=o[o.length-1].x,d=r*Math.abs(c-u),f=Ty(o.map(function(x){return x.y||0}));return rs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Ty(a.map(function(x){return x.y||0})),f)),rs(f)?Ne.createElement("rect",{x:c<u?c:c-d,y:0,width:d,height:Math.floor(f+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var s=this.props,a=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].y,u=o[o.length-1].y,d=r*Math.abs(c-u),f=Ty(o.map(function(x){return x.x||0}));return rs(a)&&typeof a=="number"?f=Math.max(a,f):a&&Array.isArray(a)&&a.length&&(f=Math.max(Ty(a.map(function(x){return x.x||0})),f)),rs(f)?Ne.createElement("rect",{x:0,y:c<u?c:c-d,width:f+(l?parseInt("".concat(l),10):1),height:Math.floor(d)}):null}},{key:"renderClipRect",value:function(r){var s=this.props.layout;return s==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,s,a,o){var l=this.props,c=l.layout,u=l.type,d=l.stroke,f=l.connectNulls,x=l.isRange;l.ref;var g=UHe(l,Ssn);return Ne.createElement(Na,{clipPath:a?"url(#clipPath-".concat(o,")"):null},Ne.createElement(E3,jw({},Ci(g,!0),{points:r,connectNulls:f,type:u,baseLine:s,layout:c,stroke:"none",className:"recharts-area-area"})),d!=="none"&&Ne.createElement(E3,jw({},Ci(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:r})),d!=="none"&&x&&Ne.createElement(E3,jw({},Ci(this.props,!1),{className:"recharts-area-curve",layout:c,type:u,connectNulls:f,fill:"none",points:s})))}},{key:"renderAreaWithAnimation",value:function(r,s){var a=this,o=this.props,l=o.points,c=o.baseLine,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,x=o.animationEasing,g=o.animationId,y=this.state,v=y.prevPoints,C=y.prevBaseLine;return Ne.createElement(Pm,{begin:d,duration:f,isActive:u,easing:x,from:{t:0},to:{t:1},key:"area-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var P=N.t;if(v){var T=v.length/l.length,M=l.map(function(z,X){var ne=Math.floor(X*T);if(v[ne]){var J=v[ne],K=Al(J.x,z.x),te=Al(J.y,z.y);return Bb(Bb({},z),{},{x:K(P),y:te(P)})}return z}),F;if(rs(c)&&typeof c=="number"){var $=Al(C,c);F=$(P)}else if(Si(c)||Nj(c)){var L=Al(C,0);F=L(P)}else F=c.map(function(z,X){var ne=Math.floor(X*T);if(C[ne]){var J=C[ne],K=Al(J.x,z.x),te=Al(J.y,z.y);return Bb(Bb({},z),{},{x:K(P),y:te(P)})}return z});return a.renderAreaStatically(M,F,r,s)}return Ne.createElement(Na,null,Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"animationClipPath-".concat(s)},a.renderClipRect(P))),Ne.createElement(Na,{clipPath:"url(#animationClipPath-".concat(s,")")},a.renderAreaStatically(l,c,r,s)))})}},{key:"renderArea",value:function(r,s){var a=this.props,o=a.points,l=a.baseLine,c=a.isAnimationActive,u=this.state,d=u.prevPoints,f=u.prevBaseLine,x=u.totalLength;return c&&o&&o.length&&(!d&&x>0||!d5(d,o)||!d5(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,a=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,x=s.yAxis,g=s.width,y=s.height,v=s.isAnimationActive,C=s.id;if(a||!l||!l.length)return null;var N=this.state.isAnimationFinished,P=l.length===1,T=la("recharts-area",c),M=f&&f.allowDataOverflow,F=x&&x.allowDataOverflow,$=M||F,L=Si(C)?this.id:C,z=(r=Ci(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},X=z.r,ne=X===void 0?3:X,J=z.strokeWidth,K=J===void 0?2:J,te=X$e(o)?o:{},fe=te.clipDot,q=fe===void 0?!0:fe,se=ne*2+K;return Ne.createElement(Na,{className:T},M||F?Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"clipPath-".concat(L)},Ne.createElement("rect",{x:M?d:d-g/2,y:F?u:u-y/2,width:M?g:g*2,height:F?y:y*2})),!q&&Ne.createElement("clipPath",{id:"clipPath-dots-".concat(L)},Ne.createElement("rect",{x:d-se/2,y:u-se/2,width:g+se,height:y+se}))):null,P?null:this.renderArea($,L),(o||P)&&this.renderDots($,q,L),(!v||N)&&Z0.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(m.PureComponent);$He=q5;U0(q5,"displayName","Area");U0(q5,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});U0(q5,"getBaseValue",function(t,e,n,r){var s=t.layout,a=t.baseValue,o=e.props.baseValue,l=o??a;if(rs(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});U0(q5,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,s=t.yAxis,a=t.xAxisTicks,o=t.yAxisTicks,l=t.bandSize,c=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,x=t.offset,g=e.layout,y=u&&u.length,v=$He.getBaseValue(e,n,r,s),C=g==="horizontal",N=!1,P=f.map(function(M,F){var $;y?$=u[d+F]:($=lc(M,c),Array.isArray($)?N=!0:$=[v,$]);var L=$[1]==null||y&&lc(M,c)==null;return C?{x:eA({axis:r,ticks:a,bandSize:l,entry:M,index:F}),y:L?null:s.scale($[1]),value:$,payload:M}:{x:L?null:r.scale($[1]),y:eA({axis:s,ticks:o,bandSize:l,entry:M,index:F}),value:$,payload:M}}),T;return y||N?T=P.map(function(M){var F=Array.isArray(M.value)?M.value[0]:null;return C?{x:M.x,y:F!=null&&M.y!=null?s.scale(F):null}:{x:F!=null?r.scale(F):null,y:M.y}}):T=C?s.scale(v):r.scale(v),Bb({points:P,baseLine:T,layout:g,isRange:N},x)});U0(q5,"renderDotItem",function(t,e){var n;if(Ne.isValidElement(t))n=Ne.cloneElement(t,e);else if(Ei(t))n=t(e);else{var r=la("recharts-area-dot",typeof t!="boolean"?t.className:""),s=e.key,a=UHe(e,Nsn);n=Ne.createElement(JU,jw({},a,{key:s,className:r}))}return n});function dA(t){"@babel/helpers - typeof";return dA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dA(t)}function Fsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Osn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qHe(r.key),r)}}function Msn(t,e,n){return Osn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Rsn(t,e,n){return e=FD(e),Lsn(t,VHe()?Reflect.construct(e,n||[],FD(t).constructor):e.apply(t,n))}function Lsn(t,e){if(e&&(dA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dsn(t)}function Dsn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function VHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VHe=function(){return!!t})()}function FD(t){return FD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},FD(t)}function Bsn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rre(t,e)}function Rre(t,e){return Rre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Rre(t,e)}function WHe(t,e,n){return e=qHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qHe(t){var e=$sn(t,"string");return dA(e)=="symbol"?e:e+""}function $sn(t,e){if(dA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(dA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var oz=function(t){function e(){return Fsn(this,e),Rsn(this,e,arguments)}return Bsn(e,t),Msn(e,[{key:"render",value:function(){return null}}])}(Ne.Component);WHe(oz,"displayName","ZAxis");WHe(oz,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var Usn=["option","isActive"];function U9(){return U9=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},U9.apply(this,arguments)}function zsn(t,e){if(t==null)return{};var n=Hsn(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Hsn(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Vsn(t){var e=t.option,n=t.isActive,r=zsn(t,Usn);return typeof e=="string"?Ne.createElement(Cre,U9({option:Ne.createElement($U,U9({type:e},r)),isActive:n,shapeType:"symbols"},r)):Ne.createElement(Cre,U9({option:e,isActive:n,shapeType:"symbols"},r))}function fA(t){"@babel/helpers - typeof";return fA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fA(t)}function z9(){return z9=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},z9.apply(this,arguments)}function b4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?b4e(Object(n),!0).forEach(function(r){Iy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Wsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y4e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,KHe(r.key),r)}}function qsn(t,e,n){return y4e(t.prototype,e),y4e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Gsn(t,e,n){return e=OD(e),Ksn(t,GHe()?Reflect.construct(e,n,OD(t).constructor):e.apply(t,n))}function Ksn(t,e){if(e&&(fA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ysn(t)}function Ysn(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function GHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GHe=function(){return!!t})()}function OD(t){return OD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},OD(t)}function Xsn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lre(t,e)}function Lre(t,e){return Lre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Lre(t,e)}function Iy(t,e,n){return e=KHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function KHe(t){var e=Qsn(t,"string");return fA(e)=="symbol"?e:e+""}function Qsn(t,e){if(fA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(fA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lz=function(t){function e(){var n;Wsn(this,e);for(var r=arguments.length,s=new Array(r),a=0;a<r;a++)s[a]=arguments[a];return n=Gsn(this,e,[].concat(s)),Iy(n,"state",{isAnimationFinished:!1}),Iy(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0})}),Iy(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1})}),Iy(n,"id",z5("recharts-scatter-")),n}return Xsn(e,t),qsn(e,[{key:"renderSymbolsStatically",value:function(r){var s=this,a=this.props,o=a.shape,l=a.activeShape,c=a.activeIndex,u=Ci(this.props,!1);return r.map(function(d,f){var x=c===f,g=x?l:o,y=Vh(Vh({},u),d);return Ne.createElement(Na,z9({className:"recharts-scatter-symbol",key:"symbol-".concat(d==null?void 0:d.cx,"-").concat(d==null?void 0:d.cy,"-").concat(d==null?void 0:d.size,"-").concat(f)},$_(s.props,d,f),{role:"img"}),Ne.createElement(Vsn,z9({option:g,isActive:x,key:"symbol-".concat(f)},y)))})}},{key:"renderSymbolsWithAnimation",value:function(){var r=this,s=this.props,a=s.points,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,u=s.animationEasing,d=s.animationId,f=this.state.prevPoints;return Ne.createElement(Pm,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var g=x.t,y=a.map(function(v,C){var N=f&&f[C];if(N){var P=Al(N.cx,v.cx),T=Al(N.cy,v.cy),M=Al(N.size,v.size);return Vh(Vh({},v),{},{cx:P(g),cy:T(g),size:M(g)})}var F=Al(0,v.size);return Vh(Vh({},v),{},{size:F(g)})});return Ne.createElement(Na,null,r.renderSymbolsStatically(y))})}},{key:"renderSymbols",value:function(){var r=this.props,s=r.points,a=r.isAnimationActive,o=this.state.prevPoints;return a&&s&&s.length&&(!o||!d5(o,s))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(s)}},{key:"renderErrorBar",value:function(){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var s=this.props,a=s.points,o=s.xAxis,l=s.yAxis,c=s.children,u=hf(c,kj);return u?u.map(function(d,f){var x=d.props,g=x.direction,y=x.dataKey;return Ne.cloneElement(d,{key:"".concat(g,"-").concat(y,"-").concat(a[f]),data:a,xAxis:o,yAxis:l,layout:g==="x"?"vertical":"horizontal",dataPointFormatter:function(C,N){return{x:C.cx,y:C.cy,value:g==="x"?+C.node.x:+C.node.y,errorVal:lc(C,N)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,s=r.points,a=r.line,o=r.lineType,l=r.lineJointType,c=Ci(this.props,!1),u=Ci(a,!1),d,f;if(o==="joint")d=s.map(function(T){return{x:T.cx,y:T.cy}});else if(o==="fitting"){var x=LHt(s),g=x.xmin,y=x.xmax,v=x.a,C=x.b,N=function(M){return v*M+C};d=[{x:g,y:N(g)},{x:y,y:N(y)}]}var P=Vh(Vh(Vh({},c),{},{fill:"none",stroke:c&&c.fill},u),{},{points:d});return Ne.isValidElement(a)?f=Ne.cloneElement(a,P):Ei(a)?f=a(P):f=Ne.createElement(E3,z9({},P,{type:l})),Ne.createElement(Na,{className:"recharts-scatter-line",key:"recharts-scatter-line"},f)}},{key:"render",value:function(){var r=this.props,s=r.hide,a=r.points,o=r.line,l=r.className,c=r.xAxis,u=r.yAxis,d=r.left,f=r.top,x=r.width,g=r.height,y=r.id,v=r.isAnimationActive;if(s||!a||!a.length)return null;var C=this.state.isAnimationFinished,N=la("recharts-scatter",l),P=c&&c.allowDataOverflow,T=u&&u.allowDataOverflow,M=P||T,F=Si(y)?this.id:y;return Ne.createElement(Na,{className:N,clipPath:M?"url(#clipPath-".concat(F,")"):null},P||T?Ne.createElement("defs",null,Ne.createElement("clipPath",{id:"clipPath-".concat(F)},Ne.createElement("rect",{x:P?d:d-x/2,y:T?f:f-g/2,width:P?x:x*2,height:T?g:g*2}))):null,o&&this.renderLine(),this.renderErrorBar(),Ne.createElement(Na,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!v||C)&&Z0.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}}])}(m.PureComponent);Iy(lz,"displayName","Scatter");Iy(lz,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Sm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});Iy(lz,"getComposedData",function(t){var e=t.xAxis,n=t.yAxis,r=t.zAxis,s=t.item,a=t.displayedData,o=t.xAxisTicks,l=t.yAxisTicks,c=t.offset,u=s.props.tooltipType,d=hf(s.props.children,Nue),f=Si(e.dataKey)?s.props.dataKey:e.dataKey,x=Si(n.dataKey)?s.props.dataKey:n.dataKey,g=r&&r.dataKey,y=r?r.range:oz.defaultProps.range,v=y&&y[0],C=e.scale.bandwidth?e.scale.bandwidth():0,N=n.scale.bandwidth?n.scale.bandwidth():0,P=a.map(function(T,M){var F=lc(T,f),$=lc(T,x),L=!Si(g)&&lc(T,g)||"-",z=[{name:Si(e.dataKey)?s.props.name:e.name||e.dataKey,unit:e.unit||"",value:F,payload:T,dataKey:f,type:u},{name:Si(n.dataKey)?s.props.name:n.name||n.dataKey,unit:n.unit||"",value:$,payload:T,dataKey:x,type:u}];L!=="-"&&z.push({name:r.name||r.dataKey,unit:r.unit||"",value:L,payload:T,dataKey:g,type:u});var X=eA({axis:e,ticks:o,bandSize:C,entry:T,index:M,dataKey:f}),ne=eA({axis:n,ticks:l,bandSize:N,entry:T,index:M,dataKey:x}),J=L!=="-"?r.scale(L):v,K=Math.sqrt(Math.max(J,0)/Math.PI);return Vh(Vh({},T),{},{cx:X,cy:ne,x:X-K,y:ne-K,xAxis:e,yAxis:n,zAxis:r,width:2*K,height:2*K,size:J,node:{x:F,y:$,z:L},tooltipPayload:z,tooltipPosition:{x:X,y:ne},payload:T},d[M]&&d[M].props)});return Vh({points:P},c)});function hA(t){"@babel/helpers - typeof";return hA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hA(t)}function Zsn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Jsn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,QHe(r.key),r)}}function ein(t,e,n){return Jsn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function tin(t,e,n){return e=MD(e),nin(t,YHe()?Reflect.construct(e,n||[],MD(t).constructor):e.apply(t,n))}function nin(t,e){if(e&&(hA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rin(t)}function rin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function YHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YHe=function(){return!!t})()}function MD(t){return MD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},MD(t)}function sin(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dre(t,e)}function Dre(t,e){return Dre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Dre(t,e)}function XHe(t,e,n){return e=QHe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QHe(t){var e=iin(t,"string");return hA(e)=="symbol"?e:e+""}function iin(t,e){if(hA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(hA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bre(){return Bre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Bre.apply(this,arguments)}function ain(t){var e=t.xAxisId,n=ede(),r=tde(),s=AHe(e);return s==null?null:Ne.createElement(Pj,Bre({},s,{className:la("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return Yg(o,!0)}}))}var Ij=function(t){function e(){return Zsn(this,e),tin(this,e,arguments)}return sin(e,t),ein(e,[{key:"render",value:function(){return Ne.createElement(ain,this.props)}}])}(Ne.Component);XHe(Ij,"displayName","XAxis");XHe(Ij,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function pA(t){"@babel/helpers - typeof";return pA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pA(t)}function oin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lin(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,eVe(r.key),r)}}function cin(t,e,n){return lin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function uin(t,e,n){return e=RD(e),din(t,ZHe()?Reflect.construct(e,n||[],RD(t).constructor):e.apply(t,n))}function din(t,e){if(e&&(pA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fin(t)}function fin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ZHe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZHe=function(){return!!t})()}function RD(t){return RD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},RD(t)}function hin(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$re(t,e)}function $re(t,e){return $re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},$re(t,e)}function JHe(t,e,n){return e=eVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eVe(t){var e=pin(t,"string");return pA(e)=="symbol"?e:e+""}function pin(t,e){if(pA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(pA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ure(){return Ure=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ure.apply(this,arguments)}var min=function(e){var n=e.yAxisId,r=ede(),s=tde(),a=jHe(n);return a==null?null:Ne.createElement(Pj,Ure({},a,{className:la("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(l){return Yg(l,!0)}}))},Fj=function(t){function e(){return oin(this,e),uin(this,e,arguments)}return hin(e,t),cin(e,[{key:"render",value:function(){return Ne.createElement(min,this.props)}}])}(Ne.Component);JHe(Fj,"displayName","YAxis");JHe(Fj,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function v4e(t){return yin(t)||bin(t)||gin(t)||xin()}function xin(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gin(t,e){if(t){if(typeof t=="string")return zre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zre(t,e)}}function bin(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function yin(t){if(Array.isArray(t))return zre(t)}function zre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Hre=function(e,n,r,s,a){var o=hf(e,rde),l=hf(e,sz),c=[].concat(v4e(o),v4e(l)),u=hf(e,az),d="".concat(s,"Id"),f=s[0],x=n;if(c.length&&(x=c.reduce(function(v,C){if(C.props[d]===r&&J0(C.props,"extendDomain")&&rs(C.props[f])){var N=C.props[f];return[Math.min(v[0],N),Math.max(v[1],N)]}return v},x)),u.length){var g="".concat(f,"1"),y="".concat(f,"2");x=u.reduce(function(v,C){if(C.props[d]===r&&J0(C.props,"extendDomain")&&rs(C.props[g])&&rs(C.props[y])){var N=C.props[g],P=C.props[y];return[Math.min(v[0],N,P),Math.max(v[1],N,P)]}return v},x)}return a&&a.length&&(x=a.reduce(function(v,C){return rs(C)?[Math.min(v[0],C),Math.max(v[1],C)]:v},x)),x},RX={exports:{}},w4e;function vin(){return w4e||(w4e=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,x){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new s(d,f||c,x),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],g]:c._events[y].push(g):(c._events[y]=g,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)e.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var x=0,g=f.length,y=new Array(g);x<g;x++)y[x]=f[x].fn;return y},l.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,x,g,y){var v=n?n+u:u;if(!this._events[v])return!1;var C=this._events[v],N=arguments.length,P,T;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),N){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,f),!0;case 4:return C.fn.call(C.context,d,f,x),!0;case 5:return C.fn.call(C.context,d,f,x,g),!0;case 6:return C.fn.call(C.context,d,f,x,g,y),!0}for(T=1,P=new Array(N-1);T<N;T++)P[T-1]=arguments[T];C.fn.apply(C.context,P)}else{var M=C.length,F;for(T=0;T<M;T++)switch(C[T].once&&this.removeListener(u,C[T].fn,void 0,!0),N){case 1:C[T].fn.call(C[T].context);break;case 2:C[T].fn.call(C[T].context,d);break;case 3:C[T].fn.call(C[T].context,d,f);break;case 4:C[T].fn.call(C[T].context,d,f,x);break;default:if(!P)for(F=1,P=new Array(N-1);F<N;F++)P[F-1]=arguments[F];C[T].fn.apply(C[T].context,P)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,x){var g=n?n+u:u;if(!this._events[g])return this;if(!d)return o(this,g),this;var y=this._events[g];if(y.fn)y.fn===d&&(!x||y.once)&&(!f||y.context===f)&&o(this,g);else{for(var v=0,C=[],N=y.length;v<N;v++)(y[v].fn!==d||x&&!y[v].once||f&&y[v].context!==f)&&C.push(y[v]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(RX)),RX.exports}var win=vin();const Cin=Ii(win);var LX=new Cin,DX="recharts.syncMouseEvents";function vk(t){"@babel/helpers - typeof";return vk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vk(t)}function Sin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Nin(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tVe(r.key),r)}}function Ain(t,e,n){return Nin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function BX(t,e,n){return e=tVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tVe(t){var e=jin(t,"string");return vk(e)=="symbol"?e:e+""}function jin(t,e){if(vk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(vk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Ein=function(){function t(){Sin(this,t),BX(this,"activeIndex",0),BX(this,"coordinateList",[]),BX(this,"layout","horizontal")}return Ain(t,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,a=s===void 0?null:s,o=n.container,l=o===void 0?null:o,c=n.layout,u=c===void 0?null:c,d=n.offset,f=d===void 0?null:d,x=n.mouseHandlerCallback,g=x===void 0?null:x;this.coordinateList=(r=a??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=g??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),a=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,u=((n=window)===null||n===void 0?void 0:n.scrollX)||0,d=((r=window)===null||r===void 0?void 0:r.scrollY)||0,f=a+c+u,x=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:x})}}}])}();function _in(t,e,n){if(n==="number"&&e===!0&&Array.isArray(t)){var r=t==null?void 0:t[0],s=t==null?void 0:t[1];if(r&&s&&rs(r)&&rs(s))return!0}return!1}function kin(t,e,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-s:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-s,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function nVe(t){var e=t.cx,n=t.cy,r=t.radius,s=t.startAngle,a=t.endAngle,o=au(e,n,r,s),l=au(e,n,r,a);return{points:[o,l],cx:e,cy:n,radius:r,startAngle:s,endAngle:a}}function Tin(t,e,n){var r,s,a,o;if(t==="horizontal")r=e.x,a=r,s=n.top,o=n.top+n.height;else if(t==="vertical")s=e.y,o=s,r=n.left,a=n.left+n.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var l=e.cx,c=e.cy,u=e.innerRadius,d=e.outerRadius,f=e.angle,x=au(l,c,u,f),g=au(l,c,d,f);r=x.x,s=x.y,a=g.x,o=g.y}else return nVe(e);return[{x:r,y:s},{x:a,y:o}]}function wk(t){"@babel/helpers - typeof";return wk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wk(t)}function C4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function CF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?C4e(Object(n),!0).forEach(function(r){Pin(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Pin(t,e,n){return e=Iin(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Iin(t){var e=Fin(t,"string");return wk(e)=="symbol"?e:e+""}function Fin(t,e){if(wk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(wk(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oin(t){var e,n,r=t.element,s=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,l=t.activePayload,c=t.offset,u=t.activeTooltipIndex,d=t.tooltipAxisBandSize,f=t.layout,x=t.chartName,g=(e=r.props.cursor)!==null&&e!==void 0?e:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!g||!a||!o||x!=="ScatterChart"&&s!=="axis")return null;var y,v=E3;if(x==="ScatterChart")y=o,v=stn;else if(x==="BarChart")y=kin(f,o,c,d),v=Xue;else if(f==="radial"){var C=nVe(o),N=C.cx,P=C.cy,T=C.radius,M=C.startAngle,F=C.endAngle;y={cx:N,cy:P,startAngle:M,endAngle:F,innerRadius:T,outerRadius:T},v=eHe}else y={points:Tin(f,o,c)},v=E3;var $=CF(CF(CF(CF({stroke:"#ccc",pointerEvents:"none"},c),y),Ci(g,!1)),{},{payload:l,payloadIndex:u,className:la("recharts-tooltip-cursor",g.className)});return m.isValidElement(g)?m.cloneElement(g,$):m.createElement(v,$)}var Min=["item"],Rin=["children","className","width","height","style","compact","title","desc"];function mA(t){"@babel/helpers - typeof";return mA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mA(t)}function c4(){return c4=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c4.apply(this,arguments)}function S4e(t,e){return Bin(t)||Din(t,e)||sVe(t,e)||Lin()}function Lin(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Din(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,a,o,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e!==0)for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,s=d}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Bin(t){if(Array.isArray(t))return t}function N4e(t,e){if(t==null)return{};var n=$in(t,e),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(s=0;s<a.length;s++)r=a[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $in(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Uin(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zin(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iVe(r.key),r)}}function Hin(t,e,n){return zin(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vin(t,e,n){return e=LD(e),Win(t,rVe()?Reflect.construct(e,n,LD(t).constructor):e.apply(t,n))}function Win(t,e){if(e&&(mA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qin(t)}function qin(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rVe=function(){return!!t})()}function LD(t){return LD=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},LD(t)}function Gin(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vre(t,e)}function Vre(t,e){return Vre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Vre(t,e)}function xA(t){return Xin(t)||Yin(t)||sVe(t)||Kin()}function Kin(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sVe(t,e){if(t){if(typeof t=="string")return Wre(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wre(t,e)}}function Yin(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Xin(t){if(Array.isArray(t))return Wre(t)}function Wre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function A4e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?A4e(Object(n),!0).forEach(function(r){ni(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A4e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ni(t,e,n){return e=iVe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iVe(t){var e=Qin(t,"string");return mA(e)=="symbol"?e:e+""}function Qin(t,e){if(mA(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(mA(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Zin={xAxis:["bottom","top"],yAxis:["left","right"]},Jin={width:"100%",height:"100%"},aVe={x:0,y:0};function SF(t){return t}var ean=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},tan=function(e,n,r,s){var a=n.find(function(d){return d&&d.index===r});if(a){if(e==="horizontal")return{x:a.coordinate,y:s.y};if(e==="vertical")return{x:s.x,y:a.coordinate};if(e==="centric"){var o=a.coordinate,l=s.radius;return Ar(Ar(Ar({},s),au(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=a.coordinate,u=s.angle;return Ar(Ar(Ar({},s),au(s.cx,s.cy,c,u)),{},{angle:u,radius:c})}return aVe},cz=function(e,n){var r=n.graphicalItems,s=n.dataStartIndex,a=n.dataEndIndex,o=(r??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(xA(l),xA(u)):l},[]);return o.length>0?o:e&&e.length&&rs(s)&&rs(a)?e.slice(s,a+1):[]};function oVe(t){return t==="number"?[0,"auto"]:void 0}var qre=function(e,n,r,s){var a=e.graphicalItems,o=e.tooltipAxis,l=cz(n,e);return r<0||!a||!a.length||r>=l.length?null:a.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var x;if(o.dataKey&&!o.allowDuplicatedCategory){var g=f===void 0?l:f;x=$L(g,o.dataKey,s)}else x=f&&f[r]||l[r];return x?[].concat(xA(c),[Qze(u,x)]):c},[])},j4e=function(e,n,r,s){var a=s||{x:e.chartX,y:e.chartY},o=ean(a,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,u=e.tooltipTicks,d=VQt(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,x=qre(e,n,d,f),g=tan(r,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:x,activeCoordinate:g}}return null},nan=function(e,n){var r=n.axes,s=n.graphicalItems,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,x=e.stackOffset,g=Kze(d,a);return r.reduce(function(y,v){var C,N=v.type.defaultProps!==void 0?Ar(Ar({},v.type.defaultProps),v.props):v.props,P=N.type,T=N.dataKey,M=N.allowDataOverflow,F=N.allowDuplicatedCategory,$=N.scale,L=N.ticks,z=N.includeHidden,X=N[o];if(y[X])return y;var ne=cz(e.data,{graphicalItems:s.filter(function(de){var Ce,me=o in de.props?de.props[o]:(Ce=de.type.defaultProps)===null||Ce===void 0?void 0:Ce[o];return me===X}),dataStartIndex:c,dataEndIndex:u}),J=ne.length,K,te,fe;_in(N.domain,M,P)&&(K=are(N.domain,null,M),g&&(P==="number"||$!=="auto")&&(fe=D9(ne,T,"category")));var q=oVe(P);if(!K||K.length===0){var se,ae=(se=N.domain)!==null&&se!==void 0?se:q;if(T){if(K=D9(ne,T,P),P==="category"&&g){var W=RHt(K);F&&W?(te=K,K=wD(0,J)):F||(K=R6e(ae,K,v).reduce(function(de,Ce){return de.indexOf(Ce)>=0?de:[].concat(xA(de),[Ce])},[]))}else if(P==="category")F?K=K.filter(function(de){return de!==""&&!Si(de)}):K=R6e(ae,K,v).reduce(function(de,Ce){return de.indexOf(Ce)>=0||Ce===""||Si(Ce)?de:[].concat(xA(de),[Ce])},[]);else if(P==="number"){var V=YQt(ne,s.filter(function(de){var Ce,me,we=o in de.props?de.props[o]:(Ce=de.type.defaultProps)===null||Ce===void 0?void 0:Ce[o],xe="hide"in de.props?de.props.hide:(me=de.type.defaultProps)===null||me===void 0?void 0:me.hide;return we===X&&(z||!xe)}),T,a,d);V&&(K=V)}g&&(P==="number"||$!=="auto")&&(fe=D9(ne,T,"category"))}else g?K=wD(0,J):l&&l[X]&&l[X].hasStack&&P==="number"?K=x==="expand"?[0,1]:Xze(l[X].stackGroups,c,u):K=Gze(ne,s.filter(function(de){var Ce=o in de.props?de.props[o]:de.type.defaultProps[o],me="hide"in de.props?de.props.hide:de.type.defaultProps.hide;return Ce===X&&(z||!me)}),P,d,!0);if(P==="number")K=Hre(f,K,X,a,L),ae&&(K=are(ae,K,M));else if(P==="category"&&ae){var ee=ae,oe=K.every(function(de){return ee.indexOf(de)>=0});oe&&(K=ee)}}return Ar(Ar({},y),{},ni({},X,Ar(Ar({},N),{},{axisType:a,domain:K,categoricalDomain:fe,duplicateDomain:te,originalDomain:(C=N.domain)!==null&&C!==void 0?C:q,isCategorical:g,layout:d})))},{})},ran=function(e,n){var r=n.graphicalItems,s=n.Axis,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,x=cz(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),g=x.length,y=Kze(d,a),v=-1;return r.reduce(function(C,N){var P=N.type.defaultProps!==void 0?Ar(Ar({},N.type.defaultProps),N.props):N.props,T=P[o],M=oVe("number");if(!C[T]){v++;var F;return y?F=wD(0,g):l&&l[T]&&l[T].hasStack?(F=Xze(l[T].stackGroups,c,u),F=Hre(f,F,T,a)):(F=are(M,Gze(x,r.filter(function($){var L,z,X=o in $.props?$.props[o]:(L=$.type.defaultProps)===null||L===void 0?void 0:L[o],ne="hide"in $.props?$.props.hide:(z=$.type.defaultProps)===null||z===void 0?void 0:z.hide;return X===T&&!ne}),"number",d),s.defaultProps.allowDataOverflow),F=Hre(f,F,T,a)),Ar(Ar({},C),{},ni({},T,Ar(Ar({axisType:a},s.defaultProps),{},{hide:!0,orientation:dp(Zin,"".concat(a,".").concat(v%2),null),domain:F,originalDomain:M,isCategorical:y,layout:d})))}return C},{})},san=function(e,n){var r=n.axisType,s=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(s,"Id"),x=hf(d,a),g={};return x.length?g=nan(e,{axes:x,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(g=ran(e,{Axis:a,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),g},ian=function(e){var n=Kb(e),r=Yg(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Cue(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:fD(n,r)}},E4e=function(e){var n=e.children,r=e.defaultShowTooltip,s=Wf(n,rA),a=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(a=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},aan=function(e){return!e||!e.length?!1:e.some(function(n){var r=o1(n&&n.type);return r&&r.indexOf("Bar")>=0})},_4e=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},oan=function(e,n){var r=e.props,s=e.graphicalItems,a=e.xAxisMap,o=a===void 0?{}:a,l=e.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,x=r.margin||{},g=Wf(f,rA),y=Wf(f,N3),v=Object.keys(c).reduce(function(F,$){var L=c[$],z=L.orientation;return!L.mirror&&!L.hide?Ar(Ar({},F),{},ni({},z,F[z]+L.width)):F},{left:x.left||0,right:x.right||0}),C=Object.keys(o).reduce(function(F,$){var L=o[$],z=L.orientation;return!L.mirror&&!L.hide?Ar(Ar({},F),{},ni({},z,dp(F,"".concat(z))+L.height)):F},{top:x.top||0,bottom:x.bottom||0}),N=Ar(Ar({},C),v),P=N.bottom;g&&(N.bottom+=g.props.height||rA.defaultProps.height),y&&n&&(N=GQt(N,s,r,n));var T=u-N.left-N.right,M=d-N.top-N.bottom;return Ar(Ar({brushBottom:P},N),{},{width:Math.max(T,0),height:Math.max(M,0)})},lan=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},lVe=function(e){var n=e.chartName,r=e.GraphicalChild,s=e.defaultTooltipEventType,a=s===void 0?"axis":s,o=e.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,x=function(N,P){var T=P.graphicalItems,M=P.stackGroups,F=P.offset,$=P.updateId,L=P.dataStartIndex,z=P.dataEndIndex,X=N.barSize,ne=N.layout,J=N.barGap,K=N.barCategoryGap,te=N.maxBarSize,fe=_4e(ne),q=fe.numericAxisName,se=fe.cateAxisName,ae=aan(T),W=[];return T.forEach(function(V,ee){var oe=cz(N.data,{graphicalItems:[V],dataStartIndex:L,dataEndIndex:z}),de=V.type.defaultProps!==void 0?Ar(Ar({},V.type.defaultProps),V.props):V.props,Ce=de.dataKey,me=de.maxBarSize,we=de["".concat(q,"Id")],xe=de["".concat(se,"Id")],be={},je=c.reduce(function(wt,nn){var cn=P["".concat(nn.axisType,"Map")],Un=de["".concat(nn.axisType,"Id")];cn&&cn[Un]||nn.axisType==="zAxis"||h5();var Xt=cn[Un];return Ar(Ar({},wt),{},ni(ni({},nn.axisType,Xt),"".concat(nn.axisType,"Ticks"),Yg(Xt)))},be),Ie=je[se],Re=je["".concat(se,"Ticks")],Qe=M&&M[we]&&M[we].hasStack&&oZt(V,M[we].stackGroups),Ke=o1(V.type).indexOf("Bar")>=0,dt=fD(Ie,Re),tt=[],nt=ae&&WQt({barSize:X,stackGroups:M,totalSize:lan(je,se)});if(Ke){var Le,Be,ht=Si(me)?te:me,pt=(Le=(Be=fD(Ie,Re,!0))!==null&&Be!==void 0?Be:ht)!==null&&Le!==void 0?Le:0;tt=qQt({barGap:J,barCategoryGap:K,bandSize:pt!==dt?pt:dt,sizeList:nt[xe],maxBarSize:ht}),pt!==dt&&(tt=tt.map(function(wt){return Ar(Ar({},wt),{},{position:Ar(Ar({},wt.position),{},{offset:wt.position.offset-pt/2})})}))}var Gt=V&&V.type&&V.type.getComposedData;Gt&&W.push({props:Ar(Ar({},Gt(Ar(Ar({},je),{},{displayedData:oe,props:N,dataKey:Ce,item:V,bandSize:dt,barPosition:tt,offset:F,stackedData:Qe,layout:ne,dataStartIndex:L,dataEndIndex:z}))),{},ni(ni(ni({key:V.key||"item-".concat(ee)},q,je[q]),se,je[se]),"animationId",$)),childIndex:YHt(V,N.children),item:V})}),W},g=function(N,P){var T=N.props,M=N.dataStartIndex,F=N.dataEndIndex,$=N.updateId;if(!Qve({props:T}))return null;var L=T.children,z=T.layout,X=T.stackOffset,ne=T.data,J=T.reverseStackOrder,K=_4e(z),te=K.numericAxisName,fe=K.cateAxisName,q=hf(L,r),se=sZt(ne,q,"".concat(te,"Id"),"".concat(fe,"Id"),X,J),ae=c.reduce(function(de,Ce){var me="".concat(Ce.axisType,"Map");return Ar(Ar({},de),{},ni({},me,san(T,Ar(Ar({},Ce),{},{graphicalItems:q,stackGroups:Ce.axisType===te&&se,dataStartIndex:M,dataEndIndex:F}))))},{}),W=oan(Ar(Ar({},ae),{},{props:T,graphicalItems:q}),P==null?void 0:P.legendBBox);Object.keys(ae).forEach(function(de){ae[de]=d(T,ae[de],W,de.replace("Map",""),n)});var V=ae["".concat(fe,"Map")],ee=ian(V),oe=x(T,Ar(Ar({},ae),{},{dataStartIndex:M,dataEndIndex:F,updateId:$,graphicalItems:q,stackGroups:se,offset:W}));return Ar(Ar({formattedGraphicalItems:oe,graphicalItems:q,offset:W,stackGroups:se},ee),ae)},y=function(C){function N(P){var T,M,F;return Uin(this,N),F=Vin(this,N,[P]),ni(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ni(F,"accessibilityManager",new Ein),ni(F,"handleLegendBBoxUpdate",function($){if($){var L=F.state,z=L.dataStartIndex,X=L.dataEndIndex,ne=L.updateId;F.setState(Ar({legendBBox:$},g({props:F.props,dataStartIndex:z,dataEndIndex:X,updateId:ne},Ar(Ar({},F.state),{},{legendBBox:$}))))}}),ni(F,"handleReceiveSyncEvent",function($,L,z){if(F.props.syncId===$){if(z===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(L)}}),ni(F,"handleBrushChange",function($){var L=$.startIndex,z=$.endIndex;if(L!==F.state.dataStartIndex||z!==F.state.dataEndIndex){var X=F.state.updateId;F.setState(function(){return Ar({dataStartIndex:L,dataEndIndex:z},g({props:F.props,dataStartIndex:L,dataEndIndex:z,updateId:X},F.state))}),F.triggerSyncEvent({dataStartIndex:L,dataEndIndex:z})}}),ni(F,"handleMouseEnter",function($){var L=F.getMouseInfo($);if(L){var z=Ar(Ar({},L),{},{isTooltipActive:!0});F.setState(z),F.triggerSyncEvent(z);var X=F.props.onMouseEnter;Ei(X)&&X(z,$)}}),ni(F,"triggeredAfterMouseMove",function($){var L=F.getMouseInfo($),z=L?Ar(Ar({},L),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(z),F.triggerSyncEvent(z);var X=F.props.onMouseMove;Ei(X)&&X(z,$)}),ni(F,"handleItemMouseEnter",function($){F.setState(function(){return{isTooltipActive:!0,activeItem:$,activePayload:$.tooltipPayload,activeCoordinate:$.tooltipPosition||{x:$.cx,y:$.cy}}})}),ni(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),ni(F,"handleMouseMove",function($){$.persist(),F.throttleTriggeredAfterMouseMove($)}),ni(F,"handleMouseLeave",function($){F.throttleTriggeredAfterMouseMove.cancel();var L={isTooltipActive:!1};F.setState(L),F.triggerSyncEvent(L);var z=F.props.onMouseLeave;Ei(z)&&z(L,$)}),ni(F,"handleOuterEvent",function($){var L=KHt($),z=dp(F.props,"".concat(L));if(L&&Ei(z)){var X,ne;/.*touch.*/i.test(L)?ne=F.getMouseInfo($.changedTouches[0]):ne=F.getMouseInfo($),z((X=ne)!==null&&X!==void 0?X:{},$)}}),ni(F,"handleClick",function($){var L=F.getMouseInfo($);if(L){var z=Ar(Ar({},L),{},{isTooltipActive:!0});F.setState(z),F.triggerSyncEvent(z);var X=F.props.onClick;Ei(X)&&X(z,$)}}),ni(F,"handleMouseDown",function($){var L=F.props.onMouseDown;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),ni(F,"handleMouseUp",function($){var L=F.props.onMouseUp;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),ni(F,"handleTouchMove",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove($.changedTouches[0])}),ni(F,"handleTouchStart",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseDown($.changedTouches[0])}),ni(F,"handleTouchEnd",function($){$.changedTouches!=null&&$.changedTouches.length>0&&F.handleMouseUp($.changedTouches[0])}),ni(F,"handleDoubleClick",function($){var L=F.props.onDoubleClick;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),ni(F,"handleContextMenu",function($){var L=F.props.onContextMenu;if(Ei(L)){var z=F.getMouseInfo($);L(z,$)}}),ni(F,"triggerSyncEvent",function($){F.props.syncId!==void 0&&LX.emit(DX,F.props.syncId,$,F.eventEmitterSymbol)}),ni(F,"applySyncEvent",function($){var L=F.props,z=L.layout,X=L.syncMethod,ne=F.state.updateId,J=$.dataStartIndex,K=$.dataEndIndex;if($.dataStartIndex!==void 0||$.dataEndIndex!==void 0)F.setState(Ar({dataStartIndex:J,dataEndIndex:K},g({props:F.props,dataStartIndex:J,dataEndIndex:K,updateId:ne},F.state)));else if($.activeTooltipIndex!==void 0){var te=$.chartX,fe=$.chartY,q=$.activeTooltipIndex,se=F.state,ae=se.offset,W=se.tooltipTicks;if(!ae)return;if(typeof X=="function")q=X(W,$);else if(X==="value"){q=-1;for(var V=0;V<W.length;V++)if(W[V].value===$.activeLabel){q=V;break}}var ee=Ar(Ar({},ae),{},{x:ae.left,y:ae.top}),oe=Math.min(te,ee.x+ee.width),de=Math.min(fe,ee.y+ee.height),Ce=W[q]&&W[q].value,me=qre(F.state,F.props.data,q),we=W[q]?{x:z==="horizontal"?W[q].coordinate:oe,y:z==="horizontal"?de:W[q].coordinate}:aVe;F.setState(Ar(Ar({},$),{},{activeLabel:Ce,activeCoordinate:we,activePayload:me,activeTooltipIndex:q}))}else F.setState($)}),ni(F,"renderCursor",function($){var L,z=F.state,X=z.isTooltipActive,ne=z.activeCoordinate,J=z.activePayload,K=z.offset,te=z.activeTooltipIndex,fe=z.tooltipAxisBandSize,q=F.getTooltipEventType(),se=(L=$.props.active)!==null&&L!==void 0?L:X,ae=F.props.layout,W=$.key||"_recharts-cursor";return Ne.createElement(Oin,{key:W,activeCoordinate:ne,activePayload:J,activeTooltipIndex:te,chartName:n,element:$,isActive:se,layout:ae,offset:K,tooltipAxisBandSize:fe,tooltipEventType:q})}),ni(F,"renderPolarAxis",function($,L,z){var X=dp($,"type.axisType"),ne=dp(F.state,"".concat(X,"Map")),J=$.type.defaultProps,K=J!==void 0?Ar(Ar({},J),$.props):$.props,te=ne&&ne[K["".concat(X,"Id")]];return m.cloneElement($,Ar(Ar({},te),{},{className:la(X,te.className),key:$.key||"".concat(L,"-").concat(z),ticks:Yg(te,!0)}))}),ni(F,"renderPolarGrid",function($){var L=$.props,z=L.radialLines,X=L.polarAngles,ne=L.polarRadius,J=F.state,K=J.radiusAxisMap,te=J.angleAxisMap,fe=Kb(K),q=Kb(te),se=q.cx,ae=q.cy,W=q.innerRadius,V=q.outerRadius;return m.cloneElement($,{polarAngles:Array.isArray(X)?X:Yg(q,!0).map(function(ee){return ee.coordinate}),polarRadius:Array.isArray(ne)?ne:Yg(fe,!0).map(function(ee){return ee.coordinate}),cx:se,cy:ae,innerRadius:W,outerRadius:V,key:$.key||"polar-grid",radialLines:z})}),ni(F,"renderLegend",function(){var $=F.state.formattedGraphicalItems,L=F.props,z=L.children,X=L.width,ne=L.height,J=F.props.margin||{},K=X-(J.left||0)-(J.right||0),te=Wze({children:z,formattedGraphicalItems:$,legendWidth:K,legendContent:u});if(!te)return null;var fe=te.item,q=N4e(te,Min);return m.cloneElement(fe,Ar(Ar({},q),{},{chartWidth:X,chartHeight:ne,margin:J,onBBoxUpdate:F.handleLegendBBoxUpdate}))}),ni(F,"renderTooltip",function(){var $,L=F.props,z=L.children,X=L.accessibilityLayer,ne=Wf(z,sm);if(!ne)return null;var J=F.state,K=J.isTooltipActive,te=J.activeCoordinate,fe=J.activePayload,q=J.activeLabel,se=J.offset,ae=($=ne.props.active)!==null&&$!==void 0?$:K;return m.cloneElement(ne,{viewBox:Ar(Ar({},se),{},{x:se.left,y:se.top}),active:ae,label:q,payload:ae?fe:[],coordinate:te,accessibilityLayer:X})}),ni(F,"renderBrush",function($){var L=F.props,z=L.margin,X=L.data,ne=F.state,J=ne.offset,K=ne.dataStartIndex,te=ne.dataEndIndex,fe=ne.updateId;return m.cloneElement($,{key:$.key||"_recharts-brush",onChange:bF(F.handleBrushChange,$.props.onChange),data:X,x:rs($.props.x)?$.props.x:J.left,y:rs($.props.y)?$.props.y:J.top+J.height+J.brushBottom-(z.bottom||0),width:rs($.props.width)?$.props.width:J.width,startIndex:K,endIndex:te,updateId:"brush-".concat(fe)})}),ni(F,"renderReferenceElement",function($,L,z){if(!$)return null;var X=F,ne=X.clipPathId,J=F.state,K=J.xAxisMap,te=J.yAxisMap,fe=J.offset,q=$.type.defaultProps||{},se=$.props,ae=se.xAxisId,W=ae===void 0?q.xAxisId:ae,V=se.yAxisId,ee=V===void 0?q.yAxisId:V;return m.cloneElement($,{key:$.key||"".concat(L,"-").concat(z),xAxis:K[W],yAxis:te[ee],viewBox:{x:fe.left,y:fe.top,width:fe.width,height:fe.height},clipPathId:ne})}),ni(F,"renderActivePoints",function($){var L=$.item,z=$.activePoint,X=$.basePoint,ne=$.childIndex,J=$.isRange,K=[],te=L.props.key,fe=L.item.type.defaultProps!==void 0?Ar(Ar({},L.item.type.defaultProps),L.item.props):L.item.props,q=fe.activeDot,se=fe.dataKey,ae=Ar(Ar({index:ne,dataKey:se,cx:z.x,cy:z.y,r:4,fill:Yue(L.item),strokeWidth:2,stroke:"#fff",payload:z.payload,value:z.value},Ci(q,!1)),UL(q));return K.push(N.renderActiveDot(q,ae,"".concat(te,"-activePoint-").concat(ne))),X?K.push(N.renderActiveDot(q,Ar(Ar({},ae),{},{cx:X.x,cy:X.y}),"".concat(te,"-basePoint-").concat(ne))):J&&K.push(null),K}),ni(F,"renderGraphicChild",function($,L,z){var X=F.filterFormatItem($,L,z);if(!X)return null;var ne=F.getTooltipEventType(),J=F.state,K=J.isTooltipActive,te=J.tooltipAxis,fe=J.activeTooltipIndex,q=J.activeLabel,se=F.props.children,ae=Wf(se,sm),W=X.props,V=W.points,ee=W.isRange,oe=W.baseLine,de=X.item.type.defaultProps!==void 0?Ar(Ar({},X.item.type.defaultProps),X.item.props):X.item.props,Ce=de.activeDot,me=de.hide,we=de.activeBar,xe=de.activeShape,be=!!(!me&&K&&ae&&(Ce||we||xe)),je={};ne!=="axis"&&ae&&ae.props.trigger==="click"?je={onClick:bF(F.handleItemMouseEnter,$.props.onClick)}:ne!=="axis"&&(je={onMouseLeave:bF(F.handleItemMouseLeave,$.props.onMouseLeave),onMouseEnter:bF(F.handleItemMouseEnter,$.props.onMouseEnter)});var Ie=m.cloneElement($,Ar(Ar({},X.props),je));function Re(nn){return typeof te.dataKey=="function"?te.dataKey(nn.payload):null}if(be)if(fe>=0){var Qe,Ke;if(te.dataKey&&!te.allowDuplicatedCategory){var dt=typeof te.dataKey=="function"?Re:"payload.".concat(te.dataKey.toString());Qe=$L(V,dt,q),Ke=ee&&oe&&$L(oe,dt,q)}else Qe=V==null?void 0:V[fe],Ke=ee&&oe&&oe[fe];if(xe||we){var tt=$.props.activeIndex!==void 0?$.props.activeIndex:fe;return[m.cloneElement($,Ar(Ar(Ar({},X.props),je),{},{activeIndex:tt})),null,null]}if(!Si(Qe))return[Ie].concat(xA(F.renderActivePoints({item:X,activePoint:Qe,basePoint:Ke,childIndex:fe,isRange:ee})))}else{var nt,Le=(nt=F.getItemByXY(F.state.activeCoordinate))!==null&&nt!==void 0?nt:{graphicalItem:Ie},Be=Le.graphicalItem,ht=Be.item,pt=ht===void 0?$:ht,Gt=Be.childIndex,wt=Ar(Ar(Ar({},X.props),je),{},{activeIndex:Gt});return[m.cloneElement(pt,wt),null,null]}return ee?[Ie,null,null]:[Ie,null]}),ni(F,"renderCustomized",function($,L,z){return m.cloneElement($,Ar(Ar({key:"recharts-customized-".concat(z)},F.props),F.state))}),ni(F,"renderMap",{CartesianGrid:{handler:SF,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:SF},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:SF},YAxis:{handler:SF},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((T=P.id)!==null&&T!==void 0?T:z5("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=VUe(F.triggeredAfterMouseMove,(M=P.throttleDelay)!==null&&M!==void 0?M:1e3/60),F.state={},F}return Gin(N,C),Hin(N,[{key:"componentDidMount",value:function(){var T,M;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(T=this.props.margin.left)!==null&&T!==void 0?T:0,top:(M=this.props.margin.top)!==null&&M!==void 0?M:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var T=this.props,M=T.children,F=T.data,$=T.height,L=T.layout,z=Wf(M,sm);if(z){var X=z.props.defaultIndex;if(!(typeof X!="number"||X<0||X>this.state.tooltipTicks.length-1)){var ne=this.state.tooltipTicks[X]&&this.state.tooltipTicks[X].value,J=qre(this.state,F,X,ne),K=this.state.tooltipTicks[X].coordinate,te=(this.state.offset.top+$)/2,fe=L==="horizontal",q=fe?{x:K,y:te}:{y:K,x:te},se=this.state.formattedGraphicalItems.find(function(W){var V=W.item;return V.type.name==="Scatter"});se&&(q=Ar(Ar({},q),se.props.points[X].tooltipPosition),J=se.props.points[X].tooltipPayload);var ae={activeTooltipIndex:X,isTooltipActive:!0,activeLabel:ne,activePayload:J,activeCoordinate:q};this.setState(ae),this.renderCursor(z),this.accessibilityManager.setIndex(X)}}}},{key:"getSnapshotBeforeUpdate",value:function(T,M){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==M.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==T.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==T.margin){var F,$;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:($=this.props.margin.top)!==null&&$!==void 0?$:0}})}return null}},{key:"componentDidUpdate",value:function(T){_ne([Wf(T.children,sm)],[Wf(this.props.children,sm)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var T=Wf(this.props.children,sm);if(T&&typeof T.props.shared=="boolean"){var M=T.props.shared?"axis":"item";return l.indexOf(M)>=0?M:a}return a}},{key:"getMouseInfo",value:function(T){if(!this.container)return null;var M=this.container,F=M.getBoundingClientRect(),$=OGt(F),L={chartX:Math.round(T.pageX-$.left),chartY:Math.round(T.pageY-$.top)},z=F.width/M.offsetWidth||1,X=this.inRange(L.chartX,L.chartY,z);if(!X)return null;var ne=this.state,J=ne.xAxisMap,K=ne.yAxisMap,te=this.getTooltipEventType(),fe=j4e(this.state,this.props.data,this.props.layout,X);if(te!=="axis"&&J&&K){var q=Kb(J).scale,se=Kb(K).scale,ae=q&&q.invert?q.invert(L.chartX):null,W=se&&se.invert?se.invert(L.chartY):null;return Ar(Ar({},L),{},{xValue:ae,yValue:W},fe)}return fe?Ar(Ar({},L),fe):null}},{key:"inRange",value:function(T,M){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,$=this.props.layout,L=T/F,z=M/F;if($==="horizontal"||$==="vertical"){var X=this.state.offset,ne=L>=X.left&&L<=X.left+X.width&&z>=X.top&&z<=X.top+X.height;return ne?{x:L,y:z}:null}var J=this.state,K=J.angleAxisMap,te=J.radiusAxisMap;if(K&&te){var fe=Kb(K);return B6e({x:L,y:z},fe)}return null}},{key:"parseEventsOfWrapper",value:function(){var T=this.props.children,M=this.getTooltipEventType(),F=Wf(T,sm),$={};F&&M==="axis"&&(F.props.trigger==="click"?$={onClick:this.handleClick}:$={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var L=UL(this.props,this.handleOuterEvent);return Ar(Ar({},L),$)}},{key:"addListener",value:function(){LX.on(DX,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){LX.removeListener(DX,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(T,M,F){for(var $=this.state.formattedGraphicalItems,L=0,z=$.length;L<z;L++){var X=$[L];if(X.item===T||X.props.key===T.key||M===o1(X.item.type)&&F===X.childIndex)return X}return null}},{key:"renderClipPath",value:function(){var T=this.clipPathId,M=this.state.offset,F=M.left,$=M.top,L=M.height,z=M.width;return Ne.createElement("defs",null,Ne.createElement("clipPath",{id:T},Ne.createElement("rect",{x:F,y:$,height:L,width:z})))}},{key:"getXScales",value:function(){var T=this.state.xAxisMap;return T?Object.entries(T).reduce(function(M,F){var $=S4e(F,2),L=$[0],z=$[1];return Ar(Ar({},M),{},ni({},L,z.scale))},{}):null}},{key:"getYScales",value:function(){var T=this.state.yAxisMap;return T?Object.entries(T).reduce(function(M,F){var $=S4e(F,2),L=$[0],z=$[1];return Ar(Ar({},M),{},ni({},L,z.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(T){var M;return(M=this.state.xAxisMap)===null||M===void 0||(M=M[T])===null||M===void 0?void 0:M.scale}},{key:"getYScaleByAxisId",value:function(T){var M;return(M=this.state.yAxisMap)===null||M===void 0||(M=M[T])===null||M===void 0?void 0:M.scale}},{key:"getItemByXY",value:function(T){var M=this.state,F=M.formattedGraphicalItems,$=M.activeItem;if(F&&F.length)for(var L=0,z=F.length;L<z;L++){var X=F[L],ne=X.props,J=X.item,K=J.type.defaultProps!==void 0?Ar(Ar({},J.type.defaultProps),J.props):J.props,te=o1(J.type);if(te==="Bar"){var fe=(ne.data||[]).find(function(W){return Ken(T,W)});if(fe)return{graphicalItem:X,payload:fe}}else if(te==="RadialBar"){var q=(ne.data||[]).find(function(W){return B6e(T,W)});if(q)return{graphicalItem:X,payload:q}}else if(ez(X,$)||tz(X,$)||mk(X,$)){var se=Ltn({graphicalItem:X,activeTooltipItem:$,itemData:K.data}),ae=K.activeIndex===void 0?se:K.activeIndex;return{graphicalItem:Ar(Ar({},X),{},{childIndex:ae}),payload:mk(X,$)?K.data[se]:X.props.data[se]}}}return null}},{key:"render",value:function(){var T=this;if(!Qve(this))return null;var M=this.props,F=M.children,$=M.className,L=M.width,z=M.height,X=M.style,ne=M.compact,J=M.title,K=M.desc,te=N4e(M,Rin),fe=Ci(te,!1);if(ne)return Ne.createElement(e4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Ne.createElement(Tne,c4({},fe,{width:L,height:z,title:J,desc:K}),this.renderClipPath(),Jve(F,this.renderMap)));if(this.props.accessibilityLayer){var q,se;fe.tabIndex=(q=this.props.tabIndex)!==null&&q!==void 0?q:0,fe.role=(se=this.props.role)!==null&&se!==void 0?se:"application",fe.onKeyDown=function(W){T.accessibilityManager.keyboardEvent(W)},fe.onFocus=function(){T.accessibilityManager.focus()}}var ae=this.parseEventsOfWrapper();return Ne.createElement(e4e,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Ne.createElement("div",c4({className:la("recharts-wrapper",$),style:Ar({position:"relative",cursor:"default",width:L,height:z},X)},ae,{ref:function(V){T.container=V}}),Ne.createElement(Tne,c4({},fe,{width:L,height:z,title:J,desc:K,style:Jin}),this.renderClipPath(),Jve(F,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(m.Component);ni(y,"displayName",n),ni(y,"defaultProps",Ar({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),ni(y,"getDerivedStateFromProps",function(C,N){var P=C.dataKey,T=C.data,M=C.children,F=C.width,$=C.height,L=C.layout,z=C.stackOffset,X=C.margin,ne=N.dataStartIndex,J=N.dataEndIndex;if(N.updateId===void 0){var K=E4e(C);return Ar(Ar(Ar({},K),{},{updateId:0},g(Ar(Ar({props:C},K),{},{updateId:0}),N)),{},{prevDataKey:P,prevData:T,prevWidth:F,prevHeight:$,prevLayout:L,prevStackOffset:z,prevMargin:X,prevChildren:M})}if(P!==N.prevDataKey||T!==N.prevData||F!==N.prevWidth||$!==N.prevHeight||L!==N.prevLayout||z!==N.prevStackOffset||!R4(X,N.prevMargin)){var te=E4e(C),fe={chartX:N.chartX,chartY:N.chartY,isTooltipActive:N.isTooltipActive},q=Ar(Ar({},j4e(N,T,L)),{},{updateId:N.updateId+1}),se=Ar(Ar(Ar({},te),fe),q);return Ar(Ar(Ar({},se),g(Ar({props:C},se),N)),{},{prevDataKey:P,prevData:T,prevWidth:F,prevHeight:$,prevLayout:L,prevStackOffset:z,prevMargin:X,prevChildren:M})}if(!_ne(M,N.prevChildren)){var ae,W,V,ee,oe=Wf(M,rA),de=oe&&(ae=(W=oe.props)===null||W===void 0?void 0:W.startIndex)!==null&&ae!==void 0?ae:ne,Ce=oe&&(V=(ee=oe.props)===null||ee===void 0?void 0:ee.endIndex)!==null&&V!==void 0?V:J,me=de!==ne||Ce!==J,we=!Si(T),xe=we&&!me?N.updateId:N.updateId+1;return Ar(Ar({updateId:xe},g(Ar(Ar({props:C},N),{},{updateId:xe,dataStartIndex:de,dataEndIndex:Ce}),N)),{},{prevChildren:M,dataStartIndex:de,dataEndIndex:Ce})}return null}),ni(y,"renderActiveDot",function(C,N,P){var T;return m.isValidElement(C)?T=m.cloneElement(C,N):Ei(C)?T=C(N):T=Ne.createElement(JU,N),Ne.createElement(Na,{className:"recharts-active-dot",key:P},T)});var v=m.forwardRef(function(N,P){return Ne.createElement(y,c4({},N,{ref:P}))});return v.displayName=y.displayName,v},can=lVe({chartName:"LineChart",GraphicalChild:$0,axisComponents:[{axisType:"xAxis",AxisComp:Ij},{axisType:"yAxis",AxisComp:Fj}],formatAxisMap:gHe}),uan=lVe({chartName:"ComposedChart",GraphicalChild:[$0,q5,Tj,lz],axisComponents:[{axisType:"xAxis",AxisComp:Ij},{axisType:"yAxis",AxisComp:Fj},{axisType:"zAxis",AxisComp:oz}],formatAxisMap:gHe});const dan=({wallet:t})=>{const[e,n]=m.useState([]),[r]=m.useState("allTime"),[s]=m.useState("pnlHistory"),[a,o]=m.useState(!1),l=m.useRef(null),c=t||"";return m.useEffect(()=>{let u=new AbortController;const d=async()=>{var x,g,y;const f=`perp${r.charAt(0).toUpperCase()+r.slice(1)}`;o(!0);try{const P=(((g=(x=(await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:c},{headers:{Accept:"*/*","Content-Type":"application/json"},signal:u.signal})).data.find(T=>T[0]===f))==null?void 0:x[1])==null?void 0:g[s])||[]).map(([T,M])=>({time:new Date(T).getTime(),value:parseFloat(M)}));n(P)}catch(v){((y=v.response)==null?void 0:y.status)===429?(console.warn("Error 429..."),l.current=setTimeout(d,15e3)):v.name!=="CanceledError"&&(console.error("Error fetching chart data:",v),l.current=setTimeout(d,15e3))}finally{o(!1)}};return d(),()=>{u.abort(),l.current&&clearTimeout(l.current)}},[r,s,c]),i.jsx("div",{className:"bg-transparent rounded-2xl w-full",style:{minHeight:"40px"},children:a?i.jsx("div",{className:"w-full h-full flex justify-center items-center",children:i.jsx(O8e,{className:"w-5 h-5 -mb-[41px]"})}):e.length===0?i.jsx("div",{className:"w-full h-full flex justify-center items-center",children:i.jsx("span",{className:"text-gray-600 text-xs -mb-[41px]",children:"No chart data"})}):i.jsx(WUe,{width:"100%",height:40,children:i.jsxs(can,{data:e,children:[i.jsx(Ij,{dataKey:"time",hide:!0}),i.jsx(Fj,{hide:!0}),i.jsx(sm,{cursor:{stroke:"#555",strokeWidth:1},content:({active:u,payload:d})=>{if(u&&d&&d.length){const f=d[0].payload,x=new Date(f.time),g=x.toLocaleDateString("en-GB",{month:"short",day:"2-digit"}).toUpperCase(),y=x.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return i.jsxs("div",{style:{background:"#1B1B1B",padding:"6px 10px",borderRadius:"12px",fontSize:"12px",color:"#fff",border:"1px solid #353535"},children:[i.jsxs("div",{className:"text-[12px] font-medium text-[#909090]",children:[g," ",y]}),i.jsxs("div",{className:"text-[14px] font-semibold flex items-center",children:[i.jsx("span",{className:"inline-block w-[8px] h-[8px] bg-[#67FFBD] rounded-full mr-1"}),i.jsx("span",{className:"text-[#67FFBD] mr-2",children:"PnL"}),i.jsxs("span",{children:["$",_r(f.value)]})]})]})}return null},wrapperStyle:{marginLeft:"-40px",marginTop:"-50px"}}),i.jsx($0,{type:"monotone",dataKey:"value",stroke:"#67FFBD",strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})},fan="https://dextradata.nftinit.io/api/hyper/analytics/wallet_backtest_summary/?format=json&limit=48&offset=0&order_by=three_month_pnl&order_dir=desc",han=({handleAddedTime:t})=>{const{trackedWatchList:e,copyTradeWatchList:n,setSignModalOpen:r}=m.useContext(Qr),{address:s}=ns(),[a,o]=m.useState([]),[l,c]=m.useState(!0),[u,d]=m.useState(null),[f,x]=m.useState(1),g=typeof window<"u"&&window.innerWidth>640?4:2,[y,v]=m.useState(!1),[C,N]=m.useState(null),[P,T]=m.useState(null),[M,F]=m.useState("");m.useEffect(()=>{(async()=>{try{c(!0),d(null);const J=await fetch(fan);if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);const K=await J.json();o((K==null?void 0:K.data)||[])}catch{d("Failed to fetch wallets.")}finally{c(!1)}})()},[]);const $=async({walletAddress:ne,isFollow:J,isScalper:K})=>{try{F(ne);const te=window.localStorage.getItem("hyperToken"),fe=window.localStorage.getItem("hyperAddress");if(!te){r(!0);return}const q=J?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",se=J?{address:s?s.toLowerCase():fe,token:te,follow_address:ne.toLowerCase()}:{address:s?s.toLowerCase():fe,token:te},ae=await fetch(q,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(se)});if(!ae.ok)throw new Error(`Server responded with status ${ae.status}`);const W=await ae.json();W.success?(N(Array.isArray(W==null?void 0:W.data)?[...W.data].sort((V,ee)=>new Date(ee.created_at||0)-new Date(V.created_at||0)):W==null?void 0:W.data),T(K),v(!0)):tn.error(W.error_message)}catch(te){tn.error(te.message||"Something went wrong!")}},L=Math.ceil(a.length/g),z=(f-1)*g,X=a.slice(z,z+g);return i.jsxs(i.Fragment,{children:[i.jsx($5,{open:y,setOpen:v,copyTradeData:C,copyTradeWallet:M,setCopyTradeWallet:F,isScalper:P,setCopyTradeData:N}),i.jsx("div",{className:"grid grid-cols-2 gap-4 w-full",children:l?i.jsx("div",{className:"flex justify-center items-center w-full h-[300px] col-span-2",children:i.jsx($a,{})}):i.jsxs(i.Fragment,{children:[X==null?void 0:X.map((ne,J)=>{var fe,q,se,ae,W,V,ee,oe,de;const K=e==null?void 0:e.some(Ce=>Ce.wallet_address===(ne==null?void 0:ne.user_token)),te=n==null?void 0:n.some(Ce=>Ce.wallet_address===(ne==null?void 0:ne.user_token));return i.jsx(pm.div,{initial:{opacity:0,y:16,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.5,delay:J*.06,ease:[.22,1,.36,1]},whileHover:{y:-4,scale:1.01},whileTap:{scale:.99},className:"col-span-2 md:col-span-1 w-full relative rounded-[18px] p-[1px] bg-gradient-to-br from-[#67ffbd33] via-[#67ffbd66] to-[#67ffbd99]",children:i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full min-h-max sm:min-h-[220px] rounded-[18px] border border-[#2a2a2a] p-4 bg-[#0a0a0a]",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5 sm:gap-2 w-full",children:[i.jsx("img",{src:Yi,alt:"",className:"w-7 h-7 sm:w-8 sm:h-8 rounded-md"}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${ne==null?void 0:ne.user_token}`,"_blank"),t()},className:"text-white text-[12px] sm:text-base font-semibold font-manrope leading-none tracking-wide cursor-pointer",children:(ne==null?void 0:ne.user_token)&&(ne==null?void 0:ne.user_token.slice(0,6))+"..."+(ne==null?void 0:ne.user_token.slice(-4))}),i.jsx(B5,{walletAddress:ne==null?void 0:ne.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:K?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})}),i.jsx(dan,{wallet:ne==null?void 0:ne.user_token})]}),i.jsxs("div",{className:"flex flex-col items-start gap-4 w-full",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start sm:flex-row sm:justify-between sm:items-center gap-2 md:gap-6 lg:gap-10 min-w-full h-[120px] sm:h-auto overflow-y-auto sm:overflow-hidden pr-2 sm:pr-0",children:[i.jsx($X,{title:"PNL",data:[{label:"7D:",value:(fe=ne==null?void 0:ne.source_data)==null?void 0:fe.portfolio_perp_week_pnl,format:Ms},{label:"30D:",value:(q=ne==null?void 0:ne.source_data)==null?void 0:q.portfolio_perp_month_pnl,format:Ms},{label:"90D:",value:(se=ne==null?void 0:ne.source_data)==null?void 0:se.portfolio_perp_3month_pnl,format:Ms}]}),i.jsx($X,{title:"Growth Rate",data:[{label:"7D:",value:(ae=ne==null?void 0:ne.source_data)==null?void 0:ae.portfolio_perp_week_growth_rate},{label:"30D:",value:(W=ne==null?void 0:ne.source_data)==null?void 0:W.portfolio_perp_month_growth_rate},{label:"90D:",value:(V=ne==null?void 0:ne.source_data)==null?void 0:V.portfolio_perp_3month_growth_rate}]}),i.jsx($X,{title:"Drawdown",data:[{label:"7D:",value:(ee=ne==null?void 0:ne.source_data)==null?void 0:ee.portfolio_perp_week_dd,format:Ms},{label:"30D:",value:(oe=ne==null?void 0:ne.source_data)==null?void 0:oe.portfolio_perp_month_dd,format:Ms},{label:"90D:",value:(de=ne==null?void 0:ne.source_data)==null?void 0:de.portfolio_perp_3month_dd,format:Ms}]})]}),i.jsxs(pm.button,{onClick:Ce=>{Ce.preventDefault(),$({walletAddress:ne==null?void 0:ne.user_token,isFollow:te,isScalper:ne==null?void 0:ne.is_scalper})},whileHover:{scale:1.02},whileTap:{scale:.98},className:`relative overflow-hidden w-full h-9 rounded-xl px-4 inline-flex items-center justify-center font-semibold cursor-pointer ${te?"bg-[#67ffbd] text-[#161616]":"text-[#161616]"}`,children:[i.jsx("span",{className:"relative z-10",children:te?"Adjust Copy":"Copy Trade"}),!te&&i.jsxs(i.Fragment,{children:[i.jsx(pm.span,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-xl",style:{background:"linear-gradient(90deg, #67FFCD 0%, #67FFBD 50%, #67FFFD 100%)",backgroundSize:"300% 100%"},initial:{backgroundPosition:"0% 50%",opacity:1},animate:{backgroundPosition:["0% 50%","100% 50%","0% 50%"]},transition:{duration:3.2,repeat:1/0,ease:"linear"}}),i.jsx(pm.span,{"aria-hidden":!0,className:"pointer-events-none absolute -inset-1 rounded-xl blur-lg",style:{background:"radial-gradient(60% 60% at 50% 50%, rgba(117,53,254,0.55), transparent 60%)"},initial:{opacity:.6},animate:{opacity:[.55,.95,.55],scale:[1,1.03,1]},transition:{duration:1.6,repeat:1/0,ease:"easeInOut"}})]})]})]})]})},`${z+J}-${ne==null?void 0:ne.user_token}`)}),i.jsxs("div",{className:"flex justify-center items-center gap-4 w-full col-span-2",children:[i.jsx("button",{className:"px-3 py-1 rounded bg-[#333] text-white disabled:opacity-50 focus:outline-none focus:ring-0 border-none",onClick:()=>x(ne=>ne-1),disabled:f===1,children:"Prev"}),i.jsxs("span",{className:"text-white text-sm",children:["Page ",f," of ",L]}),i.jsx("button",{className:"px-3 py-1 rounded bg-[#333] text-white disabled:opacity-50 focus:outline-none focus:ring-0 border-none",onClick:()=>x(ne=>ne+1),disabled:f===L,children:"Next"})]})]})})]})},$X=({title:t,data:e})=>i.jsxs("div",{className:"flex flex-col justify-start items-start gap-4 w-full",children:[i.jsxs("div",{className:"flex flex-col items-start gap-2 w-full",children:[i.jsx("div",{className:"text-[#fff] text-xs font-normal font-manrope leading-[13px] tracking-wide min-w-max",children:t}),e.map((n,r)=>i.jsxs("div",{className:"flex justify-between sm:justify-start items-center gap-2 w-full",children:[i.jsx("span",{className:"flex justify-start items-center text-[#9b9b9b] text-xs font-medium min-w-[30px]",children:n.label}),i.jsxs("span",{className:`${n.value==null||isNaN(parseFloat(n.value))||n.value==0?"text-white":n.value>0?"text-[#1DE6A3]":"text-[#FF7173]"} text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:[t==="Growth Rate"||t==="Drawdown"?"":"$",n.format?n.format(Math.abs(n.value)):Ms(n.value),t==="Growth Rate"||t==="Drawdown"?"%":""]})]},r))]}),(t==="Growth Rate"||t==="PNL")&&i.jsx("div",{className:"h-px w-full min-w-full sm:hidden bg-[#404040]"})]}),pan=({open:t,setOpen:e,sevenSelectShow:n})=>{const[r,s]=m.useState(!1),a=()=>{if(n)if(r){const l=Date.now()+6048e5;localStorage.setItem("dailyPicksBlockedUntil",l.toString())}else localStorage.setItem("dailyPicksDismissedAt",Date.now().toString());e(!1)},o=()=>{if(n)if(r){const l=Date.now()+6048e5;localStorage.setItem("dailyPicksBlockedUntil",l.toString())}else localStorage.setItem("dailyPicksDismissedAt",Date.now().toString())};return i.jsxs(_a,{open:t,onClose:a,className:"relative z-50",children:[i.jsx(Ea,{as:pm.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 backdrop-blur-md",style:{background:"radial-gradient(120% 120% at 10% 10%, rgba(117,53,254,0.26), transparent 60%), radial-gradient(120% 120% at 90% 10%, rgba(103,255,189,0.20), transparent 60%), rgba(0,0,0,0.55)"}}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center sm:p-0",children:i.jsx(ya,{as:pm.div,initial:{opacity:0,y:22,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",bounce:.22,duration:.5},className:"relative transform overflow-hidden rounded-3xl w-full xl:w-[70%] 2xl:w-[60%] p-[1px] bg-gradient-to-br from-black/90 via-black/70 to-black/50",children:i.jsxs("div",{className:"relative flex flex-col justify-start items-center gap-6 w-full min-h-[420px] p-4 sm:p-8 rounded-3xl",children:[i.jsxs("div",{className:"absolute inset-0 -z-10 overflow-hidden rounded-3xl",children:[i.jsx(pm.div,{className:"absolute -inset-28 opacity-60",style:{background:"radial-gradient(60% 60% at 20% 20%, rgba(103,255,189,0.18) 0%, transparent 60%), radial-gradient(60% 60% at 80% 30%, rgba(117,53,254,0.18) 0%, transparent 60%), radial-gradient(70% 70% at 50% 90%, rgba(255,121,124,0.18) 0%, transparent 60%)"},animate:{rotate:[0,360]},transition:{duration:60,repeat:1/0,ease:"linear"}}),i.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top,rgba(255,255,255,0.06),transparent_60%)]"}),i.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(rgba(255,255,255,0.06)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.06)_1px,transparent_1px)] bg-[size:18px_18px] opacity-10"})]}),i.jsx("button",{onClick:a,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"flex justify-start items-center w-full",children:i.jsxs("div",{className:"flex flex-col items-start w-full gap-3 sm:gap-5",children:[i.jsx("div",{className:"text-white font-manrope text-[20px] sm:text-[22px] font-extrabold leading-none -ml-[3px] tracking-[-0.2px]",children:"🔥 Daily Picks"}),i.jsx("div",{className:"text-[13px] sm:text-[14px] text-start text-white/90 font-manrope font-semibold leading-[18px] max-w-[70ch]",children:"Our algorithm highlights traders with proven skills, strong profits, and low drawdowns — ready for you to copy."})]})}),i.jsx("div",{className:"flex justify-start items-center w-full",children:i.jsx(han,{handleAddedTime:o})}),n&&i.jsxs("div",{className:"flex justify-start items-center gap-2 w-full",children:[i.jsx("input",{type:"checkbox",checked:r,onChange:l=>s(l.target.checked),className:"w-4 h-4 accent-[#7535FE]"}),i.jsx("label",{className:"text-[12px] sm:text-[13px] text-white/90 font-manrope font-semibold leading-[16px]",children:"Don’t show this popup again for the next 7 days"})]})]})})})})]})},man=()=>{const[t,e]=m.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx(pan,{open:t,setOpen:e,sevenSelectShow:!1}),i.jsxs("div",{onClick:()=>e(!0),className:"flex justify-start items-center gap-1.5 rounded-2xl text-white bg-transparent px-2 py-0.5 cursor-pointer w-max",children:[i.jsxs("svg",{className:"bn-svg !text-[16px] w-3.5 h-3.5 -mt-[1.5px]",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M3.3 20.7h17.4V6.3H3.3v14.4zm19.2.3l-.008.153a1.5 1.5 0 01-1.339 1.34L21 22.5H3l-.153-.008a1.5 1.5 0 01-1.34-1.339L1.5 21V6a1.5 1.5 0 011.347-1.492L3 4.5h18l.153.008A1.5 1.5 0 0122.5 6v15z",fill:"currentColor"}),i.jsx("path",{d:"M6.1 5V2.5a.9.9 0 011.8 0V5a.9.9 0 01-1.8 0zM16.1 5V2.5a.9.9 0 011.8 0V5a.9.9 0 01-1.8 0zM21 9.1l.092.004a.9.9 0 010 1.792L21 10.9H2.5a.9.9 0 010-1.8H21zM11.1 12.5v4.517l-1.507-1.32a.9.9 0 00-1.186 1.356l3 2.625.066.052a.9.9 0 001.12-.052l3-2.625.066-.065a.9.9 0 00-1.18-1.347l-.072.056-1.507 1.32V12.5a.9.9 0 00-1.8 0z",fill:"currentColor"})]}),i.jsx("span",{className:"text-white text-[11px] font-semibold font-manrope",children:"Daily Picks"})]})]})};function xan(){return i.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[60] h-[30px] bg-[#0B0B0B]/70 backdrop-blur",children:i.jsxs("div",{className:"flex justify-between items-center h-full w-full gap-2 sm:gap-4 pl-2 sm:pl-4 pr-5",children:[i.jsx("div",{className:"flex justify-start items-center",children:i.jsx(man,{})}),i.jsxs("div",{className:"h-full w-full flex items-center justify-end gap-2",children:[i.jsx(F$t,{}),i.jsx(O$t,{}),i.jsx(M$t,{}),i.jsx(R$t,{})]})]})})}const gan=()=>{const t=Kl();return i.jsxs("div",{className:"flex flex-col items-stretch justify-start w-screen h-[100dvh] overflow-hidden p-0 m-0 realtive",children:[(t.pathname==="/discover-wallets"||t.pathname==="/hyperliquid-whale-trades")&&i.jsx(I$t,{}),i.jsx("div",{className:"hidden sm:block",children:i.jsx(s$t,{})}),i.jsx("div",{className:"block sm:hidden",children:i.jsx(P$t,{})}),i.jsx("div",{style:{height:"calc(100vh - 4.875rem)"},className:"flex flex-col items-stretch justify-start flex-grow h-full w-[100vw] overflow-auto",children:i.jsx("main",{children:i.jsx(GQe,{})})}),i.jsx(xan,{})]})},ua=({info1:t,info2:e,padding:n,icon:r,info1_Color:s,info2_Color:a,rowTwo:o,info3:l})=>i.jsxs("div",{className:`${n||"pl-1 pr-2"} flex flex-col gap-2 font-manrope`,children:[i.jsxs("div",{className:`${s} ${o?"-mt-3.5":""} text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:[i.jsx("img",{src:r,alt:"",className:""}),l?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[#1DE6A3]",children:t})," /"," ",i.jsx("span",{className:"text-[#FF7173]",children:l})]}):t]}),e&&i.jsx("div",{className:`${a} text-xs font-normal not-italic font-inter flex items-center justify-end leading-3 min-w-max text-[#979797]`,children:e})]}),Ja=({className:t})=>i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M11.9467 5.45312H7.79341H4.05341C3.41341 5.45312 3.09341 6.22646 3.54674 6.67979L7.00008 10.1331C7.55341 10.6865 8.45341 10.6865 9.00674 10.1331L10.3201 8.81979L12.4601 6.67979C12.9067 6.22646 12.5867 5.45312 11.9467 5.45312Z",fill:"currentColor"})}),uz=({sortKey:t,state:e,className:n})=>"-"+t===e?i.jsx(Ja,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] rotate-180 "+n}):t===e?i.jsx(Ja,{className:"text-white hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}):i.jsx(Ja,{className:"text-[#9B9B9B] hover:text-[#D8D3D3] group-hover:text-[#D8D3D3] "+n}),el=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s,isFilter:a})=>{const o=()=>{r(n===`-${e}`?e:`-${e}`)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>o(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope cursor-pointer`,children:[i.jsx("div",{className:`${n===e||n===`-${e}`?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(uz,{sortKey:e,state:n,className:""})]})})};function Rl(t){const[e,n]=m.useState(t.minFilterType||""),[r,s]=m.useState(t.maxFilterType||"");m.useEffect(()=>{n(t.minFilterType||"")},[t.minFilterType]),m.useEffect(()=>{s(t.maxFilterType||"")},[t.maxFilterType]);const a=()=>{t.handleChange({target:{name:t.minInputName,value:e}})},o=()=>{t.handleChange({target:{name:t.maxInputName,value:r}})},l=f=>f.preventDefault(),c=f=>f.target.addEventListener("wheel",l,{passive:!1}),u=f=>f.target.removeEventListener("wheel",l),d=f=>{["-","+","e"].includes(f.key)&&f.preventDefault()};return i.jsxs("div",{className:"col-span-1 flex flex-col justify-start max-w-full z-3 font-manrope gap-[13px]",children:[i.jsxs("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px] flex justify-start items-center gap-1",children:[t.name,t.isTooltip&&i.jsxs("span",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!0})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{value:e,onChange:f=>n(f.target.value),onBlur:a,onFocus:c,onBlurCapture:u,type:"number",name:t.minInputName,onKeyDown:["Win Count","Loss Count","Trades Count","Tx Count","Perp Equity","Margin %","Margin Used","Avg. Lvg.","Drawdown PnL"].includes(t.name)?d:void 0,placeholder:"Min",className:`py-0.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-sm font-medium font-inter leading-[8px] w-1/2 px-2 ${e!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`}),i.jsx("input",{value:r,onChange:f=>s(f.target.value),onBlur:o,onFocus:c,onBlurCapture:u,type:"number",name:t.maxInputName,onKeyDown:["Win Count","Loss Count","Trades Count","Tx Count","Perp Equity","Margin %","Margin Used","Avg. Lvg.","Drawdown PnL"].includes(t.name)?d:void 0,placeholder:"Max",className:`bg-[#1b1b1b] rounded-md border border-[#303030] py-0.5 h-8 block sm:text-sm font-semibold font-manrope leading-none w-1/2 px-2 ${r!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`})]})]})}function k4e(t){m.useEffect(()=>{const s=t.minFilterType,a=t.maxFilterType;s&&t.setMinValue(e(s)),a&&t.setMaxValue(e(a))},[t.minInputName,t.maxInputName]);const e=s=>{const a=new Date(Number(s));if(isNaN(a.getTime()))return"";const o=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return String(a.getHours()).padStart(2,"0"),String(a.getMinutes()).padStart(2,"0"),`${o}-${l}-${c}`},n=s=>{const{name:a,value:o}=s.target;if(!o){t.setAdvancedFilters(c=>({...c,[a]:""})),a===t.minInputName?t.setMinValue(""):a===t.maxInputName&&t.setMaxValue("");return}const l=new Date(o).getTime();t.setAdvancedFilters(c=>({...c,[a]:l})),a===t.minInputName?t.setMinValue(o):a===t.maxInputName&&t.setMaxValue(o)},r=async()=>{const s={...t.advancedFilters,[t.minInputName]:"",[t.maxInputName]:""};t.setMinValue(""),t.setMaxValue(""),t.setAdvancedFilters(s)};return i.jsxs("div",{className:"col-span-1 flex flex-col justify-start gap-[7px] min-w-max xl:w-full z-3 font-manrope",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:t.name}),i.jsx("div",{onClick:()=>{r()},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("input",{value:t.minValue||"",onChange:n,type:"date",name:t.minInputName,placeholder:"Min",className:`${t.minValue!==void 0&&t.minValue!==null&&t.minValue!==""?"border border-[#8d67ff] input-data-time-local-white-full":"input-data-time-local-dark-empty"} shadow-sm py-0.5 bg-[#1b1b1b] h-8 border border-[#303030] block sm:text-sm font-semibold font-manrope leading-none rounded-md w-full px-2 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353]`}),i.jsx("input",{value:t.maxValue||"",onChange:n,type:"date",name:t.maxInputName,placeholder:"Max",className:`${t.maxValue!==void 0&&t.maxValue!==null&&t.maxValue!==""?"border border-[#8d67ff] input-data-time-local-white-full":"input-data-time-local-dark-empty"} shadow-sm py-0.5 bg-[#1b1b1b] h-8 border border-[#303030] block sm:text-sm font-semibold font-manrope leading-none rounded-md w-full px-2 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353]`})]})]})}const ban=({className:t})=>i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M11.62 5.22084L7.81667 9.02417C7.3675 9.47334 6.6325 9.47334 6.18334 9.02417L2.38 5.22084",stroke:"#7C7C7C",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})}),UX=({title:t,titleInfo:e,icon:n,children:r})=>{const[s,a]=m.useState(!1),o=()=>{a(!s)};return i.jsxs("div",{className:"overflow-hidden w-full border-t border-t-[#353535]",children:[i.jsxs("div",{className:"w-full flex items-center justify-between pt-3 cursor-pointer",onClick:o,children:[i.jsxs("div",{className:"flex items-center",children:[n&&i.jsx("span",{className:"w-[18px] h-[18px] mr-[8px]",children:n}),i.jsx("span",{className:"text-white font-manrope text-[13px] font-semibold leading-[8px]",children:t}),i.jsx("span",{className:`${e>0?"bg-[#67ffbd]/40 text-[#7bf4bf] shadow-2xl shadow-green-500 text-[10px] font-bold flex justify-center items-center rounded-md px-1.5 py-1 tracking-wide ml-1":"text-white text-[13px] font-semibold"} font-['Manrope'] leading-[8px] `,children:e>0?e:"(0)"})]}),i.jsx("span",{className:`transform transition-transform duration-300 ${s?"rotate-180":"rotate-0"}`,children:i.jsx(ban,{})})]}),i.jsx("div",{className:`flex flex-col transition-[opacity,padding] duration-300 ease-in-out ${s?"opacity-100 pt-4 pb-4 space-y-4 m-1":"opacity-0 h-0 p-0"}`,children:s&&r})]})},yan=({className:t})=>i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M11.1375 2.96251V5.81251H10.0125V2.96251C10.0125 2.76001 9.8325 2.66251 9.7125 2.66251C9.675 2.66251 9.6375 2.67001 9.6 2.68501L3.6525 4.92751C3.255 5.07751 3 5.45251 3 5.88001V6.38251C2.3175 6.89251 1.875 7.71001 1.875 8.63251V5.88001C1.875 4.98751 2.4225 4.19251 3.255 3.87751L9.21 1.62751C9.375 1.56751 9.5475 1.53751 9.7125 1.53751C10.4625 1.53751 11.1375 2.14501 11.1375 2.96251Z",fill:"currentColor"}),i.jsx("path",{d:"M16.125 10.875V11.625C16.125 11.8275 15.9675 11.9925 15.7575 12H14.6625C14.265 12 13.905 11.7075 13.875 11.3175C13.8525 11.085 13.9425 10.8675 14.0925 10.7175C14.2275 10.575 14.415 10.5 14.6175 10.5H15.75C15.9675 10.5075 16.125 10.6725 16.125 10.875Z",fill:"currentColor"}),i.jsx("path",{d:"M14.61 9.7125H15.375C15.7875 9.7125 16.125 9.375 16.125 8.9625V8.6325C16.125 7.08 14.8575 5.8125 13.305 5.8125H4.695C4.0575 5.8125 3.4725 6.0225 3 6.3825C2.3175 6.8925 1.875 7.71 1.875 8.6325V13.68C1.875 15.2325 3.1425 16.5 4.695 16.5H13.305C14.8575 16.5 16.125 15.2325 16.125 13.68V13.5375C16.125 13.125 15.7875 12.7875 15.375 12.7875H14.7225C14.0025 12.7875 13.3125 12.345 13.125 11.6475C12.9675 11.0775 13.155 10.53 13.53 10.1625C13.8075 9.8775 14.19 9.7125 14.61 9.7125ZM10.5 9.5625H5.25C4.9425 9.5625 4.6875 9.3075 4.6875 9C4.6875 8.6925 4.9425 8.4375 5.25 8.4375H10.5C10.8075 8.4375 11.0625 8.6925 11.0625 9C11.0625 9.3075 10.8075 9.5625 10.5 9.5625Z",fill:"currentColor"})]}),van=({className:t})=>i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M12.1425 1.5H5.8575C3.1275 1.5 1.5 3.1275 1.5 5.8575V12.135C1.5 14.8725 3.1275 16.5 5.8575 16.5H12.135C14.865 16.5 16.4925 14.8725 16.4925 12.1425V5.8575C16.5 3.1275 14.8725 1.5 12.1425 1.5ZM12.945 7.47L11.2125 9.705C10.995 9.9825 10.6875 10.1625 10.335 10.2C9.9825 10.245 9.6375 10.1475 9.36 9.93L7.9875 8.85C7.935 8.805 7.875 8.805 7.845 8.8125C7.815 8.8125 7.7625 8.8275 7.7175 8.8875L5.9325 11.205C5.82 11.3475 5.655 11.4225 5.49 11.4225C5.37 11.4225 5.25 11.385 5.145 11.3025C4.8975 11.115 4.8525 10.7625 5.04 10.515L6.825 8.1975C7.0425 7.92 7.35 7.74 7.7025 7.695C8.0475 7.65 8.4 7.7475 8.6775 7.965L10.05 9.045C10.1025 9.09 10.155 9.09 10.1925 9.0825C10.2225 9.0825 10.275 9.0675 10.32 9.0075L12.0525 6.7725C12.24 6.525 12.6 6.48 12.84 6.675C13.0875 6.8775 13.1325 7.23 12.945 7.47Z",fill:"white"})}),wan=({className:t})=>i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M12.1425 1.5H5.8575C3.1275 1.5 1.5 3.1275 1.5 5.8575V12.135C1.5 14.8725 3.1275 16.5 5.8575 16.5H12.135C14.865 16.5 16.4925 14.8725 16.4925 12.1425V5.8575C16.5 3.1275 14.8725 1.5 12.1425 1.5ZM7.5975 10.875C7.815 11.0925 7.815 11.4525 7.5975 11.67C7.485 11.7825 7.3425 11.835 7.2 11.835C7.0575 11.835 6.915 11.7825 6.8025 11.67L4.935 9.8025C4.4925 9.36 4.4925 8.6475 4.935 8.205L6.8025 6.3375C7.02 6.12 7.38 6.12 7.5975 6.3375C7.815 6.555 7.815 6.915 7.5975 7.1325L5.73 9L7.5975 10.875ZM13.065 9.795L11.1975 11.6625C11.085 11.775 10.9425 11.8275 10.8 11.8275C10.6575 11.8275 10.515 11.775 10.4025 11.6625C10.185 11.445 10.185 11.085 10.4025 10.8675L12.27 9L10.4025 7.125C10.185 6.9075 10.185 6.5475 10.4025 6.33C10.62 6.1125 10.98 6.1125 11.1975 6.33L13.065 8.1975C13.5075 8.64 13.5075 9.36 13.065 9.795Z",fill:"white"})});HUe();function Can(t){var X,ne,J,K,te,fe,q,se,ae,W;const[e,n]=m.useState(!1),r=m.useRef(null),[s,a]=m.useState(!1),o=m.useRef(null);m.useEffect(()=>{var ee;const V=(ee=t.advancedFilters)==null?void 0:ee.coin;if(t.dataCoin.length>0){const de=V.split(",").map(Ce=>t.dataCoin.find(me=>me.value===Ce)).filter(Boolean);t.setSelectedCoins(de)}},[t.dataCoin]),m.useEffect(()=>{var ee;const V=(ee=t.advancedFilters)==null?void 0:ee.refcode;if(V&&t.dataReferral.length>0){const de=V.split(",").map(Ce=>t.dataReferral.find(me=>me.value===Ce)).filter(Boolean);t.setSelectedReferrals(de)}},[t.dataReferral]);const l=V=>{if(!V)return;const oe=Array.isArray(V)?V:[V],de=t.selectedCoins||[],Ce=[...de,...oe.filter(xe=>!de.some(be=>be.value===xe.value))],we=Ce.map(xe=>xe.value).join(",");t.setSelectedCoins(Ce),t.setAdvancedFilters(xe=>({...xe,coin:we}))},c=V=>{if(!V)return;const oe=Array.isArray(V)?V:[V],de=t.selectedReferrals||[],Ce=[...de,...oe.filter(we=>!de.some(xe=>xe.value===we.value))],me=Ce.map(we=>we.value);me.join(","),t.setSelectedReferrals(Ce),t.setAdvancedFilters(we=>({...we,refcode:me}))},u=V=>{const{name:ee,value:oe}=V.target;t.setAdvancedFilters(de=>({...de,[ee]:oe}))},d={control:(V,{isFocused:ee})=>{var oe,de,Ce,me,we,xe,be,je;return{...V,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((oe=t.advancedFilters)==null?void 0:oe.coin)&&((de=t.advancedFilters)==null?void 0:de.coin.length)>0||typeof((Ce=t.advancedFilters)==null?void 0:Ce.coin)=="string"&&((me=t.advancedFilters)==null?void 0:me.coin.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((we=t.advancedFilters)==null?void 0:we.coin)&&((xe=t.advancedFilters)==null?void 0:xe.coin.length)>0||typeof((be=t.advancedFilters)==null?void 0:be.coin)=="string"&&((je=t.advancedFilters)==null?void 0:je.coin.trim())!==""?"1px solid #8d67ff":"none"}}},menu:V=>({...V,backgroundColor:"#353535",maxWidth:"248px"}),menuList:V=>({...V,backgroundColor:"#353535",maxHeight:"180px",zIndex:50}),clearIndicator:V=>({...V,color:"#b3b3b3",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",padding:"0px",paddingRight:"5px",":hover":{color:"white"}}),dropdownIndicator:V=>({...V,color:"#b3b3b3",cursor:"pointer",alignItems:"center",justifyContent:"center",width:"25px",height:"25px",minWidth:"25px",minHeight:"25px",padding:"0px",paddingRight:"5px",paddingLeft:"5px",display:"none",":hover":{color:"white"}}),indicatorSeparator:()=>({display:"none"}),option:(V,{data:ee,isDisabled:oe,isFocused:de,isSelected:Ce})=>{const me=bi(ee.color);return{...V,fontSize:"14px",fontWeight:"600",backgroundColor:oe?void 0:Ce?ee.color:de?me.alpha(.1).css():void 0,color:"white",cursor:oe?"not-allowed":"pointer",":active":{...V[":active"],backgroundColor:oe?void 0:Ce?ee.color:me.alpha(.9).css()}}},multiValue:(V,{data:ee})=>{const oe=bi(ee.color);return{...V,backgroundColor:oe.alpha(.4).css()}},multiValueLabel:(V,{data:ee})=>({...V,color:"white"}),multiValueRemove:(V,{data:ee})=>({...V,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:V=>({...V,color:"white"}),valueContainer:V=>({...V,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},f={control:(V,{isFocused:ee})=>{var oe,de,Ce,me,we,xe,be,je;return{...V,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",border:Array.isArray((oe=t.advancedFilters)==null?void 0:oe.refcode)&&((de=t.advancedFilters)==null?void 0:de.refcode.length)>0||typeof((Ce=t.advancedFilters)==null?void 0:Ce.refcode)=="string"&&((me=t.advancedFilters)==null?void 0:me.refcode.trim())!==""?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:Array.isArray((we=t.advancedFilters)==null?void 0:we.refcode)&&((xe=t.advancedFilters)==null?void 0:xe.refcode.length)>0||typeof((be=t.advancedFilters)==null?void 0:be.refcode)=="string"&&((je=t.advancedFilters)==null?void 0:je.refcode.trim())!==""?"1px solid #8d67ff":"none"}}},menu:V=>({...V,backgroundColor:"#353535",maxWidth:"248px"}),menuList:V=>({...V,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:V=>({...V,color:"#b3b3b3",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",padding:"0px",paddingRight:"5px",":hover":{color:"white"}}),dropdownIndicator:V=>({...V,color:"#b3b3b3",cursor:"pointer",alignItems:"center",justifyContent:"center",width:"25px",height:"25px",minWidth:"25px",minHeight:"25px",padding:"0px",paddingRight:"5px",paddingLeft:"5px",display:"none",":hover":{color:"white"}}),indicatorSeparator:()=>({display:"none"}),option:(V,{data:ee,isDisabled:oe,isFocused:de,isSelected:Ce})=>{const me=bi(ee.color);return{...V,fontSize:"14px",fontWeight:"600",backgroundColor:oe?void 0:Ce?ee.color:de?me.alpha(.1).css():void 0,color:"white",cursor:oe?"not-allowed":"pointer",":active":{...V[":active"],backgroundColor:oe?void 0:Ce?ee.color:me.alpha(.9).css()}}},multiValue:(V,{data:ee})=>{const oe=bi(ee.color);return{...V,backgroundColor:oe.alpha(.4).css()}},multiValueLabel:(V,{data:ee})=>({...V,color:"white"}),multiValueRemove:(V,{data:ee})=>({...V,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:V=>({...V,color:"white"}),valueContainer:V=>({...V,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},x=(V,ee)=>{var de;const oe=(de=ee.selectedCoins)==null?void 0:de.filter(Ce=>Ce.value!==V.value);ee.setSelectedCoins(oe),ee.setAdvancedFilters(Ce=>({...Ce,coin:oe==null?void 0:oe.map(we=>we.value)}))},g=(V,ee)=>{var de;const oe=(de=ee.selectedReferrals)==null?void 0:de.filter(Ce=>Ce.value!==V.value);ee.setSelectedReferrals(oe),ee.setAdvancedFilters(Ce=>({...Ce,refcode:oe==null?void 0:oe.map(we=>we.value)}))};m.useEffect(()=>{const V=ee=>{r.current&&!r.current.contains(ee.target)&&n(!1)};return document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[]),m.useEffect(()=>{const V=ee=>{o.current&&!o.current.contains(ee.target)&&a(!1)};return document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[]);const y=async()=>{t.setAdvancedFilters(V=>({...V,user_token:""}))},v=({src:V,alt:ee})=>{const[oe,de]=Ne.useState(!1);return oe?i.jsx("div",{className:"rounded-full w-5 h-5 min-w-5 min-h-5 mr-1 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}):i.jsx("img",{src:V,alt:ee,className:"rounded-full w-5 h-5 min-w-5 min-h-5 mr-1",loading:"lazy",onError:()=>de(!0)})},C=V=>{const{data:ee,innerRef:oe,innerProps:de,selectProps:Ce}=V,me=Ce.styles.option({},V);return i.jsxs("div",{ref:oe,...de,style:me,className:"flex items-center p-2",children:[i.jsx(v,{src:ee.icon,alt:ee.label}),ee.label]})},N=(V,ee)=>ee.reduce((oe,de)=>{const Ce=V[de];return Ce!==void 0&&Ce!==""&&Ce!==null&&oe++,oe},0),P=()=>{const V=t.advancedFilters.is_favorite_wallet?"":!0;t.setAdvancedFilters(ee=>({...ee,is_favorite_wallet:V}))},T=["min_pnl","max_pnl","min_win_complated_rate","max_win_complated_rate","min_complated_trades_count","max_complated_trades_count","min_complated_win_count","max_complated_win_count","min_complated_loss_count","max_complated_loss_count","min_long_kar","max_long_kar","min_short_kar","max_short_kar","min_long_win_rate","max_long_win_rate","min_short_win_rate","max_short_win_rate","min_rTx_count","max_rTx_count"],M=["min_pnl","max_pnl"],F=["min_uPnl","max_uPnl","max_sharpe","min_sharpe","max_growth_rate","min_growth_rate","max_perp_dd","min_perp_dd","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_rToken_count","max_rToken_count","min_uToken_count","max_uToken_count"],$=["min_uPnl","max_uPnl","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_uToken_count","max_uToken_count"],L=["min_uPnl","max_uPnl","max_perp_dd_pnl","min_perp_dd_pnl","min_perp_equity","max_perp_equity","min_margin_roi","max_margin_roi","min_margin_used_percentage","max_margin_used_percentage","min_margin_used","max_margin_used","min_avg_uLeverage_value","max_avg_uLeverage_value","min_funding","max_funding","min_rToken_count","max_rToken_count","min_uToken_count","max_uToken_count"],z=["min_first_time","max_first_time","min_end_time","max_end_time"];return i.jsxs("div",{className:"text-white flex flex-wrap justify-start sm:justify-center font-manrope gap-4 pt-2",children:[i.jsxs("div",{className:"col-span-1 flex flex-col justify-start gap-[7px] w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Search Wallet"}),i.jsx("div",{onClick:()=>{y()},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"flex items-center relative",children:[i.jsx("input",{value:(X=t.advancedFilters)==null?void 0:X.user_token,onChange:u,type:"text",name:"user_token",placeholder:"Search Wallet",className:`${(ne=t.advancedFilters)!=null&&ne.user_token?"border border-[#8d67ff]":""} py-[4px] bg-[#353535] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-full sm:w-full pl-[30px] pr-2 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[32px]`}),i.jsx(zy,{className:"text-[#646464] absolute left-1.5"})]})]}),t.period!=999&&i.jsxs("div",{className:"col-span-1 flex flex-col gap-[7px] justify-start w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("div",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Search Coin"}),i.jsx("div",{onClick:()=>{t.setSelectedCoins([]),t.setAdvancedFilters(V=>({...V,coin:[]}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear Coins"})})]}),i.jsx("div",{className:"float-left w-full",ref:r,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:"text-[#646464] absolute left-[6px] top-[7px] z-10"}),i.jsx(jl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter(V=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(ee=>ee.value===V.value)),components:{Option:C},styles:d,onChange:l,menuIsOpen:e,onMenuOpen:()=>n(!0),placeholder:t.isLoadingCoin?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Search Coin"}),noOptionsMessage:()=>t.isLoadingCoin?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"No data available"})}),i.jsx("div",{className:`absolute top-[220px] z-[4] left-0 w-full max-w-[248px] bg-[#303030] flex flex-wrap gap-1 p-2 border border-[#3a3a3a] mt-1 ${e?"block":"hidden"} ${e&&((J=t.selectedCoins)==null?void 0:J.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((K=t.selectedCoins)==null?void 0:K.map(V=>i.jsxs("div",{className:"h-6 pl-1 rounded-md border border-[#3a3a3a] justify-start items-center gap-0.5 flex",children:[i.jsx(v,{src:V==null?void 0:V.icon,alt:V==null?void 0:V.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:V.label}),i.jsx("div",{onClick:ee=>{ee.stopPropagation(),x(V,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},V.value)))}),i.jsx("div",{className:`${((te=t.selectedCoins)==null?void 0:te.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[248px]`,children:t.selectedCoins&&((fe=t.selectedCoins)==null?void 0:fe.map(V=>i.jsxs("div",{className:"h-6 pl-1.5 rounded-md border border-[#3a3a3a] justify-start items-center gap-1.5 flex",children:[i.jsx(v,{src:V==null?void 0:V.icon,alt:V==null?void 0:V.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:V.label}),i.jsx("div",{onClick:()=>x(V,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},V.value)))})]})})]}),i.jsxs("div",{className:"flex justify-between items-center gap-1 w-full h-8 bg-[#353535] rounded-xl px-2.5",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1 w-max",children:[i.jsx("div",{style:{boxShadow:"0px 4px 24px 0px #FF600A, 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"},className:"w-[18px] h-[18px] px-2 py-1.5 bg-gradient-to-b from-[#ff7200] to-[#ff2525] rounded-[5px] flex justify-center items-center",children:i.jsx("img",{src:wEe,alt:"",className:"w-[9.67px] h-[12px] min-w-[9.67px] min-h-[12px]"})}),i.jsx("span",{className:"text-white text-[13px] font-semibold font-['Manrope'] leading-[8px] ml-1",children:"Show Popular Wallets"})]}),i.jsx("div",{onClick:P,style:{boxShadow:"0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"},className:`w-[17px] h-[17px] rounded-md flex items-center justify-center transition-all
${t.advancedFilters.is_favorite_wallet?"bg-[#3ec78c] border-[#3ec78c]":"bg-transparent border border-[#12d782]"}
cursor-pointer
`,children:t.advancedFilters.is_favorite_wallet&&i.jsx("svg",{className:"w-[12px] h-[12px] text-[#0c623d]",fill:"none",stroke:"currentColor",strokeWidth:"3",viewBox:"0 0 24 24",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})})}),i.jsx("input",{type:"checkbox",checked:t.advancedFilters.is_favorite_wallet===!0,onChange:P,className:"hidden"})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[7px] justify-start w-full z-3 bg-[#353535] rounded-xl pt-3 pb-1 px-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{style:{boxShadow:"0px 4px 24px 0px #9137FF, 0px 1px 1px 0px rgba(255, 255, 255, 0.32) inset"},className:"flex justify-center items-center w-[18px] h-[18px] px-2 py-1.5 bg-[#8b2cff] rounded-[5px] ml-[5px]",children:i.jsx("img",{src:qlt,alt:"",className:"w-[16px] h-[16px] min-w-[16px] min-h-[16px]"})}),i.jsx("div",{className:"flex justify-start text-white text-[13px] font-semibold font-['Manrope'] leading-[8px] ml-[5px]",children:"Filter by Referrer"})]}),i.jsxs("div",{className:"flex flex-col gap-[7px] bg-[#1f1f1f] rounded-xl p-2.5",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("div",{className:"text-[#c9c9c9] text-[13px] font-semibold font-['Manrope'] leading-[8px]",children:"Filter by Referrer"})}),i.jsx("div",{onClick:()=>{t.setSelectedReferrals([]),t.setAdvancedFilters(V=>({...V,refcode:[]}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsx("div",{className:"float-left w-full",ref:o,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:`${e?"-z-10":"z-10"} text-[#646464] absolute left-[6px] top-[7px]`}),i.jsx(jl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataReferral.filter(V=>Array.isArray(t.selectedReferrals)&&!t.selectedReferrals.some(ee=>ee.value===V.value)),styles:f,onChange:c,menuIsOpen:s,onMenuOpen:()=>a(!0),placeholder:t.isLoadingReferral?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Search Referrer"}),noOptionsMessage:()=>t.isLoadingReferral?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"No data available"})}),i.jsx("div",{className:`absolute top-[220px] z-[4] left-0 w-full max-w-[248px] bg-[#303030] flex flex-wrap gap-1 p-2 border border-[#3a3a3a] mt-1 ${s?"block":"hidden"} ${s&&((q=t.selectedReferrals)==null?void 0:q.length)>0?"block":"hidden"}`,children:t.selectedReferrals&&((se=t.selectedReferrals)==null?void 0:se.map(V=>i.jsxs("div",{className:"h-6 pl-1 rounded-md border border-[#3a3a3a] justify-start items-center gap-0.5 flex",children:[i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:V.label}),i.jsx("div",{onClick:ee=>{ee.stopPropagation(),g(V,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},V.value)))}),i.jsx("div",{className:`${((ae=t.selectedReferrals)==null?void 0:ae.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[248px]`,children:t.selectedReferrals&&((W=t.selectedReferrals)==null?void 0:W.map(V=>i.jsxs("div",{className:"h-6 pl-1.5 rounded-md border border-[#3a3a3a] justify-start items-center gap-1.5 flex",children:[i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:V.label}),i.jsx("div",{onClick:()=>g(V,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},V.value)))})]})})]})]}),i.jsxs(UX,{title:"Wallet Filters",titleInfo:N(t.advancedFilters,t.period!=999?T:M),icon:i.jsx(yan,{className:"text-white"}),children:[i.jsx(Rl,{minFilterType:t.advancedFilters.min_pnl,maxFilterType:t.advancedFilters.max_pnl,handleChange:u,minInputName:"min_pnl",maxInputName:"max_pnl",name:"PnL",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_win_complated_rate,maxFilterType:t.advancedFilters.max_win_complated_rate,handleChange:u,minInputName:"min_win_complated_rate",maxInputName:"max_win_complated_rate",name:"Win Rate",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_complated_trades_count,maxFilterType:t.advancedFilters.max_complated_trades_count,handleChange:u,minInputName:"min_complated_trades_count",maxInputName:"max_complated_trades_count",name:"Trades Count",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_complated_win_count,maxFilterType:t.advancedFilters.max_complated_win_count,handleChange:u,minInputName:"min_complated_win_count",maxInputName:"max_complated_win_count",name:"Win Count",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_complated_loss_count,maxFilterType:t.advancedFilters.max_complated_loss_count,handleChange:u,minInputName:"min_complated_loss_count",maxInputName:"max_complated_loss_count",name:"Loss Count",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_long_kar,maxFilterType:t.advancedFilters.max_long_kar,handleChange:u,minInputName:"min_long_kar",maxInputName:"max_long_kar",name:"Long PnL",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_short_kar,maxFilterType:t.advancedFilters.max_short_kar,handleChange:u,minInputName:"min_short_kar",maxInputName:"max_short_kar",name:"Short PnL",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_rTx_count,maxFilterType:t.advancedFilters.max_rTx_count,handleChange:u,minInputName:"min_rTx_count",maxInputName:"max_rTx_count",name:"Tx Count",isTooltip:!1})]}),i.jsxs(UX,{title:"Performance Filters",titleInfo:N(t.advancedFilters,t.period==999?$:t.period==1?L:F),icon:i.jsx(van,{}),children:[i.jsx(Rl,{minFilterType:t.advancedFilters.min_uPnl,maxFilterType:t.advancedFilters.max_uPnl,handleChange:u,minInputName:"min_uPnl",maxInputName:"max_uPnl",name:"uPnL",isTooltip:!1}),t.period!=1&&t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_growth_rate,maxFilterType:t.advancedFilters.max_growth_rate,handleChange:u,minInputName:"min_growth_rate",maxInputName:"max_growth_rate",name:"Growth Rate",isTooltip:!1}),t.period!=1&&t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_perp_dd,maxFilterType:t.advancedFilters.max_perp_dd,handleChange:u,minInputName:"min_perp_dd",maxInputName:"max_perp_dd",name:"Drawdown",isTooltip:!1}),t.period!=1&&t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_sharpe,maxFilterType:t.advancedFilters.max_sharpe,handleChange:u,minInputName:"min_sharpe",maxInputName:"max_sharpe",name:"Sharpe",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_perp_equity,maxFilterType:t.advancedFilters.max_perp_equity,handleChange:u,minInputName:"min_perp_equity",maxInputName:"max_perp_equity",name:"Perp Equity",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_margin_roi,maxFilterType:t.advancedFilters.max_margin_roi,handleChange:u,minInputName:"min_margin_roi",maxInputName:"max_margin_roi",name:"ROE",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_margin_used_percentage,maxFilterType:t.advancedFilters.max_margin_used_percentage,handleChange:u,minInputName:"min_margin_used_percentage",maxInputName:"max_margin_used_percentage",name:"Margin %",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_margin_used,maxFilterType:t.advancedFilters.max_margin_used,handleChange:u,minInputName:"min_margin_used",maxInputName:"max_margin_used",name:"Margin Used",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_avg_uLeverage_value,maxFilterType:t.advancedFilters.max_avg_uLeverage_value,handleChange:u,minInputName:"min_avg_uLeverage_value",maxInputName:"max_avg_uLeverage_value",name:"Avg. Lvg.",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_funding,maxFilterType:t.advancedFilters.max_funding,handleChange:u,minInputName:"min_funding",maxInputName:"max_funding",name:"Funding",isTooltip:!1}),t.period!=999&&i.jsx(Rl,{minFilterType:t.advancedFilters.min_rToken_count,maxFilterType:t.advancedFilters.max_rToken_count,handleChange:u,minInputName:"min_rToken_count",maxInputName:"max_rToken_count",name:"rToken",isTooltip:!1}),i.jsx(Rl,{minFilterType:t.advancedFilters.min_uToken_count,maxFilterType:t.advancedFilters.max_uToken_count,handleChange:u,minInputName:"min_uToken_count",maxInputName:"max_uToken_count",name:"uToken",isTooltip:!1})]}),t.period!=999&&i.jsxs(UX,{title:"Date Filters",titleInfo:N(t.advancedFilters,z),icon:i.jsx(wan,{}),children:[i.jsx(k4e,{minFilterType:t.advancedFilters.min_first_time,maxFilterType:t.advancedFilters.max_first_time,advancedFilters:t.advancedFilters,setAdvancedFilters:t.setAdvancedFilters,minInputName:"min_first_time",maxInputName:"max_first_time",name:"First Tx Time",minValue:t.minFirstValue,maxValue:t.maxFirstValue,setMinValue:t.setMinFirstValue,setMaxValue:t.setMaxFirstValue,setFilters:t.setFilters}),i.jsx(k4e,{minFilterType:t.advancedFilters.min_end_time,maxFilterType:t.advancedFilters.max_end_time,advancedFilters:t.advancedFilters,setAdvancedFilters:t.setAdvancedFilters,minInputName:"min_end_time",maxInputName:"max_end_time",name:"Last Tx Time",minValue:t.minEndValue,maxValue:t.maxEndValue,setMinValue:t.setMinEndValue,setMaxValue:t.setMaxEndValue,setFilters:t.setFilters})]})]})}const San=({period:t,advancedFilters:e,setAdvancedFilters:n,resetFilters:r,setFilters:s,minFirstValue:a,setMinFirstValue:o,maxFirstValue:l,setMaxFirstValue:c,minEndValue:u,setMinEndValue:d,maxEndValue:f,setMaxEndValue:x,dataCoin:g,selectedCoins:y,setSelectedCoins:v,isLoadingCoin:C,setIsLoadingCoin:N,dataReferral:P,selectedReferrals:T,setSelectedReferrals:M,isLoadingReferral:F,setIsLoadingReferral:$})=>{const[L,z]=m.useState(!1);return m.useEffect(()=>{localStorage.getItem("fire_ref_modal_seen")||z(!0)},[]),i.jsx(i.Fragment,{children:i.jsxs("div",{className:"bg-[#232323] rounded-2xl min-h-[340px] sm:max-h-full lg:min-h-[66vh] order-last lg:order-none lg:w-min min-w-[286px] lg:max-w-[286px] p-1 py-3 font-manrope overflow-hidden relative h-[calc(100vh-150px)] sm:h-[calc(100vh-125px)]",children:[i.jsxs("div",{className:"w-full flex justify-between items-center pt-[2px] pl-3 pr-1 pb-[10px]",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[8px]",children:"Filters"}),i.jsx("div",{className:"flex sm:hidden justify-center",children:i.jsx("div",{onClick:()=>s(),className:"w-[134px] h-6 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] pointer-events-none",children:"Search"})})}),i.jsx("div",{onClick:()=>{r()},className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex mr-3 cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("div",{className:"h-full w-full overflow-y-scroll font-manrope py-1 px-3",children:i.jsx("div",{className:"font-manrope font-normal pb-[120px] sm:pb-[80px] max-w-full lg:max-w-[256px]",children:i.jsx(Can,{period:t,resetFilters:r,setFilters:s,advancedFilters:e,setAdvancedFilters:n,minFirstValue:a,setMinFirstValue:o,maxFirstValue:l,setMaxFirstValue:c,minEndValue:u,setMinEndValue:d,maxEndValue:f,setMaxEndValue:x,dataCoin:g,selectedCoins:y,setSelectedCoins:v,isLoadingCoin:C,setIsLoadingCoin:N,dataReferral:P,selectedReferrals:T,setSelectedReferrals:M,isLoadingReferral:F,setIsLoadingReferral:$})})}),i.jsx("div",{className:"hidden sm:block absolute bottom-0 w-full",children:i.jsx("div",{className:"sticky h-12 bg-[#1b1b1b]/30 rounded-bl-2xl rounded-br-2xl border-t border-[#353535] backdrop-blur-[32px] min-h-14 pt-[11px] w-full z-10",children:i.jsx("div",{className:"flex justify-center -ml-3",children:i.jsx("div",{onClick:()=>s(),className:"w-[234px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] pointer-events-none",children:"Search"})})})})})]})})},cVe=()=>i.jsxs("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:[i.jsx("div",{className:"p-4 bg-#FFA756 bg-opacity-20 rounded-full",children:i.jsx("img",{src:plt,alt:"",className:"w-8 h-8"})}),i.jsxs("div",{className:"flex flex-col items-center justify-center gap-1",children:[i.jsx("div",{className:"text-#FFA756",children:"No Data"}),i.jsxs("div",{className:"text-#767676",children:["There isn't any data"," ",i.jsxs("span",{children:["for this",i.jsx("br",{})," time range at the moment"]})]})]})]}),T4e=({content:t,positionTop:e,alignRight:n,type:r})=>{const s=t?r==="coin"?t.split(", ").map(a=>{const[o,l]=a.split(" (");return{name:o,value:l==null?void 0:l.replace(")","")}}):r==="position"?t==null?void 0:t.map(a=>({name:a.coin,value:a.unrealized_pnl})):[]:[];return i.jsx("span",{className:`tooltip ${n?"left-5 top-1/2 -translate-y-1/2 ":e?"-top-6 translate-x-[10%] -left-[20%]":"-top-6 translate-x-[10%] right-[20%] mr-9"} transform text-white font-manrope font-semibold text-xs leading-3 whitespace-nowrap mt-1`,children:i.jsxs("div",{className:`${e?"ml-6":"mr-6"} border border-[#404040] bg-[#222222] p-2 rounded-sm relative`,children:[i.jsx("div",{className:"overflow-y-auto scroll-design-search-scroll w-max min-h-[31px] h-max max-h-[160px]",children:i.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:(s==null?void 0:s.length)>0?s==null?void 0:s.map((a,o)=>i.jsxs("li",{className:`${o===(s==null?void 0:s.length)-1?"mb-0":"mb-[5px]"} flex justify-between pl-1 pr-2 h-max p-2 rounded border border-[#7d7c7c]`,children:[i.jsx("span",{className:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))||(a==null?void 0:a.value)==0?"text-white":(a==null?void 0:a.value)>0?"text-[#1DE6A3]":"text-[#FF7173]"} flex justify-start items-center gap-1 min-w-20 border-r border-white`,children:a==null?void 0:a.name}),i.jsx("span",{className:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))||(a==null?void 0:a.value)==0?"text-white":(a==null?void 0:a.value)>0?"text-[#1DE6A3]":"text-[#FF7173]"} pl-4`,children:`${(a==null?void 0:a.value)==null||isNaN(parseFloat(a==null?void 0:a.value))?"-":Ms(Math.abs(a==null?void 0:a.value))}`})]},o)):i.jsx("span",{children:"No data available"})})}),i.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`absolute transform -z-1 ${n?"-rotate-90 left-1 -translate-x-full -translate-y-1/2 top-1/2 ":e?"-left-2 top-[15%] -rotate-90 -translate-y-1/2":"-right-2 top-[15%] rotate-90 -translate-y-1/2"}`,children:i.jsx("path",{d:"M3.70096 1.25C4.27831 0.25 5.72169 0.25 6.29904 1.25L8.89711 5.75C9.47446 6.75 8.75278 8 7.59808 8H2.40192C1.24722 8 0.525536 6.75 1.10289 5.75L3.70096 1.25Z",fill:"#404040",stroke:"#404040"})})]})})},ade=({periods:t,selectedPeriod:e,handlePeriod:n,borderColor:r})=>i.jsx(i.Fragment,{children:t?i.jsx("div",{className:`${r=="ticker"?"border-[#333333]":"border-[#232323]"} flex items-center justify-center w-max h-[28px] rounded-lg border font-manrope p-[3px] `,children:t.map((s,a)=>i.jsx("button",{onClick:o=>n(o.target.dataset.value),"data-value":s.value,className:`${s.value===e?"bg-[#3d3d3d] text-white":"bg-transparent text-[#9b9b9b]"} flex justify-center items-center uppercase font-manrope focus:outline-none focus:ring-0 border-none rounded-md text-xs font-bold leading-[8px] tracking-wide h-5 w-[35.5px] sm:w-[48px]`,children:s.name},a))}):null});function Nan({currentPage:t,offset:e,setOffset:n,totalPage:r,totalWalletCount:s}){return i.jsxs("header",{className:"flex items-center justify-between gap-2 z-4 bg-[#161616] font-manrope",children:[i.jsxs("div",{className:"flex justify-center items-center gap-1",children:[i.jsx(ji,{className:"text-white hidden sm:block"}),i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-white text-[12px] font-semibold font-manrope leading-[14px]",children:s}),i.jsx("span",{className:"text-[#7e7e7e] text-[12px] font-semibold font-manrope leading-[14px]",children:"wallets found"})]})]}),i.jsxs("div",{className:"flex items-center justify-start gap-[4px]",children:[i.jsx("button",{onClick:t===1?()=>{}:()=>n(e===0?0:e-50),type:"button",className:t===1?"relative inline-flex items-center p-1.5 text-sm font-medium text-white/20 rounded-md focus:ring-0 focus:outline-none border-none cursor-not-allowed bg-[#3d3d3d] w-6 h-6":"relative inline-flex items-center p-1.5 rounded-md bg-[#3d3d3d] text-sm font-medium text-white hover:bg-white/40 focus:outline-none focus:ring-0 border-none focus:z-10",children:i.jsx(ld,{className:`${t===1?"text-white/30":"text-white"} w-3 h-3 rotate-90`})}),i.jsxs("div",{type:"button",className:"-ml-px relative inline-flex items-center px-2 py-2 bg-[#3d3d3d]/60 text-sm font-medium text-white focus:z-10 focus:outline-none focus:ring-0 outline-none min-w-max h-6 max-h-6 rounded-md",children:[t," / ",r]}),i.jsx("button",{onClick:t===r||r===0?()=>{}:()=>n(e+50),type:"button",className:t===r?"bg-[#3d3d3d] w-6 h-6 cursor-not-allowed relative inline-flex items-center p-1.5 rounded-md text-sm font-medium text-black focus:z-10 focus:outline-none focus:ring-0 border-none":"relative inline-flex items-center p-1.5 rounded-md bg-[#3d3d3d] w-6 h-6 text-sm font-medium text-white hover:bg-white/40 focus:z-10 focus:outline-none focus:ring-0 border-none",children:i.jsx(ld,{className:`${t===r?"text-white/30":"text-white"} w-3 h-3 -rotate-90`})})]})]})}const Aan=({info1:t,info2:e,padding:n,icon:r,info1_Color:s,info2_Color:a,rowTwo:o,info3:l})=>i.jsxs("div",{className:`${n||"pl-1 pr-2"} flex flex-col gap-2 font-manrope`,children:[e&&i.jsx("div",{className:`${a} text-xs font-normal not-italic font-inter flex items-center justify-end leading-3 min-w-max text-white`,children:e}),i.jsxs("div",{className:`${s} ${o?"-mt-3.5":""} text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:[i.jsx("img",{src:r,alt:"",className:""}),l?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[#1DE6A3]",children:t})," /"," ",i.jsx("span",{className:"text-[#FF7173]",children:l})]}):t]})]});function jan({open:t,setOpen:e}){return i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-4",children:[i.jsx("div",{className:"text-center text-white text-[32px] font-manrope font-semibold leading-loose",children:"Coming Soon"}),i.jsx("div",{className:"w-[300px] text-center text-white/60 text-sm font-medium font-manrope leading-[18px] tracking-[0.28px] pt-4 pb-8 px-5",children:"Join Dextrabot on Discord for the latest features and announcements!"}),i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank"),e(!1)},className:"flex justify-center items-center w-[348px] h-12 bg-[#7446FF] rounded-2xl mt-2 cursor-pointer",children:i.jsx("div",{className:"text-center text-white text-sm font-semibold font-manrope leading-[0.28px] tracking-tight",children:"Join Dextrabot on Discord"})})]})]})})})})})]})}function Ean(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),s=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(s),e&&(r.href=e),s.href=t,s.href}const _an=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function Vy(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let NC=null;function uVe(t={}){return NC||(t.includeStyleProperties?(NC=t.includeStyleProperties,NC):(NC=Vy(window.getComputedStyle(document.documentElement)),NC))}function DD(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function kan(t){const e=DD(t,"border-left-width"),n=DD(t,"border-right-width");return t.clientWidth+e+n}function Tan(t){const e=DD(t,"border-top-width"),n=DD(t,"border-bottom-width");return t.clientHeight+e+n}function dVe(t,e={}){const n=e.width||kan(t),r=e.height||Tan(t);return{width:n,height:r}}function Pan(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const Mf=16384;function Ian(t){(t.width>Mf||t.height>Mf)&&(t.width>Mf&&t.height>Mf?t.width>t.height?(t.height*=Mf/t.width,t.width=Mf):(t.width*=Mf/t.height,t.height=Mf):t.width>Mf?(t.height*=Mf/t.width,t.width=Mf):(t.width*=Mf/t.height,t.height=Mf))}function BD(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function Fan(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Oan(t,e,n){const r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return s.setAttribute("width",`${e}`),s.setAttribute("height",`${n}`),s.setAttribute("viewBox",`0 0 ${e} ${n}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),s.appendChild(a),a.appendChild(t),Fan(s)}const pf=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||pf(n,e)};function Man(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Ran(t,e){return uVe(e).map(n=>{const r=t.getPropertyValue(n),s=t.getPropertyPriority(n);return`${n}: ${r}${s?" !important":""};`}).join(" ")}function Lan(t,e,n,r){const s=`.${t}:${e}`,a=n.cssText?Man(n):Ran(n,r);return document.createTextNode(`${s}{${a}}`)}function P4e(t,e,n,r){const s=window.getComputedStyle(t,n),a=s.getPropertyValue("content");if(a===""||a==="none")return;const o=_an();try{e.className=`${e.className} ${o}`}catch{return}const l=document.createElement("style");l.appendChild(Lan(o,n,s,r)),e.appendChild(l)}function Dan(t,e,n){P4e(t,e,":before",n),P4e(t,e,":after",n)}const I4e="application/font-woff",F4e="image/jpeg",Ban={woff:I4e,woff2:I4e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:F4e,jpeg:F4e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function $an(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function ode(t){const e=$an(t).toLowerCase();return Ban[e]||""}function Uan(t){return t.split(/,/)[1]}function Gre(t){return t.search(/^(data:)/)!==-1}function zan(t,e){return`data:${e};base64,${t}`}async function fVe(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const s=await r.blob();return new Promise((a,o)=>{const l=new FileReader;l.onerror=o,l.onloadend=()=>{try{a(n({res:r,result:l.result}))}catch(c){o(c)}},l.readAsDataURL(s)})}const zX={};function Han(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function lde(t,e,n){const r=Han(t,e,n.includeQueryParams);if(zX[r]!=null)return zX[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let s;try{const a=await fVe(t,n.fetchRequestInit,({res:o,result:l})=>(e||(e=o.headers.get("Content-Type")||""),Uan(l)));s=zan(a,e)}catch(a){s=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return zX[r]=s,s}async function Van(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):BD(e)}async function Wan(t,e){if(t.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=t.clientWidth,a.height=t.clientHeight,o==null||o.drawImage(t,0,0,a.width,a.height);const l=a.toDataURL();return BD(l)}const n=t.poster,r=ode(n),s=await lde(n,r,e);return BD(s)}async function qan(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await dz(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Gan(t,e){return pf(t,HTMLCanvasElement)?Van(t):pf(t,HTMLVideoElement)?Wan(t,e):pf(t,HTMLIFrameElement)?qan(t,e):t.cloneNode(hVe(t))}const Kan=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",hVe=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Yan(t,e,n){var r,s;if(hVe(e))return e;let a=[];return Kan(t)&&t.assignedNodes?a=Vy(t.assignedNodes()):pf(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=Vy(t.contentDocument.body.childNodes):a=Vy(((s=t.shadowRoot)!==null&&s!==void 0?s:t).childNodes),a.length===0||pf(t,HTMLVideoElement)||await a.reduce((o,l)=>o.then(()=>dz(l,n)).then(c=>{c&&e.appendChild(c)}),Promise.resolve()),e}function Xan(t,e,n){const r=e.style;if(!r)return;const s=window.getComputedStyle(t);s.cssText?(r.cssText=s.cssText,r.transformOrigin=s.transformOrigin):uVe(n).forEach(a=>{let o=s.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),pf(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),r.setProperty(a,o,s.getPropertyPriority(a))})}function Qan(t,e){pf(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),pf(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Zan(t,e){if(pf(t,HTMLSelectElement)){const n=e,r=Array.from(n.children).find(s=>t.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function Jan(t,e,n){return pf(e,Element)&&(Xan(t,e,n),Dan(t,e,n),Qan(t,e),Zan(t,e)),e}async function eon(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let a=0;a<n.length;a++){const l=n[a].getAttribute("xlink:href");if(l){const c=t.querySelector(l),u=document.querySelector(l);!c&&u&&!r[l]&&(r[l]=await dz(u,e,!0))}}const s=Object.values(r);if(s.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const l=document.createElementNS(a,"defs");o.appendChild(l);for(let c=0;c<s.length;c++)l.appendChild(s[c]);t.appendChild(o)}return t}async function dz(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>Gan(r,e)).then(r=>Yan(t,r,e)).then(r=>Jan(t,r,e)).then(r=>eon(r,e))}const pVe=/url\((['"]?)([^'"]+?)\1\)/g,ton=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,non=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ron(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function son(t){const e=[];return t.replace(pVe,(n,r,s)=>(e.push(s),n)),e.filter(n=>!Gre(n))}async function ion(t,e,n,r,s){try{const a=n?Ean(e,n):e,o=ode(e);let l;return s||(l=await lde(a,o,r)),t.replace(ron(e),`$1${l}$3`)}catch{}return t}function aon(t,{preferredFontFormat:e}){return e?t.replace(non,n=>{for(;;){const[r,,s]=ton.exec(n)||[];if(!s)return"";if(s===e)return`src: ${r};`}}):t}function mVe(t){return t.search(pVe)!==-1}async function xVe(t,e,n){if(!mVe(t))return t;const r=aon(t,n);return son(r).reduce((a,o)=>a.then(l=>ion(l,o,e,n)),Promise.resolve(r))}async function AC(t,e,n){var r;const s=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(s){const a=await xVe(s,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function oon(t,e){await AC("background",t,e)||await AC("background-image",t,e),await AC("mask",t,e)||await AC("-webkit-mask",t,e)||await AC("mask-image",t,e)||await AC("-webkit-mask-image",t,e)}async function lon(t,e){const n=pf(t,HTMLImageElement);if(!(n&&!Gre(t.src))&&!(pf(t,SVGImageElement)&&!Gre(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,s=await lde(r,ode(r),e);await new Promise((a,o)=>{t.onload=a,t.onerror=e.onImageErrorHandler?(...c)=>{try{a(e.onImageErrorHandler(...c))}catch(u){o(u)}}:o;const l=t;l.decode&&(l.decode=a),l.loading==="lazy"&&(l.loading="eager"),n?(t.srcset="",t.src=s):t.href.baseVal=s})}async function con(t,e){const r=Vy(t.childNodes).map(s=>gVe(s,e));await Promise.all(r).then(()=>t)}async function gVe(t,e){pf(t,Element)&&(await oon(t,e),await lon(t,e),await con(t,e))}function uon(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(s=>{n[s]=r[s]}),t}const O4e={};async function M4e(t){let e=O4e[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},O4e[t]=e,e}async function R4e(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let l=o.replace(r,"$1");return l.startsWith("https://")||(l=new URL(l,t.url).href),fVe(l,e.fetchRequestInit,({result:c})=>(n=n.replace(o,`url(${c})`),[o,c]))});return Promise.all(a).then(()=>n)}function L4e(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=s.exec(r);if(c===null)break;e.push(c[0])}r=r.replace(s,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(o,"gi");for(;;){let c=a.exec(r);if(c===null){if(c=l.exec(r),c===null)break;a.lastIndex=l.lastIndex}else l.lastIndex=a.lastIndex;e.push(c[0])}return e}async function don(t,e){const n=[],r=[];return t.forEach(s=>{if("cssRules"in s)try{Vy(s.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let l=o+1;const c=a.href,u=M4e(c).then(d=>R4e(d,e)).then(d=>L4e(d).forEach(f=>{try{s.insertRule(f,f.startsWith("@import")?l+=1:s.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:f,error:x})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(u)}})}catch(a){const o=t.find(l=>l.href==null)||document.styleSheets[0];s.href!=null&&r.push(M4e(s.href).then(l=>R4e(l,e)).then(l=>L4e(l).forEach(c=>{o.insertRule(c,o.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",a)}}),Promise.all(r).then(()=>(t.forEach(s=>{if("cssRules"in s)try{Vy(s.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${s.href}`,a)}}),n))}function fon(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>mVe(e.style.getPropertyValue("src")))}async function hon(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Vy(t.ownerDocument.styleSheets),r=await don(n,e);return fon(r)}function bVe(t){return t.trim().replace(/["']/g,"")}function pon(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(bVe(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function mon(t,e){const n=await hon(t,e),r=pon(t);return(await Promise.all(n.filter(a=>r.has(bVe(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return xVe(a.cssText,o,e)}))).join(`
`)}async function xon(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await mon(t,e);if(n){const r=document.createElement("style"),s=document.createTextNode(n);r.appendChild(s),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function gon(t,e={}){const{width:n,height:r}=dVe(t,e),s=await dz(t,e,!0);return await xon(s,e),await gVe(s,e),uon(s,e),await Oan(s,n,r)}async function bon(t,e={}){const{width:n,height:r}=dVe(t,e),s=await gon(t,e),a=await BD(s),o=document.createElement("canvas"),l=o.getContext("2d"),c=e.pixelRatio||Pan(),u=e.canvasWidth||n,d=e.canvasHeight||r;return o.width=u*c,o.height=d*c,e.skipAutoScale||Ian(o),o.style.width=`${u}`,o.style.height=`${d}`,e.backgroundColor&&(l.fillStyle=e.backgroundColor,l.fillRect(0,0,o.width,o.height)),l.drawImage(a,0,0,o.width,o.height),o}async function V1(t,e={}){return(await bon(t,e)).toDataURL()}function yon({open:t,setOpen:e,data:n,setTradeInfo:r,period:s}){const a=m.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(u=>setTimeout(u,500));const l=await V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),c=document.createElement("a");c.href=l,c.download="dextrabot.png",document.body.appendChild(c),c.click(),document.body.removeChild(c),tn.success("PNG successfully downloaded!")}catch(l){console.error("Error generating PNG:",l),tn.error("Failed to download PNG.")}};return i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(l=>({...l,pnl:0,winRate:0,tradeCount:0,longWinRate:0,shortWinRate:0,leverage:0,roe:0,unrealizedPnL:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[838px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[830px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[482px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[42px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:`${s==999?"mt-20":"mt-[44px]"} flex flex-col items-start justify-start gap-2 `,children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"PnL"}),i.jsx("div",{className:`${(n==null?void 0:n.pnl)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[66px] font-semibold font-manrope leading-[52px] inline-flex justify-center items-center min-w-max`,children:(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`})]}),i.jsxs("div",{className:`${s==999?"hidden":""} flex justify-start items-start gap-[65px] pt-[26px]`,children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max min-w-[140px]",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.winRate)==null||isNaN(parseFloat(n==null?void 0:n.winRate))?"--":(n==null?void 0:n.winRate)+"%"}`})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"TX COUNT"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.tradeCount)==null||isNaN(parseFloat(n==null?void 0:n.tradeCount))?"--":Ms(n==null?void 0:n.tradeCount)}`})]})]}),i.jsxs("div",{className:`${s==999?"hidden":""} flex justify-start items-start gap-[65px] pt-[8px]`,children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"LONG WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.longWinRate)==null||isNaN(parseFloat(n==null?void 0:n.longWinRate))?"--":(n==null?void 0:n.longWinRate)+"%"}`})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"SHORT WIN RATE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:`${(n==null?void 0:n.shortWinRate)==null||isNaN(parseFloat(n==null?void 0:n.shortWinRate))?"--":(n==null?void 0:n.shortWinRate)+"%"}`})]})]}),(n==null?void 0:n.referral)&&i.jsx("div",{className:`${s==999?"pt-[150px]":"pt-[26px]"} flex justify-start items-start gap-[65px]`,children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral?"pt-[1px]":s==999?"pt-[240px]":"pt-[82px]"} flex justify-start items-start `,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[378px] overflow-hidden",children:(n==null?void 0:n.pnl)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Numbers don’t lie! 🔥 Total Profit:"," ",(n==null?void 0:n.pnl)>=0?"":"-",(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders and save 4% on fees using my referral: ",n==null?void 0:n.referral," ","@Dextrabot"," "]}):i.jsxs("span",{children:["Numbers don’t lie! 🔥 Total Profit:"," ",(n==null?void 0:n.pnl)>=0?"":"-",(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`$${Ms(Math.abs(n==null?void 0:n.pnl))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders! @Dextrabot"]})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:l=>{l.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:()=>{o()},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Numbers%20don’t%20lie!%20🔥%20Total%20Profit:%20${(n==null?void 0:n.pnl)==null||isNaN(parseFloat(n==null?void 0:n.pnl))?"--":`${(n==null?void 0:n.pnl)>=0?"":"-"}%24${Ms(Math.abs(n==null?void 0:n.pnl))}`}%20🚀%20Tap%20into%20the%20best%20trades%20with%20Dextrabot%20on%20Hyperliquid!%20Copy%20top%20traders${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20and%20save%204%25%20on%20fees%20using%20my%20referral:%20${n==null?void 0:n.referral}`:"!"}%20%40Dextrabot%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}function von({open:t,setOpen:e,data:n,setTradeInfo:r}){const s=m.useRef(null),a=async()=>{if(s.current)try{await document.fonts.ready,await new Promise(c=>setTimeout(c,500));const o=await V1(s.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),l=document.createElement("a");l.href=o,l.download="dextrabot.png",document.body.appendChild(l),l.click(),document.body.removeChild(l),tn.success("PNG successfully downloaded!")}catch(o){console.error("Error generating PNG:",o),tn.error("Failed to download PNG.")}};return i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(o=>({...o,pnl:0,winRate:0,tradeCount:0,longWinRate:0,shortWinRate:0,leverage:0,roe:0,unrealizedPnL:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:s,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[42px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsx("div",{className:"flex justify-start items-center gap-2 relative mt-16",children:i.jsx("div",{className:"bg-[#67ffbd]/20 text-[#67ffbd] h-9 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide",children:`${(n==null?void 0:n.leverage)==null||isNaN(parseFloat(n==null?void 0:n.leverage))?"--":`${parseFloat(n==null?void 0:n.leverage).toFixed(2)}x`}`})}),i.jsxs("div",{className:`${(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center min-w-max`,children:[(n==null?void 0:n.roe)>=0?"+":"-",`${(n==null?void 0:n.roe)==null||isNaN(parseFloat(n==null?void 0:n.roe))?"--":`${Ms(Math.abs(n==null?void 0:n.roe))}%`}`]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[22px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max min-w-[130px]",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"UNREALIZED PNL"}),i.jsx("div",{className:`${(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))||(n==null?void 0:n.unrealizedPnL)==0?"text-white":(n==null?void 0:n.unrealizedPnL)>0?"text-[#1DE6A3]":"text-[#FF7173]"} text-[32px] font-semibold font-manrope leading-none flex`,children:(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`})]})}),(n==null?void 0:n.referral)&&i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[26px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral?"pt-[16px]":"pt-[112px]"} flex justify-start items-start`,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[398px] overflow-hidden",children:(n==null?void 0:n.roe)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Numbers don’t lie! 🔥 Unrealized PnL:"," ",(n==null?void 0:n.unrealizedPnL)>=0?"":"-",(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders and save 4% on fees using my referral: ",n==null?void 0:n.referral," ","@Dextrabot"," "]}):i.jsxs("span",{children:["Numbers don’t lie! 🔥 Unrealized PnL:"," ",(n==null?void 0:n.unrealizedPnL)>=0?"":"-",(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`," ","🚀 Tap into the best trades with Dextrabot on Hyperliquid! Copy top traders! @Dextrabot"]})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:o=>{o.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:()=>{a()},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Numbers%20don’t%20lie!%20🔥%20Unrealized%20PnL:%20${(n==null?void 0:n.unrealizedPnL)==null||isNaN(parseFloat(n==null?void 0:n.unrealizedPnL))?"--":`${(n==null?void 0:n.unrealizedPnL)>=0?"":"-"}$${Ms(Math.abs(n==null?void 0:n.unrealizedPnL))}`}%20🚀%20Tap%20into%20the%20best%20trades%20with%20Dextrabot%20on%20Hyperliquid!%20Copy%20top%20traders${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20and%20save%204%25%20on%20fees%20using%20my%20referral:%20${n==null?void 0:n.referral}`:"!"}%20%40Dextrabot%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}const yVe=()=>{const[t,e]=m.useState(!1);m.useEffect(()=>{(()=>{localStorage.getItem("isCopyTradeIntroductionModal")||(e(!0),localStorage.removeItem("copyTradeIntroductionModal"))})()},[]),m.useEffect(()=>{const r=s=>{s.key==="Escape"&&(localStorage.setItem("isCopyTradeIntroductionModal","true"),e(!1))};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]);const n=()=>{localStorage.setItem("isCopyTradeIntroductionModal","true"),e(!1)};return i.jsxs(_a,{open:t,onClose:n,className:"relative z-50 font-manrope hidden lg:block",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#1b1b1b] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[480px] h-max relative bg-[#1b1b1b] rounded-3xl pb-8",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{n()},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#67FFBD52]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-2 px-2",children:i.jsx("img",{src:_lt,alt:""})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-4 pt-[14px]",children:[i.jsxs("div",{className:"text-center justify-center",children:[i.jsxs("span",{className:"text-white text-2xl font-semibold font-manrope leading-7 tracking-tight",children:["You can start"," "]}),i.jsx("span",{className:"text-[#67ffbd] text-2xl font-semibold font-manrope leading-7 tracking-tight",children:"Copy Trading"}),i.jsxs("span",{className:"text-white text-2xl font-semibold font-manrope leading-7 tracking-tight",children:[" ","now!"]})]}),i.jsx("div",{className:"w-[320px] text-center justify-start text-[#979797] text-[13px] font-normal font-manrope leading-4 tracking-tight",children:"Hyperliquid Copy Trading is live on Dextrabot. Best wallets. Auto trades. Simple. 🚀"})]})]})})})})})]})},won=({info1:t,info2:e,info3:n,padding:r,icon:s,info1_Color:a,info2_Color:o,info3_Color:l,rowTwo:c})=>i.jsx("div",{className:`${r||"pl-1 pr-2"} flex flex-col gap-2 font-manrope`,children:i.jsx("div",{className:`${c?"-mt-3.5":""} text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px] text-white`,children:t=="--"&&e=="--"&&n=="--"?"--":i.jsxs(i.Fragment,{children:[i.jsx("span",{className:`${a}`,children:`${t}/`}),i.jsx("span",{className:`${o}`,children:`${e}/`}),i.jsx("span",{className:`${l}`,children:`${n}`})]})})}),Con=({setCurrentPage:t,offset:e,setOffset:n,setTotalPage:r,setTotalWalletCount:s,period:a,periods:o,totalPage:l,totalWalletCount:c,currentPage:u,handlePeriodChange:d})=>{const[f,x]=m.useState([]),[g,y]=m.useState(!0),[v,C]=m.useState(null),{hyperToken:N,copyTradeWatchList:P,getCopyTradeWatchList:T,trackedWatchList:M,getTrackedWatchList:F,setSignModalOpen:$,setTelegramChatId:L,setSubscriberRole:z,setSubsExpireDay:X,setMushboomerETH:ne,setMushboomerSOL:J,setIsReferralCode:K,isReferralCodeName:te,setIsReferralCodeName:fe,setIsWhitelist:q,setHyperToken:se,setHyperAddress:ae}=m.useContext(Qr),{isConnected:W,address:V}=ns();jo(),Kl();const[ee,oe]=m.useState(!1),[de,Ce]=m.useState(null),[me,we]=m.useState(null),[xe,be]=m.useState(""),[je,Ie]=m.useState(""),[Re,Qe]=m.useState(""),[Ke,dt]=m.useState(""),[tt,nt]=m.useState(""),[Le,Be]=m.useState([]),[ht,pt]=m.useState(!0),[Gt,wt]=m.useState([]),[nn,cn]=m.useState([]),[Un,Xt]=m.useState(!0),[an,Jt]=m.useState([]),[Ye,Je]=m.useState(!1),[It,hn]=m.useState(!1),Yt=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_pnl`,Rt=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_dd`,ot=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_growth_rate`,De=`portfolio_perp_${{1:"day",7:"week",30:"month",90:"3month",999:"all_time"}[a]||"day"}_sharpe`;function At(Oe){if(!Oe)return"--";const Zt=parseInt(Oe==null?void 0:Oe.split(":")[0]),sn=parseInt(Oe==null?void 0:Oe.split(":")[1]);return`${Zt}h ${sn}m`}m.useEffect(()=>{(async()=>{var jt,Qn;const Zt=window.localStorage.getItem("hyperToken"),sn=window.localStorage.getItem("hyperAddress");if(!(!Zt||!sn))try{const bn=await ki(sn.toLowerCase(),Zt);bn!=null&&bn.success?(L(bn==null?void 0:bn.telegram_chat_id),z(bn==null?void 0:bn.subscriber_role),X(bn==null?void 0:bn.subs_expire_day),ne((jt=bn==null?void 0:bn.mushboomer_counts)==null?void 0:jt.eth),J((Qn=bn==null?void 0:bn.mushboomer_counts)==null?void 0:Qn.sol),K(bn==null?void 0:bn.referral_code),fe(bn==null?void 0:bn.refcode),q(bn==null?void 0:bn.whitelist),se(Zt),ae(sn)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),se(""),ae(""))}catch(bn){console.error("Token verification error:",bn),console.error(bn.message||"An unknown error occurred.")}})()},[]);const ze={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};m.useEffect(()=>{(async()=>{var Zt,sn;try{const Qn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),bn=()=>bi.random().hex(),Dt=(sn=(Zt=Qn.coins)==null?void 0:Zt.filter(en=>!en.startsWith("@")&&!en.endsWith("/USDC")))==null?void 0:sn.map(en=>({value:en,label:en.endsWith("/USDC")?en+" (Spot)":en,color:bn(),icon:`https://app.hyperliquid.xyz/coins/${ze[en]||(en==null?void 0:en.split("/")[0])}.svg`}));Be(Dt),pt(!1)}catch(jt){console.error("Data retrieval error:",jt),pt(!1)}})()},[]),m.useEffect(()=>{(async()=>{var Zt,sn;try{const Qn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_refcodes/")).json(),bn=()=>bi.random().hex(),Dt=(sn=(Zt=Qn==null?void 0:Qn.refcodes)==null?void 0:Zt.filter(en=>en.code!=="DEXTRABOT"))==null?void 0:sn.slice(0,1300).map(en=>({value:en.code,label:en.code,color:bn()}));cn(Dt),Xt(!1)}catch(jt){console.error("Data retrieval error:",jt),Xt(!1)}})()},[]);const rt=Oe=>{const Zt=["Growth Rate","Drawdown","Drawdown PnL","Sharpe"],sn=[{header:"Popular Wallet",value:jt=>{const Qn=Number(jt.copier_count)||0;return Qn===0?"":Qn<=5?"F":Qn<=10?"FF":"FFF"}},{header:"Wallet",value:jt=>jt.user_token},{header:"PnL",value:jt=>(jt==null?void 0:jt[Yt])==null||isNaN(+(jt==null?void 0:jt[Yt]))?"--":`$${Ms(jt==null?void 0:jt[Yt])}`},{header:"uPnL",value:jt=>jt.total_unrealized_pnl==null||isNaN(+jt.total_unrealized_pnl)?"--":`$${Ms(jt.total_unrealized_pnl)}`},{header:"Perp Equity",value:jt=>jt.portfolio_perp_all_time_value==null||isNaN(+jt.portfolio_perp_all_time_value)?"--":`$${Ms(Math.abs(jt.portfolio_perp_all_time_value))}`},{header:"Win Rate",value:jt=>jt.win_complated_rate==null||isNaN(+jt.win_complated_rate)||Oe==999?"--":`%${Math.abs(jt.win_complated_rate)}`},{header:"Trades Count",value:jt=>jt.complated_trades_count==null||isNaN(+jt.complated_trades_count)||Oe==999?"--":`${Ms(Math.abs(jt.complated_trades_count))}`},{header:"Win Count",value:jt=>jt.complated_win_count==null||isNaN(+jt.complated_win_count)||Oe==999?"--":`${Ms(Math.abs(jt.complated_win_count))}`},{header:"Loss Count",value:jt=>jt.complated_loss_count==null||isNaN(+jt.complated_loss_count)?"--":`${Ms(Math.abs(jt.complated_loss_count))}`},{header:"Long PnL",value:jt=>jt.long_kar==null||isNaN(+jt.long_kar)||Oe==999?"--":`$${Ms(Math.abs(jt.long_kar))}`},{header:"Short PnL",value:jt=>jt.short_kar==null||isNaN(+jt.short_kar)||Oe==999?"--":`$${Ms(jt.short_kar)}`},{header:"Growth Rate",value:jt=>(jt==null?void 0:jt[ot])==null||isNaN(+(jt==null?void 0:jt[ot]))||Oe==1||Oe==999?"--":`%${Ms(jt==null?void 0:jt[ot])}`},{header:"Drawdown",value:jt=>(jt==null?void 0:jt[Rt])==null||isNaN(+(jt==null?void 0:jt[Rt]))||Oe==999?"--":`%${Ms(jt==null?void 0:jt[Rt])}`},{header:"Sharpe",value:jt=>(jt==null?void 0:jt[De])==null||isNaN(+(jt==null?void 0:jt[De]))||Oe==999?"--":`${jt==null?void 0:jt[De]}`},{header:"Tx Count",value:jt=>jt.rtx_count==null||isNaN(+jt.rtx_count)||Oe==999?"--":`${Ms(jt.rtx_count)}`},{header:"ROE (%)",value:jt=>jt.margin_roi==null||isNaN(+jt.margin_roi)?"--":`${Ms(jt.margin_roi)}%`},{header:"Margin / Used",value:jt=>jt.margin_used==null||isNaN(+jt.margin_used)||jt.margin_percentage==null||isNaN(+jt.margin_percentage)?"--":`${Ms(jt.margin_used)} / %${parseFloat(jt.margin_percentage).toFixed(2)}`},{header:"Avg. Lvg.",value:jt=>jt.avg_uleverage_value==null||isNaN(+jt.avg_uleverage_value)?"--":`${parseFloat(jt.avg_uleverage_value).toFixed(2)}x`},{header:"Funding",value:jt=>jt.funding==null||isNaN(+jt.funding)?"--":`$${Ms(jt.funding)}`},{header:"rToken #",value:jt=>jt.token_count==null||isNaN(+jt.token_count)||Oe==999?"--":Ms(jt.token_count)},{header:"uToken #",value:jt=>jt.position_count==null||isNaN(+jt.position_count)?"--":Ms(jt.position_count)},{header:"Avg. Dur.",value:jt=>Oe==999?"--":`${At(jt.complated_avg_duration)}`},{header:"First Tx Time",value:jt=>Oe==999?"--":vI(jt.first_time)},{header:"Last Tx Time",value:jt=>Oe==999?"--":vI(jt.end_time)}];return Oe===1?sn.filter(jt=>!Zt.includes(jt.header)):sn},mt=()=>{if(!(f!=null&&f.length))return;const Oe=new Date,Zt=tr=>tr.toString().padStart(2,"0"),sn=`discoverwallet_${Zt(Oe.getDate())}${Zt(Oe.getMonth()+1)}${Oe.getFullYear()}_${Zt(Oe.getHours())}${Zt(Oe.getMinutes())}.csv`,jt=rt(a),Qn=jt.map(tr=>`"${tr.header}"`).join(","),bn=f==null?void 0:f.map(tr=>jt==null?void 0:jt.map(ar=>`"${ar.value(tr)}"`).join(",")),Dt=new Blob([Qn+`\r
`+bn.join(`\r
`)],{type:"text/csv;charset=utf-8;"}),en=URL.createObjectURL(Dt);Object.assign(document.createElement("a"),{href:en,download:sn}).click(),URL.revokeObjectURL(en)},[Lt,kt]=m.useState("-perp_pnl"),[dn,rn]=m.useState({max_first_time:"",min_first_time:"",max_end_time:"",min_end_time:"",max_short_kar:"",min_short_kar:"",max_long_kar:"",min_long_kar:"",max_pnl:"",min_pnl:"",max_uPnl:"",min_uPnl:"",max_rToken_count:"",min_rToken_count:"",max_uToken_count:"",min_uToken_count:"",max_perp_equity:"",min_perp_equity:"",max_margin_used:"",min_margin_used:"",max_margin_used_percentage:"",min_margin_used_percentage:"",max_avg_uLeverage_value:"",min_avg_uLeverage_value:"",max_funding:"",min_funding:"",max_margin_roi:"",min_margin_roi:"",max_rTx_count:"",min_rTx_count:"",max_sharpe:"",min_sharpe:"",max_growth_rate:"",min_growth_rate:"",max_perp_dd:"",min_perp_dd:"",max_perp_dd_pnl:"",min_perp_dd_pnl:"",max_win_complated_rate:"",min_win_complated_rate:"",max_complated_trades_count:"",min_complated_trades_count:"",max_complated_win_count:"",min_complated_win_count:"",max_complated_loss_count:"",min_complated_loss_count:"",user_token:"",coin:"",refcode:"",is_favorite_wallet:""});m.useEffect(()=>{async function Oe(){try{y(!0);const Zt={period:a===999?"all_time":a,order:Lt,offset:e===-50?"0":e.toString(),limit:"50",...dn},sn=Object.entries(Zt).filter(([en,Pn])=>Pn!=null).map(([en,Pn])=>`${encodeURIComponent(en)}=${encodeURIComponent(Pn)}`).join("&"),jt=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${sn}`,Qn=await fetch(jt.toString());if(!Qn.ok)throw new Error(`HTTP error! status: ${Qn.status}`);const bn=await Qn.json();r(Math.ceil(bn.count/50)),s(bn.count),t((e+50)/50),window.localStorage.getItem("hyperToken")&&(T(),F()),x(bn.results)}catch(Zt){x([]),console.error("Error fetching data:",Zt),C(Zt.message)}finally{y(!1)}}Oe()},[e,Lt,a]);async function gn(Oe){try{y(!0);const Zt={period:a===999?"all_time":a,order:Lt,offset:e===-50?"0":e.toString(),limit:"50",...dn},sn=Object.entries(Zt).filter(([en,Pn])=>Pn!=null).map(([en,Pn])=>`${encodeURIComponent(en)}=${encodeURIComponent(Pn)}`).join("&"),jt=`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?${sn}`,Qn=await fetch(jt);if(!Qn.ok)throw new Error(`HTTP error! status: ${Qn.status}`);const bn=await Qn.json();t(1),r(Math.ceil(bn.count/50)),s(bn.count),n(0),window.localStorage.getItem("hyperToken")&&(T(),F()),x(bn.results)}catch(Zt){x([]),console.error("Error fetching data:",Zt),C(Zt.message)}finally{y(!1)}}async function An(Oe){try{y(!0);const Zt=await fetch(`https://dextradata.nftinit.io/api/hyper/${a==999?"get_wallets_profit_all_time":"get_wallets_profit_new"}/?period=${a==999?"all_time":a}&order=${Lt}&offset=0&limit=50`);if(!Zt.ok)throw new Error(`HTTP error! status: ${Zt.status}`);const sn=await Zt.json();t(50/50),r(Math.ceil(sn.count/50)),s(sn.count),n(0),x(sn.results),window.localStorage.getItem("hyperToken")&&(T(),F()),rn({max_first_time:"",min_first_time:"",max_end_time:"",min_end_time:"",max_short_kar:"",min_short_kar:"",max_long_kar:"",min_long_kar:"",max_pnl:"",min_pnl:"",max_uPnl:"",min_uPnl:"",max_rToken_count:"",min_rToken_count:"",max_uToken_count:"",min_uToken_count:"",max_perp_equity:"",min_perp_equity:"",max_margin_used:"",min_margin_used:"",max_margin_used_percentage:"",min_margin_used_percentage:"",max_avg_uLeverage_value:"",min_avg_uLeverage_value:"",max_funding:"",min_funding:"",max_margin_roi:"",min_margin_roi:"",max_rTx_count:"",min_rTx_count:"",max_sharpe:"",min_sharpe:"",max_growth_rate:"",min_growth_rate:"",max_perp_dd:"",min_perp_dd:"",max_perp_dd_pnl:"",min_perp_dd_pnl:"",max_win_complated_rate:"",min_win_complated_rate:"",max_complated_trades_count:"",min_complated_trades_count:"",max_complated_win_count:"",min_complated_win_count:"",max_complated_loss_count:"",min_complated_loss_count:"",user_token:"",coin:"",refcode:"",is_favorite_wallet:""}),Ie(""),Qe(""),dt(""),nt(""),wt([])}catch(Zt){x([]),console.error("Error resetting filters:",Zt),C(Zt.message)}finally{y(!1)}}const kn=async({walletAddress:Oe,isFollow:Zt,isScalper:sn})=>{try{be(Oe);const jt=window.localStorage.getItem("hyperToken"),Qn=window.localStorage.getItem("hyperAddress");if(!jt){$(!0);return}const bn=Zt?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",Dt=Zt?{address:V?V.toLowerCase():Qn,token:jt,follow_address:Oe.toLowerCase()}:{address:V?V.toLowerCase():Qn,token:jt},en=await fetch(bn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Dt)});if(!en.ok)throw new Error(`Server responded with status ${en.status}`);const Pn=await en.json();Pn.success?(Ce(Array.isArray(Pn==null?void 0:Pn.data)?[...Pn.data].sort((tr,ar)=>new Date(ar.created_at||0)-new Date(tr.created_at||0)):Pn==null?void 0:Pn.data),we(sn),oe(!0)):(console.log(Pn.error_message),tn.error(Pn.error_message))}catch(jt){console.error("Error in like function:",jt),tn.error(jt.message||"Something went wrong!")}},yn=Oe=>Oe>=640&&Oe<1024?7:Oe>=1024&&Oe<1240?6:Oe>=1240&&Oe<1540?7:Oe>=1540?10:4,[Vn,Kn]=m.useState(!1),[Dn,Xn]=m.useState(!1),[Nn,on]=m.useState({pnl:0,winRate:0,tradeCount:0,longWinRate:0,shortWinRate:0,leverage:0,roe:0,unrealizedPnL:0,referral:""});return i.jsxs(i.Fragment,{children:[i.jsx(yVe,{}),i.jsx(jan,{open:Ye,setOpen:Je}),i.jsx($5,{open:ee,setOpen:oe,copyTradeData:de,setCopyTradeData:Ce,copyTradeWallet:xe,setCopyTradeWallet:be,isScalper:me}),i.jsx(yon,{open:Vn,setOpen:Kn,data:Nn,setTradeInfo:on,period:a}),i.jsx(von,{open:Dn,setOpen:Xn,data:Nn,setTradeInfo:on}),i.jsxs("div",{className:"block lg:hidden w-full p-2 space-y-2",children:[i.jsx(VLe,{}),i.jsx("button",{className:"px-2 py-2 text-xs font-bold rounded-2xl border border-gray-600 text-white hover:bg-[#1D1D1D] bg-[#171717] h-8 font-manrope w-full",onClick:mt,children:"Export CSV"})]}),i.jsx("div",{className:"lg:hidden flex w-full p-2",children:i.jsx("button",{className:"px-2 py-2 text-xs font-medium rounded-2xl border border-gray-600 text-white hover:bg-[#1D1D1D] w-full bg-[#171717]",onClick:()=>hn(!It),children:It?"Hide Filters":"Show Filters"})}),i.jsxs("div",{className:"flex-grow flex flex-col lg:flex-row items-start justify-start gap-2 lg:gap-6 bg-[#161616] w-full h-full overflow-y-scroll pl-1 sm:pl-4 pt-1 sm:pt-4 pr-0.5 pb-3 font-manrope relative",children:[i.jsx("div",{className:`${It?"block":"hidden"} lg:flex flex-shrink-0 lg:w-auto w-full lg:max-w-none max-w-full h-full`,children:i.jsx(San,{period:a,advancedFilters:dn,setAdvancedFilters:rn,resetFilters:An,setFilters:gn,minFirstValue:je,setMinFirstValue:Ie,maxFirstValue:Re,setMaxFirstValue:Qe,minEndValue:Ke,setMinEndValue:dt,maxEndValue:tt,setMaxEndValue:nt,dataCoin:Le,selectedCoins:Gt,setSelectedCoins:wt,isLoadingCoin:ht,setIsLoadingCoin:pt,dataReferral:nn,selectedReferrals:an,setSelectedReferrals:Jt,isLoadingReferral:Un,setIsLoadingReferral:Xt})}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[10px] bg-[#161616] max-h-full lg:min-w-0 lg:flex-grow max-w-full lg:max-w-none overflow-auto font-manrope",children:[i.jsxs("div",{className:"sticky sm:static top-0 sm:mt-2 flex flex-row sm:flex-col items-center sm:items-start justify-between sm:justify-start gap-2 font-manrope max-w-full w-full bg-[#161616] pl-2 sm:pl-0 pb-2 sm:pb-0 pr-2 sm:pr-0 z-10",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 min-w-max mt-[10px] sm:mt-0",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-[16px] sm:text-[18px] font-medium font-manrope leading-[21px]",children:"Discover Wallets"})})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-end sm:items-center justify-between w-full gap-1 pr-0 sm:pr-2",children:[i.jsx("div",{className:"flex",children:i.jsx(ade,{periods:o,selectedPeriod:a,handlePeriod:d,borderColor:"discover"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Nan,{offset:e,setOffset:n,totalPage:l,totalWalletCount:c,currentPage:u}),i.jsx("div",{className:"hidden lg:block",children:i.jsx("button",{className:"px-2 py-2 text-xs font-bold rounded-2xl border border-gray-600 text-white hover:bg-[#1D1D1D] bg-[#171717] h-8 font-manrope",onClick:mt,children:"Export CSV"})})]})]})]}),i.jsx("div",{className:"w-full overflow-scroll h-[calc(100vh-200px)] flex-grow bg-[#161616] rounded mt-2 sm:mt-0",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-10",children:[i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-0 h-10 pl-2 sm:pl-4 min-w-[130px] sm:min-w-[130px] z-[8]",children:i.jsx("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max ",children:i.jsx("div",{className:"flex items-center justify-start group",children:"Action"})})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[130px] h-10 px-1 min-w-[50px] sm:min-w-[50px] z-[8]",children:i.jsxs("div",{className:"flex justify-start items-center w-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:["🔥",i.jsx("span",{className:"",children:i.jsx(oo,{content:"🔥🔥🔥 Copytrend indicator. More flames = more followers.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[215px] min-w-[215px] leading-[16px] -mb-5"})})]})}),i.jsx(el,{title:"",sortKey:"copier_count",sortOption:Lt,setSortOption:kt,isFilterIcon:!1,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[180px] h-10 px-1 min-w-[120px] sm:min-w-[140px] z-[7]",children:i.jsx(el,{title:"Wallet",sortKey:"user_token",sortOption:Lt,setSortOption:kt,isFilterIcon:!1,isFilter:!1})}),i.jsx("th",{scope:"col",className:"min-w-[120px] sm:min-w-[140px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:"Realized profit/loss from completed trades.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[200px] min-w-[200px] leading-[16px] -mb-5"})})]})}),i.jsx(el,{title:"PnL",sortKey:"perp_pnl",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[140px] sm:min-w-[170px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"uPnL",sortKey:"total_unrealized_pnl",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[150px] sm:min-w-[170px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Perp Equity",sortKey:"portfolio_perp_all_time_value",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[140px] sm:min-w-[165px] px-1"}`,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Win Rate",sortKey:"win_complated_rate",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[170px] sm:min-w-[200px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Total/Win/Loss",sortKey:"complated_trades_count",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[130px] sm:min-w-[160px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Long PnL",sortKey:"long_kar",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[130px] sm:min-w-[160px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Short PnL",sortKey:"short_kar",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==1||a==999?"min-w-[120px] sm:min-w-[150px] px-1":"min-w-[150px] sm:min-w-[170px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:`${a==1||a==999?"flex":"hidden"} justify-end items-center has-tooltip relative`,children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:"Available for 7, 30, 90 days",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Growth Rate"}):i.jsx(el,{title:"Growth Rate",sortKey:"growth_rate",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==1||a==999?"min-w-[120px] sm:min-w-[140px] px-1":"min-w-[140px] sm:min-w-[160px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:`${a==1||a==999?"flex":"hidden"} justify-end items-center has-tooltip relative`,children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:"Available for 7, 30, 90 days",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Drawdown"}):i.jsx(el,{title:"Drawdown",sortKey:"perp_dd",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==1||a==999?"min-w-[100px] sm:min-w-[120px] px-1":"min-w-[120px] sm:min-w-[145px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:a==1||a==999?"Available for 7, 30, 90 days":"Sharpe_tooltip",positionTop:!1,alignRight:!1,tooltipCss:a==1||a==999?"max-w-[180px] min-w-[180px] leading-[16px] h-10 -mb-2":"max-w-[80px] min-w-[80px] leading-[16px] -mb-12"})})]})}),a==1||a==999?i.jsx("div",{className:"flex items-center justify-start",children:"Sharpe"}):i.jsx(el,{title:"Sharpe",sortKey:"sharpe",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[130px] sm:min-w-[150px] px-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Tx Count",sortKey:"rtx_count",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[135px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"ROE",sortKey:"margin_roi",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[125px] sm:min-w-[150px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Margin",sortKey:"margin_percentage",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[150px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Avg. Lvg.",sortKey:"avg_uleverage_value",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:"min-w-[125px] sm:min-w-[155px] px-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Funding",sortKey:"funding",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[130px] sm:min-w-[150px] pr-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"rToken #",sortKey:"token_count",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"min-w-[120px] sm:min-w-[150px] pl-1 pr-7":"min-w-[120px] sm:min-w-[150px] pr-1"}`,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"uToken #",sortKey:"position_count",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[120px] sm:min-w-[150px] pr-1"} `,children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"hidden justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!1})})]})}),i.jsx(el,{title:"Avg. Dur.",sortKey:"complated_avg_duration",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})]})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[140px] sm:min-w-[160px] pl-1 pr-1.5"} `,children:i.jsx(el,{title:"First Tx Time",sortKey:"first_time",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})}),i.jsx("th",{scope:"col",className:`${a==999?"hidden":"min-w-[150px] sm:min-w-[180px] pl-1 pr-7"} `,children:i.jsx(el,{title:"Last Tx Time",sortKey:"end_time",sortOption:Lt,setSortOption:kt,isFilterIcon:!0,isFilter:!1})})]})}),i.jsx("tbody",{children:!f||g?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:yn(window.innerWidth),className:"h-[30vh]",children:i.jsx("div",{className:"flex min-h-[46vh] lg:min-h-[66vh] flex-col justify-center items-center fixed top-[20%] lg:top-[25%] left-[45%] sm:left-[50%] lg:left-[60%] 2xl:left-[55%] z-10",children:i.jsx($a,{})})})}):v&&!f?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:yn(window.innerWidth),className:"h-[30vh]",children:i.jsx("div",{className:"flex min-h-[46vh] lg:min-h-[66vh] flex-col justify-center items-center fixed top-[20%] lg:top-[25%] left-[45%] sm:left-[50%] lg:left-[60%] 2xl:left-[55%] z-10",children:i.jsx(Error,{})})})}):(f==null?void 0:f.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:yn(window.innerWidth),className:"h-[30vh]",children:!It&&i.jsx("div",{className:"flex flex-col justify-center items-center fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",children:i.jsx(cVe,{})})})}):f&&(f==null?void 0:f.map((Oe,Zt)=>i.jsxs(Ne.Fragment,{children:[i.jsxs("tr",{className:`${Zt%2==0?"bg-[#1b1b1b]":"bg-[#1f1f1f]"} relative group hover:bg-[#222222] h-[56px] max-h-[56px] text-white rounded-2xl`,style:{margin:"2px"},children:[i.jsx("td",{scope:"row",className:`${Zt%2==0?"bg-[#1b1b1b]":"bg-[#1f1f1f]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222] sm:rounded-l-2xl`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 sm:pl-4 h-14 max-h-14 rounded-2xl",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{onClick:sn=>{sn.preventDefault();const jt=P==null?void 0:P.some(Qn=>Qn.wallet_address===(Oe==null?void 0:Oe.user_token));kn({walletAddress:Oe==null?void 0:Oe.user_token,isFollow:jt,isScalper:Oe==null?void 0:Oe.is_scalper})},className:`
${P.some(sn=>sn.wallet_address===(Oe==null?void 0:Oe.user_token))?"bg-[#67ffbd] text-[#161616] font-semibold":"border border-[#67ffbd] bg-[#161616] text-[#67ffbd] hover:bg-[#67ffbd] hover:text-[#161616] font-bold"}
h-[22px] rounded-[256px] justify-center items-center gap-1 inline-flex cursor-pointer text-xs font-['Manrope'] leading-[8px] tracking-tight px-2 min-w-max`,children:"Copy Trade"}),i.jsx(B5,{walletAddress:Oe==null?void 0:Oe.user_token,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:M.some(sn=>sn.wallet_address===(Oe==null?void 0:Oe.user_token))?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${Zt%2==0?"bg-[#1b1b1b]":"bg-[#1f1f1f]"} sm:sticky sm:left-[130px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-14 max-h-14",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 mr-6 sm:mr-0",children:i.jsx("div",{className:"pl-2 pr-2 flex flex-col gap-2 font-manrope hover:scale-125 transition-transform duration-150 cursor-pointer",children:i.jsxs("div",{className:"flex items-center justify-end gap-[3px]",children:[i.jsx("div",{className:`${Oe!=null&&Oe.is_favorite_wallet?"":"hidden"} relative w-1 h-[16px] bg-[#4a3131] rounded-md`,children:i.jsx("div",{className:`${(Oe==null?void 0:Oe.copier_count)>=1&&(Oe==null?void 0:Oe.copier_count)<=5?"bg-[#FFAA22] shadow-[0px_2px_4px_0px_rgba(255,170,34,0.32)]":(Oe==null?void 0:Oe.copier_count)>5&&(Oe==null?void 0:Oe.copier_count)<=10?"bg-[#FF8C00] shadow-[0px_2px_4px_0px_rgba(255,140,0,0.32)]":(Oe==null?void 0:Oe.copier_count)>10?"bg-gradient-to-b from-[#ff0000] to-[#ff8c00] shadow-[0px_2px_4px_0px_rgba(255,45,45,0.32)]":"bg-[#FF8C00] shadow-[0px_2px_4px_0px_rgba(255,140,0,0.32)]"} absolute bottom-0 w-full rounded-md`,style:{height:`${(Oe==null?void 0:Oe.copier_count)>=1&&(Oe==null?void 0:Oe.copier_count)<=5?25:(Oe==null?void 0:Oe.copier_count)>5&&(Oe==null?void 0:Oe.copier_count)<=10?50:(Oe==null?void 0:Oe.copier_count)>10?100:0}%`,transition:"height 0.3s ease"}})}),i.jsx("span",{className:"text-[14px] text-white font-semibold font-manrope leading-[8px]",children:Oe!=null&&Oe.is_favorite_wallet?"🔥":""})]})})})})}),i.jsx("td",{scope:"row",className:`${Zt%2==0?"bg-[#1b1b1b]":"bg-[#1f1f1f]"} sm:sticky sm:left-[180px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${Oe==null?void 0:Oe.user_token}`,"_blank")},className:"cursor-pointer group-hover:bg-[#222222] flex justify-start items-center gap-2 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5 mr-6 sm:mr-0",children:[i.jsx(ua,{info1:`${(Oe==null?void 0:Oe.user_token).slice(0,5)+"..."+(Oe==null?void 0:Oe.user_token).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:sn=>{sn.stopPropagation(),navigator.clipboard.writeText(Oe==null?void 0:Oe.user_token),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})})}),i.jsx("td",{className:"",children:i.jsxs("div",{onClick:sn=>{sn.preventDefault(),(Oe==null?void 0:Oe[Yt])!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe[Yt]))&&(on(jt=>({...jt,pnl:Oe==null?void 0:Oe[Yt],winRate:Oe==null?void 0:Oe.win_complated_rate,tradeCount:Oe==null?void 0:Oe.rtx_count,longWinRate:Oe==null?void 0:Oe.long_win_rate,shortWinRate:Oe==null?void 0:Oe.short_win_rate,roe:Oe==null?void 0:Oe.margin_roi,referral:window.localStorage.getItem("hyperToken")?te:null})),Kn(!0))},className:`${(Oe==null?void 0:Oe[Yt])!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe[Yt]))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(ua,{info1:`$${Ms(Math.abs(Oe==null?void 0:Oe[Yt]))}`,info1_Color:`${(Oe==null?void 0:Oe[Yt])==null||isNaN(parseFloat(Oe==null?void 0:Oe[Yt]))||(Oe==null?void 0:Oe[Yt])==0?"text-white":(Oe==null?void 0:Oe[Yt])>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(Oe==null?void 0:Oe[Yt])!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe[Yt]))&&i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{className:"",children:i.jsxs("div",{onClick:sn=>{sn.preventDefault(),(Oe==null?void 0:Oe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe.total_unrealized_pnl))&&(on(jt=>({...jt,pnl:Oe==null?void 0:Oe[Yt],unrealizedPnL:Oe==null?void 0:Oe.total_unrealized_pnl,roe:Oe==null?void 0:Oe.margin_roi,leverage:Oe==null?void 0:Oe.avg_uleverage_value,referral:N?te:null})),Xn(!0))},className:`${(Oe==null?void 0:Oe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe.total_unrealized_pnl))?"cursor-pointer":""} flex justify-end items-center gap-1 min-w-max px-1`,children:[i.jsx(ua,{info1:(Oe==null?void 0:Oe.total_unrealized_pnl)==null||isNaN(parseFloat(Oe==null?void 0:Oe.total_unrealized_pnl))?"--":`$${Ms(Math.abs(Oe==null?void 0:Oe.total_unrealized_pnl))}`,info1_Color:`${(Oe==null?void 0:Oe.total_unrealized_pnl)==null||isNaN(parseFloat(Oe==null?void 0:Oe.total_unrealized_pnl))||(Oe==null?void 0:Oe.total_unrealized_pnl)==0?"text-white":(Oe==null?void 0:Oe.total_unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1}),(Oe==null?void 0:Oe.total_unrealized_pnl)!=null&&!isNaN(parseFloat(Oe==null?void 0:Oe.total_unrealized_pnl))&&i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{className:"",children:i.jsx(ua,{info1:(Oe==null?void 0:Oe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_all_time_value))?"--":`$${Ms(Math.abs(Oe==null?void 0:Oe.portfolio_perp_all_time_value))}`,info1_Color:`${(Oe==null?void 0:Oe.portfolio_perp_all_time_value)==null||isNaN(parseFloat(Oe==null?void 0:Oe.portfolio_perp_all_time_value))||(Oe==null?void 0:Oe.portfolio_perp_all_time_value)==0?"text-white":(Oe==null?void 0:Oe.portfolio_perp_all_time_value)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:(Oe==null?void 0:Oe.win_complated_rate)==null||isNaN(parseFloat(Oe==null?void 0:Oe.win_complated_rate))?"--":`${Math.abs(Oe==null?void 0:Oe.win_complated_rate)}%`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(won,{info1:(Oe==null?void 0:Oe.complated_trades_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.complated_trades_count))?"--":`${Ms(Math.abs(Oe==null?void 0:Oe.complated_trades_count))}`,info2:(Oe==null?void 0:Oe.complated_win_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.complated_win_count))?"--":`${Ms(Math.abs(Oe==null?void 0:Oe.complated_win_count))}`,info3:(Oe==null?void 0:Oe.complated_loss_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.complated_loss_count))?"--":`${Ms(Math.abs(Oe==null?void 0:Oe.complated_loss_count))}`,info1_Color:"text-white",info2_Color:"text-[#1DE6A3]",info3_Color:"text-[#FF7173]",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:(Oe==null?void 0:Oe.long_kar)==null||isNaN(parseFloat(Oe==null?void 0:Oe.long_kar))?"--":`$${Ms(Math.abs(Oe==null?void 0:Oe.long_kar))}`,info1_Color:`${(Oe==null?void 0:Oe.long_kar)==null||isNaN(parseFloat(Oe==null?void 0:Oe.long_kar))||(Oe==null?void 0:Oe.long_kar)==0?"text-white":(Oe==null?void 0:Oe.long_kar)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:`$${(Oe==null?void 0:Oe.short_kar)==null||isNaN(parseFloat(Oe==null?void 0:Oe.short_kar))?"--":Ms(Math.abs(Oe==null?void 0:Oe.short_kar))}`,info1_Color:`${(Oe==null?void 0:Oe.short_kar)==null||isNaN(parseFloat(Oe==null?void 0:Oe.short_kar))||(Oe==null?void 0:Oe.short_kar)==0?"text-white":(Oe==null?void 0:Oe.short_kar)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:a==1||a==999?i.jsx("div",{className:"space-y-2 flex justify-end items-center",children:i.jsx(gi,{content:"Available for 7, 30, 90 days",children:i.jsx("div",{className:"text-gray-500 text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px] w-max pl-16 h-10",children:"--"})})}):i.jsx(ua,{info1:`${a==1||a==999||(Oe==null?void 0:Oe[ot])==null||isNaN(parseFloat(Oe==null?void 0:Oe[ot]))||ot=="portfolio_perp_day_growth_rate"?"--":`${Ms(Oe==null?void 0:Oe[ot])}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(Oe==null?void 0:Oe[ot])==null||isNaN(parseFloat(Oe==null?void 0:Oe[ot]))||ot=="portfolio_perp_day_growth_rate"||(Oe==null?void 0:Oe[ot])==0?"text-white":(Oe==null?void 0:Oe[ot])>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:a==1||a==999?i.jsx("div",{className:"space-y-2 flex justify-end items-center",children:i.jsx(gi,{content:"Available for 7, 30, 90 days",children:i.jsx("div",{className:"text-gray-500 text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px] w-max pl-16 h-10",children:"--"})})}):i.jsx(ua,{info1:`${a==1||a==999||(Oe==null?void 0:Oe[Rt])==null||isNaN(parseFloat(Oe==null?void 0:Oe[Rt]))||Rt=="portfolio_perp_day_dd"?"--":`${Ms(Math.abs(Oe==null?void 0:Oe[Rt]))}%`}`,info1_Color:`${a==1||a==999?"text-gray-600":(Oe==null?void 0:Oe[Rt])==null||isNaN(parseFloat(Oe==null?void 0:Oe[Rt]))||Rt=="portfolio_perp_day_dd"||(Oe==null?void 0:Oe[Rt])==0?"text-white":(Oe==null?void 0:Oe[Rt])>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:a==1||a==999?i.jsx("div",{className:"space-y-2 flex justify-end items-center",children:i.jsx(gi,{content:"Available for 7, 30, 90 days",children:i.jsx("div",{className:"text-gray-500 text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px] w-max pl-16 h-10",children:"--"})})}):i.jsx(ua,{info1:`${a==1||a==999||(Oe==null?void 0:Oe[De])==null||isNaN(parseFloat(Oe==null?void 0:Oe[De]))||De=="portfolio_perp_day_sharpe"?"--":`${_r(Oe==null?void 0:Oe[De])}`}`,info1_Color:`${a==1||a==999?"text-gray-600":(Oe==null?void 0:Oe[De])==null||isNaN(parseFloat(Oe==null?void 0:Oe[De]))||De=="portfolio_perp_day_sharpe"?"text-white":(Oe==null?void 0:Oe[De])>=1&&(Oe==null?void 0:Oe[De])<=2?"text-[#E5BB18]":(Oe==null?void 0:Oe[De])>2?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:`${(Oe==null?void 0:Oe.rtx_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.rtx_count))?"--":Ms(Oe==null?void 0:Oe.rtx_count)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(ua,{info1:`${(Oe==null?void 0:Oe.margin_roi)==null||isNaN(parseFloat(Oe==null?void 0:Oe.margin_roi))?"--":`${Ms(Math.abs(Oe==null?void 0:Oe.margin_roi))}%`}`,info1_Color:`${(Oe==null?void 0:Oe.margin_roi)==null||isNaN(parseFloat(Oe==null?void 0:Oe.margin_roi))||(Oe==null?void 0:Oe.margin_roi)==0?"text-white":(Oe==null?void 0:Oe.margin_roi)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{children:i.jsx(Aan,{info1:`${(Oe==null?void 0:Oe.margin_used)==null||isNaN(parseFloat(Oe==null?void 0:Oe.margin_used))?"--":Ms(Oe==null?void 0:Oe.margin_used)}`,info2:`${(Oe==null?void 0:Oe.margin_percentage)==null||isNaN(parseFloat(Oe==null?void 0:Oe.margin_percentage))?"--":parseFloat(Oe==null?void 0:Oe.margin_percentage).toFixed(2)+"%"}`,info1_Color:"text-white",info2_Color:"text-[#979797]",rowTwo:!1})}),i.jsx("td",{children:i.jsx(ua,{info1:`${(Oe==null?void 0:Oe.avg_uleverage_value)==null||isNaN(parseFloat(Oe==null?void 0:Oe.avg_uleverage_value))?"--":`${parseFloat(Oe==null?void 0:Oe.avg_uleverage_value).toFixed(2)}x`}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{children:i.jsx(ua,{info1:`${(Oe==null?void 0:Oe.funding)==null||isNaN(parseFloat(Oe==null?void 0:Oe.funding))?"--":`$${Ms(Math.abs(Oe==null?void 0:Oe.funding))}`}`,info1_Color:`${(Oe==null?void 0:Oe.funding)==null||isNaN(parseFloat(Oe==null?void 0:Oe.funding))||(Oe==null?void 0:Oe.funding)==0?"text-white":(Oe==null?void 0:Oe.funding)<0?"text-[#1DE6A3]":"text-[#FF7173]"}`,rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-1",children:i.jsx("div",{className:"text-sm font-medium font-manrope leading-none flex items-center justify-center gap-0.5",children:i.jsxs("div",{className:"has-tooltip relative w-5 h-5",children:[i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-center gap-2 font-manrope w-full h-full has-tooltip",children:i.jsx("div",{className:`${(Oe==null?void 0:Oe.token_count)>0?"underline underline-offset-2":""} text-white text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:(Oe==null?void 0:Oe.token_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.token_count))?"--":Ms(Oe==null?void 0:Oe.token_count)})}),(Oe==null?void 0:Oe.token_count)>0&&i.jsx(T4e,{content:Oe==null?void 0:Oe.coins_with_profit,positionTop:!0,alignRight:!1,type:"coin"})]})})})}),i.jsx("td",{className:`${a==999?"pr-6 sm:rounded-r-2xl":""} `,children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-1",children:i.jsx("div",{className:"text-sm font-medium font-manrope leading-none flex items-center justify-center gap-0.5",children:i.jsxs("div",{className:"has-tooltip relative w-5 h-5",children:[i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-center gap-2 font-manrope w-full h-full has-tooltip",children:i.jsx("div",{className:`${(Oe==null?void 0:Oe.position_count)>0?"underline underline-offset-2":""} text-white text-sm font-semibold font-manrope leading-[13px] flex items-center justify-end gap-0.5 tracking-[0.28px]`,children:(Oe==null?void 0:Oe.position_count)==null||isNaN(parseFloat(Oe==null?void 0:Oe.position_count))?"--":Ms(Oe==null?void 0:Oe.position_count)})}),(Oe==null?void 0:Oe.position_count)>0&&i.jsx(T4e,{content:Oe==null?void 0:Oe.open_positions,positionTop:a!=999,alignRight:!1,type:"position"})]})})})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:`${At(Oe==null?void 0:Oe.complated_avg_duration)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":""}`,children:i.jsx(ua,{info1:`${vI(Oe==null?void 0:Oe.first_time)}`,info1_Color:"text-white",rowTwo:!1})}),i.jsx("td",{className:`${a==999?"hidden":"pr-6 sm:rounded-r-2xl"}`,children:i.jsx(ua,{info1:`${vI(Oe==null?void 0:Oe.end_time)}`,info1_Color:"text-white",rowTwo:!1})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},Zt)))})]})})]})]})]})};var HX,D4e;function Son(){if(D4e)return HX;D4e=1;var t=typeof Element<"u",e=typeof Map=="function",n=typeof Set=="function",r=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function s(a,o){if(a===o)return!0;if(a&&o&&typeof a=="object"&&typeof o=="object"){if(a.constructor!==o.constructor)return!1;var l,c,u;if(Array.isArray(a)){if(l=a.length,l!=o.length)return!1;for(c=l;c--!==0;)if(!s(a[c],o[c]))return!1;return!0}var d;if(e&&a instanceof Map&&o instanceof Map){if(a.size!==o.size)return!1;for(d=a.entries();!(c=d.next()).done;)if(!o.has(c.value[0]))return!1;for(d=a.entries();!(c=d.next()).done;)if(!s(c.value[1],o.get(c.value[0])))return!1;return!0}if(n&&a instanceof Set&&o instanceof Set){if(a.size!==o.size)return!1;for(d=a.entries();!(c=d.next()).done;)if(!o.has(c.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(a)&&ArrayBuffer.isView(o)){if(l=a.length,l!=o.length)return!1;for(c=l;c--!==0;)if(a[c]!==o[c])return!1;return!0}if(a.constructor===RegExp)return a.source===o.source&&a.flags===o.flags;if(a.valueOf!==Object.prototype.valueOf&&typeof a.valueOf=="function"&&typeof o.valueOf=="function")return a.valueOf()===o.valueOf();if(a.toString!==Object.prototype.toString&&typeof a.toString=="function"&&typeof o.toString=="function")return a.toString()===o.toString();if(u=Object.keys(a),l=u.length,l!==Object.keys(o).length)return!1;for(c=l;c--!==0;)if(!Object.prototype.hasOwnProperty.call(o,u[c]))return!1;if(t&&a instanceof Element)return!1;for(c=l;c--!==0;)if(!((u[c]==="_owner"||u[c]==="__v"||u[c]==="__o")&&a.$$typeof)&&!s(a[u[c]],o[u[c]]))return!1;return!0}return a!==a&&o!==o}return HX=function(o,l){try{return s(o,l)}catch(c){if((c.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw c}},HX}var Non=Son();const Aon=Ii(Non);var VX,B4e;function jon(){if(B4e)return VX;B4e=1;var t=function(e,n,r,s,a,o,l,c){if(!e){var u;if(n===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,s,a,o,l,c],f=0;u=new Error(n.replace(/%s/g,function(){return d[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return VX=t,VX}var Eon=jon();const $4e=Ii(Eon);var WX,U4e;function _on(){return U4e||(U4e=1,WX=function(e,n,r,s){var a=r?r.call(s,e,n):void 0;if(a!==void 0)return!!a;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var o=Object.keys(e),l=Object.keys(n);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var f=e[d],x=n[d];if(a=r?r.call(s,f,x,d):void 0,a===!1||a===void 0&&f!==x)return!1}return!0}),WX}var kon=_on();const Ton=Ii(kon);var vVe=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(vVe||{}),qX={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},z4e=Object.values(vVe),cde={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Pon=Object.entries(cde).reduce((t,[e,n])=>(t[n]=e,t),{}),bm="data-rh",B4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},$4=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},Ion=t=>{let e=$4(t,"title");const n=$4(t,B4.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=$4(t,B4.DEFAULT_TITLE);return e||r||void 0},Fon=t=>$4(t,B4.ON_CHANGE_CLIENT_STATE)||(()=>{}),GX=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),Oon=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const s=Object.keys(r);for(let a=0;a<s.length;a+=1){const l=s[a].toLowerCase();if(t.indexOf(l)!==-1&&r[l])return n.concat(r)}}return n},[]),Mon=t=>console&&typeof console.warn=="function"&&console.warn(t),b7=(t,e,n)=>{const r={};return n.filter(s=>Array.isArray(s[t])?!0:(typeof s[t]<"u"&&Mon(`Helmet: ${t} should be of type "Array". Instead found type "${typeof s[t]}"`),!1)).map(s=>s[t]).reverse().reduce((s,a)=>{const o={};a.filter(c=>{let u;const d=Object.keys(c);for(let x=0;x<d.length;x+=1){const g=d[x],y=g.toLowerCase();e.indexOf(y)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(y==="rel"&&c[y].toLowerCase()==="stylesheet")&&(u=y),e.indexOf(g)!==-1&&(g==="innerHTML"||g==="cssText"||g==="itemprop")&&(u=g)}if(!u||!c[u])return!1;const f=c[u].toLowerCase();return r[u]||(r[u]={}),o[u]||(o[u]={}),r[u][f]?!1:(o[u][f]=!0,!0)}).reverse().forEach(c=>s.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const u=l[c],d={...r[u],...o[u]};r[u]=d}return s},[]).reverse()},Ron=(t,e)=>{if(Array.isArray(t)&&t.length){for(let n=0;n<t.length;n+=1)if(t[n][e])return!0}return!1},Lon=t=>({baseTag:Oon(["href"],t),bodyAttributes:GX("bodyAttributes",t),defer:$4(t,B4.DEFER),encode:$4(t,B4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:GX("htmlAttributes",t),linkTags:b7("link",["rel","href"],t),metaTags:b7("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:b7("noscript",["innerHTML"],t),onChangeClientState:Fon(t),scriptTags:b7("script",["src","innerHTML"],t),styleTags:b7("style",["cssText"],t),title:Ion(t),titleAttributes:GX("titleAttributes",t),prioritizeSeoTags:Ron(t,B4.PRIORITIZE_SEO_TAGS)}),wVe=t=>Array.isArray(t)?t.join(""):t,Don=(t,e)=>{const n=Object.keys(t);for(let r=0;r<n.length;r+=1)if(e[n[r]]&&e[n[r]].includes(t[n[r]]))return!0;return!1},KX=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(Don(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},H4e=(t,e)=>({...t,[e]:void 0}),Bon=["noscript","script","style"],Kre=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),CVe=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),$on=(t,e,n,r)=>{const s=CVe(n),a=wVe(e);return s?`<${t} ${bm}="true" ${s}>${Kre(a,r)}</${t}>`:`<${t} ${bm}="true">${Kre(a,r)}</${t}>`},Uon=(t,e,n=!0)=>e.reduce((r,s)=>{const a=s,o=Object.keys(a).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const f=typeof a[d]>"u"?d:`${d}="${Kre(a[d],n)}"`;return u?`${u} ${f}`:f},""),l=a.innerHTML||a.cssText||"",c=Bon.indexOf(t)===-1;return`${r}<${t} ${bm}="true" ${o}${c?"/>":`>${l}</${t}>`}`},""),SVe=(t,e={})=>Object.keys(t).reduce((n,r)=>{const s=cde[r];return n[s||r]=t[r],n},e),zon=(t,e,n)=>{const r={key:e,[bm]:!0},s=SVe(n,r);return[Ne.createElement("title",s,e)]},mM=(t,e)=>e.map((n,r)=>{const s={key:r,[bm]:!0};return Object.keys(n).forEach(a=>{const l=cde[a]||a;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=n[a]}),Ne.createElement(t,s)}),Wh=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>zon(t,e.title,e.titleAttributes),toString:()=>$on(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>SVe(e),toString:()=>CVe(e)};default:return{toComponent:()=>mM(t,e),toString:()=>Uon(t,e,n)}}},Hon=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const s=KX(t,qX.meta),a=KX(e,qX.link),o=KX(n,qX.script);return{priorityMethods:{toComponent:()=>[...mM("meta",s.priority),...mM("link",a.priority),...mM("script",o.priority)],toString:()=>`${Wh("meta",s.priority,r)} ${Wh("link",a.priority,r)} ${Wh("script",o.priority,r)}`},metaTags:s.default,linkTags:a.default,scriptTags:o.default}},Von=t=>{const{baseTag:e,bodyAttributes:n,encode:r=!0,htmlAttributes:s,noscriptTags:a,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:u}=t;let{linkTags:d,metaTags:f,scriptTags:x}=t,g={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:g,linkTags:d,metaTags:f,scriptTags:x}=Hon(t)),{priority:g,base:Wh("base",e,r),bodyAttributes:Wh("bodyAttributes",n,r),htmlAttributes:Wh("htmlAttributes",s,r),link:Wh("link",d,r),meta:Wh("meta",f,r),noscript:Wh("noscript",a,r),script:Wh("script",x,r),style:Wh("style",o,r),title:Wh("title",{title:l,titleAttributes:c},r)}},NVe=Von,NF=[],AVe=!!(typeof window<"u"&&window.document&&window.document.createElement),Yre=class{constructor(t,e){$n(this,"instances",[]);$n(this,"canUseDOM",AVe);$n(this,"context");$n(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?NF:this.instances,add:t=>{(this.canUseDOM?NF:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?NF:this.instances).indexOf(t);(this.canUseDOM?NF:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=NVe({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Won={},jVe=Ne.createContext(Won),a3,to=(a3=class extends m.Component{constructor(n){super(n);$n(this,"helmetData");this.helmetData=new Yre(this.props.context||{},a3.canUseDOM)}render(){return Ne.createElement(jVe.Provider,{value:this.helmetData.value},this.props.children)}},$n(a3,"canUseDOM",AVe),a3),jC=(t,e)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll(`${t}[${bm}]`),s=[].slice.call(r),a=[];let o;return e&&e.length&&e.forEach(l=>{const c=document.createElement(t);for(const u in l)if(Object.prototype.hasOwnProperty.call(l,u))if(u==="innerHTML")c.innerHTML=l.innerHTML;else if(u==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const d=u,f=typeof l[d]>"u"?"":l[d];c.setAttribute(u,f)}c.setAttribute(bm,"true"),s.some((u,d)=>(o=d,c.isEqualNode(u)))?s.splice(o,1):a.push(c)}),s.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),a.forEach(l=>n.appendChild(l)),{oldTags:s,newTags:a}},Xre=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const r=n.getAttribute(bm),s=r?r.split(","):[],a=[...s],o=Object.keys(e);for(const l of o){const c=e[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=a.indexOf(l);u!==-1&&a.splice(u,1)}for(let l=a.length-1;l>=0;l-=1)n.removeAttribute(a[l]);s.length===a.length?n.removeAttribute(bm):n.getAttribute(bm)!==o.join(",")&&n.setAttribute(bm,o.join(","))},qon=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=wVe(t)),Xre("title",e)},V4e=(t,e)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:s,linkTags:a,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:d,title:f,titleAttributes:x}=t;Xre("body",r),Xre("html",s),qon(f,x);const g={baseTag:jC("base",n),linkTags:jC("link",a),metaTags:jC("meta",o),noscriptTags:jC("noscript",l),scriptTags:jC("script",u),styleTags:jC("style",d)},y={},v={};Object.keys(g).forEach(C=>{const{newTags:N,oldTags:P}=g[C];N.length&&(y[C]=N),P.length&&(v[C]=g[C].oldTags)}),e&&e(),c(t,y,v)},y7=null,Gon=t=>{y7&&cancelAnimationFrame(y7),t.defer?y7=requestAnimationFrame(()=>{V4e(t,()=>{y7=null})}):(V4e(t),y7=null)},Kon=Gon,W4e=class extends m.Component{constructor(){super(...arguments);$n(this,"rendered",!1)}shouldComponentUpdate(e){return!Ton(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let r=null;const s=Lon(e.get().map(a=>{const o={...a.props};return delete o.context,o}));to.canUseDOM?Kon(s):r=NVe(s),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},_Z,xo=(_Z=class extends m.Component{shouldComponentUpdate(t){return!Aon(H4e(this.props,"helmetData"),H4e(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,r){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,r)}]}}mapObjectTypeChildren(t,e,n,r){switch(t.type){case"title":return{...e,[t.type]:r,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(r=>{n={...n,[r]:t[r]}}),n}warnOnInvalidChildren(t,e){return $4e(z4e.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${z4e.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),$4e(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return Ne.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:s,...a}=r.props,o=Object.keys(a).reduce((c,u)=>(c[Pon[u]||u]=a[u],c),{});let{type:l}=r;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(r,s),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(s,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,o,s);break;default:e=this.mapObjectTypeChildren(r,e,o,s);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:r}=e;if(t&&(n=this.mapChildrenToProps(t,n)),r&&!(r instanceof Yre)){const s=r;r=new Yre(s.context,!0),delete n.helmetData}return r?Ne.createElement(W4e,{...n,context:r.value}):Ne.createElement(jVe.Consumer,null,s=>Ne.createElement(W4e,{...n,context:s}))}},$n(_Z,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),_Z);const Yon=()=>{const[t,e]=m.useState(1),[n,r]=m.useState("-"),[s,a]=m.useState("-"),o=0,[l,c]=m.useState(o),u=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90},{index:4,name:"All",value:999}],d=parseInt(localStorage.getItem("discover_period")),f=!isNaN(d)&&u[d]?u[d].value:u[1].value,[x,g]=m.useState(f),y=v=>{g(Number(v)),localStorage.setItem("discover_period",u.findIndex(C=>C.value===Number(v)).toFixed(0))};return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Discover Top HyperLiquid Wallets for Copy Trading - Dextrabot"}),i.jsx("meta",{name:"description",content:"Find and analyze the best HyperLiquid wallets for copy trading. Use powerful filters to discover profitable traders and automate your trades effortlessly."}),i.jsx("meta",{name:"og:title",content:"Discover Top HyperLiquid Wallets for Copy Trading - Dextrabot"}),i.jsx("meta",{name:"og:description",content:"Find and analyze the best HyperLiquid wallets for copy trading. Use powerful filters to discover profitable traders and automate your trades effortlessly."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/discover-wallets"})]})}),i.jsx("div",{className:"flex flex-col items-stretch justify-start sm:justify-center text-white w-full bg-[#161616] overflow-hidden min-h-[calc(100vh)] sm:min-h-[calc(100vh-5rem)] sm:h-[calc(100vh-5rem)] overflow-y-auto sm:pb-0",children:i.jsx(Con,{currentPage:t,setCurrentPage:e,offset:l,setOffset:c,totalPage:n,totalWalletCount:s,setTotalPage:r,setTotalWalletCount:a,period:x,periods:u,handlePeriodChange:y})})]})},mi=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s})=>{const a=()=>{r(n===`-${e}`?e:`-${e}`)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>a(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope`,children:[i.jsx("div",{className:`${n.includes(e)?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(uz,{sortKey:e,state:n,className:""})]})})};var AF={},jF={exports:{}};/*!
* ApexCharts v3.54.1
* (c) 2018-2024 ApexCharts
* Released under the MIT License.
*/var q4e;function Xon(){return q4e||(q4e=1,function(t,e){function n(Ee,h){(h==null||h>Ee.length)&&(h=Ee.length);for(var p=0,S=Array(h);p<h;p++)S[p]=Ee[p];return S}function r(Ee){if(Ee===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return Ee}function s(Ee,h){if(!(Ee instanceof h))throw new TypeError("Cannot call a class as a function")}function a(Ee,h){for(var p=0;p<h.length;p++){var S=h[p];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(Ee,P(S.key),S)}}function o(Ee,h,p){return h&&a(Ee.prototype,h),p&&a(Ee,p),Object.defineProperty(Ee,"prototype",{writable:!1}),Ee}function l(Ee,h){var p=typeof Symbol<"u"&&Ee[Symbol.iterator]||Ee["@@iterator"];if(!p){if(Array.isArray(Ee)||(p=M(Ee))||h){p&&(Ee=p);var S=0,_=function(){};return{s:_,n:function(){return S>=Ee.length?{done:!0}:{done:!1,value:Ee[S++]}},e:function(G){throw G},f:_}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k,I=!0,B=!1;return{s:function(){p=p.call(Ee)},n:function(){var G=p.next();return I=G.done,G},e:function(G){B=!0,k=G},f:function(){try{I||p.return==null||p.return()}finally{if(B)throw k}}}}function c(Ee){var h=x();return function(){var p,S=d(Ee);if(h){var _=d(this).constructor;p=Reflect.construct(S,arguments,_)}else p=S.apply(this,arguments);return function(k,I){if(I&&(typeof I=="object"||typeof I=="function"))return I;if(I!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r(k)}(this,p)}}function u(Ee,h,p){return(h=P(h))in Ee?Object.defineProperty(Ee,h,{value:p,enumerable:!0,configurable:!0,writable:!0}):Ee[h]=p,Ee}function d(Ee){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(h){return h.__proto__||Object.getPrototypeOf(h)},d(Ee)}function f(Ee,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function");Ee.prototype=Object.create(h&&h.prototype,{constructor:{value:Ee,writable:!0,configurable:!0}}),Object.defineProperty(Ee,"prototype",{writable:!1}),h&&v(Ee,h)}function x(){try{var Ee=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x=function(){return!!Ee})()}function g(Ee,h){var p=Object.keys(Ee);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(Ee);h&&(S=S.filter(function(_){return Object.getOwnPropertyDescriptor(Ee,_).enumerable})),p.push.apply(p,S)}return p}function y(Ee){for(var h=1;h<arguments.length;h++){var p=arguments[h]!=null?arguments[h]:{};h%2?g(Object(p),!0).forEach(function(S){u(Ee,S,p[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Ee,Object.getOwnPropertyDescriptors(p)):g(Object(p)).forEach(function(S){Object.defineProperty(Ee,S,Object.getOwnPropertyDescriptor(p,S))})}return Ee}function v(Ee,h){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(p,S){return p.__proto__=S,p},v(Ee,h)}function C(Ee,h){return function(p){if(Array.isArray(p))return p}(Ee)||function(p,S){var _=p==null?null:typeof Symbol<"u"&&p[Symbol.iterator]||p["@@iterator"];if(_!=null){var k,I,B,G,re=[],ce=!0,ue=!1;try{if(B=(_=_.call(p)).next,S===0){if(Object(_)!==_)return;ce=!1}else for(;!(ce=(k=B.call(_)).done)&&(re.push(k.value),re.length!==S);ce=!0);}catch(ge){ue=!0,I=ge}finally{try{if(!ce&&_.return!=null&&(G=_.return(),Object(G)!==G))return}finally{if(ue)throw I}}return re}}(Ee,h)||M(Ee,h)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function N(Ee){return function(h){if(Array.isArray(h))return n(h)}(Ee)||function(h){if(typeof Symbol<"u"&&h[Symbol.iterator]!=null||h["@@iterator"]!=null)return Array.from(h)}(Ee)||M(Ee)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function P(Ee){var h=function(p,S){if(typeof p!="object"||!p)return p;var _=p[Symbol.toPrimitive];if(_!==void 0){var k=_.call(p,S||"default");if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(p)}(Ee,"string");return typeof h=="symbol"?h:h+""}function T(Ee){return T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},T(Ee)}function M(Ee,h){if(Ee){if(typeof Ee=="string")return n(Ee,h);var p={}.toString.call(Ee).slice(8,-1);return p==="Object"&&Ee.constructor&&(p=Ee.constructor.name),p==="Map"||p==="Set"?Array.from(Ee):p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p)?n(Ee,h):void 0}}var F=function(){function Ee(){s(this,Ee)}return o(Ee,[{key:"shadeRGBColor",value:function(h,p){var S=p.split(","),_=h<0?0:255,k=h<0?-1*h:h,I=parseInt(S[0].slice(4),10),B=parseInt(S[1],10),G=parseInt(S[2],10);return"rgb("+(Math.round((_-I)*k)+I)+","+(Math.round((_-B)*k)+B)+","+(Math.round((_-G)*k)+G)+")"}},{key:"shadeHexColor",value:function(h,p){var S=parseInt(p.slice(1),16),_=h<0?0:255,k=h<0?-1*h:h,I=S>>16,B=S>>8&255,G=255&S;return"#"+(16777216+65536*(Math.round((_-I)*k)+I)+256*(Math.round((_-B)*k)+B)+(Math.round((_-G)*k)+G)).toString(16).slice(1)}},{key:"shadeColor",value:function(h,p){return Ee.isColorHex(p)?this.shadeHexColor(h,p):this.shadeRGBColor(h,p)}}],[{key:"bind",value:function(h,p){return function(){return h.apply(p,arguments)}}},{key:"isObject",value:function(h){return h&&T(h)==="object"&&!Array.isArray(h)&&h!=null}},{key:"is",value:function(h,p){return Object.prototype.toString.call(p)==="[object "+h+"]"}},{key:"listToArray",value:function(h){var p,S=[];for(p=0;p<h.length;p++)S[p]=h[p];return S}},{key:"extend",value:function(h,p){var S=this;typeof Object.assign!="function"&&(Object.assign=function(k){if(k==null)throw new TypeError("Cannot convert undefined or null to object");for(var I=Object(k),B=1;B<arguments.length;B++){var G=arguments[B];if(G!=null)for(var re in G)G.hasOwnProperty(re)&&(I[re]=G[re])}return I});var _=Object.assign({},h);return this.isObject(h)&&this.isObject(p)&&Object.keys(p).forEach(function(k){S.isObject(p[k])&&k in h?_[k]=S.extend(h[k],p[k]):Object.assign(_,u({},k,p[k]))}),_}},{key:"extendArray",value:function(h,p){var S=[];return h.map(function(_){S.push(Ee.extend(p,_))}),h=S}},{key:"monthMod",value:function(h){return h%12}},{key:"clone",value:function(h){if(Ee.is("Array",h)){for(var p=[],S=0;S<h.length;S++)p[S]=this.clone(h[S]);return p}if(Ee.is("Null",h))return null;if(Ee.is("Date",h))return h;if(T(h)==="object"){var _={};for(var k in h)h.hasOwnProperty(k)&&(_[k]=this.clone(h[k]));return _}return h}},{key:"log10",value:function(h){return Math.log(h)/Math.LN10}},{key:"roundToBase10",value:function(h){return Math.pow(10,Math.floor(Math.log10(h)))}},{key:"roundToBase",value:function(h,p){return Math.pow(p,Math.floor(Math.log(h)/Math.log(p)))}},{key:"parseNumber",value:function(h){return h===null?h:parseFloat(h)}},{key:"stripNumber",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Number.isInteger(h)?h:parseFloat(h.toPrecision(p))}},{key:"randomId",value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:"noExponents",value:function(h){var p=String(h).split(/[eE]/);if(p.length===1)return p[0];var S="",_=h<0?"-":"",k=p[0].replace(".",""),I=Number(p[1])+1;if(I<0){for(S=_+"0.";I++;)S+="0";return S+k.replace(/^-/,"")}for(I-=k.length;I--;)S+="0";return k+S}},{key:"getDimensions",value:function(h){var p=getComputedStyle(h,null),S=h.clientHeight,_=h.clientWidth;return S-=parseFloat(p.paddingTop)+parseFloat(p.paddingBottom),[_-=parseFloat(p.paddingLeft)+parseFloat(p.paddingRight),S]}},{key:"getBoundingClientRect",value:function(h){var p=h.getBoundingClientRect();return{top:p.top,right:p.right,bottom:p.bottom,left:p.left,width:h.clientWidth,height:h.clientHeight,x:p.left,y:p.top}}},{key:"getLargestStringFromArr",value:function(h){return h.reduce(function(p,S){return Array.isArray(S)&&(S=S.reduce(function(_,k){return _.length>k.length?_:k})),p.length>S.length?p:S},0)}},{key:"hexToRgba",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"#999999",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.6;h.substring(0,1)!=="#"&&(h="#999999");var S=h.replace("#","");S=S.match(new RegExp("(.{"+S.length/3+"})","g"));for(var _=0;_<S.length;_++)S[_]=parseInt(S[_].length===1?S[_]+S[_]:S[_],16);return p!==void 0&&S.push(p),"rgba("+S.join(",")+")"}},{key:"getOpacityFromRGBA",value:function(h){return parseFloat(h.replace(/^.*,(.+)\)/,"$1"))}},{key:"rgb2hex",value:function(h){return(h=h.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&h.length===4?"#"+("0"+parseInt(h[1],10).toString(16)).slice(-2)+("0"+parseInt(h[2],10).toString(16)).slice(-2)+("0"+parseInt(h[3],10).toString(16)).slice(-2):""}},{key:"isColorHex",value:function(h){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(h)}},{key:"getPolygonPos",value:function(h,p){for(var S=[],_=2*Math.PI/p,k=0;k<p;k++){var I={};I.x=h*Math.sin(k*_),I.y=-h*Math.cos(k*_),S.push(I)}return S}},{key:"polarToCartesian",value:function(h,p,S,_){var k=(_-90)*Math.PI/180;return{x:h+S*Math.cos(k),y:p+S*Math.sin(k)}}},{key:"escapeString",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x",S=h.toString().slice();return S=S.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,p)}},{key:"negToZero",value:function(h){return h<0?0:h}},{key:"moveIndexInArray",value:function(h,p,S){if(S>=h.length)for(var _=S-h.length+1;_--;)h.push(void 0);return h.splice(S,0,h.splice(p,1)[0]),h}},{key:"extractNumber",value:function(h){return parseFloat(h.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(h,p){for(;(h=h.parentElement)&&!h.classList.contains(p););return h}},{key:"setELstyles",value:function(h,p){for(var S in p)p.hasOwnProperty(S)&&(h.style.key=p[S])}},{key:"preciseAddition",value:function(h,p){var S=(String(h).split(".")[1]||"").length,_=(String(p).split(".")[1]||"").length,k=Math.pow(10,Math.max(S,_));return(Math.round(h*k)+Math.round(p*k))/k}},{key:"isNumber",value:function(h){return!isNaN(h)&&parseFloat(Number(h))===h&&!isNaN(parseInt(h,10))}},{key:"isFloat",value:function(h){return Number(h)===h&&h%1!=0}},{key:"isSafari",value:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}},{key:"isFirefox",value:function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1}},{key:"isMsEdge",value:function(){var h=window.navigator.userAgent,p=h.indexOf("Edge/");return p>0&&parseInt(h.substring(p+5,h.indexOf(".",p)),10)}},{key:"getGCD",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,_=Math.pow(10,S-Math.floor(Math.log10(Math.max(h,p))));for(h=Math.round(Math.abs(h)*_),p=Math.round(Math.abs(p)*_);p;){var k=p;p=h%p,h=k}return h/_}},{key:"getPrimeFactors",value:function(h){for(var p=[],S=2;h>=2;)h%S==0?(p.push(S),h/=S):S++;return p}},{key:"mod",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:7,_=Math.pow(10,S-Math.floor(Math.log10(Math.max(h,p))));return(h=Math.round(Math.abs(h)*_))%(p=Math.round(Math.abs(p)*_))/_}}]),Ee}(),$=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.setEasingFunctions()}return o(Ee,[{key:"setEasingFunctions",value:function(){var h;if(!this.w.globals.easing){switch(this.w.config.chart.animations.easing){case"linear":h="-";break;case"easein":h="<";break;case"easeout":h=">";break;case"easeinout":default:h="<>";break;case"swing":h=function(p){var S=1.70158;return(p-=1)*p*((S+1)*p+S)+1};break;case"bounce":h=function(p){return p<1/2.75?7.5625*p*p:p<2/2.75?7.5625*(p-=1.5/2.75)*p+.75:p<2.5/2.75?7.5625*(p-=2.25/2.75)*p+.9375:7.5625*(p-=2.625/2.75)*p+.984375};break;case"elastic":h=function(p){return p===!!p?p:Math.pow(2,-10*p)*Math.sin((p-.075)*(2*Math.PI)/.3)+1}}this.w.globals.easing=h}}},{key:"animateLine",value:function(h,p,S,_){h.attr(p).animate(_).attr(S)}},{key:"animateMarker",value:function(h,p,S,_){h.attr({opacity:0}).animate(p,S).attr({opacity:1}).afterAll(function(){_()})}},{key:"animateRect",value:function(h,p,S,_,k){h.attr(p).animate(_).attr(S).afterAll(function(){return k()})}},{key:"animatePathsGradually",value:function(h){var p=h.el,S=h.realIndex,_=h.j,k=h.fill,I=h.pathFrom,B=h.pathTo,G=h.speed,re=h.delay,ce=this.w,ue=0;ce.config.chart.animations.animateGradually.enabled&&(ue=ce.config.chart.animations.animateGradually.delay),ce.config.chart.animations.dynamicAnimation.enabled&&ce.globals.dataChanged&&ce.config.chart.type!=="bar"&&(ue=0),this.morphSVG(p,S,_,ce.config.chart.type!=="line"||ce.globals.comboCharts?k:"stroke",I,B,G,re*ue)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach(function(h){var p=h.el;p.classList.remove("apexcharts-element-hidden"),p.classList.add("apexcharts-hidden-element-shown")})}},{key:"animationCompleted",value:function(h){var p=this.w;p.globals.animationEnded||(p.globals.animationEnded=!0,this.showDelayedElements(),typeof p.config.chart.events.animationEnd=="function"&&p.config.chart.events.animationEnd(this.ctx,{el:h,w:p}))}},{key:"morphSVG",value:function(h,p,S,_,k,I,B,G){var re=this,ce=this.w;k||(k=h.attr("pathFrom")),I||(I=h.attr("pathTo"));var ue=function(ge){return ce.config.chart.type==="radar"&&(B=1),"M 0 ".concat(ce.globals.gridHeight)};(!k||k.indexOf("undefined")>-1||k.indexOf("NaN")>-1)&&(k=ue()),(!I||I.indexOf("undefined")>-1||I.indexOf("NaN")>-1)&&(I=ue()),ce.globals.shouldAnimate||(B=1),h.plot(k).animate(1,ce.globals.easing,G).plot(k).animate(B,ce.globals.easing,G).plot(I).afterAll(function(){F.isNumber(S)?S===ce.globals.series[ce.globals.maxValsInArrayIndex].length-2&&ce.globals.shouldAnimate&&re.animationCompleted(h):_!=="none"&&ce.globals.shouldAnimate&&(!ce.globals.comboCharts&&p===ce.globals.series.length-1||ce.globals.comboCharts)&&re.animationCompleted(h),re.showDelayedElements()})}}]),Ee}(),L=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"getDefaultFilter",value:function(h,p){var S=this.w;h.unfilter(!0),new window.SVG.Filter().size("120%","180%","-5%","-40%"),S.config.states.normal.filter!=="none"?this.applyFilter(h,p,S.config.states.normal.filter.type,S.config.states.normal.filter.value):S.config.chart.dropShadow.enabled&&this.dropShadow(h,S.config.chart.dropShadow,p)}},{key:"addNormalFilter",value:function(h,p){var S=this.w;S.config.chart.dropShadow.enabled&&!h.node.classList.contains("apexcharts-marker")&&this.dropShadow(h,S.config.chart.dropShadow,p)}},{key:"addLightenFilter",value:function(h,p,S){var _=this,k=this.w,I=S.intensity;h.unfilter(!0),new window.SVG.Filter,h.filter(function(B){var G=k.config.chart.dropShadow;(G.enabled?_.addShadow(B,p,G):B).componentTransfer({rgb:{type:"linear",slope:1.5,intercept:I}})}),h.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(h.filterer.node)}},{key:"addDarkenFilter",value:function(h,p,S){var _=this,k=this.w,I=S.intensity;h.unfilter(!0),new window.SVG.Filter,h.filter(function(B){var G=k.config.chart.dropShadow;(G.enabled?_.addShadow(B,p,G):B).componentTransfer({rgb:{type:"linear",slope:I}})}),h.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(h.filterer.node)}},{key:"applyFilter",value:function(h,p,S){var _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.5;switch(S){case"none":this.addNormalFilter(h,p);break;case"lighten":this.addLightenFilter(h,p,{intensity:_});break;case"darken":this.addDarkenFilter(h,p,{intensity:_})}}},{key:"addShadow",value:function(h,p,S){var _,k=this.w,I=S.blur,B=S.top,G=S.left,re=S.color,ce=S.opacity;if(((_=k.config.chart.dropShadow.enabledOnSeries)===null||_===void 0?void 0:_.length)>0&&k.config.chart.dropShadow.enabledOnSeries.indexOf(p)===-1)return h;var ue=h.flood(Array.isArray(re)?re[p]:re,ce).composite(h.sourceAlpha,"in").offset(G,B).gaussianBlur(I).merge(h.source);return h.blend(h.source,ue)}},{key:"dropShadow",value:function(h,p){var S,_,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,I=p.top,B=p.left,G=p.blur,re=p.color,ce=p.opacity,ue=p.noUserSpaceOnUse,ge=this.w;return h.unfilter(!0),F.isMsEdge()&&ge.config.chart.type==="radialBar"||((S=ge.config.chart.dropShadow.enabledOnSeries)===null||S===void 0?void 0:S.length)>0&&((_=ge.config.chart.dropShadow.enabledOnSeries)===null||_===void 0?void 0:_.indexOf(k))===-1||(re=Array.isArray(re)?re[k]:re,h.filter(function(Ae){var ke=null;ke=F.isSafari()||F.isFirefox()||F.isMsEdge()?Ae.flood(re,ce).composite(Ae.sourceAlpha,"in").offset(B,I).gaussianBlur(G):Ae.flood(re,ce).composite(Ae.sourceAlpha,"in").offset(B,I).gaussianBlur(G).merge(Ae.source),Ae.blend(Ae.source,ke)}),ue||h.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(h.filterer.node)),h}},{key:"setSelectionFilter",value:function(h,p,S){var _=this.w;if(_.globals.selectedDataPoints[p]!==void 0&&_.globals.selectedDataPoints[p].indexOf(S)>-1){h.node.setAttribute("selected",!0);var k=_.config.states.active.filter;k!=="none"&&this.applyFilter(h,p,k.type,k.value)}}},{key:"_scaleFilterSize",value:function(h){(function(p){for(var S in p)p.hasOwnProperty(S)&&h.setAttribute(S,p[S])})({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}]),Ee}(),z=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"roundPathCorners",value:function(h,p){function S(st,ut,yt){var Mt=ut.x-st.x,Kt=ut.y-st.y,un=Math.sqrt(Mt*Mt+Kt*Kt);return _(st,ut,Math.min(1,yt/un))}function _(st,ut,yt){return{x:st.x+(ut.x-st.x)*yt,y:st.y+(ut.y-st.y)*yt}}function k(st,ut){st.length>2&&(st[st.length-2]=ut.x,st[st.length-1]=ut.y)}function I(st){return{x:parseFloat(st[st.length-2]),y:parseFloat(st[st.length-1])}}h.indexOf("NaN")>-1&&(h="");var B=h.split(/[,\s]/).reduce(function(st,ut){var yt=ut.match("([a-zA-Z])(.+)");return yt?(st.push(yt[1]),st.push(yt[2])):st.push(ut),st},[]).reduce(function(st,ut){return parseFloat(ut)==ut&&st.length?st[st.length-1].push(ut):st.push([ut]),st},[]),G=[];if(B.length>1){var re=I(B[0]),ce=null;B[B.length-1][0]=="Z"&&B[0].length>2&&(ce=["L",re.x,re.y],B[B.length-1]=ce),G.push(B[0]);for(var ue=1;ue<B.length;ue++){var ge=G[G.length-1],Ae=B[ue],ke=Ae==ce?B[1]:B[ue+1];if(ke&&ge&&ge.length>2&&Ae[0]=="L"&&ke.length>2&&ke[0]=="L"){var Me,qe,Fe=I(ge),at=I(Ae),ie=I(ke);Me=S(at,Fe,p),qe=S(at,ie,p),k(Ae,Me),Ae.origPoint=at,G.push(Ae);var Se=_(Me,at,.5),$e=_(at,qe,.5),Ue=["C",Se.x,Se.y,$e.x,$e.y,qe.x,qe.y];Ue.origPoint=at,G.push(Ue)}else G.push(Ae)}if(ce){var _e=I(G[G.length-1]);G.push(["Z"]),k(G[0],_e)}}else G=B;return G.reduce(function(st,ut){return st+ut.join(" ")+" "},"")}},{key:"drawLine",value:function(h,p,S,_){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"#a8a8a8",I=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,B=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,G=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"butt";return this.w.globals.dom.Paper.line().attr({x1:h,y1:p,x2:S,y2:_,stroke:k,"stroke-dasharray":I,"stroke-width":B,"stroke-linecap":G})}},{key:"drawRect",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,I=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"#fefefe",B=arguments.length>6&&arguments[6]!==void 0?arguments[6]:1,G=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,re=arguments.length>8&&arguments[8]!==void 0?arguments[8]:null,ce=arguments.length>9&&arguments[9]!==void 0?arguments[9]:0,ue=this.w.globals.dom.Paper.rect();return ue.attr({x:h,y:p,width:S>0?S:0,height:_>0?_:0,rx:k,ry:k,opacity:B,"stroke-width":G!==null?G:0,stroke:re!==null?re:"none","stroke-dasharray":ce}),ue.node.setAttribute("fill",I),ue}},{key:"drawPolygon",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#e1e1e1",S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"none";return this.w.globals.dom.Paper.polygon(h).attr({fill:_,stroke:p,"stroke-width":S})}},{key:"drawCircle",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;h<0&&(h=0);var S=this.w.globals.dom.Paper.circle(2*h);return p!==null&&S.attr(p),S}},{key:"drawPath",value:function(h){var p=h.d,S=p===void 0?"":p,_=h.stroke,k=_===void 0?"#a8a8a8":_,I=h.strokeWidth,B=I===void 0?1:I,G=h.fill,re=h.fillOpacity,ce=re===void 0?1:re,ue=h.strokeOpacity,ge=ue===void 0?1:ue,Ae=h.classes,ke=h.strokeLinecap,Me=ke===void 0?null:ke,qe=h.strokeDashArray,Fe=qe===void 0?0:qe,at=this.w;return Me===null&&(Me=at.config.stroke.lineCap),(S.indexOf("undefined")>-1||S.indexOf("NaN")>-1)&&(S="M 0 ".concat(at.globals.gridHeight)),at.globals.dom.Paper.path(S).attr({fill:G,"fill-opacity":ce,stroke:k,"stroke-opacity":ge,"stroke-linecap":Me,"stroke-width":B,"stroke-dasharray":Fe,class:Ae})}},{key:"group",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,p=this.w.globals.dom.Paper.group();return h!==null&&p.attr(h),p}},{key:"move",value:function(h,p){var S=["M",h,p].join(" ");return S}},{key:"line",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=null;return S===null?_=[" L",h,p].join(" "):S==="H"?_=[" H",h].join(" "):S==="V"&&(_=[" V",p].join(" ")),_}},{key:"curve",value:function(h,p,S,_,k,I){var B=["C",h,p,S,_,k,I].join(" ");return B}},{key:"quadraticCurve",value:function(h,p,S,_){return["Q",h,p,S,_].join(" ")}},{key:"arc",value:function(h,p,S,_,k,I,B){var G="A";arguments.length>7&&arguments[7]!==void 0&&arguments[7]&&(G="a");var re=[G,h,p,S,_,k,I,B].join(" ");return re}},{key:"renderPaths",value:function(h){var p,S=h.j,_=h.realIndex,k=h.pathFrom,I=h.pathTo,B=h.stroke,G=h.strokeWidth,re=h.strokeLinecap,ce=h.fill,ue=h.animationDelay,ge=h.initialSpeed,Ae=h.dataChangeSpeed,ke=h.className,Me=h.chartType,qe=h.shouldClipToGrid,Fe=qe===void 0||qe,at=h.bindEventsOnPaths,ie=at===void 0||at,Se=h.drawShadow,$e=Se===void 0||Se,Ue=this.w,_e=new L(this.ctx),st=new $(this.ctx),ut=this.w.config.chart.animations.enabled,yt=ut&&this.w.config.chart.animations.dynamicAnimation.enabled,Mt=!!(ut&&!Ue.globals.resized||yt&&Ue.globals.dataChanged&&Ue.globals.shouldAnimate);Mt?p=k:(p=I,Ue.globals.animationEnded=!0);var Kt=Ue.config.stroke.dashArray,un=0;un=Array.isArray(Kt)?Kt[_]:Ue.config.stroke.dashArray;var Xe=this.drawPath({d:p,stroke:B,strokeWidth:G,fill:ce,fillOpacity:1,classes:ke,strokeLinecap:re,strokeDashArray:un});if(Xe.attr("index",_),Fe&&(Me==="bar"&&!Ue.globals.isHorizontal||Ue.globals.comboCharts?Xe.attr({"clip-path":"url(#gridRectBarMask".concat(Ue.globals.cuid,")")}):Xe.attr({"clip-path":"url(#gridRectMask".concat(Ue.globals.cuid,")")})),Ue.config.states.normal.filter.type!=="none")_e.getDefaultFilter(Xe,_);else if(Ue.config.chart.dropShadow.enabled&&$e){var Pt=Ue.config.chart.dropShadow;_e.dropShadow(Xe,Pt,_)}ie&&(Xe.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,Xe)),Xe.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,Xe)),Xe.node.addEventListener("mousedown",this.pathMouseDown.bind(this,Xe))),Xe.attr({pathTo:I,pathFrom:k});var Wt={el:Xe,j:S,realIndex:_,pathFrom:k,pathTo:I,fill:ce,strokeWidth:G,delay:ue};return!ut||Ue.globals.resized||Ue.globals.dataChanged?!Ue.globals.resized&&Ue.globals.dataChanged||st.showDelayedElements():st.animatePathsGradually(y(y({},Wt),{},{speed:ge})),Ue.globals.dataChanged&&yt&&Mt&&st.animatePathsGradually(y(y({},Wt),{},{speed:Ae})),Xe}},{key:"drawPattern",value:function(h,p,S){var _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"#a8a8a8",k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;return this.w.globals.dom.Paper.pattern(p,S,function(I){h==="horizontalLines"?I.line(0,0,S,0).stroke({color:_,width:k+1}):h==="verticalLines"?I.line(0,0,0,p).stroke({color:_,width:k+1}):h==="slantedLines"?I.line(0,0,p,S).stroke({color:_,width:k}):h==="squares"?I.rect(p,S).fill("none").stroke({color:_,width:k}):h==="circles"&&I.circle(p).fill("none").stroke({color:_,width:k})})}},{key:"drawGradient",value:function(h,p,S,_,k){var I,B=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,G=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,re=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,ce=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0,ue=this.w;p.length<9&&p.indexOf("#")===0&&(p=F.hexToRgba(p,_)),S.length<9&&S.indexOf("#")===0&&(S=F.hexToRgba(S,k));var ge=0,Ae=1,ke=1,Me=null;G!==null&&(ge=G[0]!==void 0?G[0]/100:0,Ae=G[1]!==void 0?G[1]/100:1,ke=G[2]!==void 0?G[2]/100:1,Me=G[3]!==void 0?G[3]/100:null);var qe=!(ue.config.chart.type!=="donut"&&ue.config.chart.type!=="pie"&&ue.config.chart.type!=="polarArea"&&ue.config.chart.type!=="bubble");if(I=re===null||re.length===0?ue.globals.dom.Paper.gradient(qe?"radial":"linear",function(ie){ie.at(ge,p,_),ie.at(Ae,S,k),ie.at(ke,S,k),Me!==null&&ie.at(Me,p,_)}):ue.globals.dom.Paper.gradient(qe?"radial":"linear",function(ie){(Array.isArray(re[ce])?re[ce]:re).forEach(function(Se){ie.at(Se.offset/100,Se.color,Se.opacity)})}),qe){var Fe=ue.globals.gridWidth/2,at=ue.globals.gridHeight/2;ue.config.chart.type!=="bubble"?I.attr({gradientUnits:"userSpaceOnUse",cx:Fe,cy:at,r:B}):I.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else h==="vertical"?I.from(0,0).to(0,1):h==="diagonal"?I.from(0,0).to(1,1):h==="horizontal"?I.from(0,1).to(1,1):h==="diagonal2"&&I.from(1,0).to(0,1);return I}},{key:"getTextBasedOnMaxWidth",value:function(h){var p=h.text,S=h.maxWidth,_=h.fontSize,k=h.fontFamily,I=this.getTextRects(p,_,k),B=I.width/p.length,G=Math.floor(S/B);return S<I.width?p.slice(0,G-3)+"...":p}},{key:"drawText",value:function(h){var p=this,S=h.x,_=h.y,k=h.text,I=h.textAnchor,B=h.fontSize,G=h.fontFamily,re=h.fontWeight,ce=h.foreColor,ue=h.opacity,ge=h.maxWidth,Ae=h.cssClass,ke=Ae===void 0?"":Ae,Me=h.isPlainText,qe=Me===void 0||Me,Fe=h.dominantBaseline,at=Fe===void 0?"auto":Fe,ie=this.w;k===void 0&&(k="");var Se=k;I||(I="start"),ce&&ce.length||(ce=ie.config.chart.foreColor),G=G||ie.config.chart.fontFamily,re=re||"regular";var $e,Ue={maxWidth:ge,fontSize:B=B||"11px",fontFamily:G};return Array.isArray(k)?$e=ie.globals.dom.Paper.text(function(_e){for(var st=0;st<k.length;st++)Se=k[st],ge&&(Se=p.getTextBasedOnMaxWidth(y({text:k[st]},Ue))),st===0?_e.tspan(Se):_e.tspan(Se).newLine()}):(ge&&(Se=this.getTextBasedOnMaxWidth(y({text:k},Ue))),$e=qe?ie.globals.dom.Paper.plain(k):ie.globals.dom.Paper.text(function(_e){return _e.tspan(Se)})),$e.attr({x:S,y:_,"text-anchor":I,"dominant-baseline":at,"font-size":B,"font-family":G,"font-weight":re,fill:ce,class:"apexcharts-text "+ke}),$e.node.style.fontFamily=G,$e.node.style.opacity=ue,$e}},{key:"getMarkerPath",value:function(h,p,S,_){var k="";switch(S){case"cross":k="M ".concat(h-(_/=1.4)," ").concat(p-_," L ").concat(h+_," ").concat(p+_," M ").concat(h-_," ").concat(p+_," L ").concat(h+_," ").concat(p-_);break;case"plus":k="M ".concat(h-(_/=1.12)," ").concat(p," L ").concat(h+_," ").concat(p," M ").concat(h," ").concat(p-_," L ").concat(h," ").concat(p+_);break;case"star":case"sparkle":var I=5;_*=1.15,S==="sparkle"&&(_/=1.1,I=4);for(var B=Math.PI/I,G=0;G<=2*I;G++){var re=G*B,ce=G%2==0?_:_/2;k+=(G===0?"M":"L")+(h+ce*Math.sin(re))+","+(p-ce*Math.cos(re))}k+="Z";break;case"triangle":k="M ".concat(h," ").concat(p-_,`
L `).concat(h+_," ").concat(p+_,`
L `).concat(h-_," ").concat(p+_,`
Z`);break;case"square":case"rect":k="M ".concat(h-(_/=1.125)," ").concat(p-_,`
L `).concat(h+_," ").concat(p-_,`
L `).concat(h+_," ").concat(p+_,`
L `).concat(h-_," ").concat(p+_,`
Z`);break;case"diamond":_*=1.05,k="M ".concat(h," ").concat(p-_,`
L `).concat(h+_," ").concat(p,`
L `).concat(h," ").concat(p+_,`
L `).concat(h-_," ").concat(p,`
Z`);break;case"line":k="M ".concat(h-(_/=1.1)," ").concat(p,`
L `).concat(h+_," ").concat(p);break;default:_*=2,k="M ".concat(h,", ").concat(p,`
m -`).concat(_/2,`, 0
a `).concat(_/2,",").concat(_/2," 0 1,0 ").concat(_,`,0
a `).concat(_/2,",").concat(_/2," 0 1,0 -").concat(_,",0")}return k}},{key:"drawMarkerShape",value:function(h,p,S,_,k){var I=this.drawPath({d:this.getMarkerPath(h,p,S,_,k),stroke:k.pointStrokeColor,strokeDashArray:k.pointStrokeDashArray,strokeWidth:k.pointStrokeWidth,fill:k.pointFillColor,fillOpacity:k.pointFillOpacity,strokeOpacity:k.pointStrokeOpacity});return I.attr({cx:h,cy:p,shape:k.shape,class:k.class?k.class:""}),I}},{key:"drawMarker",value:function(h,p,S){h=h||0;var _=S.pSize||0;return F.isNumber(p)||(_=0,p=0),this.drawMarkerShape(h,p,S==null?void 0:S.shape,_,y(y({},S),S.shape==="line"||S.shape==="plus"||S.shape==="cross"?{pointStrokeColor:S.pointFillColor,pointStrokeOpacity:S.pointFillOpacity}:{}))}},{key:"pathMouseEnter",value:function(h,p){var S=this.w,_=new L(this.ctx),k=parseInt(h.node.getAttribute("index"),10),I=parseInt(h.node.getAttribute("j"),10);if(typeof S.config.chart.events.dataPointMouseEnter=="function"&&S.config.chart.events.dataPointMouseEnter(p,this.ctx,{seriesIndex:k,dataPointIndex:I,w:S}),this.ctx.events.fireEvent("dataPointMouseEnter",[p,this.ctx,{seriesIndex:k,dataPointIndex:I,w:S}]),(S.config.states.active.filter.type==="none"||h.node.getAttribute("selected")!=="true")&&S.config.states.hover.filter.type!=="none"&&!S.globals.isTouchDevice){var B=S.config.states.hover.filter;_.applyFilter(h,k,B.type,B.value)}}},{key:"pathMouseLeave",value:function(h,p){var S=this.w,_=new L(this.ctx),k=parseInt(h.node.getAttribute("index"),10),I=parseInt(h.node.getAttribute("j"),10);typeof S.config.chart.events.dataPointMouseLeave=="function"&&S.config.chart.events.dataPointMouseLeave(p,this.ctx,{seriesIndex:k,dataPointIndex:I,w:S}),this.ctx.events.fireEvent("dataPointMouseLeave",[p,this.ctx,{seriesIndex:k,dataPointIndex:I,w:S}]),S.config.states.active.filter.type!=="none"&&h.node.getAttribute("selected")==="true"||S.config.states.hover.filter.type!=="none"&&_.getDefaultFilter(h,k)}},{key:"pathMouseDown",value:function(h,p){var S=this.w,_=new L(this.ctx),k=parseInt(h.node.getAttribute("index"),10),I=parseInt(h.node.getAttribute("j"),10),B="false";if(h.node.getAttribute("selected")==="true"){if(h.node.setAttribute("selected","false"),S.globals.selectedDataPoints[k].indexOf(I)>-1){var G=S.globals.selectedDataPoints[k].indexOf(I);S.globals.selectedDataPoints[k].splice(G,1)}}else{if(!S.config.states.active.allowMultipleDataPointsSelection&&S.globals.selectedDataPoints.length>0){S.globals.selectedDataPoints=[];var re=S.globals.dom.Paper.select(".apexcharts-series path").members,ce=S.globals.dom.Paper.select(".apexcharts-series circle, .apexcharts-series rect").members,ue=function(ke){Array.prototype.forEach.call(ke,function(Me){Me.node.setAttribute("selected","false"),_.getDefaultFilter(Me,k)})};ue(re),ue(ce)}h.node.setAttribute("selected","true"),B="true",S.globals.selectedDataPoints[k]===void 0&&(S.globals.selectedDataPoints[k]=[]),S.globals.selectedDataPoints[k].push(I)}if(B==="true"){var ge=S.config.states.active.filter;if(ge!=="none")_.applyFilter(h,k,ge.type,ge.value);else if(S.config.states.hover.filter!=="none"&&!S.globals.isTouchDevice){var Ae=S.config.states.hover.filter;_.applyFilter(h,k,Ae.type,Ae.value)}}else S.config.states.active.filter.type!=="none"&&(S.config.states.hover.filter.type==="none"||S.globals.isTouchDevice?_.getDefaultFilter(h,k):(Ae=S.config.states.hover.filter,_.applyFilter(h,k,Ae.type,Ae.value)));typeof S.config.chart.events.dataPointSelection=="function"&&S.config.chart.events.dataPointSelection(p,this.ctx,{selectedDataPoints:S.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:I,w:S}),p&&this.ctx.events.fireEvent("dataPointSelection",[p,this.ctx,{selectedDataPoints:S.globals.selectedDataPoints,seriesIndex:k,dataPointIndex:I,w:S}])}},{key:"rotateAroundCenter",value:function(h){var p={};return h&&typeof h.getBBox=="function"&&(p=h.getBBox()),{x:p.x+p.width/2,y:p.y+p.height/2}}},{key:"getTextRects",value:function(h,p,S,_){var k=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],I=this.w,B=this.drawText({x:-200,y:-200,text:h,textAnchor:"start",fontSize:p,fontFamily:S,foreColor:"#fff",opacity:0});_&&B.attr("transform",_),I.globals.dom.Paper.add(B);var G=B.bbox();return k||(G=B.node.getBoundingClientRect()),B.remove(),{width:G.width,height:G.height}}},{key:"placeTextWithEllipsis",value:function(h,p,S){if(typeof h.getComputedTextLength=="function"&&(h.textContent=p,p.length>0&&h.getComputedTextLength()>=S/1.1)){for(var _=p.length-3;_>0;_-=3)if(h.getSubStringLength(0,_)<=S/1.1)return void(h.textContent=p.substring(0,_)+"...");h.textContent="."}}}],[{key:"setAttrs",value:function(h,p){for(var S in p)p.hasOwnProperty(S)&&h.setAttribute(S,p[S])}}]),Ee}(),X=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"getStackedSeriesTotals",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=this.w,S=[];if(p.globals.series.length===0)return S;for(var _=0;_<p.globals.series[p.globals.maxValsInArrayIndex].length;_++){for(var k=0,I=0;I<p.globals.series.length;I++)p.globals.series[I][_]!==void 0&&h.indexOf(I)===-1&&(k+=p.globals.series[I][_]);S.push(k)}return S}},{key:"getSeriesTotalByIndex",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return h===null?this.w.config.series.reduce(function(p,S){return p+S},0):this.w.globals.series[h].reduce(function(p,S){return p+S},0)}},{key:"getStackedSeriesTotalsByGroups",value:function(){var h=this,p=this.w,S=[];return p.globals.seriesGroups.forEach(function(_){var k=[];p.config.series.forEach(function(B,G){_.indexOf(p.globals.seriesNames[G])>-1&&k.push(G)});var I=p.globals.series.map(function(B,G){return k.indexOf(G)===-1?G:-1}).filter(function(B){return B!==-1});S.push(h.getStackedSeriesTotals(I))}),S}},{key:"setSeriesYAxisMappings",value:function(){var h=this.w.globals,p=this.w.config,S=[],_=[],k=[],I=h.series.length>p.yaxis.length||p.yaxis.some(function(ue){return Array.isArray(ue.seriesName)});p.series.forEach(function(ue,ge){k.push(ge),_.push(null)}),p.yaxis.forEach(function(ue,ge){S[ge]=[]});var B=[];p.yaxis.forEach(function(ue,ge){var Ae=!1;if(ue.seriesName){var ke=[];Array.isArray(ue.seriesName)?ke=ue.seriesName:ke.push(ue.seriesName),ke.forEach(function(Me){p.series.forEach(function(qe,Fe){if(qe.name===Me){var at=Fe;ge===Fe||I?!I||k.indexOf(Fe)>-1?S[ge].push([ge,Fe]):console.warn("Series '"+qe.name+"' referenced more than once in what looks like the new style. That is, when using either seriesName: [], or when there are more series than yaxes."):(S[Fe].push([Fe,ge]),at=ge),Ae=!0,(at=k.indexOf(at))!==-1&&k.splice(at,1)}})})}Ae||B.push(ge)}),S=S.map(function(ue,ge){var Ae=[];return ue.forEach(function(ke){_[ke[1]]=ke[0],Ae.push(ke[1])}),Ae});for(var G=p.yaxis.length-1,re=0;re<B.length&&(G=B[re],S[G]=[],k);re++){var ce=k[0];k.shift(),S[G].push(ce),_[ce]=G}k.forEach(function(ue){S[G].push(ue),_[ue]=G}),h.seriesYAxisMap=S.map(function(ue){return ue}),h.seriesYAxisReverseMap=_.map(function(ue){return ue}),h.seriesYAxisMap.forEach(function(ue,ge){ue.forEach(function(Ae){p.series[Ae]&&p.series[Ae].group===void 0&&(p.series[Ae].group="apexcharts-axis-".concat(ge.toString()))})})}},{key:"isSeriesNull",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return(h===null?this.w.config.series.filter(function(p){return p!==null}):this.w.config.series[h].data.filter(function(p){return p!==null})).length===0}},{key:"seriesHaveSameValues",value:function(h){return this.w.globals.series[h].every(function(p,S,_){return p===_[0]})}},{key:"getCategoryLabels",value:function(h){var p=this.w,S=h.slice();return p.config.xaxis.convertedCatToNumeric&&(S=h.map(function(_,k){return p.config.xaxis.labels.formatter(_-p.globals.minX+1)})),S}},{key:"getLargestSeries",value:function(){var h=this.w;h.globals.maxValsInArrayIndex=h.globals.series.map(function(p){return p.length}).indexOf(Math.max.apply(Math,h.globals.series.map(function(p){return p.length})))}},{key:"getLargestMarkerSize",value:function(){var h=this.w,p=0;return h.globals.markers.size.forEach(function(S){p=Math.max(p,S)}),h.config.markers.discrete&&h.config.markers.discrete.length&&h.config.markers.discrete.forEach(function(S){p=Math.max(p,S.size)}),p>0&&(h.config.markers.hover.size>0?p=h.config.markers.hover.size:p+=h.config.markers.hover.sizeOffset),h.globals.markers.largestSize=p,p}},{key:"getSeriesTotals",value:function(){var h=this.w;h.globals.seriesTotals=h.globals.series.map(function(p,S){var _=0;if(Array.isArray(p))for(var k=0;k<p.length;k++)_+=p[k];else _+=p;return _})}},{key:"getSeriesTotalsXRange",value:function(h,p){var S=this.w;return S.globals.series.map(function(_,k){for(var I=0,B=0;B<_.length;B++)S.globals.seriesX[k][B]>h&&S.globals.seriesX[k][B]<p&&(I+=_[B]);return I})}},{key:"getPercentSeries",value:function(){var h=this.w;h.globals.seriesPercent=h.globals.series.map(function(p,S){var _=[];if(Array.isArray(p))for(var k=0;k<p.length;k++){var I=h.globals.stackedSeriesTotals[k],B=0;I&&(B=100*p[k]/I),_.push(B)}else{var G=100*p/h.globals.seriesTotals.reduce(function(re,ce){return re+ce},0);_.push(G)}return _})}},{key:"getCalculatedRatios",value:function(){var h,p,S,_=this,k=this.w,I=k.globals,B=[],G=0,re=[],ce=.1,ue=0;if(I.yRange=[],I.isMultipleYAxis)for(var ge=0;ge<I.minYArr.length;ge++)I.yRange.push(Math.abs(I.minYArr[ge]-I.maxYArr[ge])),re.push(0);else I.yRange.push(Math.abs(I.minY-I.maxY));I.xRange=Math.abs(I.maxX-I.minX),I.zRange=Math.abs(I.maxZ-I.minZ);for(var Ae=0;Ae<I.yRange.length;Ae++)B.push(I.yRange[Ae]/I.gridHeight);if(p=I.xRange/I.gridWidth,h=I.yRange/I.gridWidth,S=I.xRange/I.gridHeight,(G=I.zRange/I.gridHeight*16)||(G=1),I.minY!==Number.MIN_VALUE&&Math.abs(I.minY)!==0&&(I.hasNegs=!0),k.globals.seriesYAxisReverseMap.length>0){var ke=function(qe,Fe){var at=k.config.yaxis[k.globals.seriesYAxisReverseMap[Fe]],ie=qe<0?-1:1;return qe=Math.abs(qe),at.logarithmic&&(qe=_.getBaseLog(at.logBase,qe)),-ie*qe/B[Fe]};if(I.isMultipleYAxis){re=[];for(var Me=0;Me<B.length;Me++)re.push(ke(I.minYArr[Me],Me))}else(re=[]).push(ke(I.minY,0)),I.minY!==Number.MIN_VALUE&&Math.abs(I.minY)!==0&&(ce=-I.minY/h,ue=I.minX/p)}else(re=[]).push(0),ce=0,ue=0;return{yRatio:B,invertedYRatio:h,zRatio:G,xRatio:p,invertedXRatio:S,baseLineInvertedY:ce,baseLineY:re,baseLineX:ue}}},{key:"getLogSeries",value:function(h){var p=this,S=this.w;return S.globals.seriesLog=h.map(function(_,k){var I=S.globals.seriesYAxisReverseMap[k];return S.config.yaxis[I]&&S.config.yaxis[I].logarithmic?_.map(function(B){return B===null?null:p.getLogVal(S.config.yaxis[I].logBase,B,k)}):_}),S.globals.invalidLogScale?h:S.globals.seriesLog}},{key:"getBaseLog",value:function(h,p){return Math.log(p)/Math.log(h)}},{key:"getLogVal",value:function(h,p,S){if(p<=0)return 0;var _=this.w,k=_.globals.minYArr[S]===0?-1:this.getBaseLog(h,_.globals.minYArr[S]),I=(_.globals.maxYArr[S]===0?0:this.getBaseLog(h,_.globals.maxYArr[S]))-k;return p<1?p/I:(this.getBaseLog(h,p)-k)/I}},{key:"getLogYRatios",value:function(h){var p=this,S=this.w,_=this.w.globals;return _.yLogRatio=h.slice(),_.logYRange=_.yRange.map(function(k,I){var B=S.globals.seriesYAxisReverseMap[I];if(S.config.yaxis[B]&&p.w.config.yaxis[B].logarithmic){var G,re=-Number.MAX_VALUE,ce=Number.MIN_VALUE;return _.seriesLog.forEach(function(ue,ge){ue.forEach(function(Ae){S.config.yaxis[ge]&&S.config.yaxis[ge].logarithmic&&(re=Math.max(Ae,re),ce=Math.min(Ae,ce))})}),G=Math.pow(_.yRange[I],Math.abs(ce-re)/_.yRange[I]),_.yLogRatio[I]=G/_.gridHeight,G}}),_.invalidLogScale?h.slice():_.yLogRatio}},{key:"drawSeriesByGroup",value:function(h,p,S,_){var k=this.w,I=[];return h.series.length>0&&p.forEach(function(B){var G=[],re=[];h.i.forEach(function(ce,ue){k.config.series[ce].group===B&&(G.push(h.series[ue]),re.push(ce))}),G.length>0&&I.push(_.draw(G,S,re))}),I}}],[{key:"checkComboSeries",value:function(h,p){var S=!1,_=0,k=0;return p===void 0&&(p="line"),h.length&&h[0].type!==void 0&&h.forEach(function(I){I.type!=="bar"&&I.type!=="column"&&I.type!=="candlestick"&&I.type!=="boxPlot"||_++,I.type!==void 0&&I.type!==p&&k++}),k>0&&(S=!0),{comboBarCount:_,comboCharts:S}}},{key:"extendArrayProps",value:function(h,p,S){var _,k,I,B,G,re;return(_=p)!==null&&_!==void 0&&_.yaxis&&(p=h.extendYAxis(p,S)),(k=p)!==null&&k!==void 0&&k.annotations&&(p.annotations.yaxis&&(p=h.extendYAxisAnnotations(p)),(I=p)!==null&&I!==void 0&&(B=I.annotations)!==null&&B!==void 0&&B.xaxis&&(p=h.extendXAxisAnnotations(p)),(G=p)!==null&&G!==void 0&&(re=G.annotations)!==null&&re!==void 0&&re.points&&(p=h.extendPointAnnotations(p))),p}}]),Ee}(),ne=function(){function Ee(h){s(this,Ee),this.w=h.w,this.annoCtx=h}return o(Ee,[{key:"setOrientations",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,S=this.w;if(h.label.orientation==="vertical"){var _=p!==null?p:0,k=S.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(_,"']"));if(k!==null){var I=k.getBoundingClientRect();k.setAttribute("x",parseFloat(k.getAttribute("x"))-I.height+4);var B=h.label.position==="top"?I.width:-I.width;k.setAttribute("y",parseFloat(k.getAttribute("y"))+B);var G=this.annoCtx.graphics.rotateAroundCenter(k),re=G.x,ce=G.y;k.setAttribute("transform","rotate(-90 ".concat(re," ").concat(ce,")"))}}}},{key:"addBackgroundToAnno",value:function(h,p){var S=this.w;if(!h||!p.label.text||!String(p.label.text).trim())return null;var _=S.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),k=h.getBoundingClientRect(),I=p.label.style.padding,B=I.left,G=I.right,re=I.top,ce=I.bottom;if(p.label.orientation==="vertical"){var ue=[B,G,re,ce];re=ue[0],ce=ue[1],B=ue[2],G=ue[3]}var ge=k.left-_.left-B,Ae=k.top-_.top-re,ke=this.annoCtx.graphics.drawRect(ge-S.globals.barPadForNumericAxis,Ae,k.width+B+G,k.height+re+ce,p.label.borderRadius,p.label.style.background,1,p.label.borderWidth,p.label.borderColor,0);return p.id&&ke.node.classList.add(p.id),ke}},{key:"annotationsBackground",value:function(){var h=this,p=this.w,S=function(_,k,I){var B=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(I,"-annotations .apexcharts-").concat(I,"-annotation-label[rel='").concat(k,"']"));if(B){var G=B.parentNode,re=h.addBackgroundToAnno(B,_);re&&(G.insertBefore(re.node,B),_.label.mouseEnter&&re.node.addEventListener("mouseenter",_.label.mouseEnter.bind(h,_)),_.label.mouseLeave&&re.node.addEventListener("mouseleave",_.label.mouseLeave.bind(h,_)),_.label.click&&re.node.addEventListener("click",_.label.click.bind(h,_)))}};p.config.annotations.xaxis.forEach(function(_,k){return S(_,k,"xaxis")}),p.config.annotations.yaxis.forEach(function(_,k){return S(_,k,"yaxis")}),p.config.annotations.points.forEach(function(_,k){return S(_,k,"point")})}},{key:"getY1Y2",value:function(h,p){var S,_=this.w,k=h==="y1"?p.y:p.y2,I=!1;if(this.annoCtx.invertAxis){var B=_.config.xaxis.convertedCatToNumeric?_.globals.categoryLabels:_.globals.labels,G=B.indexOf(k),re=_.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child(".concat(G+1,")"));S=re?parseFloat(re.getAttribute("y")):(_.globals.gridHeight/B.length-1)*(G+1)-_.globals.barHeight,p.seriesIndex!==void 0&&_.globals.barHeight&&(S-=_.globals.barHeight/2*(_.globals.series.length-1)-_.globals.barHeight*p.seriesIndex)}else{var ce,ue=_.globals.seriesYAxisMap[p.yAxisIndex][0],ge=_.config.yaxis[p.yAxisIndex].logarithmic?new X(this.annoCtx.ctx).getLogVal(_.config.yaxis[p.yAxisIndex].logBase,k,ue)/_.globals.yLogRatio[ue]:(k-_.globals.minYArr[ue])/(_.globals.yRange[ue]/_.globals.gridHeight);S=_.globals.gridHeight-Math.min(Math.max(ge,0),_.globals.gridHeight),I=ge>_.globals.gridHeight||ge<0,!p.marker||p.y!==void 0&&p.y!==null||(S=0),(ce=_.config.yaxis[p.yAxisIndex])!==null&&ce!==void 0&&ce.reversed&&(S=ge)}return typeof k=="string"&&k.includes("px")&&(S=parseFloat(k)),{yP:S,clipped:I}}},{key:"getX1X2",value:function(h,p){var S=this.w,_=h==="x1"?p.x:p.x2,k=this.annoCtx.invertAxis?S.globals.minY:S.globals.minX,I=this.annoCtx.invertAxis?S.globals.maxY:S.globals.maxX,B=this.annoCtx.invertAxis?S.globals.yRange[0]:S.globals.xRange,G=!1,re=this.annoCtx.inversedReversedAxis?(I-_)/(B/S.globals.gridWidth):(_-k)/(B/S.globals.gridWidth);return S.config.xaxis.type!=="category"&&!S.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||S.globals.dataFormatXNumeric||S.config.chart.sparkline.enabled||(re=this.getStringX(_)),typeof _=="string"&&_.includes("px")&&(re=parseFloat(_)),_==null&&p.marker&&(re=S.globals.gridWidth),p.seriesIndex!==void 0&&S.globals.barWidth&&!this.annoCtx.invertAxis&&(re-=S.globals.barWidth/2*(S.globals.series.length-1)-S.globals.barWidth*p.seriesIndex),re>S.globals.gridWidth?(re=S.globals.gridWidth,G=!0):re<0&&(re=0,G=!0),{x:re,clipped:G}}},{key:"getStringX",value:function(h){var p=this.w,S=h;p.config.xaxis.convertedCatToNumeric&&p.globals.categoryLabels.length&&(h=p.globals.categoryLabels.indexOf(h)+1);var _=p.globals.labels.map(function(I){return Array.isArray(I)?I.join(" "):I}).indexOf(h),k=p.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child(".concat(_+1,")"));return k&&(S=parseFloat(k.getAttribute("x"))),S}}]),Ee}(),J=function(){function Ee(h){s(this,Ee),this.w=h.w,this.annoCtx=h,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new ne(this.annoCtx)}return o(Ee,[{key:"addXaxisAnnotation",value:function(h,p,S){var _,k=this.w,I=this.helpers.getX1X2("x1",h),B=I.x,G=I.clipped,re=!0,ce=h.label.text,ue=h.strokeDashArray;if(F.isNumber(B)){if(h.x2===null||h.x2===void 0){if(!G){var ge=this.annoCtx.graphics.drawLine(B+h.offsetX,0+h.offsetY,B+h.offsetX,k.globals.gridHeight+h.offsetY,h.borderColor,ue,h.borderWidth);p.appendChild(ge.node),h.id&&ge.node.classList.add(h.id)}}else{var Ae=this.helpers.getX1X2("x2",h);if(_=Ae.x,re=Ae.clipped,!G||!re){if(_<B){var ke=B;B=_,_=ke}var Me=this.annoCtx.graphics.drawRect(B+h.offsetX,0+h.offsetY,_-B,k.globals.gridHeight+h.offsetY,0,h.fillColor,h.opacity,1,h.borderColor,ue);Me.node.classList.add("apexcharts-annotation-rect"),Me.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Me.node),h.id&&Me.node.classList.add(h.id)}}if(!G||!re){var qe=this.annoCtx.graphics.getTextRects(ce,parseFloat(h.label.style.fontSize)),Fe=h.label.position==="top"?4:h.label.position==="center"?k.globals.gridHeight/2+(h.label.orientation==="vertical"?qe.width/2:0):k.globals.gridHeight,at=this.annoCtx.graphics.drawText({x:B+h.label.offsetX,y:Fe+h.label.offsetY-(h.label.orientation==="vertical"?h.label.position==="top"?qe.width/2-12:-qe.width/2:0),text:ce,textAnchor:h.label.textAnchor,fontSize:h.label.style.fontSize,fontFamily:h.label.style.fontFamily,fontWeight:h.label.style.fontWeight,foreColor:h.label.style.color,cssClass:"apexcharts-xaxis-annotation-label ".concat(h.label.style.cssClass," ").concat(h.id?h.id:"")});at.attr({rel:S}),p.appendChild(at.node),this.annoCtx.helpers.setOrientations(h,S)}}}},{key:"drawXAxisAnnotations",value:function(){var h=this,p=this.w,S=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return p.config.annotations.xaxis.map(function(_,k){h.addXaxisAnnotation(_,S.node,k)}),S}}]),Ee}(),K=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.months31=[1,3,5,7,8,10,12],this.months30=[2,4,6,9,11],this.daysCntOfYear=[0,31,59,90,120,151,181,212,243,273,304,334]}return o(Ee,[{key:"isValidDate",value:function(h){return typeof h!="number"&&!isNaN(this.parseDate(h))}},{key:"getTimeStamp",value:function(h){return Date.parse(h)?this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(h).toISOString().substr(0,25)).getTime():new Date(h).getTime():h}},{key:"getDate",value:function(h){return this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(h).toUTCString()):new Date(h)}},{key:"parseDate",value:function(h){var p=Date.parse(h);if(!isNaN(p))return this.getTimeStamp(h);var S=Date.parse(h.replace(/-/g,"/").replace(/[a-z]+/gi," "));return S=this.getTimeStamp(S)}},{key:"parseDateWithTimezone",value:function(h){return Date.parse(h.replace(/-/g,"/").replace(/[a-z]+/gi," "))}},{key:"formatDate",value:function(h,p){var S=this.w.globals.locale,_=this.w.config.xaxis.labels.datetimeUTC,k=["\0"].concat(N(S.months)),I=[""].concat(N(S.shortMonths)),B=[""].concat(N(S.days)),G=[""].concat(N(S.shortDays));function re(st,ut){var yt=st+"";for(ut=ut||2;yt.length<ut;)yt="0"+yt;return yt}var ce=_?h.getUTCFullYear():h.getFullYear();p=(p=(p=p.replace(/(^|[^\\])yyyy+/g,"$1"+ce)).replace(/(^|[^\\])yy/g,"$1"+ce.toString().substr(2,2))).replace(/(^|[^\\])y/g,"$1"+ce);var ue=(_?h.getUTCMonth():h.getMonth())+1;p=(p=(p=(p=p.replace(/(^|[^\\])MMMM+/g,"$1"+k[0])).replace(/(^|[^\\])MMM/g,"$1"+I[0])).replace(/(^|[^\\])MM/g,"$1"+re(ue))).replace(/(^|[^\\])M/g,"$1"+ue);var ge=_?h.getUTCDate():h.getDate();p=(p=(p=(p=p.replace(/(^|[^\\])dddd+/g,"$1"+B[0])).replace(/(^|[^\\])ddd/g,"$1"+G[0])).replace(/(^|[^\\])dd/g,"$1"+re(ge))).replace(/(^|[^\\])d/g,"$1"+ge);var Ae=_?h.getUTCHours():h.getHours(),ke=Ae>12?Ae-12:Ae===0?12:Ae;p=(p=(p=(p=p.replace(/(^|[^\\])HH+/g,"$1"+re(Ae))).replace(/(^|[^\\])H/g,"$1"+Ae)).replace(/(^|[^\\])hh+/g,"$1"+re(ke))).replace(/(^|[^\\])h/g,"$1"+ke);var Me=_?h.getUTCMinutes():h.getMinutes();p=(p=p.replace(/(^|[^\\])mm+/g,"$1"+re(Me))).replace(/(^|[^\\])m/g,"$1"+Me);var qe=_?h.getUTCSeconds():h.getSeconds();p=(p=p.replace(/(^|[^\\])ss+/g,"$1"+re(qe))).replace(/(^|[^\\])s/g,"$1"+qe);var Fe=_?h.getUTCMilliseconds():h.getMilliseconds();p=p.replace(/(^|[^\\])fff+/g,"$1"+re(Fe,3)),Fe=Math.round(Fe/10),p=p.replace(/(^|[^\\])ff/g,"$1"+re(Fe)),Fe=Math.round(Fe/10);var at=Ae<12?"AM":"PM";p=(p=(p=p.replace(/(^|[^\\])f/g,"$1"+Fe)).replace(/(^|[^\\])TT+/g,"$1"+at)).replace(/(^|[^\\])T/g,"$1"+at.charAt(0));var ie=at.toLowerCase();p=(p=p.replace(/(^|[^\\])tt+/g,"$1"+ie)).replace(/(^|[^\\])t/g,"$1"+ie.charAt(0));var Se=-h.getTimezoneOffset(),$e=_||!Se?"Z":Se>0?"+":"-";if(!_){var Ue=(Se=Math.abs(Se))%60;$e+=re(Math.floor(Se/60))+":"+re(Ue)}p=p.replace(/(^|[^\\])K/g,"$1"+$e);var _e=(_?h.getUTCDay():h.getDay())+1;return p=(p=(p=(p=(p=p.replace(new RegExp(B[0],"g"),B[_e])).replace(new RegExp(G[0],"g"),G[_e])).replace(new RegExp(k[0],"g"),k[ue])).replace(new RegExp(I[0],"g"),I[ue])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(h,p,S){var _=this.w;_.config.xaxis.min!==void 0&&(h=_.config.xaxis.min),_.config.xaxis.max!==void 0&&(p=_.config.xaxis.max);var k=this.getDate(h),I=this.getDate(p),B=this.formatDate(k,"yyyy MM dd HH mm ss fff").split(" "),G=this.formatDate(I,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(B[6],10),maxMillisecond:parseInt(G[6],10),minSecond:parseInt(B[5],10),maxSecond:parseInt(G[5],10),minMinute:parseInt(B[4],10),maxMinute:parseInt(G[4],10),minHour:parseInt(B[3],10),maxHour:parseInt(G[3],10),minDate:parseInt(B[2],10),maxDate:parseInt(G[2],10),minMonth:parseInt(B[1],10)-1,maxMonth:parseInt(G[1],10)-1,minYear:parseInt(B[0],10),maxYear:parseInt(G[0],10)}}},{key:"isLeapYear",value:function(h){return h%4==0&&h%100!=0||h%400==0}},{key:"calculcateLastDaysOfMonth",value:function(h,p,S){return this.determineDaysOfMonths(h,p)-S}},{key:"determineDaysOfYear",value:function(h){var p=365;return this.isLeapYear(h)&&(p=366),p}},{key:"determineRemainingDaysOfYear",value:function(h,p,S){var _=this.daysCntOfYear[p]+S;return p>1&&this.isLeapYear()&&_++,_}},{key:"determineDaysOfMonths",value:function(h,p){var S=30;switch(h=F.monthMod(h),!0){case this.months30.indexOf(h)>-1:h===2&&(S=this.isLeapYear(p)?29:28);break;case this.months31.indexOf(h)>-1:default:S=31}return S}}]),Ee}(),te=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.tooltipKeyFormat="dd MMM"}return o(Ee,[{key:"xLabelFormat",value:function(h,p,S,_){var k=this.w;if(k.config.xaxis.type==="datetime"&&k.config.xaxis.labels.formatter===void 0&&k.config.tooltip.x.formatter===void 0){var I=new K(this.ctx);return I.formatDate(I.getDate(p),k.config.tooltip.x.format)}return h(p,S,_)}},{key:"defaultGeneralFormatter",value:function(h){return Array.isArray(h)?h.map(function(p){return p}):h}},{key:"defaultYFormatter",value:function(h,p,S){var _=this.w;if(F.isNumber(h))if(_.globals.yValueDecimal!==0)h=h.toFixed(p.decimalsInFloat!==void 0?p.decimalsInFloat:_.globals.yValueDecimal);else{var k=h.toFixed(0);h=h==k?k:h.toFixed(1)}return h}},{key:"setLabelFormatters",value:function(){var h=this,p=this.w;return p.globals.xaxisTooltipFormatter=function(S){return h.defaultGeneralFormatter(S)},p.globals.ttKeyFormatter=function(S){return h.defaultGeneralFormatter(S)},p.globals.ttZFormatter=function(S){return S},p.globals.legendFormatter=function(S){return h.defaultGeneralFormatter(S)},p.config.xaxis.labels.formatter!==void 0?p.globals.xLabelFormatter=p.config.xaxis.labels.formatter:p.globals.xLabelFormatter=function(S){if(F.isNumber(S)){if(!p.config.xaxis.convertedCatToNumeric&&p.config.xaxis.type==="numeric"){if(F.isNumber(p.config.xaxis.decimalsInFloat))return S.toFixed(p.config.xaxis.decimalsInFloat);var _=p.globals.maxX-p.globals.minX;return _>0&&_<100?S.toFixed(1):S.toFixed(0)}return p.globals.isBarHorizontal&&p.globals.maxY-p.globals.minYArr<4?S.toFixed(1):S.toFixed(0)}return S},typeof p.config.tooltip.x.formatter=="function"?p.globals.ttKeyFormatter=p.config.tooltip.x.formatter:p.globals.ttKeyFormatter=p.globals.xLabelFormatter,typeof p.config.xaxis.tooltip.formatter=="function"&&(p.globals.xaxisTooltipFormatter=p.config.xaxis.tooltip.formatter),(Array.isArray(p.config.tooltip.y)||p.config.tooltip.y.formatter!==void 0)&&(p.globals.ttVal=p.config.tooltip.y),p.config.tooltip.z.formatter!==void 0&&(p.globals.ttZFormatter=p.config.tooltip.z.formatter),p.config.legend.formatter!==void 0&&(p.globals.legendFormatter=p.config.legend.formatter),p.config.yaxis.forEach(function(S,_){S.labels.formatter!==void 0?p.globals.yLabelFormatters[_]=S.labels.formatter:p.globals.yLabelFormatters[_]=function(k){return p.globals.xyCharts?Array.isArray(k)?k.map(function(I){return h.defaultYFormatter(I,S,_)}):h.defaultYFormatter(k,S,_):k}}),p.globals}},{key:"heatmapLabelFormatters",value:function(){var h=this.w;if(h.config.chart.type==="heatmap"){h.globals.yAxisScale[0].result=h.globals.seriesNames.slice();var p=h.globals.seriesNames.reduce(function(S,_){return S.length>_.length?S:_},0);h.globals.yAxisScale[0].niceMax=p,h.globals.yAxisScale[0].niceMin=p}}}]),Ee}(),fe=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"getLabel",value:function(h,p,S,_){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],I=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"12px",B=!(arguments.length>6&&arguments[6]!==void 0)||arguments[6],G=this.w,re=h[_]===void 0?"":h[_],ce=re,ue=G.globals.xLabelFormatter,ge=G.config.xaxis.labels.formatter,Ae=!1,ke=new te(this.ctx),Me=re;B&&(ce=ke.xLabelFormat(ue,re,Me,{i:_,dateFormatter:new K(this.ctx).formatDate,w:G}),ge!==void 0&&(ce=ge(re,h[_],{i:_,dateFormatter:new K(this.ctx).formatDate,w:G})));var qe,Fe;p.length>0?(qe=p[_].unit,Fe=null,p.forEach(function($e){$e.unit==="month"?Fe="year":$e.unit==="day"?Fe="month":$e.unit==="hour"?Fe="day":$e.unit==="minute"&&(Fe="hour")}),Ae=Fe===qe,S=p[_].position,ce=p[_].value):G.config.xaxis.type==="datetime"&&ge===void 0&&(ce=""),ce===void 0&&(ce=""),ce=Array.isArray(ce)?ce:ce.toString();var at=new z(this.ctx),ie={};ie=G.globals.rotateXLabels&&B?at.getTextRects(ce,parseInt(I,10),null,"rotate(".concat(G.config.xaxis.labels.rotate," 0 0)"),!1):at.getTextRects(ce,parseInt(I,10));var Se=!G.config.xaxis.labels.showDuplicates&&this.ctx.timeScale;return!Array.isArray(ce)&&(String(ce)==="NaN"||k.indexOf(ce)>=0&&Se)&&(ce=""),{x:S,text:ce,textRect:ie,isBold:Ae}}},{key:"checkLabelBasedOnTickamount",value:function(h,p,S){var _=this.w,k=_.config.xaxis.tickAmount;return k==="dataPoints"&&(k=Math.round(_.globals.gridWidth/120)),k>S||h%Math.round(S/(k+1))==0||(p.text=""),p}},{key:"checkForOverflowingLabels",value:function(h,p,S,_,k){var I=this.w;if(h===0&&I.globals.skipFirstTimelinelabel&&(p.text=""),h===S-1&&I.globals.skipLastTimelinelabel&&(p.text=""),I.config.xaxis.labels.hideOverlappingLabels&&_.length>0){var B=k[k.length-1];p.x<B.textRect.width/(I.globals.rotateXLabels?Math.abs(I.config.xaxis.labels.rotate)/12:1.01)+B.x&&(p.text="")}return p}},{key:"checkForReversedLabels",value:function(h,p){var S=this.w;return S.config.yaxis[h]&&S.config.yaxis[h].reversed&&p.reverse(),p}},{key:"yAxisAllSeriesCollapsed",value:function(h){var p=this.w.globals;return!p.seriesYAxisMap[h].some(function(S){return p.collapsedSeriesIndices.indexOf(S)===-1})}},{key:"translateYAxisIndex",value:function(h){var p=this.w,S=p.globals,_=p.config.yaxis;return S.series.length>_.length||_.some(function(k){return Array.isArray(k.seriesName)})?h:S.seriesYAxisReverseMap[h]}},{key:"isYAxisHidden",value:function(h){var p=this.w,S=p.config.yaxis[h];if(!S.show||this.yAxisAllSeriesCollapsed(h))return!0;if(!S.showForNullSeries){var _=p.globals.seriesYAxisMap[h],k=new X(this.ctx);return _.every(function(I){return k.isSeriesNull(I)})}return!1}},{key:"getYAxisForeColor",value:function(h,p){var S=this.w;return Array.isArray(h)&&S.globals.yAxisScale[p]&&this.ctx.theme.pushExtraColors(h,S.globals.yAxisScale[p].result.length,!1),h}},{key:"drawYAxisTicks",value:function(h,p,S,_,k,I,B){var G=this.w,re=new z(this.ctx),ce=G.globals.translateY+G.config.yaxis[k].labels.offsetY;if(G.globals.isBarHorizontal?ce=0:G.config.chart.type==="heatmap"&&(ce+=I/2),_.show&&p>0){G.config.yaxis[k].opposite===!0&&(h+=_.width);for(var ue=p;ue>=0;ue--){var ge=re.drawLine(h+S.offsetX-_.width+_.offsetX,ce+_.offsetY,h+S.offsetX+_.offsetX,ce+_.offsetY,_.color);B.add(ge),ce+=I}}}}]),Ee}(),q=function(){function Ee(h){s(this,Ee),this.w=h.w,this.annoCtx=h,this.helpers=new ne(this.annoCtx),this.axesUtils=new fe(this.annoCtx)}return o(Ee,[{key:"addYaxisAnnotation",value:function(h,p,S){var _,k=this.w,I=h.strokeDashArray,B=this.helpers.getY1Y2("y1",h),G=B.yP,re=B.clipped,ce=!0,ue=!1,ge=h.label.text;if(h.y2===null||h.y2===void 0){if(!re){ue=!0;var Ae=this.annoCtx.graphics.drawLine(0+h.offsetX,G+h.offsetY,this._getYAxisAnnotationWidth(h),G+h.offsetY,h.borderColor,I,h.borderWidth);p.appendChild(Ae.node),h.id&&Ae.node.classList.add(h.id)}}else{if(_=(B=this.helpers.getY1Y2("y2",h)).yP,ce=B.clipped,_>G){var ke=G;G=_,_=ke}if(!re||!ce){ue=!0;var Me=this.annoCtx.graphics.drawRect(0+h.offsetX,_+h.offsetY,this._getYAxisAnnotationWidth(h),G-_,0,h.fillColor,h.opacity,1,h.borderColor,I);Me.node.classList.add("apexcharts-annotation-rect"),Me.attr("clip-path","url(#gridRectMask".concat(k.globals.cuid,")")),p.appendChild(Me.node),h.id&&Me.node.classList.add(h.id)}}if(ue){var qe=h.label.position==="right"?k.globals.gridWidth:h.label.position==="center"?k.globals.gridWidth/2:0,Fe=this.annoCtx.graphics.drawText({x:qe+h.label.offsetX,y:(_??G)+h.label.offsetY-3,text:ge,textAnchor:h.label.textAnchor,fontSize:h.label.style.fontSize,fontFamily:h.label.style.fontFamily,fontWeight:h.label.style.fontWeight,foreColor:h.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(h.label.style.cssClass," ").concat(h.id?h.id:"")});Fe.attr({rel:S}),p.appendChild(Fe.node)}}},{key:"_getYAxisAnnotationWidth",value:function(h){var p=this.w;return p.globals.gridWidth,(h.width.indexOf("%")>-1?p.globals.gridWidth*parseInt(h.width,10)/100:parseInt(h.width,10))+h.offsetX}},{key:"drawYAxisAnnotations",value:function(){var h=this,p=this.w,S=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return p.config.annotations.yaxis.forEach(function(_,k){_.yAxisIndex=h.axesUtils.translateYAxisIndex(_.yAxisIndex),h.axesUtils.isYAxisHidden(_.yAxisIndex)&&h.axesUtils.yAxisAllSeriesCollapsed(_.yAxisIndex)||h.addYaxisAnnotation(_,S.node,k)}),S}}]),Ee}(),se=function(){function Ee(h){s(this,Ee),this.w=h.w,this.annoCtx=h,this.helpers=new ne(this.annoCtx)}return o(Ee,[{key:"addPointAnnotation",value:function(h,p,S){if(!(this.w.globals.collapsedSeriesIndices.indexOf(h.seriesIndex)>-1)){var _=this.helpers.getX1X2("x1",h),k=_.x,I=_.clipped,B=(_=this.helpers.getY1Y2("y1",h)).yP,G=_.clipped;if(F.isNumber(k)&&!G&&!I){var re={pSize:h.marker.size,pointStrokeWidth:h.marker.strokeWidth,pointFillColor:h.marker.fillColor,pointStrokeColor:h.marker.strokeColor,shape:h.marker.shape,pRadius:h.marker.radius,class:"apexcharts-point-annotation-marker ".concat(h.marker.cssClass," ").concat(h.id?h.id:"")},ce=this.annoCtx.graphics.drawMarker(k+h.marker.offsetX,B+h.marker.offsetY,re);p.appendChild(ce.node);var ue=h.label.text?h.label.text:"",ge=this.annoCtx.graphics.drawText({x:k+h.label.offsetX,y:B+h.label.offsetY-h.marker.size-parseFloat(h.label.style.fontSize)/1.6,text:ue,textAnchor:h.label.textAnchor,fontSize:h.label.style.fontSize,fontFamily:h.label.style.fontFamily,fontWeight:h.label.style.fontWeight,foreColor:h.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(h.label.style.cssClass," ").concat(h.id?h.id:"")});if(ge.attr({rel:S}),p.appendChild(ge.node),h.customSVG.SVG){var Ae=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+h.customSVG.cssClass});Ae.attr({transform:"translate(".concat(k+h.customSVG.offsetX,", ").concat(B+h.customSVG.offsetY,")")}),Ae.node.innerHTML=h.customSVG.SVG,p.appendChild(Ae.node)}if(h.image.path){var ke=h.image.width?h.image.width:20,Me=h.image.height?h.image.height:20;ce=this.annoCtx.addImage({x:k+h.image.offsetX-ke/2,y:B+h.image.offsetY-Me/2,width:ke,height:Me,path:h.image.path,appendTo:".apexcharts-point-annotations"})}h.mouseEnter&&ce.node.addEventListener("mouseenter",h.mouseEnter.bind(this,h)),h.mouseLeave&&ce.node.addEventListener("mouseleave",h.mouseLeave.bind(this,h)),h.click&&ce.node.addEventListener("click",h.click.bind(this,h))}}}},{key:"drawPointAnnotations",value:function(){var h=this,p=this.w,S=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return p.config.annotations.points.map(function(_,k){h.addPointAnnotation(_,S.node,k)}),S}}]),Ee}(),ae={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},W=function(){function Ee(){s(this,Ee),this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,logBase:10,tickAmount:void 0,stepSize:void 0,forceNiceScale:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,showDuplicates:!1,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={id:void 0,x:0,y:null,yAxisIndex:0,seriesIndex:void 0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={id:void 0,y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,width:"100%",yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={id:void 0,x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}return o(Ee,[{key:"init",value:function(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,easing:"easeinout",speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"",locales:[ae],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.35},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{line:{isSlopeChart:!1},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(h){return h}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(h){return h+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(h){return h.globals.seriesTotals.reduce(function(p,S){return p+S},0)/h.globals.series.length+"%"}}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:function(h){return h},onClick:void 0}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,endAngle:360,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:function(h){return h}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(h){return h}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(h){return h.globals.seriesTotals.reduce(function(p,S){return p+S},0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(h){return h!==null?h:""},textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.45}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.45}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},forecastDataPoints:{count:0,fillOpacity:.5,strokeWidth:void 0,dashArray:4},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,customLegendItems:[],labels:{colors:void 0,useSeriesColors:!1},markers:{size:7,fillColors:void 0,strokeWidth:1,shape:void 0,offsetX:0,offsetY:0,customHTML:void 0,onClick:void 0},itemMargin:{horizontal:5,vertical:4},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",offsetX:0,offsetY:0,showNullDataPoints:!0,onClick:void 0,onDblClick:void 0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",verticalAlign:"middle",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{normal:{filter:{type:"none",value:0}},hover:{filter:{type:"lighten",value:.1}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken",value:.5}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0,fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]}}},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,hideEmptySeries:!1,followCursor:!1,intersect:!1,inverseOrder:!1,custom:void 0,fillSeriesColor:!1,theme:"light",cssClass:"",style:{fontSize:"12px",fontFamily:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:function(h){return h?h+": ":""}}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,offsetX:0,offsetY:0,overwriteCategories:void 0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM 'yy",day:"dd MMM",hour:"HH:mm",minute:"HH:mm:ss",second:"HH:mm:ss"}},group:{groups:[],style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},stepSize:void 0,tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,decimalsInFloat:void 0,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.4}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65}}}}}]),Ee}(),V=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.graphics=new z(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new ne(this),this.xAxisAnnotations=new J(this),this.yAxisAnnotations=new q(this),this.pointsAnnotations=new se(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.globals.gridWidth/this.w.globals.dataPoints}return o(Ee,[{key:"drawAxesAnnotations",value:function(){var h=this.w;if(h.globals.axisCharts&&h.globals.dataPoints){for(var p=this.yAxisAnnotations.drawYAxisAnnotations(),S=this.xAxisAnnotations.drawXAxisAnnotations(),_=this.pointsAnnotations.drawPointAnnotations(),k=h.config.chart.animations.enabled,I=[p,S,_],B=[S.node,p.node,_.node],G=0;G<3;G++)h.globals.dom.elGraphical.add(I[G]),!k||h.globals.resized||h.globals.dataChanged||h.config.chart.type!=="scatter"&&h.config.chart.type!=="bubble"&&h.globals.dataPoints>1&&B[G].classList.add("apexcharts-element-hidden"),h.globals.delayedElements.push({el:B[G],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var h=this;this.w.config.annotations.images.map(function(p,S){h.addImage(p,S)})}},{key:"drawTextAnnos",value:function(){var h=this;this.w.config.annotations.texts.map(function(p,S){h.addText(p,S)})}},{key:"addXaxisAnnotation",value:function(h,p,S){this.xAxisAnnotations.addXaxisAnnotation(h,p,S)}},{key:"addYaxisAnnotation",value:function(h,p,S){this.yAxisAnnotations.addYaxisAnnotation(h,p,S)}},{key:"addPointAnnotation",value:function(h,p,S){this.pointsAnnotations.addPointAnnotation(h,p,S)}},{key:"addText",value:function(h,p){var S=h.x,_=h.y,k=h.text,I=h.textAnchor,B=h.foreColor,G=h.fontSize,re=h.fontFamily,ce=h.fontWeight,ue=h.cssClass,ge=h.backgroundColor,Ae=h.borderWidth,ke=h.strokeDashArray,Me=h.borderRadius,qe=h.borderColor,Fe=h.appendTo,at=Fe===void 0?".apexcharts-svg":Fe,ie=h.paddingLeft,Se=ie===void 0?4:ie,$e=h.paddingRight,Ue=$e===void 0?4:$e,_e=h.paddingBottom,st=_e===void 0?2:_e,ut=h.paddingTop,yt=ut===void 0?2:ut,Mt=this.w,Kt=this.graphics.drawText({x:S,y:_,text:k,textAnchor:I||"start",fontSize:G||"12px",fontWeight:ce||"regular",fontFamily:re||Mt.config.chart.fontFamily,foreColor:B||Mt.config.chart.foreColor,cssClass:ue}),un=Mt.globals.dom.baseEl.querySelector(at);un&&un.appendChild(Kt.node);var Xe=Kt.bbox();if(k){var Pt=this.graphics.drawRect(Xe.x-Se,Xe.y-yt,Xe.width+Se+Ue,Xe.height+st+yt,Me,ge||"transparent",1,Ae,qe,ke);un.insertBefore(Pt.node,Kt.node)}}},{key:"addImage",value:function(h,p){var S=this.w,_=h.path,k=h.x,I=k===void 0?0:k,B=h.y,G=B===void 0?0:B,re=h.width,ce=re===void 0?20:re,ue=h.height,ge=ue===void 0?20:ue,Ae=h.appendTo,ke=Ae===void 0?".apexcharts-svg":Ae,Me=S.globals.dom.Paper.image(_);Me.size(ce,ge).move(I,G);var qe=S.globals.dom.baseEl.querySelector(ke);return qe&&qe.appendChild(Me.node),Me}},{key:"addXaxisAnnotationExternal",value:function(h,p,S){return this.addAnnotationExternal({params:h,pushToMemory:p,context:S,type:"xaxis",contextMethod:S.addXaxisAnnotation}),S}},{key:"addYaxisAnnotationExternal",value:function(h,p,S){return this.addAnnotationExternal({params:h,pushToMemory:p,context:S,type:"yaxis",contextMethod:S.addYaxisAnnotation}),S}},{key:"addPointAnnotationExternal",value:function(h,p,S){return this.invertAxis===void 0&&(this.invertAxis=S.w.globals.isBarHorizontal),this.addAnnotationExternal({params:h,pushToMemory:p,context:S,type:"point",contextMethod:S.addPointAnnotation}),S}},{key:"addAnnotationExternal",value:function(h){var p=h.params,S=h.pushToMemory,_=h.context,k=h.type,I=h.contextMethod,B=_,G=B.w,re=G.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations")),ce=re.childNodes.length+1,ue=new W,ge=Object.assign({},k==="xaxis"?ue.xAxisAnnotation:k==="yaxis"?ue.yAxisAnnotation:ue.pointAnnotation),Ae=F.extend(ge,p);switch(k){case"xaxis":this.addXaxisAnnotation(Ae,re,ce);break;case"yaxis":this.addYaxisAnnotation(Ae,re,ce);break;case"point":this.addPointAnnotation(Ae,re,ce)}var ke=G.globals.dom.baseEl.querySelector(".apexcharts-".concat(k,"-annotations .apexcharts-").concat(k,"-annotation-label[rel='").concat(ce,"']")),Me=this.helpers.addBackgroundToAnno(ke,Ae);return Me&&re.insertBefore(Me.node,ke),S&&G.globals.memory.methodsToExec.push({context:B,id:Ae.id?Ae.id:F.randomId(),method:I,label:"addAnnotation",params:p}),_}},{key:"clearAnnotations",value:function(h){for(var p=h.w,S=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations"),_=p.globals.memory.methodsToExec.length-1;_>=0;_--)p.globals.memory.methodsToExec[_].label!=="addText"&&p.globals.memory.methodsToExec[_].label!=="addAnnotation"||p.globals.memory.methodsToExec.splice(_,1);S=F.listToArray(S),Array.prototype.forEach.call(S,function(k){for(;k.firstChild;)k.removeChild(k.firstChild)})}},{key:"removeAnnotation",value:function(h,p){var S=h.w,_=S.globals.dom.baseEl.querySelectorAll(".".concat(p));_&&(S.globals.memory.methodsToExec.map(function(k,I){k.id===p&&S.globals.memory.methodsToExec.splice(I,1)}),Array.prototype.forEach.call(_,function(k){k.parentElement.removeChild(k)}))}}]),Ee}(),ee=function(Ee){var h,p=Ee.isTimeline,S=Ee.ctx,_=Ee.seriesIndex,k=Ee.dataPointIndex,I=Ee.y1,B=Ee.y2,G=Ee.w,re=G.globals.seriesRangeStart[_][k],ce=G.globals.seriesRangeEnd[_][k],ue=G.globals.labels[k],ge=G.config.series[_].name?G.config.series[_].name:"",Ae=G.globals.ttKeyFormatter,ke=G.config.tooltip.y.title.formatter,Me={w:G,seriesIndex:_,dataPointIndex:k,start:re,end:ce};typeof ke=="function"&&(ge=ke(ge,Me)),(h=G.config.series[_].data[k])!==null&&h!==void 0&&h.x&&(ue=G.config.series[_].data[k].x),p||G.config.xaxis.type==="datetime"&&(ue=new te(S).xLabelFormat(G.globals.ttKeyFormatter,ue,ue,{i:void 0,dateFormatter:new K(S).formatDate,w:G})),typeof Ae=="function"&&(ue=Ae(ue,Me)),Number.isFinite(I)&&Number.isFinite(B)&&(re=I,ce=B);var qe="",Fe="",at=G.globals.colors[_];if(G.config.tooltip.x.formatter===void 0)if(G.config.xaxis.type==="datetime"){var ie=new K(S);qe=ie.formatDate(ie.getDate(re),G.config.tooltip.x.format),Fe=ie.formatDate(ie.getDate(ce),G.config.tooltip.x.format)}else qe=re,Fe=ce;else qe=G.config.tooltip.x.formatter(re),Fe=G.config.tooltip.x.formatter(ce);return{start:re,end:ce,startVal:qe,endVal:Fe,ylabel:ue,color:at,seriesName:ge}},oe=function(Ee){var h=Ee.color,p=Ee.seriesName,S=Ee.ylabel,_=Ee.start,k=Ee.end,I=Ee.seriesIndex,B=Ee.dataPointIndex,G=Ee.ctx.tooltip.tooltipLabels.getFormatters(I);_=G.yLbFormatter(_),k=G.yLbFormatter(k);var re=G.yLbFormatter(Ee.w.globals.series[I][B]),ce=`<span class="value start-value">
`.concat(_,`
</span> <span class="separator">-</span> <span class="value end-value">
`).concat(k,`
</span>`);return'<div class="apexcharts-tooltip-rangebar"><div> <span class="series-name" style="color: '+h+'">'+(p||"")+'</span></div><div> <span class="category">'+S+": </span> "+(Ee.w.globals.comboCharts?Ee.w.config.series[I].type==="rangeArea"||Ee.w.config.series[I].type==="rangeBar"?ce:"<span>".concat(re,"</span>"):ce)+" </div></div>"},de=function(){function Ee(h){s(this,Ee),this.opts=h}return o(Ee,[{key:"hideYAxis",value:function(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}},{key:"line",value:function(){return{chart:{animations:{easing:"swing"}},dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(h){return this.hideYAxis(),F.extend(h,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"slope",value:function(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter:function(h,p){var S=p.w.config.series[p.seriesIndex].name;return h!==null?S+": "+h:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}},{key:"bar",value:function(){return{chart:{stacked:!1,animations:{easing:"swing"}},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"round"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"funnel",value:function(){return this.hideYAxis(),y(y({},this.bar()),{},{chart:{animations:{easing:"linear",speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}},{key:"candlestick",value:function(){var h=this;return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(p){var S=p.seriesIndex,_=p.dataPointIndex,k=p.w;return h._getBoxTooltip(k,S,_,["Open","High","","Low","Close"],"candlestick")}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"boxPlot",value:function(){var h=this;return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(p){var S=p.seriesIndex,_=p.dataPointIndex,k=p.w;return h._getBoxTooltip(k,S,_,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")}},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(h,p){p.ctx;var S=p.seriesIndex,_=p.dataPointIndex,k=p.w,I=function(){var B=k.globals.seriesRangeStart[S][_];return k.globals.seriesRangeEnd[S][_]-B};return k.globals.comboCharts?k.config.series[S].type==="rangeBar"||k.config.series[S].type==="rangeArea"?I():h:I()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:function(h){return h.w.config.plotOptions&&h.w.config.plotOptions.bar&&h.w.config.plotOptions.bar.horizontal?function(p){var S=ee(y(y({},p),{},{isTimeline:!0})),_=S.color,k=S.seriesName,I=S.ylabel,B=S.startVal,G=S.endVal;return oe(y(y({},p),{},{color:_,seriesName:k,ylabel:I,start:B,end:G}))}(h):function(p){var S=ee(p),_=S.color,k=S.seriesName,I=S.ylabel,B=S.start,G=S.end;return oe(y(y({},p),{},{color:_,seriesName:k,ylabel:I,start:B,end:G}))}(h)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"dumbbell",value:function(h){var p,S;return(p=h.plotOptions.bar)!==null&&p!==void 0&&p.barHeight||(h.plotOptions.bar.barHeight=2),(S=h.plotOptions.bar)!==null&&S!==void 0&&S.columnWidth||(h.plotOptions.bar.columnWidth=2),h}},{key:"area",value:function(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"rangeArea",value:function(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:function(h){return function(p){var S=ee(p),_=S.color,k=S.seriesName,I=S.ylabel,B=S.start,G=S.end;return oe(y(y({},p),{},{color:_,seriesName:k,ylabel:I,start:B,end:G}))}(h)}}}}},{key:"brush",value:function(h){return F.extend(h,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(h){h.dataLabels=h.dataLabels||{},h.dataLabels.formatter=h.dataLabels.formatter||void 0;var p=h.dataLabels.formatter;return h.yaxis.forEach(function(S,_){h.yaxis[_].min=0,h.yaxis[_].max=100}),h.chart.type==="bar"&&(h.dataLabels.formatter=p||function(S){return typeof S=="number"&&S?S.toFixed(0)+"%":S}),h}},{key:"stackedBars",value:function(){var h=this.bar();return y(y({},h),{},{plotOptions:y(y({},h.plotOptions),{},{bar:y(y({},h.plotOptions.bar),{},{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}},{key:"convertCatToNumeric",value:function(h){return h.xaxis.convertedCatToNumeric=!0,h}},{key:"convertCatToNumericXaxis",value:function(h,p,S){h.xaxis.type="numeric",h.xaxis.labels=h.xaxis.labels||{},h.xaxis.labels.formatter=h.xaxis.labels.formatter||function(I){return F.isNumber(I)?Math.floor(I):I};var _=h.xaxis.labels.formatter,k=h.xaxis.categories&&h.xaxis.categories.length?h.xaxis.categories:h.labels;return S&&S.length&&(k=S.map(function(I){return Array.isArray(I)?I:String(I)})),k&&k.length&&(h.xaxis.labels.formatter=function(I){return F.isNumber(I)?_(k[Math.floor(I)-1]):_(I)}),h.xaxis.categories=[],h.labels=[],h.xaxis.tickAmount=h.xaxis.tickAmount||"dataPoints",h}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}},{key:"treemap",value:function(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(h){return h.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(h){return h.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"polarArea",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(h){return h.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:function(h){return h},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}},{key:"_getBoxTooltip",value:function(h,p,S,_,k){var I=h.globals.seriesCandleO[p][S],B=h.globals.seriesCandleH[p][S],G=h.globals.seriesCandleM[p][S],re=h.globals.seriesCandleL[p][S],ce=h.globals.seriesCandleC[p][S];return h.config.series[p].type&&h.config.series[p].type!==k?`<div class="apexcharts-custom-tooltip">
`.concat(h.config.series[p].name?h.config.series[p].name:"series-"+(p+1),": <strong>").concat(h.globals.series[p][S],`</strong>
</div>`):'<div class="apexcharts-tooltip-box apexcharts-tooltip-'.concat(h.config.chart.type,'">')+"<div>".concat(_[0],': <span class="value">')+I+"</span></div>"+"<div>".concat(_[1],': <span class="value">')+B+"</span></div>"+(G?"<div>".concat(_[2],': <span class="value">')+G+"</span></div>":"")+"<div>".concat(_[3],': <span class="value">')+re+"</span></div>"+"<div>".concat(_[4],': <span class="value">')+ce+"</span></div></div>"}}]),Ee}(),Ce=function(){function Ee(h){s(this,Ee),this.opts=h}return o(Ee,[{key:"init",value:function(h){var p=h.responsiveOverride,S=this.opts,_=new W,k=new de(S);this.chartType=S.chart.type,S=this.extendYAxis(S),S=this.extendAnnotations(S);var I=_.init(),B={};if(S&&T(S)==="object"){var G,re,ce,ue,ge,Ae,ke,Me,qe,Fe,at={};at=["line","area","bar","candlestick","boxPlot","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"].indexOf(S.chart.type)!==-1?k[S.chart.type]():k.line(),(G=S.plotOptions)!==null&&G!==void 0&&(re=G.bar)!==null&&re!==void 0&&re.isFunnel&&(at=k.funnel()),S.chart.stacked&&S.chart.type==="bar"&&(at=k.stackedBars()),(ce=S.chart.brush)!==null&&ce!==void 0&&ce.enabled&&(at=k.brush(at)),(ue=S.plotOptions)!==null&&ue!==void 0&&(ge=ue.line)!==null&&ge!==void 0&&ge.isSlopeChart&&(at=k.slope()),S.chart.stacked&&S.chart.stackType==="100%"&&(S=k.stacked100(S)),(Ae=S.plotOptions)!==null&&Ae!==void 0&&(ke=Ae.bar)!==null&&ke!==void 0&&ke.isDumbbell&&(S=k.dumbbell(S)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(S),S.xaxis=S.xaxis||window.Apex.xaxis||{},p||(S.xaxis.convertedCatToNumeric=!1),((Me=(S=this.checkForCatToNumericXAxis(this.chartType,at,S)).chart.sparkline)!==null&&Me!==void 0&&Me.enabled||(qe=window.Apex.chart)!==null&&qe!==void 0&&(Fe=qe.sparkline)!==null&&Fe!==void 0&&Fe.enabled)&&(at=k.sparkline(at)),B=F.extend(I,at)}var ie=F.extend(B,window.Apex);return I=F.extend(ie,S),I=this.handleUserInputErrors(I)}},{key:"checkForCatToNumericXAxis",value:function(h,p,S){var _,k,I=new de(S),B=(h==="bar"||h==="boxPlot")&&((_=S.plotOptions)===null||_===void 0||(k=_.bar)===null||k===void 0?void 0:k.horizontal),G=h==="pie"||h==="polarArea"||h==="donut"||h==="radar"||h==="radialBar"||h==="heatmap",re=S.xaxis.type!=="datetime"&&S.xaxis.type!=="numeric",ce=S.xaxis.tickPlacement?S.xaxis.tickPlacement:p.xaxis&&p.xaxis.tickPlacement;return B||G||!re||ce==="between"||(S=I.convertCatToNumeric(S)),S}},{key:"extendYAxis",value:function(h,p){var S=new W;(h.yaxis===void 0||!h.yaxis||Array.isArray(h.yaxis)&&h.yaxis.length===0)&&(h.yaxis={}),h.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(h.yaxis=F.extend(h.yaxis,window.Apex.yaxis)),h.yaxis.constructor!==Array?h.yaxis=[F.extend(S.yAxis,h.yaxis)]:h.yaxis=F.extendArray(h.yaxis,S.yAxis);var _=!1;h.yaxis.forEach(function(I){I.logarithmic&&(_=!0)});var k=h.series;return p&&!k&&(k=p.config.series),_&&k.length!==h.yaxis.length&&k.length&&(h.yaxis=k.map(function(I,B){if(I.name||(k[B].name="series-".concat(B+1)),h.yaxis[B])return h.yaxis[B].seriesName=k[B].name,h.yaxis[B];var G=F.extend(S.yAxis,h.yaxis[0]);return G.show=!1,G})),_&&k.length>1&&k.length!==h.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes"),h}},{key:"extendAnnotations",value:function(h){return h.annotations===void 0&&(h.annotations={},h.annotations.yaxis=[],h.annotations.xaxis=[],h.annotations.points=[]),h=this.extendYAxisAnnotations(h),h=this.extendXAxisAnnotations(h),h=this.extendPointAnnotations(h)}},{key:"extendYAxisAnnotations",value:function(h){var p=new W;return h.annotations.yaxis=F.extendArray(h.annotations.yaxis!==void 0?h.annotations.yaxis:[],p.yAxisAnnotation),h}},{key:"extendXAxisAnnotations",value:function(h){var p=new W;return h.annotations.xaxis=F.extendArray(h.annotations.xaxis!==void 0?h.annotations.xaxis:[],p.xAxisAnnotation),h}},{key:"extendPointAnnotations",value:function(h){var p=new W;return h.annotations.points=F.extendArray(h.annotations.points!==void 0?h.annotations.points:[],p.pointAnnotation),h}},{key:"checkForDarkTheme",value:function(h){h.theme&&h.theme.mode==="dark"&&(h.tooltip||(h.tooltip={}),h.tooltip.theme!=="light"&&(h.tooltip.theme="dark"),h.chart.foreColor||(h.chart.foreColor="#f6f7f8"),h.theme.palette||(h.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(h){var p=h;if(p.tooltip.shared&&p.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if(p.chart.type==="bar"&&p.plotOptions.bar.horizontal){if(p.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");p.yaxis[0].reversed&&(p.yaxis[0].opposite=!0),p.xaxis.tooltip.enabled=!1,p.yaxis[0].tooltip.enabled=!1,p.chart.zoom.enabled=!1}return p.chart.type!=="bar"&&p.chart.type!=="rangeBar"||p.tooltip.shared&&p.xaxis.crosshairs.width==="barWidth"&&p.series.length>1&&(p.xaxis.crosshairs.width="tickWidth"),p.chart.type!=="candlestick"&&p.chart.type!=="boxPlot"||p.yaxis[0].reversed&&(console.warn("Reversed y-axis in ".concat(p.chart.type," chart is not supported.")),p.yaxis[0].reversed=!1),p}}]),Ee}(),me=function(){function Ee(){s(this,Ee)}return o(Ee,[{key:"initGlobalVars",value:function(h){h.series=[],h.seriesCandleO=[],h.seriesCandleH=[],h.seriesCandleM=[],h.seriesCandleL=[],h.seriesCandleC=[],h.seriesRangeStart=[],h.seriesRangeEnd=[],h.seriesRange=[],h.seriesPercent=[],h.seriesGoals=[],h.seriesX=[],h.seriesZ=[],h.seriesNames=[],h.seriesTotals=[],h.seriesLog=[],h.seriesColors=[],h.stackedSeriesTotals=[],h.seriesXvalues=[],h.seriesYvalues=[],h.labels=[],h.hasXaxisGroups=!1,h.groups=[],h.barGroups=[],h.lineGroups=[],h.areaGroups=[],h.hasSeriesGroups=!1,h.seriesGroups=[],h.categoryLabels=[],h.timescaleLabels=[],h.noLabelsProvided=!1,h.resizeTimer=null,h.selectionResizeTimer=null,h.lastWheelExecution=0,h.delayedElements=[],h.pointsArray=[],h.dataLabelsRects=[],h.isXNumeric=!1,h.skipLastTimelinelabel=!1,h.skipFirstTimelinelabel=!1,h.isDataXYZ=!1,h.isMultiLineX=!1,h.isMultipleYAxis=!1,h.maxY=-Number.MAX_VALUE,h.minY=Number.MIN_VALUE,h.minYArr=[],h.maxYArr=[],h.maxX=-Number.MAX_VALUE,h.minX=Number.MAX_VALUE,h.initialMaxX=-Number.MAX_VALUE,h.initialMinX=Number.MAX_VALUE,h.maxDate=0,h.minDate=Number.MAX_VALUE,h.minZ=Number.MAX_VALUE,h.maxZ=-Number.MAX_VALUE,h.minXDiff=Number.MAX_VALUE,h.yAxisScale=[],h.xAxisScale=null,h.xAxisTicksPositions=[],h.yLabelsCoords=[],h.yTitleCoords=[],h.barPadForNumericAxis=0,h.padHorizontal=0,h.xRange=0,h.yRange=[],h.zRange=0,h.dataPoints=0,h.xTickAmount=0,h.multiAxisTickAmount=0}},{key:"globalVars",value:function(h){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],clientX:null,clientY:null,fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:h.markers.size,largestSize:0},animationEnded:!1,isTouchDevice:"ontouchstart"in window||navigator.msMaxTouchPoints,isDirty:!1,isExecCalled:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],columnSeries:null,labels:[],timescaleLabels:[],noLabelsProvided:!1,allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],dataFormatXNumeric:!1,capturedSeriesIndex:-1,capturedDataPointIndex:-1,selectedDataPoints:[],invalidLogScale:!1,ignoreYAxisIndexes:[],maxValsInArrayIndex:0,radialSize:0,selection:void 0,zoomEnabled:h.chart.toolbar.autoSelected==="zoom"&&h.chart.toolbar.tools.zoom&&h.chart.zoom.enabled,panEnabled:h.chart.toolbar.autoSelected==="pan"&&h.chart.toolbar.tools.pan,selectionEnabled:h.chart.toolbar.autoSelected==="selection"&&h.chart.toolbar.tools.selection,yaxis:null,mousedown:!1,lastClientPosition:{},visibleXRange:void 0,yValueDecimal:0,total:0,SVGNS:"http://www.w3.org/2000/svg",svgWidth:0,svgHeight:0,noData:!1,locale:{},dom:{},memory:{methodsToExec:[]},shouldAnimate:!0,skipLastTimelinelabel:!1,skipFirstTimelinelabel:!1,delayedElements:[],axisCharts:!0,isDataXYZ:!1,isSlopeChart:h.plotOptions.line.isSlopeChart,resized:!1,resizeTimer:null,comboCharts:!1,dataChanged:!1,previousPaths:[],allSeriesHasEqualX:!0,pointsArray:[],dataLabelsRects:[],lastDrawnDataLabelsIndexes:[],hasNullValues:!1,easing:null,zoomed:!1,gridWidth:0,gridHeight:0,rotateXLabels:!1,defaultLabels:!1,xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,LINE_HEIGHT_RATIO:1.618,xAxisLabelsHeight:0,xAxisGroupLabelsHeight:0,xAxisLabelsWidth:0,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateX:0,translateY:0,translateYAxisX:[],yAxisWidths:[],translateXAxisY:0,translateXAxisX:0,tooltip:null,niceScaleAllowedMagMsd:[[1,1,2,5,5,5,10,10,10,10,10],[1,1,2,5,5,5,10,10,10,10,10]],niceScaleDefaultTicks:[1,2,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,12,12,12,12,24],seriesYAxisMap:[],seriesYAxisReverseMap:[]}}},{key:"init",value:function(h){var p=this.globalVars(h);return this.initGlobalVars(p),p.initialConfig=F.extend({},h),p.initialSeries=F.clone(h.series),p.lastXAxis=F.clone(p.initialConfig.xaxis),p.lastYAxis=F.clone(p.initialConfig.yaxis),p}}]),Ee}(),we=function(){function Ee(h){s(this,Ee),this.opts=h}return o(Ee,[{key:"init",value:function(){var h=new Ce(this.opts).init({responsiveOverride:!1});return{config:h,globals:new me().init(h)}}}]),Ee}(),xe=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}return o(Ee,[{key:"clippedImgArea",value:function(h){var p=this.w,S=p.config,_=parseInt(p.globals.gridWidth,10),k=parseInt(p.globals.gridHeight,10),I=_>k?_:k,B=h.image,G=0,re=0;h.width===void 0&&h.height===void 0?S.fill.image.width!==void 0&&S.fill.image.height!==void 0?(G=S.fill.image.width+1,re=S.fill.image.height):(G=I+1,re=I):(G=h.width,re=h.height);var ce=document.createElementNS(p.globals.SVGNS,"pattern");z.setAttrs(ce,{id:h.patternID,patternUnits:h.patternUnits?h.patternUnits:"userSpaceOnUse",width:G+"px",height:re+"px"});var ue=document.createElementNS(p.globals.SVGNS,"image");ce.appendChild(ue),ue.setAttributeNS(window.SVG.xlink,"href",B),z.setAttrs(ue,{x:0,y:0,preserveAspectRatio:"none",width:G+"px",height:re+"px"}),ue.style.opacity=h.opacity,p.globals.dom.elDefs.node.appendChild(ce)}},{key:"getSeriesIndex",value:function(h){var p=this.w,S=p.config.chart.type;return(S==="bar"||S==="rangeBar")&&p.config.plotOptions.bar.distributed||S==="heatmap"||S==="treemap"?this.seriesIndex=h.seriesNumber:this.seriesIndex=h.seriesNumber%p.globals.series.length,this.seriesIndex}},{key:"fillPath",value:function(h){var p=this.w;this.opts=h;var S,_,k,I=this.w.config;this.seriesIndex=this.getSeriesIndex(h);var B=this.getFillColors()[this.seriesIndex];p.globals.seriesColors[this.seriesIndex]!==void 0&&(B=p.globals.seriesColors[this.seriesIndex]),typeof B=="function"&&(B=B({seriesIndex:this.seriesIndex,dataPointIndex:h.dataPointIndex,value:h.value,w:p}));var G=h.fillType?h.fillType:this.getFillType(this.seriesIndex),re=Array.isArray(I.fill.opacity)?I.fill.opacity[this.seriesIndex]:I.fill.opacity;h.color&&(B=h.color),B||(B="#fff",console.warn("undefined color - ApexCharts"));var ce=B;if(B.indexOf("rgb")===-1?B.length<9&&(ce=F.hexToRgba(B,re)):B.indexOf("rgba")>-1&&(re=F.getOpacityFromRGBA(B)),h.opacity&&(re=h.opacity),G==="pattern"&&(_=this.handlePatternFill({fillConfig:h.fillConfig,patternFill:_,fillColor:B,fillOpacity:re,defaultColor:ce})),G==="gradient"&&(k=this.handleGradientFill({fillConfig:h.fillConfig,fillColor:B,fillOpacity:re,i:this.seriesIndex})),G==="image"){var ue=I.fill.image.src,ge=h.patternID?h.patternID:"",Ae="pattern".concat(p.globals.cuid).concat(h.seriesNumber+1).concat(ge);this.patternIDs.indexOf(Ae)===-1&&(this.clippedImgArea({opacity:re,image:Array.isArray(ue)?h.seriesNumber<ue.length?ue[h.seriesNumber]:ue[0]:ue,width:h.width?h.width:void 0,height:h.height?h.height:void 0,patternUnits:h.patternUnits,patternID:Ae}),this.patternIDs.push(Ae)),S="url(#".concat(Ae,")")}else S=G==="gradient"?k:G==="pattern"?_:ce;return h.solid&&(S=ce),S}},{key:"getFillType",value:function(h){var p=this.w;return Array.isArray(p.config.fill.type)?p.config.fill.type[h]:p.config.fill.type}},{key:"getFillColors",value:function(){var h=this.w,p=h.config,S=this.opts,_=[];return h.globals.comboCharts?h.config.series[this.seriesIndex].type==="line"?Array.isArray(h.globals.stroke.colors)?_=h.globals.stroke.colors:_.push(h.globals.stroke.colors):Array.isArray(h.globals.fill.colors)?_=h.globals.fill.colors:_.push(h.globals.fill.colors):p.chart.type==="line"?Array.isArray(h.globals.stroke.colors)?_=h.globals.stroke.colors:_.push(h.globals.stroke.colors):Array.isArray(h.globals.fill.colors)?_=h.globals.fill.colors:_.push(h.globals.fill.colors),S.fillColors!==void 0&&(_=[],Array.isArray(S.fillColors)?_=S.fillColors.slice():_.push(S.fillColors)),_}},{key:"handlePatternFill",value:function(h){var p=h.fillConfig,S=h.patternFill,_=h.fillColor,k=h.fillOpacity,I=h.defaultColor,B=this.w.config.fill;p&&(B=p);var G=this.opts,re=new z(this.ctx),ce=Array.isArray(B.pattern.strokeWidth)?B.pattern.strokeWidth[this.seriesIndex]:B.pattern.strokeWidth,ue=_;return Array.isArray(B.pattern.style)?S=B.pattern.style[G.seriesNumber]!==void 0?re.drawPattern(B.pattern.style[G.seriesNumber],B.pattern.width,B.pattern.height,ue,ce,k):I:S=re.drawPattern(B.pattern.style,B.pattern.width,B.pattern.height,ue,ce,k),S}},{key:"handleGradientFill",value:function(h){var p=h.fillColor,S=h.fillOpacity,_=h.fillConfig,k=h.i,I=this.w.config.fill;_&&(I=y(y({},I),_));var B,G=this.opts,re=new z(this.ctx),ce=new F,ue=I.gradient.type,ge=p,Ae=I.gradient.opacityFrom===void 0?S:Array.isArray(I.gradient.opacityFrom)?I.gradient.opacityFrom[k]:I.gradient.opacityFrom;ge.indexOf("rgba")>-1&&(Ae=F.getOpacityFromRGBA(ge));var ke=I.gradient.opacityTo===void 0?S:Array.isArray(I.gradient.opacityTo)?I.gradient.opacityTo[k]:I.gradient.opacityTo;if(I.gradient.gradientToColors===void 0||I.gradient.gradientToColors.length===0)B=I.gradient.shade==="dark"?ce.shadeColor(-1*parseFloat(I.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p):ce.shadeColor(parseFloat(I.gradient.shadeIntensity),p.indexOf("rgb")>-1?F.rgb2hex(p):p);else if(I.gradient.gradientToColors[G.seriesNumber]){var Me=I.gradient.gradientToColors[G.seriesNumber];B=Me,Me.indexOf("rgba")>-1&&(ke=F.getOpacityFromRGBA(Me))}else B=p;if(I.gradient.gradientFrom&&(ge=I.gradient.gradientFrom),I.gradient.gradientTo&&(B=I.gradient.gradientTo),I.gradient.inverseColors){var qe=ge;ge=B,B=qe}return ge.indexOf("rgb")>-1&&(ge=F.rgb2hex(ge)),B.indexOf("rgb")>-1&&(B=F.rgb2hex(B)),re.drawGradient(ue,ge,B,Ae,ke,G.size,I.gradient.stops,I.gradient.colorStops,k)}}]),Ee}(),be=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"setGlobalMarkerSize",value:function(){var h=this.w;if(h.globals.markers.size=Array.isArray(h.config.markers.size)?h.config.markers.size:[h.config.markers.size],h.globals.markers.size.length>0){if(h.globals.markers.size.length<h.globals.series.length+1)for(var p=0;p<=h.globals.series.length;p++)h.globals.markers.size[p]===void 0&&h.globals.markers.size.push(h.globals.markers.size[0])}else h.globals.markers.size=h.config.series.map(function(S){return h.config.markers.size})}},{key:"plotChartMarkers",value:function(h,p,S,_){var k,I=arguments.length>4&&arguments[4]!==void 0&&arguments[4],B=this.w,G=p,re=h,ce=null,ue=new z(this.ctx),ge=B.config.markers.discrete&&B.config.markers.discrete.length;if((B.globals.markers.size[p]>0||I||ge)&&(ce=ue.group({class:I||ge?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(B.globals.cuid,")")),Array.isArray(re.x))for(var Ae=0;Ae<re.x.length;Ae++){var ke=S;S===1&&Ae===0&&(ke=0),S===1&&Ae===1&&(ke=1);var Me="apexcharts-marker";if(B.config.chart.type!=="line"&&B.config.chart.type!=="area"||B.globals.comboCharts||B.config.tooltip.intersect||(Me+=" no-pointer-events"),(Array.isArray(B.config.markers.size)?B.globals.markers.size[p]>0:B.config.markers.size>0)||I||ge){F.isNumber(re.y[Ae])?Me+=" w".concat(F.randomId()):Me="apexcharts-nullpoint";var qe=this.getMarkerConfig({cssClass:Me,seriesIndex:p,dataPointIndex:ke});B.config.series[G].data[ke]&&(B.config.series[G].data[ke].fillColor&&(qe.pointFillColor=B.config.series[G].data[ke].fillColor),B.config.series[G].data[ke].strokeColor&&(qe.pointStrokeColor=B.config.series[G].data[ke].strokeColor)),_!==void 0&&(qe.pSize=_),(re.x[Ae]<-B.globals.markers.largestSize||re.x[Ae]>B.globals.gridWidth+B.globals.markers.largestSize||re.y[Ae]<-B.globals.markers.largestSize||re.y[Ae]>B.globals.gridHeight+B.globals.markers.largestSize)&&(qe.pSize=0),(k=ue.drawMarker(re.x[Ae],re.y[Ae],qe)).attr("rel",ke),k.attr("j",ke),k.attr("index",p),k.node.setAttribute("default-marker-size",qe.pSize),new L(this.ctx).setSelectionFilter(k,p,ke),this.addEvents(k),ce&&ce.add(k)}else B.globals.pointsArray[p]===void 0&&(B.globals.pointsArray[p]=[]),B.globals.pointsArray[p].push([re.x[Ae],re.y[Ae]])}return ce}},{key:"getMarkerConfig",value:function(h){var p=h.cssClass,S=h.seriesIndex,_=h.dataPointIndex,k=_===void 0?null:_,I=h.radius,B=I===void 0?null:I,G=h.size,re=G===void 0?null:G,ce=h.strokeWidth,ue=ce===void 0?null:ce,ge=this.w,Ae=this.getMarkerStyle(S),ke=re===null?ge.globals.markers.size[S]:re,Me=ge.config.markers;return k!==null&&Me.discrete.length&&Me.discrete.map(function(qe){qe.seriesIndex===S&&qe.dataPointIndex===k&&(Ae.pointStrokeColor=qe.strokeColor,Ae.pointFillColor=qe.fillColor,ke=qe.size,Ae.pointShape=qe.shape)}),{pSize:B===null?ke:B,pRadius:B!==null?B:Me.radius,pointStrokeWidth:ue!==null?ue:Array.isArray(Me.strokeWidth)?Me.strokeWidth[S]:Me.strokeWidth,pointStrokeColor:Ae.pointStrokeColor,pointFillColor:Ae.pointFillColor,shape:Ae.pointShape||(Array.isArray(Me.shape)?Me.shape[S]:Me.shape),class:p,pointStrokeOpacity:Array.isArray(Me.strokeOpacity)?Me.strokeOpacity[S]:Me.strokeOpacity,pointStrokeDashArray:Array.isArray(Me.strokeDashArray)?Me.strokeDashArray[S]:Me.strokeDashArray,pointFillOpacity:Array.isArray(Me.fillOpacity)?Me.fillOpacity[S]:Me.fillOpacity,seriesIndex:S}}},{key:"addEvents",value:function(h){var p=this.w,S=new z(this.ctx);h.node.addEventListener("mouseenter",S.pathMouseEnter.bind(this.ctx,h)),h.node.addEventListener("mouseleave",S.pathMouseLeave.bind(this.ctx,h)),h.node.addEventListener("mousedown",S.pathMouseDown.bind(this.ctx,h)),h.node.addEventListener("click",p.config.markers.onClick),h.node.addEventListener("dblclick",p.config.markers.onDblClick),h.node.addEventListener("touchstart",S.pathMouseDown.bind(this.ctx,h),{passive:!0})}},{key:"getMarkerStyle",value:function(h){var p=this.w,S=p.globals.markers.colors,_=p.config.markers.strokeColor||p.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(_)?_[h]:_,pointFillColor:Array.isArray(S)?S[h]:S}}}]),Ee}(),je=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.initialAnim=this.w.config.chart.animations.enabled}return o(Ee,[{key:"draw",value:function(h,p,S){var _=this.w,k=new z(this.ctx),I=S.realIndex,B=S.pointsPos,G=S.zRatio,re=S.elParent,ce=k.group({class:"apexcharts-series-markers apexcharts-series-".concat(_.config.chart.type)});if(ce.attr("clip-path","url(#gridRectMarkerMask".concat(_.globals.cuid,")")),Array.isArray(B.x))for(var ue=0;ue<B.x.length;ue++){var ge=p+1,Ae=!0;p===0&&ue===0&&(ge=0),p===0&&ue===1&&(ge=1);var ke=_.globals.markers.size[I];if(G!==1/0){var Me=_.config.plotOptions.bubble;ke=_.globals.seriesZ[I][ge],Me.zScaling&&(ke/=G),Me.minBubbleRadius&&ke<Me.minBubbleRadius&&(ke=Me.minBubbleRadius),Me.maxBubbleRadius&&ke>Me.maxBubbleRadius&&(ke=Me.maxBubbleRadius)}var qe=B.x[ue],Fe=B.y[ue];if(ke=ke||0,Fe!==null&&_.globals.series[I][ge]!==void 0||(Ae=!1),Ae){var at=this.drawPoint(qe,Fe,ke,I,ge,p);ce.add(at)}re.add(ce)}}},{key:"drawPoint",value:function(h,p,S,_,k,I){var B=this.w,G=_,re=new $(this.ctx),ce=new L(this.ctx),ue=new xe(this.ctx),ge=new be(this.ctx),Ae=new z(this.ctx),ke=ge.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:G,dataPointIndex:k,radius:B.config.chart.type==="bubble"||B.globals.comboCharts&&B.config.series[_]&&B.config.series[_].type==="bubble"?S:null}),Me=ue.fillPath({seriesNumber:_,dataPointIndex:k,color:ke.pointFillColor,patternUnits:"objectBoundingBox",value:B.globals.series[_][I]}),qe=Ae.drawMarker(h,p,ke);if(B.config.series[G].data[k]&&B.config.series[G].data[k].fillColor&&(Me=B.config.series[G].data[k].fillColor),qe.attr({fill:Me}),B.config.chart.dropShadow.enabled){var Fe=B.config.chart.dropShadow;ce.dropShadow(qe,Fe,_)}if(!this.initialAnim||B.globals.dataChanged||B.globals.resized)B.globals.animationEnded=!0;else{var at=B.config.chart.animations.speed;re.animateMarker(qe,at,B.globals.easing,function(){window.setTimeout(function(){re.animationCompleted(qe)},100)})}return qe.attr({rel:k,j:k,index:_,"default-marker-size":ke.pSize}),ce.setSelectionFilter(qe,_,k),ge.addEvents(qe),qe.node.classList.add("apexcharts-marker"),qe}},{key:"centerTextInBubble",value:function(h){var p=this.w;return{y:h+=parseInt(p.config.dataLabels.style.fontSize,10)/4}}}]),Ee}(),Ie=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"dataLabelsCorrection",value:function(h,p,S,_,k,I,B){var G=this.w,re=!1,ce=new z(this.ctx).getTextRects(S,B),ue=ce.width,ge=ce.height;p<0&&(p=0),p>G.globals.gridHeight+ge&&(p=G.globals.gridHeight+ge/2),G.globals.dataLabelsRects[_]===void 0&&(G.globals.dataLabelsRects[_]=[]),G.globals.dataLabelsRects[_].push({x:h,y:p,width:ue,height:ge});var Ae=G.globals.dataLabelsRects[_].length-2,ke=G.globals.lastDrawnDataLabelsIndexes[_]!==void 0?G.globals.lastDrawnDataLabelsIndexes[_][G.globals.lastDrawnDataLabelsIndexes[_].length-1]:0;if(G.globals.dataLabelsRects[_][Ae]!==void 0){var Me=G.globals.dataLabelsRects[_][ke];(h>Me.x+Me.width||p>Me.y+Me.height||p+ge<Me.y||h+ue<Me.x)&&(re=!0)}return(k===0||I)&&(re=!0),{x:h,y:p,textRects:ce,drawnextLabel:re}}},{key:"drawDataLabel",value:function(h){var p=this,S=h.type,_=h.pos,k=h.i,I=h.j,B=h.isRangeStart,G=h.strokeWidth,re=G===void 0?2:G,ce=this.w,ue=new z(this.ctx),ge=ce.config.dataLabels,Ae=0,ke=0,Me=I,qe=null;if(ce.globals.collapsedSeriesIndices.indexOf(k)!==-1||!ge.enabled||!Array.isArray(_.x))return qe;qe=ue.group({class:"apexcharts-data-labels"});for(var Fe=0;Fe<_.x.length;Fe++)if(Ae=_.x[Fe]+ge.offsetX,ke=_.y[Fe]+ge.offsetY+re,!isNaN(Ae)){I===1&&Fe===0&&(Me=0),I===1&&Fe===1&&(Me=1);var at=ce.globals.series[k][Me];S==="rangeArea"&&(at=B?ce.globals.seriesRangeStart[k][Me]:ce.globals.seriesRangeEnd[k][Me]);var ie="",Se=function(Ue){return ce.config.dataLabels.formatter(Ue,{ctx:p.ctx,seriesIndex:k,dataPointIndex:Me,w:ce})};ce.config.chart.type==="bubble"?(ie=Se(at=ce.globals.seriesZ[k][Me]),ke=_.y[Fe],ke=new je(this.ctx).centerTextInBubble(ke,k,Me).y):at!==void 0&&(ie=Se(at));var $e=ce.config.dataLabels.textAnchor;ce.globals.isSlopeChart&&($e=Me===0?"end":Me===ce.config.series[k].data.length-1?"start":"middle"),this.plotDataLabelsText({x:Ae,y:ke,text:ie,i:k,j:Me,parent:qe,offsetCorrection:!0,dataLabelsConfig:ce.config.dataLabels,textAnchor:$e})}return qe}},{key:"plotDataLabelsText",value:function(h){var p=this.w,S=new z(this.ctx),_=h.x,k=h.y,I=h.i,B=h.j,G=h.text,re=h.textAnchor,ce=h.fontSize,ue=h.parent,ge=h.dataLabelsConfig,Ae=h.color,ke=h.alwaysDrawDataLabel,Me=h.offsetCorrection,qe=h.className,Fe=null;if(Array.isArray(p.config.dataLabels.enabledOnSeries)&&p.config.dataLabels.enabledOnSeries.indexOf(I)<0)return Fe;var at={x:_,y:k,drawnextLabel:!0,textRects:null};Me&&(at=this.dataLabelsCorrection(_,k,G,I,B,ke,parseInt(ge.style.fontSize,10))),p.globals.zoomed||(_=at.x,k=at.y),at.textRects&&(_<-20-at.textRects.width||_>p.globals.gridWidth+at.textRects.width+30)&&(G="");var ie=p.globals.dataLabels.style.colors[I];((p.config.chart.type==="bar"||p.config.chart.type==="rangeBar")&&p.config.plotOptions.bar.distributed||p.config.dataLabels.distributed)&&(ie=p.globals.dataLabels.style.colors[B]),typeof ie=="function"&&(ie=ie({series:p.globals.series,seriesIndex:I,dataPointIndex:B,w:p})),Ae&&(ie=Ae);var Se=ge.offsetX,$e=ge.offsetY;if(p.config.chart.type!=="bar"&&p.config.chart.type!=="rangeBar"||(Se=0,$e=0),p.globals.isSlopeChart&&(B!==0&&(Se=-2*ge.offsetX+5),B!==0&&B!==p.config.series[I].data.length-1&&(Se=0)),at.drawnextLabel){if((Fe=S.drawText({width:100,height:parseInt(ge.style.fontSize,10),x:_+Se,y:k+$e,foreColor:ie,textAnchor:re||ge.textAnchor,text:G,fontSize:ce||ge.style.fontSize,fontFamily:ge.style.fontFamily,fontWeight:ge.style.fontWeight||"normal"})).attr({class:qe||"apexcharts-datalabel",cx:_,cy:k}),ge.dropShadow.enabled){var Ue=ge.dropShadow;new L(this.ctx).dropShadow(Fe,Ue)}ue.add(Fe),p.globals.lastDrawnDataLabelsIndexes[I]===void 0&&(p.globals.lastDrawnDataLabelsIndexes[I]=[]),p.globals.lastDrawnDataLabelsIndexes[I].push(B)}return Fe}},{key:"addBackgroundToDataLabel",value:function(h,p){var S=this.w,_=S.config.dataLabels.background,k=_.padding,I=_.padding/2,B=p.width,G=p.height,re=new z(this.ctx).drawRect(p.x-k,p.y-I/2,B+2*k,G+I,_.borderRadius,S.config.chart.background!=="transparent"&&S.config.chart.background?S.config.chart.background:"#fff",_.opacity,_.borderWidth,_.borderColor);return _.dropShadow.enabled&&new L(this.ctx).dropShadow(re,_.dropShadow),re}},{key:"dataLabelsBackground",value:function(){var h=this.w;if(h.config.chart.type!=="bubble")for(var p=h.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),S=0;S<p.length;S++){var _=p[S],k=_.getBBox(),I=null;if(k.width&&k.height&&(I=this.addBackgroundToDataLabel(_,k)),I){_.parentNode.insertBefore(I.node,_);var B=_.getAttribute("fill");h.config.chart.animations.enabled&&!h.globals.resized&&!h.globals.dataChanged?I.animate().attr({fill:B}):I.attr({fill:B}),_.setAttribute("fill",h.config.dataLabels.background.foreColor)}}}},{key:"bringForward",value:function(){for(var h=this.w,p=h.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels"),S=h.globals.dom.baseEl.querySelector(".apexcharts-plot-series:last-child"),_=0;_<p.length;_++)S&&S.insertBefore(p[_],S.nextSibling)}}]),Ee}(),Re=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.legendInactiveClass="legend-mouseover-inactive"}return o(Ee,[{key:"getAllSeriesEls",value:function(){return this.w.globals.dom.baseEl.getElementsByClassName("apexcharts-series")}},{key:"getSeriesByName",value:function(h){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner .apexcharts-series[seriesName='".concat(F.escapeString(h),"']"))}},{key:"isSeriesHidden",value:function(h){var p=this.getSeriesByName(h),S=parseInt(p.getAttribute("data:realIndex"),10);return{isHidden:p.classList.contains("apexcharts-series-collapsed"),realIndex:S}}},{key:"addCollapsedClassToSeries",value:function(h,p){var S=this.w;function _(k){for(var I=0;I<k.length;I++)k[I].index===p&&h.node.classList.add("apexcharts-series-collapsed")}_(S.globals.collapsedSeries),_(S.globals.ancillaryCollapsedSeries)}},{key:"toggleSeries",value:function(h){var p=this.isSeriesHidden(h);return this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,p.isHidden),p.isHidden}},{key:"showSeries",value:function(h){var p=this.isSeriesHidden(h);p.isHidden&&this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,!0)}},{key:"hideSeries",value:function(h){var p=this.isSeriesHidden(h);p.isHidden||this.ctx.legend.legendHelpers.toggleDataSeries(p.realIndex,!1)}},{key:"resetSeries",value:function(){var h=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],_=this.w,k=F.clone(_.globals.initialSeries);_.globals.previousPaths=[],S?(_.globals.collapsedSeries=[],_.globals.ancillaryCollapsedSeries=[],_.globals.collapsedSeriesIndices=[],_.globals.ancillaryCollapsedSeriesIndices=[]):k=this.emptyCollapsedSeries(k),_.config.series=k,h&&(p&&(_.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(k,_.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(h){for(var p=this.w,S=0;S<h.length;S++)p.globals.collapsedSeriesIndices.indexOf(S)>-1&&(h[S].data=[]);return h}},{key:"highlightSeries",value:function(h){var p=this.w,S=this.getSeriesByName(h),_=parseInt(S==null?void 0:S.getAttribute("data:realIndex"),10),k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),I=null,B=null,G=null;if(p.globals.axisCharts||p.config.chart.type==="radialBar")if(p.globals.axisCharts){I=p.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(_,"']")),B=p.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(_,"']"));var re=p.globals.seriesYAxisReverseMap[_];G=p.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(re,"']"))}else I=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(_+1,"']"));else I=p.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(_+1,"'] path"));for(var ce=0;ce<k.length;ce++)k[ce].classList.add(this.legendInactiveClass);if(I)p.globals.axisCharts||I.parentNode.classList.remove(this.legendInactiveClass),I.classList.remove(this.legendInactiveClass),B!==null&&B.classList.remove(this.legendInactiveClass),G!==null&&G.classList.remove(this.legendInactiveClass);else for(var ue=0;ue<k.length;ue++)k[ue].classList.remove(this.legendInactiveClass)}},{key:"toggleSeriesOnHover",value:function(h,p){var S=this.w;p||(p=h.target);var _=S.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis");if(h.type==="mousemove"){var k=parseInt(p.getAttribute("rel"),10)-1;this.highlightSeries(S.globals.seriesNames[k])}else if(h.type==="mouseout")for(var I=0;I<_.length;I++)_[I].classList.remove(this.legendInactiveClass)}},{key:"highlightRangeInSeries",value:function(h,p){var S=this,_=this.w,k=_.globals.dom.baseEl.getElementsByClassName("apexcharts-heatmap-rect"),I=function(re){for(var ce=0;ce<k.length;ce++)k[ce].classList[re](S.legendInactiveClass)};if(h.type==="mousemove"){var B=parseInt(p.getAttribute("rel"),10)-1;I("add");var G=_.config.plotOptions.heatmap.colorScale.ranges;(function(re,ce){for(var ue=0;ue<k.length;ue++){var ge=Number(k[ue].getAttribute("val"));ge>=re.from&&(ge<re.to||re.to===ce&&ge===ce)&&k[ue].classList.remove(S.legendInactiveClass)}})(G[B],G.reduce(function(re,ce){return Math.max(re,ce.to)},0))}else h.type==="mouseout"&&I("remove")}},{key:"getActiveConfigSeriesIndex",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"asc",p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],S=this.w,_=0;if(S.config.series.length>1){for(var k=S.config.series.map(function(B,G){return B.data&&B.data.length>0&&S.globals.collapsedSeriesIndices.indexOf(G)===-1&&(!S.globals.comboCharts||p.length===0||p.length&&p.indexOf(S.config.series[G].type)>-1)?G:-1}),I=h==="asc"?0:k.length-1;h==="asc"?I<k.length:I>=0;h==="asc"?I++:I--)if(k[I]!==-1){_=k[I];break}}return _}},{key:"getBarSeriesIndices",value:function(){return this.w.globals.comboCharts?this.w.config.series.map(function(h,p){return h.type==="bar"||h.type==="column"?p:-1}).filter(function(h){return h!==-1}):this.w.config.series.map(function(h,p){return p})}},{key:"getPreviousPaths",value:function(){var h=this.w;function p(I,B,G){for(var re=I[B].childNodes,ce={type:G,paths:[],realIndex:I[B].getAttribute("data:realIndex")},ue=0;ue<re.length;ue++)if(re[ue].hasAttribute("pathTo")){var ge=re[ue].getAttribute("pathTo");ce.paths.push({d:ge})}h.globals.previousPaths.push(ce)}h.globals.previousPaths=[],["line","area","bar","rangebar","rangeArea","candlestick","radar"].forEach(function(I){for(var B,G=(B=I,h.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(B,"-series .apexcharts-series"))),re=0;re<G.length;re++)p(G,re,I)}),this.handlePrevBubbleScatterPaths("bubble"),this.handlePrevBubbleScatterPaths("scatter");var S=h.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(h.config.chart.type," .apexcharts-series"));if(S.length>0)for(var _=function(I){for(var B=h.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(h.config.chart.type," .apexcharts-series[data\\:realIndex='").concat(I,"'] rect")),G=[],re=function(ue){var ge=function(ke){return B[ue].getAttribute(ke)},Ae={x:parseFloat(ge("x")),y:parseFloat(ge("y")),width:parseFloat(ge("width")),height:parseFloat(ge("height"))};G.push({rect:Ae,color:B[ue].getAttribute("color")})},ce=0;ce<B.length;ce++)re(ce);h.globals.previousPaths.push(G)},k=0;k<S.length;k++)_(k);h.globals.axisCharts||(h.globals.previousPaths=h.globals.series)}},{key:"handlePrevBubbleScatterPaths",value:function(h){var p=this.w,S=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(h,"-series .apexcharts-series"));if(S.length>0)for(var _=0;_<S.length;_++){for(var k=p.globals.dom.baseEl.querySelectorAll(".apexcharts-".concat(h,"-series .apexcharts-series[data\\:realIndex='").concat(_,"'] circle")),I=[],B=0;B<k.length;B++)I.push({x:k[B].getAttribute("cx"),y:k[B].getAttribute("cy"),r:k[B].getAttribute("r")});p.globals.previousPaths.push(I)}}},{key:"clearPreviousPaths",value:function(){var h=this.w;h.globals.previousPaths=[],h.globals.allSeriesCollapsed=!1}},{key:"handleNoData",value:function(){var h=this.w,p=h.config.noData,S=new z(this.ctx),_=h.globals.svgWidth/2,k=h.globals.svgHeight/2,I="middle";if(h.globals.noData=!0,h.globals.animationEnded=!0,p.align==="left"?(_=10,I="start"):p.align==="right"&&(_=h.globals.svgWidth-10,I="end"),p.verticalAlign==="top"?k=50:p.verticalAlign==="bottom"&&(k=h.globals.svgHeight-50),_+=p.offsetX,k=k+parseInt(p.style.fontSize,10)+2+p.offsetY,p.text!==void 0&&p.text!==""){var B=S.drawText({x:_,y:k,text:p.text,textAnchor:I,fontSize:p.style.fontSize,fontFamily:p.style.fontFamily,foreColor:p.style.color,opacity:1,class:"apexcharts-text-nodata"});h.globals.dom.Paper.add(B)}}},{key:"setNullSeriesToZeroValues",value:function(h){for(var p=this.w,S=0;S<h.length;S++)if(h[S].length===0)for(var _=0;_<h[p.globals.maxValsInArrayIndex].length;_++)h[S].push(0);return h}},{key:"hasAllSeriesEqualX",value:function(){for(var h=!0,p=this.w,S=this.filteredSeriesX(),_=0;_<S.length-1;_++)if(S[_][0]!==S[_+1][0]){h=!1;break}return p.globals.allSeriesHasEqualX=h,h}},{key:"filteredSeriesX",value:function(){var h=this.w.globals.seriesX.map(function(p){return p.length>0?p:[]});return h}}]),Ee}(),Qe=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new X(this.ctx)}return o(Ee,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var h=this.w.config.series.slice(),p=new Re(this.ctx);if(this.activeSeriesIndex=p.getActiveConfigSeriesIndex(),h[this.activeSeriesIndex].data!==void 0&&h[this.activeSeriesIndex].data.length>0&&h[this.activeSeriesIndex].data[0]!==null&&h[this.activeSeriesIndex].data[0].x!==void 0&&h[this.activeSeriesIndex].data[0]!==null)return!0}},{key:"isFormat2DArray",value:function(){var h=this.w.config.series.slice(),p=new Re(this.ctx);if(this.activeSeriesIndex=p.getActiveConfigSeriesIndex(),h[this.activeSeriesIndex].data!==void 0&&h[this.activeSeriesIndex].data.length>0&&h[this.activeSeriesIndex].data[0]!==void 0&&h[this.activeSeriesIndex].data[0]!==null&&h[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(h,p){for(var S=this.w.config,_=this.w.globals,k=S.chart.type==="boxPlot"||S.series[p].type==="boxPlot",I=0;I<h[p].data.length;I++)if(h[p].data[I][1]!==void 0&&(Array.isArray(h[p].data[I][1])&&h[p].data[I][1].length===4&&!k?this.twoDSeries.push(F.parseNumber(h[p].data[I][1][3])):h[p].data[I].length>=5?this.twoDSeries.push(F.parseNumber(h[p].data[I][4])):this.twoDSeries.push(F.parseNumber(h[p].data[I][1])),_.dataFormatXNumeric=!0),S.xaxis.type==="datetime"){var B=new Date(h[p].data[I][0]);B=new Date(B).getTime(),this.twoDSeriesX.push(B)}else this.twoDSeriesX.push(h[p].data[I][0]);for(var G=0;G<h[p].data.length;G++)h[p].data[G][2]!==void 0&&(this.threeDSeries.push(h[p].data[G][2]),_.isDataXYZ=!0)}},{key:"handleFormatXY",value:function(h,p){var S=this.w.config,_=this.w.globals,k=new K(this.ctx),I=p;_.collapsedSeriesIndices.indexOf(p)>-1&&(I=this.activeSeriesIndex);for(var B=0;B<h[p].data.length;B++)h[p].data[B].y!==void 0&&(Array.isArray(h[p].data[B].y)?this.twoDSeries.push(F.parseNumber(h[p].data[B].y[h[p].data[B].y.length-1])):this.twoDSeries.push(F.parseNumber(h[p].data[B].y))),h[p].data[B].goals!==void 0&&Array.isArray(h[p].data[B].goals)?(this.seriesGoals[p]===void 0&&(this.seriesGoals[p]=[]),this.seriesGoals[p].push(h[p].data[B].goals)):(this.seriesGoals[p]===void 0&&(this.seriesGoals[p]=[]),this.seriesGoals[p].push(null));for(var G=0;G<h[I].data.length;G++){var re=typeof h[I].data[G].x=="string",ce=Array.isArray(h[I].data[G].x),ue=!ce&&!!k.isValidDate(h[I].data[G].x);if(re||ue)if(re||S.xaxis.convertedCatToNumeric){var ge=_.isBarHorizontal&&_.isRangeData;S.xaxis.type!=="datetime"||ge?(this.fallbackToCategory=!0,this.twoDSeriesX.push(h[I].data[G].x),isNaN(h[I].data[G].x)||this.w.config.xaxis.type==="category"||typeof h[I].data[G].x=="string"||(_.isXNumeric=!0)):this.twoDSeriesX.push(k.parseDate(h[I].data[G].x))}else S.xaxis.type==="datetime"?this.twoDSeriesX.push(k.parseDate(h[I].data[G].x.toString())):(_.dataFormatXNumeric=!0,_.isXNumeric=!0,this.twoDSeriesX.push(parseFloat(h[I].data[G].x)));else ce?(this.fallbackToCategory=!0,this.twoDSeriesX.push(h[I].data[G].x)):(_.isXNumeric=!0,_.dataFormatXNumeric=!0,this.twoDSeriesX.push(h[I].data[G].x))}if(h[p].data[0]&&h[p].data[0].z!==void 0){for(var Ae=0;Ae<h[p].data.length;Ae++)this.threeDSeries.push(h[p].data[Ae].z);_.isDataXYZ=!0}}},{key:"handleRangeData",value:function(h,p){var S=this.w.globals,_={};return this.isFormat2DArray()?_=this.handleRangeDataFormat("array",h,p):this.isFormatXY()&&(_=this.handleRangeDataFormat("xy",h,p)),S.seriesRangeStart.push(_.start===void 0?[]:_.start),S.seriesRangeEnd.push(_.end===void 0?[]:_.end),S.seriesRange.push(_.rangeUniques),S.seriesRange.forEach(function(k,I){k&&k.forEach(function(B,G){B.y.forEach(function(re,ce){for(var ue=0;ue<B.y.length;ue++)if(ce!==ue){var ge=re.y1,Ae=re.y2,ke=B.y[ue].y1;ge<=B.y[ue].y2&&ke<=Ae&&(B.overlaps.indexOf(re.rangeName)<0&&B.overlaps.push(re.rangeName),B.overlaps.indexOf(B.y[ue].rangeName)<0&&B.overlaps.push(B.y[ue].rangeName))}})})}),_}},{key:"handleCandleStickBoxData",value:function(h,p){var S=this.w.globals,_={};return this.isFormat2DArray()?_=this.handleCandleStickBoxDataFormat("array",h,p):this.isFormatXY()&&(_=this.handleCandleStickBoxDataFormat("xy",h,p)),S.seriesCandleO[p]=_.o,S.seriesCandleH[p]=_.h,S.seriesCandleM[p]=_.m,S.seriesCandleL[p]=_.l,S.seriesCandleC[p]=_.c,_}},{key:"handleRangeDataFormat",value:function(h,p,S){var _=[],k=[],I=p[S].data.filter(function(ce,ue,ge){return ue===ge.findIndex(function(Ae){return Ae.x===ce.x})}).map(function(ce,ue){return{x:ce.x,overlaps:[],y:[]}});if(h==="array")for(var B=0;B<p[S].data.length;B++)Array.isArray(p[S].data[B])?(_.push(p[S].data[B][1][0]),k.push(p[S].data[B][1][1])):(_.push(p[S].data[B]),k.push(p[S].data[B]));else if(h==="xy")for(var G=function(ce){var ue=Array.isArray(p[S].data[ce].y),ge=F.randomId(),Ae=p[S].data[ce].x,ke={y1:ue?p[S].data[ce].y[0]:p[S].data[ce].y,y2:ue?p[S].data[ce].y[1]:p[S].data[ce].y,rangeName:ge};p[S].data[ce].rangeName=ge;var Me=I.findIndex(function(qe){return qe.x===Ae});I[Me].y.push(ke),_.push(ke.y1),k.push(ke.y2)},re=0;re<p[S].data.length;re++)G(re);return{start:_,end:k,rangeUniques:I}}},{key:"handleCandleStickBoxDataFormat",value:function(h,p,S){var _=this.w,k=_.config.chart.type==="boxPlot"||_.config.series[S].type==="boxPlot",I=[],B=[],G=[],re=[],ce=[];if(h==="array")if(k&&p[S].data[0].length===6||!k&&p[S].data[0].length===5)for(var ue=0;ue<p[S].data.length;ue++)I.push(p[S].data[ue][1]),B.push(p[S].data[ue][2]),k?(G.push(p[S].data[ue][3]),re.push(p[S].data[ue][4]),ce.push(p[S].data[ue][5])):(re.push(p[S].data[ue][3]),ce.push(p[S].data[ue][4]));else for(var ge=0;ge<p[S].data.length;ge++)Array.isArray(p[S].data[ge][1])&&(I.push(p[S].data[ge][1][0]),B.push(p[S].data[ge][1][1]),k?(G.push(p[S].data[ge][1][2]),re.push(p[S].data[ge][1][3]),ce.push(p[S].data[ge][1][4])):(re.push(p[S].data[ge][1][2]),ce.push(p[S].data[ge][1][3])));else if(h==="xy")for(var Ae=0;Ae<p[S].data.length;Ae++)Array.isArray(p[S].data[Ae].y)&&(I.push(p[S].data[Ae].y[0]),B.push(p[S].data[Ae].y[1]),k?(G.push(p[S].data[Ae].y[2]),re.push(p[S].data[Ae].y[3]),ce.push(p[S].data[Ae].y[4])):(re.push(p[S].data[Ae].y[2]),ce.push(p[S].data[Ae].y[3])));return{o:I,h:B,m:G,l:re,c:ce}}},{key:"parseDataAxisCharts",value:function(h){var p=this,S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.ctx,_=this.w.config,k=this.w.globals,I=new K(S),B=_.labels.length>0?_.labels.slice():_.xaxis.categories.slice();k.isRangeBar=_.chart.type==="rangeBar"&&k.isBarHorizontal,k.hasXaxisGroups=_.xaxis.type==="category"&&_.xaxis.group.groups.length>0,k.hasXaxisGroups&&(k.groups=_.xaxis.group.groups),h.forEach(function(Ae,ke){Ae.name!==void 0?k.seriesNames.push(Ae.name):k.seriesNames.push("series-"+parseInt(ke+1,10))}),this.coreUtils.setSeriesYAxisMappings();var G=[],re=N(new Set(_.series.map(function(Ae){return Ae.group})));_.series.forEach(function(Ae,ke){var Me=re.indexOf(Ae.group);G[Me]||(G[Me]=[]),G[Me].push(k.seriesNames[ke])}),k.seriesGroups=G;for(var ce=function(){for(var Ae=0;Ae<B.length;Ae++)if(typeof B[Ae]=="string"){if(!I.isValidDate(B[Ae]))throw new Error("You have provided invalid Date format. Please provide a valid JavaScript Date");p.twoDSeriesX.push(I.parseDate(B[Ae]))}else p.twoDSeriesX.push(B[Ae])},ue=0;ue<h.length;ue++){if(this.twoDSeries=[],this.twoDSeriesX=[],this.threeDSeries=[],h[ue].data===void 0)return void console.error("It is a possibility that you may have not included 'data' property in series.");if(_.chart.type!=="rangeBar"&&_.chart.type!=="rangeArea"&&h[ue].type!=="rangeBar"&&h[ue].type!=="rangeArea"||(k.isRangeData=!0,_.chart.type!=="rangeBar"&&_.chart.type!=="rangeArea"||this.handleRangeData(h,ue)),this.isMultiFormat())this.isFormat2DArray()?this.handleFormat2DArray(h,ue):this.isFormatXY()&&this.handleFormatXY(h,ue),_.chart.type!=="candlestick"&&h[ue].type!=="candlestick"&&_.chart.type!=="boxPlot"&&h[ue].type!=="boxPlot"||this.handleCandleStickBoxData(h,ue),k.series.push(this.twoDSeries),k.labels.push(this.twoDSeriesX),k.seriesX.push(this.twoDSeriesX),k.seriesGoals=this.seriesGoals,ue!==this.activeSeriesIndex||this.fallbackToCategory||(k.isXNumeric=!0);else{_.xaxis.type==="datetime"?(k.isXNumeric=!0,ce(),k.seriesX.push(this.twoDSeriesX)):_.xaxis.type==="numeric"&&(k.isXNumeric=!0,B.length>0&&(this.twoDSeriesX=B,k.seriesX.push(this.twoDSeriesX))),k.labels.push(this.twoDSeriesX);var ge=h[ue].data.map(function(Ae){return F.parseNumber(Ae)});k.series.push(ge)}k.seriesZ.push(this.threeDSeries),h[ue].color!==void 0?k.seriesColors.push(h[ue].color):k.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(h){var p=this.w.globals,S=this.w.config;p.series=h.slice(),p.seriesNames=S.labels.slice();for(var _=0;_<p.series.length;_++)p.seriesNames[_]===void 0&&p.seriesNames.push("series-"+(_+1));return this.w}},{key:"handleExternalLabelsData",value:function(h){var p=this.w.config,S=this.w.globals;p.xaxis.categories.length>0?S.labels=p.xaxis.categories:p.labels.length>0?S.labels=p.labels.slice():this.fallbackToCategory?(S.labels=S.labels[0],S.seriesRange.length&&(S.seriesRange.map(function(_){_.forEach(function(k){S.labels.indexOf(k.x)<0&&k.x&&S.labels.push(k.x)})}),S.labels=Array.from(new Set(S.labels.map(JSON.stringify)),JSON.parse)),p.xaxis.convertedCatToNumeric&&(new de(p).convertCatToNumericXaxis(p,this.ctx,S.seriesX[0]),this._generateExternalLabels(h))):this._generateExternalLabels(h)}},{key:"_generateExternalLabels",value:function(h){var p=this.w.globals,S=this.w.config,_=[];if(p.axisCharts){if(p.series.length>0)if(this.isFormatXY())for(var k=S.series.map(function(ue,ge){return ue.data.filter(function(Ae,ke,Me){return Me.findIndex(function(qe){return qe.x===Ae.x})===ke})}),I=k.reduce(function(ue,ge,Ae,ke){return ke[ue].length>ge.length?ue:Ae},0),B=0;B<k[I].length;B++)_.push(B+1);else for(var G=0;G<p.series[p.maxValsInArrayIndex].length;G++)_.push(G+1);p.seriesX=[];for(var re=0;re<h.length;re++)p.seriesX.push(_);this.w.globals.isBarHorizontal||(p.isXNumeric=!0)}if(_.length===0){_=p.axisCharts?[]:p.series.map(function(ue,ge){return ge+1});for(var ce=0;ce<h.length;ce++)p.seriesX.push(_)}p.labels=_,S.xaxis.convertedCatToNumeric&&(p.categoryLabels=_.map(function(ue){return S.xaxis.labels.formatter(ue)})),p.noLabelsProvided=!0}},{key:"parseData",value:function(h){var p=this.w,S=p.config,_=p.globals;if(this.excludeCollapsedSeriesInYAxis(),this.fallbackToCategory=!1,this.ctx.core.resetGlobals(),this.ctx.core.isMultipleY(),_.axisCharts?(this.parseDataAxisCharts(h),this.coreUtils.getLargestSeries()):this.parseDataNonAxisCharts(h),S.chart.stacked){var k=new Re(this.ctx);_.series=k.setNullSeriesToZeroValues(_.series)}this.coreUtils.getSeriesTotals(),_.axisCharts&&(_.stackedSeriesTotals=this.coreUtils.getStackedSeriesTotals(),_.stackedSeriesTotalsByGroups=this.coreUtils.getStackedSeriesTotalsByGroups()),this.coreUtils.getPercentSeries(),_.dataFormatXNumeric||_.isXNumeric&&(S.xaxis.type!=="numeric"||S.labels.length!==0||S.xaxis.categories.length!==0)||this.handleExternalLabelsData(h);for(var I=this.coreUtils.getCategoryLabels(_.labels),B=0;B<I.length;B++)if(Array.isArray(I[B])){_.isMultiLineX=!0;break}}},{key:"excludeCollapsedSeriesInYAxis",value:function(){var h=this.w,p=[];h.globals.seriesYAxisMap.forEach(function(S,_){var k=0;S.forEach(function(I){h.globals.collapsedSeriesIndices.indexOf(I)!==-1&&k++}),k>0&&k==S.length&&p.push(_)}),h.globals.ignoreYAxisIndexes=p.map(function(S){return S})}}]),Ee}(),Ke=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"scaleSvgNode",value:function(h,p){var S=parseFloat(h.getAttributeNS(null,"width")),_=parseFloat(h.getAttributeNS(null,"height"));h.setAttributeNS(null,"width",S*p),h.setAttributeNS(null,"height",_*p),h.setAttributeNS(null,"viewBox","0 0 "+S+" "+_)}},{key:"getSvgString",value:function(){var h=this;return new Promise(function(p){var S=h.w,_=S.config.chart.toolbar.export.width,k=S.config.chart.toolbar.export.scale||_/S.globals.svgWidth;k||(k=1);var I=h.w.globals.dom.Paper.svg(),B=h.w.globals.dom.Paper.node.cloneNode(!0);k!==1&&h.scaleSvgNode(B,k),h.convertImagesToBase64(B).then(function(){I=new XMLSerializer().serializeToString(B),p(I.replace(/ /g," "))})})}},{key:"convertImagesToBase64",value:function(h){var p=this,S=h.getElementsByTagName("image"),_=Array.from(S).map(function(k){var I=k.getAttributeNS("http://www.w3.org/1999/xlink","href");return I&&!I.startsWith("data:")?p.getBase64FromUrl(I).then(function(B){k.setAttributeNS("http://www.w3.org/1999/xlink","href",B)}).catch(function(B){console.error("Error converting image to base64:",B)}):Promise.resolve()});return Promise.all(_)}},{key:"getBase64FromUrl",value:function(h){return new Promise(function(p,S){var _=new Image;_.crossOrigin="Anonymous",_.onload=function(){var k=document.createElement("canvas");k.width=_.width,k.height=_.height,k.getContext("2d").drawImage(_,0,0),p(k.toDataURL())},_.onerror=S,_.src=h})}},{key:"cleanup",value:function(){var h=this.w,p=h.globals.dom.baseEl.getElementsByClassName("apexcharts-xcrosshairs"),S=h.globals.dom.baseEl.getElementsByClassName("apexcharts-ycrosshairs"),_=h.globals.dom.baseEl.querySelectorAll(".apexcharts-zoom-rect, .apexcharts-selection-rect");Array.prototype.forEach.call(_,function(k){k.setAttribute("width",0)}),p&&p[0]&&(p[0].setAttribute("x",-500),p[0].setAttribute("x1",-500),p[0].setAttribute("x2",-500)),S&&S[0]&&(S[0].setAttribute("y",-100),S[0].setAttribute("y1",-100),S[0].setAttribute("y2",-100))}},{key:"svgUrl",value:function(){var h=this;return new Promise(function(p){h.cleanup(),h.getSvgString().then(function(S){var _=new Blob([S],{type:"image/svg+xml;charset=utf-8"});p(URL.createObjectURL(_))})})}},{key:"dataURI",value:function(h){var p=this;return new Promise(function(S){var _=p.w,k=h?h.scale||h.width/_.globals.svgWidth:1;p.cleanup();var I=document.createElement("canvas");I.width=_.globals.svgWidth*k,I.height=parseInt(_.globals.dom.elWrap.style.height,10)*k;var B=_.config.chart.background!=="transparent"&&_.config.chart.background?_.config.chart.background:"#fff",G=I.getContext("2d");G.fillStyle=B,G.fillRect(0,0,I.width*k,I.height*k),p.getSvgString().then(function(re){var ce="data:image/svg+xml,"+encodeURIComponent(re),ue=new Image;ue.crossOrigin="anonymous",ue.onload=function(){if(G.drawImage(ue,0,0),I.msToBlob){var ge=I.msToBlob();S({blob:ge})}else{var Ae=I.toDataURL("image/png");S({imgURI:Ae})}},ue.src=ce})})}},{key:"exportToSVG",value:function(){var h=this;this.svgUrl().then(function(p){h.triggerDownload(p,h.w.config.chart.toolbar.export.svg.filename,".svg")})}},{key:"exportToPng",value:function(){var h=this,p=this.w.config.chart.toolbar.export.scale,S=this.w.config.chart.toolbar.export.width,_=p?{scale:p}:S?{width:S}:void 0;this.dataURI(_).then(function(k){var I=k.imgURI,B=k.blob;B?navigator.msSaveOrOpenBlob(B,h.w.globals.chartID+".png"):h.triggerDownload(I,h.w.config.chart.toolbar.export.png.filename,".png")})}},{key:"exportToCSV",value:function(h){var p=this,S=h.series,_=h.fileName,k=h.columnDelimiter,I=k===void 0?",":k,B=h.lineDelimiter,G=B===void 0?`
`:B,re=this.w;S||(S=re.config.series);var ce,ue,ge=[],Ae=[],ke="",Me=re.globals.series.map(function(_e,st){return re.globals.collapsedSeriesIndices.indexOf(st)===-1?_e:[]}),qe=function(_e){return typeof re.config.chart.toolbar.export.csv.categoryFormatter=="function"?re.config.chart.toolbar.export.csv.categoryFormatter(_e):re.config.xaxis.type==="datetime"&&String(_e).length>=10?new Date(_e).toDateString():F.isNumber(_e)?_e:_e.split(I).join("")},Fe=function(_e){return typeof re.config.chart.toolbar.export.csv.valueFormatter=="function"?re.config.chart.toolbar.export.csv.valueFormatter(_e):_e},at=Math.max.apply(Math,N(S.map(function(_e){return _e.data?_e.data.length:0}))),ie=new Qe(this.ctx),Se=new fe(this.ctx),$e=function(_e){var st="";if(re.globals.axisCharts){if(re.config.xaxis.type==="category"||re.config.xaxis.convertedCatToNumeric)if(re.globals.isBarHorizontal){var ut=re.globals.yLabelFormatters[0],yt=new Re(p.ctx).getActiveConfigSeriesIndex();st=ut(re.globals.labels[_e],{seriesIndex:yt,dataPointIndex:_e,w:re})}else st=Se.getLabel(re.globals.labels,re.globals.timescaleLabels,0,_e).text;re.config.xaxis.type==="datetime"&&(re.config.xaxis.categories.length?st=re.config.xaxis.categories[_e]:re.config.labels.length&&(st=re.config.labels[_e]))}else st=re.config.labels[_e];return st===null?"nullvalue":(Array.isArray(st)&&(st=st.join(" ")),F.isNumber(st)?st:st.split(I).join(""))},Ue=function(_e,st){if(ge.length&&st===0&&Ae.push(ge.join(I)),_e.data){_e.data=_e.data.length&&_e.data||N(Array(at)).map(function(){return""});for(var ut=0;ut<_e.data.length;ut++){ge=[];var yt=$e(ut);if(yt!=="nullvalue"){if(yt||(ie.isFormatXY()?yt=S[st].data[ut].x:ie.isFormat2DArray()&&(yt=S[st].data[ut]?S[st].data[ut][0]:"")),st===0){ge.push(qe(yt));for(var Mt=0;Mt<re.globals.series.length;Mt++){var Kt,un=ie.isFormatXY()?(Kt=S[Mt].data[ut])===null||Kt===void 0?void 0:Kt.y:Me[Mt][ut];ge.push(Fe(un))}}(re.config.chart.type==="candlestick"||_e.type&&_e.type==="candlestick")&&(ge.pop(),ge.push(re.globals.seriesCandleO[st][ut]),ge.push(re.globals.seriesCandleH[st][ut]),ge.push(re.globals.seriesCandleL[st][ut]),ge.push(re.globals.seriesCandleC[st][ut])),(re.config.chart.type==="boxPlot"||_e.type&&_e.type==="boxPlot")&&(ge.pop(),ge.push(re.globals.seriesCandleO[st][ut]),ge.push(re.globals.seriesCandleH[st][ut]),ge.push(re.globals.seriesCandleM[st][ut]),ge.push(re.globals.seriesCandleL[st][ut]),ge.push(re.globals.seriesCandleC[st][ut])),re.config.chart.type==="rangeBar"&&(ge.pop(),ge.push(re.globals.seriesRangeStart[st][ut]),ge.push(re.globals.seriesRangeEnd[st][ut])),ge.length&&Ae.push(ge.join(I))}}}};ge.push(re.config.chart.toolbar.export.csv.headerCategory),re.config.chart.type==="boxPlot"?(ge.push("minimum"),ge.push("q1"),ge.push("median"),ge.push("q3"),ge.push("maximum")):re.config.chart.type==="candlestick"?(ge.push("open"),ge.push("high"),ge.push("low"),ge.push("close")):re.config.chart.type==="rangeBar"?(ge.push("minimum"),ge.push("maximum")):S.map(function(_e,st){var ut=(_e.name?_e.name:"series-".concat(st))+"";re.globals.axisCharts&&ge.push(ut.split(I).join("")?ut.split(I).join(""):"series-".concat(st))}),re.globals.axisCharts||(ge.push(re.config.chart.toolbar.export.csv.headerValue),Ae.push(ge.join(I))),re.globals.allSeriesHasEqualX||!re.globals.axisCharts||re.config.xaxis.categories.length||re.config.labels.length?S.map(function(_e,st){re.globals.axisCharts?Ue(_e,st):((ge=[]).push(qe(re.globals.labels[st])),ge.push(Fe(Me[st])),Ae.push(ge.join(I)))}):(ce=new Set,ue={},S.forEach(function(_e,st){_e==null||_e.data.forEach(function(ut){var yt,Mt;if(ie.isFormatXY())yt=ut.x,Mt=ut.y;else{if(!ie.isFormat2DArray())return;yt=ut[0],Mt=ut[1]}ue[yt]||(ue[yt]=Array(S.length).fill("")),ue[yt][st]=Fe(Mt),ce.add(yt)})}),ge.length&&Ae.push(ge.join(I)),Array.from(ce).sort().forEach(function(_e){Ae.push([qe(_e),ue[_e].join(I)])})),ke+=Ae.join(G),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\uFEFF"+ke),_||re.config.chart.toolbar.export.csv.filename,".csv")}},{key:"triggerDownload",value:function(h,p,S){var _=document.createElement("a");_.href=h,_.download=(p||this.w.globals.chartID)+S,document.body.appendChild(_),_.click(),document.body.removeChild(_)}}]),Ee}(),dt=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.elgrid=p,this.w=h.w;var S=this.w;this.axesUtils=new fe(h),this.xaxisLabels=S.globals.labels.slice(),S.globals.timescaleLabels.length>0&&!S.globals.isBarHorizontal&&(this.xaxisLabels=S.globals.timescaleLabels.slice()),S.config.xaxis.overwriteCategories&&(this.xaxisLabels=S.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],S.config.xaxis.position==="top"?this.offY=0:this.offY=S.globals.gridHeight,this.offY=this.offY+S.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal=S.config.chart.type==="bar"&&S.config.plotOptions.bar.horizontal,this.xaxisFontSize=S.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=S.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=S.config.xaxis.labels.style.colors,this.xaxisBorderWidth=S.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=S.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=S.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=S.config.xaxis.axisBorder.height,this.yaxis=S.config.yaxis[0]}return o(Ee,[{key:"drawXaxis",value:function(){var h=this.w,p=new z(this.ctx),S=p.group({class:"apexcharts-xaxis",transform:"translate(".concat(h.config.xaxis.offsetX,", ").concat(h.config.xaxis.offsetY,")")}),_=p.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(h.globals.translateXAxisX,", ").concat(h.globals.translateXAxisY,")")});S.add(_);for(var k=[],I=0;I<this.xaxisLabels.length;I++)k.push(this.xaxisLabels[I]);if(this.drawXAxisLabelAndGroup(!0,p,_,k,h.globals.isXNumeric,function(ke,Me){return Me}),h.globals.hasXaxisGroups){var B=h.globals.groups;k=[];for(var G=0;G<B.length;G++)k.push(B[G].title);var re={};h.config.xaxis.group.style&&(re.xaxisFontSize=h.config.xaxis.group.style.fontSize,re.xaxisFontFamily=h.config.xaxis.group.style.fontFamily,re.xaxisForeColors=h.config.xaxis.group.style.colors,re.fontWeight=h.config.xaxis.group.style.fontWeight,re.cssClass=h.config.xaxis.group.style.cssClass),this.drawXAxisLabelAndGroup(!1,p,_,k,!1,function(ke,Me){return B[ke].cols*Me},re)}if(h.config.xaxis.title.text!==void 0){var ce=p.group({class:"apexcharts-xaxis-title"}),ue=p.drawText({x:h.globals.gridWidth/2+h.config.xaxis.title.offsetX,y:this.offY+parseFloat(this.xaxisFontSize)+(h.config.xaxis.position==="bottom"?h.globals.xAxisLabelsHeight:-h.globals.xAxisLabelsHeight-10)+h.config.xaxis.title.offsetY,text:h.config.xaxis.title.text,textAnchor:"middle",fontSize:h.config.xaxis.title.style.fontSize,fontFamily:h.config.xaxis.title.style.fontFamily,fontWeight:h.config.xaxis.title.style.fontWeight,foreColor:h.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text "+h.config.xaxis.title.style.cssClass});ce.add(ue),S.add(ce)}if(h.config.xaxis.axisBorder.show){var ge=h.globals.barPadForNumericAxis,Ae=p.drawLine(h.globals.padHorizontal+h.config.xaxis.axisBorder.offsetX-ge,this.offY,this.xaxisBorderWidth+ge,this.offY,h.config.xaxis.axisBorder.color,0,this.xaxisBorderHeight);this.elgrid&&this.elgrid.elGridBorders&&h.config.grid.show?this.elgrid.elGridBorders.add(Ae):S.add(Ae)}return S}},{key:"drawXAxisLabelAndGroup",value:function(h,p,S,_,k,I){var B,G=this,re=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{},ce=[],ue=[],ge=this.w,Ae=re.xaxisFontSize||this.xaxisFontSize,ke=re.xaxisFontFamily||this.xaxisFontFamily,Me=re.xaxisForeColors||this.xaxisForeColors,qe=re.fontWeight||ge.config.xaxis.labels.style.fontWeight,Fe=re.cssClass||ge.config.xaxis.labels.style.cssClass,at=ge.globals.padHorizontal,ie=_.length,Se=ge.config.xaxis.type==="category"?ge.globals.dataPoints:ie;if(Se===0&&ie>Se&&(Se=ie),k){var $e=Se>1?Se-1:Se;B=ge.globals.gridWidth/Math.min($e,ie-1),at=at+I(0,B)/2+ge.config.xaxis.labels.offsetX}else B=ge.globals.gridWidth/Se,at=at+I(0,B)+ge.config.xaxis.labels.offsetX;for(var Ue=function(st){var ut=at-I(st,B)/2+ge.config.xaxis.labels.offsetX;st===0&&ie===1&&B/2===at&&Se===1&&(ut=ge.globals.gridWidth/2);var yt=G.axesUtils.getLabel(_,ge.globals.timescaleLabels,ut,st,ce,Ae,h),Mt=28;if(ge.globals.rotateXLabels&&h&&(Mt=22),ge.config.xaxis.title.text&&ge.config.xaxis.position==="top"&&(Mt+=parseFloat(ge.config.xaxis.title.style.fontSize)+2),h||(Mt=Mt+parseFloat(Ae)+(ge.globals.xAxisLabelsHeight-ge.globals.xAxisGroupLabelsHeight)+(ge.globals.rotateXLabels?10:0)),yt=ge.config.xaxis.tickAmount!==void 0&&ge.config.xaxis.tickAmount!=="dataPoints"&&ge.config.xaxis.type!=="datetime"?G.axesUtils.checkLabelBasedOnTickamount(st,yt,ie):G.axesUtils.checkForOverflowingLabels(st,yt,ie,ce,ue),ge.config.xaxis.labels.show){var Kt=p.drawText({x:yt.x,y:G.offY+ge.config.xaxis.labels.offsetY+Mt-(ge.config.xaxis.position==="top"?ge.globals.xAxisHeight+ge.config.xaxis.axisTicks.height-2:0),text:yt.text,textAnchor:"middle",fontWeight:yt.isBold?600:qe,fontSize:Ae,fontFamily:ke,foreColor:Array.isArray(Me)?h&&ge.config.xaxis.convertedCatToNumeric?Me[ge.globals.minX+st-1]:Me[st]:Me,isPlainText:!1,cssClass:(h?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+Fe});if(S.add(Kt),Kt.on("click",function(Xe){if(typeof ge.config.chart.events.xAxisLabelClick=="function"){var Pt=Object.assign({},ge,{labelIndex:st});ge.config.chart.events.xAxisLabelClick(Xe,G.ctx,Pt)}}),h){var un=document.createElementNS(ge.globals.SVGNS,"title");un.textContent=Array.isArray(yt.text)?yt.text.join(" "):yt.text,Kt.node.appendChild(un),yt.text!==""&&(ce.push(yt.text),ue.push(yt))}}st<ie-1&&(at+=I(st+1,B))},_e=0;_e<=ie-1;_e++)Ue(_e)}},{key:"drawXaxisInversed",value:function(h){var p,S,_=this,k=this.w,I=new z(this.ctx),B=k.config.yaxis[0].opposite?k.globals.translateYAxisX[h]:0,G=I.group({class:"apexcharts-yaxis apexcharts-xaxis-inversed",rel:h}),re=I.group({class:"apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g",transform:"translate("+B+", 0)"});G.add(re);var ce=[];if(k.config.yaxis[h].show)for(var ue=0;ue<this.xaxisLabels.length;ue++)ce.push(this.xaxisLabels[ue]);p=k.globals.gridHeight/ce.length,S=-p/2.2;var ge=k.globals.yLabelFormatters[0],Ae=k.config.yaxis[0].labels;if(Ae.show)for(var ke=function($e){var Ue=ce[$e]===void 0?"":ce[$e];Ue=ge(Ue,{seriesIndex:h,dataPointIndex:$e,w:k});var _e=_.axesUtils.getYAxisForeColor(Ae.style.colors,h),st=0;Array.isArray(Ue)&&(st=Ue.length/2*parseInt(Ae.style.fontSize,10));var ut=Ae.offsetX-15,yt="end";_.yaxis.opposite&&(yt="start"),k.config.yaxis[0].labels.align==="left"?(ut=Ae.offsetX,yt="start"):k.config.yaxis[0].labels.align==="center"?(ut=Ae.offsetX,yt="middle"):k.config.yaxis[0].labels.align==="right"&&(yt="end");var Mt=I.drawText({x:ut,y:S+p+Ae.offsetY-st,text:Ue,textAnchor:yt,foreColor:Array.isArray(_e)?_e[$e]:_e,fontSize:Ae.style.fontSize,fontFamily:Ae.style.fontFamily,fontWeight:Ae.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-yaxis-label "+Ae.style.cssClass,maxWidth:Ae.maxWidth});re.add(Mt),Mt.on("click",function(Xe){if(typeof k.config.chart.events.xAxisLabelClick=="function"){var Pt=Object.assign({},k,{labelIndex:$e});k.config.chart.events.xAxisLabelClick(Xe,_.ctx,Pt)}});var Kt=document.createElementNS(k.globals.SVGNS,"title");if(Kt.textContent=Array.isArray(Ue)?Ue.join(" "):Ue,Mt.node.appendChild(Kt),k.config.yaxis[h].labels.rotate!==0){var un=I.rotateAroundCenter(Mt.node);Mt.node.setAttribute("transform","rotate(".concat(k.config.yaxis[h].labels.rotate," 0 ").concat(un.y,")"))}S+=p},Me=0;Me<=ce.length-1;Me++)ke(Me);if(k.config.yaxis[0].title.text!==void 0){var qe=I.group({class:"apexcharts-yaxis-title apexcharts-xaxis-title-inversed",transform:"translate("+B+", 0)"}),Fe=I.drawText({x:k.config.yaxis[0].title.offsetX,y:k.globals.gridHeight/2+k.config.yaxis[0].title.offsetY,text:k.config.yaxis[0].title.text,textAnchor:"middle",foreColor:k.config.yaxis[0].title.style.color,fontSize:k.config.yaxis[0].title.style.fontSize,fontWeight:k.config.yaxis[0].title.style.fontWeight,fontFamily:k.config.yaxis[0].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text "+k.config.yaxis[0].title.style.cssClass});qe.add(Fe),G.add(qe)}var at=0;this.isCategoryBarHorizontal&&k.config.yaxis[0].opposite&&(at=k.globals.gridWidth);var ie=k.config.xaxis.axisBorder;if(ie.show){var Se=I.drawLine(k.globals.padHorizontal+ie.offsetX+at,1+ie.offsetY,k.globals.padHorizontal+ie.offsetX+at,k.globals.gridHeight+ie.offsetY,ie.color,0);this.elgrid&&this.elgrid.elGridBorders&&k.config.grid.show?this.elgrid.elGridBorders.add(Se):G.add(Se)}return k.config.yaxis[0].axisTicks.show&&this.axesUtils.drawYAxisTicks(at,ce.length,k.config.yaxis[0].axisBorder,k.config.yaxis[0].axisTicks,0,p,G),G}},{key:"drawXaxisTicks",value:function(h,p,S){var _=this.w,k=h;if(!(h<0||h-2>_.globals.gridWidth)){var I=this.offY+_.config.xaxis.axisTicks.offsetY;if(p=p+I+_.config.xaxis.axisTicks.height,_.config.xaxis.position==="top"&&(p=I-_.config.xaxis.axisTicks.height),_.config.xaxis.axisTicks.show){var B=new z(this.ctx).drawLine(h+_.config.xaxis.axisTicks.offsetX,I+_.config.xaxis.offsetY,k+_.config.xaxis.axisTicks.offsetX,p+_.config.xaxis.offsetY,_.config.xaxis.axisTicks.color);S.add(B),B.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var h=this.w,p=[],S=this.xaxisLabels.length,_=h.globals.padHorizontal;if(h.globals.timescaleLabels.length>0)for(var k=0;k<S;k++)_=this.xaxisLabels[k].position,p.push(_);else for(var I=S,B=0;B<I;B++){var G=I;h.globals.isXNumeric&&h.config.chart.type!=="bar"&&(G-=1),_+=h.globals.gridWidth/G,p.push(_)}return p}},{key:"xAxisLabelCorrections",value:function(){var h=this.w,p=new z(this.ctx),S=h.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g"),_=h.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)"),k=h.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-inversed text"),I=h.globals.dom.baseEl.querySelectorAll(".apexcharts-xaxis-inversed-texts-g text tspan");if(h.globals.rotateXLabels||h.config.xaxis.labels.rotateAlways)for(var B=0;B<_.length;B++){var G=p.rotateAroundCenter(_[B]);G.y=G.y-1,G.x=G.x+1,_[B].setAttribute("transform","rotate(".concat(h.config.xaxis.labels.rotate," ").concat(G.x," ").concat(G.y,")")),_[B].setAttribute("text-anchor","end"),S.setAttribute("transform","translate(0, ".concat(-10,")"));var re=_[B].childNodes;h.config.xaxis.labels.trim&&Array.prototype.forEach.call(re,function(Ae){p.placeTextWithEllipsis(Ae,Ae.textContent,h.globals.xAxisLabelsHeight-(h.config.legend.position==="bottom"?20:10))})}else(function(){for(var Ae=h.globals.gridWidth/(h.globals.labels.length+1),ke=0;ke<_.length;ke++){var Me=_[ke].childNodes;h.config.xaxis.labels.trim&&h.config.xaxis.type!=="datetime"&&Array.prototype.forEach.call(Me,function(qe){p.placeTextWithEllipsis(qe,qe.textContent,Ae)})}})();if(k.length>0){var ce=k[k.length-1].getBBox(),ue=k[0].getBBox();ce.x<-20&&k[k.length-1].parentNode.removeChild(k[k.length-1]),ue.x+ue.width>h.globals.gridWidth&&!h.globals.isBarHorizontal&&k[0].parentNode.removeChild(k[0]);for(var ge=0;ge<I.length;ge++)p.placeTextWithEllipsis(I[ge],I[ge].textContent,h.config.yaxis[0].labels.maxWidth-(h.config.yaxis[0].title.text?2*parseFloat(h.config.yaxis[0].title.style.fontSize):0)-15)}}}]),Ee}(),tt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w;var p=this.w;this.xaxisLabels=p.globals.labels.slice(),this.axesUtils=new fe(h),this.isRangeBar=p.globals.seriesRange.length&&p.globals.isBarHorizontal,p.globals.timescaleLabels.length>0&&(this.xaxisLabels=p.globals.timescaleLabels.slice())}return o(Ee,[{key:"drawGridArea",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,p=this.w,S=new z(this.ctx);h||(h=S.group({class:"apexcharts-grid"}));var _=S.drawLine(p.globals.padHorizontal,1,p.globals.padHorizontal,p.globals.gridHeight,"transparent"),k=S.drawLine(p.globals.padHorizontal,p.globals.gridHeight,p.globals.gridWidth,p.globals.gridHeight,"transparent");return h.add(k),h.add(_),h}},{key:"drawGrid",value:function(){if(this.w.globals.axisCharts){var h=this.renderGrid();return this.drawGridArea(h.el),h}return null}},{key:"createGridMask",value:function(){var h=this.w,p=h.globals,S=new z(this.ctx),_=Array.isArray(h.config.stroke.width)?Math.max.apply(Math,N(h.config.stroke.width)):h.config.stroke.width,k=function(ce){var ue=document.createElementNS(p.SVGNS,"clipPath");return ue.setAttribute("id",ce),ue};p.dom.elGridRectMask=k("gridRectMask".concat(p.cuid)),p.dom.elGridRectBarMask=k("gridRectBarMask".concat(p.cuid)),p.dom.elGridRectMarkerMask=k("gridRectMarkerMask".concat(p.cuid)),p.dom.elForecastMask=k("forecastMask".concat(p.cuid)),p.dom.elNonForecastMask=k("nonForecastMask".concat(p.cuid));var I=0,B=0;(["bar","rangeBar","candlestick","boxPlot"].includes(h.config.chart.type)||h.globals.comboBarCount>0)&&h.globals.isXNumeric&&!h.globals.isBarHorizontal&&(I=Math.max(h.config.grid.padding.left,p.barPadForNumericAxis),B=Math.max(h.config.grid.padding.right,p.barPadForNumericAxis)),p.dom.elGridRect=S.drawRect(0,0,p.gridWidth,p.gridHeight,0,"#fff"),p.dom.elGridRectBar=S.drawRect(-_/2-I-2,-_/2-2,p.gridWidth+_+B+I+4,p.gridHeight+_+4,0,"#fff");var G=h.globals.markers.largestSize;p.dom.elGridRectMarker=S.drawRect(-G,-G,p.gridWidth+2*G,p.gridHeight+2*G,0,"#fff"),p.dom.elGridRectMask.appendChild(p.dom.elGridRect.node),p.dom.elGridRectBarMask.appendChild(p.dom.elGridRectBar.node),p.dom.elGridRectMarkerMask.appendChild(p.dom.elGridRectMarker.node);var re=p.dom.baseEl.querySelector("defs");re.appendChild(p.dom.elGridRectMask),re.appendChild(p.dom.elGridRectBarMask),re.appendChild(p.dom.elGridRectMarkerMask),re.appendChild(p.dom.elForecastMask),re.appendChild(p.dom.elNonForecastMask)}},{key:"_drawGridLines",value:function(h){var p=h.i,S=h.x1,_=h.y1,k=h.x2,I=h.y2,B=h.xCount,G=h.parent,re=this.w;if(!(p===0&&re.globals.skipFirstTimelinelabel||p===B-1&&re.globals.skipLastTimelinelabel&&!re.config.xaxis.labels.formatter||re.config.chart.type==="radar")){re.config.grid.xaxis.lines.show&&this._drawGridLine({i:p,x1:S,y1:_,x2:k,y2:I,xCount:B,parent:G});var ce=0;if(re.globals.hasXaxisGroups&&re.config.xaxis.tickPlacement==="between"){var ue=re.globals.groups;if(ue){for(var ge=0,Ae=0;ge<p&&Ae<ue.length;Ae++)ge+=ue[Ae].cols;ge===p&&(ce=.6*re.globals.xAxisLabelsHeight)}}new dt(this.ctx).drawXaxisTicks(S,ce,re.globals.dom.elGraphical)}}},{key:"_drawGridLine",value:function(h){var p=h.i,S=h.x1,_=h.y1,k=h.x2,I=h.y2,B=h.xCount,G=h.parent,re=this.w,ce=G.node.classList.contains("apexcharts-gridlines-horizontal"),ue=re.globals.barPadForNumericAxis,ge=_===0&&I===0||S===0&&k===0||_===re.globals.gridHeight&&I===re.globals.gridHeight||re.globals.isBarHorizontal&&(p===0||p===B-1),Ae=new z(this).drawLine(S-(ce?ue:0),_,k+(ce?ue:0),I,re.config.grid.borderColor,re.config.grid.strokeDashArray);Ae.node.classList.add("apexcharts-gridline"),ge&&re.config.grid.show?this.elGridBorders.add(Ae):G.add(Ae)}},{key:"_drawGridBandRect",value:function(h){var p=h.c,S=h.x1,_=h.y1,k=h.x2,I=h.y2,B=h.type,G=this.w,re=new z(this.ctx),ce=G.globals.barPadForNumericAxis,ue=G.config.grid[B].colors[p],ge=re.drawRect(S-(B==="row"?ce:0),_,k+(B==="row"?2*ce:0),I,0,ue,G.config.grid[B].opacity);this.elg.add(ge),ge.attr("clip-path","url(#gridRectMask".concat(G.globals.cuid,")")),ge.node.classList.add("apexcharts-grid-".concat(B))}},{key:"_drawXYLines",value:function(h){var p=this,S=h.xCount,_=h.tickAmount,k=this.w;if(k.config.grid.xaxis.lines.show||k.config.xaxis.axisTicks.show){var I,B=k.globals.padHorizontal,G=k.globals.gridHeight;k.globals.timescaleLabels.length?function(ke){for(var Me=ke.xC,qe=ke.x1,Fe=ke.y1,at=ke.x2,ie=ke.y2,Se=0;Se<Me;Se++)qe=p.xaxisLabels[Se].position,at=p.xaxisLabels[Se].position,p._drawGridLines({i:Se,x1:qe,y1:Fe,x2:at,y2:ie,xCount:S,parent:p.elgridLinesV})}({xC:S,x1:B,y1:0,x2:I,y2:G}):(k.globals.isXNumeric&&(S=k.globals.xAxisScale.result.length),function(ke){for(var Me=ke.xC,qe=ke.x1,Fe=ke.y1,at=ke.x2,ie=ke.y2,Se=0;Se<Me+(k.globals.isXNumeric?0:1);Se++)Se===0&&Me===1&&k.globals.dataPoints===1&&(at=qe=k.globals.gridWidth/2),p._drawGridLines({i:Se,x1:qe,y1:Fe,x2:at,y2:ie,xCount:S,parent:p.elgridLinesV}),at=qe+=k.globals.gridWidth/(k.globals.isXNumeric?Me-1:Me)}({xC:S,x1:B,y1:0,x2:I,y2:G}))}if(k.config.grid.yaxis.lines.show){var re=0,ce=0,ue=k.globals.gridWidth,ge=_+1;this.isRangeBar&&(ge=k.globals.labels.length);for(var Ae=0;Ae<ge+(this.isRangeBar?1:0);Ae++)this._drawGridLine({i:Ae,xCount:ge+(this.isRangeBar?1:0),x1:0,y1:re,x2:ue,y2:ce,parent:this.elgridLinesH}),ce=re+=k.globals.gridHeight/(this.isRangeBar?ge:_)}}},{key:"_drawInvertedXYLines",value:function(h){var p=h.xCount,S=this.w;if(S.config.grid.xaxis.lines.show||S.config.xaxis.axisTicks.show)for(var _,k=S.globals.padHorizontal,I=S.globals.gridHeight,B=0;B<p+1;B++)S.config.grid.xaxis.lines.show&&this._drawGridLine({i:B,xCount:p+1,x1:k,y1:0,x2:_,y2:I,parent:this.elgridLinesV}),new dt(this.ctx).drawXaxisTicks(k,0,S.globals.dom.elGraphical),_=k+=S.globals.gridWidth/p;if(S.config.grid.yaxis.lines.show)for(var G=0,re=0,ce=S.globals.gridWidth,ue=0;ue<S.globals.dataPoints+1;ue++)this._drawGridLine({i:ue,xCount:S.globals.dataPoints+1,x1:0,y1:G,x2:ce,y2:re,parent:this.elgridLinesH}),re=G+=S.globals.gridHeight/S.globals.dataPoints}},{key:"renderGrid",value:function(){var h=this.w,p=h.globals,S=new z(this.ctx);this.elg=S.group({class:"apexcharts-grid"}),this.elgridLinesH=S.group({class:"apexcharts-gridlines-horizontal"}),this.elgridLinesV=S.group({class:"apexcharts-gridlines-vertical"}),this.elGridBorders=S.group({class:"apexcharts-grid-borders"}),this.elg.add(this.elgridLinesH),this.elg.add(this.elgridLinesV),h.config.grid.show||(this.elgridLinesV.hide(),this.elgridLinesH.hide(),this.elGridBorders.hide());for(var _=0;_<p.seriesYAxisMap.length&&p.ignoreYAxisIndexes.includes(_);)_++;_===p.seriesYAxisMap.length&&(_=0);var k,I=p.yAxisScale[_].result.length-1;if(!p.isBarHorizontal||this.isRangeBar){var B,G,re;k=this.xaxisLabels.length,this.isRangeBar&&(I=p.labels.length,h.config.xaxis.tickAmount&&h.config.xaxis.labels.formatter&&(k=h.config.xaxis.tickAmount),((B=p.yAxisScale)===null||B===void 0||(G=B[_])===null||G===void 0||(re=G.result)===null||re===void 0?void 0:re.length)>0&&h.config.xaxis.type!=="datetime"&&(k=p.yAxisScale[_].result.length-1)),this._drawXYLines({xCount:k,tickAmount:I})}else k=I,I=p.xTickAmount,this._drawInvertedXYLines({xCount:k,tickAmount:I});return this.drawGridBands(k,I),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:p.gridWidth/k}}},{key:"drawGridBands",value:function(h,p){var S,_,k=this,I=this.w;if(((S=I.config.grid.row.colors)===null||S===void 0?void 0:S.length)>0&&function(ke,Me,qe,Fe,at,ie){for(var Se=0,$e=0;Se<Me;Se++,$e++)$e>=I.config.grid[ke].colors.length&&($e=0),k._drawGridBandRect({c:$e,x1:qe,y1:Fe,x2:at,y2:ie,type:ke}),Fe+=I.globals.gridHeight/p}("row",p,0,0,I.globals.gridWidth,I.globals.gridHeight/p),((_=I.config.grid.column.colors)===null||_===void 0?void 0:_.length)>0){var B=I.globals.isBarHorizontal||I.config.xaxis.tickPlacement!=="on"||I.config.xaxis.type!=="category"&&!I.config.xaxis.convertedCatToNumeric?h:h-1;I.globals.isXNumeric&&(B=I.globals.xAxisScale.result.length-1);for(var G=I.globals.padHorizontal,re=I.globals.padHorizontal+I.globals.gridWidth/B,ce=I.globals.gridHeight,ue=0,ge=0;ue<h;ue++,ge++){var Ae;ge>=I.config.grid.column.colors.length&&(ge=0),I.config.xaxis.type==="datetime"&&(G=this.xaxisLabels[ue].position,re=(((Ae=this.xaxisLabels[ue+1])===null||Ae===void 0?void 0:Ae.position)||I.globals.gridWidth)-this.xaxisLabels[ue].position),this._drawGridBandRect({c:ge,x1:G,y1:0,x2:re,y2:ce,type:"column"}),G+=I.globals.gridWidth/B}}}}]),Ee}(),nt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.coreUtils=new X(this.ctx)}return o(Ee,[{key:"niceScale",value:function(h,p){var S,_,k,I,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,G=1e-11,re=this.w,ce=re.globals;ce.isBarHorizontal?(S=re.config.xaxis,_=Math.max((ce.svgWidth-100)/25,2)):(S=re.config.yaxis[B],_=Math.max((ce.svgHeight-100)/15,2)),F.isNumber(_)||(_=10),k=S.min!==void 0&&S.min!==null,I=S.max!==void 0&&S.min!==null;var ue=S.stepSize!==void 0&&S.stepSize!==null,ge=S.tickAmount!==void 0&&S.tickAmount!==null,Ae=ge?S.tickAmount:ce.niceScaleDefaultTicks[Math.min(Math.round(_/2),ce.niceScaleDefaultTicks.length-1)];if(ce.isMultipleYAxis&&!ge&&ce.multiAxisTickAmount>0&&(Ae=ce.multiAxisTickAmount,ge=!0),Ae=Ae==="dataPoints"?ce.dataPoints-1:Math.abs(Math.round(Ae)),(h===Number.MIN_VALUE&&p===0||!F.isNumber(h)&&!F.isNumber(p)||h===Number.MIN_VALUE&&p===-Number.MAX_VALUE)&&(h=F.isNumber(S.min)?S.min:0,p=F.isNumber(S.max)?S.max:h+Ae,ce.allSeriesCollapsed=!1),h>p){console.warn("axis.min cannot be greater than axis.max: swapping min and max");var ke=p;p=h,h=ke}else h===p&&(h=h===0?0:h-1,p=p===0?2:p+1);var Me=[];Ae<1&&(Ae=1);var qe=Ae,Fe=Math.abs(p-h);!k&&h>0&&h/Fe<.15&&(h=0,k=!0),!I&&p<0&&-p/Fe<.15&&(p=0,I=!0);var at=(Fe=Math.abs(p-h))/qe,ie=at,Se=Math.floor(Math.log10(ie)),$e=Math.pow(10,Se),Ue=Math.ceil(ie/$e);if(at=ie=(Ue=ce.niceScaleAllowedMagMsd[ce.yValueDecimal===0?0:1][Ue])*$e,ce.isBarHorizontal&&S.stepSize&&S.type!=="datetime"?(at=S.stepSize,ue=!0):ue&&(at=S.stepSize),ue&&S.forceNiceScale){var _e=Math.floor(Math.log10(at));at*=Math.pow(10,Se-_e)}if(k&&I){var st=Fe/qe;if(ge)if(ue)if(F.mod(Fe,at)!=0){var ut=F.getGCD(at,st);at=st/ut<10?ut:st}else F.mod(at,st)==0?at=st:(st=at,ge=!1);else at=st;else if(ue)F.mod(Fe,at)==0?st=at:at=st;else if(F.mod(Fe,at)==0)st=at;else{st=Fe/(qe=Math.ceil(Fe/at));var yt=F.getGCD(Fe,at);Fe/yt<_&&(st=yt),at=st}qe=Math.round(Fe/at)}else{if(k||I){if(I)if(ge)h=p-at*qe;else{var Mt=h;h=at*Math.floor(h/at),Math.abs(p-h)/F.getGCD(Fe,at)>_&&(h=p-at*Ae,h+=at*Math.floor((Mt-h)/at))}else if(k)if(ge)p=h+at*qe;else{var Kt=p;p=at*Math.ceil(p/at),Math.abs(p-h)/F.getGCD(Fe,at)>_&&(p=h+at*Ae,p+=at*Math.ceil((Kt-p)/at))}}else if(ce.isMultipleYAxis&&ge){var un=at*Math.floor(h/at),Xe=un+at*qe;Xe<p&&(at*=2),Xe=p,p=(h=un)+at*qe,Fe=Math.abs(p-h),h>0&&h<Math.abs(Xe-p)&&(h=0,p=at*qe),p<0&&-p<Math.abs(un-h)&&(p=0,h=-at*qe)}else h=at*Math.floor(h/at),p=at*Math.ceil(p/at);Fe=Math.abs(p-h),at=F.getGCD(Fe,at),qe=Math.round(Fe/at)}if(ge||k||I||(qe=Math.ceil((Fe-G)/(at+G)))>16&&F.getPrimeFactors(qe).length<2&&qe++,!ge&&S.forceNiceScale&&ce.yValueDecimal===0&&qe>Fe&&(qe=Fe,at=Math.round(Fe/qe)),qe>_&&(!ge&&!ue||S.forceNiceScale)){var Pt=F.getPrimeFactors(qe),Wt=Pt.length-1,ct=qe;e:for(var Ge=0;Ge<Wt;Ge++)for(var Tt=0;Tt<=Wt-Ge;Tt++){for(var fn=Math.min(Tt+Ge,Wt),Yn=ct,Fn=1,Gn=Tt;Gn<=fn;Gn++)Fn*=Pt[Gn];if((Yn/=Fn)<_){ct=Yn;break e}}at=ct===qe?Fe:Fe/ct,qe=Math.round(Fe/at)}ce.isMultipleYAxis&&ce.multiAxisTickAmount==0&&ce.ignoreYAxisIndexes.indexOf(B)<0&&(ce.multiAxisTickAmount=qe);var Sr=h-at,ur=at*G;do Sr+=at,Me.push(F.stripNumber(Sr,7));while(p-Sr>ur);return{result:Me,niceMin:Me[0],niceMax:Me[Me.length-1]}}},{key:"linearScale",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:void 0,I=Math.abs(p-h),B=[];if(h===p)return{result:B=[h],niceMin:B[0],niceMax:B[B.length-1]};(S=this._adjustTicksForSmallRange(S,_,I))==="dataPoints"&&(S=this.w.globals.dataPoints-1),k||(k=I/S),k=Math.round(10*(k+Number.EPSILON))/10,S===Number.MAX_VALUE&&(S=5,k=1);for(var G=h;S>=0;)B.push(G),G=F.preciseAddition(G,k),S-=1;return{result:B,niceMin:B[0],niceMax:B[B.length-1]}}},{key:"logarithmicScaleNice",value:function(h,p,S){p<=0&&(p=Math.max(h,S)),h<=0&&(h=Math.min(p,S));for(var _=[],k=Math.ceil(Math.log(p)/Math.log(S)+1),I=Math.floor(Math.log(h)/Math.log(S));I<k;I++)_.push(Math.pow(S,I));return{result:_,niceMin:_[0],niceMax:_[_.length-1]}}},{key:"logarithmicScale",value:function(h,p,S){p<=0&&(p=Math.max(h,S)),h<=0&&(h=Math.min(p,S));for(var _=[],k=Math.log(p)/Math.log(S),I=Math.log(h)/Math.log(S),B=k-I,G=Math.round(B),re=B/G,ce=0,ue=I;ce<G;ce++,ue+=re)_.push(Math.pow(S,ue));return _.push(Math.pow(S,k)),{result:_,niceMin:h,niceMax:p}}},{key:"_adjustTicksForSmallRange",value:function(h,p,S){var _=h;if(p!==void 0&&this.w.config.yaxis[p].labels.formatter&&this.w.config.yaxis[p].tickAmount===void 0){var k=Number(this.w.config.yaxis[p].labels.formatter(1));F.isNumber(k)&&this.w.globals.yValueDecimal===0&&(_=Math.ceil(S))}return _<h?_:h}},{key:"setYScaleForIndex",value:function(h,p,S){var _=this.w.globals,k=this.w.config,I=_.isBarHorizontal?k.xaxis:k.yaxis[h];_.yAxisScale[h]===void 0&&(_.yAxisScale[h]=[]);var B=Math.abs(S-p);I.logarithmic&&B<=5&&(_.invalidLogScale=!0),I.logarithmic&&B>5?(_.allSeriesCollapsed=!1,_.yAxisScale[h]=I.forceNiceScale?this.logarithmicScaleNice(p,S,I.logBase):this.logarithmicScale(p,S,I.logBase)):S!==-Number.MAX_VALUE&&F.isNumber(S)&&p!==Number.MAX_VALUE&&F.isNumber(p)?(_.allSeriesCollapsed=!1,_.yAxisScale[h]=this.niceScale(p,S,h)):_.yAxisScale[h]=this.niceScale(Number.MIN_VALUE,0,h)}},{key:"setXScale",value:function(h,p){var S=this.w,_=S.globals,k=Math.abs(p-h);if(p!==-Number.MAX_VALUE&&F.isNumber(p)){var I=_.xTickAmount+1;k<10&&k>1&&(I=k),_.xAxisScale=this.linearScale(h,p,I,0,S.config.xaxis.stepSize)}else _.xAxisScale=this.linearScale(0,10,10);return _.xAxisScale}},{key:"scaleMultipleYAxes",value:function(){var h=this,p=this.w.config,S=this.w.globals;this.coreUtils.setSeriesYAxisMappings();var _=S.seriesYAxisMap,k=S.minYArr,I=S.maxYArr;S.allSeriesCollapsed=!0,S.barGroups=[],_.forEach(function(B,G){var re=[];B.forEach(function(ce){var ue=p.series[ce].group;re.indexOf(ue)<0&&re.push(ue)}),B.length>0?function(){var ce,ue,ge=Number.MAX_VALUE,Ae=-Number.MAX_VALUE,ke=ge,Me=Ae;if(p.chart.stacked)(function(){var at=new Array(S.dataPoints).fill(0),ie=[],Se=[],$e=[];re.forEach(function(){ie.push(at.map(function(){return Number.MIN_VALUE})),Se.push(at.map(function(){return Number.MIN_VALUE})),$e.push(at.map(function(){return Number.MIN_VALUE}))});for(var Ue=function(st){!ce&&p.series[B[st]].type&&(ce=p.series[B[st]].type);var ut=B[st];ue=p.series[ut].group?p.series[ut].group:"axis-".concat(G),!(S.collapsedSeriesIndices.indexOf(ut)<0&&S.ancillaryCollapsedSeriesIndices.indexOf(ut)<0)||(S.allSeriesCollapsed=!1,re.forEach(function(yt,Mt){if(p.series[ut].group===yt)for(var Kt=0;Kt<S.series[ut].length;Kt++){var un=S.series[ut][Kt];un>=0?Se[Mt][Kt]+=un:$e[Mt][Kt]+=un,ie[Mt][Kt]+=un,ke=Math.min(ke,un),Me=Math.max(Me,un)}})),ce!=="bar"&&ce!=="column"||S.barGroups.push(ue)},_e=0;_e<B.length;_e++)Ue(_e);ce||(ce=p.chart.type),ce==="bar"||ce==="column"?re.forEach(function(st,ut){ge=Math.min(ge,Math.min.apply(null,$e[ut])),Ae=Math.max(Ae,Math.max.apply(null,Se[ut]))}):(re.forEach(function(st,ut){ke=Math.min(ke,Math.min.apply(null,ie[ut])),Me=Math.max(Me,Math.max.apply(null,ie[ut]))}),ge=ke,Ae=Me),ge===Number.MIN_VALUE&&Ae===Number.MIN_VALUE&&(Ae=-Number.MAX_VALUE)})();else for(var qe=0;qe<B.length;qe++){var Fe=B[qe];ge=Math.min(ge,k[Fe]),Ae=Math.max(Ae,I[Fe]),!(S.collapsedSeriesIndices.indexOf(Fe)<0&&S.ancillaryCollapsedSeriesIndices.indexOf(Fe)<0)||(S.allSeriesCollapsed=!1)}p.yaxis[G].min!==void 0&&(ge=typeof p.yaxis[G].min=="function"?p.yaxis[G].min(ge):p.yaxis[G].min),p.yaxis[G].max!==void 0&&(Ae=typeof p.yaxis[G].max=="function"?p.yaxis[G].max(Ae):p.yaxis[G].max),S.barGroups=S.barGroups.filter(function(at,ie,Se){return Se.indexOf(at)===ie}),h.setYScaleForIndex(G,ge,Ae),B.forEach(function(at){k[at]=S.yAxisScale[G].niceMin,I[at]=S.yAxisScale[G].niceMax})}():h.setYScaleForIndex(G,0,-Number.MAX_VALUE)})}}]),Ee}(),Le=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.scales=new nt(h)}return o(Ee,[{key:"init",value:function(){this.setYRange(),this.setXRange(),this.setZRange()}},{key:"getMinYMaxY",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:-Number.MAX_VALUE,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,k=this.w.config,I=this.w.globals,B=-Number.MAX_VALUE,G=Number.MIN_VALUE;_===null&&(_=h+1);var re=I.series,ce=re,ue=re;k.chart.type==="candlestick"?(ce=I.seriesCandleL,ue=I.seriesCandleH):k.chart.type==="boxPlot"?(ce=I.seriesCandleO,ue=I.seriesCandleC):I.isRangeData&&(ce=I.seriesRangeStart,ue=I.seriesRangeEnd);var ge=!1;if(I.seriesX.length>=_){var Ae,ke=(Ae=I.brushSource)===null||Ae===void 0?void 0:Ae.w.config.chart.brush;(k.chart.zoom.enabled&&k.chart.zoom.autoScaleYaxis||ke!=null&&ke.enabled&&ke!=null&&ke.autoScaleYaxis)&&(ge=!0)}for(var Me=h;Me<_;Me++){I.dataPoints=Math.max(I.dataPoints,re[Me].length);var qe=k.series[Me].type;I.categoryLabels.length&&(I.dataPoints=I.categoryLabels.filter(function($e){return $e!==void 0}).length),I.labels.length&&k.xaxis.type!=="datetime"&&I.series.reduce(function($e,Ue){return $e+Ue.length},0)!==0&&(I.dataPoints=Math.max(I.dataPoints,I.labels.length));var Fe=0,at=re[Me].length-1;if(ge){if(k.xaxis.min)for(;Fe<at&&I.seriesX[Me][Fe]<k.xaxis.min;Fe++);if(k.xaxis.max)for(;at>Fe&&I.seriesX[Me][at]>k.xaxis.max;at--);}for(var ie=Fe;ie<=at&&ie<I.series[Me].length;ie++){var Se=re[Me][ie];if(Se!==null&&F.isNumber(Se)){switch(ue[Me][ie]!==void 0&&(B=Math.max(B,ue[Me][ie]),p=Math.min(p,ue[Me][ie])),ce[Me][ie]!==void 0&&(p=Math.min(p,ce[Me][ie]),S=Math.max(S,ce[Me][ie])),qe){case"candlestick":I.seriesCandleC[Me][ie]!==void 0&&(B=Math.max(B,I.seriesCandleH[Me][ie]),p=Math.min(p,I.seriesCandleL[Me][ie]));break;case"boxPlot":I.seriesCandleC[Me][ie]!==void 0&&(B=Math.max(B,I.seriesCandleC[Me][ie]),p=Math.min(p,I.seriesCandleO[Me][ie]))}qe&&qe!=="candlestick"&&qe!=="boxPlot"&&qe!=="rangeArea"&&qe!=="rangeBar"&&(B=Math.max(B,I.series[Me][ie]),p=Math.min(p,I.series[Me][ie])),S=B,I.seriesGoals[Me]&&I.seriesGoals[Me][ie]&&Array.isArray(I.seriesGoals[Me][ie])&&I.seriesGoals[Me][ie].forEach(function($e){G!==Number.MIN_VALUE&&(G=Math.min(G,$e.value),p=G),B=Math.max(B,$e.value),S=B}),F.isFloat(Se)&&(Se=F.noExponents(Se),I.yValueDecimal=Math.max(I.yValueDecimal,Se.toString().split(".")[1].length)),G>ce[Me][ie]&&ce[Me][ie]<0&&(G=ce[Me][ie])}else I.hasNullValues=!0}qe!=="bar"&&qe!=="column"||(G<0&&B<0&&(B=0,S=Math.max(S,0)),G===Number.MIN_VALUE&&(G=0,p=Math.min(p,0)))}return k.chart.type==="rangeBar"&&I.seriesRangeStart.length&&I.isBarHorizontal&&(G=p),k.chart.type==="bar"&&(G<0&&B<0&&(B=0),G===Number.MIN_VALUE&&(G=0)),{minY:G,maxY:B,lowestY:p,highestY:S}}},{key:"setYRange",value:function(){var h=this.w.globals,p=this.w.config;h.maxY=-Number.MAX_VALUE,h.minY=Number.MIN_VALUE;var S,_=Number.MAX_VALUE;if(h.isMultipleYAxis){_=Number.MAX_VALUE;for(var k=0;k<h.series.length;k++)S=this.getMinYMaxY(k),h.minYArr[k]=S.lowestY,h.maxYArr[k]=S.highestY,_=Math.min(_,S.lowestY)}return S=this.getMinYMaxY(0,_,null,h.series.length),p.chart.type==="bar"?(h.minY=S.minY,h.maxY=S.maxY):(h.minY=S.lowestY,h.maxY=S.highestY),_=S.lowestY,p.chart.stacked&&this._setStackedMinMax(),p.chart.type==="line"||p.chart.type==="area"||p.chart.type==="scatter"||p.chart.type==="candlestick"||p.chart.type==="boxPlot"||p.chart.type==="rangeBar"&&!h.isBarHorizontal?h.minY===Number.MIN_VALUE&&_!==-Number.MAX_VALUE&&_!==h.maxY&&(h.minY=_):h.minY=h.minY!==Number.MIN_VALUE?Math.min(S.minY,h.minY):S.minY,p.yaxis.forEach(function(I,B){I.max!==void 0&&(typeof I.max=="number"?h.maxYArr[B]=I.max:typeof I.max=="function"&&(h.maxYArr[B]=I.max(h.isMultipleYAxis?h.maxYArr[B]:h.maxY)),h.maxY=h.maxYArr[B]),I.min!==void 0&&(typeof I.min=="number"?h.minYArr[B]=I.min:typeof I.min=="function"&&(h.minYArr[B]=I.min(h.isMultipleYAxis?h.minYArr[B]===Number.MIN_VALUE?0:h.minYArr[B]:h.minY)),h.minY=h.minYArr[B])}),h.isBarHorizontal&&["min","max"].forEach(function(I){p.xaxis[I]!==void 0&&typeof p.xaxis[I]=="number"&&(I==="min"?h.minY=p.xaxis[I]:h.maxY=p.xaxis[I])}),h.isMultipleYAxis?(this.scales.scaleMultipleYAxes(),h.minY=_):(this.scales.setYScaleForIndex(0,h.minY,h.maxY),h.minY=h.yAxisScale[0].niceMin,h.maxY=h.yAxisScale[0].niceMax,h.minYArr[0]=h.minY,h.maxYArr[0]=h.maxY),h.barGroups=[],h.lineGroups=[],h.areaGroups=[],p.series.forEach(function(I){switch(I.type||p.chart.type){case"bar":case"column":h.barGroups.push(I.group);break;case"line":h.lineGroups.push(I.group);break;case"area":h.areaGroups.push(I.group)}}),h.barGroups=h.barGroups.filter(function(I,B,G){return G.indexOf(I)===B}),h.lineGroups=h.lineGroups.filter(function(I,B,G){return G.indexOf(I)===B}),h.areaGroups=h.areaGroups.filter(function(I,B,G){return G.indexOf(I)===B}),{minY:h.minY,maxY:h.maxY,minYArr:h.minYArr,maxYArr:h.maxYArr,yAxisScale:h.yAxisScale}}},{key:"setXRange",value:function(){var h=this.w.globals,p=this.w.config,S=p.xaxis.type==="numeric"||p.xaxis.type==="datetime"||p.xaxis.type==="category"&&!h.noLabelsProvided||h.noLabelsProvided||h.isXNumeric;if(h.isXNumeric&&function(){for(var G=0;G<h.series.length;G++)if(h.labels[G])for(var re=0;re<h.labels[G].length;re++)h.labels[G][re]!==null&&F.isNumber(h.labels[G][re])&&(h.maxX=Math.max(h.maxX,h.labels[G][re]),h.initialMaxX=Math.max(h.maxX,h.labels[G][re]),h.minX=Math.min(h.minX,h.labels[G][re]),h.initialMinX=Math.min(h.minX,h.labels[G][re]))}(),h.noLabelsProvided&&p.xaxis.categories.length===0&&(h.maxX=h.labels[h.labels.length-1],h.initialMaxX=h.labels[h.labels.length-1],h.minX=1,h.initialMinX=1),h.isXNumeric||h.noLabelsProvided||h.dataFormatXNumeric){var _=10;if(p.xaxis.tickAmount===void 0)_=Math.round(h.svgWidth/150),p.xaxis.type==="numeric"&&h.dataPoints<30&&(_=h.dataPoints-1),_>h.dataPoints&&h.dataPoints!==0&&(_=h.dataPoints-1);else if(p.xaxis.tickAmount==="dataPoints"){if(h.series.length>1&&(_=h.series[h.maxValsInArrayIndex].length-1),h.isXNumeric){var k=h.maxX-h.minX;k<30&&(_=k-1)}}else _=p.xaxis.tickAmount;if(h.xTickAmount=_,p.xaxis.max!==void 0&&typeof p.xaxis.max=="number"&&(h.maxX=p.xaxis.max),p.xaxis.min!==void 0&&typeof p.xaxis.min=="number"&&(h.minX=p.xaxis.min),p.xaxis.range!==void 0&&(h.minX=h.maxX-p.xaxis.range),h.minX!==Number.MAX_VALUE&&h.maxX!==-Number.MAX_VALUE)if(p.xaxis.convertedCatToNumeric&&!h.dataFormatXNumeric){for(var I=[],B=h.minX-1;B<h.maxX;B++)I.push(B+1);h.xAxisScale={result:I,niceMin:I[0],niceMax:I[I.length-1]}}else h.xAxisScale=this.scales.setXScale(h.minX,h.maxX);else h.xAxisScale=this.scales.linearScale(0,_,_,0,p.xaxis.stepSize),h.noLabelsProvided&&h.labels.length>0&&(h.xAxisScale=this.scales.linearScale(1,h.labels.length,_-1,0,p.xaxis.stepSize),h.seriesX=h.labels.slice());S&&(h.labels=h.xAxisScale.result.slice())}return h.isBarHorizontal&&h.labels.length&&(h.xTickAmount=h.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:h.minX,maxX:h.maxX}}},{key:"setZRange",value:function(){var h=this.w.globals;if(h.isDataXYZ){for(var p=0;p<h.series.length;p++)if(h.seriesZ[p]!==void 0)for(var S=0;S<h.seriesZ[p].length;S++)h.seriesZ[p][S]!==null&&F.isNumber(h.seriesZ[p][S])&&(h.maxZ=Math.max(h.maxZ,h.seriesZ[p][S]),h.minZ=Math.min(h.minZ,h.seriesZ[p][S]))}}},{key:"_handleSingleDataPoint",value:function(){var h=this.w.globals,p=this.w.config;if(h.minX===h.maxX){var S=new K(this.ctx);if(p.xaxis.type==="datetime"){var _=S.getDate(h.minX);p.xaxis.labels.datetimeUTC?_.setUTCDate(_.getUTCDate()-2):_.setDate(_.getDate()-2),h.minX=new Date(_).getTime();var k=S.getDate(h.maxX);p.xaxis.labels.datetimeUTC?k.setUTCDate(k.getUTCDate()+2):k.setDate(k.getDate()+2),h.maxX=new Date(k).getTime()}else(p.xaxis.type==="numeric"||p.xaxis.type==="category"&&!h.noLabelsProvided)&&(h.minX=h.minX-2,h.initialMinX=h.minX,h.maxX=h.maxX+2,h.initialMaxX=h.maxX)}}},{key:"_getMinXDiff",value:function(){var h=this.w.globals;h.isXNumeric&&h.seriesX.forEach(function(p,S){p.length===1&&p.push(h.seriesX[h.maxValsInArrayIndex][h.seriesX[h.maxValsInArrayIndex].length-1]);var _=p.slice();_.sort(function(k,I){return k-I}),_.forEach(function(k,I){if(I>0){var B=k-_[I-1];B>0&&(h.minXDiff=Math.min(B,h.minXDiff))}}),h.dataPoints!==1&&h.minXDiff!==Number.MAX_VALUE||(h.minXDiff=.5)})}},{key:"_setStackedMinMax",value:function(){var h=this,p=this.w.globals;if(p.series.length){var S=p.seriesGroups;S.length||(S=[this.w.globals.seriesNames.map(function(I){return I})]);var _={},k={};S.forEach(function(I){_[I]=[],k[I]=[],h.w.config.series.map(function(B,G){return I.indexOf(p.seriesNames[G])>-1?G:null}).filter(function(B){return B!==null}).forEach(function(B){for(var G=0;G<p.series[p.maxValsInArrayIndex].length;G++){var re,ce,ue,ge;_[I][G]===void 0&&(_[I][G]=0,k[I][G]=0),(h.w.config.chart.stacked&&!p.comboCharts||h.w.config.chart.stacked&&p.comboCharts&&(!h.w.config.chart.stackOnlyBar||((re=h.w.config.series)===null||re===void 0||(ce=re[B])===null||ce===void 0?void 0:ce.type)==="bar"||((ue=h.w.config.series)===null||ue===void 0||(ge=ue[B])===null||ge===void 0?void 0:ge.type)==="column"))&&p.series[B][G]!==null&&F.isNumber(p.series[B][G])&&(p.series[B][G]>0?_[I][G]+=parseFloat(p.series[B][G])+1e-4:k[I][G]+=parseFloat(p.series[B][G]))}})}),Object.entries(_).forEach(function(I){var B=C(I,1)[0];_[B].forEach(function(G,re){p.maxY=Math.max(p.maxY,_[B][re]),p.minY=Math.min(p.minY,k[B][re])})})}}}]),Ee}(),Be=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.elgrid=p,this.w=h.w;var S=this.w;this.xaxisFontSize=S.config.xaxis.labels.style.fontSize,this.axisFontFamily=S.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=S.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal=S.config.chart.type==="bar"&&S.config.plotOptions.bar.horizontal,this.xAxisoffX=S.config.xaxis.position==="bottom"?S.globals.gridHeight:0,this.drawnLabels=[],this.axesUtils=new fe(h)}return o(Ee,[{key:"drawYaxis",value:function(h){var p=this.w,S=new z(this.ctx),_=p.config.yaxis[h].labels.style,k=_.fontSize,I=_.fontFamily,B=_.fontWeight,G=S.group({class:"apexcharts-yaxis",rel:h,transform:"translate(".concat(p.globals.translateYAxisX[h],", 0)")});if(this.axesUtils.isYAxisHidden(h))return G;var re=S.group({class:"apexcharts-yaxis-texts-g"});G.add(re);var ce=p.globals.yAxisScale[h].result.length-1,ue=p.globals.gridHeight/ce,ge=p.globals.yLabelFormatters[h],Ae=this.axesUtils.checkForReversedLabels(h,p.globals.yAxisScale[h].result.slice());if(p.config.yaxis[h].labels.show){var ke=p.globals.translateY+p.config.yaxis[h].labels.offsetY;p.globals.isBarHorizontal?ke=0:p.config.chart.type==="heatmap"&&(ke-=ue/2),ke+=parseInt(k,10)/3;for(var Me=ce;Me>=0;Me--){var qe=ge(Ae[Me],Me,p),Fe=p.config.yaxis[h].labels.padding;p.config.yaxis[h].opposite&&p.config.yaxis.length!==0&&(Fe*=-1);var at=this.getTextAnchor(p.config.yaxis[h].labels.align,p.config.yaxis[h].opposite),ie=this.axesUtils.getYAxisForeColor(_.colors,h),Se=Array.isArray(ie)?ie[Me]:ie,$e=F.listToArray(p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(h,"'] .apexcharts-yaxis-label tspan"))).map(function(_e){return _e.textContent}),Ue=S.drawText({x:Fe,y:ke,text:$e.includes(qe)&&!p.config.yaxis[h].labels.showDuplicates?"":qe,textAnchor:at,fontSize:k,fontFamily:I,fontWeight:B,maxWidth:p.config.yaxis[h].labels.maxWidth,foreColor:Se,isPlainText:!1,cssClass:"apexcharts-yaxis-label ".concat(_.cssClass)});re.add(Ue),this.addTooltip(Ue,qe),p.config.yaxis[h].labels.rotate!==0&&this.rotateLabel(S,Ue,firstLabel,p.config.yaxis[h].labels.rotate),ke+=ue}}return this.addYAxisTitle(S,G,h),this.addAxisBorder(S,G,h,ce,ue),G}},{key:"getTextAnchor",value:function(h,p){return h==="left"?"start":h==="center"?"middle":h==="right"?"end":p?"start":"end"}},{key:"addTooltip",value:function(h,p){var S=document.createElementNS(this.w.globals.SVGNS,"title");S.textContent=Array.isArray(p)?p.join(" "):p,h.node.appendChild(S)}},{key:"rotateLabel",value:function(h,p,S,_){var k=h.rotateAroundCenter(S.node),I=h.rotateAroundCenter(p.node);p.node.setAttribute("transform","rotate(".concat(_," ").concat(k.x," ").concat(I.y,")"))}},{key:"addYAxisTitle",value:function(h,p,S){var _=this.w;if(_.config.yaxis[S].title.text!==void 0){var k=h.group({class:"apexcharts-yaxis-title"}),I=_.config.yaxis[S].opposite?_.globals.translateYAxisX[S]:0,B=h.drawText({x:I,y:_.globals.gridHeight/2+_.globals.translateY+_.config.yaxis[S].title.offsetY,text:_.config.yaxis[S].title.text,textAnchor:"end",foreColor:_.config.yaxis[S].title.style.color,fontSize:_.config.yaxis[S].title.style.fontSize,fontWeight:_.config.yaxis[S].title.style.fontWeight,fontFamily:_.config.yaxis[S].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text ".concat(_.config.yaxis[S].title.style.cssClass)});k.add(B),p.add(k)}}},{key:"addAxisBorder",value:function(h,p,S,_,k){var I=this.w,B=I.config.yaxis[S].axisBorder,G=31+B.offsetX;if(I.config.yaxis[S].opposite&&(G=-31-B.offsetX),B.show){var re=h.drawLine(G,I.globals.translateY+B.offsetY-2,G,I.globals.gridHeight+I.globals.translateY+B.offsetY+2,B.color,0,B.width);p.add(re)}I.config.yaxis[S].axisTicks.show&&this.axesUtils.drawYAxisTicks(G,_,B,I.config.yaxis[S].axisTicks,S,k,p)}},{key:"drawYaxisInversed",value:function(h){var p=this.w,S=new z(this.ctx),_=S.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),k=S.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(p.globals.translateXAxisX,", ").concat(p.globals.translateXAxisY,")")});_.add(k);var I=p.globals.yAxisScale[h].result.length-1,B=p.globals.gridWidth/I+.1,G=B+p.config.xaxis.labels.offsetX,re=p.globals.xLabelFormatter,ce=this.axesUtils.checkForReversedLabels(h,p.globals.yAxisScale[h].result.slice()),ue=p.globals.timescaleLabels;if(ue.length>0&&(this.xaxisLabels=ue.slice(),I=(ce=ue.slice()).length),p.config.xaxis.labels.show)for(var ge=ue.length?0:I;ue.length?ge<ue.length:ge>=0;ue.length?ge++:ge--){var Ae=re(ce[ge],ge,p),ke=p.globals.gridWidth+p.globals.padHorizontal-(G-B+p.config.xaxis.labels.offsetX);if(ue.length){var Me=this.axesUtils.getLabel(ce,ue,ke,ge,this.drawnLabels,this.xaxisFontSize);ke=Me.x,Ae=Me.text,this.drawnLabels.push(Me.text),ge===0&&p.globals.skipFirstTimelinelabel&&(Ae=""),ge===ce.length-1&&p.globals.skipLastTimelinelabel&&(Ae="")}var qe=S.drawText({x:ke,y:this.xAxisoffX+p.config.xaxis.labels.offsetY+30-(p.config.xaxis.position==="top"?p.globals.xAxisHeight+p.config.xaxis.axisTicks.height-2:0),text:Ae,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[h]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:p.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label ".concat(p.config.xaxis.labels.style.cssClass)});k.add(qe),qe.tspan(Ae),this.addTooltip(qe,Ae),G+=B}return this.inversedYAxisTitleText(_),this.inversedYAxisBorder(_),_}},{key:"inversedYAxisBorder",value:function(h){var p=this.w,S=new z(this.ctx),_=p.config.xaxis.axisBorder;if(_.show){var k=0;p.config.chart.type==="bar"&&p.globals.isXNumeric&&(k-=15);var I=S.drawLine(p.globals.padHorizontal+k+_.offsetX,this.xAxisoffX,p.globals.gridWidth,this.xAxisoffX,_.color,0,_.height);this.elgrid&&this.elgrid.elGridBorders&&p.config.grid.show?this.elgrid.elGridBorders.add(I):h.add(I)}}},{key:"inversedYAxisTitleText",value:function(h){var p=this.w,S=new z(this.ctx);if(p.config.xaxis.title.text!==void 0){var _=S.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),k=S.drawText({x:p.globals.gridWidth/2+p.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(p.config.xaxis.title.style.fontSize)+p.config.xaxis.title.offsetY+20,text:p.config.xaxis.title.text,textAnchor:"middle",fontSize:p.config.xaxis.title.style.fontSize,fontFamily:p.config.xaxis.title.style.fontFamily,fontWeight:p.config.xaxis.title.style.fontWeight,foreColor:p.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text ".concat(p.config.xaxis.title.style.cssClass)});_.add(k),h.add(_)}}},{key:"yAxisTitleRotate",value:function(h,p){var S=this.w,_=new z(this.ctx),k=S.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(h,"'] .apexcharts-yaxis-texts-g")),I=k?k.getBoundingClientRect():{width:0,height:0},B=S.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(h,"'] .apexcharts-yaxis-title text")),G=B?B.getBoundingClientRect():{width:0,height:0};if(B){var re=this.xPaddingForYAxisTitle(h,I,G,p);B.setAttribute("x",re.xPos-(p?10:0));var ce=_.rotateAroundCenter(B);B.setAttribute("transform","rotate(".concat(p?-1*S.config.yaxis[h].title.rotate:S.config.yaxis[h].title.rotate," ").concat(ce.x," ").concat(ce.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(h,p,S,_){var k=this.w,I=0,B=10;return k.config.yaxis[h].title.text===void 0||h<0?{xPos:I,padd:0}:(_?I=p.width+k.config.yaxis[h].title.offsetX+S.width/2+B/2:(I=-1*p.width+k.config.yaxis[h].title.offsetX+B/2+S.width/2,k.globals.isBarHorizontal&&(B=25,I=-1*p.width-k.config.yaxis[h].title.offsetX-B)),{xPos:I,padd:B})}},{key:"setYAxisXPosition",value:function(h,p){var S=this.w,_=0,k=0,I=18,B=1;S.config.yaxis.length>1&&(this.multipleYs=!0),S.config.yaxis.forEach(function(G,re){var ce=S.globals.ignoreYAxisIndexes.includes(re)||!G.show||G.floating||h[re].width===0,ue=h[re].width+p[re].width;G.opposite?S.globals.isBarHorizontal?(k=S.globals.gridWidth+S.globals.translateX-1,S.globals.translateYAxisX[re]=k-G.labels.offsetX):(k=S.globals.gridWidth+S.globals.translateX+B,ce||(B+=ue+20),S.globals.translateYAxisX[re]=k-G.labels.offsetX+20):(_=S.globals.translateX-I,ce||(I+=ue+20),S.globals.translateYAxisX[re]=_+G.labels.offsetX)})}},{key:"setYAxisTextAlignments",value:function(){var h=this.w;F.listToArray(h.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach(function(p,S){var _=h.config.yaxis[S];if(_&&!_.floating&&_.labels.align!==void 0){var k=h.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(S,"'] .apexcharts-yaxis-texts-g")),I=F.listToArray(h.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(S,"'] .apexcharts-yaxis-label"))),B=k.getBoundingClientRect();I.forEach(function(G){G.setAttribute("text-anchor",_.labels.align)}),_.labels.align!=="left"||_.opposite?_.labels.align==="center"?k.setAttribute("transform","translate(".concat(B.width/2*(_.opposite?1:-1),", 0)")):_.labels.align==="right"&&_.opposite&&k.setAttribute("transform","translate(".concat(B.width,", 0)")):k.setAttribute("transform","translate(-".concat(B.width,", 0)"))}})}}]),Ee}(),ht=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.documentEvent=F.bind(this.documentEvent,this)}return o(Ee,[{key:"addEventListener",value:function(h,p){var S=this.w;S.globals.events.hasOwnProperty(h)?S.globals.events[h].push(p):S.globals.events[h]=[p]}},{key:"removeEventListener",value:function(h,p){var S=this.w;if(S.globals.events.hasOwnProperty(h)){var _=S.globals.events[h].indexOf(p);_!==-1&&S.globals.events[h].splice(_,1)}}},{key:"fireEvent",value:function(h,p){var S=this.w;if(S.globals.events.hasOwnProperty(h)){p&&p.length||(p=[]);for(var _=S.globals.events[h],k=_.length,I=0;I<k;I++)_[I].apply(null,p)}}},{key:"setupEventHandlers",value:function(){var h=this,p=this.w,S=this.ctx,_=p.globals.dom.baseEl.querySelector(p.globals.chartClass);this.ctx.eventList.forEach(function(k){_.addEventListener(k,function(I){var B=Object.assign({},p,{seriesIndex:p.globals.axisCharts?p.globals.capturedSeriesIndex:0,dataPointIndex:p.globals.capturedDataPointIndex});I.type==="mousemove"||I.type==="touchmove"?typeof p.config.chart.events.mouseMove=="function"&&p.config.chart.events.mouseMove(I,S,B):I.type==="mouseleave"||I.type==="touchleave"?typeof p.config.chart.events.mouseLeave=="function"&&p.config.chart.events.mouseLeave(I,S,B):(I.type==="mouseup"&&I.which===1||I.type==="touchend")&&(typeof p.config.chart.events.click=="function"&&p.config.chart.events.click(I,S,B),S.ctx.events.fireEvent("click",[I,S,B]))},{capture:!1,passive:!0})}),this.ctx.eventList.forEach(function(k){p.globals.dom.baseEl.addEventListener(k,h.documentEvent,{passive:!0})}),this.ctx.core.setupBrushHandler()}},{key:"documentEvent",value:function(h){var p=this.w,S=h.target.className;if(h.type==="click"){var _=p.globals.dom.baseEl.querySelector(".apexcharts-menu");_&&_.classList.contains("apexcharts-menu-open")&&S!=="apexcharts-menu-icon"&&_.classList.remove("apexcharts-menu-open")}p.globals.clientX=h.type==="touchmove"?h.touches[0].clientX:h.clientX,p.globals.clientY=h.type==="touchmove"?h.touches[0].clientY:h.clientY}}]),Ee}(),pt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"setCurrentLocaleValues",value:function(h){var p=this.w.config.chart.locales;window.Apex.chart&&window.Apex.chart.locales&&window.Apex.chart.locales.length>0&&(p=this.w.config.chart.locales.concat(window.Apex.chart.locales));var S=p.filter(function(k){return k.name===h})[0];if(!S)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var _=F.extend(ae,S);this.w.globals.locale=_.options}}]),Ee}(),Gt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"drawAxis",value:function(h,p){var S,_,k=this,I=this.w.globals,B=this.w.config,G=new dt(this.ctx,p),re=new Be(this.ctx,p);I.axisCharts&&h!=="radar"&&(I.isBarHorizontal?(_=re.drawYaxisInversed(0),S=G.drawXaxisInversed(0),I.dom.elGraphical.add(S),I.dom.elGraphical.add(_)):(S=G.drawXaxis(),I.dom.elGraphical.add(S),B.yaxis.map(function(ce,ue){if(I.ignoreYAxisIndexes.indexOf(ue)===-1&&(_=re.drawYaxis(ue),I.dom.Paper.add(_),k.w.config.grid.position==="back")){var ge=I.dom.Paper.children()[1];ge.remove(),I.dom.Paper.add(ge)}})))}}]),Ee}(),wt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"drawXCrosshairs",value:function(){var h=this.w,p=new z(this.ctx),S=new L(this.ctx),_=h.config.xaxis.crosshairs.fill.gradient,k=h.config.xaxis.crosshairs.dropShadow,I=h.config.xaxis.crosshairs.fill.type,B=_.colorFrom,G=_.colorTo,re=_.opacityFrom,ce=_.opacityTo,ue=_.stops,ge=k.enabled,Ae=k.left,ke=k.top,Me=k.blur,qe=k.color,Fe=k.opacity,at=h.config.xaxis.crosshairs.fill.color;if(h.config.xaxis.crosshairs.show){I==="gradient"&&(at=p.drawGradient("vertical",B,G,re,ce,null,ue,null));var ie=p.drawRect();h.config.xaxis.crosshairs.width===1&&(ie=p.drawLine());var Se=h.globals.gridHeight;(!F.isNumber(Se)||Se<0)&&(Se=0);var $e=h.config.xaxis.crosshairs.width;(!F.isNumber($e)||$e<0)&&($e=0),ie.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:Se,width:$e,height:Se,fill:at,filter:"none","fill-opacity":h.config.xaxis.crosshairs.opacity,stroke:h.config.xaxis.crosshairs.stroke.color,"stroke-width":h.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":h.config.xaxis.crosshairs.stroke.dashArray}),ge&&(ie=S.dropShadow(ie,{left:Ae,top:ke,blur:Me,color:qe,opacity:Fe})),h.globals.dom.elGraphical.add(ie)}}},{key:"drawYCrosshairs",value:function(){var h=this.w,p=new z(this.ctx),S=h.config.yaxis[0].crosshairs,_=h.globals.barPadForNumericAxis;if(h.config.yaxis[0].crosshairs.show){var k=p.drawLine(-_,0,h.globals.gridWidth+_,0,S.stroke.color,S.stroke.dashArray,S.stroke.width);k.attr({class:"apexcharts-ycrosshairs"}),h.globals.dom.elGraphical.add(k)}var I=p.drawLine(-_,0,h.globals.gridWidth+_,0,S.stroke.color,0,0);I.attr({class:"apexcharts-ycrosshairs-hidden"}),h.globals.dom.elGraphical.add(I)}}]),Ee}(),nn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"checkResponsiveConfig",value:function(h){var p=this,S=this.w,_=S.config;if(_.responsive.length!==0){var k=_.responsive.slice();k.sort(function(re,ce){return re.breakpoint>ce.breakpoint?1:ce.breakpoint>re.breakpoint?-1:0}).reverse();var I=new Ce({}),B=function(){var re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ce=k[0].breakpoint,ue=window.innerWidth>0?window.innerWidth:screen.width;if(ue>ce){var ge=F.clone(S.globals.initialConfig);ge.series=F.clone(S.config.series);var Ae=X.extendArrayProps(I,ge,S);re=F.extend(Ae,re),re=F.extend(S.config,re),p.overrideResponsiveOptions(re)}else for(var ke=0;ke<k.length;ke++)ue<k[ke].breakpoint&&(re=X.extendArrayProps(I,k[ke].options,S),re=F.extend(S.config,re),p.overrideResponsiveOptions(re))};if(h){var G=X.extendArrayProps(I,h,S);G=F.extend(S.config,G),B(G=F.extend(G,h))}else B({})}}},{key:"overrideResponsiveOptions",value:function(h){var p=new Ce(h).init({responsiveOverride:!0});this.w.config=p}}]),Ee}(),cn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.colors=[],this.isColorFn=!1,this.isHeatmapDistributed=this.checkHeatmapDistributed(),this.isBarDistributed=this.checkBarDistributed()}return o(Ee,[{key:"checkHeatmapDistributed",value:function(){var h=this.w.config,p=h.chart,S=h.plotOptions;return p.type==="treemap"&&S.treemap&&S.treemap.distributed||p.type==="heatmap"&&S.heatmap&&S.heatmap.distributed}},{key:"checkBarDistributed",value:function(){var h=this.w.config,p=h.chart,S=h.plotOptions;return S.bar&&S.bar.distributed&&(p.type==="bar"||p.type==="rangeBar")}},{key:"init",value:function(){this.setDefaultColors()}},{key:"setDefaultColors",value:function(){var h=this.w,p=new F;h.globals.dom.elWrap.classList.add("apexcharts-theme-".concat(h.config.theme.mode));var S=N(h.config.colors||h.config.fill.colors||[]);h.globals.colors=this.getColors(S),this.applySeriesColors(h.globals.seriesColors,h.globals.colors),h.config.theme.monochrome.enabled&&(h.globals.colors=this.getMonochromeColors(h.config.theme.monochrome,h.globals.series,p));var _=h.globals.colors.slice();this.pushExtraColors(h.globals.colors),this.applyColorTypes(["fill","stroke"],_),this.applyDataLabelsColors(_),this.applyRadarPolygonsColors(),this.applyMarkersColors(_)}},{key:"getColors",value:function(h){var p=this,S=this.w;return h&&h.length!==0?Array.isArray(h)&&h.length>0&&typeof h[0]=="function"?(this.isColorFn=!0,S.config.series.map(function(_,k){var I=h[k]||h[0];return typeof I=="function"?I({value:S.globals.axisCharts?S.globals.series[k][0]||0:S.globals.series[k],seriesIndex:k,dataPointIndex:k,w:p.w}):I})):h:this.predefined()}},{key:"applySeriesColors",value:function(h,p){h.forEach(function(S,_){S&&(p[_]=S)})}},{key:"getMonochromeColors",value:function(h,p,S){var _=h.color,k=h.shadeIntensity,I=h.shadeTo,B=this.isBarDistributed||this.isHeatmapDistributed?p[0].length*p.length:p.length,G=1/(B/k),re=0;return Array.from({length:B},function(){var ce=I==="dark"?S.shadeColor(-1*re,_):S.shadeColor(re,_);return re+=G,ce})}},{key:"applyColorTypes",value:function(h,p){var S=this,_=this.w;h.forEach(function(k){_.globals[k].colors=_.config[k].colors===void 0?S.isColorFn?_.config.colors:p:_.config[k].colors.slice(),S.pushExtraColors(_.globals[k].colors)})}},{key:"applyDataLabelsColors",value:function(h){var p=this.w;p.globals.dataLabels.style.colors=p.config.dataLabels.style.colors===void 0?h:p.config.dataLabels.style.colors.slice(),this.pushExtraColors(p.globals.dataLabels.style.colors,50)}},{key:"applyRadarPolygonsColors",value:function(){var h=this.w;h.globals.radarPolygons.fill.colors=h.config.plotOptions.radar.polygons.fill.colors===void 0?[h.config.theme.mode==="dark"?"#424242":"none"]:h.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(h.globals.radarPolygons.fill.colors,20)}},{key:"applyMarkersColors",value:function(h){var p=this.w;p.globals.markers.colors=p.config.markers.colors===void 0?h:p.config.markers.colors.slice(),this.pushExtraColors(p.globals.markers.colors)}},{key:"pushExtraColors",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=this.w,k=p||_.globals.series.length;if(S===null&&(S=this.isBarDistributed||this.isHeatmapDistributed||_.config.chart.type==="heatmap"&&_.config.plotOptions.heatmap&&_.config.plotOptions.heatmap.colorScale.inverse),S&&_.globals.series.length&&(k=_.globals.series[_.globals.maxValsInArrayIndex].length*_.globals.series.length),h.length<k)for(var I=k-h.length,B=0;B<I;B++)h.push(h[B])}},{key:"updateThemeOptions",value:function(h){h.chart=h.chart||{},h.tooltip=h.tooltip||{};var p=h.theme.mode,S=p==="dark"?"palette4":p==="light"?"palette1":h.theme.palette||"palette1",_=p==="dark"?"#f6f7f8":p==="light"?"#373d3f":h.chart.foreColor||"#373d3f";return h.tooltip.theme=p||"light",h.chart.foreColor=_,h.theme.palette=S,h}},{key:"predefined",value:function(){var h={palette1:["#008FFB","#00E396","#FEB019","#FF4560","#775DD0"],palette2:["#3f51b5","#03a9f4","#4caf50","#f9ce1d","#FF9800"],palette3:["#33b2df","#546E7A","#d4526e","#13d8aa","#A5978B"],palette4:["#4ecdc4","#c7f464","#81D4FA","#fd6a6a","#546E7A"],palette5:["#2b908f","#f9a3a4","#90ee7e","#fa4443","#69d2e7"],palette6:["#449DD1","#F86624","#EA3546","#662E9B","#C5D86D"],palette7:["#D7263D","#1B998B","#2E294E","#F46036","#E2C044"],palette8:["#662E9B","#F86624","#F9C80E","#EA3546","#43BCCD"],palette9:["#5C4742","#A5978B","#8D5B4C","#5A2A27","#C4BBAF"],palette10:["#A300D6","#7D02EB","#5653FE","#2983FF","#00B1F2"],default:["#008FFB","#00E396","#FEB019","#FF4560","#775DD0"]};return h[this.w.config.theme.palette]||h.default}}]),Ee}(),Un=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"draw",value:function(){this.drawTitleSubtitle("title"),this.drawTitleSubtitle("subtitle")}},{key:"drawTitleSubtitle",value:function(h){var p=this.w,S=h==="title"?p.config.title:p.config.subtitle,_=p.globals.svgWidth/2,k=S.offsetY,I="middle";if(S.align==="left"?(_=10,I="start"):S.align==="right"&&(_=p.globals.svgWidth-10,I="end"),_+=S.offsetX,k=k+parseInt(S.style.fontSize,10)+S.margin/2,S.text!==void 0){var B=new z(this.ctx).drawText({x:_,y:k,text:S.text,textAnchor:I,fontSize:S.style.fontSize,fontFamily:S.style.fontFamily,fontWeight:S.style.fontWeight,foreColor:S.style.color,opacity:1});B.node.setAttribute("class","apexcharts-".concat(h,"-text")),p.globals.dom.Paper.add(B)}}}]),Ee}(),Xt=function(){function Ee(h){s(this,Ee),this.w=h.w,this.dCtx=h}return o(Ee,[{key:"getTitleSubtitleCoords",value:function(h){var p=this.w,S=0,_=0,k=h==="title"?p.config.title.floating:p.config.subtitle.floating,I=p.globals.dom.baseEl.querySelector(".apexcharts-".concat(h,"-text"));if(I!==null&&!k){var B=I.getBoundingClientRect();S=B.width,_=p.globals.axisCharts?B.height+5:B.height}return{width:S,height:_}}},{key:"getLegendsRect",value:function(){var h=this.w,p=h.globals.dom.elLegendWrap;h.config.legend.height||h.config.legend.position!=="top"&&h.config.legend.position!=="bottom"||(p.style.maxHeight=h.globals.svgHeight/2+"px");var S=Object.assign({},F.getBoundingClientRect(p));return p!==null&&!h.config.legend.floating&&h.config.legend.show?this.dCtx.lgRect={x:S.x,y:S.y,height:S.height,width:S.height===0?0:S.width}:this.dCtx.lgRect={x:0,y:0,height:0,width:0},h.config.legend.position!=="left"&&h.config.legend.position!=="right"||1.5*this.dCtx.lgRect.width>h.globals.svgWidth&&(this.dCtx.lgRect.width=h.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getDatalabelsRect",value:function(){var h=this,p=this.w,S=[];p.config.series.forEach(function(G,re){G.data.forEach(function(ce,ue){var ge;ge=p.globals.series[re][ue],_=p.config.dataLabels.formatter(ge,{ctx:h.dCtx.ctx,seriesIndex:re,dataPointIndex:ue,w:p}),S.push(_)})});var _=F.getLargestStringFromArr(S),k=new z(this.dCtx.ctx),I=p.config.dataLabels.style,B=k.getTextRects(_,parseInt(I.fontSize),I.fontFamily);return{width:1.05*B.width,height:B.height}}},{key:"getLargestStringFromMultiArr",value:function(h,p){var S=h;if(this.w.globals.isMultiLineX){var _=p.map(function(I,B){return Array.isArray(I)?I.length:1}),k=Math.max.apply(Math,N(_));S=p[_.indexOf(k)]}return S}}]),Ee}(),an=function(){function Ee(h){s(this,Ee),this.w=h.w,this.dCtx=h}return o(Ee,[{key:"getxAxisLabelsCoords",value:function(){var h,p=this.w,S=p.globals.labels.slice();if(p.config.xaxis.convertedCatToNumeric&&S.length===0&&(S=p.globals.categoryLabels),p.globals.timescaleLabels.length>0){var _=this.getxAxisTimeScaleLabelsCoords();h={width:_.width,height:_.height},p.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends=p.config.legend.position!=="left"&&p.config.legend.position!=="right"||p.config.legend.floating?0:this.dCtx.lgRect.width;var k=p.globals.xLabelFormatter,I=F.getLargestStringFromArr(S),B=this.dCtx.dimHelpers.getLargestStringFromMultiArr(I,S);p.globals.isBarHorizontal&&(B=I=p.globals.yAxisScale[0].result.reduce(function(ke,Me){return ke.length>Me.length?ke:Me},0));var G=new te(this.dCtx.ctx),re=I;I=G.xLabelFormat(k,I,re,{i:void 0,dateFormatter:new K(this.dCtx.ctx).formatDate,w:p}),B=G.xLabelFormat(k,B,re,{i:void 0,dateFormatter:new K(this.dCtx.ctx).formatDate,w:p}),(p.config.xaxis.convertedCatToNumeric&&I===void 0||String(I).trim()==="")&&(B=I="1");var ce=new z(this.dCtx.ctx),ue=ce.getTextRects(I,p.config.xaxis.labels.style.fontSize),ge=ue;if(I!==B&&(ge=ce.getTextRects(B,p.config.xaxis.labels.style.fontSize)),(h={width:ue.width>=ge.width?ue.width:ge.width,height:ue.height>=ge.height?ue.height:ge.height}).width*S.length>p.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&p.config.xaxis.labels.rotate!==0||p.config.xaxis.labels.rotateAlways){if(!p.globals.isBarHorizontal){p.globals.rotateXLabels=!0;var Ae=function(ke){return ce.getTextRects(ke,p.config.xaxis.labels.style.fontSize,p.config.xaxis.labels.style.fontFamily,"rotate(".concat(p.config.xaxis.labels.rotate," 0 0)"),!1)};ue=Ae(I),I!==B&&(ge=Ae(B)),h.height=(ue.height>ge.height?ue.height:ge.height)/1.5,h.width=ue.width>ge.width?ue.width:ge.width}}else p.globals.rotateXLabels=!1}return p.config.xaxis.labels.show||(h={width:0,height:0}),{width:h.width,height:h.height}}},{key:"getxAxisGroupLabelsCoords",value:function(){var h,p=this.w;if(!p.globals.hasXaxisGroups)return{width:0,height:0};var S,_=((h=p.config.xaxis.group.style)===null||h===void 0?void 0:h.fontSize)||p.config.xaxis.labels.style.fontSize,k=p.globals.groups.map(function(ue){return ue.title}),I=F.getLargestStringFromArr(k),B=this.dCtx.dimHelpers.getLargestStringFromMultiArr(I,k),G=new z(this.dCtx.ctx),re=G.getTextRects(I,_),ce=re;return I!==B&&(ce=G.getTextRects(B,_)),S={width:re.width>=ce.width?re.width:ce.width,height:re.height>=ce.height?re.height:ce.height},p.config.xaxis.labels.show||(S={width:0,height:0}),{width:S.width,height:S.height}}},{key:"getxAxisTitleCoords",value:function(){var h=this.w,p=0,S=0;if(h.config.xaxis.title.text!==void 0){var _=new z(this.dCtx.ctx).getTextRects(h.config.xaxis.title.text,h.config.xaxis.title.style.fontSize);p=_.width,S=_.height}return{width:p,height:S}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var h,p=this.w;this.dCtx.timescaleLabels=p.globals.timescaleLabels.slice();var S=this.dCtx.timescaleLabels.map(function(k){return k.value}),_=S.reduce(function(k,I){return k===void 0?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):k.length>I.length?k:I},0);return 1.05*(h=new z(this.dCtx.ctx).getTextRects(_,p.config.xaxis.labels.style.fontSize)).width*S.length>p.globals.gridWidth&&p.config.xaxis.labels.rotate!==0&&(p.globals.overlappingXLabels=!0),h}},{key:"additionalPaddingXLabels",value:function(h){var p=this,S=this.w,_=S.globals,k=S.config,I=k.xaxis.type,B=h.width;_.skipLastTimelinelabel=!1,_.skipFirstTimelinelabel=!1;var G=S.config.yaxis[0].opposite&&S.globals.isBarHorizontal,re=function(ce,ue){k.yaxis.length>1&&function(ge){return _.collapsedSeriesIndices.indexOf(ge)!==-1}(ue)||function(ge){if(p.dCtx.timescaleLabels&&p.dCtx.timescaleLabels.length){var Ae=p.dCtx.timescaleLabels[0],ke=p.dCtx.timescaleLabels[p.dCtx.timescaleLabels.length-1].position+B/1.75-p.dCtx.yAxisWidthRight,Me=Ae.position-B/1.75+p.dCtx.yAxisWidthLeft,qe=S.config.legend.position==="right"&&p.dCtx.lgRect.width>0?p.dCtx.lgRect.width:0;ke>_.svgWidth-_.translateX-qe&&(_.skipLastTimelinelabel=!0),Me<-(ge.show&&!ge.floating||k.chart.type!=="bar"&&k.chart.type!=="candlestick"&&k.chart.type!=="rangeBar"&&k.chart.type!=="boxPlot"?10:B/1.75)&&(_.skipFirstTimelinelabel=!0)}else I==="datetime"?p.dCtx.gridPad.right<B&&!_.rotateXLabels&&(_.skipLastTimelinelabel=!0):I!=="datetime"&&p.dCtx.gridPad.right<B/2-p.dCtx.yAxisWidthRight&&!_.rotateXLabels&&!S.config.xaxis.labels.trim&&(p.dCtx.xPadRight=B/2+1)}(ce)};k.yaxis.forEach(function(ce,ue){G?(p.dCtx.gridPad.left<B&&(p.dCtx.xPadLeft=B/2+1),p.dCtx.xPadRight=B/2+1):re(ce,ue)})}}]),Ee}(),Jt=function(){function Ee(h){s(this,Ee),this.w=h.w,this.dCtx=h}return o(Ee,[{key:"getyAxisLabelsCoords",value:function(){var h=this,p=this.w,S=[],_=10,k=new fe(this.dCtx.ctx);return p.config.yaxis.map(function(I,B){var G={seriesIndex:B,dataPointIndex:-1,w:p},re=p.globals.yAxisScale[B],ce=0;if(!k.isYAxisHidden(B)&&I.labels.show&&I.labels.minWidth!==void 0&&(ce=I.labels.minWidth),!k.isYAxisHidden(B)&&I.labels.show&&re.result.length){var ue=p.globals.yLabelFormatters[B],ge=re.niceMin===Number.MIN_VALUE?0:re.niceMin,Ae=re.result.reduce(function(Se,$e){var Ue,_e;return((Ue=String(ue(Se,G)))===null||Ue===void 0?void 0:Ue.length)>((_e=String(ue($e,G)))===null||_e===void 0?void 0:_e.length)?Se:$e},ge),ke=Ae=ue(Ae,G);if(Ae!==void 0&&Ae.length!==0||(Ae=re.niceMax),p.globals.isBarHorizontal){_=0;var Me=p.globals.labels.slice();Ae=F.getLargestStringFromArr(Me),Ae=ue(Ae,{seriesIndex:B,dataPointIndex:-1,w:p}),ke=h.dCtx.dimHelpers.getLargestStringFromMultiArr(Ae,Me)}var qe=new z(h.dCtx.ctx),Fe="rotate(".concat(I.labels.rotate," 0 0)"),at=qe.getTextRects(Ae,I.labels.style.fontSize,I.labels.style.fontFamily,Fe,!1),ie=at;Ae!==ke&&(ie=qe.getTextRects(ke,I.labels.style.fontSize,I.labels.style.fontFamily,Fe,!1)),S.push({width:(ce>ie.width||ce>at.width?ce:ie.width>at.width?ie.width:at.width)+_,height:ie.height>at.height?ie.height:at.height})}else S.push({width:0,height:0})}),S}},{key:"getyAxisTitleCoords",value:function(){var h=this,p=this.w,S=[];return p.config.yaxis.map(function(_,k){if(_.show&&_.title.text!==void 0){var I=new z(h.dCtx.ctx),B="rotate(".concat(_.title.rotate," 0 0)"),G=I.getTextRects(_.title.text,_.title.style.fontSize,_.title.style.fontFamily,B,!1);S.push({width:G.width,height:G.height})}else S.push({width:0,height:0})}),S}},{key:"getTotalYAxisWidth",value:function(){var h=this.w,p=0,S=0,_=0,k=h.globals.yAxisScale.length>1?10:0,I=new fe(this.dCtx.ctx),B=function(G,re){var ce=h.config.yaxis[re].floating,ue=0;G.width>0&&!ce?(ue=G.width+k,function(ge){return h.globals.ignoreYAxisIndexes.indexOf(ge)>-1}(re)&&(ue=ue-G.width-k)):ue=ce||I.isYAxisHidden(re)?0:5,h.config.yaxis[re].opposite?_+=ue:S+=ue,p+=ue};return h.globals.yLabelsCoords.map(function(G,re){B(G,re)}),h.globals.yTitleCoords.map(function(G,re){B(G,re)}),h.globals.isBarHorizontal&&!h.config.yaxis[0].floating&&(p=h.globals.yLabelsCoords[0].width+h.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=S,this.dCtx.yAxisWidthRight=_,p}}]),Ee}(),Ye=function(){function Ee(h){s(this,Ee),this.w=h.w,this.dCtx=h}return o(Ee,[{key:"gridPadForColumnsInNumericAxis",value:function(h){var p=this.w,S=p.config,_=p.globals;if(_.noData||_.collapsedSeries.length+_.ancillaryCollapsedSeries.length===S.series.length)return 0;var k=function(Ae){return["bar","rangeBar","candlestick","boxPlot"].includes(Ae)},I=S.chart.type,B=0,G=k(I)?S.series.length:1;_.comboBarCount>0&&(G=_.comboBarCount),_.collapsedSeries.forEach(function(Ae){k(Ae.type)&&(G-=1)}),S.chart.stacked&&(G=1);var re=k(I)||_.comboBarCount>0,ce=Math.abs(_.initialMaxX-_.initialMinX);if(re&&_.isXNumeric&&!_.isBarHorizontal&&G>0&&ce!==0){ce<=3&&(ce=_.dataPoints);var ue=ce/h,ge=_.minXDiff&&_.minXDiff/ue>0?_.minXDiff/ue:0;ge>h/2&&(ge/=2),(B=ge*parseInt(S.plotOptions.bar.columnWidth,10)/100)<1&&(B=1),_.barPadForNumericAxis=B}return B}},{key:"gridPadFortitleSubtitle",value:function(){var h=this,p=this.w,S=p.globals,_=this.dCtx.isSparkline||!S.axisCharts?0:10;["title","subtitle"].forEach(function(B){p.config[B].text!==void 0?_+=p.config[B].margin:_+=h.dCtx.isSparkline||!S.axisCharts?0:5}),!p.config.legend.show||p.config.legend.position!=="bottom"||p.config.legend.floating||S.axisCharts||(_+=10);var k=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),I=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");S.gridHeight-=k.height+I.height+_,S.translateY+=k.height+I.height+_}},{key:"setGridXPosForDualYAxis",value:function(h,p){var S=this.w,_=new fe(this.dCtx.ctx);S.config.yaxis.forEach(function(k,I){S.globals.ignoreYAxisIndexes.indexOf(I)!==-1||k.floating||_.isYAxisHidden(I)||(k.opposite&&(S.globals.translateX-=p[I].width+h[I].width+parseInt(k.labels.style.fontSize,10)/1.2+12),S.globals.translateX<2&&(S.globals.translateX=2))})}}]),Ee}(),Je=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new Xt(this),this.dimYAxis=new Jt(this),this.dimXAxis=new an(this),this.dimGrid=new Ye(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return o(Ee,[{key:"plotCoords",value:function(){var h=this,p=this.w,S=p.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};var _=Array.isArray(p.config.stroke.width)?Math.max.apply(Math,N(p.config.stroke.width)):p.config.stroke.width;this.isSparkline&&((p.config.markers.discrete.length>0||p.config.markers.size>0)&&Object.entries(this.gridPad).forEach(function(I){var B=C(I,2),G=B[0],re=B[1];h.gridPad[G]=Math.max(re,h.w.globals.markers.largestSize/1.5)}),this.gridPad.top=Math.max(_/2,this.gridPad.top),this.gridPad.bottom=Math.max(_/2,this.gridPad.bottom)),S.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),S.gridHeight=S.gridHeight-this.gridPad.top-this.gridPad.bottom,S.gridWidth=S.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var k=this.dimGrid.gridPadForColumnsInNumericAxis(S.gridWidth);S.gridWidth=S.gridWidth-2*k,S.translateX=S.translateX+this.gridPad.left+this.xPadLeft+(k>0?k:0),S.translateY=S.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var h=this,p=this.w,S=p.globals,_=this.dimYAxis.getyAxisLabelsCoords(),k=this.dimYAxis.getyAxisTitleCoords();S.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),p.globals.yLabelsCoords=[],p.globals.yTitleCoords=[],p.config.yaxis.map(function(Ae,ke){p.globals.yLabelsCoords.push({width:_[ke].width,index:ke}),p.globals.yTitleCoords.push({width:k[ke].width,index:ke})}),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var I=this.dimXAxis.getxAxisLabelsCoords(),B=this.dimXAxis.getxAxisGroupLabelsCoords(),G=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(I,G,B),S.translateXAxisY=p.globals.rotateXLabels?this.xAxisHeight/8:-4,S.translateXAxisX=p.globals.rotateXLabels&&p.globals.isXNumeric&&p.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,p.globals.isBarHorizontal&&(S.rotateXLabels=!1,S.translateXAxisY=parseInt(p.config.xaxis.labels.style.fontSize,10)/1.5*-1),S.translateXAxisY=S.translateXAxisY+p.config.xaxis.labels.offsetY,S.translateXAxisX=S.translateXAxisX+p.config.xaxis.labels.offsetX;var re=this.yAxisWidth,ce=this.xAxisHeight;S.xAxisLabelsHeight=this.xAxisHeight-G.height,S.xAxisGroupLabelsHeight=S.xAxisLabelsHeight-I.height,S.xAxisLabelsWidth=this.xAxisWidth,S.xAxisHeight=this.xAxisHeight;var ue=10;(p.config.chart.type==="radar"||this.isSparkline)&&(re=0,ce=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||p.config.chart.type==="treemap")&&(re=0,ce=0,ue=0),this.isSparkline||p.config.chart.type==="treemap"||this.dimXAxis.additionalPaddingXLabels(I);var ge=function(){S.translateX=re+h.datalabelsCoords.width,S.gridHeight=S.svgHeight-h.lgRect.height-ce-(h.isSparkline||p.config.chart.type==="treemap"?0:p.globals.rotateXLabels?10:15),S.gridWidth=S.svgWidth-re-2*h.datalabelsCoords.width};switch(p.config.xaxis.position==="top"&&(ue=S.xAxisHeight-p.config.xaxis.axisTicks.height-5),p.config.legend.position){case"bottom":S.translateY=ue,ge();break;case"top":S.translateY=this.lgRect.height+ue,ge();break;case"left":S.translateY=ue,S.translateX=this.lgRect.width+re+this.datalabelsCoords.width,S.gridHeight=S.svgHeight-ce-12,S.gridWidth=S.svgWidth-this.lgRect.width-re-2*this.datalabelsCoords.width;break;case"right":S.translateY=ue,S.translateX=re+this.datalabelsCoords.width,S.gridHeight=S.svgHeight-ce-12,S.gridWidth=S.svgWidth-this.lgRect.width-re-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(k,_),new Be(this.ctx).setYAxisXPosition(_,k)}},{key:"setDimensionsForNonAxisCharts",value:function(){var h=this.w,p=h.globals,S=h.config,_=0;h.config.legend.show&&!h.config.legend.floating&&(_=20);var k=S.chart.type==="pie"||S.chart.type==="polarArea"||S.chart.type==="donut"?"pie":"radialBar",I=S.plotOptions[k].offsetY,B=S.plotOptions[k].offsetX;if(!S.legend.show||S.legend.floating){p.gridHeight=p.svgHeight;var G=p.dom.elWrap.getBoundingClientRect().width;return p.gridWidth=Math.min(G,p.gridHeight),p.translateY=I,void(p.translateX=B+(p.svgWidth-p.gridWidth)/2)}switch(S.legend.position){case"bottom":p.gridHeight=p.svgHeight-this.lgRect.height,p.gridWidth=p.svgWidth,p.translateY=I-10,p.translateX=B+(p.svgWidth-p.gridWidth)/2;break;case"top":p.gridHeight=p.svgHeight-this.lgRect.height,p.gridWidth=p.svgWidth,p.translateY=this.lgRect.height+I+10,p.translateX=B+(p.svgWidth-p.gridWidth)/2;break;case"left":p.gridWidth=p.svgWidth-this.lgRect.width-_,p.gridHeight=S.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=I,p.translateX=B+this.lgRect.width+_;break;case"right":p.gridWidth=p.svgWidth-this.lgRect.width-_-5,p.gridHeight=S.chart.height!=="auto"?p.svgHeight:p.gridWidth,p.translateY=I,p.translateX=B+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(h,p,S){var _=this.w,k=_.globals.hasXaxisGroups?2:1,I=S.height+h.height+p.height,B=_.globals.isMultiLineX?1.2:_.globals.LINE_HEIGHT_RATIO,G=_.globals.rotateXLabels?22:10,re=_.globals.rotateXLabels&&_.config.legend.position==="bottom"?10:0;this.xAxisHeight=I*B+k*G+re,this.xAxisWidth=h.width,this.xAxisHeight-p.height>_.config.xaxis.labels.maxHeight&&(this.xAxisHeight=_.config.xaxis.labels.maxHeight),_.config.xaxis.labels.minHeight&&this.xAxisHeight<_.config.xaxis.labels.minHeight&&(this.xAxisHeight=_.config.xaxis.labels.minHeight),_.config.xaxis.floating&&(this.xAxisHeight=0);var ce=0,ue=0;_.config.yaxis.forEach(function(ge){ce+=ge.labels.minWidth,ue+=ge.labels.maxWidth}),this.yAxisWidth<ce&&(this.yAxisWidth=ce),this.yAxisWidth>ue&&(this.yAxisWidth=ue)}}]),Ee}(),It=function(){function Ee(h){s(this,Ee),this.w=h.w,this.lgCtx=h}return o(Ee,[{key:"getLegendStyles",value:function(){var h,p,S,_=document.createElement("style");_.setAttribute("type","text/css");var k=((h=this.lgCtx.ctx)===null||h===void 0||(p=h.opts)===null||p===void 0||(S=p.chart)===null||S===void 0?void 0:S.nonce)||this.w.config.chart.nonce;k&&_.setAttribute("nonce",k);var I=document.createTextNode(`
.apexcharts-flip-y {
transform: scaleY(-1) translateY(-100%);
transform-origin: top;
transform-box: fill-box;
}
.apexcharts-flip-x {
transform: scaleX(-1);
transform-origin: center;
transform-box: fill-box;
}
.apexcharts-legend {
display: flex;
overflow: auto;
padding: 0 10px;
}
.apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {
flex-wrap: wrap
}
.apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {
flex-direction: column;
bottom: 0;
}
.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {
justify-content: flex-start;
}
.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {
justify-content: center;
}
.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {
justify-content: flex-end;
}
.apexcharts-legend-series {
cursor: pointer;
line-height: normal;
display: flex;
align-items: center;
}
.apexcharts-legend-text {
position: relative;
font-size: 14px;
}
.apexcharts-legend-text *, .apexcharts-legend-marker * {
pointer-events: none;
}
.apexcharts-legend-marker {
position: relative;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
margin-right: 1px;
}
.apexcharts-legend-series.apexcharts-no-click {
cursor: auto;
}
.apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {
display: none !important;
}
.apexcharts-inactive-legend {
opacity: 0.45;
}`);return _.appendChild(I),_}},{key:"getLegendDimensions",value:function(){var h=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),p=h.width;return{clwh:h.height,clww:p}}},{key:"appendToForeignObject",value:function(){this.w.globals.dom.elLegendForeign.appendChild(this.getLegendStyles())}},{key:"toggleDataSeries",value:function(h,p){var S=this,_=this.w;if(_.globals.axisCharts||_.config.chart.type==="radialBar"){_.globals.resized=!0;var k=null,I=null;_.globals.risingSeries=[],_.globals.axisCharts?(k=_.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(h,"']")),I=parseInt(k.getAttribute("data:realIndex"),10)):(k=_.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(h+1,"']")),I=parseInt(k.getAttribute("rel"),10)-1),p?[{cs:_.globals.collapsedSeries,csi:_.globals.collapsedSeriesIndices},{cs:_.globals.ancillaryCollapsedSeries,csi:_.globals.ancillaryCollapsedSeriesIndices}].forEach(function(ce){S.riseCollapsedSeries(ce.cs,ce.csi,I)}):this.hideSeries({seriesEl:k,realIndex:I})}else{var B=_.globals.dom.Paper.select(" .apexcharts-series[rel='".concat(h+1,"'] path")),G=_.config.chart.type;if(G==="pie"||G==="polarArea"||G==="donut"){var re=_.config.plotOptions.pie.donut.labels;new z(this.lgCtx.ctx).pathMouseDown(B.members[0],null),this.lgCtx.ctx.pie.printDataLabelsInner(B.members[0].node,re)}B.fire("click")}}},{key:"getSeriesAfterCollapsing",value:function(h){var p=h.realIndex,S=this.w,_=S.globals,k=F.clone(S.config.series);if(_.axisCharts){var I=S.config.yaxis[_.seriesYAxisReverseMap[p]],B={index:p,data:k[p].data.slice(),type:k[p].type||S.config.chart.type};if(I&&I.show&&I.showAlways)_.ancillaryCollapsedSeriesIndices.indexOf(p)<0&&(_.ancillaryCollapsedSeries.push(B),_.ancillaryCollapsedSeriesIndices.push(p));else if(_.collapsedSeriesIndices.indexOf(p)<0){_.collapsedSeries.push(B),_.collapsedSeriesIndices.push(p);var G=_.risingSeries.indexOf(p);_.risingSeries.splice(G,1)}}else _.collapsedSeries.push({index:p,data:k[p]}),_.collapsedSeriesIndices.push(p);return _.allSeriesCollapsed=_.collapsedSeries.length+_.ancillaryCollapsedSeries.length===S.config.series.length,this._getSeriesBasedOnCollapsedState(k)}},{key:"hideSeries",value:function(h){for(var p=h.seriesEl,S=h.realIndex,_=this.w,k=this.getSeriesAfterCollapsing({realIndex:S}),I=p.childNodes,B=0;B<I.length;B++)I[B].classList.contains("apexcharts-series-markers-wrap")&&(I[B].classList.contains("apexcharts-hide")?I[B].classList.remove("apexcharts-hide"):I[B].classList.add("apexcharts-hide"));this.lgCtx.ctx.updateHelpers._updateSeries(k,_.config.chart.animations.dynamicAnimation.enabled)}},{key:"riseCollapsedSeries",value:function(h,p,S){var _=this.w,k=F.clone(_.config.series);if(h.length>0){for(var I=0;I<h.length;I++)h[I].index===S&&(_.globals.axisCharts?k[S].data=h[I].data.slice():k[S]=h[I].data,k[S].hidden=!1,h.splice(I,1),p.splice(I,1),_.globals.risingSeries.push(S));k=this._getSeriesBasedOnCollapsedState(k),this.lgCtx.ctx.updateHelpers._updateSeries(k,_.config.chart.animations.dynamicAnimation.enabled)}}},{key:"_getSeriesBasedOnCollapsedState",value:function(h){var p=this.w,S=0;return p.globals.axisCharts?h.forEach(function(_,k){p.globals.collapsedSeriesIndices.indexOf(k)<0&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(k)<0||(h[k].data=[],S++)}):h.forEach(function(_,k){!p.globals.collapsedSeriesIndices.indexOf(k)<0&&(h[k]=0,S++)}),p.globals.allSeriesCollapsed=S===h.length,h}}]),Ee}(),hn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.isBarsDistributed=this.w.config.chart.type==="bar"&&this.w.config.plotOptions.bar.distributed&&this.w.config.series.length===1,this.legendHelpers=new It(this)}return o(Ee,[{key:"init",value:function(){var h=this.w,p=h.globals,S=h.config,_=S.legend.showForSingleSeries&&p.series.length===1||this.isBarsDistributed||p.series.length>1;if(this.legendHelpers.appendToForeignObject(),(_||!p.axisCharts)&&S.legend.show){for(;p.dom.elLegendWrap.firstChild;)p.dom.elLegendWrap.removeChild(p.dom.elLegendWrap.firstChild);this.drawLegends(),S.legend.position==="bottom"||S.legend.position==="top"?this.legendAlignHorizontal():S.legend.position!=="right"&&S.legend.position!=="left"||this.legendAlignVertical()}}},{key:"createLegendMarker",value:function(h){var p=h.i,S=h.fillcolor,_=this.w,k=document.createElement("span");k.classList.add("apexcharts-legend-marker");var I=_.config.legend.markers.shape||_.config.markers.shape,B=I;Array.isArray(I)&&(B=I[p]);var G=Array.isArray(_.config.legend.markers.size)?parseFloat(_.config.legend.markers.size[p]):parseFloat(_.config.legend.markers.size),re=Array.isArray(_.config.legend.markers.offsetX)?parseFloat(_.config.legend.markers.offsetX[p]):parseFloat(_.config.legend.markers.offsetX),ce=Array.isArray(_.config.legend.markers.offsetY)?parseFloat(_.config.legend.markers.offsetY[p]):parseFloat(_.config.legend.markers.offsetY),ue=Array.isArray(_.config.legend.markers.strokeWidth)?parseFloat(_.config.legend.markers.strokeWidth[p]):parseFloat(_.config.legend.markers.strokeWidth),ge=k.style;if(ge.height=2*(G+ue)+"px",ge.width=2*(G+ue)+"px",ge.left=re+"px",ge.top=ce+"px",_.config.legend.markers.customHTML)ge.background="transparent",ge.color=S[p],Array.isArray(_.config.legend.markers.customHTML)?_.config.legend.markers.customHTML[p]&&(k.innerHTML=_.config.legend.markers.customHTML[p]()):k.innerHTML=_.config.legend.markers.customHTML();else{var Ae=new be(this.ctx).getMarkerConfig({cssClass:"apexcharts-legend-marker apexcharts-marker apexcharts-marker-".concat(B),seriesIndex:p,strokeWidth:ue,size:G}),ke=SVG(k).size("100%","100%"),Me=new z(this.ctx).drawMarker(0,0,y(y({},Ae),{},{pointFillColor:Array.isArray(S)?S[p]:Ae.pointFillColor,shape:B}));SVG.select(".apexcharts-legend-marker.apexcharts-marker").members.forEach(function(qe){qe.node.classList.contains("apexcharts-marker-triangle")?qe.node.style.transform="translate(50%, 45%)":qe.node.style.transform="translate(50%, 50%)"}),ke.add(Me)}return k}},{key:"drawLegends",value:function(){var h=this,p=this.w,S=p.config.legend.fontFamily,_=p.globals.seriesNames,k=p.config.legend.markers.fillColors?p.config.legend.markers.fillColors.slice():p.globals.colors.slice();if(p.config.chart.type==="heatmap"){var I=p.config.plotOptions.heatmap.colorScale.ranges;_=I.map(function($e){return $e.name?$e.name:$e.from+" - "+$e.to}),k=I.map(function($e){return $e.color})}else this.isBarsDistributed&&(_=p.globals.labels.slice());p.config.legend.customLegendItems.length&&(_=p.config.legend.customLegendItems);for(var B=p.globals.legendFormatter,G=p.config.legend.inverseOrder,re=G?_.length-1:0;G?re>=0:re<=_.length-1;G?re--:re++){var ce,ue=B(_[re],{seriesIndex:re,w:p}),ge=!1,Ae=!1;if(p.globals.collapsedSeries.length>0)for(var ke=0;ke<p.globals.collapsedSeries.length;ke++)p.globals.collapsedSeries[ke].index===re&&(ge=!0);if(p.globals.ancillaryCollapsedSeriesIndices.length>0)for(var Me=0;Me<p.globals.ancillaryCollapsedSeriesIndices.length;Me++)p.globals.ancillaryCollapsedSeriesIndices[Me]===re&&(Ae=!0);var qe=this.createLegendMarker({i:re,fillcolor:k});z.setAttrs(qe,{rel:re+1,"data:collapsed":ge||Ae}),(ge||Ae)&&qe.classList.add("apexcharts-inactive-legend");var Fe=document.createElement("div"),at=document.createElement("span");at.classList.add("apexcharts-legend-text"),at.innerHTML=Array.isArray(ue)?ue.join(" "):ue;var ie=p.config.legend.labels.useSeriesColors?p.globals.colors[re]:Array.isArray(p.config.legend.labels.colors)?(ce=p.config.legend.labels.colors)===null||ce===void 0?void 0:ce[re]:p.config.legend.labels.colors;ie||(ie=p.config.chart.foreColor),at.style.color=ie,at.style.fontSize=parseFloat(p.config.legend.fontSize)+"px",at.style.fontWeight=p.config.legend.fontWeight,at.style.fontFamily=S||p.config.chart.fontFamily,z.setAttrs(at,{rel:re+1,i:re,"data:default-text":encodeURIComponent(ue),"data:collapsed":ge||Ae}),Fe.appendChild(qe),Fe.appendChild(at);var Se=new X(this.ctx);p.config.legend.showForZeroSeries||Se.getSeriesTotalByIndex(re)===0&&Se.seriesHaveSameValues(re)&&!Se.isSeriesNull(re)&&p.globals.collapsedSeriesIndices.indexOf(re)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(re)===-1&&Fe.classList.add("apexcharts-hidden-zero-series"),p.config.legend.showForNullSeries||Se.isSeriesNull(re)&&p.globals.collapsedSeriesIndices.indexOf(re)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(re)===-1&&Fe.classList.add("apexcharts-hidden-null-series"),p.globals.dom.elLegendWrap.appendChild(Fe),p.globals.dom.elLegendWrap.classList.add("apexcharts-align-".concat(p.config.legend.horizontalAlign)),p.globals.dom.elLegendWrap.classList.add("apx-legend-position-"+p.config.legend.position),Fe.classList.add("apexcharts-legend-series"),Fe.style.margin="".concat(p.config.legend.itemMargin.vertical,"px ").concat(p.config.legend.itemMargin.horizontal,"px"),p.globals.dom.elLegendWrap.style.width=p.config.legend.width?p.config.legend.width+"px":"",p.globals.dom.elLegendWrap.style.height=p.config.legend.height?p.config.legend.height+"px":"",z.setAttrs(Fe,{rel:re+1,seriesName:F.escapeString(_[re]),"data:collapsed":ge||Ae}),(ge||Ae)&&Fe.classList.add("apexcharts-inactive-legend"),p.config.legend.onItemClick.toggleDataSeries||Fe.classList.add("apexcharts-no-click")}p.globals.dom.elWrap.addEventListener("click",h.onLegendClick,!0),p.config.legend.onItemHover.highlightDataSeries&&p.config.legend.customLegendItems.length===0&&(p.globals.dom.elWrap.addEventListener("mousemove",h.onLegendHovered,!0),p.globals.dom.elWrap.addEventListener("mouseout",h.onLegendHovered,!0))}},{key:"setLegendWrapXY",value:function(h,p){var S=this.w,_=S.globals.dom.elLegendWrap,k=_.clientHeight,I=0,B=0;if(S.config.legend.position==="bottom")B=S.globals.svgHeight-Math.min(k,S.globals.svgHeight/2)-5;else if(S.config.legend.position==="top"){var G=new Je(this.ctx),re=G.dimHelpers.getTitleSubtitleCoords("title").height,ce=G.dimHelpers.getTitleSubtitleCoords("subtitle").height;B=(re>0?re-10:0)+(ce>0?ce-10:0)}_.style.position="absolute",I=I+h+S.config.legend.offsetX,B=B+p+S.config.legend.offsetY,_.style.left=I+"px",_.style.top=B+"px",S.config.legend.position==="right"&&(_.style.left="auto",_.style.right=25+S.config.legend.offsetX+"px"),["width","height"].forEach(function(ue){_.style[ue]&&(_.style[ue]=parseInt(S.config.legend[ue],10)+"px")})}},{key:"legendAlignHorizontal",value:function(){var h=this.w;h.globals.dom.elLegendWrap.style.right=0;var p=new Je(this.ctx),S=p.dimHelpers.getTitleSubtitleCoords("title"),_=p.dimHelpers.getTitleSubtitleCoords("subtitle"),k=0;h.config.legend.position==="top"&&(k=S.height+_.height+h.config.title.margin+h.config.subtitle.margin-10),this.setLegendWrapXY(20,k)}},{key:"legendAlignVertical",value:function(){var h=this.w,p=this.legendHelpers.getLegendDimensions(),S=0;h.config.legend.position==="left"&&(S=20),h.config.legend.position==="right"&&(S=h.globals.svgWidth-p.clww-10),this.setLegendWrapXY(S,20)}},{key:"onLegendHovered",value:function(h){var p=this.w,S=h.target.classList.contains("apexcharts-legend-series")||h.target.classList.contains("apexcharts-legend-text")||h.target.classList.contains("apexcharts-legend-marker");if(p.config.chart.type==="heatmap"||this.isBarsDistributed){if(S){var _=parseInt(h.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,_,this.w]),new Re(this.ctx).highlightRangeInSeries(h,h.target)}}else!h.target.classList.contains("apexcharts-inactive-legend")&&S&&new Re(this.ctx).toggleSeriesOnHover(h,h.target)}},{key:"onLegendClick",value:function(h){var p=this.w;if(!p.config.legend.customLegendItems.length&&(h.target.classList.contains("apexcharts-legend-series")||h.target.classList.contains("apexcharts-legend-text")||h.target.classList.contains("apexcharts-legend-marker"))){var S=parseInt(h.target.getAttribute("rel"),10)-1,_=h.target.getAttribute("data:collapsed")==="true",k=this.w.config.chart.events.legendClick;typeof k=="function"&&k(this.ctx,S,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,S,this.w]);var I=this.w.config.legend.markers.onClick;typeof I=="function"&&h.target.classList.contains("apexcharts-legend-marker")&&(I(this.ctx,S,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,S,this.w])),p.config.chart.type!=="treemap"&&p.config.chart.type!=="heatmap"&&!this.isBarsDistributed&&p.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(S,_)}}}]),Ee}(),Yt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w;var p=this.w;this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=p.globals.minX,this.maxX=p.globals.maxX}return o(Ee,[{key:"createToolbar",value:function(){var h=this,p=this.w,S=function(){return document.createElement("div")},_=S();if(_.setAttribute("class","apexcharts-toolbar"),_.style.top=p.config.chart.toolbar.offsetY+"px",_.style.right=3-p.config.chart.toolbar.offsetX+"px",p.globals.dom.elWrap.appendChild(_),this.elZoom=S(),this.elZoomIn=S(),this.elZoomOut=S(),this.elPan=S(),this.elSelection=S(),this.elZoomReset=S(),this.elMenuIcon=S(),this.elMenu=S(),this.elCustomIcons=[],this.t=p.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var k=0;k<this.t.customIcons.length;k++)this.elCustomIcons.push(S());var I=[],B=function(ue,ge,Ae){var ke=ue.toLowerCase();h.t[ke]&&p.config.chart.zoom.enabled&&I.push({el:ge,icon:typeof h.t[ke]=="string"?h.t[ke]:Ae,title:h.localeValues[ue],class:"apexcharts-".concat(ke,"-icon")})};B("zoomIn",this.elZoomIn,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
</svg>
`),B("zoomOut",this.elZoomOut,`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M7 11v2h10v-2H7zm5-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
</svg>
`);var G=function(ue){h.t[ue]&&p.config.chart[ue].enabled&&I.push({el:ue==="zoom"?h.elZoom:h.elSelection,icon:typeof h.t[ue]=="string"?h.t[ue]:ue==="zoom"?`<svg xmlns="http://www.w3.org/2000/svg" fill="#000000" height="24" viewBox="0 0 24 24" width="24">
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"/>
</svg>`:`<svg fill="#6E8192" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 5h2V3c-1.1 0-2 .9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-.9-2-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2z"/>
</svg>`,title:h.localeValues[ue==="zoom"?"selectionZoom":"selection"],class:p.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(ue,"-icon")})};G("zoom"),G("selection"),this.t.pan&&p.config.chart.zoom.enabled&&I.push({el:this.elPan,icon:typeof this.t.pan=="string"?this.t.pan:`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000" height="24" viewBox="0 0 24 24" width="24">
<defs>
<path d="M0 0h24v24H0z" id="a"/>
</defs>
<clipPath id="b">
<use overflow="visible" xlink:href="#a"/>
</clipPath>
<path clip-path="url(#b)" d="M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z"/>
</svg>`,title:this.localeValues.pan,class:p.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-pan-icon"}),B("reset",this.elZoomReset,`<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>`),this.t.download&&I.push({el:this.elMenuIcon,icon:typeof this.t.download=="string"?this.t.download:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(var re=0;re<this.elCustomIcons.length;re++)I.push({el:this.elCustomIcons[re],icon:this.t.customIcons[re].icon,title:this.t.customIcons[re].title,index:this.t.customIcons[re].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[re].class});I.forEach(function(ue,ge){ue.index&&F.moveIndexInArray(I,ge,ue.index)});for(var ce=0;ce<I.length;ce++)z.setAttrs(I[ce].el,{class:I[ce].class,title:I[ce].title}),I[ce].el.innerHTML=I[ce].icon,_.appendChild(I[ce].el);this._createHamburgerMenu(_),p.globals.zoomEnabled?this.elZoom.classList.add(this.selectedClass):p.globals.panEnabled?this.elPan.classList.add(this.selectedClass):p.globals.selectionEnabled&&this.elSelection.classList.add(this.selectedClass),this.addToolbarEventListeners()}},{key:"_createHamburgerMenu",value:function(h){this.elMenuItems=[],h.appendChild(this.elMenu),z.setAttrs(this.elMenu,{class:"apexcharts-menu"});for(var p=[{name:"exportSVG",title:this.localeValues.exportToSVG},{name:"exportPNG",title:this.localeValues.exportToPNG},{name:"exportCSV",title:this.localeValues.exportToCSV}],S=0;S<p.length;S++)this.elMenuItems.push(document.createElement("div")),this.elMenuItems[S].innerHTML=p[S].title,z.setAttrs(this.elMenuItems[S],{class:"apexcharts-menu-item ".concat(p[S].name),title:p[S].title}),this.elMenu.appendChild(this.elMenuItems[S])}},{key:"addToolbarEventListeners",value:function(){var h=this;this.elZoomReset.addEventListener("click",this.handleZoomReset.bind(this)),this.elSelection.addEventListener("click",this.toggleZoomSelection.bind(this,"selection")),this.elZoom.addEventListener("click",this.toggleZoomSelection.bind(this,"zoom")),this.elZoomIn.addEventListener("click",this.handleZoomIn.bind(this)),this.elZoomOut.addEventListener("click",this.handleZoomOut.bind(this)),this.elPan.addEventListener("click",this.togglePanning.bind(this)),this.elMenuIcon.addEventListener("click",this.toggleMenu.bind(this)),this.elMenuItems.forEach(function(S){S.classList.contains("exportSVG")?S.addEventListener("click",h.handleDownload.bind(h,"svg")):S.classList.contains("exportPNG")?S.addEventListener("click",h.handleDownload.bind(h,"png")):S.classList.contains("exportCSV")&&S.addEventListener("click",h.handleDownload.bind(h,"csv"))});for(var p=0;p<this.t.customIcons.length;p++)this.elCustomIcons[p].addEventListener("click",this.t.customIcons[p].click.bind(this,this.ctx,this.ctx.w))}},{key:"toggleZoomSelection",value:function(h){this.ctx.getSyncedCharts().forEach(function(p){p.ctx.toolbar.toggleOtherControls();var S=h==="selection"?p.ctx.toolbar.elSelection:p.ctx.toolbar.elZoom,_=h==="selection"?"selectionEnabled":"zoomEnabled";p.w.globals[_]=!p.w.globals[_],S.classList.contains(p.ctx.toolbar.selectedClass)?S.classList.remove(p.ctx.toolbar.selectedClass):S.classList.add(p.ctx.toolbar.selectedClass)})}},{key:"getToolbarIconsReference",value:function(){var h=this.w;this.elZoom||(this.elZoom=h.globals.dom.baseEl.querySelector(".apexcharts-zoom-icon")),this.elPan||(this.elPan=h.globals.dom.baseEl.querySelector(".apexcharts-pan-icon")),this.elSelection||(this.elSelection=h.globals.dom.baseEl.querySelector(".apexcharts-selection-icon"))}},{key:"enableZoomPanFromToolbar",value:function(h){this.toggleOtherControls(),h==="pan"?this.w.globals.panEnabled=!0:this.w.globals.zoomEnabled=!0;var p=h==="pan"?this.elPan:this.elZoom,S=h==="pan"?this.elZoom:this.elPan;p&&p.classList.add(this.selectedClass),S&&S.classList.remove(this.selectedClass)}},{key:"togglePanning",value:function(){this.ctx.getSyncedCharts().forEach(function(h){h.ctx.toolbar.toggleOtherControls(),h.w.globals.panEnabled=!h.w.globals.panEnabled,h.ctx.toolbar.elPan.classList.contains(h.ctx.toolbar.selectedClass)?h.ctx.toolbar.elPan.classList.remove(h.ctx.toolbar.selectedClass):h.ctx.toolbar.elPan.classList.add(h.ctx.toolbar.selectedClass)})}},{key:"toggleOtherControls",value:function(){var h=this,p=this.w;p.globals.panEnabled=!1,p.globals.zoomEnabled=!1,p.globals.selectionEnabled=!1,this.getToolbarIconsReference(),[this.elPan,this.elSelection,this.elZoom].forEach(function(S){S&&S.classList.remove(h.selectedClass)})}},{key:"handleZoomIn",value:function(){var h=this.w;h.globals.isRangeBar&&(this.minX=h.globals.minY,this.maxX=h.globals.maxY);var p=(this.minX+this.maxX)/2,S=(this.minX+p)/2,_=(this.maxX+p)/2,k=this._getNewMinXMaxX(S,_);h.globals.disableZoomIn||this.zoomUpdateOptions(k.minX,k.maxX)}},{key:"handleZoomOut",value:function(){var h=this.w;if(h.globals.isRangeBar&&(this.minX=h.globals.minY,this.maxX=h.globals.maxY),!(h.config.xaxis.type==="datetime"&&new Date(this.minX).getUTCFullYear()<1e3)){var p=(this.minX+this.maxX)/2,S=this.minX-(p-this.minX),_=this.maxX-(p-this.maxX),k=this._getNewMinXMaxX(S,_);h.globals.disableZoomOut||this.zoomUpdateOptions(k.minX,k.maxX)}}},{key:"_getNewMinXMaxX",value:function(h,p){var S=this.w.config.xaxis.convertedCatToNumeric;return{minX:S?Math.floor(h):h,maxX:S?Math.floor(p):p}}},{key:"zoomUpdateOptions",value:function(h,p){var S=this.w;if(h!==void 0||p!==void 0){if(!(S.config.xaxis.convertedCatToNumeric&&(h<1&&(h=1,p=S.globals.dataPoints),p-h<2))){var _={min:h,max:p},k=this.getBeforeZoomRange(_);k&&(_=k.xaxis);var I={xaxis:_},B=F.clone(S.globals.initialConfig.yaxis);S.config.chart.group||(I.yaxis=B),this.w.globals.zoomed=!0,this.ctx.updateHelpers._updateOptions(I,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(_,B)}}else this.handleZoomReset()}},{key:"zoomCallback",value:function(h,p){typeof this.ev.zoomed=="function"&&this.ev.zoomed(this.ctx,{xaxis:h,yaxis:p})}},{key:"getBeforeZoomRange",value:function(h,p){var S=null;return typeof this.ev.beforeZoom=="function"&&(S=this.ev.beforeZoom(this,{xaxis:h,yaxis:p})),S}},{key:"toggleMenu",value:function(){var h=this;window.setTimeout(function(){h.elMenu.classList.contains("apexcharts-menu-open")?h.elMenu.classList.remove("apexcharts-menu-open"):h.elMenu.classList.add("apexcharts-menu-open")},0)}},{key:"handleDownload",value:function(h){var p=this.w,S=new Ke(this.ctx);switch(h){case"svg":S.exportToSVG(this.ctx);break;case"png":S.exportToPng(this.ctx);break;case"csv":S.exportToCSV({series:p.config.series,columnDelimiter:p.config.chart.toolbar.export.csv.columnDelimiter})}}},{key:"handleZoomReset",value:function(h){this.ctx.getSyncedCharts().forEach(function(p){var S=p.w;if(S.globals.lastXAxis.min=S.globals.initialConfig.xaxis.min,S.globals.lastXAxis.max=S.globals.initialConfig.xaxis.max,p.updateHelpers.revertDefaultAxisMinMax(),typeof S.config.chart.events.beforeResetZoom=="function"){var _=S.config.chart.events.beforeResetZoom(p,S);_&&p.updateHelpers.revertDefaultAxisMinMax(_)}typeof S.config.chart.events.zoomed=="function"&&p.ctx.toolbar.zoomCallback({min:S.config.xaxis.min,max:S.config.xaxis.max}),S.globals.zoomed=!1;var k=p.ctx.series.emptyCollapsedSeries(F.clone(S.globals.initialSeries));p.updateHelpers._updateSeries(k,S.config.chart.animations.dynamicAnimation.enabled)})}},{key:"destroy",value:function(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null}}]),Ee}(),Rt=function(Ee){f(p,Yt);var h=c(p);function p(S){var _;return s(this,p),(_=h.call(this,S)).ctx=S,_.w=S.w,_.dragged=!1,_.graphics=new z(_.ctx),_.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend","wheel"],_.clientX=0,_.clientY=0,_.startX=0,_.endX=0,_.dragX=0,_.startY=0,_.endY=0,_.dragY=0,_.moveDirection="none",_.debounceTimer=null,_.debounceDelay=100,_.wheelDelay=400,_}return o(p,[{key:"init",value:function(S){var _=this,k=S.xyRatios,I=this.w,B=this;this.xyRatios=k,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.gridRect=I.globals.dom.baseEl.querySelector(".apexcharts-grid"),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),I.globals.dom.elGraphical.add(this.zoomRect),I.globals.dom.elGraphical.add(this.selectionRect),I.config.chart.selection.type==="x"?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:I.globals.gridWidth,maxY:I.globals.gridHeight}).on("dragmove",this.selectionDragging.bind(this,"dragging")):I.config.chart.selection.type==="y"?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:I.globals.gridWidth}).on("dragmove",this.selectionDragging.bind(this,"dragging")):this.slDraggableRect=this.selectionRect.draggable().on("dragmove",this.selectionDragging.bind(this,"dragging")),this.preselectedSelection(),this.hoverArea=I.globals.dom.baseEl.querySelector("".concat(I.globals.chartClass," .apexcharts-svg")),this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(function(G){_.hoverArea.addEventListener(G,B.svgMouseEvents.bind(B,k),{capture:!1,passive:!0})}),I.config.chart.zoom.allowMouseWheelZoom&&this.hoverArea.addEventListener("wheel",B.mouseWheelEvent.bind(B),{capture:!1,passive:!1})}},{key:"destroy",value:function(){this.slDraggableRect&&(this.slDraggableRect.draggable(!1),this.slDraggableRect.off(),this.selectionRect.off()),this.selectionRect=null,this.zoomRect=null,this.gridRect=null}},{key:"svgMouseEvents",value:function(S,_){var k=this.w,I=this,B=this.ctx.toolbar,G=k.globals.zoomEnabled?k.config.chart.zoom.type:k.config.chart.selection.type,re=k.config.chart.toolbar.autoSelected;if(_.shiftKey?(this.shiftWasPressed=!0,B.enableZoomPanFromToolbar(re==="pan"?"zoom":"pan")):this.shiftWasPressed&&(B.enableZoomPanFromToolbar(re),this.shiftWasPressed=!1),_.target){var ce,ue=_.target.classList;if(_.target.parentNode&&_.target.parentNode!==null&&(ce=_.target.parentNode.classList),!(ue.contains("apexcharts-selection-rect")||ue.contains("apexcharts-legend-marker")||ue.contains("apexcharts-legend-text")||ce&&ce.contains("apexcharts-toolbar"))){if(I.clientX=_.type==="touchmove"||_.type==="touchstart"?_.touches[0].clientX:_.type==="touchend"?_.changedTouches[0].clientX:_.clientX,I.clientY=_.type==="touchmove"||_.type==="touchstart"?_.touches[0].clientY:_.type==="touchend"?_.changedTouches[0].clientY:_.clientY,_.type==="mousedown"&&_.which===1){var ge=I.gridRect.getBoundingClientRect();I.startX=I.clientX-ge.left,I.startY=I.clientY-ge.top,I.dragged=!1,I.w.globals.mousedown=!0}if((_.type==="mousemove"&&_.which===1||_.type==="touchmove")&&(I.dragged=!0,k.globals.panEnabled?(k.globals.selection=null,I.w.globals.mousedown&&I.panDragging({context:I,zoomtype:G,xyRatios:S})):(I.w.globals.mousedown&&k.globals.zoomEnabled||I.w.globals.mousedown&&k.globals.selectionEnabled)&&(I.selection=I.selectionDrawing({context:I,zoomtype:G}))),_.type==="mouseup"||_.type==="touchend"||_.type==="mouseleave"){var Ae,ke=(Ae=I.gridRect)===null||Ae===void 0?void 0:Ae.getBoundingClientRect();ke&&I.w.globals.mousedown&&(I.endX=I.clientX-ke.left,I.endY=I.clientY-ke.top,I.dragX=Math.abs(I.endX-I.startX),I.dragY=Math.abs(I.endY-I.startY),(k.globals.zoomEnabled||k.globals.selectionEnabled)&&I.selectionDrawn({context:I,zoomtype:G}),k.globals.panEnabled&&k.config.xaxis.convertedCatToNumeric&&I.delayedPanScrolled()),k.globals.zoomEnabled&&I.hideSelectionRect(this.selectionRect),I.dragged=!1,I.w.globals.mousedown=!1}this.makeSelectionRectDraggable()}}}},{key:"mouseWheelEvent",value:function(S){var _=this,k=this.w;S.preventDefault();var I=Date.now();I-k.globals.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(S),k.globals.lastWheelExecution=I),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){I-k.globals.lastWheelExecution>_.wheelDelay&&(_.executeMouseWheelZoom(S),k.globals.lastWheelExecution=I)},this.debounceDelay)}},{key:"executeMouseWheelZoom",value:function(S){var _,k=this.w;this.minX=k.globals.isRangeBar?k.globals.minY:k.globals.minX,this.maxX=k.globals.isRangeBar?k.globals.maxY:k.globals.maxX;var I=(_=this.gridRect)===null||_===void 0?void 0:_.getBoundingClientRect();if(I){var B,G,re,ce=(S.clientX-I.left)/I.width,ue=this.minX,ge=this.maxX,Ae=ge-ue;if(S.deltaY<0){var ke=ue+ce*Ae;G=ke-(B=.5*Ae)/2,re=ke+B/2}else G=ue-(B=1.5*Ae)/2,re=ge+B/2;if(!k.globals.isRangeBar){G=Math.max(G,k.globals.initialMinX),re=Math.min(re,k.globals.initialMaxX);var Me=.01*(k.globals.initialMaxX-k.globals.initialMinX);if(re-G<Me){var qe=(G+re)/2;G=qe-Me/2,re=qe+Me/2}}var Fe=this._getNewMinXMaxX(G,re);isNaN(Fe.minX)||isNaN(Fe.maxX)||this.zoomUpdateOptions(Fe.minX,Fe.maxX)}}},{key:"makeSelectionRectDraggable",value:function(){var S=this.w;if(this.selectionRect){var _=this.selectionRect.node.getBoundingClientRect();_.width>0&&_.height>0&&this.slDraggableRect.selectize({points:"l, r",pointSize:8,pointType:"rect"}).resize({constraint:{minX:0,minY:0,maxX:S.globals.gridWidth,maxY:S.globals.gridHeight}}).on("resizing",this.selectionDragging.bind(this,"resizing"))}}},{key:"preselectedSelection",value:function(){var S=this.w,_=this.xyRatios;if(!S.globals.zoomEnabled){if(S.globals.selection!==void 0&&S.globals.selection!==null)this.drawSelectionRect(S.globals.selection);else if(S.config.chart.selection.xaxis.min!==void 0&&S.config.chart.selection.xaxis.max!==void 0){var k=(S.config.chart.selection.xaxis.min-S.globals.minX)/_.xRatio,I=S.globals.gridWidth-(S.globals.maxX-S.config.chart.selection.xaxis.max)/_.xRatio-k;S.globals.isRangeBar&&(k=(S.config.chart.selection.xaxis.min-S.globals.yAxisScale[0].niceMin)/_.invertedYRatio,I=(S.config.chart.selection.xaxis.max-S.config.chart.selection.xaxis.min)/_.invertedYRatio);var B={x:k,y:0,width:I,height:S.globals.gridHeight,translateX:0,translateY:0,selectionEnabled:!0};this.drawSelectionRect(B),this.makeSelectionRectDraggable(),typeof S.config.chart.events.selection=="function"&&S.config.chart.events.selection(this.ctx,{xaxis:{min:S.config.chart.selection.xaxis.min,max:S.config.chart.selection.xaxis.max},yaxis:{}})}}}},{key:"drawSelectionRect",value:function(S){var _=S.x,k=S.y,I=S.width,B=S.height,G=S.translateX,re=G===void 0?0:G,ce=S.translateY,ue=ce===void 0?0:ce,ge=this.w,Ae=this.zoomRect,ke=this.selectionRect;if(this.dragged||ge.globals.selection!==null){var Me={transform:"translate("+re+", "+ue+")"};ge.globals.zoomEnabled&&this.dragged&&(I<0&&(I=1),Ae.attr({x:_,y:k,width:I,height:B,fill:ge.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":ge.config.chart.zoom.zoomedArea.fill.opacity,stroke:ge.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":ge.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":ge.config.chart.zoom.zoomedArea.stroke.opacity}),z.setAttrs(Ae.node,Me)),ge.globals.selectionEnabled&&(ke.attr({x:_,y:k,width:I>0?I:0,height:B>0?B:0,fill:ge.config.chart.selection.fill.color,"fill-opacity":ge.config.chart.selection.fill.opacity,stroke:ge.config.chart.selection.stroke.color,"stroke-width":ge.config.chart.selection.stroke.width,"stroke-dasharray":ge.config.chart.selection.stroke.dashArray,"stroke-opacity":ge.config.chart.selection.stroke.opacity}),z.setAttrs(ke.node,Me))}}},{key:"hideSelectionRect",value:function(S){S&&S.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(S){var _=S.context,k=S.zoomtype,I=this.w,B=_,G=this.gridRect.getBoundingClientRect(),re=B.startX-1,ce=B.startY,ue=!1,ge=!1,Ae=B.clientX-G.left-re,ke=B.clientY-G.top-ce,Me={};return Math.abs(Ae+re)>I.globals.gridWidth?Ae=I.globals.gridWidth-re:B.clientX-G.left<0&&(Ae=re),re>B.clientX-G.left&&(ue=!0,Ae=Math.abs(Ae)),ce>B.clientY-G.top&&(ge=!0,ke=Math.abs(ke)),Me=k==="x"?{x:ue?re-Ae:re,y:0,width:Ae,height:I.globals.gridHeight}:k==="y"?{x:0,y:ge?ce-ke:ce,width:I.globals.gridWidth,height:ke}:{x:ue?re-Ae:re,y:ge?ce-ke:ce,width:Ae,height:ke},B.drawSelectionRect(Me),B.selectionDragging("resizing"),Me}},{key:"selectionDragging",value:function(S,_){var k=this,I=this.w,B=this.xyRatios,G=this.selectionRect,re=0;S==="resizing"&&(re=30);var ce=function(ge){return parseFloat(G.node.getAttribute(ge))},ue={x:ce("x"),y:ce("y"),width:ce("width"),height:ce("height")};I.globals.selection=ue,typeof I.config.chart.events.selection=="function"&&I.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout(function(){var ge,Ae,ke,Me,qe=k.gridRect.getBoundingClientRect(),Fe=G.node.getBoundingClientRect();I.globals.isRangeBar?(ge=I.globals.yAxisScale[0].niceMin+(Fe.left-qe.left)*B.invertedYRatio,Ae=I.globals.yAxisScale[0].niceMin+(Fe.right-qe.left)*B.invertedYRatio,ke=0,Me=1):(ge=I.globals.xAxisScale.niceMin+(Fe.left-qe.left)*B.xRatio,Ae=I.globals.xAxisScale.niceMin+(Fe.right-qe.left)*B.xRatio,ke=I.globals.yAxisScale[0].niceMin+(qe.bottom-Fe.bottom)*B.yRatio[0],Me=I.globals.yAxisScale[0].niceMax-(Fe.top-qe.top)*B.yRatio[0]);var at={xaxis:{min:ge,max:Ae},yaxis:{min:ke,max:Me}};I.config.chart.events.selection(k.ctx,at),I.config.chart.brush.enabled&&I.config.chart.events.brushScrolled!==void 0&&I.config.chart.events.brushScrolled(k.ctx,at)},re))}},{key:"selectionDrawn",value:function(S){var _=S.context,k=S.zoomtype,I=this.w,B=_,G=this.xyRatios,re=this.ctx.toolbar;if(B.startX>B.endX){var ce=B.startX;B.startX=B.endX,B.endX=ce}if(B.startY>B.endY){var ue=B.startY;B.startY=B.endY,B.endY=ue}var ge=void 0,Ae=void 0;I.globals.isRangeBar?(ge=I.globals.yAxisScale[0].niceMin+B.startX*G.invertedYRatio,Ae=I.globals.yAxisScale[0].niceMin+B.endX*G.invertedYRatio):(ge=I.globals.xAxisScale.niceMin+B.startX*G.xRatio,Ae=I.globals.xAxisScale.niceMin+B.endX*G.xRatio);var ke=[],Me=[];if(I.config.yaxis.forEach(function(Ue,_e){var st=I.globals.seriesYAxisMap[_e][0];ke.push(I.globals.yAxisScale[_e].niceMax-G.yRatio[st]*B.startY),Me.push(I.globals.yAxisScale[_e].niceMax-G.yRatio[st]*B.endY)}),B.dragged&&(B.dragX>10||B.dragY>10)&&ge!==Ae){if(I.globals.zoomEnabled){var qe=F.clone(I.globals.initialConfig.yaxis),Fe=F.clone(I.globals.initialConfig.xaxis);if(I.globals.zoomed=!0,I.config.xaxis.convertedCatToNumeric&&(ge=Math.floor(ge),Ae=Math.floor(Ae),ge<1&&(ge=1,Ae=I.globals.dataPoints),Ae-ge<2&&(Ae=ge+1)),k!=="xy"&&k!=="x"||(Fe={min:ge,max:Ae}),k!=="xy"&&k!=="y"||qe.forEach(function(Ue,_e){qe[_e].min=Me[_e],qe[_e].max=ke[_e]}),re){var at=re.getBeforeZoomRange(Fe,qe);at&&(Fe=at.xaxis?at.xaxis:Fe,qe=at.yaxis?at.yaxis:qe)}var ie={xaxis:Fe};I.config.chart.group||(ie.yaxis=qe),B.ctx.updateHelpers._updateOptions(ie,!1,B.w.config.chart.animations.dynamicAnimation.enabled),typeof I.config.chart.events.zoomed=="function"&&re.zoomCallback(Fe,qe)}else if(I.globals.selectionEnabled){var Se,$e=null;Se={min:ge,max:Ae},k!=="xy"&&k!=="y"||($e=F.clone(I.config.yaxis)).forEach(function(Ue,_e){$e[_e].min=Me[_e],$e[_e].max=ke[_e]}),I.globals.selection=B.selection,typeof I.config.chart.events.selection=="function"&&I.config.chart.events.selection(B.ctx,{xaxis:Se,yaxis:$e})}}}},{key:"panDragging",value:function(S){var _=S.context,k=this.w,I=_;if(k.globals.lastClientPosition.x!==void 0){var B=k.globals.lastClientPosition.x-I.clientX,G=k.globals.lastClientPosition.y-I.clientY;Math.abs(B)>Math.abs(G)&&B>0?this.moveDirection="left":Math.abs(B)>Math.abs(G)&&B<0?this.moveDirection="right":Math.abs(G)>Math.abs(B)&&G>0?this.moveDirection="up":Math.abs(G)>Math.abs(B)&&G<0&&(this.moveDirection="down")}k.globals.lastClientPosition={x:I.clientX,y:I.clientY};var re=k.globals.isRangeBar?k.globals.minY:k.globals.minX,ce=k.globals.isRangeBar?k.globals.maxY:k.globals.maxX;k.config.xaxis.convertedCatToNumeric||I.panScrolled(re,ce)}},{key:"delayedPanScrolled",value:function(){var S=this.w,_=S.globals.minX,k=S.globals.maxX,I=(S.globals.maxX-S.globals.minX)/2;this.moveDirection==="left"?(_=S.globals.minX+I,k=S.globals.maxX+I):this.moveDirection==="right"&&(_=S.globals.minX-I,k=S.globals.maxX-I),_=Math.floor(_),k=Math.floor(k),this.updateScrolledChart({xaxis:{min:_,max:k}},_,k)}},{key:"panScrolled",value:function(S,_){var k=this.w,I=this.xyRatios,B=F.clone(k.globals.initialConfig.yaxis),G=I.xRatio,re=k.globals.minX,ce=k.globals.maxX;k.globals.isRangeBar&&(G=I.invertedYRatio,re=k.globals.minY,ce=k.globals.maxY),this.moveDirection==="left"?(S=re+k.globals.gridWidth/15*G,_=ce+k.globals.gridWidth/15*G):this.moveDirection==="right"&&(S=re-k.globals.gridWidth/15*G,_=ce-k.globals.gridWidth/15*G),k.globals.isRangeBar||(S<k.globals.initialMinX||_>k.globals.initialMaxX)&&(S=re,_=ce);var ue={xaxis:{min:S,max:_}};k.config.chart.group||(ue.yaxis=B),this.updateScrolledChart(ue,S,_)}},{key:"updateScrolledChart",value:function(S,_,k){var I=this.w;this.ctx.updateHelpers._updateOptions(S,!1,!1),typeof I.config.chart.events.scrolled=="function"&&I.config.chart.events.scrolled(this.ctx,{xaxis:{min:_,max:k}})}}]),p}(),ot=function(){function Ee(h){s(this,Ee),this.w=h.w,this.ttCtx=h,this.ctx=h.ctx}return o(Ee,[{key:"getNearestValues",value:function(h){var p=h.hoverArea,S=h.elGrid,_=h.clientX,k=h.clientY,I=this.w,B=S.getBoundingClientRect(),G=B.width,re=B.height,ce=G/(I.globals.dataPoints-1),ue=re/I.globals.dataPoints,ge=this.hasBars();!I.globals.comboCharts&&!ge||I.config.xaxis.convertedCatToNumeric||(ce=G/I.globals.dataPoints);var Ae=_-B.left-I.globals.barPadForNumericAxis,ke=k-B.top;Ae<0||ke<0||Ae>G||ke>re?(p.classList.remove("hovering-zoom"),p.classList.remove("hovering-pan")):I.globals.zoomEnabled?(p.classList.remove("hovering-pan"),p.classList.add("hovering-zoom")):I.globals.panEnabled&&(p.classList.remove("hovering-zoom"),p.classList.add("hovering-pan"));var Me=Math.round(Ae/ce),qe=Math.floor(ke/ue);ge&&!I.config.xaxis.convertedCatToNumeric&&(Me=Math.ceil(Ae/ce),Me-=1);var Fe=null,at=null,ie=I.globals.seriesXvalues.map(function(st){return st.filter(function(ut){return F.isNumber(ut)})}),Se=I.globals.seriesYvalues.map(function(st){return st.filter(function(ut){return F.isNumber(ut)})});if(I.globals.isXNumeric){var $e=this.ttCtx.getElGrid().getBoundingClientRect(),Ue=Ae*($e.width/G),_e=ke*($e.height/re);Fe=(at=this.closestInMultiArray(Ue,_e,ie,Se)).index,Me=at.j,Fe!==null&&(ie=I.globals.seriesXvalues[Fe],Me=(at=this.closestInArray(Ue,ie)).index)}return I.globals.capturedSeriesIndex=Fe===null?-1:Fe,(!Me||Me<1)&&(Me=0),I.globals.isBarHorizontal?I.globals.capturedDataPointIndex=qe:I.globals.capturedDataPointIndex=Me,{capturedSeries:Fe,j:I.globals.isBarHorizontal?qe:Me,hoverX:Ae,hoverY:ke}}},{key:"closestInMultiArray",value:function(h,p,S,_){var k=this.w,I=0,B=null,G=-1;k.globals.series.length>1?I=this.getFirstActiveXArray(S):B=0;var re=S[I][0],ce=Math.abs(h-re);if(S.forEach(function(Ae){Ae.forEach(function(ke,Me){var qe=Math.abs(h-ke);qe<=ce&&(ce=qe,G=Me)})}),G!==-1){var ue=_[I][G],ge=Math.abs(p-ue);B=I,_.forEach(function(Ae,ke){var Me=Math.abs(p-Ae[G]);Me<=ge&&(ge=Me,B=ke)})}return{index:B,j:G}}},{key:"getFirstActiveXArray",value:function(h){for(var p=this.w,S=0,_=h.map(function(I,B){return I.length>0?B:-1}),k=0;k<_.length;k++)if(_[k]!==-1&&p.globals.collapsedSeriesIndices.indexOf(k)===-1&&p.globals.ancillaryCollapsedSeriesIndices.indexOf(k)===-1){S=_[k];break}return S}},{key:"closestInArray",value:function(h,p){for(var S=p[0],_=null,k=Math.abs(h-S),I=0;I<p.length;I++){var B=Math.abs(h-p[I]);B<k&&(k=B,_=I)}return{index:_}}},{key:"isXoverlap",value:function(h){var p=[],S=this.w.globals.seriesX.filter(function(k){return k[0]!==void 0});if(S.length>0)for(var _=0;_<S.length-1;_++)S[_][h]!==void 0&&S[_+1][h]!==void 0&&S[_][h]!==S[_+1][h]&&p.push("unEqual");return p.length===0}},{key:"isInitialSeriesSameLen",value:function(){for(var h=!0,p=this.w.globals.initialSeries,S=0;S<p.length-1;S++)if(p[S].data.length!==p[S+1].data.length){h=!1;break}return h}},{key:"getBarsHeight",value:function(h){return N(h).reduce(function(p,S){return p+S.getBBox().height},0)}},{key:"getElMarkers",value:function(h){return typeof h=="number"?this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:realIndex='".concat(h,"'] .apexcharts-series-markers-wrap > *")):this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}},{key:"getAllMarkers",value:function(){var h=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap");(h=N(h)).sort(function(S,_){var k=Number(S.getAttribute("data:realIndex")),I=Number(_.getAttribute("data:realIndex"));return I<k?1:I>k?-1:0});var p=[];return h.forEach(function(S){p.push(S.querySelector(".apexcharts-marker"))}),p}},{key:"hasMarkers",value:function(h){return this.getElMarkers(h).length>0}},{key:"getPathFromPoint",value:function(h,p){var S=Number(h.getAttribute("cx")),_=Number(h.getAttribute("cy")),k=h.getAttribute("shape");return new z(this.ctx).getMarkerPath(S,_,k,p)}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(h){var p=this.w,S=p.config.markers.hover.size;return S===void 0&&(S=p.globals.markers.size[h]+p.config.markers.hover.sizeOffset),S}},{key:"toggleAllTooltipSeriesGroups",value:function(h){var p=this.w,S=this.ttCtx;S.allTooltipSeriesGroups.length===0&&(S.allTooltipSeriesGroups=p.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var _=S.allTooltipSeriesGroups,k=0;k<_.length;k++)h==="enable"?(_[k].classList.add("apexcharts-active"),_[k].style.display=p.config.tooltip.items.display):(_[k].classList.remove("apexcharts-active"),_[k].style.display="none")}}]),Ee}(),De=function(){function Ee(h){s(this,Ee),this.w=h.w,this.ctx=h.ctx,this.ttCtx=h,this.tooltipUtil=new ot(h)}return o(Ee,[{key:"drawSeriesTexts",value:function(h){var p=h.shared,S=p===void 0||p,_=h.ttItems,k=h.i,I=k===void 0?0:k,B=h.j,G=B===void 0?null:B,re=h.y1,ce=h.y2,ue=h.e,ge=this.w;ge.config.tooltip.custom!==void 0?this.handleCustomTooltip({i:I,j:G,y1:re,y2:ce,w:ge}):this.toggleActiveInactiveSeries(S,I);var Ae=this.getValuesToPrint({i:I,j:G});this.printLabels({i:I,j:G,values:Ae,ttItems:_,shared:S,e:ue});var ke=this.ttCtx.getElTooltip();this.ttCtx.tooltipRect.ttWidth=ke.getBoundingClientRect().width,this.ttCtx.tooltipRect.ttHeight=ke.getBoundingClientRect().height}},{key:"printLabels",value:function(h){var p,S=this,_=h.i,k=h.j,I=h.values,B=h.ttItems,G=h.shared,re=h.e,ce=this.w,ue=[],ge=function($e){return ce.globals.seriesGoals[$e]&&ce.globals.seriesGoals[$e][k]&&Array.isArray(ce.globals.seriesGoals[$e][k])},Ae=I.xVal,ke=I.zVal,Me=I.xAxisTTVal,qe="",Fe=ce.globals.colors[_];k!==null&&ce.config.plotOptions.bar.distributed&&(Fe=ce.globals.colors[k]);for(var at=function($e,Ue){var _e=S.getFormatters(_);qe=S.getSeriesName({fn:_e.yLbTitleFormatter,index:_,seriesIndex:_,j:k}),ce.config.chart.type==="treemap"&&(qe=_e.yLbTitleFormatter(String(ce.config.series[_].data[k].x),{series:ce.globals.series,seriesIndex:_,dataPointIndex:k,w:ce}));var st=ce.config.tooltip.inverseOrder?Ue:$e;if(ce.globals.axisCharts){var ut=function(Kt){var un,Xe,Pt,Wt;return ce.globals.isRangeData?_e.yLbFormatter((un=ce.globals.seriesRangeStart)===null||un===void 0||(Xe=un[Kt])===null||Xe===void 0?void 0:Xe[k],{series:ce.globals.seriesRangeStart,seriesIndex:Kt,dataPointIndex:k,w:ce})+" - "+_e.yLbFormatter((Pt=ce.globals.seriesRangeEnd)===null||Pt===void 0||(Wt=Pt[Kt])===null||Wt===void 0?void 0:Wt[k],{series:ce.globals.seriesRangeEnd,seriesIndex:Kt,dataPointIndex:k,w:ce}):_e.yLbFormatter(ce.globals.series[Kt][k],{series:ce.globals.series,seriesIndex:Kt,dataPointIndex:k,w:ce})};if(G)_e=S.getFormatters(st),qe=S.getSeriesName({fn:_e.yLbTitleFormatter,index:st,seriesIndex:_,j:k}),Fe=ce.globals.colors[st],p=ut(st),ge(st)&&(ue=ce.globals.seriesGoals[st][k].map(function(Kt){return{attrs:Kt,val:_e.yLbFormatter(Kt.value,{seriesIndex:st,dataPointIndex:k,w:ce})}}));else{var yt,Mt=re==null||(yt=re.target)===null||yt===void 0?void 0:yt.getAttribute("fill");Mt&&(Mt.indexOf("url")!==-1?Mt.indexOf("Pattern")!==-1&&(Fe=ce.globals.dom.baseEl.querySelector(Mt.substr(4).slice(0,-1)).childNodes[0].getAttribute("stroke")):Fe=Mt),p=ut(_),ge(_)&&Array.isArray(ce.globals.seriesGoals[_][k])&&(ue=ce.globals.seriesGoals[_][k].map(function(Kt){return{attrs:Kt,val:_e.yLbFormatter(Kt.value,{seriesIndex:_,dataPointIndex:k,w:ce})}}))}}k===null&&(p=_e.yLbFormatter(ce.globals.series[_],y(y({},ce),{},{seriesIndex:_,dataPointIndex:_}))),S.DOMHandling({i:_,t:st,j:k,ttItems:B,values:{val:p,goalVals:ue,xVal:Ae,xAxisTTVal:Me,zVal:ke},seriesName:qe,shared:G,pColor:Fe})},ie=0,Se=ce.globals.series.length-1;ie<ce.globals.series.length;ie++,Se--)at(ie,Se)}},{key:"getFormatters",value:function(h){var p,S=this.w,_=S.globals.yLabelFormatters[h];return S.globals.ttVal!==void 0?Array.isArray(S.globals.ttVal)?(_=S.globals.ttVal[h]&&S.globals.ttVal[h].formatter,p=S.globals.ttVal[h]&&S.globals.ttVal[h].title&&S.globals.ttVal[h].title.formatter):(_=S.globals.ttVal.formatter,typeof S.globals.ttVal.title.formatter=="function"&&(p=S.globals.ttVal.title.formatter)):p=S.config.tooltip.y.title.formatter,typeof _!="function"&&(_=S.globals.yLabelFormatters[0]?S.globals.yLabelFormatters[0]:function(k){return k}),typeof p!="function"&&(p=function(k){return k}),{yLbFormatter:_,yLbTitleFormatter:p}}},{key:"getSeriesName",value:function(h){var p=h.fn,S=h.index,_=h.seriesIndex,k=h.j,I=this.w;return p(String(I.globals.seriesNames[S]),{series:I.globals.series,seriesIndex:_,dataPointIndex:k,w:I})}},{key:"DOMHandling",value:function(h){h.i;var p=h.t,S=h.j,_=h.ttItems,k=h.values,I=h.seriesName,B=h.shared,G=h.pColor,re=this.w,ce=this.ttCtx,ue=k.val,ge=k.goalVals,Ae=k.xVal,ke=k.xAxisTTVal,Me=k.zVal,qe=null;qe=_[p].children,re.config.tooltip.fillSeriesColor&&(_[p].style.backgroundColor=G,qe[0].style.display="none"),ce.showTooltipTitle&&(ce.tooltipTitle===null&&(ce.tooltipTitle=re.globals.dom.baseEl.querySelector(".apexcharts-tooltip-title")),ce.tooltipTitle.innerHTML=Ae),ce.isXAxisTooltipEnabled&&(ce.xaxisTooltipText.innerHTML=ke!==""?ke:Ae);var Fe=_[p].querySelector(".apexcharts-tooltip-text-y-label");Fe&&(Fe.innerHTML=I||"");var at=_[p].querySelector(".apexcharts-tooltip-text-y-value");at&&(at.innerHTML=ue!==void 0?ue:""),qe[0]&&qe[0].classList.contains("apexcharts-tooltip-marker")&&(re.config.tooltip.marker.fillColors&&Array.isArray(re.config.tooltip.marker.fillColors)&&(G=re.config.tooltip.marker.fillColors[p]),qe[0].style.backgroundColor=G),re.config.tooltip.marker.show||(qe[0].style.display="none");var ie=_[p].querySelector(".apexcharts-tooltip-text-goals-label"),Se=_[p].querySelector(".apexcharts-tooltip-text-goals-value");if(ge.length&&re.globals.seriesGoals[p]){var $e=function(){var st="<div >",ut="<div>";ge.forEach(function(yt,Mt){st+=' <div style="display: flex"><span class="apexcharts-tooltip-marker" style="background-color: '.concat(yt.attrs.strokeColor,'; height: 3px; border-radius: 0; top: 5px;"></span> ').concat(yt.attrs.name,"</div>"),ut+="<div>".concat(yt.val,"</div>")}),ie.innerHTML=st+"</div>",Se.innerHTML=ut+"</div>"};B?re.globals.seriesGoals[p][S]&&Array.isArray(re.globals.seriesGoals[p][S])?$e():(ie.innerHTML="",Se.innerHTML=""):$e()}else ie.innerHTML="",Se.innerHTML="";if(Me!==null&&(_[p].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=re.config.tooltip.z.title,_[p].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=Me!==void 0?Me:""),B&&qe[0]){if(re.config.tooltip.hideEmptySeries){var Ue=_[p].querySelector(".apexcharts-tooltip-marker"),_e=_[p].querySelector(".apexcharts-tooltip-text");parseFloat(ue)==0?(Ue.style.display="none",_e.style.display="none"):(Ue.style.display="block",_e.style.display="block")}ue==null||re.globals.ancillaryCollapsedSeriesIndices.indexOf(p)>-1||re.globals.collapsedSeriesIndices.indexOf(p)>-1||Array.isArray(ce.tConfig.enabledOnSeries)&&ce.tConfig.enabledOnSeries.indexOf(p)===-1?qe[0].parentNode.style.display="none":qe[0].parentNode.style.display=re.config.tooltip.items.display}else Array.isArray(ce.tConfig.enabledOnSeries)&&ce.tConfig.enabledOnSeries.indexOf(p)===-1&&(qe[0].parentNode.style.display="none")}},{key:"toggleActiveInactiveSeries",value:function(h,p){var S=this.w;if(h)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var _=S.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group-".concat(p));_&&(_.classList.add("apexcharts-active"),_.style.display=S.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(h){var p=h.i,S=h.j,_=this.w,k=this.ctx.series.filteredSeriesX(),I="",B="",G=null,re=null,ce={series:_.globals.series,seriesIndex:p,dataPointIndex:S,w:_},ue=_.globals.ttZFormatter;S===null?re=_.globals.series[p]:_.globals.isXNumeric&&_.config.chart.type!=="treemap"?(I=k[p][S],k[p].length===0&&(I=k[this.tooltipUtil.getFirstActiveXArray(k)][S])):I=new Qe(this.ctx).isFormatXY()?_.config.series[p].data[S]!==void 0?_.config.series[p].data[S].x:"":_.globals.labels[S]!==void 0?_.globals.labels[S]:"";var ge=I;return _.globals.isXNumeric&&_.config.xaxis.type==="datetime"?I=new te(this.ctx).xLabelFormat(_.globals.ttKeyFormatter,ge,ge,{i:void 0,dateFormatter:new K(this.ctx).formatDate,w:this.w}):I=_.globals.isBarHorizontal?_.globals.yLabelFormatters[0](ge,ce):_.globals.xLabelFormatter(ge,ce),_.config.tooltip.x.formatter!==void 0&&(I=_.globals.ttKeyFormatter(ge,ce)),_.globals.seriesZ.length>0&&_.globals.seriesZ[p].length>0&&(G=ue(_.globals.seriesZ[p][S],_)),B=typeof _.config.xaxis.tooltip.formatter=="function"?_.globals.xaxisTooltipFormatter(ge,ce):I,{val:Array.isArray(re)?re.join(" "):re,xVal:Array.isArray(I)?I.join(" "):I,xAxisTTVal:Array.isArray(B)?B.join(" "):B,zVal:G}}},{key:"handleCustomTooltip",value:function(h){var p=h.i,S=h.j,_=h.y1,k=h.y2,I=h.w,B=this.ttCtx.getElTooltip(),G=I.config.tooltip.custom;Array.isArray(G)&&G[p]&&(G=G[p]),B.innerHTML=G({ctx:this.ctx,series:I.globals.series,seriesIndex:p,dataPointIndex:S,y1:_,y2:k,w:I})}}]),Ee}(),At=function(){function Ee(h){s(this,Ee),this.ttCtx=h,this.ctx=h.ctx,this.w=h.w}return o(Ee,[{key:"moveXCrosshairs",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,S=this.ttCtx,_=this.w,k=S.getElXCrosshairs(),I=h-S.xcrosshairsWidth/2,B=_.globals.labels.slice().length;if(p!==null&&(I=_.globals.gridWidth/B*p),k===null||_.globals.isBarHorizontal||(k.setAttribute("x",I),k.setAttribute("x1",I),k.setAttribute("x2",I),k.setAttribute("y2",_.globals.gridHeight),k.classList.add("apexcharts-active")),I<0&&(I=0),I>_.globals.gridWidth&&(I=_.globals.gridWidth),S.isXAxisTooltipEnabled){var G=I;_.config.xaxis.crosshairs.width!=="tickWidth"&&_.config.xaxis.crosshairs.width!=="barWidth"||(G=I+S.xcrosshairsWidth/2),this.moveXAxisTooltip(G)}}},{key:"moveYCrosshairs",value:function(h){var p=this.ttCtx;p.ycrosshairs!==null&&z.setAttrs(p.ycrosshairs,{y1:h,y2:h}),p.ycrosshairsHidden!==null&&z.setAttrs(p.ycrosshairsHidden,{y1:h,y2:h})}},{key:"moveXAxisTooltip",value:function(h){var p=this.w,S=this.ttCtx;if(S.xaxisTooltip!==null&&S.xcrosshairsWidth!==0){S.xaxisTooltip.classList.add("apexcharts-active");var _=S.xaxisOffY+p.config.xaxis.tooltip.offsetY+p.globals.translateY+1+p.config.xaxis.offsetY;if(h-=S.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(h)){h+=p.globals.translateX;var k;k=new z(this.ctx).getTextRects(S.xaxisTooltipText.innerHTML),S.xaxisTooltipText.style.minWidth=k.width+"px",S.xaxisTooltip.style.left=h+"px",S.xaxisTooltip.style.top=_+"px"}}}},{key:"moveYAxisTooltip",value:function(h){var p=this.w,S=this.ttCtx;S.yaxisTTEls===null&&(S.yaxisTTEls=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var _=parseInt(S.ycrosshairsHidden.getAttribute("y1"),10),k=p.globals.translateY+_,I=S.yaxisTTEls[h].getBoundingClientRect().height,B=p.globals.translateYAxisX[h]-2;p.config.yaxis[h].opposite&&(B-=26),k-=I/2,p.globals.ignoreYAxisIndexes.indexOf(h)===-1?(S.yaxisTTEls[h].classList.add("apexcharts-active"),S.yaxisTTEls[h].style.top=k+"px",S.yaxisTTEls[h].style.left=B+p.config.yaxis[h].tooltip.offsetX+"px"):S.yaxisTTEls[h].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=this.w,k=this.ttCtx,I=k.getElTooltip(),B=k.tooltipRect,G=S!==null?parseFloat(S):1,re=parseFloat(h)+G+5,ce=parseFloat(p)+G/2;if(re>_.globals.gridWidth/2&&(re=re-B.ttWidth-G-10),re>_.globals.gridWidth-B.ttWidth-10&&(re=_.globals.gridWidth-B.ttWidth),re<-20&&(re=-20),_.config.tooltip.followCursor){var ue=k.getElGrid().getBoundingClientRect();(re=k.e.clientX-ue.left)>_.globals.gridWidth/2&&(re-=k.tooltipRect.ttWidth),(ce=k.e.clientY+_.globals.translateY-ue.top)>_.globals.gridHeight/2&&(ce-=k.tooltipRect.ttHeight)}else _.globals.isBarHorizontal||B.ttHeight/2+ce>_.globals.gridHeight&&(ce=_.globals.gridHeight-B.ttHeight+_.globals.translateY);isNaN(re)||(re+=_.globals.translateX,I.style.left=re+"px",I.style.top=ce+"px")}},{key:"moveMarkers",value:function(h,p){var S=this.w,_=this.ttCtx;if(S.globals.markers.size[h]>0)for(var k=S.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(h,"'] .apexcharts-marker")),I=0;I<k.length;I++)parseInt(k[I].getAttribute("rel"),10)===p&&(_.marker.resetPointsSize(),_.marker.enlargeCurrentPoint(p,k[I]));else _.marker.resetPointsSize(),this.moveDynamicPointOnHover(p,h)}},{key:"moveDynamicPointOnHover",value:function(h,p){var S,_,k,I,B=this.w,G=this.ttCtx,re=new z(this.ctx),ce=B.globals.pointsArray,ue=G.tooltipUtil.getHoverMarkerSize(p),ge=B.config.series[p].type;if(!ge||ge!=="column"&&ge!=="candlestick"&&ge!=="boxPlot"){k=(S=ce[p][h])===null||S===void 0?void 0:S[0],I=((_=ce[p][h])===null||_===void 0?void 0:_[1])||0;var Ae=B.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(p,"'] .apexcharts-series-markers path"));if(Ae&&I<B.globals.gridHeight&&I>0){var ke=Ae.getAttribute("shape"),Me=re.getMarkerPath(k,I,ke,1.5*ue);Ae.setAttribute("d",Me)}this.moveXCrosshairs(k),G.fixedTooltip||this.moveTooltip(k,I,ue)}}},{key:"moveDynamicPointsOnHover",value:function(h){var p,S=this.ttCtx,_=S.w,k=0,I=0,B=_.globals.pointsArray,G=new Re(this.ctx),re=new z(this.ctx);p=G.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);var ce=S.tooltipUtil.getHoverMarkerSize(p);B[p]&&(k=B[p][h][0],I=B[p][h][1]);var ue=S.tooltipUtil.getAllMarkers();if(ue!==null)for(var ge=0;ge<_.globals.series.length;ge++){var Ae=B[ge];if(_.globals.comboCharts&&Ae===void 0&&ue.splice(ge,0,null),Ae&&Ae.length){var ke=B[ge][h][1],Me=void 0;ue[ge].setAttribute("cx",k);var qe=ue[ge].getAttribute("shape");if(_.config.chart.type==="rangeArea"&&!_.globals.comboCharts){var Fe=h+_.globals.series[ge].length;Me=B[ge][Fe][1],ke-=Math.abs(ke-Me)/2}if(ke!==null&&!isNaN(ke)&&ke<_.globals.gridHeight+ce&&ke+ce>0){var at=re.getMarkerPath(k,ke,qe,ce);ue[ge].setAttribute("d",at)}else ue[ge].setAttribute("d","")}}this.moveXCrosshairs(k),S.fixedTooltip||this.moveTooltip(k,I||_.globals.gridHeight,ce)}},{key:"moveStickyTooltipOverBars",value:function(h,p){var S=this.w,_=this.ttCtx,k=S.globals.columnSeries?S.globals.columnSeries.length:S.globals.series.length,I=k>=2&&k%2==0?Math.floor(k/2):Math.floor(k/2)+1;S.globals.isBarHorizontal&&(I=new Re(this.ctx).getActiveConfigSeriesIndex("desc")+1);var B=S.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(I,"'] path[j='").concat(h,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(I,"'] path[j='").concat(h,"'], .apexcharts-boxPlot-series .apexcharts-series[rel='").concat(I,"'] path[j='").concat(h,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(I,"'] path[j='").concat(h,"']"));B||typeof p!="number"||(B=S.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[data\\:realIndex='".concat(p,"'] path[j='").concat(h,`'],
.apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(h,`'],
.apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(h,`'],
.apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='`).concat(p,"'] path[j='").concat(h,"']")));var G=B?parseFloat(B.getAttribute("cx")):0,re=B?parseFloat(B.getAttribute("cy")):0,ce=B?parseFloat(B.getAttribute("barWidth")):0,ue=_.getElGrid().getBoundingClientRect(),ge=B&&(B.classList.contains("apexcharts-candlestick-area")||B.classList.contains("apexcharts-boxPlot-area"));S.globals.isXNumeric?(B&&!ge&&(G-=k%2!=0?ce/2:0),B&&ge&&S.globals.comboCharts&&(G-=ce/2)):S.globals.isBarHorizontal||(G=_.xAxisTicksPositions[h-1]+_.dataPointsDividedWidth/2,isNaN(G)&&(G=_.xAxisTicksPositions[h]-_.dataPointsDividedWidth/2)),S.globals.isBarHorizontal?re-=_.tooltipRect.ttHeight:S.config.tooltip.followCursor?re=_.e.clientY-ue.top-_.tooltipRect.ttHeight/2:re+_.tooltipRect.ttHeight+15>S.globals.gridHeight&&(re=S.globals.gridHeight),S.globals.isBarHorizontal||this.moveXCrosshairs(G),_.fixedTooltip||this.moveTooltip(G,re||S.globals.gridHeight)}}]),Ee}(),ze=function(){function Ee(h){s(this,Ee),this.w=h.w,this.ttCtx=h,this.ctx=h.ctx,this.tooltipPosition=new At(h)}return o(Ee,[{key:"drawDynamicPoints",value:function(){var h=this.w,p=new z(this.ctx),S=new be(this.ctx),_=h.globals.dom.baseEl.querySelectorAll(".apexcharts-series");_=N(_),h.config.chart.stacked&&_.sort(function(ue,ge){return parseFloat(ue.getAttribute("data:realIndex"))-parseFloat(ge.getAttribute("data:realIndex"))});for(var k=0;k<_.length;k++){var I=_[k].querySelector(".apexcharts-series-markers-wrap");if(I!==null){var B=void 0,G="apexcharts-marker w".concat((Math.random()+1).toString(36).substring(4));h.config.chart.type!=="line"&&h.config.chart.type!=="area"||h.globals.comboCharts||h.config.tooltip.intersect||(G+=" no-pointer-events");var re=S.getMarkerConfig({cssClass:G,seriesIndex:Number(I.getAttribute("data:realIndex"))});(B=p.drawMarker(0,0,re)).node.setAttribute("default-marker-size",0);var ce=document.createElementNS(h.globals.SVGNS,"g");ce.classList.add("apexcharts-series-markers"),ce.appendChild(B.node),I.appendChild(ce)}}}},{key:"enlargeCurrentPoint",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,k=this.w;k.config.chart.type!=="bubble"&&this.newPointSize(h,p);var I=p.getAttribute("cx"),B=p.getAttribute("cy");if(S!==null&&_!==null&&(I=S,B=_),this.tooltipPosition.moveXCrosshairs(I),!this.fixedTooltip){if(k.config.chart.type==="radar"){var G=this.ttCtx.getElGrid().getBoundingClientRect();I=this.ttCtx.e.clientX-G.left}this.tooltipPosition.moveTooltip(I,B,k.config.markers.hover.size)}}},{key:"enlargePoints",value:function(h){for(var p=this.w,S=this,_=this.ttCtx,k=h,I=p.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),B=p.config.markers.hover.size,G=0;G<I.length;G++){var re=I[G].getAttribute("rel"),ce=I[G].getAttribute("index");if(B===void 0&&(B=p.globals.markers.size[ce]+p.config.markers.hover.sizeOffset),k===parseInt(re,10)){S.newPointSize(k,I[G]);var ue=I[G].getAttribute("cx"),ge=I[G].getAttribute("cy");S.tooltipPosition.moveXCrosshairs(ue),_.fixedTooltip||S.tooltipPosition.moveTooltip(ue,ge,B)}else S.oldPointSize(I[G])}}},{key:"newPointSize",value:function(h,p){var S=this.w,_=S.config.markers.hover.size,k=h===0?p.parentNode.firstChild:p.parentNode.lastChild;if(k.getAttribute("default-marker-size")!=="0"){var I=parseInt(k.getAttribute("index"),10);_===void 0&&(_=S.globals.markers.size[I]+S.config.markers.hover.sizeOffset),_<0&&(_=0);var B=this.ttCtx.tooltipUtil.getPathFromPoint(p,_);p.setAttribute("d",B)}}},{key:"oldPointSize",value:function(h){var p=parseFloat(h.getAttribute("default-marker-size")),S=this.ttCtx.tooltipUtil.getPathFromPoint(h,p);h.setAttribute("d",S)}},{key:"resetPointsSize",value:function(){for(var h=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),p=0;p<h.length;p++){var S=parseFloat(h[p].getAttribute("default-marker-size"));if(F.isNumber(S)&&S>=0){var _=this.ttCtx.tooltipUtil.getPathFromPoint(h[p],S);h[p].setAttribute("d",_)}else h[p].setAttribute("d","M0,0")}}}]),Ee}(),rt=function(){function Ee(h){s(this,Ee),this.w=h.w;var p=this.w;this.ttCtx=h,this.isVerticalGroupedRangeBar=!p.globals.isBarHorizontal&&p.config.chart.type==="rangeBar"&&p.config.plotOptions.bar.rangeBarGroupRows}return o(Ee,[{key:"getAttr",value:function(h,p){return parseFloat(h.target.getAttribute(p))}},{key:"handleHeatTreeTooltip",value:function(h){var p=h.e,S=h.opt,_=h.x,k=h.y,I=h.type,B=this.ttCtx,G=this.w;if(p.target.classList.contains("apexcharts-".concat(I,"-rect"))){var re=this.getAttr(p,"i"),ce=this.getAttr(p,"j"),ue=this.getAttr(p,"cx"),ge=this.getAttr(p,"cy"),Ae=this.getAttr(p,"width"),ke=this.getAttr(p,"height");if(B.tooltipLabels.drawSeriesTexts({ttItems:S.ttItems,i:re,j:ce,shared:!1,e:p}),G.globals.capturedSeriesIndex=re,G.globals.capturedDataPointIndex=ce,_=ue+B.tooltipRect.ttWidth/2+Ae,k=ge+B.tooltipRect.ttHeight/2-ke/2,B.tooltipPosition.moveXCrosshairs(ue+Ae/2),_>G.globals.gridWidth/2&&(_=ue-B.tooltipRect.ttWidth/2+Ae),B.w.config.tooltip.followCursor){var Me=G.globals.dom.elWrap.getBoundingClientRect();_=G.globals.clientX-Me.left-(_>G.globals.gridWidth/2?B.tooltipRect.ttWidth:0),k=G.globals.clientY-Me.top-(k>G.globals.gridHeight/2?B.tooltipRect.ttHeight:0)}}return{x:_,y:k}}},{key:"handleMarkerTooltip",value:function(h){var p,S,_=h.e,k=h.opt,I=h.x,B=h.y,G=this.w,re=this.ttCtx;if(_.target.classList.contains("apexcharts-marker")){var ce=parseInt(k.paths.getAttribute("cx"),10),ue=parseInt(k.paths.getAttribute("cy"),10),ge=parseFloat(k.paths.getAttribute("val"));if(S=parseInt(k.paths.getAttribute("rel"),10),p=parseInt(k.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,re.intersect){var Ae=F.findAncestor(k.paths,"apexcharts-series");Ae&&(p=parseInt(Ae.getAttribute("data:realIndex"),10))}if(re.tooltipLabels.drawSeriesTexts({ttItems:k.ttItems,i:p,j:S,shared:!re.showOnIntersect&&G.config.tooltip.shared,e:_}),_.type==="mouseup"&&re.markerClick(_,p,S),G.globals.capturedSeriesIndex=p,G.globals.capturedDataPointIndex=S,I=ce,B=ue+G.globals.translateY-1.4*re.tooltipRect.ttHeight,re.w.config.tooltip.followCursor){var ke=re.getElGrid().getBoundingClientRect();B=re.e.clientY+G.globals.translateY-ke.top}ge<0&&(B=ue),re.marker.enlargeCurrentPoint(S,k.paths,I,B)}return{x:I,y:B}}},{key:"handleBarTooltip",value:function(h){var p,S,_=h.e,k=h.opt,I=this.w,B=this.ttCtx,G=B.getElTooltip(),re=0,ce=0,ue=0,ge=this.getBarTooltipXY({e:_,opt:k});p=ge.i;var Ae=ge.j;I.globals.capturedSeriesIndex=p,I.globals.capturedDataPointIndex=Ae,I.globals.isBarHorizontal&&B.tooltipUtil.hasBars()||!I.config.tooltip.shared?(ce=ge.x,ue=ge.y,S=Array.isArray(I.config.stroke.width)?I.config.stroke.width[p]:I.config.stroke.width,re=ce):I.globals.comboCharts||I.config.tooltip.shared||(re/=2),isNaN(ue)&&(ue=I.globals.svgHeight-B.tooltipRect.ttHeight);var ke=parseInt(k.paths.parentNode.getAttribute("data:realIndex"),10);if(I.globals.isMultipleYAxis?I.config.yaxis[ke]&&I.config.yaxis[ke].reversed:I.config.yaxis[0].reversed,ce+B.tooltipRect.ttWidth>I.globals.gridWidth?ce-=B.tooltipRect.ttWidth:ce<0&&(ce=0),B.w.config.tooltip.followCursor){var Me=B.getElGrid().getBoundingClientRect();ue=B.e.clientY-Me.top}B.tooltip===null&&(B.tooltip=I.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),I.config.tooltip.shared||(I.globals.comboBarCount>0?B.tooltipPosition.moveXCrosshairs(re+S/2):B.tooltipPosition.moveXCrosshairs(re)),!B.fixedTooltip&&(!I.config.tooltip.shared||I.globals.isBarHorizontal&&B.tooltipUtil.hasBars())&&(ue=ue+I.globals.translateY-B.tooltipRect.ttHeight/2,G.style.left=ce+I.globals.translateX+"px",G.style.top=ue+"px")}},{key:"getBarTooltipXY",value:function(h){var p=this,S=h.e,_=h.opt,k=this.w,I=null,B=this.ttCtx,G=0,re=0,ce=0,ue=0,ge=0,Ae=S.target.classList;if(Ae.contains("apexcharts-bar-area")||Ae.contains("apexcharts-candlestick-area")||Ae.contains("apexcharts-boxPlot-area")||Ae.contains("apexcharts-rangebar-area")){var ke=S.target,Me=ke.getBoundingClientRect(),qe=_.elGrid.getBoundingClientRect(),Fe=Me.height;ge=Me.height;var at=Me.width,ie=parseInt(ke.getAttribute("cx"),10),Se=parseInt(ke.getAttribute("cy"),10);ue=parseFloat(ke.getAttribute("barWidth"));var $e=S.type==="touchmove"?S.touches[0].clientX:S.clientX;I=parseInt(ke.getAttribute("j"),10),G=parseInt(ke.parentNode.getAttribute("rel"),10)-1;var Ue=ke.getAttribute("data-range-y1"),_e=ke.getAttribute("data-range-y2");k.globals.comboCharts&&(G=parseInt(ke.parentNode.getAttribute("data:realIndex"),10));var st=function(yt){return k.globals.isXNumeric?ie-at/2:p.isVerticalGroupedRangeBar?ie+at/2:ie-B.dataPointsDividedWidth+at/2},ut=function(){return Se-B.dataPointsDividedHeight+Fe/2-B.tooltipRect.ttHeight/2};B.tooltipLabels.drawSeriesTexts({ttItems:_.ttItems,i:G,j:I,y1:Ue?parseInt(Ue,10):null,y2:_e?parseInt(_e,10):null,shared:!B.showOnIntersect&&k.config.tooltip.shared,e:S}),k.config.tooltip.followCursor?k.globals.isBarHorizontal?(re=$e-qe.left+15,ce=ut()):(re=st(),ce=S.clientY-qe.top-B.tooltipRect.ttHeight/2-15):k.globals.isBarHorizontal?((re=ie)<B.xyRatios.baseLineInvertedY&&(re=ie-B.tooltipRect.ttWidth),ce=ut()):(re=st(),ce=Se)}return{x:re,y:ce,barHeight:ge,barWidth:ue,i:G,j:I}}}]),Ee}(),mt=function(){function Ee(h){s(this,Ee),this.w=h.w,this.ttCtx=h}return o(Ee,[{key:"drawXaxisTooltip",value:function(){var h=this.w,p=this.ttCtx,S=h.config.xaxis.position==="bottom";p.xaxisOffY=S?h.globals.gridHeight+1:-h.globals.xAxisHeight-h.config.xaxis.axisTicks.height+3;var _=S?"apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom":"apexcharts-xaxistooltip apexcharts-xaxistooltip-top",k=h.globals.dom.elWrap;p.isXAxisTooltipEnabled&&h.globals.dom.baseEl.querySelector(".apexcharts-xaxistooltip")===null&&(p.xaxisTooltip=document.createElement("div"),p.xaxisTooltip.setAttribute("class",_+" apexcharts-theme-"+h.config.tooltip.theme),k.appendChild(p.xaxisTooltip),p.xaxisTooltipText=document.createElement("div"),p.xaxisTooltipText.classList.add("apexcharts-xaxistooltip-text"),p.xaxisTooltipText.style.fontFamily=h.config.xaxis.tooltip.style.fontFamily||h.config.chart.fontFamily,p.xaxisTooltipText.style.fontSize=h.config.xaxis.tooltip.style.fontSize,p.xaxisTooltip.appendChild(p.xaxisTooltipText))}},{key:"drawYaxisTooltip",value:function(){for(var h=this.w,p=this.ttCtx,S=0;S<h.config.yaxis.length;S++){var _=h.config.yaxis[S].opposite||h.config.yaxis[S].crosshairs.opposite;p.yaxisOffX=_?h.globals.gridWidth+1:1;var k="apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(S,_?" apexcharts-yaxistooltip-right":" apexcharts-yaxistooltip-left"),I=h.globals.dom.elWrap;h.globals.dom.baseEl.querySelector(".apexcharts-yaxistooltip apexcharts-yaxistooltip-".concat(S))===null&&(p.yaxisTooltip=document.createElement("div"),p.yaxisTooltip.setAttribute("class",k+" apexcharts-theme-"+h.config.tooltip.theme),I.appendChild(p.yaxisTooltip),S===0&&(p.yaxisTooltipText=[]),p.yaxisTooltipText[S]=document.createElement("div"),p.yaxisTooltipText[S].classList.add("apexcharts-yaxistooltip-text"),p.yaxisTooltip.appendChild(p.yaxisTooltipText[S]))}}},{key:"setXCrosshairWidth",value:function(){var h=this.w,p=this.ttCtx,S=p.getElXCrosshairs();if(p.xcrosshairsWidth=parseInt(h.config.xaxis.crosshairs.width,10),h.globals.comboCharts){var _=h.globals.dom.baseEl.querySelector(".apexcharts-bar-area");if(_!==null&&h.config.xaxis.crosshairs.width==="barWidth"){var k=parseFloat(_.getAttribute("barWidth"));p.xcrosshairsWidth=k}else if(h.config.xaxis.crosshairs.width==="tickWidth"){var I=h.globals.labels.length;p.xcrosshairsWidth=h.globals.gridWidth/I}}else if(h.config.xaxis.crosshairs.width==="tickWidth"){var B=h.globals.labels.length;p.xcrosshairsWidth=h.globals.gridWidth/B}else if(h.config.xaxis.crosshairs.width==="barWidth"){var G=h.globals.dom.baseEl.querySelector(".apexcharts-bar-area");if(G!==null){var re=parseFloat(G.getAttribute("barWidth"));p.xcrosshairsWidth=re}else p.xcrosshairsWidth=1}h.globals.isBarHorizontal&&(p.xcrosshairsWidth=0),S!==null&&p.xcrosshairsWidth>0&&S.setAttribute("width",p.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var h=this.w,p=this.ttCtx;p.ycrosshairs=h.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),p.ycrosshairsHidden=h.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(h,p,S){var _=this.ttCtx,k=this.w,I=k.globals,B=I.seriesYAxisMap[h];if(_.yaxisTooltips[h]&&B.length>0){var G=I.yLabelFormatters[h],re=_.getElGrid().getBoundingClientRect(),ce=B[0],ue=0;S.yRatio.length>1&&(ue=ce);var ge=(p-re.top)*S.yRatio[ue],Ae=I.maxYArr[ce]-I.minYArr[ce],ke=I.minYArr[ce]+(Ae-ge);k.config.yaxis[h].reversed&&(ke=I.maxYArr[ce]-(Ae-ge)),_.tooltipPosition.moveYCrosshairs(p-re.top),_.yaxisTooltipText[h].innerHTML=G(ke),_.tooltipPosition.moveYAxisTooltip(h)}}}]),Ee}(),Lt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w;var p=this.w;this.tConfig=p.config.tooltip,this.tooltipUtil=new ot(this),this.tooltipLabels=new De(this),this.tooltipPosition=new At(this),this.marker=new ze(this),this.intersect=new rt(this),this.axesTooltip=new mt(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.yaxisTTEls=null,this.isBarShared=!p.globals.isBarHorizontal&&this.tConfig.shared,this.lastHoverTime=Date.now()}return o(Ee,[{key:"getElTooltip",value:function(h){return h||(h=this),h.w.globals.dom.baseEl?h.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip"):null}},{key:"getElXCrosshairs",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}},{key:"getElGrid",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid")}},{key:"drawTooltip",value:function(h){var p=this.w;this.xyRatios=h,this.isXAxisTooltipEnabled=p.config.xaxis.tooltip.enabled&&p.globals.axisCharts,this.yaxisTooltips=p.config.yaxis.map(function(I,B){return!!(I.show&&I.tooltip.enabled&&p.globals.axisCharts)}),this.allTooltipSeriesGroups=[],p.globals.axisCharts||(this.showTooltipTitle=!1);var S=document.createElement("div");if(S.classList.add("apexcharts-tooltip"),p.config.tooltip.cssClass&&S.classList.add(p.config.tooltip.cssClass),S.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),p.globals.dom.elWrap.appendChild(S),p.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var _=new dt(this.ctx);this.xAxisTicksPositions=_.getXAxisTicksPositions()}if(!p.globals.comboCharts&&!this.tConfig.intersect&&p.config.chart.type!=="rangeBar"||this.tConfig.shared||(this.showOnIntersect=!0),p.config.markers.size!==0&&p.globals.markers.largestSize!==0||this.marker.drawDynamicPoints(this),p.globals.collapsedSeries.length!==p.globals.series.length){this.dataPointsDividedHeight=p.globals.gridHeight/p.globals.dataPoints,this.dataPointsDividedWidth=p.globals.gridWidth/p.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||p.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,S.appendChild(this.tooltipTitle));var k=p.globals.series.length;(p.globals.xyCharts||p.globals.comboCharts)&&this.tConfig.shared&&(k=this.showOnIntersect?1:p.globals.series.length),this.legendLabels=p.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(k),this.addSVGEvents()}}},{key:"createTTElements",value:function(h){for(var p=this,S=this.w,_=[],k=this.getElTooltip(),I=function(G){var re=document.createElement("div");re.classList.add("apexcharts-tooltip-series-group","apexcharts-tooltip-series-group-".concat(G)),re.style.order=S.config.tooltip.inverseOrder?h-G:G+1;var ce=document.createElement("span");ce.classList.add("apexcharts-tooltip-marker"),ce.style.backgroundColor=S.globals.colors[G],re.appendChild(ce);var ue=document.createElement("div");ue.classList.add("apexcharts-tooltip-text"),ue.style.fontFamily=p.tConfig.style.fontFamily||S.config.chart.fontFamily,ue.style.fontSize=p.tConfig.style.fontSize,["y","goals","z"].forEach(function(ge){var Ae=document.createElement("div");Ae.classList.add("apexcharts-tooltip-".concat(ge,"-group"));var ke=document.createElement("span");ke.classList.add("apexcharts-tooltip-text-".concat(ge,"-label")),Ae.appendChild(ke);var Me=document.createElement("span");Me.classList.add("apexcharts-tooltip-text-".concat(ge,"-value")),Ae.appendChild(Me),ue.appendChild(Ae)}),re.appendChild(ue),k.appendChild(re),_.push(re)},B=0;B<h;B++)I(B);return _}},{key:"addSVGEvents",value:function(){var h=this.w,p=h.config.chart.type,S=this.getElTooltip(),_=!(p!=="bar"&&p!=="candlestick"&&p!=="boxPlot"&&p!=="rangeBar"),k=p==="area"||p==="line"||p==="scatter"||p==="bubble"||p==="radar",I=h.globals.dom.Paper.node,B=this.getElGrid();B&&(this.seriesBound=B.getBoundingClientRect());var G,re=[],ce=[],ue={hoverArea:I,elGrid:B,tooltipEl:S,tooltipY:re,tooltipX:ce,ttItems:this.ttItems};if(h.globals.axisCharts&&(k?G=h.globals.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker"):_?G=h.globals.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-bar-area, .apexcharts-series .apexcharts-candlestick-area, .apexcharts-series .apexcharts-boxPlot-area, .apexcharts-series .apexcharts-rangebar-area"):p!=="heatmap"&&p!=="treemap"||(G=h.globals.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap")),G&&G.length))for(var ge=0;ge<G.length;ge++)re.push(G[ge].getAttribute("cy")),ce.push(G[ge].getAttribute("cx"));if(h.globals.xyCharts&&!this.showOnIntersect||h.globals.comboCharts&&!this.showOnIntersect||_&&this.tooltipUtil.hasBars()&&this.tConfig.shared)this.addPathsEventListeners([I],ue);else if(_&&!h.globals.comboCharts||k&&this.showOnIntersect)this.addDatapointEventsListeners(ue);else if(!h.globals.axisCharts||p==="heatmap"||p==="treemap"){var Ae=h.globals.dom.baseEl.querySelectorAll(".apexcharts-series");this.addPathsEventListeners(Ae,ue)}if(this.showOnIntersect){var ke=h.globals.dom.baseEl.querySelectorAll(".apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker");ke.length>0&&this.addPathsEventListeners(ke,ue),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(ue)}}},{key:"drawFixedTooltipRect",value:function(){var h=this.w,p=this.getElTooltip(),S=p.getBoundingClientRect(),_=S.width+10,k=S.height+10,I=this.tConfig.fixed.offsetX,B=this.tConfig.fixed.offsetY,G=this.tConfig.fixed.position.toLowerCase();return G.indexOf("right")>-1&&(I=I+h.globals.svgWidth-_+10),G.indexOf("bottom")>-1&&(B=B+h.globals.svgHeight-k-10),p.style.left=I+"px",p.style.top=B+"px",{x:I,y:B,ttWidth:_,ttHeight:k}}},{key:"addDatapointEventsListeners",value:function(h){var p=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(p,h)}},{key:"addPathsEventListeners",value:function(h,p){for(var S=this,_=function(I){var B={paths:h[I],tooltipEl:p.tooltipEl,tooltipY:p.tooltipY,tooltipX:p.tooltipX,elGrid:p.elGrid,hoverArea:p.hoverArea,ttItems:p.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map(function(G){return h[I].addEventListener(G,S.onSeriesHover.bind(S,B),{capture:!1,passive:!0})})},k=0;k<h.length;k++)_(k)}},{key:"onSeriesHover",value:function(h,p){var S=this,_=Date.now()-this.lastHoverTime;_>=100?this.seriesHover(h,p):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout(function(){S.seriesHover(h,p)},100-_))}},{key:"seriesHover",value:function(h,p){var S=this;this.lastHoverTime=Date.now();var _=[],k=this.w;k.config.chart.group&&(_=this.ctx.getGroupedCharts()),k.globals.axisCharts&&(k.globals.minX===-1/0&&k.globals.maxX===1/0||k.globals.dataPoints===0)||(_.length?_.forEach(function(I){var B=S.getElTooltip(I),G={paths:h.paths,tooltipEl:B,tooltipY:h.tooltipY,tooltipX:h.tooltipX,elGrid:h.elGrid,hoverArea:h.hoverArea,ttItems:I.w.globals.tooltip.ttItems};I.w.globals.minX===S.w.globals.minX&&I.w.globals.maxX===S.w.globals.maxX&&I.w.globals.tooltip.seriesHoverByContext({chartCtx:I,ttCtx:I.w.globals.tooltip,opt:G,e:p})}):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:h,e:p}))}},{key:"seriesHoverByContext",value:function(h){var p=h.chartCtx,S=h.ttCtx,_=h.opt,k=h.e,I=p.w,B=this.getElTooltip(p);B&&(S.tooltipRect={x:0,y:0,ttWidth:B.getBoundingClientRect().width,ttHeight:B.getBoundingClientRect().height},S.e=k,S.tooltipUtil.hasBars()&&!I.globals.comboCharts&&!S.isBarShared&&this.tConfig.onDatasetHover.highlightDataSeries&&new Re(p).toggleSeriesOnHover(k,k.target.parentNode),S.fixedTooltip&&S.drawFixedTooltipRect(),I.globals.axisCharts?S.axisChartsTooltips({e:k,opt:_,tooltipRect:S.tooltipRect}):S.nonAxisChartsTooltips({e:k,opt:_,tooltipRect:S.tooltipRect}))}},{key:"axisChartsTooltips",value:function(h){var p,S,_=h.e,k=h.opt,I=this.w,B=k.elGrid.getBoundingClientRect(),G=_.type==="touchmove"?_.touches[0].clientX:_.clientX,re=_.type==="touchmove"?_.touches[0].clientY:_.clientY;if(this.clientY=re,this.clientX=G,I.globals.capturedSeriesIndex=-1,I.globals.capturedDataPointIndex=-1,re<B.top||re>B.top+B.height)this.handleMouseOut(k);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!I.config.tooltip.shared){var ce=parseInt(k.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(ce)<0)return void this.handleMouseOut(k)}var ue=this.getElTooltip(),ge=this.getElXCrosshairs(),Ae=[];I.config.chart.group&&(Ae=this.ctx.getSyncedCharts());var ke=I.globals.xyCharts||I.config.chart.type==="bar"&&!I.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||I.globals.comboCharts&&this.tooltipUtil.hasBars();if(_.type==="mousemove"||_.type==="touchmove"||_.type==="mouseup"){if(I.globals.collapsedSeries.length+I.globals.ancillaryCollapsedSeries.length===I.globals.series.length)return;ge!==null&&ge.classList.add("apexcharts-active");var Me=this.yaxisTooltips.filter(function(at){return at===!0});if(this.ycrosshairs!==null&&Me.length&&this.ycrosshairs.classList.add("apexcharts-active"),ke&&!this.showOnIntersect||Ae.length>1)this.handleStickyTooltip(_,G,re,k);else if(I.config.chart.type==="heatmap"||I.config.chart.type==="treemap"){var qe=this.intersect.handleHeatTreeTooltip({e:_,opt:k,x:p,y:S,type:I.config.chart.type});p=qe.x,S=qe.y,ue.style.left=p+"px",ue.style.top=S+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:_,opt:k}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:_,opt:k,x:p,y:S});if(this.yaxisTooltips.length)for(var Fe=0;Fe<I.config.yaxis.length;Fe++)this.axesTooltip.drawYaxisTooltipText(Fe,re,this.xyRatios);I.globals.dom.baseEl.classList.add("apexcharts-tooltip-active"),k.tooltipEl.classList.add("apexcharts-active")}else _.type!=="mouseout"&&_.type!=="touchend"||this.handleMouseOut(k)}}},{key:"nonAxisChartsTooltips",value:function(h){var p=h.e,S=h.opt,_=h.tooltipRect,k=this.w,I=S.paths.getAttribute("rel"),B=this.getElTooltip(),G=k.globals.dom.elWrap.getBoundingClientRect();if(p.type==="mousemove"||p.type==="touchmove"){k.globals.dom.baseEl.classList.add("apexcharts-tooltip-active"),B.classList.add("apexcharts-active"),this.tooltipLabels.drawSeriesTexts({ttItems:S.ttItems,i:parseInt(I,10)-1,shared:!1});var re=k.globals.clientX-G.left-_.ttWidth/2,ce=k.globals.clientY-G.top-_.ttHeight-10;if(B.style.left=re+"px",B.style.top=ce+"px",k.config.legend.tooltipHoverFormatter){var ue=I-1,ge=(0,k.config.legend.tooltipHoverFormatter)(this.legendLabels[ue].getAttribute("data:default-text"),{seriesIndex:ue,dataPointIndex:ue,w:k});this.legendLabels[ue].innerHTML=ge}}else p.type!=="mouseout"&&p.type!=="touchend"||(B.classList.remove("apexcharts-active"),k.globals.dom.baseEl.classList.remove("apexcharts-tooltip-active"),k.config.legend.tooltipHoverFormatter&&this.legendLabels.forEach(function(Ae){var ke=Ae.getAttribute("data:default-text");Ae.innerHTML=decodeURIComponent(ke)}))}},{key:"handleStickyTooltip",value:function(h,p,S,_){var k=this.w,I=this.tooltipUtil.getNearestValues({context:this,hoverArea:_.hoverArea,elGrid:_.elGrid,clientX:p,clientY:S}),B=I.j,G=I.capturedSeries;k.globals.collapsedSeriesIndices.includes(G)&&(G=null);var re=_.elGrid.getBoundingClientRect();if(I.hoverX<0||I.hoverX>re.width)this.handleMouseOut(_);else if(G!==null)this.handleStickyCapturedSeries(h,G,_,B);else if(this.tooltipUtil.isXoverlap(B)||k.globals.isBarHorizontal){var ce=k.globals.series.findIndex(function(ue,ge){return!k.globals.collapsedSeriesIndices.includes(ge)});this.create(h,this,ce,B,_.ttItems)}}},{key:"handleStickyCapturedSeries",value:function(h,p,S,_){var k=this.w;if(!this.tConfig.shared&&k.globals.series[p][_]===null)return void this.handleMouseOut(S);if(k.globals.series[p][_]!==void 0)this.tConfig.shared&&this.tooltipUtil.isXoverlap(_)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(h,this,p,_,S.ttItems):this.create(h,this,p,_,S.ttItems,!1);else if(this.tooltipUtil.isXoverlap(_)){var I=k.globals.series.findIndex(function(B,G){return!k.globals.collapsedSeriesIndices.includes(G)});this.create(h,this,I,_,S.ttItems)}}},{key:"deactivateHoverFilter",value:function(){for(var h=this.w,p=new z(this.ctx),S=h.globals.dom.Paper.select(".apexcharts-bar-area"),_=0;_<S.length;_++)p.pathMouseLeave(S[_])}},{key:"handleMouseOut",value:function(h){var p=this.w,S=this.getElXCrosshairs();if(p.globals.dom.baseEl.classList.remove("apexcharts-tooltip-active"),h.tooltipEl.classList.remove("apexcharts-active"),this.deactivateHoverFilter(),p.config.chart.type!=="bubble"&&this.marker.resetPointsSize(),S!==null&&S.classList.remove("apexcharts-active"),this.ycrosshairs!==null&&this.ycrosshairs.classList.remove("apexcharts-active"),this.isXAxisTooltipEnabled&&this.xaxisTooltip.classList.remove("apexcharts-active"),this.yaxisTooltips.length){this.yaxisTTEls===null&&(this.yaxisTTEls=p.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));for(var _=0;_<this.yaxisTTEls.length;_++)this.yaxisTTEls[_].classList.remove("apexcharts-active")}p.config.legend.tooltipHoverFormatter&&this.legendLabels.forEach(function(k){var I=k.getAttribute("data:default-text");k.innerHTML=decodeURIComponent(I)})}},{key:"markerClick",value:function(h,p,S){var _=this.w;typeof _.config.chart.events.markerClick=="function"&&_.config.chart.events.markerClick(h,this.ctx,{seriesIndex:p,dataPointIndex:S,w:_}),this.ctx.events.fireEvent("markerClick",[h,this.ctx,{seriesIndex:p,dataPointIndex:S,w:_}])}},{key:"create",value:function(h,p,S,_,k){var I,B,G,re,ce,ue,ge,Ae,ke,Me,qe,Fe,at,ie,Se,$e,Ue=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,_e=this.w,st=p;h.type==="mouseup"&&this.markerClick(h,S,_),Ue===null&&(Ue=this.tConfig.shared);var ut=this.tooltipUtil.hasMarkers(S),yt=this.tooltipUtil.getElBars();if(_e.config.legend.tooltipHoverFormatter){var Mt=_e.config.legend.tooltipHoverFormatter,Kt=Array.from(this.legendLabels);Kt.forEach(function(Fn){var Gn=Fn.getAttribute("data:default-text");Fn.innerHTML=decodeURIComponent(Gn)});for(var un=0;un<Kt.length;un++){var Xe=Kt[un],Pt=parseInt(Xe.getAttribute("i"),10),Wt=decodeURIComponent(Xe.getAttribute("data:default-text")),ct=Mt(Wt,{seriesIndex:Ue?Pt:S,dataPointIndex:_,w:_e});if(Ue)Xe.innerHTML=_e.globals.collapsedSeriesIndices.indexOf(Pt)<0?ct:Wt;else if(Xe.innerHTML=Pt===S?ct:Wt,S===Pt)break}}var Ge=y(y({ttItems:k,i:S,j:_},((I=_e.globals.seriesRange)===null||I===void 0||(B=I[S])===null||B===void 0||(G=B[_])===null||G===void 0||(re=G.y[0])===null||re===void 0?void 0:re.y1)!==void 0&&{y1:(ce=_e.globals.seriesRange)===null||ce===void 0||(ue=ce[S])===null||ue===void 0||(ge=ue[_])===null||ge===void 0||(Ae=ge.y[0])===null||Ae===void 0?void 0:Ae.y1}),((ke=_e.globals.seriesRange)===null||ke===void 0||(Me=ke[S])===null||Me===void 0||(qe=Me[_])===null||qe===void 0||(Fe=qe.y[0])===null||Fe===void 0?void 0:Fe.y2)!==void 0&&{y2:(at=_e.globals.seriesRange)===null||at===void 0||(ie=at[S])===null||ie===void 0||(Se=ie[_])===null||Se===void 0||($e=Se.y[0])===null||$e===void 0?void 0:$e.y2});if(Ue){if(st.tooltipLabels.drawSeriesTexts(y(y({},Ge),{},{shared:!this.showOnIntersect&&this.tConfig.shared})),ut)_e.globals.markers.largestSize>0?st.marker.enlargePoints(_):st.tooltipPosition.moveDynamicPointsOnHover(_);else if(this.tooltipUtil.hasBars()&&(this.barSeriesHeight=this.tooltipUtil.getBarsHeight(yt),this.barSeriesHeight>0)){var Tt=new z(this.ctx),fn=_e.globals.dom.Paper.select(".apexcharts-bar-area[j='".concat(_,"']"));this.deactivateHoverFilter(),this.tooltipPosition.moveStickyTooltipOverBars(_,S);for(var Yn=0;Yn<fn.length;Yn++)Tt.pathMouseEnter(fn[Yn])}}else st.tooltipLabels.drawSeriesTexts(y({shared:!1},Ge)),this.tooltipUtil.hasBars()&&st.tooltipPosition.moveStickyTooltipOverBars(_,S),ut&&st.tooltipPosition.moveMarkers(S,_)}}]),Ee}(),kt=function(){function Ee(h){s(this,Ee),this.w=h.w,this.barCtx=h,this.totalFormatter=this.w.config.plotOptions.bar.dataLabels.total.formatter,this.totalFormatter||(this.totalFormatter=this.w.config.dataLabels.formatter)}return o(Ee,[{key:"handleBarDataLabels",value:function(h){var p,S,_=h.x,k=h.y,I=h.y1,B=h.y2,G=h.i,re=h.j,ce=h.realIndex,ue=h.columnGroupIndex,ge=h.series,Ae=h.barHeight,ke=h.barWidth,Me=h.barXPosition,qe=h.barYPosition,Fe=h.visibleSeries,at=h.renderedPath,ie=this.w,Se=new z(this.barCtx.ctx),$e=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[ce]:this.barCtx.strokeWidth;ie.globals.isXNumeric&&!ie.globals.isBarHorizontal?(p=_+parseFloat(ke*(Fe+1)),S=k+parseFloat(Ae*(Fe+1))-$e):(p=_+parseFloat(ke*Fe),S=k+parseFloat(Ae*Fe));var Ue,_e=null,st=_,ut=k,yt={},Mt=ie.config.dataLabels,Kt=this.barCtx.barOptions.dataLabels,un=this.barCtx.barOptions.dataLabels.total;qe!==void 0&&this.barCtx.isRangeBar&&(S=qe,ut=qe),Me!==void 0&&this.barCtx.isVerticalGroupedRangeBar&&(p=Me,st=Me);var Xe=Mt.offsetX,Pt=Mt.offsetY,Wt={width:0,height:0};if(ie.config.dataLabels.enabled){var ct=ie.globals.series[G][re];Wt=Se.getTextRects(ie.config.dataLabels.formatter?ie.config.dataLabels.formatter(ct,y(y({},ie),{},{seriesIndex:G,dataPointIndex:re,w:ie})):ie.globals.yLabelFormatters[0](ct),parseFloat(Mt.style.fontSize))}var Ge={x:_,y:k,i:G,j:re,realIndex:ce,columnGroupIndex:ue,renderedPath:at,bcx:p,bcy:S,barHeight:Ae,barWidth:ke,textRects:Wt,strokeWidth:$e,dataLabelsX:st,dataLabelsY:ut,dataLabelsConfig:Mt,barDataLabelsConfig:Kt,barTotalDataLabelsConfig:un,offX:Xe,offY:Pt};return yt=this.barCtx.isHorizontal?this.calculateBarsDataLabelsPosition(Ge):this.calculateColumnsDataLabelsPosition(Ge),at.attr({cy:yt.bcy,cx:yt.bcx,j:re,val:ie.globals.series[G][re],barHeight:Ae,barWidth:ke}),Ue=this.drawCalculatedDataLabels({x:yt.dataLabelsX,y:yt.dataLabelsY,val:this.barCtx.isRangeBar?[I,B]:ie.config.chart.stackType==="100%"?ge[ce][re]:ie.globals.series[ce][re],i:ce,j:re,barWidth:ke,barHeight:Ae,textRects:Wt,dataLabelsConfig:Mt}),ie.config.chart.stacked&&un.enabled&&(_e=this.drawTotalDataLabels({x:yt.totalDataLabelsX,y:yt.totalDataLabelsY,barWidth:ke,barHeight:Ae,realIndex:ce,textAnchor:yt.totalDataLabelsAnchor,val:this.getStackedTotalDataLabel({realIndex:ce,j:re}),dataLabelsConfig:Mt,barTotalDataLabelsConfig:un})),{dataLabels:Ue,totalDataLabels:_e}}},{key:"getStackedTotalDataLabel",value:function(h){var p=h.realIndex,S=h.j,_=this.w,k=this.barCtx.stackedSeriesTotals[S];return this.totalFormatter&&(k=this.totalFormatter(k,y(y({},_),{},{seriesIndex:p,dataPointIndex:S,w:_}))),k}},{key:"calculateColumnsDataLabelsPosition",value:function(h){var p=this.w,S=h.i,_=h.j,k=h.realIndex;h.columnGroupIndex;var I,B,G=h.y,re=h.bcx,ce=h.barWidth,ue=h.barHeight,ge=h.textRects,Ae=h.dataLabelsX,ke=h.dataLabelsY,Me=h.dataLabelsConfig,qe=h.barDataLabelsConfig,Fe=h.barTotalDataLabelsConfig,at=h.strokeWidth,ie=h.offX,Se=h.offY,$e=re;ue=Math.abs(ue);var Ue=p.config.plotOptions.bar.dataLabels.orientation==="vertical",_e=this.barCtx.barHelpers.getZeroValueEncounters({i:S,j:_}).zeroEncounters;re-=at/2;var st=p.globals.gridWidth/p.globals.dataPoints;this.barCtx.isVerticalGroupedRangeBar?Ae+=ce/2:(Ae=p.globals.isXNumeric?re-ce/2+ie:re-st+ce/2+ie,_e>0&&p.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(Ae-=ce*_e)),Ue&&(Ae=Ae+ge.height/2-at/2-2);var ut=p.globals.series[S][_]<0,yt=G;switch(this.barCtx.isReversed&&(yt=G+(ut?ue:-ue)),qe.position){case"center":ke=Ue?ut?yt-ue/2+Se:yt+ue/2-Se:ut?yt-ue/2+ge.height/2+Se:yt+ue/2+ge.height/2-Se;break;case"bottom":ke=Ue?ut?yt-ue+Se:yt+ue-Se:ut?yt-ue+ge.height+at+Se:yt+ue-ge.height/2+at-Se;break;case"top":ke=Ue?ut?yt+Se:yt-Se:ut?yt-ge.height/2-Se:yt+ge.height+Se}if(this.barCtx.lastActiveBarSerieIndex===k&&Fe.enabled){var Mt=new z(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:k,j:_}),Me.fontSize);I=ut?yt-Mt.height/2-Se-Fe.offsetY+18:yt+Mt.height+Se+Fe.offsetY-18;var Kt=st;B=$e+(p.globals.isXNumeric?-ce*p.globals.barGroups.length/2:p.globals.barGroups.length*ce/2-(p.globals.barGroups.length-1)*ce-Kt)+Fe.offsetX}return p.config.chart.stacked||(ke<0?ke=0+at:ke+ge.height/3>p.globals.gridHeight&&(ke=p.globals.gridHeight-at)),{bcx:re,bcy:G,dataLabelsX:Ae,dataLabelsY:ke,totalDataLabelsX:B,totalDataLabelsY:I,totalDataLabelsAnchor:"middle"}}},{key:"calculateBarsDataLabelsPosition",value:function(h){var p=this.w,S=h.x,_=h.i,k=h.j,I=h.realIndex,B=h.bcy,G=h.barHeight,re=h.barWidth,ce=h.textRects,ue=h.dataLabelsX,ge=h.strokeWidth,Ae=h.dataLabelsConfig,ke=h.barDataLabelsConfig,Me=h.barTotalDataLabelsConfig,qe=h.offX,Fe=h.offY,at=p.globals.gridHeight/p.globals.dataPoints;re=Math.abs(re);var ie,Se,$e=B-(this.barCtx.isRangeBar?0:at)+G/2+ce.height/2+Fe-3,Ue="start",_e=p.globals.series[_][k]<0,st=S;switch(this.barCtx.isReversed&&(st=S+(_e?-re:re),Ue=_e?"start":"end"),ke.position){case"center":ue=_e?st+re/2-qe:Math.max(ce.width/2,st-re/2)+qe;break;case"bottom":ue=_e?st+re-ge-qe:st-re+ge+qe;break;case"top":ue=_e?st-ge-qe:st-ge+qe}if(this.barCtx.lastActiveBarSerieIndex===I&&Me.enabled){var ut=new z(this.barCtx.ctx).getTextRects(this.getStackedTotalDataLabel({realIndex:I,j:k}),Ae.fontSize);_e?(ie=st-ge-qe-Me.offsetX,Ue="end"):ie=st+qe+Me.offsetX+(this.barCtx.isReversed?-(re+ge):ge),Se=$e-ce.height/2+ut.height/2+Me.offsetY+ge}return p.config.chart.stacked||(Ae.textAnchor==="start"?ue-ce.width<0?ue=_e?ce.width+ge:ge:ue+ce.width>p.globals.gridWidth&&(ue=_e?p.globals.gridWidth-ge:p.globals.gridWidth-ce.width-ge):Ae.textAnchor==="middle"?ue-ce.width/2<0?ue=ce.width/2+ge:ue+ce.width/2>p.globals.gridWidth&&(ue=p.globals.gridWidth-ce.width/2-ge):Ae.textAnchor==="end"&&(ue<1?ue=ce.width+ge:ue+1>p.globals.gridWidth&&(ue=p.globals.gridWidth-ce.width-ge))),{bcx:S,bcy:B,dataLabelsX:ue,dataLabelsY:$e,totalDataLabelsX:ie,totalDataLabelsY:Se,totalDataLabelsAnchor:Ue}}},{key:"drawCalculatedDataLabels",value:function(h){var p=h.x,S=h.y,_=h.val,k=h.i,I=h.j,B=h.textRects,G=h.barHeight,re=h.barWidth,ce=h.dataLabelsConfig,ue=this.w,ge="rotate(0)";ue.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(ge="rotate(-90, ".concat(p,", ").concat(S,")"));var Ae=new Ie(this.barCtx.ctx),ke=new z(this.barCtx.ctx),Me=ce.formatter,qe=null,Fe=ue.globals.collapsedSeriesIndices.indexOf(k)>-1;if(ce.enabled&&!Fe){qe=ke.group({class:"apexcharts-data-labels",transform:ge});var at="";_!==void 0&&(at=Me(_,y(y({},ue),{},{seriesIndex:k,dataPointIndex:I,w:ue}))),!_&&ue.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(at="");var ie=ue.globals.series[k][I]<0,Se=ue.config.plotOptions.bar.dataLabels.position;ue.config.plotOptions.bar.dataLabels.orientation==="vertical"&&(Se==="top"&&(ce.textAnchor=ie?"end":"start"),Se==="center"&&(ce.textAnchor="middle"),Se==="bottom"&&(ce.textAnchor=ie?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&re<ke.getTextRects(at,parseFloat(ce.style.fontSize)).width&&(at=""),ue.config.chart.stacked&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&(this.barCtx.isHorizontal?B.width/1.6>Math.abs(re)&&(at=""):B.height/1.6>Math.abs(G)&&(at=""));var $e=y({},ce);this.barCtx.isHorizontal&&_<0&&(ce.textAnchor==="start"?$e.textAnchor="end":ce.textAnchor==="end"&&($e.textAnchor="start")),Ae.plotDataLabelsText({x:p,y:S,text:at,i:k,j:I,parent:qe,dataLabelsConfig:$e,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return qe}},{key:"drawTotalDataLabels",value:function(h){var p=h.x,S=h.y,_=h.val,k=h.realIndex,I=h.textAnchor,B=h.barTotalDataLabelsConfig;this.w;var G,re=new z(this.barCtx.ctx);return B.enabled&&p!==void 0&&S!==void 0&&this.barCtx.lastActiveBarSerieIndex===k&&(G=re.drawText({x:p,y:S,foreColor:B.style.color,text:_,textAnchor:I,fontFamily:B.style.fontFamily,fontSize:B.style.fontSize,fontWeight:B.style.fontWeight})),G}}]),Ee}(),dn=function(){function Ee(h){s(this,Ee),this.w=h.w,this.barCtx=h}return o(Ee,[{key:"initVariables",value:function(h){var p=this.w;this.barCtx.series=h,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var S=0;S<h.length;S++)if(h[S].length>0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=h[S].length),p.globals.isXNumeric)for(var _=0;_<h[S].length;_++)p.globals.seriesX[S][_]>p.globals.minX&&p.globals.seriesX[S][_]<p.globals.maxX&&this.barCtx.visibleItems++;else this.barCtx.visibleItems=p.globals.dataPoints;this.arrBorderRadius=this.createBorderRadiusArr(p.globals.series),this.barCtx.seriesLen===0&&(this.barCtx.seriesLen=1),this.barCtx.zeroSerieses=[],p.globals.comboCharts||this.checkZeroSeries({series:h})}},{key:"initialPositions",value:function(){var h,p,S,_,k,I,B,G,re=this.w,ce=re.globals.dataPoints;this.barCtx.isRangeBar&&(ce=re.globals.labels.length);var ue=this.barCtx.seriesLen;if(re.config.plotOptions.bar.rangeBarGroupRows&&(ue=1),this.barCtx.isHorizontal)k=(S=re.globals.gridHeight/ce)/ue,re.globals.isXNumeric&&(k=(S=re.globals.gridHeight/this.barCtx.totalItems)/this.barCtx.seriesLen),k=k*parseInt(this.barCtx.barOptions.barHeight,10)/100,String(this.barCtx.barOptions.barHeight).indexOf("%")===-1&&(k=parseInt(this.barCtx.barOptions.barHeight,10)),G=this.barCtx.baseLineInvertedY+re.globals.padHorizontal+(this.barCtx.isReversed?re.globals.gridWidth:0)-(this.barCtx.isReversed?2*this.barCtx.baseLineInvertedY:0),this.barCtx.isFunnel&&(G=re.globals.gridWidth/2),p=(S-k*this.barCtx.seriesLen)/2;else{if(_=re.globals.gridWidth/this.barCtx.visibleItems,re.config.xaxis.convertedCatToNumeric&&(_=re.globals.gridWidth/re.globals.dataPoints),I=_/ue*parseInt(this.barCtx.barOptions.columnWidth,10)/100,re.globals.isXNumeric){var ge=this.barCtx.xRatio;re.globals.minXDiff&&re.globals.minXDiff!==.5&&re.globals.minXDiff/ge>0&&(_=re.globals.minXDiff/ge),(I=_/ue*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(I=1)}String(this.barCtx.barOptions.columnWidth).indexOf("%")===-1&&(I=parseInt(this.barCtx.barOptions.columnWidth,10)),B=re.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?re.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),h=re.globals.padHorizontal+(_-I*this.barCtx.seriesLen)/2}return re.globals.barHeight=k,re.globals.barWidth=I,{x:h,y:p,yDivision:S,xDivision:_,barHeight:k,barWidth:I,zeroH:B,zeroW:G}}},{key:"initializeStackedPrevVars",value:function(h){h.w.globals.seriesGroups.forEach(function(p){h[p]||(h[p]={}),h[p].prevY=[],h[p].prevX=[],h[p].prevYF=[],h[p].prevXF=[],h[p].prevYVal=[],h[p].prevXVal=[]})}},{key:"initializeStackedXYVars",value:function(h){h.w.globals.seriesGroups.forEach(function(p){h[p]||(h[p]={}),h[p].xArrj=[],h[p].xArrjF=[],h[p].xArrjVal=[],h[p].yArrj=[],h[p].yArrjF=[],h[p].yArrjVal=[]})}},{key:"getPathFillColor",value:function(h,p,S,_){var k,I,B,G,re,ce=this.w,ue=this.barCtx.ctx.fill,ge=null,Ae=this.barCtx.barOptions.distributed?S:p;return this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map(function(ke){h[p][S]>=ke.from&&h[p][S]<=ke.to&&(ge=ke.color)}),(k=ce.config.series[p].data[S])!==null&&k!==void 0&&k.fillColor&&(ge=ce.config.series[p].data[S].fillColor),ue.fillPath({seriesNumber:this.barCtx.barOptions.distributed?Ae:_,dataPointIndex:S,color:ge,value:h[p][S],fillConfig:(I=ce.config.series[p].data[S])===null||I===void 0?void 0:I.fill,fillType:(B=ce.config.series[p].data[S])!==null&&B!==void 0&&(G=B.fill)!==null&&G!==void 0&&G.type?(re=ce.config.series[p].data[S])===null||re===void 0?void 0:re.fill.type:Array.isArray(ce.config.fill.type)?ce.config.fill.type[_]:ce.config.fill.type})}},{key:"getStrokeWidth",value:function(h,p,S){var _=0,k=this.w;return this.barCtx.series[h][p]?this.barCtx.isNullValue=!1:this.barCtx.isNullValue=!0,k.config.stroke.show&&(this.barCtx.isNullValue||(_=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[S]:this.barCtx.strokeWidth)),_}},{key:"createBorderRadiusArr",value:function(h){var p=this.w,S=!this.w.config.chart.stacked||p.config.plotOptions.bar.borderRadiusWhenStacked!=="last"||p.config.plotOptions.bar.borderRadius<=0,_=h.length,k=h[0].length,I=Array.from({length:_},function(){return Array(k).fill(S?"top":"none")});if(S)return I;for(var B=0;B<k;B++){for(var G=[],re=[],ce=0,ue=0;ue<_;ue++){var ge=h[ue][B];ge>0?(G.push(ue),ce++):ge<0&&(re.push(ue),ce++)}if(G.length>0&&re.length===0)if(G.length===1)I[G[0]][B]="both";else{var Ae,ke=G[0],Me=G[G.length-1],qe=l(G);try{for(qe.s();!(Ae=qe.n()).done;){var Fe=Ae.value;I[Fe][B]=Fe===ke?"bottom":Fe===Me?"top":"none"}}catch(Pt){qe.e(Pt)}finally{qe.f()}}else if(re.length>0&&G.length===0)if(re.length===1)I[re[0]][B]="both";else{var at,ie=re[0],Se=re[re.length-1],$e=l(re);try{for($e.s();!(at=$e.n()).done;){var Ue=at.value;I[Ue][B]=Ue===ie?"bottom":Ue===Se?"top":"none"}}catch(Pt){$e.e(Pt)}finally{$e.f()}}else if(G.length>0&&re.length>0){var _e,st=G[G.length-1],ut=l(G);try{for(ut.s();!(_e=ut.n()).done;){var yt=_e.value;I[yt][B]=yt===st?"top":"none"}}catch(Pt){ut.e(Pt)}finally{ut.f()}var Mt,Kt=re[re.length-1],un=l(re);try{for(un.s();!(Mt=un.n()).done;){var Xe=Mt.value;I[Xe][B]=Xe===Kt?"bottom":"none"}}catch(Pt){un.e(Pt)}finally{un.f()}}else ce===1&&(I[G[0]||re[0]][B]="both")}return I}},{key:"barBackground",value:function(h){var p=h.j,S=h.i,_=h.x1,k=h.x2,I=h.y1,B=h.y2,G=h.elSeries,re=this.w,ce=new z(this.barCtx.ctx),ue=new Re(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&ue===S){p>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(p%=this.barCtx.barOptions.colors.backgroundBarColors.length);var ge=this.barCtx.barOptions.colors.backgroundBarColors[p],Ae=ce.drawRect(_!==void 0?_:0,I!==void 0?I:0,k!==void 0?k:re.globals.gridWidth,B!==void 0?B:re.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,ge,this.barCtx.barOptions.colors.backgroundBarOpacity);G.add(Ae),Ae.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(h){var p,S=h.barWidth,_=h.barXPosition,k=h.y1,I=h.y2,B=h.strokeWidth,G=h.isReversed,re=h.series,ce=h.seriesGroup,ue=h.realIndex,ge=h.i,Ae=h.j,ke=h.w,Me=new z(this.barCtx.ctx);(B=Array.isArray(B)?B[ue]:B)||(B=0);var qe=S,Fe=_;(p=ke.config.series[ue].data[Ae])!==null&&p!==void 0&&p.columnWidthOffset&&(Fe=_-ke.config.series[ue].data[Ae].columnWidthOffset/2,qe=S+ke.config.series[ue].data[Ae].columnWidthOffset);var at=B/2,ie=Fe+at,Se=Fe+qe-at,$e=(re[ge][Ae]>=0?1:-1)*(G?-1:1);k+=.001-at*$e,I+=.001+at*$e;var Ue=Me.move(ie,k),_e=Me.move(ie,k),st=Me.line(Se,k);if(ke.globals.previousPaths.length>0&&(_e=this.barCtx.getPreviousPath(ue,Ae,!1)),Ue=Ue+Me.line(ie,I)+Me.line(Se,I)+st+(ke.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ae]==="both"?" Z":" z"),_e=_e+Me.line(ie,k)+st+st+st+st+st+Me.line(ie,k)+(ke.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ae]==="both"?" Z":" z"),this.arrBorderRadius[ue][Ae]!=="none"&&(Ue=Me.roundPathCorners(Ue,ke.config.plotOptions.bar.borderRadius)),ke.config.chart.stacked){var ut=this.barCtx;(ut=this.barCtx[ce]).yArrj.push(I-at*$e),ut.yArrjF.push(Math.abs(k-I+B*$e)),ut.yArrjVal.push(this.barCtx.series[ge][Ae])}return{pathTo:Ue,pathFrom:_e}}},{key:"getBarpaths",value:function(h){var p,S=h.barYPosition,_=h.barHeight,k=h.x1,I=h.x2,B=h.strokeWidth,G=h.isReversed,re=h.series,ce=h.seriesGroup,ue=h.realIndex,ge=h.i,Ae=h.j,ke=h.w,Me=new z(this.barCtx.ctx);(B=Array.isArray(B)?B[ue]:B)||(B=0);var qe=S,Fe=_;(p=ke.config.series[ue].data[Ae])!==null&&p!==void 0&&p.barHeightOffset&&(qe=S-ke.config.series[ue].data[Ae].barHeightOffset/2,Fe=_+ke.config.series[ue].data[Ae].barHeightOffset);var at=B/2,ie=qe+at,Se=qe+Fe-at,$e=(re[ge][Ae]>=0?1:-1)*(G?-1:1);k+=.001+at*$e,I+=.001-at*$e;var Ue=Me.move(k,ie),_e=Me.move(k,ie);ke.globals.previousPaths.length>0&&(_e=this.barCtx.getPreviousPath(ue,Ae,!1));var st=Me.line(k,Se);if(Ue=Ue+Me.line(I,ie)+Me.line(I,Se)+st+(ke.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ae]==="both"?" Z":" z"),_e=_e+Me.line(k,ie)+st+st+st+st+st+Me.line(k,ie)+(ke.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[ue][Ae]==="both"?" Z":" z"),this.arrBorderRadius[ue][Ae]!=="none"&&(Ue=Me.roundPathCorners(Ue,ke.config.plotOptions.bar.borderRadius)),ke.config.chart.stacked){var ut=this.barCtx;(ut=this.barCtx[ce]).xArrj.push(I+at*$e),ut.xArrjF.push(Math.abs(k-I-B*$e)),ut.xArrjVal.push(this.barCtx.series[ge][Ae])}return{pathTo:Ue,pathFrom:_e}}},{key:"checkZeroSeries",value:function(h){for(var p=h.series,S=this.w,_=0;_<p.length;_++){for(var k=0,I=0;I<p[S.globals.maxValsInArrayIndex].length;I++)k+=p[_][I];k===0&&this.barCtx.zeroSerieses.push(_)}}},{key:"getXForValue",value:function(h,p){var S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2]?p:null;return h!=null&&(S=p+h/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?h/this.barCtx.invertedYRatio:0)),S}},{key:"getYForValue",value:function(h,p,S){var _=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3]?p:null;return h!=null&&(_=p-h/this.barCtx.yRatio[S]+2*(this.barCtx.isReversed?h/this.barCtx.yRatio[S]:0)),_}},{key:"getGoalValues",value:function(h,p,S,_,k,I){var B=this,G=this.w,re=[],ce=function(Ae,ke){var Me;re.push((u(Me={},h,h==="x"?B.getXForValue(Ae,p,!1):B.getYForValue(Ae,S,I,!1)),u(Me,"attrs",ke),Me))};if(G.globals.seriesGoals[_]&&G.globals.seriesGoals[_][k]&&Array.isArray(G.globals.seriesGoals[_][k])&&G.globals.seriesGoals[_][k].forEach(function(Ae){ce(Ae.value,Ae)}),this.barCtx.barOptions.isDumbbell&&G.globals.seriesRange.length){var ue=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:G.globals.colors,ge={strokeHeight:h==="x"?0:G.globals.markers.size[_],strokeWidth:h==="x"?G.globals.markers.size[_]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(ue[_])?ue[_][0]:ue[_]};ce(G.globals.seriesRangeStart[_][k],ge),ce(G.globals.seriesRangeEnd[_][k],y(y({},ge),{},{strokeColor:Array.isArray(ue[_])?ue[_][1]:ue[_]}))}return re}},{key:"drawGoalLine",value:function(h){var p=h.barXPosition,S=h.barYPosition,_=h.goalX,k=h.goalY,I=h.barWidth,B=h.barHeight,G=new z(this.barCtx.ctx),re=G.group({className:"apexcharts-bar-goals-groups"});re.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:re.node}),re.attr("clip-path","url(#gridRectMarkerMask".concat(this.barCtx.w.globals.cuid,")"));var ce=null;return this.barCtx.isHorizontal?Array.isArray(_)&&_.forEach(function(ue){if(ue.x>=-1&&ue.x<=G.w.globals.gridWidth+1){var ge=ue.attrs.strokeHeight!==void 0?ue.attrs.strokeHeight:B/2,Ae=S+ge+B/2;ce=G.drawLine(ue.x,Ae-2*ge,ue.x,Ae,ue.attrs.strokeColor?ue.attrs.strokeColor:void 0,ue.attrs.strokeDashArray,ue.attrs.strokeWidth?ue.attrs.strokeWidth:2,ue.attrs.strokeLineCap),re.add(ce)}}):Array.isArray(k)&&k.forEach(function(ue){if(ue.y>=-1&&ue.y<=G.w.globals.gridHeight+1){var ge=ue.attrs.strokeWidth!==void 0?ue.attrs.strokeWidth:I/2,Ae=p+ge+I/2;ce=G.drawLine(Ae-2*ge,ue.y,Ae,ue.y,ue.attrs.strokeColor?ue.attrs.strokeColor:void 0,ue.attrs.strokeDashArray,ue.attrs.strokeHeight?ue.attrs.strokeHeight:2,ue.attrs.strokeLineCap),re.add(ce)}}),re}},{key:"drawBarShadow",value:function(h){var p=h.prevPaths,S=h.currPaths,_=h.color,k=this.w,I=p.x,B=p.x1,G=p.barYPosition,re=S.x,ce=S.x1,ue=S.barYPosition,ge=G+S.barHeight,Ae=new z(this.barCtx.ctx),ke=new F,Me=Ae.move(B,ge)+Ae.line(I,ge)+Ae.line(re,ue)+Ae.line(ce,ue)+Ae.line(B,ge)+(k.config.plotOptions.bar.borderRadiusApplication==="around"||this.arrBorderRadius[realIndex][j]==="both"?" Z":" z");return Ae.drawPath({d:Me,fill:ke.shadeColor(.5,F.rgb2hex(_)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadows"})}},{key:"getZeroValueEncounters",value:function(h){var p,S=h.i,_=h.j,k=this.w,I=0,B=0;return(k.config.plotOptions.bar.horizontal?k.globals.series.map(function(G,re){return re}):((p=k.globals.columnSeries)===null||p===void 0?void 0:p.i.map(function(G){return G}))||[]).forEach(function(G){var re=k.globals.seriesPercent[G][_];re&&I++,G<S&&re===0&&B++}),{nonZeroColumns:I,zeroEncounters:B}}},{key:"getGroupIndex",value:function(h){var p=this.w,S=p.globals.seriesGroups.findIndex(function(I){return I.indexOf(p.globals.seriesNames[h])>-1}),_=this.barCtx.columnGroupIndices,k=_.indexOf(S);return k<0&&(_.push(S),k=_.length-1),{groupIndex:S,columnGroupIndex:k}}}]),Ee}(),rn=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.w=h.w;var S=this.w;this.barOptions=S.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=S.config.stroke.width,this.isNullValue=!1,this.isRangeBar=S.globals.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!S.globals.isBarHorizontal&&S.globals.seriesRange.length&&S.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.xyRatios=p,this.xyRatios!==null&&(this.xRatio=p.xRatio,this.yRatio=p.yRatio,this.invertedXRatio=p.invertedXRatio,this.invertedYRatio=p.invertedYRatio,this.baseLineY=p.baseLineY,this.baseLineInvertedY=p.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[];var _=new Re(this.ctx);this.lastActiveBarSerieIndex=_.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];var k=_.getBarSeriesIndices(),I=new X(this.ctx);this.stackedSeriesTotals=I.getStackedSeriesTotals(this.w.config.series.map(function(B,G){return k.indexOf(G)===-1?G:-1}).filter(function(B){return B!==-1})),this.barHelpers=new dn(this)}return o(Ee,[{key:"draw",value:function(h,p){var S=this.w,_=new z(this.ctx),k=new X(this.ctx,S);h=k.getLogSeries(h),this.series=h,this.yRatio=k.getLogYRatios(this.yRatio),this.barHelpers.initVariables(h);var I=_.group({class:"apexcharts-bar-series apexcharts-plot-series"});S.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering - ApexCharts");for(var B=0,G=0;B<h.length;B++,G++){var re,ce,ue,ge,Ae=void 0,ke=void 0,Me=[],qe=[],Fe=S.globals.comboCharts?p[B]:B,at=this.barHelpers.getGroupIndex(Fe).columnGroupIndex,ie=_.group({class:"apexcharts-series",rel:B+1,seriesName:F.escapeString(S.globals.seriesNames[Fe]),"data:realIndex":Fe});this.ctx.series.addCollapsedClassToSeries(ie,Fe),h[B].length>0&&(this.visibleI=this.visibleI+1);var Se=0,$e=0;this.yRatio.length>1&&(this.yaxisIndex=S.globals.seriesYAxisReverseMap[Fe],this.translationsIndex=Fe);var Ue=this.translationsIndex;this.isReversed=S.config.yaxis[this.yaxisIndex]&&S.config.yaxis[this.yaxisIndex].reversed;var _e=this.barHelpers.initialPositions();ke=_e.y,Se=_e.barHeight,ce=_e.yDivision,ge=_e.zeroW,Ae=_e.x,$e=_e.barWidth,re=_e.xDivision,ue=_e.zeroH,this.horizontal||qe.push(Ae+$e/2);var st=_.group({class:"apexcharts-datalabels","data:realIndex":Fe});S.globals.delayedElements.push({el:st.node}),st.node.classList.add("apexcharts-element-hidden");var ut=_.group({class:"apexcharts-bar-goals-markers"}),yt=_.group({class:"apexcharts-bar-shadows"});S.globals.delayedElements.push({el:yt.node}),yt.node.classList.add("apexcharts-element-hidden");for(var Mt=0;Mt<h[B].length;Mt++){var Kt=this.barHelpers.getStrokeWidth(B,Mt,Fe),un=null,Xe={indexes:{i:B,j:Mt,realIndex:Fe,translationsIndex:Ue,bc:G},x:Ae,y:ke,strokeWidth:Kt,elSeries:ie};this.isHorizontal?(un=this.drawBarPaths(y(y({},Xe),{},{barHeight:Se,zeroW:ge,yDivision:ce})),$e=this.series[B][Mt]/this.invertedYRatio):(un=this.drawColumnPaths(y(y({},Xe),{},{xDivision:re,barWidth:$e,zeroH:ue})),Se=this.series[B][Mt]/this.yRatio[Ue]);var Pt=this.barHelpers.getPathFillColor(h,B,Mt,Fe);if(this.isFunnel&&this.barOptions.isFunnel3d&&this.pathArr.length&&Mt>0){var Wt=this.barHelpers.drawBarShadow({color:typeof Pt=="string"&&(Pt==null?void 0:Pt.indexOf("url"))===-1?Pt:F.hexToRgba(S.globals.colors[B]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:un});Wt&&yt.add(Wt)}this.pathArr.push(un);var ct=this.barHelpers.drawGoalLine({barXPosition:un.barXPosition,barYPosition:un.barYPosition,goalX:un.goalX,goalY:un.goalY,barHeight:Se,barWidth:$e});ct&&ut.add(ct),ke=un.y,Ae=un.x,Mt>0&&qe.push(Ae+$e/2),Me.push(ke),this.renderSeries({realIndex:Fe,pathFill:Pt,j:Mt,i:B,columnGroupIndex:at,pathFrom:un.pathFrom,pathTo:un.pathTo,strokeWidth:Kt,elSeries:ie,x:Ae,y:ke,series:h,barHeight:Math.abs(un.barHeight?un.barHeight:Se),barWidth:Math.abs(un.barWidth?un.barWidth:$e),elDataLabelsWrap:st,elGoalsMarkers:ut,elBarShadows:yt,visibleSeries:this.visibleI,type:"bar"})}S.globals.seriesXvalues[Fe]=qe,S.globals.seriesYvalues[Fe]=Me,I.add(ie)}return I}},{key:"renderSeries",value:function(h){var p=h.realIndex,S=h.pathFill,_=h.lineFill,k=h.j,I=h.i,B=h.columnGroupIndex,G=h.pathFrom,re=h.pathTo,ce=h.strokeWidth,ue=h.elSeries,ge=h.x,Ae=h.y,ke=h.y1,Me=h.y2,qe=h.series,Fe=h.barHeight,at=h.barWidth,ie=h.barXPosition,Se=h.barYPosition,$e=h.elDataLabelsWrap,Ue=h.elGoalsMarkers,_e=h.elBarShadows,st=h.visibleSeries,ut=h.type,yt=h.classes,Mt=this.w,Kt=new z(this.ctx);if(!_){var un=typeof Mt.globals.stroke.colors[p]=="function"?function(Ge){var Tt,fn=Mt.config.stroke.colors;return Array.isArray(fn)&&fn.length>0&&((Tt=fn[Ge])||(Tt=""),typeof Tt=="function")?Tt({value:Mt.globals.series[Ge][k],dataPointIndex:k,w:Mt}):Tt}(p):Mt.globals.stroke.colors[p];_=this.barOptions.distributed?Mt.globals.stroke.colors[k]:un}Mt.config.series[I].data[k]&&Mt.config.series[I].data[k].strokeColor&&(_=Mt.config.series[I].data[k].strokeColor),this.isNullValue&&(S="none");var Xe=k/Mt.config.chart.animations.animateGradually.delay*(Mt.config.chart.animations.speed/Mt.globals.dataPoints)/2.4,Pt=Kt.renderPaths({i:I,j:k,realIndex:p,pathFrom:G,pathTo:re,stroke:_,strokeWidth:ce,strokeLineCap:Mt.config.stroke.lineCap,fill:S,animationDelay:Xe,initialSpeed:Mt.config.chart.animations.speed,dataChangeSpeed:Mt.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(ut,"-area ").concat(yt),chartType:ut});Pt.attr("clip-path","url(#gridRectBarMask".concat(Mt.globals.cuid,")"));var Wt=Mt.config.forecastDataPoints;Wt.count>0&&k>=Mt.globals.dataPoints-Wt.count&&(Pt.node.setAttribute("stroke-dasharray",Wt.dashArray),Pt.node.setAttribute("stroke-width",Wt.strokeWidth),Pt.node.setAttribute("fill-opacity",Wt.fillOpacity)),ke!==void 0&&Me!==void 0&&(Pt.attr("data-range-y1",ke),Pt.attr("data-range-y2",Me)),new L(this.ctx).setSelectionFilter(Pt,p,k),ue.add(Pt);var ct=new kt(this).handleBarDataLabels({x:ge,y:Ae,y1:ke,y2:Me,i:I,j:k,series:qe,realIndex:p,columnGroupIndex:B,barHeight:Fe,barWidth:at,barXPosition:ie,barYPosition:Se,renderedPath:Pt,visibleSeries:st});return ct.dataLabels!==null&&$e.add(ct.dataLabels),ct.totalDataLabels&&$e.add(ct.totalDataLabels),ue.add($e),Ue&&ue.add(Ue),_e&&ue.add(_e),ue}},{key:"drawBarPaths",value:function(h){var p,S=h.indexes,_=h.barHeight,k=h.strokeWidth,I=h.zeroW,B=h.x,G=h.y,re=h.yDivision,ce=h.elSeries,ue=this.w,ge=S.i,Ae=S.j;if(ue.globals.isXNumeric)p=(G=(ue.globals.seriesX[ge][Ae]-ue.globals.minX)/this.invertedXRatio-_)+_*this.visibleI;else if(ue.config.plotOptions.bar.hideZeroBarsWhenGrouped){var ke=0,Me=0;ue.globals.seriesPercent.forEach(function(Fe,at){Fe[Ae]&&ke++,at<ge&&Fe[Ae]===0&&Me++}),ke>0&&(_=this.seriesLen*_/ke),p=G+_*this.visibleI,p-=_*Me}else p=G+_*this.visibleI;this.isFunnel&&(I-=(this.barHelpers.getXForValue(this.series[ge][Ae],I)-I)/2),B=this.barHelpers.getXForValue(this.series[ge][Ae],I);var qe=this.barHelpers.getBarpaths({barYPosition:p,barHeight:_,x1:I,x2:B,strokeWidth:k,isReversed:this.isReversed,series:this.series,realIndex:S.realIndex,i:ge,j:Ae,w:ue});return ue.globals.isXNumeric||(G+=re),this.barHelpers.barBackground({j:Ae,i:ge,y1:p-_*this.visibleI,y2:_*this.seriesLen,elSeries:ce}),{pathTo:qe.pathTo,pathFrom:qe.pathFrom,x1:I,x:B,y:G,goalX:this.barHelpers.getGoalValues("x",I,null,ge,Ae),barYPosition:p,barHeight:_}}},{key:"drawColumnPaths",value:function(h){var p,S=h.indexes,_=h.x,k=h.y,I=h.xDivision,B=h.barWidth,G=h.zeroH,re=h.strokeWidth,ce=h.elSeries,ue=this.w,ge=S.realIndex,Ae=S.translationsIndex,ke=S.i,Me=S.j,qe=S.bc;if(ue.globals.isXNumeric){var Fe=this.getBarXForNumericXAxis({x:_,j:Me,realIndex:ge,barWidth:B});_=Fe.x,p=Fe.barXPosition}else if(ue.config.plotOptions.bar.hideZeroBarsWhenGrouped){var at=this.barHelpers.getZeroValueEncounters({i:ke,j:Me}),ie=at.nonZeroColumns,Se=at.zeroEncounters;ie>0&&(B=this.seriesLen*B/ie),p=_+B*this.visibleI,p-=B*Se}else p=_+B*this.visibleI;k=this.barHelpers.getYForValue(this.series[ke][Me],G,Ae);var $e=this.barHelpers.getColumnPaths({barXPosition:p,barWidth:B,y1:G,y2:k,strokeWidth:re,isReversed:this.isReversed,series:this.series,realIndex:ge,i:ke,j:Me,w:ue});return ue.globals.isXNumeric||(_+=I),this.barHelpers.barBackground({bc:qe,j:Me,i:ke,x1:p-re/2-B*this.visibleI,x2:B*this.seriesLen+re/2,elSeries:ce}),{pathTo:$e.pathTo,pathFrom:$e.pathFrom,x:_,y:k,goalY:this.barHelpers.getGoalValues("y",null,G,ke,Me,Ae),barXPosition:p,barWidth:B}}},{key:"getBarXForNumericXAxis",value:function(h){var p=h.x,S=h.barWidth,_=h.realIndex,k=h.j,I=this.w,B=_;return I.globals.seriesX[_].length||(B=I.globals.maxValsInArrayIndex),I.globals.seriesX[B][k]&&(p=(I.globals.seriesX[B][k]-I.globals.minX)/this.xRatio-S*this.seriesLen/2),{barXPosition:p+S*this.visibleI,x:p}}},{key:"getPreviousPath",value:function(h,p){for(var S,_=this.w,k=0;k<_.globals.previousPaths.length;k++){var I=_.globals.previousPaths[k];I.paths&&I.paths.length>0&&parseInt(I.realIndex,10)===parseInt(h,10)&&_.globals.previousPaths[k].paths[p]!==void 0&&(S=_.globals.previousPaths[k].paths[p].d)}return S}}]),Ee}(),gn=function(Ee){f(p,rn);var h=c(p);function p(){return s(this,p),h.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,_){var k=this,I=this.w;this.graphics=new z(this.ctx),this.bar=new rn(this.ctx,this.xyRatios);var B=new X(this.ctx,I);S=B.getLogSeries(S),this.yRatio=B.getLogYRatios(this.yRatio),this.barHelpers.initVariables(S),I.config.chart.stackType==="100%"&&(S=I.globals.comboCharts?_.map(function(ke){return I.globals.seriesPercent[ke]}):I.globals.seriesPercent.slice()),this.series=S,this.barHelpers.initializeStackedPrevVars(this);for(var G=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),re=0,ce=0,ue=function(ke,Me){var qe=void 0,Fe=void 0,at=void 0,ie=void 0,Se=I.globals.comboCharts?_[ke]:ke,$e=k.barHelpers.getGroupIndex(Se),Ue=$e.groupIndex,_e=$e.columnGroupIndex;k.groupCtx=k[I.globals.seriesGroups[Ue]];var st=[],ut=[],yt=0;k.yRatio.length>1&&(k.yaxisIndex=I.globals.seriesYAxisReverseMap[Se][0],yt=Se),k.isReversed=I.config.yaxis[k.yaxisIndex]&&I.config.yaxis[k.yaxisIndex].reversed;var Mt=k.graphics.group({class:"apexcharts-series",seriesName:F.escapeString(I.globals.seriesNames[Se]),rel:ke+1,"data:realIndex":Se});k.ctx.series.addCollapsedClassToSeries(Mt,Se);var Kt=k.graphics.group({class:"apexcharts-datalabels","data:realIndex":Se}),un=k.graphics.group({class:"apexcharts-bar-goals-markers"}),Xe=0,Pt=0,Wt=k.initialPositions(re,ce,qe,Fe,at,ie,yt);ce=Wt.y,Xe=Wt.barHeight,Fe=Wt.yDivision,ie=Wt.zeroW,re=Wt.x,Pt=Wt.barWidth,qe=Wt.xDivision,at=Wt.zeroH,I.globals.barHeight=Xe,I.globals.barWidth=Pt,k.barHelpers.initializeStackedXYVars(k),k.groupCtx.prevY.length===1&&k.groupCtx.prevY[0].every(function(Sr){return isNaN(Sr)})&&(k.groupCtx.prevY[0]=k.groupCtx.prevY[0].map(function(){return at}),k.groupCtx.prevYF[0]=k.groupCtx.prevYF[0].map(function(){return 0}));for(var ct=0;ct<I.globals.dataPoints;ct++){var Ge=k.barHelpers.getStrokeWidth(ke,ct,Se),Tt={indexes:{i:ke,j:ct,realIndex:Se,translationsIndex:yt,bc:Me},strokeWidth:Ge,x:re,y:ce,elSeries:Mt,columnGroupIndex:_e,seriesGroup:I.globals.seriesGroups[Ue]},fn=null;k.isHorizontal?(fn=k.drawStackedBarPaths(y(y({},Tt),{},{zeroW:ie,barHeight:Xe,yDivision:Fe})),Pt=k.series[ke][ct]/k.invertedYRatio):(fn=k.drawStackedColumnPaths(y(y({},Tt),{},{xDivision:qe,barWidth:Pt,zeroH:at})),Xe=k.series[ke][ct]/k.yRatio[yt]);var Yn=k.barHelpers.drawGoalLine({barXPosition:fn.barXPosition,barYPosition:fn.barYPosition,goalX:fn.goalX,goalY:fn.goalY,barHeight:Xe,barWidth:Pt});Yn&&un.add(Yn),ce=fn.y,re=fn.x,st.push(re),ut.push(ce);var Fn=k.barHelpers.getPathFillColor(S,ke,ct,Se),Gn="";I.globals.isBarHorizontal?k.barHelpers.arrBorderRadius[Se][ct]==="bottom"&&I.globals.series[Se][ct]>0&&(Gn="apexcharts-flip-x"):k.barHelpers.arrBorderRadius[Se][ct]==="bottom"&&I.globals.series[Se][ct]>0&&(Gn="apexcharts-flip-y"),Mt=k.renderSeries({realIndex:Se,pathFill:Fn,j:ct,i:ke,columnGroupIndex:_e,pathFrom:fn.pathFrom,pathTo:fn.pathTo,strokeWidth:Ge,elSeries:Mt,x:re,y:ce,series:S,barHeight:Xe,barWidth:Pt,elDataLabelsWrap:Kt,elGoalsMarkers:un,type:"bar",visibleSeries:_e,classes:Gn})}I.globals.seriesXvalues[Se]=st,I.globals.seriesYvalues[Se]=ut,k.groupCtx.prevY.push(k.groupCtx.yArrj),k.groupCtx.prevYF.push(k.groupCtx.yArrjF),k.groupCtx.prevYVal.push(k.groupCtx.yArrjVal),k.groupCtx.prevX.push(k.groupCtx.xArrj),k.groupCtx.prevXF.push(k.groupCtx.xArrjF),k.groupCtx.prevXVal.push(k.groupCtx.xArrjVal),G.add(Mt)},ge=0,Ae=0;ge<S.length;ge++,Ae++)ue(ge,Ae);return G}},{key:"initialPositions",value:function(S,_,k,I,B,G,re){var ce,ue,ge=this.w;if(this.isHorizontal){I=ge.globals.gridHeight/ge.globals.dataPoints;var Ae=ge.config.plotOptions.bar.barHeight;ce=String(Ae).indexOf("%")===-1?parseInt(Ae,10):I*parseInt(Ae,10)/100,G=ge.globals.padHorizontal+(this.isReversed?ge.globals.gridWidth-this.baseLineInvertedY:this.baseLineInvertedY),_=(I-ce)/2}else{ue=k=ge.globals.gridWidth/ge.globals.dataPoints;var ke=ge.config.plotOptions.bar.columnWidth;ge.globals.isXNumeric&&ge.globals.dataPoints>1?ue=(k=ge.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:String(ke).indexOf("%")===-1?ue=parseInt(ke,10):ue*=parseInt(ke,10)/100,B=this.isReversed?this.baseLineY[re]:ge.globals.gridHeight-this.baseLineY[re],S=ge.globals.padHorizontal+(k-ue)/2}var Me=ge.globals.barGroups.length||1;return{x:S,y:_,yDivision:I,xDivision:k,barHeight:ce/Me,barWidth:ue/Me,zeroH:B,zeroW:G}}},{key:"drawStackedBarPaths",value:function(S){for(var _,k=S.indexes,I=S.barHeight,B=S.strokeWidth,G=S.zeroW,re=S.x,ce=S.y,ue=S.columnGroupIndex,ge=S.seriesGroup,Ae=S.yDivision,ke=S.elSeries,Me=this.w,qe=ce+ue*I,Fe=k.i,at=k.j,ie=k.realIndex,Se=k.translationsIndex,$e=0,Ue=0;Ue<this.groupCtx.prevXF.length;Ue++)$e+=this.groupCtx.prevXF[Ue][at];var _e;if((_e=ge.indexOf(Me.config.series[ie].name))>0){var st=G;this.groupCtx.prevXVal[_e-1][at]<0?st=this.series[Fe][at]>=0?this.groupCtx.prevX[_e-1][at]+$e-2*(this.isReversed?$e:0):this.groupCtx.prevX[_e-1][at]:this.groupCtx.prevXVal[_e-1][at]>=0&&(st=this.series[Fe][at]>=0?this.groupCtx.prevX[_e-1][at]:this.groupCtx.prevX[_e-1][at]-$e+2*(this.isReversed?$e:0)),_=st}else _=G;re=this.series[Fe][at]===null?_:_+this.series[Fe][at]/this.invertedYRatio-2*(this.isReversed?this.series[Fe][at]/this.invertedYRatio:0);var ut=this.barHelpers.getBarpaths({barYPosition:qe,barHeight:I,x1:_,x2:re,strokeWidth:B,isReversed:this.isReversed,series:this.series,realIndex:k.realIndex,seriesGroup:ge,i:Fe,j:at,w:Me});return this.barHelpers.barBackground({j:at,i:Fe,y1:qe,y2:I,elSeries:ke}),ce+=Ae,{pathTo:ut.pathTo,pathFrom:ut.pathFrom,goalX:this.barHelpers.getGoalValues("x",G,null,Fe,at,Se),barXPosition:_,barYPosition:qe,x:re,y:ce}}},{key:"drawStackedColumnPaths",value:function(S){var _=S.indexes,k=S.x,I=S.y,B=S.xDivision,G=S.barWidth,re=S.zeroH,ce=S.columnGroupIndex,ue=S.seriesGroup,ge=S.elSeries,Ae=this.w,ke=_.i,Me=_.j,qe=_.bc,Fe=_.realIndex,at=_.translationsIndex;if(Ae.globals.isXNumeric){var ie=Ae.globals.seriesX[Fe][Me];ie||(ie=0),k=(ie-Ae.globals.minX)/this.xRatio-G/2*Ae.globals.barGroups.length}for(var Se,$e=k+ce*G,Ue=0,_e=0;_e<this.groupCtx.prevYF.length;_e++)Ue+=isNaN(this.groupCtx.prevYF[_e][Me])?0:this.groupCtx.prevYF[_e][Me];var st=ke;if(ue&&(st=ue.indexOf(Ae.globals.seriesNames[Fe])),st>0&&!Ae.globals.isXNumeric||st>0&&Ae.globals.isXNumeric&&Ae.globals.seriesX[Fe-1][Me]===Ae.globals.seriesX[Fe][Me]){var ut,yt,Mt,Kt=Math.min(this.yRatio.length+1,Fe+1);if(this.groupCtx.prevY[st-1]!==void 0&&this.groupCtx.prevY[st-1].length)for(var un=1;un<Kt;un++){var Xe;if(!isNaN((Xe=this.groupCtx.prevY[st-un])===null||Xe===void 0?void 0:Xe[Me])){Mt=this.groupCtx.prevY[st-un][Me];break}}for(var Pt=1;Pt<Kt;Pt++){var Wt,ct;if(((Wt=this.groupCtx.prevYVal[st-Pt])===null||Wt===void 0?void 0:Wt[Me])<0){yt=this.series[ke][Me]>=0?Mt-Ue+2*(this.isReversed?Ue:0):Mt;break}if(((ct=this.groupCtx.prevYVal[st-Pt])===null||ct===void 0?void 0:ct[Me])>=0){yt=this.series[ke][Me]>=0?Mt:Mt+Ue-2*(this.isReversed?Ue:0);break}}yt===void 0&&(yt=Ae.globals.gridHeight),Se=(ut=this.groupCtx.prevYF[0])!==null&&ut!==void 0&&ut.every(function(Tt){return Tt===0})&&this.groupCtx.prevYF.slice(1,st).every(function(Tt){return Tt.every(function(fn){return isNaN(fn)})})?re:yt}else Se=re;I=this.series[ke][Me]?Se-this.series[ke][Me]/this.yRatio[at]+2*(this.isReversed?this.series[ke][Me]/this.yRatio[at]:0):Se;var Ge=this.barHelpers.getColumnPaths({barXPosition:$e,barWidth:G,y1:Se,y2:I,yRatio:this.yRatio[at],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:ue,realIndex:_.realIndex,i:ke,j:Me,w:Ae});return this.barHelpers.barBackground({bc:qe,j:Me,i:ke,x1:$e,x2:G,elSeries:ge}),{pathTo:Ge.pathTo,pathFrom:Ge.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,re,ke,Me),barXPosition:$e,x:Ae.globals.isXNumeric?k:k+B,y:I}}}]),p}(),An=function(Ee){f(p,rn);var h=c(p);function p(){return s(this,p),h.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,_,k){var I=this,B=this.w,G=new z(this.ctx),re=B.globals.comboCharts?_:B.config.chart.type,ce=new xe(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=B.config.plotOptions.bar.horizontal;var ue=new X(this.ctx,B);S=ue.getLogSeries(S),this.series=S,this.yRatio=ue.getLogYRatios(this.yRatio),this.barHelpers.initVariables(S);for(var ge=G.group({class:"apexcharts-".concat(re,"-series apexcharts-plot-series")}),Ae=function(Me){I.isBoxPlot=B.config.chart.type==="boxPlot"||B.config.series[Me].type==="boxPlot";var qe,Fe,at,ie,Se=void 0,$e=void 0,Ue=[],_e=[],st=B.globals.comboCharts?k[Me]:Me,ut=I.barHelpers.getGroupIndex(st).columnGroupIndex,yt=G.group({class:"apexcharts-series",seriesName:F.escapeString(B.globals.seriesNames[st]),rel:Me+1,"data:realIndex":st});I.ctx.series.addCollapsedClassToSeries(yt,st),S[Me].length>0&&(I.visibleI=I.visibleI+1);var Mt,Kt,un=0;I.yRatio.length>1&&(I.yaxisIndex=B.globals.seriesYAxisReverseMap[st][0],un=st);var Xe=I.barHelpers.initialPositions();$e=Xe.y,Mt=Xe.barHeight,Fe=Xe.yDivision,ie=Xe.zeroW,Se=Xe.x,Kt=Xe.barWidth,qe=Xe.xDivision,at=Xe.zeroH,_e.push(Se+Kt/2);for(var Pt=G.group({class:"apexcharts-datalabels","data:realIndex":st}),Wt=function(Ge){var Tt=I.barHelpers.getStrokeWidth(Me,Ge,st),fn=null,Yn={indexes:{i:Me,j:Ge,realIndex:st,translationsIndex:un},x:Se,y:$e,strokeWidth:Tt,elSeries:yt};fn=I.isHorizontal?I.drawHorizontalBoxPaths(y(y({},Yn),{},{yDivision:Fe,barHeight:Mt,zeroW:ie})):I.drawVerticalBoxPaths(y(y({},Yn),{},{xDivision:qe,barWidth:Kt,zeroH:at})),$e=fn.y,Se=fn.x,Ge>0&&_e.push(Se+Kt/2),Ue.push($e),fn.pathTo.forEach(function(Fn,Gn){var Sr=!I.isBoxPlot&&I.candlestickOptions.wick.useFillColor?fn.color[Gn]:B.globals.stroke.colors[Me],ur=ce.fillPath({seriesNumber:st,dataPointIndex:Ge,color:fn.color[Gn],value:S[Me][Ge]});I.renderSeries({realIndex:st,pathFill:ur,lineFill:Sr,j:Ge,i:Me,pathFrom:fn.pathFrom,pathTo:Fn,strokeWidth:Tt,elSeries:yt,x:Se,y:$e,series:S,columnGroupIndex:ut,barHeight:Mt,barWidth:Kt,elDataLabelsWrap:Pt,visibleSeries:I.visibleI,type:B.config.chart.type})})},ct=0;ct<B.globals.dataPoints;ct++)Wt(ct);B.globals.seriesXvalues[st]=_e,B.globals.seriesYvalues[st]=Ue,ge.add(yt)},ke=0;ke<S.length;ke++)Ae(ke);return ge}},{key:"drawVerticalBoxPaths",value:function(S){var _=S.indexes,k=S.x;S.y;var I=S.xDivision,B=S.barWidth,G=S.zeroH,re=S.strokeWidth,ce=this.w,ue=new z(this.ctx),ge=_.i,Ae=_.j,ke=!0,Me=ce.config.plotOptions.candlestick.colors.upward,qe=ce.config.plotOptions.candlestick.colors.downward,Fe="";this.isBoxPlot&&(Fe=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var at=this.yRatio[_.translationsIndex],ie=_.realIndex,Se=this.getOHLCValue(ie,Ae),$e=G,Ue=G;Se.o>Se.c&&(ke=!1);var _e=Math.min(Se.o,Se.c),st=Math.max(Se.o,Se.c),ut=Se.m;ce.globals.isXNumeric&&(k=(ce.globals.seriesX[ie][Ae]-ce.globals.minX)/this.xRatio-B/2);var yt=k+B*this.visibleI;this.series[ge][Ae]===void 0||this.series[ge][Ae]===null?(_e=G,st=G):(_e=G-_e/at,st=G-st/at,$e=G-Se.h/at,Ue=G-Se.l/at,ut=G-Se.m/at);var Mt=ue.move(yt,G),Kt=ue.move(yt+B/2,_e);return ce.globals.previousPaths.length>0&&(Kt=this.getPreviousPath(ie,Ae,!0)),Mt=this.isBoxPlot?[ue.move(yt,_e)+ue.line(yt+B/2,_e)+ue.line(yt+B/2,$e)+ue.line(yt+B/4,$e)+ue.line(yt+B-B/4,$e)+ue.line(yt+B/2,$e)+ue.line(yt+B/2,_e)+ue.line(yt+B,_e)+ue.line(yt+B,ut)+ue.line(yt,ut)+ue.line(yt,_e+re/2),ue.move(yt,ut)+ue.line(yt+B,ut)+ue.line(yt+B,st)+ue.line(yt+B/2,st)+ue.line(yt+B/2,Ue)+ue.line(yt+B-B/4,Ue)+ue.line(yt+B/4,Ue)+ue.line(yt+B/2,Ue)+ue.line(yt+B/2,st)+ue.line(yt,st)+ue.line(yt,ut)+"z"]:[ue.move(yt,st)+ue.line(yt+B/2,st)+ue.line(yt+B/2,$e)+ue.line(yt+B/2,st)+ue.line(yt+B,st)+ue.line(yt+B,_e)+ue.line(yt+B/2,_e)+ue.line(yt+B/2,Ue)+ue.line(yt+B/2,_e)+ue.line(yt,_e)+ue.line(yt,st-re/2)],Kt+=ue.move(yt,_e),ce.globals.isXNumeric||(k+=I),{pathTo:Mt,pathFrom:Kt,x:k,y:st,barXPosition:yt,color:this.isBoxPlot?Fe:ke?[Me]:[qe]}}},{key:"drawHorizontalBoxPaths",value:function(S){var _=S.indexes;S.x;var k=S.y,I=S.yDivision,B=S.barHeight,G=S.zeroW,re=S.strokeWidth,ce=this.w,ue=new z(this.ctx),ge=_.i,Ae=_.j,ke=this.boxOptions.colors.lower;this.isBoxPlot&&(ke=[this.boxOptions.colors.lower,this.boxOptions.colors.upper]);var Me=this.invertedYRatio,qe=_.realIndex,Fe=this.getOHLCValue(qe,Ae),at=G,ie=G,Se=Math.min(Fe.o,Fe.c),$e=Math.max(Fe.o,Fe.c),Ue=Fe.m;ce.globals.isXNumeric&&(k=(ce.globals.seriesX[qe][Ae]-ce.globals.minX)/this.invertedXRatio-B/2);var _e=k+B*this.visibleI;this.series[ge][Ae]===void 0||this.series[ge][Ae]===null?(Se=G,$e=G):(Se=G+Se/Me,$e=G+$e/Me,at=G+Fe.h/Me,ie=G+Fe.l/Me,Ue=G+Fe.m/Me);var st=ue.move(G,_e),ut=ue.move(Se,_e+B/2);return ce.globals.previousPaths.length>0&&(ut=this.getPreviousPath(qe,Ae,!0)),st=[ue.move(Se,_e)+ue.line(Se,_e+B/2)+ue.line(at,_e+B/2)+ue.line(at,_e+B/2-B/4)+ue.line(at,_e+B/2+B/4)+ue.line(at,_e+B/2)+ue.line(Se,_e+B/2)+ue.line(Se,_e+B)+ue.line(Ue,_e+B)+ue.line(Ue,_e)+ue.line(Se+re/2,_e),ue.move(Ue,_e)+ue.line(Ue,_e+B)+ue.line($e,_e+B)+ue.line($e,_e+B/2)+ue.line(ie,_e+B/2)+ue.line(ie,_e+B-B/4)+ue.line(ie,_e+B/4)+ue.line(ie,_e+B/2)+ue.line($e,_e+B/2)+ue.line($e,_e)+ue.line(Ue,_e)+"z"],ut+=ue.move(Se,_e),ce.globals.isXNumeric||(k+=I),{pathTo:st,pathFrom:ut,x:$e,y:k,barYPosition:_e,color:ke}}},{key:"getOHLCValue",value:function(S,_){var k=this.w;return{o:this.isBoxPlot?k.globals.seriesCandleH[S][_]:k.globals.seriesCandleO[S][_],h:this.isBoxPlot?k.globals.seriesCandleO[S][_]:k.globals.seriesCandleH[S][_],m:k.globals.seriesCandleM[S][_],l:this.isBoxPlot?k.globals.seriesCandleC[S][_]:k.globals.seriesCandleL[S][_],c:this.isBoxPlot?k.globals.seriesCandleL[S][_]:k.globals.seriesCandleC[S][_]}}}]),p}(),kn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"checkColorRange",value:function(){var h=this.w,p=!1,S=h.config.plotOptions[h.config.chart.type];return S.colorScale.ranges.length>0&&S.colorScale.ranges.map(function(_,k){_.from<=0&&(p=!0)}),p}},{key:"getShadeColor",value:function(h,p,S,_){var k=this.w,I=1,B=k.config.plotOptions[h].shadeIntensity,G=this.determineColor(h,p,S);k.globals.hasNegs||_?I=k.config.plotOptions[h].reverseNegativeShade?G.percent<0?G.percent/100*(1.25*B):(1-G.percent/100)*(1.25*B):G.percent<=0?1-(1+G.percent/100)*B:(1-G.percent/100)*B:(I=1-G.percent/100,h==="treemap"&&(I=(1-G.percent/100)*(1.25*B)));var re=G.color,ce=new F;if(k.config.plotOptions[h].enableShades)if(this.w.config.theme.mode==="dark"){var ue=ce.shadeColor(-1*I,G.color);re=F.hexToRgba(F.isColorHex(ue)?ue:F.rgb2hex(ue),k.config.fill.opacity)}else{var ge=ce.shadeColor(I,G.color);re=F.hexToRgba(F.isColorHex(ge)?ge:F.rgb2hex(ge),k.config.fill.opacity)}return{color:re,colorProps:G}}},{key:"determineColor",value:function(h,p,S){var _=this.w,k=_.globals.series[p][S],I=_.config.plotOptions[h],B=I.colorScale.inverse?S:p;I.distributed&&_.config.chart.type==="treemap"&&(B=S);var G=_.globals.colors[B],re=null,ce=Math.min.apply(Math,N(_.globals.series[p])),ue=Math.max.apply(Math,N(_.globals.series[p]));I.distributed||h!=="heatmap"||(ce=_.globals.minY,ue=_.globals.maxY),I.colorScale.min!==void 0&&(ce=I.colorScale.min<_.globals.minY?I.colorScale.min:_.globals.minY,ue=I.colorScale.max>_.globals.maxY?I.colorScale.max:_.globals.maxY);var ge=Math.abs(ue)+Math.abs(ce),Ae=100*k/(ge===0?ge-1e-6:ge);return I.colorScale.ranges.length>0&&I.colorScale.ranges.map(function(ke,Me){if(k>=ke.from&&k<=ke.to){G=ke.color,re=ke.foreColor?ke.foreColor:null,ce=ke.from,ue=ke.to;var qe=Math.abs(ue)+Math.abs(ce);Ae=100*k/(qe===0?qe-1e-6:qe)}}),{color:G,foreColor:re,percent:Ae}}},{key:"calculateDataLabels",value:function(h){var p=h.text,S=h.x,_=h.y,k=h.i,I=h.j,B=h.colorProps,G=h.fontSize,re=this.w.config.dataLabels,ce=new z(this.ctx),ue=new Ie(this.ctx),ge=null;if(re.enabled){ge=ce.group({class:"apexcharts-data-labels"});var Ae=re.offsetX,ke=re.offsetY,Me=S+Ae,qe=_+parseFloat(re.style.fontSize)/3+ke;ue.plotDataLabelsText({x:Me,y:qe,text:p,i:k,j:I,color:B.foreColor,parent:ge,fontSize:G,dataLabelsConfig:re})}return ge}},{key:"addListeners",value:function(h){var p=new z(this.ctx);h.node.addEventListener("mouseenter",p.pathMouseEnter.bind(this,h)),h.node.addEventListener("mouseleave",p.pathMouseLeave.bind(this,h)),h.node.addEventListener("mousedown",p.pathMouseDown.bind(this,h))}}]),Ee}(),yn=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.w=h.w,this.xRatio=p.xRatio,this.yRatio=p.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new kn(h),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return o(Ee,[{key:"draw",value:function(h){var p=this.w,S=new z(this.ctx),_=S.group({class:"apexcharts-heatmap"});_.attr("clip-path","url(#gridRectMask".concat(p.globals.cuid,")"));var k=p.globals.gridWidth/p.globals.dataPoints,I=p.globals.gridHeight/p.globals.series.length,B=0,G=!1;this.negRange=this.helpers.checkColorRange();var re=h.slice();p.config.yaxis[0].reversed&&(G=!0,re.reverse());for(var ce=G?0:re.length-1;G?ce<re.length:ce>=0;G?ce++:ce--){var ue=S.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:F.escapeString(p.globals.seriesNames[ce]),rel:ce+1,"data:realIndex":ce});if(this.ctx.series.addCollapsedClassToSeries(ue,ce),p.config.chart.dropShadow.enabled){var ge=p.config.chart.dropShadow;new L(this.ctx).dropShadow(ue,ge,ce)}for(var Ae=0,ke=p.config.plotOptions.heatmap.shadeIntensity,Me=0;Me<re[ce].length;Me++){var qe=this.helpers.getShadeColor(p.config.chart.type,ce,Me,this.negRange),Fe=qe.color,at=qe.colorProps;p.config.fill.type==="image"&&(Fe=new xe(this.ctx).fillPath({seriesNumber:ce,dataPointIndex:Me,opacity:p.globals.hasNegs?at.percent<0?1-(1+at.percent/100):ke+at.percent/100:at.percent/100,patternID:F.randomId(),width:p.config.fill.image.width?p.config.fill.image.width:k,height:p.config.fill.image.height?p.config.fill.image.height:I}));var ie=this.rectRadius,Se=S.drawRect(Ae,B,k,I,ie);if(Se.attr({cx:Ae,cy:B}),Se.node.classList.add("apexcharts-heatmap-rect"),ue.add(Se),Se.attr({fill:Fe,i:ce,index:ce,j:Me,val:h[ce][Me],"stroke-width":this.strokeWidth,stroke:p.config.plotOptions.heatmap.useFillColorAsStroke?Fe:p.globals.stroke.colors[0],color:Fe}),this.helpers.addListeners(Se),p.config.chart.animations.enabled&&!p.globals.dataChanged){var $e=1;p.globals.resized||($e=p.config.chart.animations.speed),this.animateHeatMap(Se,Ae,B,k,I,$e)}if(p.globals.dataChanged){var Ue=1;if(this.dynamicAnim.enabled&&p.globals.shouldAnimate){Ue=this.dynamicAnim.speed;var _e=p.globals.previousPaths[ce]&&p.globals.previousPaths[ce][Me]&&p.globals.previousPaths[ce][Me].color;_e||(_e="rgba(255, 255, 255, 0)"),this.animateHeatColor(Se,F.isColorHex(_e)?_e:F.rgb2hex(_e),F.isColorHex(Fe)?Fe:F.rgb2hex(Fe),Ue)}}var st=(0,p.config.dataLabels.formatter)(p.globals.series[ce][Me],{value:p.globals.series[ce][Me],seriesIndex:ce,dataPointIndex:Me,w:p}),ut=this.helpers.calculateDataLabels({text:st,x:Ae+k/2,y:B+I/2,i:ce,j:Me,colorProps:at,series:re});ut!==null&&ue.add(ut),Ae+=k}B+=I,_.add(ue)}var yt=p.globals.yAxisScale[0].result.slice();return p.config.yaxis[0].reversed?yt.unshift(""):yt.push(""),p.globals.yAxisScale[0].result=yt,_}},{key:"animateHeatMap",value:function(h,p,S,_,k,I){var B=new $(this.ctx);B.animateRect(h,{x:p+_/2,y:S+k/2,width:0,height:0},{x:p,y:S,width:_,height:k},I,function(){B.animationCompleted(h)})}},{key:"animateHeatColor",value:function(h,p,S,_){h.attr({fill:p}).animate(_).attr({fill:S})}}]),Ee}(),Vn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"drawYAxisTexts",value:function(h,p,S,_){var k=this.w,I=k.config.yaxis[0],B=k.globals.yLabelFormatters[0];return new z(this.ctx).drawText({x:h+I.labels.offsetX,y:p+I.labels.offsetY,text:B(_,S),textAnchor:"middle",fontSize:I.labels.style.fontSize,fontFamily:I.labels.style.fontFamily,foreColor:Array.isArray(I.labels.style.colors)?I.labels.style.colors[S]:I.labels.style.colors})}}]),Ee}(),Kn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w;var p=this.w;this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=p.globals.stroke.colors!==void 0?p.globals.stroke.colors:p.globals.colors,this.defaultSize=Math.min(p.globals.gridWidth,p.globals.gridHeight),this.centerY=this.defaultSize/2,this.centerX=p.globals.gridWidth/2,p.config.chart.type==="radialBar"?this.fullAngle=360:this.fullAngle=Math.abs(p.config.plotOptions.pie.endAngle-p.config.plotOptions.pie.startAngle),this.initialAngle=p.config.plotOptions.pie.startAngle%this.fullAngle,p.globals.radialSize=this.defaultSize/2.05-p.config.stroke.width-(p.config.chart.sparkline.enabled?0:p.config.chart.dropShadow.blur),this.donutSize=p.globals.radialSize*parseInt(p.config.plotOptions.pie.donut.size,10)/100;var S=p.config.plotOptions.pie.customScale,_=p.globals.gridWidth/2,k=p.globals.gridHeight/2;this.translateX=_-_*S,this.translateY=k-k*S,this.dataLabelsGroup=new z(this.ctx).group({class:"apexcharts-datalabels-group",transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(S,")")}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}return o(Ee,[{key:"draw",value:function(h){var p=this,S=this.w,_=new z(this.ctx),k=_.group({class:"apexcharts-pie"});if(S.globals.noData)return k;for(var I=0,B=0;B<h.length;B++)I+=F.negToZero(h[B]);var G=[],re=_.group();I===0&&(I=1e-5),h.forEach(function(ie){p.maxY=Math.max(p.maxY,ie)}),S.config.yaxis[0].max&&(this.maxY=S.config.yaxis[0].max),S.config.grid.position==="back"&&this.chartType==="polarArea"&&this.drawPolarElements(k);for(var ce=0;ce<h.length;ce++){var ue=this.fullAngle*F.negToZero(h[ce])/I;G.push(ue),this.chartType==="polarArea"?(G[ce]=this.fullAngle/h.length,this.sliceSizes.push(S.globals.radialSize*h[ce]/this.maxY)):this.sliceSizes.push(S.globals.radialSize)}if(S.globals.dataChanged){for(var ge,Ae=0,ke=0;ke<S.globals.previousPaths.length;ke++)Ae+=F.negToZero(S.globals.previousPaths[ke]);for(var Me=0;Me<S.globals.previousPaths.length;Me++)ge=this.fullAngle*F.negToZero(S.globals.previousPaths[Me])/Ae,this.prevSectorAngleArr.push(ge)}if(this.donutSize<0&&(this.donutSize=0),this.chartType==="donut"){var qe=_.drawCircle(this.donutSize);qe.attr({cx:this.centerX,cy:this.centerY,fill:S.config.plotOptions.pie.donut.background?S.config.plotOptions.pie.donut.background:"transparent"}),re.add(qe)}var Fe=this.drawArcs(G,h);if(this.sliceLabels.forEach(function(ie){Fe.add(ie)}),re.attr({transform:"translate(".concat(this.translateX,", ").concat(this.translateY,") scale(").concat(S.config.plotOptions.pie.customScale,")")}),re.add(Fe),k.add(re),this.donutDataLabels.show){var at=this.renderInnerDataLabels(this.dataLabelsGroup,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});k.add(at)}return S.config.grid.position==="front"&&this.chartType==="polarArea"&&this.drawPolarElements(k),k}},{key:"drawArcs",value:function(h,p){var S=this.w,_=new L(this.ctx),k=new z(this.ctx),I=new xe(this.ctx),B=k.group({class:"apexcharts-slices"}),G=this.initialAngle,re=this.initialAngle,ce=this.initialAngle,ue=this.initialAngle;this.strokeWidth=S.config.stroke.show?S.config.stroke.width:0;for(var ge=0;ge<h.length;ge++){var Ae=k.group({class:"apexcharts-series apexcharts-pie-series",seriesName:F.escapeString(S.globals.seriesNames[ge]),rel:ge+1,"data:realIndex":ge});B.add(Ae),re=ue,ce=(G=ce)+h[ge],ue=re+this.prevSectorAngleArr[ge];var ke=ce<G?this.fullAngle+ce-G:ce-G,Me=I.fillPath({seriesNumber:ge,size:this.sliceSizes[ge],value:p[ge]}),qe=this.getChangedPath(re,ue),Fe=k.drawPath({d:qe,stroke:Array.isArray(this.lineColorArr)?this.lineColorArr[ge]:this.lineColorArr,strokeWidth:0,fill:Me,fillOpacity:S.config.fill.opacity,classes:"apexcharts-pie-area apexcharts-".concat(this.chartType.toLowerCase(),"-slice-").concat(ge)});if(Fe.attr({index:0,j:ge}),_.setSelectionFilter(Fe,0,ge),S.config.chart.dropShadow.enabled){var at=S.config.chart.dropShadow;_.dropShadow(Fe,at,ge)}this.addListeners(Fe,this.donutDataLabels),z.setAttrs(Fe.node,{"data:angle":ke,"data:startAngle":G,"data:strokeWidth":this.strokeWidth,"data:value":p[ge]});var ie={x:0,y:0};this.chartType==="pie"||this.chartType==="polarArea"?ie=F.polarToCartesian(this.centerX,this.centerY,S.globals.radialSize/1.25+S.config.plotOptions.pie.dataLabels.offset,(G+ke/2)%this.fullAngle):this.chartType==="donut"&&(ie=F.polarToCartesian(this.centerX,this.centerY,(S.globals.radialSize+this.donutSize)/2+S.config.plotOptions.pie.dataLabels.offset,(G+ke/2)%this.fullAngle)),Ae.add(Fe);var Se=0;if(!this.initialAnim||S.globals.resized||S.globals.dataChanged?this.animBeginArr.push(0):((Se=ke/this.fullAngle*S.config.chart.animations.speed)===0&&(Se=1),this.animDur=Se+this.animDur,this.animBeginArr.push(this.animDur)),this.dynamicAnim&&S.globals.dataChanged?this.animatePaths(Fe,{size:this.sliceSizes[ge],endAngle:ce,startAngle:G,prevStartAngle:re,prevEndAngle:ue,animateStartingPos:!0,i:ge,animBeginArr:this.animBeginArr,shouldSetPrevPaths:!0,dur:S.config.chart.animations.dynamicAnimation.speed}):this.animatePaths(Fe,{size:this.sliceSizes[ge],endAngle:ce,startAngle:G,i:ge,totalItems:h.length-1,animBeginArr:this.animBeginArr,dur:Se}),S.config.plotOptions.pie.expandOnClick&&this.chartType!=="polarArea"&&Fe.node.addEventListener("mouseup",this.pieClicked.bind(this,ge)),S.globals.selectedDataPoints[0]!==void 0&&S.globals.selectedDataPoints[0].indexOf(ge)>-1&&this.pieClicked(ge),S.config.dataLabels.enabled){var $e=ie.x,Ue=ie.y,_e=100*ke/this.fullAngle+"%";if(ke!==0&&S.config.plotOptions.pie.dataLabels.minAngleToShowLabel<h[ge]){var st=S.config.dataLabels.formatter;st!==void 0&&(_e=st(S.globals.seriesPercent[ge][0],{seriesIndex:ge,w:S}));var ut=S.globals.dataLabels.style.colors[ge],yt=k.group({class:"apexcharts-datalabels"}),Mt=k.drawText({x:$e,y:Ue,text:_e,textAnchor:"middle",fontSize:S.config.dataLabels.style.fontSize,fontFamily:S.config.dataLabels.style.fontFamily,fontWeight:S.config.dataLabels.style.fontWeight,foreColor:ut});if(yt.add(Mt),S.config.dataLabels.dropShadow.enabled){var Kt=S.config.dataLabels.dropShadow;_.dropShadow(Mt,Kt)}Mt.node.classList.add("apexcharts-pie-label"),S.config.chart.animations.animate&&S.globals.resized===!1&&(Mt.node.classList.add("apexcharts-pie-label-delay"),Mt.node.style.animationDelay=S.config.chart.animations.speed/940+"s"),this.sliceLabels.push(yt)}}}return B}},{key:"addListeners",value:function(h,p){var S=new z(this.ctx);h.node.addEventListener("mouseenter",S.pathMouseEnter.bind(this,h)),h.node.addEventListener("mouseleave",S.pathMouseLeave.bind(this,h)),h.node.addEventListener("mouseleave",this.revertDataLabelsInner.bind(this,h.node,p)),h.node.addEventListener("mousedown",S.pathMouseDown.bind(this,h)),this.donutDataLabels.total.showAlways||(h.node.addEventListener("mouseenter",this.printDataLabelsInner.bind(this,h.node,p)),h.node.addEventListener("mousedown",this.printDataLabelsInner.bind(this,h.node,p)))}},{key:"animatePaths",value:function(h,p){var S=this.w,_=p.endAngle<p.startAngle?this.fullAngle+p.endAngle-p.startAngle:p.endAngle-p.startAngle,k=_,I=p.startAngle,B=p.startAngle;p.prevStartAngle!==void 0&&p.prevEndAngle!==void 0&&(I=p.prevEndAngle,k=p.prevEndAngle<p.prevStartAngle?this.fullAngle+p.prevEndAngle-p.prevStartAngle:p.prevEndAngle-p.prevStartAngle),p.i===S.config.series.length-1&&(_+B>this.fullAngle?p.endAngle=p.endAngle-(_+B):_+B<this.fullAngle&&(p.endAngle=p.endAngle+(this.fullAngle-(_+B)))),_===this.fullAngle&&(_=this.fullAngle-.01),this.animateArc(h,I,B,_,k,p)}},{key:"animateArc",value:function(h,p,S,_,k,I){var B,G=this,re=this.w,ce=new $(this.ctx),ue=I.size;(isNaN(p)||isNaN(k))&&(p=S,k=_,I.dur=0);var ge=_,Ae=S,ke=p<S?this.fullAngle+p-S:p-S;re.globals.dataChanged&&I.shouldSetPrevPaths&&I.prevEndAngle&&(B=G.getPiePath({me:G,startAngle:I.prevStartAngle,angle:I.prevEndAngle<I.prevStartAngle?this.fullAngle+I.prevEndAngle-I.prevStartAngle:I.prevEndAngle-I.prevStartAngle,size:ue}),h.attr({d:B})),I.dur!==0?h.animate(I.dur,re.globals.easing,I.animBeginArr[I.i]).afterAll(function(){G.chartType!=="pie"&&G.chartType!=="donut"&&G.chartType!=="polarArea"||this.animate(re.config.chart.animations.dynamicAnimation.speed).attr({"stroke-width":G.strokeWidth}),I.i===re.config.series.length-1&&ce.animationCompleted(h)}).during(function(Me){ge=ke+(_-ke)*Me,I.animateStartingPos&&(ge=k+(_-k)*Me,Ae=p-k+(S-(p-k))*Me),B=G.getPiePath({me:G,startAngle:Ae,angle:ge,size:ue}),h.node.setAttribute("data:pathOrig",B),h.attr({d:B})}):(B=G.getPiePath({me:G,startAngle:Ae,angle:_,size:ue}),I.isTrack||(re.globals.animationEnded=!0),h.node.setAttribute("data:pathOrig",B),h.attr({d:B,"stroke-width":G.strokeWidth}))}},{key:"pieClicked",value:function(h){var p,S=this.w,_=this,k=_.sliceSizes[h]+(S.config.plotOptions.pie.expandOnClick?4:0),I=S.globals.dom.Paper.select(".apexcharts-".concat(_.chartType.toLowerCase(),"-slice-").concat(h)).members[0];if(I.attr("data:pieClicked")!=="true"){var B=S.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area");Array.prototype.forEach.call(B,function(ue){ue.setAttribute("data:pieClicked","false");var ge=ue.getAttribute("data:pathOrig");ge&&ue.setAttribute("d",ge)}),S.globals.capturedDataPointIndex=h,I.attr("data:pieClicked","true");var G=parseInt(I.attr("data:startAngle"),10),re=parseInt(I.attr("data:angle"),10);p=_.getPiePath({me:_,startAngle:G,angle:re,size:k}),re!==360&&I.plot(p)}else{I.attr({"data:pieClicked":"false"}),this.revertDataLabelsInner(I.node,this.donutDataLabels);var ce=I.attr("data:pathOrig");I.attr({d:ce})}}},{key:"getChangedPath",value:function(h,p){var S="";return this.dynamicAnim&&this.w.globals.dataChanged&&(S=this.getPiePath({me:this,startAngle:h,angle:p-h,size:this.size})),S}},{key:"getPiePath",value:function(h){var p,S=h.me,_=h.startAngle,k=h.angle,I=h.size,B=new z(this.ctx),G=_,re=Math.PI*(G-90)/180,ce=k+_;Math.ceil(ce)>=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(ce=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(ce)>this.fullAngle&&(ce-=this.fullAngle);var ue=Math.PI*(ce-90)/180,ge=S.centerX+I*Math.cos(re),Ae=S.centerY+I*Math.sin(re),ke=S.centerX+I*Math.cos(ue),Me=S.centerY+I*Math.sin(ue),qe=F.polarToCartesian(S.centerX,S.centerY,S.donutSize,ce),Fe=F.polarToCartesian(S.centerX,S.centerY,S.donutSize,G),at=k>180?1:0,ie=["M",ge,Ae,"A",I,I,0,at,1,ke,Me];return p=S.chartType==="donut"?[].concat(ie,["L",qe.x,qe.y,"A",S.donutSize,S.donutSize,0,at,0,Fe.x,Fe.y,"L",ge,Ae,"z"]).join(" "):S.chartType==="pie"||S.chartType==="polarArea"?[].concat(ie,["L",S.centerX,S.centerY,"L",ge,Ae]).join(" "):[].concat(ie).join(" "),B.roundPathCorners(p,2*this.strokeWidth)}},{key:"drawPolarElements",value:function(h){var p=this.w,S=new nt(this.ctx),_=new z(this.ctx),k=new Vn(this.ctx),I=_.group(),B=_.group(),G=S.niceScale(0,Math.ceil(this.maxY),0),re=G.result.reverse(),ce=G.result.length;this.maxY=G.niceMax;for(var ue=p.globals.radialSize,ge=ue/(ce-1),Ae=0;Ae<ce-1;Ae++){var ke=_.drawCircle(ue);if(ke.attr({cx:this.centerX,cy:this.centerY,fill:"none","stroke-width":p.config.plotOptions.polarArea.rings.strokeWidth,stroke:p.config.plotOptions.polarArea.rings.strokeColor}),p.config.yaxis[0].show){var Me=k.drawYAxisTexts(this.centerX,this.centerY-ue+parseInt(p.config.yaxis[0].labels.style.fontSize,10)/2,Ae,re[Ae]);B.add(Me)}I.add(ke),ue-=ge}this.drawSpokes(h),h.add(I),h.add(B)}},{key:"renderInnerDataLabels",value:function(h,p,S){var _=this.w,k=new z(this.ctx),I=p.total.show;h.node.innerHTML="",h.node.style.opacity=S.opacity;var B,G,re=S.centerX,ce=this.donutDataLabels.total.label?S.centerY:S.centerY-S.centerY/6;B=p.name.color===void 0?_.globals.colors[0]:p.name.color;var ue=p.name.fontSize,ge=p.name.fontFamily,Ae=p.name.fontWeight;G=p.value.color===void 0?_.config.chart.foreColor:p.value.color;var ke=p.value.formatter,Me="",qe="";if(I?(B=p.total.color,ue=p.total.fontSize,ge=p.total.fontFamily,Ae=p.total.fontWeight,qe=this.donutDataLabels.total.label?p.total.label:"",Me=p.total.formatter(_)):_.globals.series.length===1&&(Me=ke(_.globals.series[0],_),qe=_.globals.seriesNames[0]),qe&&(qe=p.name.formatter(qe,p.total.show,_)),p.name.show){var Fe=k.drawText({x:re,y:ce+parseFloat(p.name.offsetY),text:qe,textAnchor:"middle",foreColor:B,fontSize:ue,fontWeight:Ae,fontFamily:ge});Fe.node.classList.add("apexcharts-datalabel-label"),h.add(Fe)}if(p.value.show){var at=p.name.show?parseFloat(p.value.offsetY)+16:p.value.offsetY,ie=k.drawText({x:re,y:ce+at,text:Me,textAnchor:"middle",foreColor:G,fontWeight:p.value.fontWeight,fontSize:p.value.fontSize,fontFamily:p.value.fontFamily});ie.node.classList.add("apexcharts-datalabel-value"),h.add(ie)}return h}},{key:"printInnerLabels",value:function(h,p,S,_){var k,I=this.w;_?k=h.name.color===void 0?I.globals.colors[parseInt(_.parentNode.getAttribute("rel"),10)-1]:h.name.color:I.globals.series.length>1&&h.total.show&&(k=h.total.color);var B=I.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),G=I.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");S=(0,h.value.formatter)(S,I),_||typeof h.total.formatter!="function"||(S=h.total.formatter(I));var re=p===h.total.label;p=this.donutDataLabels.total.label?h.name.formatter(p,re,I):"",B!==null&&(B.textContent=p),G!==null&&(G.textContent=S),B!==null&&(B.style.fill=k)}},{key:"printDataLabelsInner",value:function(h,p){var S=this.w,_=h.getAttribute("data:value"),k=S.globals.seriesNames[parseInt(h.parentNode.getAttribute("rel"),10)-1];S.globals.series.length>1&&this.printInnerLabels(p,k,_,h);var I=S.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");I!==null&&(I.style.opacity=1)}},{key:"drawSpokes",value:function(h){var p=this,S=this.w,_=new z(this.ctx),k=S.config.plotOptions.polarArea.spokes;if(k.strokeWidth!==0){for(var I=[],B=360/S.globals.series.length,G=0;G<S.globals.series.length;G++)I.push(F.polarToCartesian(this.centerX,this.centerY,S.globals.radialSize,S.config.plotOptions.pie.startAngle+B*G));I.forEach(function(re,ce){var ue=_.drawLine(re.x,re.y,p.centerX,p.centerY,Array.isArray(k.connectorColors)?k.connectorColors[ce]:k.connectorColors);h.add(ue)})}}},{key:"revertDataLabelsInner",value:function(){var h=this.w;if(this.donutDataLabels.show){var p=h.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0],S=this.renderInnerDataLabels(p,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});h.globals.dom.Paper.select(".apexcharts-radialbar, .apexcharts-pie").members[0].add(S)}}}]),Ee}(),Dn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animDur=0;var p=this.w;this.graphics=new z(this.ctx),this.lineColorArr=p.globals.stroke.colors!==void 0?p.globals.stroke.colors:p.globals.colors,this.defaultSize=p.globals.svgHeight<p.globals.svgWidth?p.globals.gridHeight:p.globals.gridWidth,this.isLog=p.config.yaxis[0].logarithmic,this.logBase=p.config.yaxis[0].logBase,this.coreUtils=new X(this.ctx),this.maxValue=this.isLog?this.coreUtils.getLogVal(this.logBase,p.globals.maxY,0):p.globals.maxY,this.minValue=this.isLog?this.coreUtils.getLogVal(this.logBase,this.w.globals.minY,0):p.globals.minY,this.polygons=p.config.plotOptions.radar.polygons,this.strokeWidth=p.config.stroke.show?p.config.stroke.width:0,this.size=this.defaultSize/2.1-this.strokeWidth-p.config.chart.dropShadow.blur,p.config.xaxis.labels.show&&(this.size=this.size-p.globals.xAxisLabelsWidth/1.75),p.config.plotOptions.radar.size!==void 0&&(this.size=p.config.plotOptions.radar.size),this.dataRadiusOfPercent=[],this.dataRadius=[],this.angleArr=[],this.yaxisLabelsTextsPos=[]}return o(Ee,[{key:"draw",value:function(h){var p=this,S=this.w,_=new xe(this.ctx),k=[],I=new Ie(this.ctx);h.length&&(this.dataPointsLen=h[S.globals.maxValsInArrayIndex].length),this.disAngle=2*Math.PI/this.dataPointsLen;var B=S.globals.gridWidth/2,G=S.globals.gridHeight/2,re=B+S.config.plotOptions.radar.offsetX,ce=G+S.config.plotOptions.radar.offsetY,ue=this.graphics.group({class:"apexcharts-radar-series apexcharts-plot-series",transform:"translate(".concat(re||0,", ").concat(ce||0,")")}),ge=[],Ae=null,ke=null;if(this.yaxisLabels=this.graphics.group({class:"apexcharts-yaxis"}),h.forEach(function(qe,Fe){var at=qe.length===S.globals.dataPoints,ie=p.graphics.group().attr({class:"apexcharts-series","data:longestSeries":at,seriesName:F.escapeString(S.globals.seriesNames[Fe]),rel:Fe+1,"data:realIndex":Fe});p.dataRadiusOfPercent[Fe]=[],p.dataRadius[Fe]=[],p.angleArr[Fe]=[],qe.forEach(function(un,Xe){var Pt=Math.abs(p.maxValue-p.minValue);un-=p.minValue,p.isLog&&(un=p.coreUtils.getLogVal(p.logBase,un,0)),p.dataRadiusOfPercent[Fe][Xe]=un/Pt,p.dataRadius[Fe][Xe]=p.dataRadiusOfPercent[Fe][Xe]*p.size,p.angleArr[Fe][Xe]=Xe*p.disAngle}),ge=p.getDataPointsPos(p.dataRadius[Fe],p.angleArr[Fe]);var Se=p.createPaths(ge,{x:0,y:0});Ae=p.graphics.group({class:"apexcharts-series-markers-wrap apexcharts-element-hidden"}),ke=p.graphics.group({class:"apexcharts-datalabels","data:realIndex":Fe}),S.globals.delayedElements.push({el:Ae.node,index:Fe});var $e={i:Fe,realIndex:Fe,animationDelay:Fe,initialSpeed:S.config.chart.animations.speed,dataChangeSpeed:S.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-radar",shouldClipToGrid:!1,bindEventsOnPaths:!1,stroke:S.globals.stroke.colors[Fe],strokeLineCap:S.config.stroke.lineCap},Ue=null;S.globals.previousPaths.length>0&&(Ue=p.getPreviousPath(Fe));for(var _e=0;_e<Se.linePathsTo.length;_e++){var st=p.graphics.renderPaths(y(y({},$e),{},{pathFrom:Ue===null?Se.linePathsFrom[_e]:Ue,pathTo:Se.linePathsTo[_e],strokeWidth:Array.isArray(p.strokeWidth)?p.strokeWidth[Fe]:p.strokeWidth,fill:"none",drawShadow:!1}));ie.add(st);var ut=_.fillPath({seriesNumber:Fe}),yt=p.graphics.renderPaths(y(y({},$e),{},{pathFrom:Ue===null?Se.areaPathsFrom[_e]:Ue,pathTo:Se.areaPathsTo[_e],strokeWidth:0,fill:ut,drawShadow:!1}));if(S.config.chart.dropShadow.enabled){var Mt=new L(p.ctx),Kt=S.config.chart.dropShadow;Mt.dropShadow(yt,Object.assign({},Kt,{noUserSpaceOnUse:!0}),Fe)}ie.add(yt)}qe.forEach(function(un,Xe){var Pt=new be(p.ctx).getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:Fe,dataPointIndex:Xe}),Wt=p.graphics.drawMarker(ge[Xe].x,ge[Xe].y,Pt);Wt.attr("rel",Xe),Wt.attr("j",Xe),Wt.attr("index",Fe),Wt.node.setAttribute("default-marker-size",Pt.pSize);var ct=p.graphics.group({class:"apexcharts-series-markers"});ct&&ct.add(Wt),Ae.add(ct),ie.add(Ae);var Ge=S.config.dataLabels;if(Ge.enabled){var Tt=Ge.formatter(S.globals.series[Fe][Xe],{seriesIndex:Fe,dataPointIndex:Xe,w:S});I.plotDataLabelsText({x:ge[Xe].x,y:ge[Xe].y,text:Tt,textAnchor:"middle",i:Fe,j:Fe,parent:ke,offsetCorrection:!1,dataLabelsConfig:y({},Ge)})}ie.add(ke)}),k.push(ie)}),this.drawPolygons({parent:ue}),S.config.xaxis.labels.show){var Me=this.drawXAxisTexts();ue.add(Me)}return k.forEach(function(qe){ue.add(qe)}),ue.add(this.yaxisLabels),ue}},{key:"drawPolygons",value:function(h){for(var p=this,S=this.w,_=h.parent,k=new Vn(this.ctx),I=S.globals.yAxisScale[0].result.reverse(),B=I.length,G=[],re=this.size/(B-1),ce=0;ce<B;ce++)G[ce]=re*ce;G.reverse();var ue=[],ge=[];G.forEach(function(Ae,ke){var Me=F.getPolygonPos(Ae,p.dataPointsLen),qe="";Me.forEach(function(Fe,at){if(ke===0){var ie=p.graphics.drawLine(Fe.x,Fe.y,0,0,Array.isArray(p.polygons.connectorColors)?p.polygons.connectorColors[at]:p.polygons.connectorColors);ge.push(ie)}at===0&&p.yaxisLabelsTextsPos.push({x:Fe.x,y:Fe.y}),qe+=Fe.x+","+Fe.y+" "}),ue.push(qe)}),ue.forEach(function(Ae,ke){var Me=p.polygons.strokeColors,qe=p.polygons.strokeWidth,Fe=p.graphics.drawPolygon(Ae,Array.isArray(Me)?Me[ke]:Me,Array.isArray(qe)?qe[ke]:qe,S.globals.radarPolygons.fill.colors[ke]);_.add(Fe)}),ge.forEach(function(Ae){_.add(Ae)}),S.config.yaxis[0].show&&this.yaxisLabelsTextsPos.forEach(function(Ae,ke){var Me=k.drawYAxisTexts(Ae.x,Ae.y,ke,I[ke]);p.yaxisLabels.add(Me)})}},{key:"drawXAxisTexts",value:function(){var h=this,p=this.w,S=p.config.xaxis.labels,_=this.graphics.group({class:"apexcharts-xaxis"}),k=F.getPolygonPos(this.size,this.dataPointsLen);return p.globals.labels.forEach(function(I,B){var G=p.config.xaxis.labels.formatter,re=new Ie(h.ctx);if(k[B]){var ce=h.getTextPos(k[B],h.size),ue=G(I,{seriesIndex:-1,dataPointIndex:B,w:p});re.plotDataLabelsText({x:ce.newX,y:ce.newY,text:ue,textAnchor:ce.textAnchor,i:B,j:B,parent:_,className:"apexcharts-xaxis-label",color:Array.isArray(S.style.colors)&&S.style.colors[B]?S.style.colors[B]:"#a8a8a8",dataLabelsConfig:y({textAnchor:ce.textAnchor,dropShadow:{enabled:!1}},S),offsetCorrection:!1}).on("click",function(ge){if(typeof p.config.chart.events.xAxisLabelClick=="function"){var Ae=Object.assign({},p,{labelIndex:B});p.config.chart.events.xAxisLabelClick(ge,h.ctx,Ae)}})}}),_}},{key:"createPaths",value:function(h,p){var S=this,_=[],k=[],I=[],B=[];if(h.length){k=[this.graphics.move(p.x,p.y)],B=[this.graphics.move(p.x,p.y)];var G=this.graphics.move(h[0].x,h[0].y),re=this.graphics.move(h[0].x,h[0].y);h.forEach(function(ce,ue){G+=S.graphics.line(ce.x,ce.y),re+=S.graphics.line(ce.x,ce.y),ue===h.length-1&&(G+="Z",re+="Z")}),_.push(G),I.push(re)}return{linePathsFrom:k,linePathsTo:_,areaPathsFrom:B,areaPathsTo:I}}},{key:"getTextPos",value:function(h,p){var S="middle",_=h.x,k=h.y;return Math.abs(h.x)>=10?h.x>0?(S="start",_+=10):h.x<0&&(S="end",_-=10):S="middle",Math.abs(h.y)>=p-10&&(h.y<0?k-=10:h.y>0&&(k+=10)),{textAnchor:S,newX:_,newY:k}}},{key:"getPreviousPath",value:function(h){for(var p=this.w,S=null,_=0;_<p.globals.previousPaths.length;_++){var k=p.globals.previousPaths[_];k.paths.length>0&&parseInt(k.realIndex,10)===parseInt(h,10)&&p.globals.previousPaths[_].paths[0]!==void 0&&(S=p.globals.previousPaths[_].paths[0].d)}return S}},{key:"getDataPointsPos",value:function(h,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.dataPointsLen;h=h||[],p=p||[];for(var _=[],k=0;k<S;k++){var I={};I.x=h[k]*Math.sin(p[k]),I.y=-h[k]*Math.cos(p[k]),_.push(I)}return _}}]),Ee}(),Xn=function(Ee){f(p,Kn);var h=c(p);function p(S){var _;s(this,p),(_=h.call(this,S)).ctx=S,_.w=S.w,_.animBeginArr=[0],_.animDur=0;var k=_.w;return _.startAngle=k.config.plotOptions.radialBar.startAngle,_.endAngle=k.config.plotOptions.radialBar.endAngle,_.totalAngle=Math.abs(k.config.plotOptions.radialBar.endAngle-k.config.plotOptions.radialBar.startAngle),_.trackStartAngle=k.config.plotOptions.radialBar.track.startAngle,_.trackEndAngle=k.config.plotOptions.radialBar.track.endAngle,_.barLabels=_.w.config.plotOptions.radialBar.barLabels,_.donutDataLabels=_.w.config.plotOptions.radialBar.dataLabels,_.radialDataLabels=_.donutDataLabels,_.trackStartAngle||(_.trackStartAngle=_.startAngle),_.trackEndAngle||(_.trackEndAngle=_.endAngle),_.endAngle===360&&(_.endAngle=359.99),_.margin=parseInt(k.config.plotOptions.radialBar.track.margin,10),_.onBarLabelClick=_.onBarLabelClick.bind(r(_)),_}return o(p,[{key:"draw",value:function(S){var _=this.w,k=new z(this.ctx),I=k.group({class:"apexcharts-radialbar"});if(_.globals.noData)return I;var B=k.group(),G=this.defaultSize/2,re=_.globals.gridWidth/2,ce=this.defaultSize/2.05;_.config.chart.sparkline.enabled||(ce=ce-_.config.stroke.width-_.config.chart.dropShadow.blur);var ue=_.globals.fill.colors;if(_.config.plotOptions.radialBar.track.show){var ge=this.drawTracks({size:ce,centerX:re,centerY:G,colorArr:ue,series:S});B.add(ge)}var Ae=this.drawArcs({size:ce,centerX:re,centerY:G,colorArr:ue,series:S}),ke=360;_.config.plotOptions.radialBar.startAngle<0&&(ke=this.totalAngle);var Me=(360-ke)/360;if(_.globals.radialSize=ce-ce*Me,this.radialDataLabels.value.show){var qe=Math.max(this.radialDataLabels.value.offsetY,this.radialDataLabels.name.offsetY);_.globals.radialSize+=qe*Me}return B.add(Ae.g),_.config.plotOptions.radialBar.hollow.position==="front"&&(Ae.g.add(Ae.elHollow),Ae.dataLabels&&Ae.g.add(Ae.dataLabels)),I.add(B),I}},{key:"drawTracks",value:function(S){var _=this.w,k=new z(this.ctx),I=k.group({class:"apexcharts-tracks"}),B=new L(this.ctx),G=new xe(this.ctx),re=this.getStrokeWidth(S);S.size=S.size-re/2;for(var ce=0;ce<S.series.length;ce++){var ue=k.group({class:"apexcharts-radialbar-track apexcharts-track"});I.add(ue),ue.attr({rel:ce+1}),S.size=S.size-re-this.margin;var ge=_.config.plotOptions.radialBar.track,Ae=G.fillPath({seriesNumber:0,size:S.size,fillColors:Array.isArray(ge.background)?ge.background[ce]:ge.background,solid:!0}),ke=this.trackStartAngle,Me=this.trackEndAngle;Math.abs(Me)+Math.abs(ke)>=360&&(Me=360-Math.abs(this.startAngle)-.1);var qe=k.drawPath({d:"",stroke:Ae,strokeWidth:re*parseInt(ge.strokeWidth,10)/100,fill:"none",strokeOpacity:ge.opacity,classes:"apexcharts-radialbar-area"});if(ge.dropShadow.enabled){var Fe=ge.dropShadow;B.dropShadow(qe,Fe)}ue.add(qe),qe.attr("id","apexcharts-radialbarTrack-"+ce),this.animatePaths(qe,{centerX:S.centerX,centerY:S.centerY,endAngle:Me,startAngle:ke,size:S.size,i:ce,totalItems:2,animBeginArr:0,dur:0,isTrack:!0,easing:_.globals.easing})}return I}},{key:"drawArcs",value:function(S){var _=this.w,k=new z(this.ctx),I=new xe(this.ctx),B=new L(this.ctx),G=k.group(),re=this.getStrokeWidth(S);S.size=S.size-re/2;var ce=_.config.plotOptions.radialBar.hollow.background,ue=S.size-re*S.series.length-this.margin*S.series.length-re*parseInt(_.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,ge=ue-_.config.plotOptions.radialBar.hollow.margin;_.config.plotOptions.radialBar.hollow.image!==void 0&&(ce=this.drawHollowImage(S,G,ue,ce));var Ae=this.drawHollow({size:ge,centerX:S.centerX,centerY:S.centerY,fill:ce||"transparent"});if(_.config.plotOptions.radialBar.hollow.dropShadow.enabled){var ke=_.config.plotOptions.radialBar.hollow.dropShadow;B.dropShadow(Ae,ke)}var Me=1;!this.radialDataLabels.total.show&&_.globals.series.length>1&&(Me=0);var qe=null;if(this.radialDataLabels.show){var Fe=_.globals.dom.Paper.select(".apexcharts-datalabels-group").members[0];qe=this.renderInnerDataLabels(Fe,this.radialDataLabels,{hollowSize:ue,centerX:S.centerX,centerY:S.centerY,opacity:Me})}_.config.plotOptions.radialBar.hollow.position==="back"&&(G.add(Ae),qe&&G.add(qe));var at=!1;_.config.plotOptions.radialBar.inverseOrder&&(at=!0);for(var ie=at?S.series.length-1:0;at?ie>=0:ie<S.series.length;at?ie--:ie++){var Se=k.group({class:"apexcharts-series apexcharts-radial-series",seriesName:F.escapeString(_.globals.seriesNames[ie])});G.add(Se),Se.attr({rel:ie+1,"data:realIndex":ie}),this.ctx.series.addCollapsedClassToSeries(Se,ie),S.size=S.size-re-this.margin;var $e=I.fillPath({seriesNumber:ie,size:S.size,value:S.series[ie]}),Ue=this.startAngle,_e=void 0,st=F.negToZero(S.series[ie]>100?100:S.series[ie])/100,ut=Math.round(this.totalAngle*st)+this.startAngle,yt=void 0;_.globals.dataChanged&&(_e=this.startAngle,yt=Math.round(this.totalAngle*F.negToZero(_.globals.previousPaths[ie])/100)+_e),Math.abs(ut)+Math.abs(Ue)>360&&(ut-=.01),Math.abs(yt)+Math.abs(_e)>360&&(yt-=.01);var Mt=ut-Ue,Kt=Array.isArray(_.config.stroke.dashArray)?_.config.stroke.dashArray[ie]:_.config.stroke.dashArray,un=k.drawPath({d:"",stroke:$e,strokeWidth:re,fill:"none",fillOpacity:_.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+ie,strokeDashArray:Kt});if(z.setAttrs(un.node,{"data:angle":Mt,"data:value":S.series[ie]}),_.config.chart.dropShadow.enabled){var Xe=_.config.chart.dropShadow;B.dropShadow(un,Xe,ie)}if(B.setSelectionFilter(un,0,ie),this.addListeners(un,this.radialDataLabels),Se.add(un),un.attr({index:0,j:ie}),this.barLabels.enabled){var Pt=F.polarToCartesian(S.centerX,S.centerY,S.size,Ue),Wt=this.barLabels.formatter(_.globals.seriesNames[ie],{seriesIndex:ie,w:_}),ct=["apexcharts-radialbar-label"];this.barLabels.onClick||ct.push("apexcharts-no-click");var Ge=this.barLabels.useSeriesColors?_.globals.colors[ie]:_.config.chart.foreColor;Ge||(Ge=_.config.chart.foreColor);var Tt=Pt.x+this.barLabels.offsetX,fn=Pt.y+this.barLabels.offsetY,Yn=k.drawText({x:Tt,y:fn,text:Wt,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:Ge,cssClass:ct.join(" ")});Yn.on("click",this.onBarLabelClick),Yn.attr({rel:ie+1}),Ue!==0&&Yn.attr({"transform-origin":"".concat(Tt," ").concat(fn),transform:"rotate(".concat(Ue," 0 0)")}),Se.add(Yn)}var Fn=0;!this.initialAnim||_.globals.resized||_.globals.dataChanged||(Fn=_.config.chart.animations.speed),_.globals.dataChanged&&(Fn=_.config.chart.animations.dynamicAnimation.speed),this.animDur=Fn/(1.2*S.series.length)+this.animDur,this.animBeginArr.push(this.animDur),this.animatePaths(un,{centerX:S.centerX,centerY:S.centerY,endAngle:ut,startAngle:Ue,prevEndAngle:yt,prevStartAngle:_e,size:S.size,i:ie,totalItems:2,animBeginArr:this.animBeginArr,dur:Fn,shouldSetPrevPaths:!0,easing:_.globals.easing})}return{g:G,elHollow:Ae,dataLabels:qe}}},{key:"drawHollow",value:function(S){var _=new z(this.ctx).drawCircle(2*S.size);return _.attr({class:"apexcharts-radialbar-hollow",cx:S.centerX,cy:S.centerY,r:S.size,fill:S.fill}),_}},{key:"drawHollowImage",value:function(S,_,k,I){var B=this.w,G=new xe(this.ctx),re=F.randomId(),ce=B.config.plotOptions.radialBar.hollow.image;if(B.config.plotOptions.radialBar.hollow.imageClipped)G.clippedImgArea({width:k,height:k,image:ce,patternID:"pattern".concat(B.globals.cuid).concat(re)}),I="url(#pattern".concat(B.globals.cuid).concat(re,")");else{var ue=B.config.plotOptions.radialBar.hollow.imageWidth,ge=B.config.plotOptions.radialBar.hollow.imageHeight;if(ue===void 0&&ge===void 0){var Ae=B.globals.dom.Paper.image(ce).loaded(function(Me){this.move(S.centerX-Me.width/2+B.config.plotOptions.radialBar.hollow.imageOffsetX,S.centerY-Me.height/2+B.config.plotOptions.radialBar.hollow.imageOffsetY)});_.add(Ae)}else{var ke=B.globals.dom.Paper.image(ce).loaded(function(Me){this.move(S.centerX-ue/2+B.config.plotOptions.radialBar.hollow.imageOffsetX,S.centerY-ge/2+B.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(ue,ge)});_.add(ke)}}return I}},{key:"getStrokeWidth",value:function(S){var _=this.w;return S.size*(100-parseInt(_.config.plotOptions.radialBar.hollow.size,10))/100/(S.series.length+1)-this.margin}},{key:"onBarLabelClick",value:function(S){var _=parseInt(S.target.getAttribute("rel"),10)-1,k=this.barLabels.onClick,I=this.w;k&&k(I.globals.seriesNames[_],{w:I,seriesIndex:_})}}]),p}(),Nn=function(Ee){f(p,rn);var h=c(p);function p(){return s(this,p),h.apply(this,arguments)}return o(p,[{key:"draw",value:function(S,_){var k=this.w,I=new z(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=S,this.seriesRangeStart=k.globals.seriesRangeStart,this.seriesRangeEnd=k.globals.seriesRangeEnd,this.barHelpers.initVariables(S);for(var B=I.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),G=0;G<S.length;G++){var re,ce,ue,ge,Ae=void 0,ke=void 0,Me=k.globals.comboCharts?_[G]:G,qe=this.barHelpers.getGroupIndex(Me).columnGroupIndex,Fe=I.group({class:"apexcharts-series",seriesName:F.escapeString(k.globals.seriesNames[Me]),rel:G+1,"data:realIndex":Me});this.ctx.series.addCollapsedClassToSeries(Fe,Me),S[G].length>0&&(this.visibleI=this.visibleI+1);var at=0,ie=0,Se=0;this.yRatio.length>1&&(this.yaxisIndex=k.globals.seriesYAxisReverseMap[Me][0],Se=Me);var $e=this.barHelpers.initialPositions();ke=$e.y,ge=$e.zeroW,Ae=$e.x,ie=$e.barWidth,at=$e.barHeight,re=$e.xDivision,ce=$e.yDivision,ue=$e.zeroH;for(var Ue=I.group({class:"apexcharts-datalabels","data:realIndex":Me}),_e=I.group({class:"apexcharts-rangebar-goals-markers"}),st=0;st<k.globals.dataPoints;st++){var ut=this.barHelpers.getStrokeWidth(G,st,Me),yt=this.seriesRangeStart[G][st],Mt=this.seriesRangeEnd[G][st],Kt=null,un=null,Xe=null,Pt={x:Ae,y:ke,strokeWidth:ut,elSeries:Fe},Wt=this.seriesLen;if(k.config.plotOptions.bar.rangeBarGroupRows&&(Wt=1),k.config.series[G].data[st]===void 0)break;if(this.isHorizontal){Xe=ke+at*this.visibleI;var ct=(ce-at*Wt)/2;if(k.config.series[G].data[st].x){var Ge=this.detectOverlappingBars({i:G,j:st,barYPosition:Xe,srty:ct,barHeight:at,yDivision:ce,initPositions:$e});at=Ge.barHeight,Xe=Ge.barYPosition}ie=(Kt=this.drawRangeBarPaths(y({indexes:{i:G,j:st,realIndex:Me},barHeight:at,barYPosition:Xe,zeroW:ge,yDivision:ce,y1:yt,y2:Mt},Pt))).barWidth}else{k.globals.isXNumeric&&(Ae=(k.globals.seriesX[G][st]-k.globals.minX)/this.xRatio-ie/2),un=Ae+ie*this.visibleI;var Tt=(re-ie*Wt)/2;if(k.config.series[G].data[st].x){var fn=this.detectOverlappingBars({i:G,j:st,barXPosition:un,srtx:Tt,barWidth:ie,xDivision:re,initPositions:$e});ie=fn.barWidth,un=fn.barXPosition}at=(Kt=this.drawRangeColumnPaths(y({indexes:{i:G,j:st,realIndex:Me,translationsIndex:Se},barWidth:ie,barXPosition:un,zeroH:ue,xDivision:re},Pt))).barHeight}var Yn=this.barHelpers.drawGoalLine({barXPosition:Kt.barXPosition,barYPosition:Xe,goalX:Kt.goalX,goalY:Kt.goalY,barHeight:at,barWidth:ie});Yn&&_e.add(Yn),ke=Kt.y,Ae=Kt.x;var Fn=this.barHelpers.getPathFillColor(S,G,st,Me),Gn=k.globals.stroke.colors[Me];this.renderSeries({realIndex:Me,pathFill:Fn,lineFill:Gn,j:st,i:G,x:Ae,y:ke,y1:yt,y2:Mt,pathFrom:Kt.pathFrom,pathTo:Kt.pathTo,strokeWidth:ut,elSeries:Fe,series:S,barHeight:at,barWidth:ie,barXPosition:un,barYPosition:Xe,columnGroupIndex:qe,elDataLabelsWrap:Ue,elGoalsMarkers:_e,visibleSeries:this.visibleI,type:"rangebar"})}B.add(Fe)}return B}},{key:"detectOverlappingBars",value:function(S){var _=S.i,k=S.j,I=S.barYPosition,B=S.barXPosition,G=S.srty,re=S.srtx,ce=S.barHeight,ue=S.barWidth,ge=S.yDivision,Ae=S.xDivision,ke=S.initPositions,Me=this.w,qe=[],Fe=Me.config.series[_].data[k].rangeName,at=Me.config.series[_].data[k].x,ie=Array.isArray(at)?at.join(" "):at,Se=Me.globals.labels.map(function(Ue){return Array.isArray(Ue)?Ue.join(" "):Ue}).indexOf(ie),$e=Me.globals.seriesRange[_].findIndex(function(Ue){return Ue.x===ie&&Ue.overlaps.length>0});return this.isHorizontal?(I=Me.config.plotOptions.bar.rangeBarGroupRows?G+ge*Se:G+ce*this.visibleI+ge*Se,$e>-1&&!Me.config.plotOptions.bar.rangeBarOverlap&&(qe=Me.globals.seriesRange[_][$e].overlaps).indexOf(Fe)>-1&&(I=(ce=ke.barHeight/qe.length)*this.visibleI+ge*(100-parseInt(this.barOptions.barHeight,10))/100/2+ce*(this.visibleI+qe.indexOf(Fe))+ge*Se)):(Se>-1&&!Me.globals.timescaleLabels.length&&(B=Me.config.plotOptions.bar.rangeBarGroupRows?re+Ae*Se:re+ue*this.visibleI+Ae*Se),$e>-1&&!Me.config.plotOptions.bar.rangeBarOverlap&&(qe=Me.globals.seriesRange[_][$e].overlaps).indexOf(Fe)>-1&&(B=(ue=ke.barWidth/qe.length)*this.visibleI+Ae*(100-parseInt(this.barOptions.barWidth,10))/100/2+ue*(this.visibleI+qe.indexOf(Fe))+Ae*Se)),{barYPosition:I,barXPosition:B,barHeight:ce,barWidth:ue}}},{key:"drawRangeColumnPaths",value:function(S){var _=S.indexes,k=S.x,I=S.xDivision,B=S.barWidth,G=S.barXPosition,re=S.zeroH,ce=this.w,ue=_.i,ge=_.j,Ae=_.realIndex,ke=_.translationsIndex,Me=this.yRatio[ke],qe=this.getRangeValue(Ae,ge),Fe=Math.min(qe.start,qe.end),at=Math.max(qe.start,qe.end);this.series[ue][ge]===void 0||this.series[ue][ge]===null?Fe=re:(Fe=re-Fe/Me,at=re-at/Me);var ie=Math.abs(at-Fe),Se=this.barHelpers.getColumnPaths({barXPosition:G,barWidth:B,y1:Fe,y2:at,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:Ae,i:Ae,j:ge,w:ce});if(ce.globals.isXNumeric){var $e=this.getBarXForNumericXAxis({x:k,j:ge,realIndex:Ae,barWidth:B});k=$e.x,G=$e.barXPosition}else k+=I;return{pathTo:Se.pathTo,pathFrom:Se.pathFrom,barHeight:ie,x:k,y:qe.start<0&&qe.end<0?Fe:at,goalY:this.barHelpers.getGoalValues("y",null,re,ue,ge,ke),barXPosition:G}}},{key:"preventBarOverflow",value:function(S){var _=this.w;return S<0&&(S=0),S>_.globals.gridWidth&&(S=_.globals.gridWidth),S}},{key:"drawRangeBarPaths",value:function(S){var _=S.indexes,k=S.y,I=S.y1,B=S.y2,G=S.yDivision,re=S.barHeight,ce=S.barYPosition,ue=S.zeroW,ge=this.w,Ae=_.realIndex,ke=_.j,Me=this.preventBarOverflow(ue+I/this.invertedYRatio),qe=this.preventBarOverflow(ue+B/this.invertedYRatio),Fe=this.getRangeValue(Ae,ke),at=Math.abs(qe-Me),ie=this.barHelpers.getBarpaths({barYPosition:ce,barHeight:re,x1:Me,x2:qe,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:Ae,realIndex:Ae,j:ke,w:ge});return ge.globals.isXNumeric||(k+=G),{pathTo:ie.pathTo,pathFrom:ie.pathFrom,barWidth:at,x:Fe.start<0&&Fe.end<0?Me:qe,goalX:this.barHelpers.getGoalValues("x",ue,null,Ae,ke),y:k}}},{key:"getRangeValue",value:function(S,_){var k=this.w;return{start:k.globals.seriesRangeStart[S][_],end:k.globals.seriesRangeEnd[S][_]}}}]),p}(),on=function(){function Ee(h){s(this,Ee),this.w=h.w,this.lineCtx=h}return o(Ee,[{key:"sameValueSeriesFix",value:function(h,p){var S=this.w;if((S.config.fill.type==="gradient"||S.config.fill.type[h]==="gradient")&&new X(this.lineCtx.ctx,S).seriesHaveSameValues(h)){var _=p[h].slice();_[_.length-1]=_[_.length-1]+1e-6,p[h]=_}return p}},{key:"calculatePoints",value:function(h){var p=h.series,S=h.realIndex,_=h.x,k=h.y,I=h.i,B=h.j,G=h.prevY,re=this.w,ce=[],ue=[];if(B===0){var ge=this.lineCtx.categoryAxisCorrection+re.config.markers.offsetX;re.globals.isXNumeric&&(ge=(re.globals.seriesX[S][0]-re.globals.minX)/this.lineCtx.xRatio+re.config.markers.offsetX),ce.push(ge),ue.push(F.isNumber(p[I][0])?G+re.config.markers.offsetY:null),ce.push(_+re.config.markers.offsetX),ue.push(F.isNumber(p[I][B+1])?k+re.config.markers.offsetY:null)}else ce.push(_+re.config.markers.offsetX),ue.push(F.isNumber(p[I][B+1])?k+re.config.markers.offsetY:null);return{x:ce,y:ue}}},{key:"checkPreviousPaths",value:function(h){for(var p=h.pathFromLine,S=h.pathFromArea,_=h.realIndex,k=this.w,I=0;I<k.globals.previousPaths.length;I++){var B=k.globals.previousPaths[I];(B.type==="line"||B.type==="area")&&B.paths.length>0&&parseInt(B.realIndex,10)===parseInt(_,10)&&(B.type==="line"?(this.lineCtx.appendPathFrom=!1,p=k.globals.previousPaths[I].paths[0].d):B.type==="area"&&(this.lineCtx.appendPathFrom=!1,S=k.globals.previousPaths[I].paths[0].d,k.config.stroke.show&&k.globals.previousPaths[I].paths[1]&&(p=k.globals.previousPaths[I].paths[1].d)))}return{pathFromLine:p,pathFromArea:S}}},{key:"determineFirstPrevY",value:function(h){var p,S,_,k=h.i,I=h.realIndex,B=h.series,G=h.prevY,re=h.lineYPosition,ce=h.translationsIndex,ue=this.w,ge=ue.config.chart.stacked&&!ue.globals.comboCharts||ue.config.chart.stacked&&ue.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[I])===null||p===void 0?void 0:p.type)==="bar"||((S=this.w.config.series[I])===null||S===void 0?void 0:S.type)==="column");if(((_=B[k])===null||_===void 0?void 0:_[0])!==void 0)G=(re=ge&&k>0?this.lineCtx.prevSeriesY[k-1][0]:this.lineCtx.zeroY)-B[k][0]/this.lineCtx.yRatio[ce]+2*(this.lineCtx.isReversed?B[k][0]/this.lineCtx.yRatio[ce]:0);else if(ge&&k>0&&B[k][0]===void 0){for(var Ae=k-1;Ae>=0;Ae--)if(B[Ae][0]!==null&&B[Ae][0]!==void 0){G=re=this.lineCtx.prevSeriesY[Ae][0];break}}return{prevY:G,lineYPosition:re}}}]),Ee}(),Oe=function(Ee){for(var h,p,S,_,k=function(ce){for(var ue=[],ge=ce[0],Ae=ce[1],ke=ue[0]=jt(ge,Ae),Me=1,qe=ce.length-1;Me<qe;Me++)ge=Ae,Ae=ce[Me+1],ue[Me]=.5*(ke+(ke=jt(ge,Ae)));return ue[Me]=ke,ue}(Ee),I=Ee.length-1,B=[],G=0;G<I;G++)S=jt(Ee[G],Ee[G+1]),Math.abs(S)<1e-6?k[G]=k[G+1]=0:(_=(h=k[G]/S)*h+(p=k[G+1]/S)*p)>9&&(_=3*S/Math.sqrt(_),k[G]=_*h,k[G+1]=_*p);for(var re=0;re<=I;re++)_=(Ee[Math.min(I,re+1)][0]-Ee[Math.max(0,re-1)][0])/(6*(1+k[re]*k[re])),B.push([_||0,k[re]*_||0]);return B},Zt=function(Ee){var h=Oe(Ee),p=Ee[1],S=Ee[0],_=[],k=h[1],I=h[0];_.push(S,[S[0]+I[0],S[1]+I[1],p[0]-k[0],p[1]-k[1],p[0],p[1]]);for(var B=2,G=h.length;B<G;B++){var re=Ee[B],ce=h[B];_.push([re[0]-ce[0],re[1]-ce[1],re[0],re[1]])}return _},sn=function(Ee,h,p){var S=Ee.slice(h,p);if(h){if(p-h>1&&S[1].length<6){var _=S[0].length;S[1]=[2*S[0][_-2]-S[0][_-4],2*S[0][_-1]-S[0][_-3]].concat(S[1])}S[0]=S[0].slice(-2)}return S};function jt(Ee,h){return(h[1]-Ee[1])/(h[0]-Ee[0])}var Qn=function(){function Ee(h,p,S){s(this,Ee),this.ctx=h,this.w=h.w,this.xyRatios=p,this.pointsChart=!(this.w.config.chart.type!=="bubble"&&this.w.config.chart.type!=="scatter")||S,this.scatter=new je(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new on(this),this.markers=new be(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return o(Ee,[{key:"draw",value:function(h,p,S,_){var k,I=this.w,B=new z(this.ctx),G=I.globals.comboCharts?p:I.config.chart.type,re=B.group({class:"apexcharts-".concat(G,"-series apexcharts-plot-series")}),ce=new X(this.ctx,I);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,h=ce.getLogSeries(h),this.yRatio=ce.getLogYRatios(this.yRatio),this.prevSeriesY=[];for(var ue=[],ge=0;ge<h.length;ge++){h=this.lineHelpers.sameValueSeriesFix(ge,h);var Ae=I.globals.comboCharts?S[ge]:ge,ke=this.yRatio.length>1?Ae:0;this._initSerieVariables(h,ge,Ae);var Me=[],qe=[],Fe=[],at=I.globals.padHorizontal+this.categoryAxisCorrection;this.ctx.series.addCollapsedClassToSeries(this.elSeries,Ae),I.globals.isXNumeric&&I.globals.seriesX.length>0&&(at=(I.globals.seriesX[Ae][0]-I.globals.minX)/this.xRatio),Fe.push(at);var ie,Se=at,$e=void 0,Ue=Se,_e=this.zeroY,st=this.zeroY;_e=this.lineHelpers.determineFirstPrevY({i:ge,realIndex:Ae,series:h,prevY:_e,lineYPosition:0,translationsIndex:ke}).prevY,I.config.stroke.curve==="monotoneCubic"&&h[ge][0]===null?Me.push(null):Me.push(_e),ie=_e,G==="rangeArea"&&($e=st=this.lineHelpers.determineFirstPrevY({i:ge,realIndex:Ae,series:_,prevY:st,lineYPosition:0,translationsIndex:ke}).prevY,qe.push(Me[0]!==null?st:null));var ut=this._calculatePathsFrom({type:G,series:h,i:ge,realIndex:Ae,translationsIndex:ke,prevX:Ue,prevY:_e,prevY2:st}),yt=[Me[0]],Mt=[qe[0]],Kt={type:G,series:h,realIndex:Ae,translationsIndex:ke,i:ge,x:at,y:1,pX:Se,pY:ie,pathsFrom:ut,linePaths:[],areaPaths:[],seriesIndex:S,lineYPosition:0,xArrj:Fe,yArrj:Me,y2Arrj:qe,seriesRangeEnd:_},un=this._iterateOverDataPoints(y(y({},Kt),{},{iterations:G==="rangeArea"?h[ge].length-1:void 0,isRangeStart:!0}));if(G==="rangeArea"){for(var Xe=this._calculatePathsFrom({series:_,i:ge,realIndex:Ae,prevX:Ue,prevY:st}),Pt=this._iterateOverDataPoints(y(y({},Kt),{},{series:_,xArrj:[at],yArrj:yt,y2Arrj:Mt,pY:$e,areaPaths:un.areaPaths,pathsFrom:Xe,iterations:_[ge].length-1,isRangeStart:!1})),Wt=un.linePaths.length/2,ct=0;ct<Wt;ct++)un.linePaths[ct]=Pt.linePaths[ct+Wt]+un.linePaths[ct];un.linePaths.splice(Wt),un.pathFromLine=Pt.pathFromLine+un.pathFromLine}else un.pathFromArea+="z";this._handlePaths({type:G,realIndex:Ae,i:ge,paths:un}),this.elSeries.add(this.elPointsMain),this.elSeries.add(this.elDataLabelsWrap),ue.push(this.elSeries)}if(((k=I.config.series[0])===null||k===void 0?void 0:k.zIndex)!==void 0&&ue.sort(function(fn,Yn){return Number(fn.node.getAttribute("zIndex"))-Number(Yn.node.getAttribute("zIndex"))}),I.config.chart.stacked)for(var Ge=ue.length-1;Ge>=0;Ge--)re.add(ue[Ge]);else for(var Tt=0;Tt<ue.length;Tt++)re.add(ue[Tt]);return re}},{key:"_initSerieVariables",value:function(h,p,S){var _=this.w,k=new z(this.ctx);this.xDivision=_.globals.gridWidth/(_.globals.dataPoints-(_.config.xaxis.tickPlacement==="on"?1:0)),this.strokeWidth=Array.isArray(_.config.stroke.width)?_.config.stroke.width[S]:_.config.stroke.width;var I=0;this.yRatio.length>1&&(this.yaxisIndex=_.globals.seriesYAxisReverseMap[S],I=S),this.isReversed=_.config.yaxis[this.yaxisIndex]&&_.config.yaxis[this.yaxisIndex].reversed,this.zeroY=_.globals.gridHeight-this.baseLineY[I]-(this.isReversed?_.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[I]:0),this.areaBottomY=this.zeroY,(this.zeroY>_.globals.gridHeight||_.config.plotOptions.area.fillTo==="end")&&(this.areaBottomY=_.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=k.group({class:"apexcharts-series",zIndex:_.config.series[S].zIndex!==void 0?_.config.series[S].zIndex:S,seriesName:F.escapeString(_.globals.seriesNames[S])}),this.elPointsMain=k.group({class:"apexcharts-series-markers-wrap","data:realIndex":S}),this.elDataLabelsWrap=k.group({class:"apexcharts-datalabels","data:realIndex":S});var B=h[p].length===_.globals.dataPoints;this.elSeries.attr({"data:longestSeries":B,rel:p+1,"data:realIndex":S}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(h){var p,S,_,k,I=h.type,B=h.series,G=h.i,re=h.realIndex,ce=h.translationsIndex,ue=h.prevX,ge=h.prevY,Ae=h.prevY2,ke=this.w,Me=new z(this.ctx);if(B[G][0]===null){for(var qe=0;qe<B[G].length;qe++)if(B[G][qe]!==null){ue=this.xDivision*qe,ge=this.zeroY-B[G][qe]/this.yRatio[ce],p=Me.move(ue,ge),S=Me.move(ue,this.areaBottomY);break}}else p=Me.move(ue,ge),I==="rangeArea"&&(p=Me.move(ue,Ae)+Me.line(ue,ge)),S=Me.move(ue,this.areaBottomY)+Me.line(ue,ge);if(_=Me.move(0,this.zeroY)+Me.line(0,this.zeroY),k=Me.move(0,this.zeroY)+Me.line(0,this.zeroY),ke.globals.previousPaths.length>0){var Fe=this.lineHelpers.checkPreviousPaths({pathFromLine:_,pathFromArea:k,realIndex:re});_=Fe.pathFromLine,k=Fe.pathFromArea}return{prevX:ue,prevY:ge,linePath:p,areaPath:S,pathFromLine:_,pathFromArea:k}}},{key:"_handlePaths",value:function(h){var p=h.type,S=h.realIndex,_=h.i,k=h.paths,I=this.w,B=new z(this.ctx),G=new xe(this.ctx);this.prevSeriesY.push(k.yArrj),I.globals.seriesXvalues[S]=k.xArrj,I.globals.seriesYvalues[S]=k.yArrj;var re=I.config.forecastDataPoints;if(re.count>0&&p!=="rangeArea"){var ce=I.globals.seriesXvalues[S][I.globals.seriesXvalues[S].length-re.count-1],ue=B.drawRect(ce,0,I.globals.gridWidth,I.globals.gridHeight,0);I.globals.dom.elForecastMask.appendChild(ue.node);var ge=B.drawRect(0,0,ce,I.globals.gridHeight,0);I.globals.dom.elNonForecastMask.appendChild(ge.node)}this.pointsChart||I.globals.delayedElements.push({el:this.elPointsMain.node,index:S});var Ae={i:_,realIndex:S,animationDelay:_,initialSpeed:I.config.chart.animations.speed,dataChangeSpeed:I.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(p)};if(p==="area")for(var ke=G.fillPath({seriesNumber:S}),Me=0;Me<k.areaPaths.length;Me++){var qe=B.renderPaths(y(y({},Ae),{},{pathFrom:k.pathFromArea,pathTo:k.areaPaths[Me],stroke:"none",strokeWidth:0,strokeLineCap:null,fill:ke}));this.elSeries.add(qe)}if(I.config.stroke.show&&!this.pointsChart){var Fe=null;if(p==="line")Fe=G.fillPath({seriesNumber:S,i:_});else if(I.config.stroke.fill.type==="solid")Fe=I.globals.stroke.colors[S];else{var at=I.config.fill;I.config.fill=I.config.stroke.fill,Fe=G.fillPath({seriesNumber:S,i:_}),I.config.fill=at}for(var ie=0;ie<k.linePaths.length;ie++){var Se=Fe;p==="rangeArea"&&(Se=G.fillPath({seriesNumber:S}));var $e=y(y({},Ae),{},{pathFrom:k.pathFromLine,pathTo:k.linePaths[ie],stroke:Fe,strokeWidth:this.strokeWidth,strokeLineCap:I.config.stroke.lineCap,fill:p==="rangeArea"?Se:"none"}),Ue=B.renderPaths($e);if(this.elSeries.add(Ue),Ue.attr("fill-rule","evenodd"),re.count>0&&p!=="rangeArea"){var _e=B.renderPaths($e);_e.node.setAttribute("stroke-dasharray",re.dashArray),re.strokeWidth&&_e.node.setAttribute("stroke-width",re.strokeWidth),this.elSeries.add(_e),_e.attr("clip-path","url(#forecastMask".concat(I.globals.cuid,")")),Ue.attr("clip-path","url(#nonForecastMask".concat(I.globals.cuid,")"))}}}}},{key:"_iterateOverDataPoints",value:function(h){var p,S,_=this,k=h.type,I=h.series,B=h.iterations,G=h.realIndex,re=h.translationsIndex,ce=h.i,ue=h.x,ge=h.y,Ae=h.pX,ke=h.pY,Me=h.pathsFrom,qe=h.linePaths,Fe=h.areaPaths,at=h.seriesIndex,ie=h.lineYPosition,Se=h.xArrj,$e=h.yArrj,Ue=h.y2Arrj,_e=h.isRangeStart,st=h.seriesRangeEnd,ut=this.w,yt=new z(this.ctx),Mt=this.yRatio,Kt=Me.prevY,un=Me.linePath,Xe=Me.areaPath,Pt=Me.pathFromLine,Wt=Me.pathFromArea,ct=F.isNumber(ut.globals.minYArr[G])?ut.globals.minYArr[G]:ut.globals.minY;B||(B=ut.globals.dataPoints>1?ut.globals.dataPoints-1:ut.globals.dataPoints);var Ge=function(Mn,rr){return rr-Mn/Mt[re]+2*(_.isReversed?Mn/Mt[re]:0)},Tt=ge,fn=ut.config.chart.stacked&&!ut.globals.comboCharts||ut.config.chart.stacked&&ut.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||((p=this.w.config.series[G])===null||p===void 0?void 0:p.type)==="bar"||((S=this.w.config.series[G])===null||S===void 0?void 0:S.type)==="column"),Yn=ut.config.stroke.curve;Array.isArray(Yn)&&(Yn=Array.isArray(at)?Yn[at[ce]]:Yn[ce]);for(var Fn,Gn=0,Sr=0;Sr<B;Sr++){var ur=I[ce][Sr+1]===void 0||I[ce][Sr+1]===null;if(ut.globals.isXNumeric){var kr=ut.globals.seriesX[G][Sr+1];ut.globals.seriesX[G][Sr+1]===void 0&&(kr=ut.globals.seriesX[G][B-1]),ue=(kr-ut.globals.minX)/this.xRatio}else ue+=this.xDivision;fn?ce>0&&ut.globals.collapsedSeries.length<ut.config.series.length-1?ie=this.prevSeriesY[function(Mn){for(var rr=Mn;rr>0;rr--){if(!(ut.globals.collapsedSeriesIndices.indexOf((at==null?void 0:at[rr])||rr)>-1))return rr;rr--}return 0}(ce-1)][Sr+1]:ie=this.zeroY:ie=this.zeroY,ur?ge=Ge(ct,ie):(ge=Ge(I[ce][Sr+1],ie),k==="rangeArea"&&(Tt=Ge(st[ce][Sr+1],ie))),Se.push(ue),!ur||ut.config.stroke.curve!=="smooth"&&ut.config.stroke.curve!=="monotoneCubic"?($e.push(ge),Ue.push(Tt)):($e.push(null),Ue.push(null));var Bn=this.lineHelpers.calculatePoints({series:I,x:ue,y:ge,realIndex:G,i:ce,j:Sr,prevY:Kt}),Sn=this._createPaths({type:k,series:I,i:ce,realIndex:G,j:Sr,x:ue,y:ge,y2:Tt,xArrj:Se,yArrj:$e,y2Arrj:Ue,pX:Ae,pY:ke,pathState:Gn,segmentStartX:Fn,linePath:un,areaPath:Xe,linePaths:qe,areaPaths:Fe,curve:Yn,isRangeStart:_e});Fe=Sn.areaPaths,qe=Sn.linePaths,Ae=Sn.pX,ke=Sn.pY,Gn=Sn.pathState,Fn=Sn.segmentStartX,Xe=Sn.areaPath,un=Sn.linePath,!this.appendPathFrom||Yn==="monotoneCubic"&&k==="rangeArea"||(Pt+=yt.line(ue,this.zeroY),Wt+=yt.line(ue,this.zeroY)),this.handleNullDataPoints(I,Bn,ce,Sr,G),this._handleMarkersAndLabels({type:k,pointsPos:Bn,i:ce,j:Sr,realIndex:G,isRangeStart:_e})}return{yArrj:$e,xArrj:Se,pathFromArea:Wt,areaPaths:Fe,pathFromLine:Pt,linePaths:qe,linePath:un,areaPath:Xe}}},{key:"_handleMarkersAndLabels",value:function(h){var p=h.type,S=h.pointsPos,_=h.isRangeStart,k=h.i,I=h.j,B=h.realIndex,G=this.w,re=new Ie(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,I,{realIndex:B,pointsPos:S,zRatio:this.zRatio,elParent:this.elPointsMain});else{G.globals.series[k].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var ce=this.markers.plotChartMarkers(S,B,I+1);ce!==null&&this.elPointsMain.add(ce)}var ue=re.drawDataLabel({type:p,isRangeStart:_,pos:S,i:B,j:I+1});ue!==null&&this.elDataLabelsWrap.add(ue)}},{key:"_createPaths",value:function(h){var p=h.type,S=h.series,_=h.i;h.realIndex;var k,I=h.j,B=h.x,G=h.y,re=h.xArrj,ce=h.yArrj,ue=h.y2,ge=h.y2Arrj,Ae=h.pX,ke=h.pY,Me=h.pathState,qe=h.segmentStartX,Fe=h.linePath,at=h.areaPath,ie=h.linePaths,Se=h.areaPaths,$e=h.curve,Ue=h.isRangeStart,_e=new z(this.ctx),st=this.areaBottomY,ut=p==="rangeArea",yt=p==="rangeArea"&&Ue;switch($e){case"monotoneCubic":var Mt=Ue?ce:ge;switch(Me){case 0:if(Mt[I+1]===null)break;Me=1;case 1:if(!(ut?re.length===S[_].length:I===S[_].length-2))break;case 2:var Kt=Ue?re:re.slice().reverse(),un=Ue?Mt:Mt.slice().reverse(),Xe=(k=un,Kt.map(function(kr,Bn){return[kr,k[Bn]]}).filter(function(kr){return kr[1]!==null})),Pt=Xe.length>1?Zt(Xe):Xe,Wt=[];ut&&(yt?Se=Xe:Wt=Se.reverse());var ct=0,Ge=0;if(function(kr,Bn){for(var Sn=function(cs){var et=[],gt=0;return cs.forEach(function(Tn){Tn!==null?gt++:gt>0&&(et.push(gt),gt=0)}),gt>0&&et.push(gt),et}(kr),Mn=[],rr=0,ls=0;rr<Sn.length;ls+=Sn[rr++])Mn[rr]=sn(Bn,ls,ls+Sn[rr]);return Mn}(un,Pt).forEach(function(kr){ct++;var Bn=function(rr){for(var ls="",cs=0;cs<rr.length;cs++){var et=rr[cs],gt=et.length;gt>4?(ls+="C".concat(et[0],", ").concat(et[1]),ls+=", ".concat(et[2],", ").concat(et[3]),ls+=", ".concat(et[4],", ").concat(et[5])):gt>2&&(ls+="S".concat(et[0],", ").concat(et[1]),ls+=", ".concat(et[2],", ").concat(et[3]))}return ls}(kr),Sn=Ge,Mn=(Ge+=kr.length)-1;yt?Fe=_e.move(Xe[Sn][0],Xe[Sn][1])+Bn:ut?Fe=_e.move(Wt[Sn][0],Wt[Sn][1])+_e.line(Xe[Sn][0],Xe[Sn][1])+Bn+_e.line(Wt[Mn][0],Wt[Mn][1]):(Fe=_e.move(Xe[Sn][0],Xe[Sn][1])+Bn,at=Fe+_e.line(Xe[Mn][0],st)+_e.line(Xe[Sn][0],st)+"z",Se.push(at)),ie.push(Fe)}),ut&&ct>1&&!yt){var Tt=ie.slice(ct).reverse();ie.splice(ct),Tt.forEach(function(kr){return ie.push(kr)})}Me=0}break;case"smooth":var fn=.35*(B-Ae);if(S[_][I]===null)Me=0;else switch(Me){case 0:if(qe=Ae,Fe=yt?_e.move(Ae,ge[I])+_e.line(Ae,ke):_e.move(Ae,ke),at=_e.move(Ae,ke),S[_][I+1]===null){ie.push(Fe),Se.push(at);break}if(Me=1,I<S[_].length-2){var Yn=_e.curve(Ae+fn,ke,B-fn,G,B,G);Fe+=Yn,at+=Yn;break}case 1:if(S[_][I+1]===null)Fe+=yt?_e.line(Ae,ue):_e.move(Ae,ke),at+=_e.line(Ae,st)+_e.line(qe,st)+"z",ie.push(Fe),Se.push(at),Me=-1;else{var Fn=_e.curve(Ae+fn,ke,B-fn,G,B,G);Fe+=Fn,at+=Fn,I>=S[_].length-2&&(yt&&(Fe+=_e.curve(B,G,B,G,B,ue)+_e.move(B,ue)),at+=_e.curve(B,G,B,G,B,st)+_e.line(qe,st)+"z",ie.push(Fe),Se.push(at),Me=-1)}}Ae=B,ke=G;break;default:var Gn=function(kr,Bn,Sn){var Mn=[];switch(kr){case"stepline":Mn=_e.line(Bn,null,"H")+_e.line(null,Sn,"V");break;case"linestep":Mn=_e.line(null,Sn,"V")+_e.line(Bn,null,"H");break;case"straight":Mn=_e.line(Bn,Sn)}return Mn};if(S[_][I]===null)Me=0;else switch(Me){case 0:if(qe=Ae,Fe=yt?_e.move(Ae,ge[I])+_e.line(Ae,ke):_e.move(Ae,ke),at=_e.move(Ae,ke),S[_][I+1]===null){ie.push(Fe),Se.push(at);break}if(Me=1,I<S[_].length-2){var Sr=Gn($e,B,G);Fe+=Sr,at+=Sr;break}case 1:if(S[_][I+1]===null)Fe+=yt?_e.line(Ae,ue):_e.move(Ae,ke),at+=_e.line(Ae,st)+_e.line(qe,st)+"z",ie.push(Fe),Se.push(at),Me=-1;else{var ur=Gn($e,B,G);Fe+=ur,at+=ur,I>=S[_].length-2&&(yt&&(Fe+=_e.line(B,ue)),at+=_e.line(B,st)+_e.line(qe,st)+"z",ie.push(Fe),Se.push(at),Me=-1)}}Ae=B,ke=G}return{linePaths:ie,areaPaths:Se,pX:Ae,pY:ke,pathState:Me,segmentStartX:qe,linePath:Fe,areaPath:at}}},{key:"handleNullDataPoints",value:function(h,p,S,_,k){var I=this.w;if(h[S][_]===null&&I.config.markers.showNullDataPoints||h[S].length===1){var B=this.strokeWidth-I.config.markers.strokeWidth/2;B>0||(B=0);var G=this.markers.plotChartMarkers(p,k,_+1,B,!0);G!==null&&this.elPointsMain.add(G)}}}]),Ee}();window.TreemapSquared={},window.TreemapSquared.generate=function(){function Ee(B,G,re,ce){this.xoffset=B,this.yoffset=G,this.height=ce,this.width=re,this.shortestEdge=function(){return Math.min(this.height,this.width)},this.getCoordinates=function(ue){var ge,Ae=[],ke=this.xoffset,Me=this.yoffset,qe=k(ue)/this.height,Fe=k(ue)/this.width;if(this.width>=this.height)for(ge=0;ge<ue.length;ge++)Ae.push([ke,Me,ke+qe,Me+ue[ge]/qe]),Me+=ue[ge]/qe;else for(ge=0;ge<ue.length;ge++)Ae.push([ke,Me,ke+ue[ge]/Fe,Me+Fe]),ke+=ue[ge]/Fe;return Ae},this.cutArea=function(ue){var ge;if(this.width>=this.height){var Ae=ue/this.height,ke=this.width-Ae;ge=new Ee(this.xoffset+Ae,this.yoffset,ke,this.height)}else{var Me=ue/this.width,qe=this.height-Me;ge=new Ee(this.xoffset,this.yoffset+Me,this.width,qe)}return ge}}function h(B,G,re,ce,ue){ce=ce===void 0?0:ce,ue=ue===void 0?0:ue;var ge=p(function(Ae,ke){var Me,qe=[],Fe=ke/k(Ae);for(Me=0;Me<Ae.length;Me++)qe[Me]=Ae[Me]*Fe;return qe}(B,G*re),[],new Ee(ce,ue,G,re),[]);return function(Ae){var ke,Me,qe=[];for(ke=0;ke<Ae.length;ke++)for(Me=0;Me<Ae[ke].length;Me++)qe.push(Ae[ke][Me]);return qe}(ge)}function p(B,G,re,ce){var ue,ge,Ae;if(B.length!==0)return ue=re.shortestEdge(),function(ke,Me,qe){var Fe;if(ke.length===0)return!0;(Fe=ke.slice()).push(Me);var at=S(ke,qe),ie=S(Fe,qe);return at>=ie}(G,ge=B[0],ue)?(G.push(ge),p(B.slice(1),G,re,ce)):(Ae=re.cutArea(k(G),ce),ce.push(re.getCoordinates(G)),p(B,[],Ae,ce)),ce;ce.push(re.getCoordinates(G))}function S(B,G){var re=Math.min.apply(Math,B),ce=Math.max.apply(Math,B),ue=k(B);return Math.max(Math.pow(G,2)*ce/Math.pow(ue,2),Math.pow(ue,2)/(Math.pow(G,2)*re))}function _(B){return B&&B.constructor===Array}function k(B){var G,re=0;for(G=0;G<B.length;G++)re+=B[G];return re}function I(B){var G,re=0;if(_(B[0]))for(G=0;G<B.length;G++)re+=I(B[G]);else re=k(B);return re}return function B(G,re,ce,ue,ge){ue=ue===void 0?0:ue,ge=ge===void 0?0:ge;var Ae,ke,Me=[],qe=[];if(_(G[0])){for(ke=0;ke<G.length;ke++)Me[ke]=I(G[ke]);for(Ae=h(Me,re,ce,ue,ge),ke=0;ke<G.length;ke++)qe.push(B(G[ke],Ae[ke][2]-Ae[ke][0],Ae[ke][3]-Ae[ke][1],Ae[ke][0],Ae[ke][1]))}else qe=h(G,re,ce,ue,ge);return qe}}();var bn,Dt,en=function(){function Ee(h,p){s(this,Ee),this.ctx=h,this.w=h.w,this.strokeWidth=this.w.config.stroke.width,this.helpers=new kn(h),this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.labels=[]}return o(Ee,[{key:"draw",value:function(h){var p=this,S=this.w,_=new z(this.ctx),k=new xe(this.ctx),I=_.group({class:"apexcharts-treemap"});if(S.globals.noData)return I;var B=[];return h.forEach(function(G){var re=G.map(function(ce){return Math.abs(ce)});B.push(re)}),this.negRange=this.helpers.checkColorRange(),S.config.series.forEach(function(G,re){G.data.forEach(function(ce){Array.isArray(p.labels[re])||(p.labels[re]=[]),p.labels[re].push(ce.x)})}),window.TreemapSquared.generate(B,S.globals.gridWidth,S.globals.gridHeight).forEach(function(G,re){var ce=_.group({class:"apexcharts-series apexcharts-treemap-series",seriesName:F.escapeString(S.globals.seriesNames[re]),rel:re+1,"data:realIndex":re});if(S.config.chart.dropShadow.enabled){var ue=S.config.chart.dropShadow;new L(p.ctx).dropShadow(I,ue,re)}var ge=_.group({class:"apexcharts-data-labels"});G.forEach(function(Ae,ke){var Me=Ae[0],qe=Ae[1],Fe=Ae[2],at=Ae[3],ie=_.drawRect(Me,qe,Fe-Me,at-qe,S.config.plotOptions.treemap.borderRadius,"#fff",1,p.strokeWidth,S.config.plotOptions.treemap.useFillColorAsStroke?$e:S.globals.stroke.colors[re]);ie.attr({cx:Me,cy:qe,index:re,i:re,j:ke,width:Fe-Me,height:at-qe});var Se=p.helpers.getShadeColor(S.config.chart.type,re,ke,p.negRange),$e=Se.color;S.config.series[re].data[ke]!==void 0&&S.config.series[re].data[ke].fillColor&&($e=S.config.series[re].data[ke].fillColor);var Ue=k.fillPath({color:$e,seriesNumber:re,dataPointIndex:ke});ie.node.classList.add("apexcharts-treemap-rect"),ie.attr({fill:Ue}),p.helpers.addListeners(ie);var _e={x:Me+(Fe-Me)/2,y:qe+(at-qe)/2,width:0,height:0},st={x:Me,y:qe,width:Fe-Me,height:at-qe};if(S.config.chart.animations.enabled&&!S.globals.dataChanged){var ut=1;S.globals.resized||(ut=S.config.chart.animations.speed),p.animateTreemap(ie,_e,st,ut)}if(S.globals.dataChanged){var yt=1;p.dynamicAnim.enabled&&S.globals.shouldAnimate&&(yt=p.dynamicAnim.speed,S.globals.previousPaths[re]&&S.globals.previousPaths[re][ke]&&S.globals.previousPaths[re][ke].rect&&(_e=S.globals.previousPaths[re][ke].rect),p.animateTreemap(ie,_e,st,yt))}var Mt=p.getFontSize(Ae),Kt=S.config.dataLabels.formatter(p.labels[re][ke],{value:S.globals.series[re][ke],seriesIndex:re,dataPointIndex:ke,w:S});S.config.plotOptions.treemap.dataLabels.format==="truncate"&&(Mt=parseInt(S.config.dataLabels.style.fontSize,10),Kt=p.truncateLabels(Kt,Mt,Me,qe,Fe,at));var un=null;S.globals.series[re][ke]&&(un=p.helpers.calculateDataLabels({text:Kt,x:(Me+Fe)/2,y:(qe+at)/2+p.strokeWidth/2+Mt/3,i:re,j:ke,colorProps:Se,fontSize:Mt,series:h})),S.config.dataLabels.enabled&&un&&p.rotateToFitLabel(un,Mt,Kt,Me,qe,Fe,at),ce.add(ie),un!==null&&ce.add(un)}),ce.add(ge),I.add(ce)}),I}},{key:"getFontSize",value:function(h){var p=this.w,S,_,k,I,B=function G(re){var ce,ue=0;if(Array.isArray(re[0]))for(ce=0;ce<re.length;ce++)ue+=G(re[ce]);else for(ce=0;ce<re.length;ce++)ue+=re[ce].length;return ue}(this.labels)/function G(re){var ce,ue=0;if(Array.isArray(re[0]))for(ce=0;ce<re.length;ce++)ue+=G(re[ce]);else for(ce=0;ce<re.length;ce++)ue+=1;return ue}(this.labels);return S=h[2]-h[0],_=h[3]-h[1],k=S*_,I=Math.pow(k,.5),Math.min(I/B,parseInt(p.config.dataLabels.style.fontSize,10))}},{key:"rotateToFitLabel",value:function(h,p,S,_,k,I,B){var G=new z(this.ctx),re=G.getTextRects(S,p);if(re.width+this.w.config.stroke.width+5>I-_&&re.width<=B-k){var ce=G.rotateAroundCenter(h.node);h.node.setAttribute("transform","rotate(-90 ".concat(ce.x," ").concat(ce.y,") translate(").concat(re.height/3,")"))}}},{key:"truncateLabels",value:function(h,p,S,_,k,I){var B=new z(this.ctx),G=B.getTextRects(h,p).width+this.w.config.stroke.width+5>k-S&&I-_>k-S?I-_:k-S,re=B.getTextBasedOnMaxWidth({text:h,maxWidth:G,fontSize:p});return h.length!==re.length&&G/p<5?"":re}},{key:"animateTreemap",value:function(h,p,S,_){var k=new $(this.ctx);k.animateRect(h,{x:p.x,y:p.y,width:p.width,height:p.height},{x:S.x,y:S.y,width:S.width,height:S.height},_,function(){k.animationCompleted(h)})}}]),Ee}(),Pn=86400,tr=10/Pn,ar=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return o(Ee,[{key:"calculateTimeScaleTicks",value:function(h,p){var S=this,_=this.w;if(_.globals.allSeriesCollapsed)return _.globals.labels=[],_.globals.timescaleLabels=[],[];var k=new K(this.ctx),I=(p-h)/864e5;this.determineInterval(I),_.globals.disableZoomIn=!1,_.globals.disableZoomOut=!1,I<tr?_.globals.disableZoomIn=!0:I>5e4&&(_.globals.disableZoomOut=!0);var B=k.getTimeUnitsfromTimestamp(h,p,this.utc),G=_.globals.gridWidth/I,re=G/24,ce=re/60,ue=ce/60,ge=Math.floor(24*I),Ae=Math.floor(1440*I),ke=Math.floor(I*Pn),Me=Math.floor(I),qe=Math.floor(I/30),Fe=Math.floor(I/365),at={minMillisecond:B.minMillisecond,minSecond:B.minSecond,minMinute:B.minMinute,minHour:B.minHour,minDate:B.minDate,minMonth:B.minMonth,minYear:B.minYear},ie={firstVal:at,currentMillisecond:at.minMillisecond,currentSecond:at.minSecond,currentMinute:at.minMinute,currentHour:at.minHour,currentMonthDate:at.minDate,currentDate:at.minDate,currentMonth:at.minMonth,currentYear:at.minYear,daysWidthOnXAxis:G,hoursWidthOnXAxis:re,minutesWidthOnXAxis:ce,secondsWidthOnXAxis:ue,numberOfSeconds:ke,numberOfMinutes:Ae,numberOfHours:ge,numberOfDays:Me,numberOfMonths:qe,numberOfYears:Fe};switch(this.tickInterval){case"years":this.generateYearScale(ie);break;case"months":case"half_year":this.generateMonthScale(ie);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(ie);break;case"hours":this.generateHourScale(ie);break;case"minutes_fives":case"minutes":this.generateMinuteScale(ie);break;case"seconds_tens":case"seconds_fives":case"seconds":this.generateSecondScale(ie)}var Se=this.timeScaleArray.map(function($e){var Ue={position:$e.position,unit:$e.unit,year:$e.year,day:$e.day?$e.day:1,hour:$e.hour?$e.hour:0,month:$e.month+1};return $e.unit==="month"?y(y({},Ue),{},{day:1,value:$e.value+1}):$e.unit==="day"||$e.unit==="hour"?y(y({},Ue),{},{value:$e.value}):$e.unit==="minute"?y(y({},Ue),{},{value:$e.value,minute:$e.value}):$e.unit==="second"?y(y({},Ue),{},{value:$e.value,minute:$e.minute,second:$e.second}):$e});return Se.filter(function($e){var Ue=1,_e=Math.ceil(_.globals.gridWidth/120),st=$e.value;_.config.xaxis.tickAmount!==void 0&&(_e=_.config.xaxis.tickAmount),Se.length>_e&&(Ue=Math.floor(Se.length/_e));var ut=!1,yt=!1;switch(S.tickInterval){case"years":$e.unit==="year"&&(ut=!0);break;case"half_year":Ue=7,$e.unit==="year"&&(ut=!0);break;case"months":Ue=1,$e.unit==="year"&&(ut=!0);break;case"months_fortnight":Ue=15,$e.unit!=="year"&&$e.unit!=="month"||(ut=!0),st===30&&(yt=!0);break;case"months_days":Ue=10,$e.unit==="month"&&(ut=!0),st===30&&(yt=!0);break;case"week_days":Ue=8,$e.unit==="month"&&(ut=!0);break;case"days":Ue=1,$e.unit==="month"&&(ut=!0);break;case"hours":$e.unit==="day"&&(ut=!0);break;case"minutes_fives":case"seconds_fives":st%5!=0&&(yt=!0);break;case"seconds_tens":st%10!=0&&(yt=!0)}if(S.tickInterval==="hours"||S.tickInterval==="minutes_fives"||S.tickInterval==="seconds_tens"||S.tickInterval==="seconds_fives"){if(!yt)return!0}else if((st%Ue==0||ut)&&!yt)return!0})}},{key:"recalcDimensionsBasedOnFormat",value:function(h,p){var S=this.w,_=this.formatDates(h),k=this.removeOverlappingTS(_);S.globals.timescaleLabels=k.slice(),new Je(this.ctx).plotCoords()}},{key:"determineInterval",value:function(h){var p=24*h,S=60*p;switch(!0){case h/365>5:this.tickInterval="years";break;case h>800:this.tickInterval="half_year";break;case h>180:this.tickInterval="months";break;case h>90:this.tickInterval="months_fortnight";break;case h>60:this.tickInterval="months_days";break;case h>30:this.tickInterval="week_days";break;case h>2:this.tickInterval="days";break;case p>2.4:this.tickInterval="hours";break;case S>15:this.tickInterval="minutes_fives";break;case S>5:this.tickInterval="minutes";break;case S>1:this.tickInterval="seconds_tens";break;case 60*S>20:this.tickInterval="seconds_fives";break;default:this.tickInterval="seconds"}}},{key:"generateYearScale",value:function(h){var p=h.firstVal,S=h.currentMonth,_=h.currentYear,k=h.daysWidthOnXAxis,I=h.numberOfYears,B=p.minYear,G=0,re=new K(this.ctx),ce="year";if(p.minDate>1||p.minMonth>0){var ue=re.determineRemainingDaysOfYear(p.minYear,p.minMonth,p.minDate);G=(re.determineDaysOfYear(p.minYear)-ue+1)*k,B=p.minYear+1,this.timeScaleArray.push({position:G,value:B,unit:ce,year:B,month:F.monthMod(S+1)})}else p.minDate===1&&p.minMonth===0&&this.timeScaleArray.push({position:G,value:B,unit:ce,year:_,month:F.monthMod(S+1)});for(var ge=B,Ae=G,ke=0;ke<I;ke++)ge++,Ae=re.determineDaysOfYear(ge-1)*k+Ae,this.timeScaleArray.push({position:Ae,value:ge,unit:ce,year:ge,month:1})}},{key:"generateMonthScale",value:function(h){var p=h.firstVal,S=h.currentMonthDate,_=h.currentMonth,k=h.currentYear,I=h.daysWidthOnXAxis,B=h.numberOfMonths,G=_,re=0,ce=new K(this.ctx),ue="month",ge=0;if(p.minDate>1){re=(ce.determineDaysOfMonths(_+1,p.minYear)-S+1)*I,G=F.monthMod(_+1);var Ae=k+ge,ke=F.monthMod(G),Me=G;G===0&&(ue="year",Me=Ae,ke=1,Ae+=ge+=1),this.timeScaleArray.push({position:re,value:Me,unit:ue,year:Ae,month:ke})}else this.timeScaleArray.push({position:re,value:G,unit:ue,year:k,month:F.monthMod(_)});for(var qe=G+1,Fe=re,at=0,ie=1;at<B;at++,ie++){(qe=F.monthMod(qe))===0?(ue="year",ge+=1):ue="month";var Se=this._getYear(k,qe,ge);Fe=ce.determineDaysOfMonths(qe,Se)*I+Fe;var $e=qe===0?Se:qe;this.timeScaleArray.push({position:Fe,value:$e,unit:ue,year:Se,month:qe===0?1:qe}),qe++}}},{key:"generateDayScale",value:function(h){var p=h.firstVal,S=h.currentMonth,_=h.currentYear,k=h.hoursWidthOnXAxis,I=h.numberOfDays,B=new K(this.ctx),G="day",re=p.minDate+1,ce=re,ue=function(ie,Se,$e){return ie>B.determineDaysOfMonths(Se+1,$e)&&(ce=1,G="month",Ae=Se+=1),Se},ge=(24-p.minHour)*k,Ae=re,ke=ue(ce,S,_);p.minHour===0&&p.minDate===1?(ge=0,Ae=F.monthMod(p.minMonth),G="month",ce=p.minDate):p.minDate!==1&&p.minHour===0&&p.minMinute===0&&(ge=0,re=p.minDate,Ae=re,ke=ue(ce=re,S,_)),this.timeScaleArray.push({position:ge,value:Ae,unit:G,year:this._getYear(_,ke,0),month:F.monthMod(ke),day:ce});for(var Me=ge,qe=0;qe<I;qe++){G="day",ke=ue(ce+=1,ke,this._getYear(_,ke,0));var Fe=this._getYear(_,ke,0);Me=24*k+Me;var at=ce===1?F.monthMod(ke):ce;this.timeScaleArray.push({position:Me,value:at,unit:G,year:Fe,month:F.monthMod(ke),day:at})}}},{key:"generateHourScale",value:function(h){var p=h.firstVal,S=h.currentDate,_=h.currentMonth,k=h.currentYear,I=h.minutesWidthOnXAxis,B=h.numberOfHours,G=new K(this.ctx),re="hour",ce=function(Ue,_e){return Ue>G.determineDaysOfMonths(_e+1,k)&&(qe=1,_e+=1),{month:_e,date:qe}},ue=function(Ue,_e){return Ue>G.determineDaysOfMonths(_e+1,k)?_e+=1:_e},ge=60-(p.minMinute+p.minSecond/60),Ae=ge*I,ke=p.minHour+1,Me=ke;ge===60&&(Ae=0,Me=ke=p.minHour);var qe=S;Me>=24&&(Me=0,qe+=1,re="day");var Fe=ce(qe,_).month;Fe=ue(qe,Fe),this.timeScaleArray.push({position:Ae,value:ke,unit:re,day:qe,hour:Me,year:k,month:F.monthMod(Fe)}),Me++;for(var at=Ae,ie=0;ie<B;ie++){re="hour",Me>=24&&(Me=0,re="day",Fe=ce(qe+=1,Fe).month,Fe=ue(qe,Fe));var Se=this._getYear(k,Fe,0);at=60*I+at;var $e=Me===0?qe:Me;this.timeScaleArray.push({position:at,value:$e,unit:re,hour:Me,day:qe,year:Se,month:F.monthMod(Fe)}),Me++}}},{key:"generateMinuteScale",value:function(h){for(var p=h.currentMillisecond,S=h.currentSecond,_=h.currentMinute,k=h.currentHour,I=h.currentDate,B=h.currentMonth,G=h.currentYear,re=h.minutesWidthOnXAxis,ce=h.secondsWidthOnXAxis,ue=h.numberOfMinutes,ge=_+1,Ae=I,ke=B,Me=G,qe=k,Fe=(60-S-p/1e3)*ce,at=0;at<ue;at++)ge>=60&&(ge=0,(qe+=1)===24&&(qe=0)),this.timeScaleArray.push({position:Fe,value:ge,unit:"minute",hour:qe,minute:ge,day:Ae,year:this._getYear(Me,ke,0),month:F.monthMod(ke)}),Fe+=re,ge++}},{key:"generateSecondScale",value:function(h){for(var p=h.currentMillisecond,S=h.currentSecond,_=h.currentMinute,k=h.currentHour,I=h.currentDate,B=h.currentMonth,G=h.currentYear,re=h.secondsWidthOnXAxis,ce=h.numberOfSeconds,ue=S+1,ge=_,Ae=I,ke=B,Me=G,qe=k,Fe=(1e3-p)/1e3*re,at=0;at<ce;at++)ue>=60&&(ue=0,++ge>=60&&(ge=0,++qe===24&&(qe=0))),this.timeScaleArray.push({position:Fe,value:ue,unit:"second",hour:qe,minute:ge,second:ue,day:Ae,year:this._getYear(Me,ke,0),month:F.monthMod(ke)}),Fe+=re,ue++}},{key:"createRawDateString",value:function(h,p){var S=h.year;return h.month===0&&(h.month=1),S+="-"+("0"+h.month.toString()).slice(-2),h.unit==="day"?S+=h.unit==="day"?"-"+("0"+p).slice(-2):"-01":S+="-"+("0"+(h.day?h.day:"1")).slice(-2),h.unit==="hour"?S+=h.unit==="hour"?"T"+("0"+p).slice(-2):"T00":S+="T"+("0"+(h.hour?h.hour:"0")).slice(-2),h.unit==="minute"?S+=":"+("0"+p).slice(-2):S+=":"+(h.minute?("0"+h.minute).slice(-2):"00"),h.unit==="second"?S+=":"+("0"+p).slice(-2):S+=":00",this.utc&&(S+=".000Z"),S}},{key:"formatDates",value:function(h){var p=this,S=this.w;return h.map(function(_){var k=_.value.toString(),I=new K(p.ctx),B=p.createRawDateString(_,k),G=I.getDate(I.parseDate(B));if(p.utc||(G=I.getDate(I.parseDateWithTimezone(B))),S.config.xaxis.labels.format===void 0){var re="dd MMM",ce=S.config.xaxis.labels.datetimeFormatter;_.unit==="year"&&(re=ce.year),_.unit==="month"&&(re=ce.month),_.unit==="day"&&(re=ce.day),_.unit==="hour"&&(re=ce.hour),_.unit==="minute"&&(re=ce.minute),_.unit==="second"&&(re=ce.second),k=I.formatDate(G,re)}else k=I.formatDate(G,S.config.xaxis.labels.format);return{dateString:B,position:_.position,value:k,unit:_.unit,year:_.year,month:_.month}})}},{key:"removeOverlappingTS",value:function(h){var p,S=this,_=new z(this.ctx),k=!1;h.length>0&&h[0].value&&h.every(function(G){return G.value.length===h[0].value.length})&&(k=!0,p=_.getTextRects(h[0].value).width);var I=0,B=h.map(function(G,re){if(re>0&&S.w.config.xaxis.labels.hideOverlappingLabels){var ce=k?p:_.getTextRects(h[I].value).width,ue=h[I].position;return G.position>ue+ce+10?(I=re,G):null}return G});return B=B.filter(function(G){return G!==null})}},{key:"_getYear",value:function(h,p,S){return h+Math.floor(p/12)+S}}]),Ee}(),hr=function(){function Ee(h,p){s(this,Ee),this.ctx=p,this.w=p.w,this.el=h}return o(Ee,[{key:"setupElements",value:function(){var h=this.w,p=h.globals,S=h.config,_=S.chart.type;p.axisCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble","radar","heatmap","treemap"].includes(_),p.xyCharts=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","scatter","bubble"].includes(_),p.isBarHorizontal=["bar","rangeBar","boxPlot"].includes(_)&&S.plotOptions.bar.horizontal,p.chartClass=".apexcharts".concat(p.chartID),p.dom.baseEl=this.el,p.dom.elWrap=document.createElement("div"),z.setAttrs(p.dom.elWrap,{id:p.chartClass.substring(1),class:"apexcharts-canvas ".concat(p.chartClass.substring(1))}),this.el.appendChild(p.dom.elWrap),p.dom.Paper=new window.SVG.Doc(p.dom.elWrap),p.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(S.chart.offsetX,", ").concat(S.chart.offsetY,")")}),p.dom.Paper.node.style.background=S.theme.mode!=="dark"||S.chart.background?S.theme.mode!=="light"||S.chart.background?S.chart.background:"#fff":"#424242",this.setSVGDimensions(),p.dom.elLegendForeign=document.createElementNS(p.SVGNS,"foreignObject"),z.setAttrs(p.dom.elLegendForeign,{x:0,y:0,width:p.svgWidth,height:p.svgHeight}),p.dom.elLegendWrap=document.createElement("div"),p.dom.elLegendWrap.classList.add("apexcharts-legend"),p.dom.elLegendWrap.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),p.dom.elLegendForeign.appendChild(p.dom.elLegendWrap),p.dom.Paper.node.appendChild(p.dom.elLegendForeign),p.dom.elGraphical=p.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),p.dom.elDefs=p.dom.Paper.defs(),p.dom.Paper.add(p.dom.elGraphical),p.dom.elGraphical.add(p.dom.elDefs)}},{key:"plotChartType",value:function(h,p){var S=this.w,_=this.ctx,k=S.config,I=S.globals,B={line:{series:[],i:[]},area:{series:[],i:[]},scatter:{series:[],i:[]},bubble:{series:[],i:[]},column:{series:[],i:[]},candlestick:{series:[],i:[]},boxPlot:{series:[],i:[]},rangeBar:{series:[],i:[]},rangeArea:{series:[],seriesRangeEnd:[],i:[]}},G=k.chart.type||"line",re=null,ce=0;I.series.forEach(function(Ue,_e){var st=h[_e].type||G;B[st]?(st==="rangeArea"?(B[st].series.push(I.seriesRangeStart[_e]),B[st].seriesRangeEnd.push(I.seriesRangeEnd[_e])):B[st].series.push(Ue),B[st].i.push(_e),st!=="column"&&st!=="bar"||(S.globals.columnSeries=B.column)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(st)?re=st:st==="bar"?(B.column.series.push(Ue),B.column.i.push(_e)):console.warn("You have specified an unrecognized series type (".concat(st,").")),G!==st&&st!=="scatter"&&ce++}),ce>0&&(re&&console.warn("Chart or series type ".concat(re," cannot appear with other chart or series types.")),B.column.series.length>0&&k.plotOptions.bar.horizontal&&(ce-=B.column.series.length,B.column={series:[],i:[]},S.globals.columnSeries={series:[],i:[]},console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"))),I.comboCharts||(I.comboCharts=ce>0);var ue=new Qn(_,p),ge=new An(_,p);_.pie=new Kn(_);var Ae=new Xn(_);_.rangeBar=new Nn(_,p);var ke=new Dn(_),Me=[];if(I.comboCharts){var qe,Fe,at=new X(_);if(B.area.series.length>0&&(qe=Me).push.apply(qe,N(at.drawSeriesByGroup(B.area,I.areaGroups,"area",ue))),B.column.series.length>0)if(k.chart.stacked){var ie=new gn(_,p);Me.push(ie.draw(B.column.series,B.column.i))}else _.bar=new rn(_,p),Me.push(_.bar.draw(B.column.series,B.column.i));if(B.rangeArea.series.length>0&&Me.push(ue.draw(B.rangeArea.series,"rangeArea",B.rangeArea.i,B.rangeArea.seriesRangeEnd)),B.line.series.length>0&&(Fe=Me).push.apply(Fe,N(at.drawSeriesByGroup(B.line,I.lineGroups,"line",ue))),B.candlestick.series.length>0&&Me.push(ge.draw(B.candlestick.series,"candlestick",B.candlestick.i)),B.boxPlot.series.length>0&&Me.push(ge.draw(B.boxPlot.series,"boxPlot",B.boxPlot.i)),B.rangeBar.series.length>0&&Me.push(_.rangeBar.draw(B.rangeBar.series,B.rangeBar.i)),B.scatter.series.length>0){var Se=new Qn(_,p,!0);Me.push(Se.draw(B.scatter.series,"scatter",B.scatter.i))}if(B.bubble.series.length>0){var $e=new Qn(_,p,!0);Me.push($e.draw(B.bubble.series,"bubble",B.bubble.i))}}else switch(k.chart.type){case"line":Me=ue.draw(I.series,"line");break;case"area":Me=ue.draw(I.series,"area");break;case"bar":k.chart.stacked?Me=new gn(_,p).draw(I.series):(_.bar=new rn(_,p),Me=_.bar.draw(I.series));break;case"candlestick":Me=new An(_,p).draw(I.series,"candlestick");break;case"boxPlot":Me=new An(_,p).draw(I.series,k.chart.type);break;case"rangeBar":Me=_.rangeBar.draw(I.series);break;case"rangeArea":Me=ue.draw(I.seriesRangeStart,"rangeArea",void 0,I.seriesRangeEnd);break;case"heatmap":Me=new yn(_,p).draw(I.series);break;case"treemap":Me=new en(_,p).draw(I.series);break;case"pie":case"donut":case"polarArea":Me=_.pie.draw(I.series);break;case"radialBar":Me=Ae.draw(I.series);break;case"radar":Me=ke.draw(I.series);break;default:Me=ue.draw(I.series)}return Me}},{key:"setSVGDimensions",value:function(){var h=this.w,p=h.globals,S=h.config;S.chart.width=S.chart.width||"100%",S.chart.height=S.chart.height||"auto",p.svgWidth=S.chart.width,p.svgHeight=S.chart.height;var _=F.getDimensions(this.el),k=S.chart.width.toString().split(/[0-9]+/g).pop();k==="%"?F.isNumber(_[0])&&(_[0].width===0&&(_=F.getDimensions(this.el.parentNode)),p.svgWidth=_[0]*parseInt(S.chart.width,10)/100):k!=="px"&&k!==""||(p.svgWidth=parseInt(S.chart.width,10));var I=String(S.chart.height).toString().split(/[0-9]+/g).pop();if(p.svgHeight!=="auto"&&p.svgHeight!=="")if(I==="%"){var B=F.getDimensions(this.el.parentNode);p.svgHeight=B[1]*parseInt(S.chart.height,10)/100}else p.svgHeight=parseInt(S.chart.height,10);else p.svgHeight=p.axisCharts?p.svgWidth/1.61:p.svgWidth/1.2;if(p.svgWidth=Math.max(p.svgWidth,0),p.svgHeight=Math.max(p.svgHeight,0),z.setAttrs(p.dom.Paper.node,{width:p.svgWidth,height:p.svgHeight}),I!=="%"){var G=S.chart.sparkline.enabled?0:p.axisCharts?S.chart.parentHeightOffset:0;p.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(p.svgHeight+G,"px")}p.dom.elWrap.style.width="".concat(p.svgWidth,"px"),p.dom.elWrap.style.height="".concat(p.svgHeight,"px")}},{key:"shiftGraphPosition",value:function(){var h=this.w.globals,p=h.translateY,S=h.translateX;z.setAttrs(h.dom.elGraphical.node,{transform:"translate(".concat(S,", ").concat(p,")")})}},{key:"resizeNonAxisCharts",value:function(){var h=this.w,p=h.globals,S=0,_=h.config.chart.sparkline.enabled?1:15;_+=h.config.grid.padding.bottom,["top","bottom"].includes(h.config.legend.position)&&h.config.legend.show&&!h.config.legend.floating&&(S=new hn(this.ctx).legendHelpers.getLegendDimensions().clwh+7);var k=h.globals.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie"),I=2.05*h.globals.radialSize;if(k&&!h.config.chart.sparkline.enabled&&h.config.plotOptions.radialBar.startAngle!==0){var B=F.getBoundingClientRect(k);I=B.bottom;var G=B.bottom-B.top;I=Math.max(2.05*h.globals.radialSize,G)}var re=Math.ceil(I+p.translateY+S+_);p.dom.elLegendForeign&&p.dom.elLegendForeign.setAttribute("height",re),h.config.chart.height&&String(h.config.chart.height).includes("%")||(p.dom.elWrap.style.height="".concat(re,"px"),z.setAttrs(p.dom.Paper.node,{height:re}),p.dom.Paper.node.parentNode.parentNode.style.minHeight="".concat(re,"px"))}},{key:"coreCalculations",value:function(){new Le(this.ctx).init()}},{key:"resetGlobals",value:function(){var h=this,p=function(){return h.w.config.series.map(function(){return[]})},S=new me,_=this.w.globals;S.initGlobalVars(_),_.seriesXvalues=p(),_.seriesYvalues=p()}},{key:"isMultipleY",value:function(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}},{key:"xySettings",value:function(){var h=this.w,p=null;if(h.globals.axisCharts){if(h.config.xaxis.crosshairs.position==="back"&&new wt(this.ctx).drawXCrosshairs(),h.config.yaxis[0].crosshairs.position==="back"&&new wt(this.ctx).drawYCrosshairs(),h.config.xaxis.type==="datetime"&&h.config.xaxis.labels.formatter===void 0){this.ctx.timeScale=new ar(this.ctx);var S=[];isFinite(h.globals.minX)&&isFinite(h.globals.maxX)&&!h.globals.isBarHorizontal?S=this.ctx.timeScale.calculateTimeScaleTicks(h.globals.minX,h.globals.maxX):h.globals.isBarHorizontal&&(S=this.ctx.timeScale.calculateTimeScaleTicks(h.globals.minY,h.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(S)}p=new X(this.ctx).getCalculatedRatios()}return p}},{key:"updateSourceChart",value:function(h){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:h.w.globals.minX,max:h.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var h=this,p=this.w;if(p.config.chart.brush.enabled&&typeof p.config.chart.events.selection!="function"){var S=Array.isArray(p.config.chart.brush.targets)?p.config.chart.brush.targets:[p.config.chart.brush.target];S.forEach(function(_){var k=ApexCharts.getChartByID(_);k.w.globals.brushSource=h.ctx,typeof k.w.config.chart.events.zoomed!="function"&&(k.w.config.chart.events.zoomed=function(){return h.updateSourceChart(k)}),typeof k.w.config.chart.events.scrolled!="function"&&(k.w.config.chart.events.scrolled=function(){return h.updateSourceChart(k)})}),p.config.chart.events.selection=function(_,k){S.forEach(function(I){ApexCharts.getChartByID(I).ctx.updateHelpers._updateOptions({xaxis:{min:k.xaxis.min,max:k.xaxis.max}},!1,!1,!1,!1)})}}}}]),Ee}(),qt=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"_updateOptions",value:function(h){var p=this,S=arguments.length>1&&arguments[1]!==void 0&&arguments[1],_=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],I=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return new Promise(function(B){var G=[p.ctx];k&&(G=p.ctx.getSyncedCharts()),p.ctx.w.globals.isExecCalled&&(G=[p.ctx],p.ctx.w.globals.isExecCalled=!1),G.forEach(function(re,ce){var ue=re.w;if(ue.globals.shouldAnimate=_,S||(ue.globals.resized=!0,ue.globals.dataChanged=!0,_&&re.series.getPreviousPaths()),h&&T(h)==="object"&&(re.config=new Ce(h),h=X.extendArrayProps(re.config,h,ue),re.w.globals.chartID!==p.ctx.w.globals.chartID&&delete h.series,ue.config=F.extend(ue.config,h),I&&(ue.globals.lastXAxis=h.xaxis?F.clone(h.xaxis):[],ue.globals.lastYAxis=h.yaxis?F.clone(h.yaxis):[],ue.globals.initialConfig=F.extend({},ue.config),ue.globals.initialSeries=F.clone(ue.config.series),h.series))){for(var ge=0;ge<ue.globals.collapsedSeriesIndices.length;ge++){var Ae=ue.config.series[ue.globals.collapsedSeriesIndices[ge]];ue.globals.collapsedSeries[ge].data=ue.globals.axisCharts?Ae.data.slice():Ae}for(var ke=0;ke<ue.globals.ancillaryCollapsedSeriesIndices.length;ke++){var Me=ue.config.series[ue.globals.ancillaryCollapsedSeriesIndices[ke]];ue.globals.ancillaryCollapsedSeries[ke].data=ue.globals.axisCharts?Me.data.slice():Me}re.series.emptyCollapsedSeries(ue.config.series)}return re.update(h).then(function(){ce===G.length-1&&B(re)})})})}},{key:"_updateSeries",value:function(h,p){var S=this,_=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return new Promise(function(k){var I,B=S.w;return B.globals.shouldAnimate=p,B.globals.dataChanged=!0,p&&S.ctx.series.getPreviousPaths(),B.globals.axisCharts?((I=h.map(function(G,re){return S._extendSeries(G,re)})).length===0&&(I=[{data:[]}]),B.config.series=I):B.config.series=h.slice(),_&&(B.globals.initialConfig.series=F.clone(B.config.series),B.globals.initialSeries=F.clone(B.config.series)),S.ctx.update().then(function(){k(S.ctx)})})}},{key:"_extendSeries",value:function(h,p){var S=this.w,_=S.config.series[p];return y(y({},S.config.series[p]),{},{name:h.name?h.name:_==null?void 0:_.name,color:h.color?h.color:_==null?void 0:_.color,type:h.type?h.type:_==null?void 0:_.type,group:h.group?h.group:_==null?void 0:_.group,hidden:h.hidden!==void 0?h.hidden:_==null?void 0:_.hidden,data:h.data?h.data:_==null?void 0:_.data,zIndex:h.zIndex!==void 0?h.zIndex:p})}},{key:"toggleDataPointSelection",value:function(h,p){var S=this.w,_=null,k=".apexcharts-series[data\\:realIndex='".concat(h,"']");return S.globals.axisCharts?_=S.globals.dom.Paper.select("".concat(k," path[j='").concat(p,"'], ").concat(k," circle[j='").concat(p,"'], ").concat(k," rect[j='").concat(p,"']")).members[0]:p===void 0&&(_=S.globals.dom.Paper.select("".concat(k," path[j='").concat(h,"']")).members[0],S.config.chart.type!=="pie"&&S.config.chart.type!=="polarArea"&&S.config.chart.type!=="donut"||this.ctx.pie.pieClicked(h)),_?(new z(this.ctx).pathMouseDown(_,null),_.node?_.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(h){var p=this.w;if(["min","max"].forEach(function(_){h.xaxis[_]!==void 0&&(p.config.xaxis[_]=h.xaxis[_],p.globals.lastXAxis[_]=h.xaxis[_])}),h.xaxis.categories&&h.xaxis.categories.length&&(p.config.xaxis.categories=h.xaxis.categories),p.config.xaxis.convertedCatToNumeric){var S=new de(h);h=S.convertCatToNumericXaxis(h,this.ctx)}return h}},{key:"forceYAxisUpdate",value:function(h){return h.chart&&h.chart.stacked&&h.chart.stackType==="100%"&&(Array.isArray(h.yaxis)?h.yaxis.forEach(function(p,S){h.yaxis[S].min=0,h.yaxis[S].max=100}):(h.yaxis.min=0,h.yaxis.max=100)),h}},{key:"revertDefaultAxisMinMax",value:function(h){var p=this,S=this.w,_=S.globals.lastXAxis,k=S.globals.lastYAxis;h&&h.xaxis&&(_=h.xaxis),h&&h.yaxis&&(k=h.yaxis),S.config.xaxis.min=_.min,S.config.xaxis.max=_.max;var I=function(B){k[B]!==void 0&&(S.config.yaxis[B].min=k[B].min,S.config.yaxis[B].max=k[B].max)};S.config.yaxis.map(function(B,G){S.globals.zoomed||k[G]!==void 0?I(G):p.ctx.opts.yaxis[G]!==void 0&&(B.min=p.ctx.opts.yaxis[G].min,B.max=p.ctx.opts.yaxis[G].max)})}}]),Ee}();bn=typeof window<"u"?window:void 0,Dt=function(Ee,h){var p=(this!==void 0?this:Ee).SVG=function(ie){if(p.supported)return ie=new p.Doc(ie),p.parser.draw||p.prepare(),ie};if(p.ns="http://www.w3.org/2000/svg",p.xmlns="http://www.w3.org/2000/xmlns/",p.xlink="http://www.w3.org/1999/xlink",p.svgjs="http://svgjs.dev",p.supported=!0,!p.supported)return!1;p.did=1e3,p.eid=function(ie){return"Svgjs"+ce(ie)+p.did++},p.create=function(ie){var Se=h.createElementNS(this.ns,ie);return Se.setAttribute("id",this.eid(ie)),Se},p.extend=function(){var ie,Se;Se=(ie=[].slice.call(arguments)).pop();for(var $e=ie.length-1;$e>=0;$e--)if(ie[$e])for(var Ue in Se)ie[$e].prototype[Ue]=Se[Ue];p.Set&&p.Set.inherit&&p.Set.inherit()},p.invent=function(ie){var Se=typeof ie.create=="function"?ie.create:function(){this.constructor.call(this,p.create(ie.create))};return ie.inherit&&(Se.prototype=new ie.inherit),ie.extend&&p.extend(Se,ie.extend),ie.construct&&p.extend(ie.parent||p.Container,ie.construct),Se},p.adopt=function(ie){return ie?ie.instance?ie.instance:((Se=ie.nodeName=="svg"?ie.parentNode instanceof Ee.SVGElement?new p.Nested:new p.Doc:ie.nodeName=="linearGradient"?new p.Gradient("linear"):ie.nodeName=="radialGradient"?new p.Gradient("radial"):p[ce(ie.nodeName)]?new p[ce(ie.nodeName)]:new p.Element(ie)).type=ie.nodeName,Se.node=ie,ie.instance=Se,Se instanceof p.Doc&&Se.namespace().defs(),Se.setData(JSON.parse(ie.getAttribute("svgjs:data"))||{}),Se):null;var Se},p.prepare=function(){var ie=h.getElementsByTagName("body")[0],Se=(ie?new p.Doc(ie):p.adopt(h.documentElement).nested()).size(2,0);p.parser={body:ie||h.documentElement,draw:Se.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node,poly:Se.polyline().node,path:Se.path().node,native:p.create("svg")}},p.parser={native:p.create("svg")},h.addEventListener("DOMContentLoaded",function(){p.parser.draw||p.prepare()},!1),p.regex={numberAndUnit:/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,transforms:/\)\s*,?\s*/,whitespace:/\s/g,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,isPercent:/^-?[\d\.]+%$/,isImage:/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,delimiter:/[\s,]+/,hyphen:/([^e])\-/gi,pathLetters:/[MLHVCSQTAZ]/gi,isPathLetter:/[MLHVCSQTAZ]/i,numbersWithDots:/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,dots:/\./g},p.utils={map:function(ie,Se){for(var $e=ie.length,Ue=[],_e=0;_e<$e;_e++)Ue.push(Se(ie[_e]));return Ue},filter:function(ie,Se){for(var $e=ie.length,Ue=[],_e=0;_e<$e;_e++)Se(ie[_e])&&Ue.push(ie[_e]);return Ue},filterSVGElements:function(ie){return this.filter(ie,function(Se){return Se instanceof Ee.SVGElement})}},p.defaults={attrs:{"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"}},p.Color=function(ie){var Se,$e;this.r=0,this.g=0,this.b=0,ie&&(typeof ie=="string"?p.regex.isRgb.test(ie)?(Se=p.regex.rgb.exec(ie.replace(p.regex.whitespace,"")),this.r=parseInt(Se[1]),this.g=parseInt(Se[2]),this.b=parseInt(Se[3])):p.regex.isHex.test(ie)&&(Se=p.regex.hex.exec(($e=ie).length==4?["#",$e.substring(1,2),$e.substring(1,2),$e.substring(2,3),$e.substring(2,3),$e.substring(3,4),$e.substring(3,4)].join(""):$e),this.r=parseInt(Se[1],16),this.g=parseInt(Se[2],16),this.b=parseInt(Se[3],16)):T(ie)==="object"&&(this.r=ie.r,this.g=ie.g,this.b=ie.b))},p.extend(p.Color,{toString:function(){return this.toHex()},toHex:function(){return"#"+ue(this.r)+ue(this.g)+ue(this.b)},toRgb:function(){return"rgb("+[this.r,this.g,this.b].join()+")"},brightness:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11},morph:function(ie){return this.destination=new p.Color(ie),this},at:function(ie){return this.destination?(ie=ie<0?0:ie>1?1:ie,new p.Color({r:~~(this.r+(this.destination.r-this.r)*ie),g:~~(this.g+(this.destination.g-this.g)*ie),b:~~(this.b+(this.destination.b-this.b)*ie)})):this}}),p.Color.test=function(ie){return ie+="",p.regex.isHex.test(ie)||p.regex.isRgb.test(ie)},p.Color.isRgb=function(ie){return ie&&typeof ie.r=="number"&&typeof ie.g=="number"&&typeof ie.b=="number"},p.Color.isColor=function(ie){return p.Color.isRgb(ie)||p.Color.test(ie)},p.Array=function(ie,Se){(ie=(ie||[]).valueOf()).length==0&&Se&&(ie=Se.valueOf()),this.value=this.parse(ie)},p.extend(p.Array,{toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(ie){return ie=ie.valueOf(),Array.isArray(ie)?ie:this.split(ie)}}),p.PointArray=function(ie,Se){p.Array.call(this,ie,Se||[[0,0]])},p.PointArray.prototype=new p.Array,p.PointArray.prototype.constructor=p.PointArray;for(var S={M:function(ie,Se,$e){return Se.x=$e.x=ie[0],Se.y=$e.y=ie[1],["M",Se.x,Se.y]},L:function(ie,Se){return Se.x=ie[0],Se.y=ie[1],["L",ie[0],ie[1]]},H:function(ie,Se){return Se.x=ie[0],["H",ie[0]]},V:function(ie,Se){return Se.y=ie[0],["V",ie[0]]},C:function(ie,Se){return Se.x=ie[4],Se.y=ie[5],["C",ie[0],ie[1],ie[2],ie[3],ie[4],ie[5]]},Q:function(ie,Se){return Se.x=ie[2],Se.y=ie[3],["Q",ie[0],ie[1],ie[2],ie[3]]},S:function(ie,Se){return Se.x=ie[2],Se.y=ie[3],["S",ie[0],ie[1],ie[2],ie[3]]},Z:function(ie,Se,$e){return Se.x=$e.x,Se.y=$e.y,["Z"]}},_="mlhvqtcsaz".split(""),k=0,I=_.length;k<I;++k)S[_[k]]=function(ie){return function(Se,$e,Ue){if(ie=="H")Se[0]=Se[0]+$e.x;else if(ie=="V")Se[0]=Se[0]+$e.y;else if(ie=="A")Se[5]=Se[5]+$e.x,Se[6]=Se[6]+$e.y;else for(var _e=0,st=Se.length;_e<st;++_e)Se[_e]=Se[_e]+(_e%2?$e.y:$e.x);if(S&&typeof S[ie]=="function")return S[ie](Se,$e,Ue)}}(_[k].toUpperCase());p.PathArray=function(ie,Se){p.Array.call(this,ie,Se||[["M",0,0]])},p.PathArray.prototype=new p.Array,p.PathArray.prototype.constructor=p.PathArray,p.extend(p.PathArray,{toString:function(){return function(ie){for(var Se=0,$e=ie.length,Ue="";Se<$e;Se++)Ue+=ie[Se][0],ie[Se][1]!=null&&(Ue+=ie[Se][1],ie[Se][2]!=null&&(Ue+=" ",Ue+=ie[Se][2],ie[Se][3]!=null&&(Ue+=" ",Ue+=ie[Se][3],Ue+=" ",Ue+=ie[Se][4],ie[Se][5]!=null&&(Ue+=" ",Ue+=ie[Se][5],Ue+=" ",Ue+=ie[Se][6],ie[Se][7]!=null&&(Ue+=" ",Ue+=ie[Se][7])))));return Ue+" "}(this.value)},move:function(ie,Se){var $e=this.bbox();return $e.x,$e.y,this},at:function(ie){if(!this.destination)return this;for(var Se=this.value,$e=this.destination.value,Ue=[],_e=new p.PathArray,st=0,ut=Se.length;st<ut;st++){Ue[st]=[Se[st][0]];for(var yt=1,Mt=Se[st].length;yt<Mt;yt++)Ue[st][yt]=Se[st][yt]+($e[st][yt]-Se[st][yt])*ie;Ue[st][0]==="A"&&(Ue[st][4]=+(Ue[st][4]!=0),Ue[st][5]=+(Ue[st][5]!=0))}return _e.value=Ue,_e},parse:function(ie){if(ie instanceof p.PathArray)return ie.valueOf();var Se,$e={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};ie=typeof ie=="string"?ie.replace(p.regex.numbersWithDots,G).replace(p.regex.pathLetters," $& ").replace(p.regex.hyphen,"$1 -").trim().split(p.regex.delimiter):ie.reduce(function(Mt,Kt){return[].concat.call(Mt,Kt)},[]);var Ue=[],_e=new p.Point,st=new p.Point,ut=0,yt=ie.length;do p.regex.isPathLetter.test(ie[ut])?(Se=ie[ut],++ut):Se=="M"?Se="L":Se=="m"&&(Se="l"),Ue.push(S[Se].call(null,ie.slice(ut,ut+=$e[Se.toUpperCase()]).map(parseFloat),_e,st));while(yt>ut);return Ue},bbox:function(){return p.parser.draw||p.prepare(),p.parser.path.setAttribute("d",this.toString()),p.parser.path.getBBox()}}),p.Number=p.invent({create:function(ie,Se){this.value=0,this.unit=Se||"",typeof ie=="number"?this.value=isNaN(ie)?0:isFinite(ie)?ie:ie<0?-34e37:34e37:typeof ie=="string"?(Se=ie.match(p.regex.numberAndUnit))&&(this.value=parseFloat(Se[1]),Se[5]=="%"?this.value/=100:Se[5]=="s"&&(this.value*=1e3),this.unit=Se[5]):ie instanceof p.Number&&(this.value=ie.valueOf(),this.unit=ie.unit)},extend:{toString:function(){return(this.unit=="%"?~~(1e8*this.value)/1e6:this.unit=="s"?this.value/1e3:this.value)+this.unit},toJSON:function(){return this.toString()},valueOf:function(){return this.value},plus:function(ie){return ie=new p.Number(ie),new p.Number(this+ie,this.unit||ie.unit)},minus:function(ie){return ie=new p.Number(ie),new p.Number(this-ie,this.unit||ie.unit)},times:function(ie){return ie=new p.Number(ie),new p.Number(this*ie,this.unit||ie.unit)},divide:function(ie){return ie=new p.Number(ie),new p.Number(this/ie,this.unit||ie.unit)},to:function(ie){var Se=new p.Number(this);return typeof ie=="string"&&(Se.unit=ie),Se},morph:function(ie){return this.destination=new p.Number(ie),ie.relative&&(this.destination.value+=this.value),this},at:function(ie){return this.destination?new p.Number(this.destination).minus(this).times(ie).plus(this):this}}}),p.Element=p.invent({create:function(ie){this._stroke=p.defaults.attrs.stroke,this._event=null,this.dom={},(this.node=ie)&&(this.type=ie.nodeName,this.node.instance=this,this._stroke=ie.getAttribute("stroke")||this._stroke)},extend:{x:function(ie){return this.attr("x",ie)},y:function(ie){return this.attr("y",ie)},cx:function(ie){return ie==null?this.x()+this.width()/2:this.x(ie-this.width()/2)},cy:function(ie){return ie==null?this.y()+this.height()/2:this.y(ie-this.height()/2)},move:function(ie,Se){return this.x(ie).y(Se)},center:function(ie,Se){return this.cx(ie).cy(Se)},width:function(ie){return this.attr("width",ie)},height:function(ie){return this.attr("height",ie)},size:function(ie,Se){var $e=ge(this,ie,Se);return this.width(new p.Number($e.width)).height(new p.Number($e.height))},clone:function(ie){this.writeDataToDom();var Se=Me(this.node.cloneNode(!0));return ie?ie.add(Se):this.after(Se),Se},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(ie){return this.after(ie).remove(),ie},addTo:function(ie){return ie.put(this)},putIn:function(ie){return ie.add(this)},id:function(ie){return this.attr("id",ie)},show:function(){return this.style("display","")},hide:function(){return this.style("display","none")},visible:function(){return this.style("display")!="none"},toString:function(){return this.attr("id")},classes:function(){var ie=this.attr("class");return ie==null?[]:ie.trim().split(p.regex.delimiter)},hasClass:function(ie){return this.classes().indexOf(ie)!=-1},addClass:function(ie){if(!this.hasClass(ie)){var Se=this.classes();Se.push(ie),this.attr("class",Se.join(" "))}return this},removeClass:function(ie){return this.hasClass(ie)&&this.attr("class",this.classes().filter(function(Se){return Se!=ie}).join(" ")),this},toggleClass:function(ie){return this.hasClass(ie)?this.removeClass(ie):this.addClass(ie)},reference:function(ie){return p.get(this.attr(ie))},parent:function(ie){var Se=this;if(!Se.node.parentNode)return null;if(Se=p.adopt(Se.node.parentNode),!ie)return Se;for(;Se&&Se.node instanceof Ee.SVGElement;){if(typeof ie=="string"?Se.matches(ie):Se instanceof ie)return Se;if(!Se.node.parentNode||Se.node.parentNode.nodeName=="#document")return null;Se=p.adopt(Se.node.parentNode)}},doc:function(){return this instanceof p.Doc?this:this.parent(p.Doc)},parents:function(ie){var Se=[],$e=this;do{if(!($e=$e.parent(ie))||!$e.node)break;Se.push($e)}while($e.parent);return Se},matches:function(ie){return function(Se,$e){return(Se.matches||Se.matchesSelector||Se.msMatchesSelector||Se.mozMatchesSelector||Se.webkitMatchesSelector||Se.oMatchesSelector).call(Se,$e)}(this.node,ie)},native:function(){return this.node},svg:function(ie){var Se=h.createElementNS("http://www.w3.org/2000/svg","svg");if(!(ie&&this instanceof p.Parent))return Se.appendChild(ie=h.createElementNS("http://www.w3.org/2000/svg","svg")),this.writeDataToDom(),ie.appendChild(this.node.cloneNode(!0)),Se.innerHTML.replace(/^<svg>/,"").replace(/<\/svg>$/,"");Se.innerHTML="<svg>"+ie.replace(/\n/,"").replace(/<([\w:-]+)([^<]+?)\/>/g,"<$1$2></$1>")+"</svg>";for(var $e=0,Ue=Se.firstChild.childNodes.length;$e<Ue;$e++)this.node.appendChild(Se.firstChild.firstChild);return this},writeDataToDom:function(){return(this.each||this.lines)&&(this.each?this:this.lines()).each(function(){this.writeDataToDom()}),this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(ie){return this.dom=ie,this},is:function(ie){return function(Se,$e){return Se instanceof $e}(this,ie)}}}),p.easing={"-":function(ie){return ie},"<>":function(ie){return-Math.cos(ie*Math.PI)/2+.5},">":function(ie){return Math.sin(ie*Math.PI/2)},"<":function(ie){return 1-Math.cos(ie*Math.PI/2)}},p.morph=function(ie){return function(Se,$e){return new p.MorphObj(Se,$e).at(ie)}},p.Situation=p.invent({create:function(ie){this.init=!1,this.reversed=!1,this.reversing=!1,this.duration=new p.Number(ie.duration).valueOf(),this.delay=new p.Number(ie.delay).valueOf(),this.start=+new Date+this.delay,this.finish=this.start+this.duration,this.ease=ie.ease,this.loop=0,this.loops=!1,this.animations={},this.attrs={},this.styles={},this.transforms=[],this.once={}}}),p.FX=p.invent({create:function(ie){this._target=ie,this.situations=[],this.active=!1,this.situation=null,this.paused=!1,this.lastPos=0,this.pos=0,this.absPos=0,this._speed=1},extend:{animate:function(ie,Se,$e){T(ie)==="object"&&(Se=ie.ease,$e=ie.delay,ie=ie.duration);var Ue=new p.Situation({duration:ie||1e3,delay:$e||0,ease:p.easing[Se||"-"]||Se});return this.queue(Ue),this},target:function(ie){return ie&&ie instanceof p.Element?(this._target=ie,this):this._target},timeToAbsPos:function(ie){return(ie-this.situation.start)/(this.situation.duration/this._speed)},absPosToTime:function(ie){return this.situation.duration/this._speed*ie+this.situation.start},startAnimFrame:function(){this.stopAnimFrame(),this.animationFrame=Ee.requestAnimationFrame((function(){this.step()}).bind(this))},stopAnimFrame:function(){Ee.cancelAnimationFrame(this.animationFrame)},start:function(){return!this.active&&this.situation&&(this.active=!0,this.startCurrent()),this},startCurrent:function(){return this.situation.start=+new Date+this.situation.delay/this._speed,this.situation.finish=this.situation.start+this.situation.duration/this._speed,this.initAnimations().step()},queue:function(ie){return(typeof ie=="function"||ie instanceof p.Situation)&&this.situations.push(ie),this.situation||(this.situation=this.situations.shift()),this},dequeue:function(){return this.stop(),this.situation=this.situations.shift(),this.situation&&(this.situation instanceof p.Situation?this.start():this.situation.call(this)),this},initAnimations:function(){var ie,Se=this.situation;if(Se.init)return this;for(var $e in Se.animations){ie=this.target()[$e](),Array.isArray(ie)||(ie=[ie]),Array.isArray(Se.animations[$e])||(Se.animations[$e]=[Se.animations[$e]]);for(var Ue=ie.length;Ue--;)Se.animations[$e][Ue]instanceof p.Number&&(ie[Ue]=new p.Number(ie[Ue])),Se.animations[$e][Ue]=ie[Ue].morph(Se.animations[$e][Ue])}for(var $e in Se.attrs)Se.attrs[$e]=new p.MorphObj(this.target().attr($e),Se.attrs[$e]);for(var $e in Se.styles)Se.styles[$e]=new p.MorphObj(this.target().style($e),Se.styles[$e]);return Se.initialTransformation=this.target().matrixify(),Se.init=!0,this},clearQueue:function(){return this.situations=[],this},clearCurrent:function(){return this.situation=null,this},stop:function(ie,Se){var $e=this.active;return this.active=!1,Se&&this.clearQueue(),ie&&this.situation&&(!$e&&this.startCurrent(),this.atEnd()),this.stopAnimFrame(),this.clearCurrent()},after:function(ie){var Se=this.last();return this.target().on("finished.fx",function $e(Ue){Ue.detail.situation==Se&&(ie.call(this,Se),this.off("finished.fx",$e))}),this._callStart()},during:function(ie){var Se=this.last(),$e=function(Ue){Ue.detail.situation==Se&&ie.call(this,Ue.detail.pos,p.morph(Ue.detail.pos),Ue.detail.eased,Se)};return this.target().off("during.fx",$e).on("during.fx",$e),this.after(function(){this.off("during.fx",$e)}),this._callStart()},afterAll:function(ie){var Se=function $e(Ue){ie.call(this),this.off("allfinished.fx",$e)};return this.target().off("allfinished.fx",Se).on("allfinished.fx",Se),this._callStart()},last:function(){return this.situations.length?this.situations[this.situations.length-1]:this.situation},add:function(ie,Se,$e){return this.last()[$e||"animations"][ie]=Se,this._callStart()},step:function(ie){var Se,$e,Ue;ie||(this.absPos=this.timeToAbsPos(+new Date)),this.situation.loops!==!1?(Se=Math.max(this.absPos,0),$e=Math.floor(Se),this.situation.loops===!0||$e<this.situation.loops?(this.pos=Se-$e,Ue=this.situation.loop,this.situation.loop=$e):(this.absPos=this.situation.loops,this.pos=1,Ue=this.situation.loop-1,this.situation.loop=this.situation.loops),this.situation.reversing&&(this.situation.reversed=this.situation.reversed!=!!((this.situation.loop-Ue)%2))):(this.absPos=Math.min(this.absPos,1),this.pos=this.absPos),this.pos<0&&(this.pos=0),this.situation.reversed&&(this.pos=1-this.pos);var _e=this.situation.ease(this.pos);for(var st in this.situation.once)st>this.lastPos&&st<=_e&&(this.situation.once[st].call(this.target(),this.pos,_e),delete this.situation.once[st]);return this.active&&this.target().fire("during",{pos:this.pos,eased:_e,fx:this,situation:this.situation}),this.situation?(this.eachAt(),this.pos==1&&!this.situation.reversed||this.situation.reversed&&this.pos==0?(this.stopAnimFrame(),this.target().fire("finished",{fx:this,situation:this.situation}),this.situations.length||(this.target().fire("allfinished"),this.situations.length||(this.target().off(".fx"),this.active=!1)),this.active?this.dequeue():this.clearCurrent()):!this.paused&&this.active&&this.startAnimFrame(),this.lastPos=_e,this):this},eachAt:function(){var ie,Se=this,$e=this.target(),Ue=this.situation;for(var _e in Ue.animations)ie=[].concat(Ue.animations[_e]).map(function(yt){return typeof yt!="string"&&yt.at?yt.at(Ue.ease(Se.pos),Se.pos):yt}),$e[_e].apply($e,ie);for(var _e in Ue.attrs)ie=[_e].concat(Ue.attrs[_e]).map(function(Mt){return typeof Mt!="string"&&Mt.at?Mt.at(Ue.ease(Se.pos),Se.pos):Mt}),$e.attr.apply($e,ie);for(var _e in Ue.styles)ie=[_e].concat(Ue.styles[_e]).map(function(Mt){return typeof Mt!="string"&&Mt.at?Mt.at(Ue.ease(Se.pos),Se.pos):Mt}),$e.style.apply($e,ie);if(Ue.transforms.length){ie=Ue.initialTransformation,_e=0;for(var st=Ue.transforms.length;_e<st;_e++){var ut=Ue.transforms[_e];ut instanceof p.Matrix?ie=ut.relative?ie.multiply(new p.Matrix().morph(ut).at(Ue.ease(this.pos))):ie.morph(ut).at(Ue.ease(this.pos)):(ut.relative||ut.undo(ie.extract()),ie=ie.multiply(ut.at(Ue.ease(this.pos))))}$e.matrix(ie)}return this},once:function(ie,Se,$e){var Ue=this.last();return $e||(ie=Ue.ease(ie)),Ue.once[ie]=Se,this},_callStart:function(){return setTimeout((function(){this.start()}).bind(this),0),this}},parent:p.Element,construct:{animate:function(ie,Se,$e){return(this.fx||(this.fx=new p.FX(this))).animate(ie,Se,$e)},delay:function(ie){return(this.fx||(this.fx=new p.FX(this))).delay(ie)},stop:function(ie,Se){return this.fx&&this.fx.stop(ie,Se),this},finish:function(){return this.fx&&this.fx.finish(),this}}}),p.MorphObj=p.invent({create:function(ie,Se){return p.Color.isColor(Se)?new p.Color(ie).morph(Se):p.regex.delimiter.test(ie)?p.regex.pathLetters.test(ie)?new p.PathArray(ie).morph(Se):new p.Array(ie).morph(Se):p.regex.numberAndUnit.test(Se)?new p.Number(ie).morph(Se):(this.value=ie,void(this.destination=Se))},extend:{at:function(ie,Se){return Se<1?this.value:this.destination},valueOf:function(){return this.value}}}),p.extend(p.FX,{attr:function(ie,Se,$e){if(T(ie)==="object")for(var Ue in ie)this.attr(Ue,ie[Ue]);else this.add(ie,Se,"attrs");return this},plot:function(ie,Se,$e,Ue){return arguments.length==4?this.plot([ie,Se,$e,Ue]):this.add("plot",new(this.target()).morphArray(ie))}}),p.Box=p.invent({create:function(ie,Se,$e,Ue){if(!(T(ie)!=="object"||ie instanceof p.Element))return p.Box.call(this,ie.left!=null?ie.left:ie.x,ie.top!=null?ie.top:ie.y,ie.width,ie.height);var _e;arguments.length==4&&(this.x=ie,this.y=Se,this.width=$e,this.height=Ue),(_e=this).x==null&&(_e.x=0,_e.y=0,_e.width=0,_e.height=0),_e.w=_e.width,_e.h=_e.height,_e.x2=_e.x+_e.width,_e.y2=_e.y+_e.height,_e.cx=_e.x+_e.width/2,_e.cy=_e.y+_e.height/2}}),p.BBox=p.invent({create:function(ie){if(p.Box.apply(this,[].slice.call(arguments)),ie instanceof p.Element){var Se;try{if(!h.documentElement.contains){for(var $e=ie.node;$e.parentNode;)$e=$e.parentNode;if($e!=h)throw new Error("Element not in the dom")}Se=ie.node.getBBox()}catch{if(ie instanceof p.Shape){p.parser.draw||p.prepare();var Ue=ie.clone(p.parser.draw.instance).show();Ue&&Ue.node&&typeof Ue.node.getBBox=="function"&&(Se=Ue.node.getBBox()),Ue&&typeof Ue.remove=="function"&&Ue.remove()}else Se={x:ie.node.clientLeft,y:ie.node.clientTop,width:ie.node.clientWidth,height:ie.node.clientHeight}}p.Box.call(this,Se)}},inherit:p.Box,parent:p.Element,construct:{bbox:function(){return new p.BBox(this)}}}),p.BBox.prototype.constructor=p.BBox,p.Matrix=p.invent({create:function(ie){var Se=ke([1,0,0,1,0,0]);ie=ie===null?Se:ie instanceof p.Element?ie.matrixify():typeof ie=="string"?ke(ie.split(p.regex.delimiter).map(parseFloat)):arguments.length==6?ke([].slice.call(arguments)):Array.isArray(ie)?ke(ie):ie&&T(ie)==="object"?ie:Se;for(var $e=Fe.length-1;$e>=0;--$e)this[Fe[$e]]=ie[Fe[$e]]!=null?ie[Fe[$e]]:Se[Fe[$e]]},extend:{extract:function(){var ie=Ae(this,0,1);Ae(this,1,0);var Se=180/Math.PI*Math.atan2(ie.y,ie.x)-90;return{x:this.e,y:this.f,transformedX:(this.e*Math.cos(Se*Math.PI/180)+this.f*Math.sin(Se*Math.PI/180))/Math.sqrt(this.a*this.a+this.b*this.b),transformedY:(this.f*Math.cos(Se*Math.PI/180)+this.e*Math.sin(-Se*Math.PI/180))/Math.sqrt(this.c*this.c+this.d*this.d),rotation:Se,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f,matrix:new p.Matrix(this)}},clone:function(){return new p.Matrix(this)},morph:function(ie){return this.destination=new p.Matrix(ie),this},multiply:function(ie){return new p.Matrix(this.native().multiply(function(Se){return Se instanceof p.Matrix||(Se=new p.Matrix(Se)),Se}(ie).native()))},inverse:function(){return new p.Matrix(this.native().inverse())},translate:function(ie,Se){return new p.Matrix(this.native().translate(ie||0,Se||0))},native:function(){for(var ie=p.parser.native.createSVGMatrix(),Se=Fe.length-1;Se>=0;Se--)ie[Fe[Se]]=this[Fe[Se]];return ie},toString:function(){return"matrix("+qe(this.a)+","+qe(this.b)+","+qe(this.c)+","+qe(this.d)+","+qe(this.e)+","+qe(this.f)+")"}},parent:p.Element,construct:{ctm:function(){return new p.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof p.Nested){var ie=this.rect(1,1),Se=ie.node.getScreenCTM();return ie.remove(),new p.Matrix(Se)}return new p.Matrix(this.node.getScreenCTM())}}}),p.Point=p.invent({create:function(ie,Se){var $e;$e=Array.isArray(ie)?{x:ie[0],y:ie[1]}:T(ie)==="object"?{x:ie.x,y:ie.y}:ie!=null?{x:ie,y:Se??ie}:{x:0,y:0},this.x=$e.x,this.y=$e.y},extend:{clone:function(){return new p.Point(this)},morph:function(ie,Se){return this.destination=new p.Point(ie,Se),this}}}),p.extend(p.Element,{point:function(ie,Se){return new p.Point(ie,Se).transform(this.screenCTM().inverse())}}),p.extend(p.Element,{attr:function(ie,Se,$e){if(ie==null){for(ie={},$e=(Se=this.node.attributes).length-1;$e>=0;$e--)ie[Se[$e].nodeName]=p.regex.isNumber.test(Se[$e].nodeValue)?parseFloat(Se[$e].nodeValue):Se[$e].nodeValue;return ie}if(T(ie)==="object")for(var Ue in ie)this.attr(Ue,ie[Ue]);else if(Se===null)this.node.removeAttribute(ie);else{if(Se==null)return(Se=this.node.getAttribute(ie))==null?p.defaults.attrs[ie]:p.regex.isNumber.test(Se)?parseFloat(Se):Se;ie=="stroke-width"?this.attr("stroke",parseFloat(Se)>0?this._stroke:null):ie=="stroke"&&(this._stroke=Se),ie!="fill"&&ie!="stroke"||(p.regex.isImage.test(Se)&&(Se=this.doc().defs().image(Se,0,0)),Se instanceof p.Image&&(Se=this.doc().defs().pattern(0,0,function(){this.add(Se)}))),typeof Se=="number"?Se=new p.Number(Se):p.Color.isColor(Se)?Se=new p.Color(Se):Array.isArray(Se)&&(Se=new p.Array(Se)),ie=="leading"?this.leading&&this.leading(Se):typeof $e=="string"?this.node.setAttributeNS($e,ie,Se.toString()):this.node.setAttribute(ie,Se.toString()),!this.rebuild||ie!="font-size"&&ie!="x"||this.rebuild(ie,Se)}return this}}),p.extend(p.Element,{transform:function(ie,Se){var $e;return T(ie)!=="object"?($e=new p.Matrix(this).extract(),typeof ie=="string"?$e[ie]:$e):($e=new p.Matrix(this),Se=!!Se||!!ie.relative,ie.a!=null&&($e=Se?$e.multiply(new p.Matrix(ie)):new p.Matrix(ie)),this.attr("transform",$e))}}),p.extend(p.Element,{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(p.regex.transforms).slice(0,-1).map(function(ie){var Se=ie.trim().split("(");return[Se[0],Se[1].split(p.regex.delimiter).map(function($e){return parseFloat($e)})]}).reduce(function(ie,Se){return Se[0]=="matrix"?ie.multiply(ke(Se[1])):ie[Se[0]].apply(ie,Se[1])},new p.Matrix)},toParent:function(ie){if(this==ie)return this;var Se=this.screenCTM(),$e=ie.screenCTM().inverse();return this.addTo(ie).untransform().transform($e.multiply(Se)),this},toDoc:function(){return this.toParent(this.doc())}}),p.Transformation=p.invent({create:function(ie,Se){if(arguments.length>1&&typeof Se!="boolean")return this.constructor.call(this,[].slice.call(arguments));if(Array.isArray(ie))for(var $e=0,Ue=this.arguments.length;$e<Ue;++$e)this[this.arguments[$e]]=ie[$e];else if(ie&&T(ie)==="object")for($e=0,Ue=this.arguments.length;$e<Ue;++$e)this[this.arguments[$e]]=ie[this.arguments[$e]];this.inversed=!1,Se===!0&&(this.inversed=!0)}}),p.Translate=p.invent({parent:p.Matrix,inherit:p.Transformation,create:function(ie,Se){this.constructor.apply(this,[].slice.call(arguments))},extend:{arguments:["transformedX","transformedY"],method:"translate"}}),p.extend(p.Element,{style:function(ie,Se){if(arguments.length==0)return this.node.style.cssText||"";if(arguments.length<2)if(T(ie)==="object")for(var $e in ie)this.style($e,ie[$e]);else{if(!p.regex.isCss.test(ie))return this.node.style[re(ie)];for(ie=ie.split(/\s*;\s*/).filter(function(Ue){return!!Ue}).map(function(Ue){return Ue.split(/\s*:\s*/)});Se=ie.pop();)this.style(Se[0],Se[1])}else this.node.style[re(ie)]=Se===null||p.regex.isBlank.test(Se)?"":Se;return this}}),p.Parent=p.invent({create:function(ie){this.constructor.call(this,ie)},inherit:p.Element,extend:{children:function(){return p.utils.map(p.utils.filterSVGElements(this.node.childNodes),function(ie){return p.adopt(ie)})},add:function(ie,Se){return Se==null?this.node.appendChild(ie.node):ie.node!=this.node.childNodes[Se]&&this.node.insertBefore(ie.node,this.node.childNodes[Se]),this},put:function(ie,Se){return this.add(ie,Se),ie},has:function(ie){return this.index(ie)>=0},index:function(ie){return[].slice.call(this.node.childNodes).indexOf(ie.node)},get:function(ie){return p.adopt(this.node.childNodes[ie])},first:function(){return this.get(0)},last:function(){return this.get(this.node.childNodes.length-1)},each:function(ie,Se){for(var $e=this.children(),Ue=0,_e=$e.length;Ue<_e;Ue++)$e[Ue]instanceof p.Element&&ie.apply($e[Ue],[Ue,$e]),Se&&$e[Ue]instanceof p.Container&&$e[Ue].each(ie,Se);return this},removeElement:function(ie){return this.node.removeChild(ie.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},defs:function(){return this.doc().defs()}}}),p.extend(p.Parent,{ungroup:function(ie,Se){return Se===0||this instanceof p.Defs||this.node==p.parser.draw||(ie=ie||(this instanceof p.Doc?this:this.parent(p.Parent)),Se=Se||1/0,this.each(function(){return this instanceof p.Defs?this:this instanceof p.Parent?this.ungroup(ie,Se-1):this.toParent(ie)}),this.node.firstChild||this.remove()),this},flatten:function(ie,Se){return this.ungroup(ie,Se)}}),p.Container=p.invent({create:function(ie){this.constructor.call(this,ie)},inherit:p.Parent}),p.ViewBox=p.invent({parent:p.Container,construct:{}}),["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(ie){p.Element.prototype[ie]=function(Se){return p.on(this.node,ie,Se),this}}),p.listeners=[],p.handlerMap=[],p.listenerId=0,p.on=function(ie,Se,$e,Ue,_e){var st=$e.bind(Ue||ie.instance||ie),ut=(p.handlerMap.indexOf(ie)+1||p.handlerMap.push(ie))-1,yt=Se.split(".")[0],Mt=Se.split(".")[1]||"*";p.listeners[ut]=p.listeners[ut]||{},p.listeners[ut][yt]=p.listeners[ut][yt]||{},p.listeners[ut][yt][Mt]=p.listeners[ut][yt][Mt]||{},$e._svgjsListenerId||($e._svgjsListenerId=++p.listenerId),p.listeners[ut][yt][Mt][$e._svgjsListenerId]=st,ie.addEventListener(yt,st,_e||{passive:!1})},p.off=function(ie,Se,$e){var Ue=p.handlerMap.indexOf(ie),_e=Se&&Se.split(".")[0],st=Se&&Se.split(".")[1],ut="";if(Ue!=-1)if($e){if(typeof $e=="function"&&($e=$e._svgjsListenerId),!$e)return;p.listeners[Ue][_e]&&p.listeners[Ue][_e][st||"*"]&&(ie.removeEventListener(_e,p.listeners[Ue][_e][st||"*"][$e],!1),delete p.listeners[Ue][_e][st||"*"][$e])}else if(st&&_e){if(p.listeners[Ue][_e]&&p.listeners[Ue][_e][st]){for(var yt in p.listeners[Ue][_e][st])p.off(ie,[_e,st].join("."),yt);delete p.listeners[Ue][_e][st]}}else if(st)for(var Mt in p.listeners[Ue])for(var ut in p.listeners[Ue][Mt])st===ut&&p.off(ie,[Mt,st].join("."));else if(_e){if(p.listeners[Ue][_e]){for(var ut in p.listeners[Ue][_e])p.off(ie,[_e,ut].join("."));delete p.listeners[Ue][_e]}}else{for(var Mt in p.listeners[Ue])p.off(ie,Mt);delete p.listeners[Ue],delete p.handlerMap[Ue]}},p.extend(p.Element,{on:function(ie,Se,$e,Ue){return p.on(this.node,ie,Se,$e,Ue),this},off:function(ie,Se){return p.off(this.node,ie,Se),this},fire:function(ie,Se){return ie instanceof Ee.Event?this.node.dispatchEvent(ie):this.node.dispatchEvent(ie=new p.CustomEvent(ie,{detail:Se,cancelable:!0})),this._event=ie,this},event:function(){return this._event}}),p.Defs=p.invent({create:"defs",inherit:p.Container}),p.G=p.invent({create:"g",inherit:p.Container,extend:{x:function(ie){return ie==null?this.transform("x"):this.transform({x:ie-this.x()},!0)}},construct:{group:function(){return this.put(new p.G)}}}),p.Doc=p.invent({create:function(ie){ie&&((ie=typeof ie=="string"?h.getElementById(ie):ie).nodeName=="svg"?this.constructor.call(this,ie):(this.constructor.call(this,p.create("svg")),ie.appendChild(this.node),this.size("100%","100%")),this.namespace().defs())},inherit:p.Container,extend:{namespace:function(){return this.attr({xmlns:p.ns,version:"1.1"}).attr("xmlns:xlink",p.xlink,p.xmlns).attr("xmlns:svgjs",p.svgjs,p.xmlns)},defs:function(){var ie;return this._defs||((ie=this.node.getElementsByTagName("defs")[0])?this._defs=p.adopt(ie):this._defs=new p.Defs,this.node.appendChild(this._defs.node)),this._defs},parent:function(){return this.node.parentNode&&this.node.parentNode.nodeName!="#document"?this.node.parentNode:null},remove:function(){return this.parent()&&this.parent().removeChild(this.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,p.parser.draw&&!p.parser.draw.parentNode&&this.node.appendChild(p.parser.draw),this},clone:function(ie){this.writeDataToDom();var Se=this.node,$e=Me(Se.cloneNode(!0));return ie?(ie.node||ie).appendChild($e.node):Se.parentNode.insertBefore($e.node,Se.nextSibling),$e}}}),p.extend(p.Element,{}),p.Gradient=p.invent({create:function(ie){this.constructor.call(this,p.create(ie+"Gradient")),this.type=ie},inherit:p.Container,extend:{at:function(ie,Se,$e){return this.put(new p.Stop).update(ie,Se,$e)},update:function(ie){return this.clear(),typeof ie=="function"&&ie.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()},attr:function(ie,Se,$e){return ie=="transform"&&(ie="gradientTransform"),p.Container.prototype.attr.call(this,ie,Se,$e)}},construct:{gradient:function(ie,Se){return this.defs().gradient(ie,Se)}}}),p.extend(p.Gradient,p.FX,{from:function(ie,Se){return(this._target||this).type=="radial"?this.attr({fx:new p.Number(ie),fy:new p.Number(Se)}):this.attr({x1:new p.Number(ie),y1:new p.Number(Se)})},to:function(ie,Se){return(this._target||this).type=="radial"?this.attr({cx:new p.Number(ie),cy:new p.Number(Se)}):this.attr({x2:new p.Number(ie),y2:new p.Number(Se)})}}),p.extend(p.Defs,{gradient:function(ie,Se){return this.put(new p.Gradient(ie)).update(Se)}}),p.Stop=p.invent({create:"stop",inherit:p.Element,extend:{update:function(ie){return(typeof ie=="number"||ie instanceof p.Number)&&(ie={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),ie.opacity!=null&&this.attr("stop-opacity",ie.opacity),ie.color!=null&&this.attr("stop-color",ie.color),ie.offset!=null&&this.attr("offset",new p.Number(ie.offset)),this}}}),p.Pattern=p.invent({create:"pattern",inherit:p.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(ie){return this.clear(),typeof ie=="function"&&ie.call(this,this),this},toString:function(){return this.fill()},attr:function(ie,Se,$e){return ie=="transform"&&(ie="patternTransform"),p.Container.prototype.attr.call(this,ie,Se,$e)}},construct:{pattern:function(ie,Se,$e){return this.defs().pattern(ie,Se,$e)}}}),p.extend(p.Defs,{pattern:function(ie,Se,$e){return this.put(new p.Pattern).update($e).attr({x:0,y:0,width:ie,height:Se,patternUnits:"userSpaceOnUse"})}}),p.Shape=p.invent({create:function(ie){this.constructor.call(this,ie)},inherit:p.Element}),p.Symbol=p.invent({create:"symbol",inherit:p.Container,construct:{symbol:function(){return this.put(new p.Symbol)}}}),p.Use=p.invent({create:"use",inherit:p.Shape,extend:{element:function(ie,Se){return this.attr("href",(Se||"")+"#"+ie,p.xlink)}},construct:{use:function(ie,Se){return this.put(new p.Use).element(ie,Se)}}}),p.Rect=p.invent({create:"rect",inherit:p.Shape,construct:{rect:function(ie,Se){return this.put(new p.Rect).size(ie,Se)}}}),p.Circle=p.invent({create:"circle",inherit:p.Shape,construct:{circle:function(ie){return this.put(new p.Circle).rx(new p.Number(ie).divide(2)).move(0,0)}}}),p.extend(p.Circle,p.FX,{rx:function(ie){return this.attr("r",ie)},ry:function(ie){return this.rx(ie)}}),p.Ellipse=p.invent({create:"ellipse",inherit:p.Shape,construct:{ellipse:function(ie,Se){return this.put(new p.Ellipse).size(ie,Se).move(0,0)}}}),p.extend(p.Ellipse,p.Rect,p.FX,{rx:function(ie){return this.attr("rx",ie)},ry:function(ie){return this.attr("ry",ie)}}),p.extend(p.Circle,p.Ellipse,{x:function(ie){return ie==null?this.cx()-this.rx():this.cx(ie+this.rx())},y:function(ie){return ie==null?this.cy()-this.ry():this.cy(ie+this.ry())},cx:function(ie){return ie==null?this.attr("cx"):this.attr("cx",ie)},cy:function(ie){return ie==null?this.attr("cy"):this.attr("cy",ie)},width:function(ie){return ie==null?2*this.rx():this.rx(new p.Number(ie).divide(2))},height:function(ie){return ie==null?2*this.ry():this.ry(new p.Number(ie).divide(2))},size:function(ie,Se){var $e=ge(this,ie,Se);return this.rx(new p.Number($e.width).divide(2)).ry(new p.Number($e.height).divide(2))}}),p.Line=p.invent({create:"line",inherit:p.Shape,extend:{array:function(){return new p.PointArray([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])},plot:function(ie,Se,$e,Ue){return ie==null?this.array():(ie=Se!==void 0?{x1:ie,y1:Se,x2:$e,y2:Ue}:new p.PointArray(ie).toLine(),this.attr(ie))},move:function(ie,Se){return this.attr(this.array().move(ie,Se).toLine())},size:function(ie,Se){var $e=ge(this,ie,Se);return this.attr(this.array().size($e.width,$e.height).toLine())}},construct:{line:function(ie,Se,$e,Ue){return p.Line.prototype.plot.apply(this.put(new p.Line),ie!=null?[ie,Se,$e,Ue]:[0,0,0,0])}}}),p.Polyline=p.invent({create:"polyline",inherit:p.Shape,construct:{polyline:function(ie){return this.put(new p.Polyline).plot(ie||new p.PointArray)}}}),p.Polygon=p.invent({create:"polygon",inherit:p.Shape,construct:{polygon:function(ie){return this.put(new p.Polygon).plot(ie||new p.PointArray)}}}),p.extend(p.Polyline,p.Polygon,{array:function(){return this._array||(this._array=new p.PointArray(this.attr("points")))},plot:function(ie){return ie==null?this.array():this.clear().attr("points",typeof ie=="string"?ie:this._array=new p.PointArray(ie))},clear:function(){return delete this._array,this},move:function(ie,Se){return this.attr("points",this.array().move(ie,Se))},size:function(ie,Se){var $e=ge(this,ie,Se);return this.attr("points",this.array().size($e.width,$e.height))}}),p.extend(p.Line,p.Polyline,p.Polygon,{morphArray:p.PointArray,x:function(ie){return ie==null?this.bbox().x:this.move(ie,this.bbox().y)},y:function(ie){return ie==null?this.bbox().y:this.move(this.bbox().x,ie)},width:function(ie){var Se=this.bbox();return ie==null?Se.width:this.size(ie,Se.height)},height:function(ie){var Se=this.bbox();return ie==null?Se.height:this.size(Se.width,ie)}}),p.Path=p.invent({create:"path",inherit:p.Shape,extend:{morphArray:p.PathArray,array:function(){return this._array||(this._array=new p.PathArray(this.attr("d")))},plot:function(ie){return ie==null?this.array():this.clear().attr("d",typeof ie=="string"?ie:this._array=new p.PathArray(ie))},clear:function(){return delete this._array,this}},construct:{path:function(ie){return this.put(new p.Path).plot(ie||new p.PathArray)}}}),p.Image=p.invent({create:"image",inherit:p.Shape,extend:{load:function(ie){if(!ie)return this;var Se=this,$e=new Ee.Image;return p.on($e,"load",function(){p.off($e);var Ue=Se.parent(p.Pattern);Ue!==null&&(Se.width()==0&&Se.height()==0&&Se.size($e.width,$e.height),Ue&&Ue.width()==0&&Ue.height()==0&&Ue.size(Se.width(),Se.height()),typeof Se._loaded=="function"&&Se._loaded.call(Se,{width:$e.width,height:$e.height,ratio:$e.width/$e.height,url:ie}))}),p.on($e,"error",function(Ue){p.off($e),typeof Se._error=="function"&&Se._error.call(Se,Ue)}),this.attr("href",$e.src=this.src=ie,p.xlink)},loaded:function(ie){return this._loaded=ie,this},error:function(ie){return this._error=ie,this}},construct:{image:function(ie,Se,$e){return this.put(new p.Image).load(ie).size(Se||0,$e||Se||0)}}}),p.Text=p.invent({create:function(){this.constructor.call(this,p.create("text")),this.dom.leading=new p.Number(1.3),this._rebuild=!0,this._build=!1,this.attr("font-family",p.defaults.attrs["font-family"])},inherit:p.Shape,extend:{x:function(ie){return ie==null?this.attr("x"):this.attr("x",ie)},text:function(ie){if(ie===void 0){ie="";for(var Se=this.node.childNodes,$e=0,Ue=Se.length;$e<Ue;++$e)$e!=0&&Se[$e].nodeType!=3&&p.adopt(Se[$e]).dom.newLined==1&&(ie+=`
`),ie+=Se[$e].textContent;return ie}if(this.clear().build(!0),typeof ie=="function")ie.call(this,this);else{$e=0;for(var _e=(ie=ie.split(`
`)).length;$e<_e;$e++)this.tspan(ie[$e]).newLine()}return this.build(!1).rebuild()},size:function(ie){return this.attr("font-size",ie).rebuild()},leading:function(ie){return ie==null?this.dom.leading:(this.dom.leading=new p.Number(ie),this.rebuild())},lines:function(){var ie=(this.textPath&&this.textPath()||this).node,Se=p.utils.map(p.utils.filterSVGElements(ie.childNodes),function($e){return p.adopt($e)});return new p.Set(Se)},rebuild:function(ie){if(typeof ie=="boolean"&&(this._rebuild=ie),this._rebuild){var Se=this,$e=0,Ue=this.dom.leading*new p.Number(this.attr("font-size"));this.lines().each(function(){this.dom.newLined&&(Se.textPath()||this.attr("x",Se.attr("x")),this.text()==`
`?$e+=Ue:(this.attr("dy",Ue+$e),$e=0))}),this.fire("rebuild")}return this},build:function(ie){return this._build=!!ie,this},setData:function(ie){return this.dom=ie,this.dom.leading=new p.Number(ie.leading||1.3),this}},construct:{text:function(ie){return this.put(new p.Text).text(ie)},plain:function(ie){return this.put(new p.Text).plain(ie)}}}),p.Tspan=p.invent({create:"tspan",inherit:p.Shape,extend:{text:function(ie){return ie==null?this.node.textContent+(this.dom.newLined?`
`:""):(typeof ie=="function"?ie.call(this,this):this.plain(ie),this)},dx:function(ie){return this.attr("dx",ie)},dy:function(ie){return this.attr("dy",ie)},newLine:function(){var ie=this.parent(p.Text);return this.dom.newLined=!0,this.dy(ie.dom.leading*ie.attr("font-size")).attr("x",ie.x())}}}),p.extend(p.Text,p.Tspan,{plain:function(ie){return this._build===!1&&this.clear(),this.node.appendChild(h.createTextNode(ie)),this},tspan:function(ie){var Se=(this.textPath&&this.textPath()||this).node,$e=new p.Tspan;return this._build===!1&&this.clear(),Se.appendChild($e.node),$e.text(ie)},clear:function(){for(var ie=(this.textPath&&this.textPath()||this).node;ie.hasChildNodes();)ie.removeChild(ie.lastChild);return this},length:function(){return this.node.getComputedTextLength()}}),p.TextPath=p.invent({create:"textPath",inherit:p.Parent,parent:p.Text,construct:{morphArray:p.PathArray,array:function(){var ie=this.track();return ie?ie.array():null},plot:function(ie){var Se=this.track(),$e=null;return Se&&($e=Se.plot(ie)),ie==null?$e:this},track:function(){var ie=this.textPath();if(ie)return ie.reference("href")},textPath:function(){if(this.node.firstChild&&this.node.firstChild.nodeName=="textPath")return p.adopt(this.node.firstChild)}}}),p.Nested=p.invent({create:function(){this.constructor.call(this,p.create("svg")),this.style("overflow","visible")},inherit:p.Container,construct:{nested:function(){return this.put(new p.Nested)}}});var B={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(ie,Se){return Se=="color"?ie:ie+"-"+Se}};function G(ie,Se,$e,Ue){return $e+Ue.replace(p.regex.dots," .")}function re(ie){return ie.toLowerCase().replace(/-(.)/g,function(Se,$e){return $e.toUpperCase()})}function ce(ie){return ie.charAt(0).toUpperCase()+ie.slice(1)}function ue(ie){var Se=ie.toString(16);return Se.length==1?"0"+Se:Se}function ge(ie,Se,$e){if(Se==null||$e==null){var Ue=ie.bbox();Se==null?Se=Ue.width/Ue.height*$e:$e==null&&($e=Ue.height/Ue.width*Se)}return{width:Se,height:$e}}function Ae(ie,Se,$e){return{x:Se*ie.a+$e*ie.c+0,y:Se*ie.b+$e*ie.d+0}}function ke(ie){return{a:ie[0],b:ie[1],c:ie[2],d:ie[3],e:ie[4],f:ie[5]}}function Me(ie){for(var Se=ie.childNodes.length-1;Se>=0;Se--)ie.childNodes[Se]instanceof Ee.SVGElement&&Me(ie.childNodes[Se]);return p.adopt(ie).id(p.eid(ie.nodeName))}function qe(ie){return Math.abs(ie)>1e-37?ie:0}["fill","stroke"].forEach(function(ie){var Se={};Se[ie]=function($e){if($e===void 0)return this;if(typeof $e=="string"||p.Color.isRgb($e)||$e&&typeof $e.fill=="function")this.attr(ie,$e);else for(var Ue=B[ie].length-1;Ue>=0;Ue--)$e[B[ie][Ue]]!=null&&this.attr(B.prefix(ie,B[ie][Ue]),$e[B[ie][Ue]]);return this},p.extend(p.Element,p.FX,Se)}),p.extend(p.Element,p.FX,{translate:function(ie,Se){return this.transform({x:ie,y:Se})},matrix:function(ie){return this.attr("transform",new p.Matrix(arguments.length==6?[].slice.call(arguments):ie))},opacity:function(ie){return this.attr("opacity",ie)},dx:function(ie){return this.x(new p.Number(ie).plus(this instanceof p.FX?0:this.x()),!0)},dy:function(ie){return this.y(new p.Number(ie).plus(this instanceof p.FX?0:this.y()),!0)}}),p.extend(p.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(ie){return this.node.getPointAtLength(ie)}}),p.Set=p.invent({create:function(ie){Array.isArray(ie)?this.members=ie:this.clear()},extend:{add:function(){for(var ie=[].slice.call(arguments),Se=0,$e=ie.length;Se<$e;Se++)this.members.push(ie[Se]);return this},remove:function(ie){var Se=this.index(ie);return Se>-1&&this.members.splice(Se,1),this},each:function(ie){for(var Se=0,$e=this.members.length;Se<$e;Se++)ie.apply(this.members[Se],[Se,this.members]);return this},clear:function(){return this.members=[],this},length:function(){return this.members.length},has:function(ie){return this.index(ie)>=0},index:function(ie){return this.members.indexOf(ie)},get:function(ie){return this.members[ie]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members}},construct:{set:function(ie){return new p.Set(ie)}}}),p.FX.Set=p.invent({create:function(ie){this.set=ie}}),p.Set.inherit=function(){var ie=[];for(var Se in p.Shape.prototype)typeof p.Shape.prototype[Se]=="function"&&typeof p.Set.prototype[Se]!="function"&&ie.push(Se);for(var Se in ie.forEach(function(Ue){p.Set.prototype[Ue]=function(){for(var _e=0,st=this.members.length;_e<st;_e++)this.members[_e]&&typeof this.members[_e][Ue]=="function"&&this.members[_e][Ue].apply(this.members[_e],arguments);return Ue=="animate"?this.fx||(this.fx=new p.FX.Set(this)):this}}),ie=[],p.FX.prototype)typeof p.FX.prototype[Se]=="function"&&typeof p.FX.Set.prototype[Se]!="function"&&ie.push(Se);ie.forEach(function($e){p.FX.Set.prototype[$e]=function(){for(var Ue=0,_e=this.set.members.length;Ue<_e;Ue++)this.set.members[Ue].fx[$e].apply(this.set.members[Ue].fx,arguments);return this}})},p.extend(p.Element,{}),p.extend(p.Element,{remember:function(ie,Se){if(T(arguments[0])==="object")for(var $e in ie)this.remember($e,ie[$e]);else{if(arguments.length==1)return this.memory()[ie];this.memory()[ie]=Se}return this},forget:function(){if(arguments.length==0)this._memory={};else for(var ie=arguments.length-1;ie>=0;ie--)delete this.memory()[arguments[ie]];return this},memory:function(){return this._memory||(this._memory={})}}),p.get=function(ie){var Se=h.getElementById(function($e){var Ue=($e||"").toString().match(p.regex.reference);if(Ue)return Ue[1]}(ie)||ie);return p.adopt(Se)},p.select=function(ie,Se){return new p.Set(p.utils.map((Se||h).querySelectorAll(ie),function($e){return p.adopt($e)}))},p.extend(p.Parent,{select:function(ie){return p.select(ie,this.node)}});var Fe="abcdef".split("");if(typeof Ee.CustomEvent!="function"){var at=function(ie,Se){Se=Se||{bubbles:!1,cancelable:!1,detail:void 0};var $e=h.createEvent("CustomEvent");return $e.initCustomEvent(ie,Se.bubbles,Se.cancelable,Se.detail),$e};at.prototype=Ee.Event.prototype,p.CustomEvent=at}else p.CustomEvent=Ee.CustomEvent;return p},T(e)==="object"?t.exports=bn.document?Dt(bn,bn.document):function(Ee){return Dt(Ee,Ee.document)}:bn.SVG=Dt(bn,bn.document),(function(){SVG.Filter=SVG.invent({create:"filter",inherit:SVG.Parent,extend:{source:"SourceGraphic",sourceAlpha:"SourceAlpha",background:"BackgroundImage",backgroundAlpha:"BackgroundAlpha",fill:"FillPaint",stroke:"StrokePaint",autoSetIn:!0,put:function(I,B){return this.add(I,B),!I.attr("in")&&this.autoSetIn&&I.attr("in",this.source),I.attr("result")||I.attr("result",I),I},blend:function(I,B,G){return this.put(new SVG.BlendEffect(I,B,G))},colorMatrix:function(I,B){return this.put(new SVG.ColorMatrixEffect(I,B))},convolveMatrix:function(I){return this.put(new SVG.ConvolveMatrixEffect(I))},componentTransfer:function(I){return this.put(new SVG.ComponentTransferEffect(I))},composite:function(I,B,G){return this.put(new SVG.CompositeEffect(I,B,G))},flood:function(I,B){return this.put(new SVG.FloodEffect(I,B))},offset:function(I,B){return this.put(new SVG.OffsetEffect(I,B))},image:function(I){return this.put(new SVG.ImageEffect(I))},merge:function(){var I=[void 0];for(var B in arguments)I.push(arguments[B]);return this.put(new(SVG.MergeEffect.bind.apply(SVG.MergeEffect,I)))},gaussianBlur:function(I,B){return this.put(new SVG.GaussianBlurEffect(I,B))},morphology:function(I,B){return this.put(new SVG.MorphologyEffect(I,B))},diffuseLighting:function(I,B,G){return this.put(new SVG.DiffuseLightingEffect(I,B,G))},displacementMap:function(I,B,G,re,ce){return this.put(new SVG.DisplacementMapEffect(I,B,G,re,ce))},specularLighting:function(I,B,G,re){return this.put(new SVG.SpecularLightingEffect(I,B,G,re))},tile:function(){return this.put(new SVG.TileEffect)},turbulence:function(I,B,G,re,ce){return this.put(new SVG.TurbulenceEffect(I,B,G,re,ce))},toString:function(){return"url(#"+this.attr("id")+")"}}}),SVG.extend(SVG.Defs,{filter:function(I){var B=this.put(new SVG.Filter);return typeof I=="function"&&I.call(B,B),B}}),SVG.extend(SVG.Container,{filter:function(I){return this.defs().filter(I)}}),SVG.extend(SVG.Element,SVG.G,SVG.Nested,{filter:function(I){return this.filterer=I instanceof SVG.Element?I:this.doc().filter(I),this.doc()&&this.filterer.doc()!==this.doc()&&this.doc().defs().add(this.filterer),this.attr("filter",this.filterer),this.filterer},unfilter:function(I){return this.filterer&&I===!0&&this.filterer.remove(),delete this.filterer,this.attr("filter",null)}}),SVG.Effect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(I){return I==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",I)},result:function(I){return I==null?this.attr("result"):this.attr("result",I)},toString:function(){return this.result()}}}),SVG.ParentEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Parent,extend:{in:function(I){return I==null?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",I)},result:function(I){return I==null?this.attr("result"):this.attr("result",I)},toString:function(){return this.result()}}});var Ee={blend:function(I,B){return this.parent()&&this.parent().blend(this,I,B)},colorMatrix:function(I,B){return this.parent()&&this.parent().colorMatrix(I,B).in(this)},convolveMatrix:function(I){return this.parent()&&this.parent().convolveMatrix(I).in(this)},componentTransfer:function(I){return this.parent()&&this.parent().componentTransfer(I).in(this)},composite:function(I,B){return this.parent()&&this.parent().composite(this,I,B)},flood:function(I,B){return this.parent()&&this.parent().flood(I,B)},offset:function(I,B){return this.parent()&&this.parent().offset(I,B).in(this)},image:function(I){return this.parent()&&this.parent().image(I)},merge:function(){return this.parent()&&this.parent().merge.apply(this.parent(),[this].concat(arguments))},gaussianBlur:function(I,B){return this.parent()&&this.parent().gaussianBlur(I,B).in(this)},morphology:function(I,B){return this.parent()&&this.parent().morphology(I,B).in(this)},diffuseLighting:function(I,B,G){return this.parent()&&this.parent().diffuseLighting(I,B,G).in(this)},displacementMap:function(I,B,G,re){return this.parent()&&this.parent().displacementMap(this,I,B,G,re)},specularLighting:function(I,B,G,re){return this.parent()&&this.parent().specularLighting(I,B,G,re).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(I,B,G,re,ce){return this.parent()&&this.parent().turbulence(I,B,G,re,ce).in(this)}};SVG.extend(SVG.Effect,Ee),SVG.extend(SVG.ParentEffect,Ee),SVG.ChildEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(I){this.attr("in",I)}}});var h={blend:function(I,B,G){this.attr({in:I,in2:B,mode:G||"normal"})},colorMatrix:function(I,B){I=="matrix"&&(B=_(B)),this.attr({type:I,values:B===void 0?null:B})},convolveMatrix:function(I){I=_(I),this.attr({order:Math.sqrt(I.split(" ").length),kernelMatrix:I})},composite:function(I,B,G){this.attr({in:I,in2:B,operator:G})},flood:function(I,B){this.attr("flood-color",I),B!=null&&this.attr("flood-opacity",B)},offset:function(I,B){this.attr({dx:I,dy:B})},image:function(I){this.attr("href",I,SVG.xlink)},displacementMap:function(I,B,G,re,ce){this.attr({in:I,in2:B,scale:G,xChannelSelector:re,yChannelSelector:ce})},gaussianBlur:function(I,B){I!=null||B!=null?this.attr("stdDeviation",function(G){if(!Array.isArray(G))return G;for(var re=0,ce=G.length,ue=[];re<ce;re++)ue.push(G[re]);return ue.join(" ")}(Array.prototype.slice.call(arguments))):this.attr("stdDeviation","0 0")},morphology:function(I,B){this.attr({operator:I,radius:B})},tile:function(){},turbulence:function(I,B,G,re,ce){this.attr({numOctaves:B,seed:G,stitchTiles:re,baseFrequency:I,type:ce})}},p={merge:function(){var I;if(arguments[0]instanceof SVG.Set){var B=this;arguments[0].each(function(re){this instanceof SVG.MergeNode?B.put(this):(this instanceof SVG.Effect||this instanceof SVG.ParentEffect)&&B.put(new SVG.MergeNode(this))})}else{I=Array.isArray(arguments[0])?arguments[0]:arguments;for(var G=0;G<I.length;G++)I[G]instanceof SVG.MergeNode?this.put(I[G]):this.put(new SVG.MergeNode(I[G]))}},componentTransfer:function(I){if(this.rgb=new SVG.Set,["r","g","b","a"].forEach((function(G){this[G]=new SVG["Func"+G.toUpperCase()]("identity"),this.rgb.add(this[G]),this.node.appendChild(this[G].node)}).bind(this)),I)for(var B in I.rgb&&(["r","g","b"].forEach((function(G){this[G].attr(I.rgb)}).bind(this)),delete I.rgb),I)this[B].attr(I[B])},diffuseLighting:function(I,B,G){this.attr({surfaceScale:I,diffuseConstant:B,kernelUnitLength:G})},specularLighting:function(I,B,G,re){this.attr({surfaceScale:I,diffuseConstant:B,specularExponent:G,kernelUnitLength:re})}},S={distantLight:function(I,B){this.attr({azimuth:I,elevation:B})},pointLight:function(I,B,G){this.attr({x:I,y:B,z:G})},spotLight:function(I,B,G,re,ce,ue){this.attr({x:I,y:B,z:G,pointsAtX:re,pointsAtY:ce,pointsAtZ:ue})},mergeNode:function(I){this.attr("in",I)}};function _(I){return Array.isArray(I)&&(I=new SVG.Array(I)),I.toString().replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ")}function k(){var I=function(){};for(var B in typeof arguments[arguments.length-1]=="function"&&(I=arguments[arguments.length-1],Array.prototype.splice.call(arguments,arguments.length-1,1)),arguments)for(var G in arguments[B])I(arguments[B][G],G,arguments[B])}["r","g","b","a"].forEach(function(I){S["Func"+I.toUpperCase()]=function(B){switch(this.attr("type",B),B){case"table":this.attr("tableValues",arguments[1]);break;case"linear":this.attr("slope",arguments[1]),this.attr("intercept",arguments[2]);break;case"gamma":this.attr("amplitude",arguments[1]),this.attr("exponent",arguments[2]),this.attr("offset",arguments[2])}}}),k(h,function(I,B){var G=B.charAt(0).toUpperCase()+B.slice(1);SVG[G+"Effect"]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+G)),I.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.Effect,extend:{}})}),k(p,function(I,B){var G=B.charAt(0).toUpperCase()+B.slice(1);SVG[G+"Effect"]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+G)),I.apply(this,arguments),this.result(this.attr("id")+"Out")},inherit:SVG.ParentEffect,extend:{}})}),k(S,function(I,B){var G=B.charAt(0).toUpperCase()+B.slice(1);SVG[G]=SVG.invent({create:function(){this.constructor.call(this,SVG.create("fe"+G)),I.apply(this,arguments)},inherit:SVG.ChildEffect,extend:{}})}),SVG.extend(SVG.MergeEffect,{in:function(I){return I instanceof SVG.MergeNode?this.add(I,0):this.add(new SVG.MergeNode(I),0),this}}),SVG.extend(SVG.CompositeEffect,SVG.BlendEffect,SVG.DisplacementMapEffect,{in2:function(I){return I==null?this.parent()&&this.parent().select('[result="'+this.attr("in2")+'"]').get(0)||this.attr("in2"):this.attr("in2",I)}}),SVG.filter={sepiatone:[.343,.669,.119,0,0,.249,.626,.13,0,0,.172,.334,.111,0,0,0,0,0,1,0]}}).call(void 0),function(){function Ee(k,I,B,G,re,ce,ue){for(var ge=k.slice(I,B||ue),Ae=G.slice(re,ce||ue),ke=0,Me={pos:[0,0],start:[0,0]},qe={pos:[0,0],start:[0,0]};ge[ke]=h.call(Me,ge[ke]),Ae[ke]=h.call(qe,Ae[ke]),ge[ke][0]!=Ae[ke][0]||ge[ke][0]=="M"||ge[ke][0]=="A"&&(ge[ke][4]!=Ae[ke][4]||ge[ke][5]!=Ae[ke][5])?(Array.prototype.splice.apply(ge,[ke,1].concat(S.call(Me,ge[ke]))),Array.prototype.splice.apply(Ae,[ke,1].concat(S.call(qe,Ae[ke])))):(ge[ke]=p.call(Me,ge[ke]),Ae[ke]=p.call(qe,Ae[ke])),!(++ke==ge.length&&ke==Ae.length);)ke==ge.length&&ge.push(["C",Me.pos[0],Me.pos[1],Me.pos[0],Me.pos[1],Me.pos[0],Me.pos[1]]),ke==Ae.length&&Ae.push(["C",qe.pos[0],qe.pos[1],qe.pos[0],qe.pos[1],qe.pos[0],qe.pos[1]]);return{start:ge,dest:Ae}}function h(k){switch(k[0]){case"z":case"Z":k[0]="L",k[1]=this.start[0],k[2]=this.start[1];break;case"H":k[0]="L",k[2]=this.pos[1];break;case"V":k[0]="L",k[2]=k[1],k[1]=this.pos[0];break;case"T":k[0]="Q",k[3]=k[1],k[4]=k[2],k[1]=this.reflection[1],k[2]=this.reflection[0];break;case"S":k[0]="C",k[6]=k[4],k[5]=k[3],k[4]=k[2],k[3]=k[1],k[2]=this.reflection[1],k[1]=this.reflection[0]}return k}function p(k){var I=k.length;return this.pos=[k[I-2],k[I-1]],"SCQT".indexOf(k[0])!=-1&&(this.reflection=[2*this.pos[0]-k[I-4],2*this.pos[1]-k[I-3]]),k}function S(k){var I=[k];switch(k[0]){case"M":return this.pos=this.start=[k[1],k[2]],I;case"L":k[5]=k[3]=k[1],k[6]=k[4]=k[2],k[1]=this.pos[0],k[2]=this.pos[1];break;case"Q":k[6]=k[4],k[5]=k[3],k[4]=1*k[4]/3+2*k[2]/3,k[3]=1*k[3]/3+2*k[1]/3,k[2]=1*this.pos[1]/3+2*k[2]/3,k[1]=1*this.pos[0]/3+2*k[1]/3;break;case"A":I=function(B,G){var re,ce,ue,ge,Ae,ke,Me,qe,Fe,at,ie,Se,$e,Ue,_e,st,ut,yt,Mt,Kt,un,Xe,Pt,Wt,ct,Ge,Tt=Math.abs(G[1]),fn=Math.abs(G[2]),Yn=G[3]%360,Fn=G[4],Gn=G[5],Sr=G[6],ur=G[7],kr=new SVG.Point(B),Bn=new SVG.Point(Sr,ur),Sn=[];if(Tt===0||fn===0||kr.x===Bn.x&&kr.y===Bn.y)return[["C",kr.x,kr.y,Bn.x,Bn.y,Bn.x,Bn.y]];for(re=new SVG.Point((kr.x-Bn.x)/2,(kr.y-Bn.y)/2).transform(new SVG.Matrix().rotate(Yn)),(ce=re.x*re.x/(Tt*Tt)+re.y*re.y/(fn*fn))>1&&(Tt*=ce=Math.sqrt(ce),fn*=ce),ue=new SVG.Matrix().rotate(Yn).scale(1/Tt,1/fn).rotate(-Yn),kr=kr.transform(ue),Bn=Bn.transform(ue),ge=[Bn.x-kr.x,Bn.y-kr.y],ke=ge[0]*ge[0]+ge[1]*ge[1],Ae=Math.sqrt(ke),ge[0]/=Ae,ge[1]/=Ae,Me=ke<4?Math.sqrt(1-ke/4):0,Fn===Gn&&(Me*=-1),qe=new SVG.Point((Bn.x+kr.x)/2+Me*-ge[1],(Bn.y+kr.y)/2+Me*ge[0]),Fe=new SVG.Point(kr.x-qe.x,kr.y-qe.y),at=new SVG.Point(Bn.x-qe.x,Bn.y-qe.y),ie=Math.acos(Fe.x/Math.sqrt(Fe.x*Fe.x+Fe.y*Fe.y)),Fe.y<0&&(ie*=-1),Se=Math.acos(at.x/Math.sqrt(at.x*at.x+at.y*at.y)),at.y<0&&(Se*=-1),Gn&&ie>Se&&(Se+=2*Math.PI),!Gn&&ie<Se&&(Se-=2*Math.PI),Ue=Math.ceil(2*Math.abs(ie-Se)/Math.PI),st=[],ut=ie,$e=(Se-ie)/Ue,_e=4*Math.tan($e/4)/3,un=0;un<=Ue;un++)Mt=Math.cos(ut),yt=Math.sin(ut),Kt=new SVG.Point(qe.x+Mt,qe.y+yt),st[un]=[new SVG.Point(Kt.x+_e*yt,Kt.y-_e*Mt),Kt,new SVG.Point(Kt.x-_e*yt,Kt.y+_e*Mt)],ut+=$e;for(st[0][0]=st[0][1].clone(),st[st.length-1][2]=st[st.length-1][1].clone(),ue=new SVG.Matrix().rotate(Yn).scale(Tt,fn).rotate(-Yn),un=0,Xe=st.length;un<Xe;un++)st[un][0]=st[un][0].transform(ue),st[un][1]=st[un][1].transform(ue),st[un][2]=st[un][2].transform(ue);for(un=1,Xe=st.length;un<Xe;un++)Pt=(Kt=st[un-1][2]).x,Wt=Kt.y,ct=(Kt=st[un][0]).x,Ge=Kt.y,Sr=(Kt=st[un][1]).x,ur=Kt.y,Sn.push(["C",Pt,Wt,ct,Ge,Sr,ur]);return Sn}(this.pos,k),k=I[0]}return k[0]="C",this.pos=[k[5],k[6]],this.reflection=[2*k[5]-k[3],2*k[6]-k[4]],I}function _(k,I){if(I===!1)return!1;for(var B=I,G=k.length;B<G;++B)if(k[B][0]=="M")return B;return!1}SVG.extend(SVG.PathArray,{morph:function(k){for(var I=this.value,B=this.parse(k),G=0,re=0,ce=!1,ue=!1;G!==!1||re!==!1;){var ge;ce=_(I,G!==!1&&G+1),ue=_(B,re!==!1&&re+1),G===!1&&(G=(ge=new SVG.PathArray(Ae.start).bbox()).height==0||ge.width==0?I.push(I[0])-1:I.push(["M",ge.x+ge.width/2,ge.y+ge.height/2])-1),re===!1&&(re=(ge=new SVG.PathArray(Ae.dest).bbox()).height==0||ge.width==0?B.push(B[0])-1:B.push(["M",ge.x+ge.width/2,ge.y+ge.height/2])-1);var Ae=Ee(I,G,ce,B,re,ue);I=I.slice(0,G).concat(Ae.start,ce===!1?[]:I.slice(ce)),B=B.slice(0,re).concat(Ae.dest,ue===!1?[]:B.slice(ue)),G=ce!==!1&&G+Ae.start.length,re=ue!==!1&&re+Ae.dest.length}return this.value=I,this.destination=new SVG.PathArray,this.destination.value=B,this}})}(),(function(){function Ee(h){h.remember("_draggable",this),this.el=h}Ee.prototype.init=function(h,p){var S=this;this.constraint=h,this.value=p,this.el.on("mousedown.drag",function(_){S.start(_)}),this.el.on("touchstart.drag",function(_){S.start(_)})},Ee.prototype.transformPoint=function(h,p){var S=(h=h||window.event).changedTouches&&h.changedTouches[0]||h;return this.p.x=S.clientX-(p||0),this.p.y=S.clientY,this.p.matrixTransform(this.m)},Ee.prototype.getBBox=function(){var h=this.el.bbox();return this.el instanceof SVG.Nested&&(h=this.el.rbox()),(this.el instanceof SVG.G||this.el instanceof SVG.Use||this.el instanceof SVG.Nested)&&(h.x=this.el.x(),h.y=this.el.y()),h},Ee.prototype.start=function(h){if(h.type!="click"&&h.type!="mousedown"&&h.type!="mousemove"||(h.which||h.buttons)==1){var p=this;if(this.el.fire("beforedrag",{event:h,handler:this}),!this.el.event().defaultPrevented){h.preventDefault(),h.stopPropagation(),this.parent=this.parent||this.el.parent(SVG.Nested)||this.el.parent(SVG.Doc),this.p=this.parent.node.createSVGPoint(),this.m=this.el.node.getScreenCTM().inverse();var S,_=this.getBBox();if(this.el instanceof SVG.Text)switch(S=this.el.node.getComputedTextLength(),this.el.attr("text-anchor")){case"middle":S/=2;break;case"start":S=0}this.startPoints={point:this.transformPoint(h,S),box:_,transform:this.el.transform()},SVG.on(window,"mousemove.drag",function(k){p.drag(k)}),SVG.on(window,"touchmove.drag",function(k){p.drag(k)}),SVG.on(window,"mouseup.drag",function(k){p.end(k)}),SVG.on(window,"touchend.drag",function(k){p.end(k)}),this.el.fire("dragstart",{event:h,p:this.startPoints.point,m:this.m,handler:this})}}},Ee.prototype.drag=function(h){var p=this.getBBox(),S=this.transformPoint(h),_=this.startPoints.box.x+S.x-this.startPoints.point.x,k=this.startPoints.box.y+S.y-this.startPoints.point.y,I=this.constraint,B=S.x-this.startPoints.point.x,G=S.y-this.startPoints.point.y;if(this.el.fire("dragmove",{event:h,p:S,m:this.m,handler:this}),this.el.event().defaultPrevented)return S;if(typeof I=="function"){var re=I.call(this.el,_,k,this.m);typeof re=="boolean"&&(re={x:re,y:re}),re.x===!0?this.el.x(_):re.x!==!1&&this.el.x(re.x),re.y===!0?this.el.y(k):re.y!==!1&&this.el.y(re.y)}else typeof I=="object"&&(I.minX!=null&&_<I.minX?B=(_=I.minX)-this.startPoints.box.x:I.maxX!=null&&_>I.maxX-p.width&&(B=(_=I.maxX-p.width)-this.startPoints.box.x),I.minY!=null&&k<I.minY?G=(k=I.minY)-this.startPoints.box.y:I.maxY!=null&&k>I.maxY-p.height&&(G=(k=I.maxY-p.height)-this.startPoints.box.y),I.snapToGrid!=null&&(_-=_%I.snapToGrid,k-=k%I.snapToGrid,B-=B%I.snapToGrid,G-=G%I.snapToGrid),this.el instanceof SVG.G?this.el.matrix(this.startPoints.transform).transform({x:B,y:G},!0):this.el.move(_,k));return S},Ee.prototype.end=function(h){var p=this.drag(h);this.el.fire("dragend",{event:h,p,m:this.m,handler:this}),SVG.off(window,"mousemove.drag"),SVG.off(window,"touchmove.drag"),SVG.off(window,"mouseup.drag"),SVG.off(window,"touchend.drag")},SVG.extend(SVG.Element,{draggable:function(h,p){typeof h!="function"&&typeof h!="object"||(p=h,h=!0);var S=this.remember("_draggable")||new Ee(this);return(h=h===void 0||h)?S.init(p||{},h):(this.off("mousedown.drag"),this.off("touchstart.drag")),this}})}).call(void 0),function(){function Ee(h){this.el=h,h.remember("_selectHandler",this),this.pointSelection={isSelected:!1},this.rectSelection={isSelected:!1},this.pointsList={lt:[0,0],rt:["width",0],rb:["width","height"],lb:[0,"height"],t:["width",0],r:["width","height"],b:["width","height"],l:[0,"height"]},this.pointCoord=function(p,S,_){var k=typeof p!="string"?p:S[p];return _?k/2:k},this.pointCoords=function(p,S){var _=this.pointsList[p];return{x:this.pointCoord(_[0],S,p==="t"||p==="b"),y:this.pointCoord(_[1],S,p==="r"||p==="l")}}}Ee.prototype.init=function(h,p){var S=this.el.bbox();this.options={};var _=this.el.selectize.defaults.points;for(var k in this.el.selectize.defaults)this.options[k]=this.el.selectize.defaults[k],p[k]!==void 0&&(this.options[k]=p[k]);var I=["points","pointsExclude"];for(var k in I){var B=this.options[I[k]];typeof B=="string"?B=B.length>0?B.split(/\s*,\s*/i):[]:typeof B=="boolean"&&I[k]==="points"&&(B=B?_:[]),this.options[I[k]]=B}this.options.points=[_,this.options.points].reduce(function(G,re){return G.filter(function(ce){return re.indexOf(ce)>-1})}),this.options.points=[this.options.points,this.options.pointsExclude].reduce(function(G,re){return G.filter(function(ce){return re.indexOf(ce)<0})}),this.parent=this.el.parent(),this.nested=this.nested||this.parent.group(),this.nested.matrix(new SVG.Matrix(this.el).translate(S.x,S.y)),this.options.deepSelect&&["line","polyline","polygon"].indexOf(this.el.type)!==-1?this.selectPoints(h):this.selectRect(h),this.observe(),this.cleanup()},Ee.prototype.selectPoints=function(h){return this.pointSelection.isSelected=h,this.pointSelection.set||(this.pointSelection.set=this.parent.set(),this.drawPoints()),this},Ee.prototype.getPointArray=function(){var h=this.el.bbox();return this.el.array().valueOf().map(function(p){return[p[0]-h.x,p[1]-h.y]})},Ee.prototype.drawPoints=function(){for(var h=this,p=this.getPointArray(),S=0,_=p.length;S<_;++S){var k=function(B){return function(G){(G=G||window.event).preventDefault?G.preventDefault():G.returnValue=!1,G.stopPropagation();var re=G.pageX||G.touches[0].pageX,ce=G.pageY||G.touches[0].pageY;h.el.fire("point",{x:re,y:ce,i:B,event:G})}}(S),I=this.drawPoint(p[S][0],p[S][1]).addClass(this.options.classPoints).addClass(this.options.classPoints+"_point").on("touchstart",k).on("mousedown",k);this.pointSelection.set.add(I)}},Ee.prototype.drawPoint=function(h,p){var S=this.options.pointType;switch(S){case"circle":return this.drawCircle(h,p);case"rect":return this.drawRect(h,p);default:if(typeof S=="function")return S.call(this,h,p);throw new Error("Unknown "+S+" point type!")}},Ee.prototype.drawCircle=function(h,p){return this.nested.circle(this.options.pointSize).center(h,p)},Ee.prototype.drawRect=function(h,p){return this.nested.rect(this.options.pointSize,this.options.pointSize).center(h,p)},Ee.prototype.updatePointSelection=function(){var h=this.getPointArray();this.pointSelection.set.each(function(p){this.cx()===h[p][0]&&this.cy()===h[p][1]||this.center(h[p][0],h[p][1])})},Ee.prototype.updateRectSelection=function(){var h=this,p=this.el.bbox();if(this.rectSelection.set.get(0).attr({width:p.width,height:p.height}),this.options.points.length&&this.options.points.map(function(_,k){var I=h.pointCoords(_,p);h.rectSelection.set.get(k+1).center(I.x,I.y)}),this.options.rotationPoint){var S=this.rectSelection.set.length();this.rectSelection.set.get(S-1).center(p.width/2,20)}},Ee.prototype.selectRect=function(h){var p=this,S=this.el.bbox();function _(B){return function(G){(G=G||window.event).preventDefault?G.preventDefault():G.returnValue=!1,G.stopPropagation();var re=G.pageX||G.touches[0].pageX,ce=G.pageY||G.touches[0].pageY;p.el.fire(B,{x:re,y:ce,event:G})}}if(this.rectSelection.isSelected=h,this.rectSelection.set=this.rectSelection.set||this.parent.set(),this.rectSelection.set.get(0)||this.rectSelection.set.add(this.nested.rect(S.width,S.height).addClass(this.options.classRect)),this.options.points.length&&this.rectSelection.set.length()<2&&(this.options.points.map(function(B,G){var re=p.pointCoords(B,S),ce=p.drawPoint(re.x,re.y).attr("class",p.options.classPoints+"_"+B).on("mousedown",_(B)).on("touchstart",_(B));p.rectSelection.set.add(ce)}),this.rectSelection.set.each(function(){this.addClass(p.options.classPoints)})),this.options.rotationPoint&&(this.options.points&&!this.rectSelection.set.get(9)||!this.options.points&&!this.rectSelection.set.get(1))){var k=function(B){(B=B||window.event).preventDefault?B.preventDefault():B.returnValue=!1,B.stopPropagation();var G=B.pageX||B.touches[0].pageX,re=B.pageY||B.touches[0].pageY;p.el.fire("rot",{x:G,y:re,event:B})},I=this.drawPoint(S.width/2,20).attr("class",this.options.classPoints+"_rot").on("touchstart",k).on("mousedown",k);this.rectSelection.set.add(I)}},Ee.prototype.handler=function(){var h=this.el.bbox();this.nested.matrix(new SVG.Matrix(this.el).translate(h.x,h.y)),this.rectSelection.isSelected&&this.updateRectSelection(),this.pointSelection.isSelected&&this.updatePointSelection()},Ee.prototype.observe=function(){var h=this;if(MutationObserver)if(this.rectSelection.isSelected||this.pointSelection.isSelected)this.observerInst=this.observerInst||new MutationObserver(function(){h.handler()}),this.observerInst.observe(this.el.node,{attributes:!0});else try{this.observerInst.disconnect(),delete this.observerInst}catch{}else this.el.off("DOMAttrModified.select"),(this.rectSelection.isSelected||this.pointSelection.isSelected)&&this.el.on("DOMAttrModified.select",function(){h.handler()})},Ee.prototype.cleanup=function(){!this.rectSelection.isSelected&&this.rectSelection.set&&(this.rectSelection.set.each(function(){this.remove()}),this.rectSelection.set.clear(),delete this.rectSelection.set),!this.pointSelection.isSelected&&this.pointSelection.set&&(this.pointSelection.set.each(function(){this.remove()}),this.pointSelection.set.clear(),delete this.pointSelection.set),this.pointSelection.isSelected||this.rectSelection.isSelected||(this.nested.remove(),delete this.nested)},SVG.extend(SVG.Element,{selectize:function(h,p){return typeof h=="object"&&(p=h,h=!0),(this.remember("_selectHandler")||new Ee(this)).init(h===void 0||h,p||{}),this}}),SVG.Element.prototype.selectize.defaults={points:["lt","rt","rb","lb","t","r","b","l"],pointsExclude:[],classRect:"svg_select_boundingRect",classPoints:"svg_select_points",pointSize:7,rotationPoint:!0,deepSelect:!1,pointType:"circle"}}(),function(){(function(){function Ee(h){h.remember("_resizeHandler",this),this.el=h,this.parameters={},this.lastUpdateCall=null,this.p=h.doc().node.createSVGPoint()}Ee.prototype.transformPoint=function(h,p,S){return this.p.x=h-(this.offset.x-window.pageXOffset),this.p.y=p-(this.offset.y-window.pageYOffset),this.p.matrixTransform(S||this.m)},Ee.prototype._extractPosition=function(h){return{x:h.clientX!=null?h.clientX:h.touches[0].clientX,y:h.clientY!=null?h.clientY:h.touches[0].clientY}},Ee.prototype.init=function(h){var p=this;if(this.stop(),h!=="stop"){for(var S in this.options={},this.el.resize.defaults)this.options[S]=this.el.resize.defaults[S],h[S]!==void 0&&(this.options[S]=h[S]);this.el.on("lt.resize",function(_){p.resize(_||window.event)}),this.el.on("rt.resize",function(_){p.resize(_||window.event)}),this.el.on("rb.resize",function(_){p.resize(_||window.event)}),this.el.on("lb.resize",function(_){p.resize(_||window.event)}),this.el.on("t.resize",function(_){p.resize(_||window.event)}),this.el.on("r.resize",function(_){p.resize(_||window.event)}),this.el.on("b.resize",function(_){p.resize(_||window.event)}),this.el.on("l.resize",function(_){p.resize(_||window.event)}),this.el.on("rot.resize",function(_){p.resize(_||window.event)}),this.el.on("point.resize",function(_){p.resize(_||window.event)}),this.update()}},Ee.prototype.stop=function(){return this.el.off("lt.resize"),this.el.off("rt.resize"),this.el.off("rb.resize"),this.el.off("lb.resize"),this.el.off("t.resize"),this.el.off("r.resize"),this.el.off("b.resize"),this.el.off("l.resize"),this.el.off("rot.resize"),this.el.off("point.resize"),this},Ee.prototype.resize=function(h){var p=this;this.m=this.el.node.getScreenCTM().inverse(),this.offset={x:window.pageXOffset,y:window.pageYOffset};var S=this._extractPosition(h.detail.event);if(this.parameters={type:this.el.type,p:this.transformPoint(S.x,S.y),x:h.detail.x,y:h.detail.y,box:this.el.bbox(),rotation:this.el.transform().rotation},this.el.type==="text"&&(this.parameters.fontSize=this.el.attr()["font-size"]),h.detail.i!==void 0){var _=this.el.array().valueOf();this.parameters.i=h.detail.i,this.parameters.pointCoords=[_[h.detail.i][0],_[h.detail.i][1]]}switch(h.type){case"lt":this.calc=function(k,I){var B=this.snapToGrid(k,I);if(this.parameters.box.width-B[0]>0&&this.parameters.box.height-B[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x+B[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-B[0]);B=this.checkAspectRatio(B),this.el.move(this.parameters.box.x+B[0],this.parameters.box.y+B[1]).size(this.parameters.box.width-B[0],this.parameters.box.height-B[1])}};break;case"rt":this.calc=function(k,I){var B=this.snapToGrid(k,I,2);if(this.parameters.box.width+B[0]>0&&this.parameters.box.height-B[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x-B[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+B[0]);B=this.checkAspectRatio(B,!0),this.el.move(this.parameters.box.x,this.parameters.box.y+B[1]).size(this.parameters.box.width+B[0],this.parameters.box.height-B[1])}};break;case"rb":this.calc=function(k,I){var B=this.snapToGrid(k,I,0);if(this.parameters.box.width+B[0]>0&&this.parameters.box.height+B[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x-B[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+B[0]);B=this.checkAspectRatio(B),this.el.move(this.parameters.box.x,this.parameters.box.y).size(this.parameters.box.width+B[0],this.parameters.box.height+B[1])}};break;case"lb":this.calc=function(k,I){var B=this.snapToGrid(k,I,1);if(this.parameters.box.width-B[0]>0&&this.parameters.box.height+B[1]>0){if(this.parameters.type==="text")return this.el.move(this.parameters.box.x+B[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-B[0]);B=this.checkAspectRatio(B,!0),this.el.move(this.parameters.box.x+B[0],this.parameters.box.y).size(this.parameters.box.width-B[0],this.parameters.box.height+B[1])}};break;case"t":this.calc=function(k,I){var B=this.snapToGrid(k,I,2);if(this.parameters.box.height-B[1]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y+B[1]).height(this.parameters.box.height-B[1])}};break;case"r":this.calc=function(k,I){var B=this.snapToGrid(k,I,0);if(this.parameters.box.width+B[0]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y).width(this.parameters.box.width+B[0])}};break;case"b":this.calc=function(k,I){var B=this.snapToGrid(k,I,0);if(this.parameters.box.height+B[1]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x,this.parameters.box.y).height(this.parameters.box.height+B[1])}};break;case"l":this.calc=function(k,I){var B=this.snapToGrid(k,I,1);if(this.parameters.box.width-B[0]>0){if(this.parameters.type==="text")return;this.el.move(this.parameters.box.x+B[0],this.parameters.box.y).width(this.parameters.box.width-B[0])}};break;case"rot":this.calc=function(k,I){var B=k+this.parameters.p.x,G=I+this.parameters.p.y,re=Math.atan2(this.parameters.p.y-this.parameters.box.y-this.parameters.box.height/2,this.parameters.p.x-this.parameters.box.x-this.parameters.box.width/2),ce=Math.atan2(G-this.parameters.box.y-this.parameters.box.height/2,B-this.parameters.box.x-this.parameters.box.width/2),ue=this.parameters.rotation+180*(ce-re)/Math.PI+this.options.snapToAngle/2;this.el.center(this.parameters.box.cx,this.parameters.box.cy).rotate(ue-ue%this.options.snapToAngle,this.parameters.box.cx,this.parameters.box.cy)};break;case"point":this.calc=function(k,I){var B=this.snapToGrid(k,I,this.parameters.pointCoords[0],this.parameters.pointCoords[1]),G=this.el.array().valueOf();G[this.parameters.i][0]=this.parameters.pointCoords[0]+B[0],G[this.parameters.i][1]=this.parameters.pointCoords[1]+B[1],this.el.plot(G)}}this.el.fire("resizestart",{dx:this.parameters.x,dy:this.parameters.y,event:h}),SVG.on(window,"touchmove.resize",function(k){p.update(k||window.event)}),SVG.on(window,"touchend.resize",function(){p.done()}),SVG.on(window,"mousemove.resize",function(k){p.update(k||window.event)}),SVG.on(window,"mouseup.resize",function(){p.done()})},Ee.prototype.update=function(h){if(h){var p=this._extractPosition(h),S=this.transformPoint(p.x,p.y),_=S.x-this.parameters.p.x,k=S.y-this.parameters.p.y;this.lastUpdateCall=[_,k],this.calc(_,k),this.el.fire("resizing",{dx:_,dy:k,event:h})}else this.lastUpdateCall&&this.calc(this.lastUpdateCall[0],this.lastUpdateCall[1])},Ee.prototype.done=function(){this.lastUpdateCall=null,SVG.off(window,"mousemove.resize"),SVG.off(window,"mouseup.resize"),SVG.off(window,"touchmove.resize"),SVG.off(window,"touchend.resize"),this.el.fire("resizedone")},Ee.prototype.snapToGrid=function(h,p,S,_){var k;return _!==void 0?k=[(S+h)%this.options.snapToGrid,(_+p)%this.options.snapToGrid]:(S=S??3,k=[(this.parameters.box.x+h+(1&S?0:this.parameters.box.width))%this.options.snapToGrid,(this.parameters.box.y+p+(2&S?0:this.parameters.box.height))%this.options.snapToGrid]),h<0&&(k[0]-=this.options.snapToGrid),p<0&&(k[1]-=this.options.snapToGrid),h-=Math.abs(k[0])<this.options.snapToGrid/2?k[0]:k[0]-(h<0?-this.options.snapToGrid:this.options.snapToGrid),p-=Math.abs(k[1])<this.options.snapToGrid/2?k[1]:k[1]-(p<0?-this.options.snapToGrid:this.options.snapToGrid),this.constraintToBox(h,p,S,_)},Ee.prototype.constraintToBox=function(h,p,S,_){var k,I,B=this.options.constraint||{};return _!==void 0?(k=S,I=_):(k=this.parameters.box.x+(1&S?0:this.parameters.box.width),I=this.parameters.box.y+(2&S?0:this.parameters.box.height)),B.minX!==void 0&&k+h<B.minX&&(h=B.minX-k),B.maxX!==void 0&&k+h>B.maxX&&(h=B.maxX-k),B.minY!==void 0&&I+p<B.minY&&(p=B.minY-I),B.maxY!==void 0&&I+p>B.maxY&&(p=B.maxY-I),[h,p]},Ee.prototype.checkAspectRatio=function(h,p){if(!this.options.saveAspectRatio)return h;var S=h.slice(),_=this.parameters.box.width/this.parameters.box.height,k=this.parameters.box.width+h[0],I=this.parameters.box.height-h[1],B=k/I;return B<_?(S[1]=k/_-this.parameters.box.height,p&&(S[1]=-S[1])):B>_&&(S[0]=this.parameters.box.width-I*_,p&&(S[0]=-S[0])),S},SVG.extend(SVG.Element,{resize:function(h){return(this.remember("_resizeHandler")||new Ee(this)).init(h||{}),this}}),SVG.Element.prototype.resize.defaults={snapToAngle:.1,snapToGrid:1,constraint:{},saveAspectRatio:!1}}).call(this)}(),window.Apex===void 0&&(window.Apex={});var zn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"initModules",value:function(){this.ctx.publicMethods=["updateOptions","updateSeries","appendData","appendSeries","isSeriesHidden","highlightSeries","toggleSeries","showSeries","hideSeries","setLocale","resetSeries","zoomX","toggleDataPointSelection","dataURI","exportToCSV","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","paper","destroy"],this.ctx.eventList=["click","mousedown","mousemove","mouseleave","touchstart","touchmove","touchleave","mouseup","touchend"],this.ctx.animations=new $(this.ctx),this.ctx.axes=new Gt(this.ctx),this.ctx.core=new hr(this.ctx.el,this.ctx),this.ctx.config=new Ce({}),this.ctx.data=new Qe(this.ctx),this.ctx.grid=new tt(this.ctx),this.ctx.graphics=new z(this.ctx),this.ctx.coreUtils=new X(this.ctx),this.ctx.crosshairs=new wt(this.ctx),this.ctx.events=new ht(this.ctx),this.ctx.exports=new Ke(this.ctx),this.ctx.fill=new xe(this.ctx),this.ctx.localization=new pt(this.ctx),this.ctx.options=new W,this.ctx.responsive=new nn(this.ctx),this.ctx.series=new Re(this.ctx),this.ctx.theme=new cn(this.ctx),this.ctx.formatters=new te(this.ctx),this.ctx.titleSubtitle=new Un(this.ctx),this.ctx.legend=new hn(this.ctx),this.ctx.toolbar=new Yt(this.ctx),this.ctx.tooltip=new Lt(this.ctx),this.ctx.dimensions=new Je(this.ctx),this.ctx.updateHelpers=new qt(this.ctx),this.ctx.zoomPanSelection=new Rt(this.ctx),this.ctx.w.globals.tooltip=new Lt(this.ctx)}}]),Ee}(),Zn=function(){function Ee(h){s(this,Ee),this.ctx=h,this.w=h.w}return o(Ee,[{key:"clear",value:function(h){var p=h.isUpdating;this.ctx.zoomPanSelection&&this.ctx.zoomPanSelection.destroy(),this.ctx.toolbar&&this.ctx.toolbar.destroy(),this.ctx.animations=null,this.ctx.axes=null,this.ctx.annotations=null,this.ctx.core=null,this.ctx.data=null,this.ctx.grid=null,this.ctx.series=null,this.ctx.responsive=null,this.ctx.theme=null,this.ctx.formatters=null,this.ctx.titleSubtitle=null,this.ctx.legend=null,this.ctx.dimensions=null,this.ctx.options=null,this.ctx.crosshairs=null,this.ctx.zoomPanSelection=null,this.ctx.updateHelpers=null,this.ctx.toolbar=null,this.ctx.localization=null,this.ctx.w.globals.tooltip=null,this.clearDomElements({isUpdating:p})}},{key:"killSVG",value:function(h){h.each(function(){this.removeClass("*"),this.off(),this.stop()},!0),h.ungroup(),h.clear()}},{key:"clearDomElements",value:function(h){var p=this,S=h.isUpdating,_=this.w.globals.dom.Paper.node;_.parentNode&&_.parentNode.parentNode&&!S&&(_.parentNode.parentNode.style.minHeight="unset");var k=this.w.globals.dom.baseEl;k&&this.ctx.eventList.forEach(function(B){k.removeEventListener(B,p.ctx.events.documentEvent)});var I=this.w.globals.dom;if(this.ctx.el!==null)for(;this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild);this.killSVG(I.Paper),I.Paper.remove(),I.elWrap=null,I.elGraphical=null,I.elLegendWrap=null,I.elLegendForeign=null,I.baseEl=null,I.elGridRect=null,I.elGridRectMask=null,I.elGridRectBarMask=null,I.elGridRectMarkerMask=null,I.elForecastMask=null,I.elNonForecastMask=null,I.elDefs=null}}]),Ee}(),Ft=new WeakMap,En=function(){function Ee(h,p){s(this,Ee),this.opts=p,this.ctx=this,this.w=new we(p).init(),this.el=h,this.w.globals.cuid=F.randomId(),this.w.globals.chartID=this.w.config.chart.id?F.escapeString(this.w.config.chart.id):this.w.globals.cuid,new zn(this).initModules(),this.create=F.bind(this.create,this),this.windowResizeHandler=this._windowResizeHandler.bind(this),this.parentResizeHandler=this._parentResizeCallback.bind(this)}return o(Ee,[{key:"render",value:function(){var h=this;return new Promise(function(p,S){if(h.el!==null){Apex._chartInstances===void 0&&(Apex._chartInstances=[]),h.w.config.chart.id&&Apex._chartInstances.push({id:h.w.globals.chartID,group:h.w.config.chart.group,chart:h}),h.setLocale(h.w.config.chart.defaultLocale);var _=h.w.config.chart.events.beforeMount;typeof _=="function"&&_(h,h.w),h.events.fireEvent("beforeMount",[h,h.w]),window.addEventListener("resize",h.windowResizeHandler),function(ge,Ae){var ke=!1;if(ge.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){var Me=ge.getBoundingClientRect();ge.style.display!=="none"&&Me.width!==0||(ke=!0)}var qe=new ResizeObserver(function(Fe){ke&&Ae.call(ge,Fe),ke=!0});ge.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(ge.children).forEach(function(Fe){return qe.observe(Fe)}):qe.observe(ge),Ft.set(Ae,qe)}(h.el.parentNode,h.parentResizeHandler);var k=h.el.getRootNode&&h.el.getRootNode(),I=F.is("ShadowRoot",k),B=h.el.ownerDocument,G=I?k.getElementById("apexcharts-css"):B.getElementById("apexcharts-css");if(!G){var re;(G=document.createElement("style")).id="apexcharts-css",G.textContent=`@keyframes opaque {
0% {
opacity: 0
}
to {
opacity: 1
}
}
@keyframes resizeanim {
0%,
to {
opacity: 0
}
}
.apexcharts-canvas {
position: relative;
direction: ltr !important;
user-select: none
}
.apexcharts-canvas ::-webkit-scrollbar {
-webkit-appearance: none;
width: 6px
}
.apexcharts-canvas ::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0, 0, 0, .5);
box-shadow: 0 0 1px rgba(255, 255, 255, .5);
-webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5)
}
.apexcharts-inner {
position: relative
}
.apexcharts-text tspan {
font-family: inherit
}
rect.legend-mouseover-inactive,
.legend-mouseover-inactive rect,
.legend-mouseover-inactive path,
.legend-mouseover-inactive circle,
.legend-mouseover-inactive line,
.legend-mouseover-inactive text.apexcharts-yaxis-title-text,
.legend-mouseover-inactive text.apexcharts-yaxis-label {
transition: .15s ease all;
opacity: .2
}
.apexcharts-legend-text {
padding-left: 15px;
margin-left: -15px;
}
.apexcharts-series-collapsed {
opacity: 0
}
.apexcharts-tooltip {
border-radius: 5px;
box-shadow: 2px 2px 6px -4px #999;
cursor: default;
font-size: 14px;
left: 62px;
opacity: 0;
pointer-events: none;
position: absolute;
top: 20px;
display: flex;
flex-direction: column;
overflow: hidden;
white-space: nowrap;
z-index: 12;
transition: .15s ease all
}
.apexcharts-tooltip.apexcharts-active {
opacity: 1;
transition: .15s ease all
}
.apexcharts-tooltip.apexcharts-theme-light {
border: 1px solid #e3e3e3;
background: rgba(255, 255, 255, .96)
}
.apexcharts-tooltip.apexcharts-theme-dark {
color: #fff;
background: rgba(30, 30, 30, .8)
}
.apexcharts-tooltip * {
font-family: inherit
}
.apexcharts-tooltip-title {
padding: 6px;
font-size: 15px;
margin-bottom: 4px
}
.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {
background: #eceff1;
border-bottom: 1px solid #ddd
}
.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {
background: rgba(0, 0, 0, .7);
border-bottom: 1px solid #333
}
.apexcharts-tooltip-text-goals-value,
.apexcharts-tooltip-text-y-value,
.apexcharts-tooltip-text-z-value {
display: inline-block;
margin-left: 5px;
font-weight: 600
}
.apexcharts-tooltip-text-goals-label:empty,
.apexcharts-tooltip-text-goals-value:empty,
.apexcharts-tooltip-text-y-label:empty,
.apexcharts-tooltip-text-y-value:empty,
.apexcharts-tooltip-text-z-value:empty,
.apexcharts-tooltip-title:empty {
display: none
}
.apexcharts-tooltip-text-goals-label,
.apexcharts-tooltip-text-goals-value {
padding: 6px 0 5px
}
.apexcharts-tooltip-goals-group,
.apexcharts-tooltip-text-goals-label,
.apexcharts-tooltip-text-goals-value {
display: flex
}
.apexcharts-tooltip-text-goals-label:not(:empty),
.apexcharts-tooltip-text-goals-value:not(:empty) {
margin-top: -6px
}
.apexcharts-tooltip-marker {
width: 12px;
height: 12px;
position: relative;
top: 0;
margin-right: 10px;
border-radius: 50%
}
.apexcharts-tooltip-series-group {
padding: 0 10px;
display: none;
text-align: left;
justify-content: left;
align-items: center
}
.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {
opacity: 1
}
.apexcharts-tooltip-series-group.apexcharts-active,
.apexcharts-tooltip-series-group:last-child {
padding-bottom: 4px
}
.apexcharts-tooltip-y-group {
padding: 6px 0 5px
}
.apexcharts-custom-tooltip,
.apexcharts-tooltip-box {
padding: 4px 8px
}
.apexcharts-tooltip-boxPlot {
display: flex;
flex-direction: column-reverse
}
.apexcharts-tooltip-box>div {
margin: 4px 0
}
.apexcharts-tooltip-box span.value {
font-weight: 700
}
.apexcharts-tooltip-rangebar {
padding: 5px 8px
}
.apexcharts-tooltip-rangebar .category {
font-weight: 600;
color: #777
}
.apexcharts-tooltip-rangebar .series-name {
font-weight: 700;
display: block;
margin-bottom: 5px
}
.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
opacity: 0;
pointer-events: none;
color: #373d3f;
font-size: 13px;
text-align: center;
border-radius: 2px;
position: absolute;
z-index: 10;
background: #eceff1;
border: 1px solid #90a4ae
}
.apexcharts-xaxistooltip {
padding: 9px 10px;
transition: .15s ease all
}
.apexcharts-xaxistooltip.apexcharts-theme-dark {
background: rgba(0, 0, 0, .7);
border: 1px solid rgba(0, 0, 0, .5);
color: #fff
}
.apexcharts-xaxistooltip:after,
.apexcharts-xaxistooltip:before {
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none
}
.apexcharts-xaxistooltip:after {
border-color: transparent;
border-width: 6px;
margin-left: -6px
}
.apexcharts-xaxistooltip:before {
border-color: transparent;
border-width: 7px;
margin-left: -7px
}
.apexcharts-xaxistooltip-bottom:after,
.apexcharts-xaxistooltip-bottom:before {
bottom: 100%
}
.apexcharts-xaxistooltip-top:after,
.apexcharts-xaxistooltip-top:before {
top: 100%
}
.apexcharts-xaxistooltip-bottom:after {
border-bottom-color: #eceff1
}
.apexcharts-xaxistooltip-bottom:before {
border-bottom-color: #90a4ae
}
.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after,
.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {
border-bottom-color: rgba(0, 0, 0, .5)
}
.apexcharts-xaxistooltip-top:after {
border-top-color: #eceff1
}
.apexcharts-xaxistooltip-top:before {
border-top-color: #90a4ae
}
.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after,
.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {
border-top-color: rgba(0, 0, 0, .5)
}
.apexcharts-xaxistooltip.apexcharts-active {
opacity: 1;
transition: .15s ease all
}
.apexcharts-yaxistooltip {
padding: 4px 10px
}
.apexcharts-yaxistooltip.apexcharts-theme-dark {
background: rgba(0, 0, 0, .7);
border: 1px solid rgba(0, 0, 0, .5);
color: #fff
}
.apexcharts-yaxistooltip:after,
.apexcharts-yaxistooltip:before {
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none
}
.apexcharts-yaxistooltip:after {
border-color: transparent;
border-width: 6px;
margin-top: -6px
}
.apexcharts-yaxistooltip:before {
border-color: transparent;
border-width: 7px;
margin-top: -7px
}
.apexcharts-yaxistooltip-left:after,
.apexcharts-yaxistooltip-left:before {
left: 100%
}
.apexcharts-yaxistooltip-right:after,
.apexcharts-yaxistooltip-right:before {
right: 100%
}
.apexcharts-yaxistooltip-left:after {
border-left-color: #eceff1
}
.apexcharts-yaxistooltip-left:before {
border-left-color: #90a4ae
}
.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after,
.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {
border-left-color: rgba(0, 0, 0, .5)
}
.apexcharts-yaxistooltip-right:after {
border-right-color: #eceff1
}
.apexcharts-yaxistooltip-right:before {
border-right-color: #90a4ae
}
.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after,
.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {
border-right-color: rgba(0, 0, 0, .5)
}
.apexcharts-yaxistooltip.apexcharts-active {
opacity: 1
}
.apexcharts-yaxistooltip-hidden {
display: none
}
.apexcharts-xcrosshairs,
.apexcharts-ycrosshairs {
pointer-events: none;
opacity: 0;
transition: .15s ease all
}
.apexcharts-xcrosshairs.apexcharts-active,
.apexcharts-ycrosshairs.apexcharts-active {
opacity: 1;
transition: .15s ease all
}
.apexcharts-ycrosshairs-hidden {
opacity: 0
}
.apexcharts-selection-rect {
cursor: move
}
.svg_select_boundingRect,
.svg_select_points_rot {
pointer-events: none;
opacity: 0;
visibility: hidden
}
.apexcharts-selection-rect+g .svg_select_boundingRect,
.apexcharts-selection-rect+g .svg_select_points_rot {
opacity: 0;
visibility: hidden
}
.apexcharts-selection-rect+g .svg_select_points_l,
.apexcharts-selection-rect+g .svg_select_points_r {
cursor: ew-resize;
opacity: 1;
visibility: visible
}
.svg_select_points {
fill: #efefef;
stroke: #333;
rx: 2
}
.apexcharts-svg.apexcharts-zoomable.hovering-zoom {
cursor: crosshair
}
.apexcharts-svg.apexcharts-zoomable.hovering-pan {
cursor: move
}
.apexcharts-menu-icon,
.apexcharts-pan-icon,
.apexcharts-reset-icon,
.apexcharts-selection-icon,
.apexcharts-toolbar-custom-icon,
.apexcharts-zoom-icon,
.apexcharts-zoomin-icon,
.apexcharts-zoomout-icon {
cursor: pointer;
width: 20px;
height: 20px;
line-height: 24px;
color: #6e8192;
text-align: center
}
.apexcharts-menu-icon svg,
.apexcharts-reset-icon svg,
.apexcharts-zoom-icon svg,
.apexcharts-zoomin-icon svg,
.apexcharts-zoomout-icon svg {
fill: #6e8192
}
.apexcharts-selection-icon svg {
fill: #444;
transform: scale(.76)
}
.apexcharts-theme-dark .apexcharts-menu-icon svg,
.apexcharts-theme-dark .apexcharts-pan-icon svg,
.apexcharts-theme-dark .apexcharts-reset-icon svg,
.apexcharts-theme-dark .apexcharts-selection-icon svg,
.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg,
.apexcharts-theme-dark .apexcharts-zoom-icon svg,
.apexcharts-theme-dark .apexcharts-zoomin-icon svg,
.apexcharts-theme-dark .apexcharts-zoomout-icon svg {
fill: #f3f4f5
}
.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg,
.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,
.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg {
fill: #008ffb
}
.apexcharts-theme-light .apexcharts-menu-icon:hover svg,
.apexcharts-theme-light .apexcharts-reset-icon:hover svg,
.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,
.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,
.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,
.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg {
fill: #333
}
.apexcharts-menu-icon,
.apexcharts-selection-icon {
position: relative
}
.apexcharts-reset-icon {
margin-left: 5px
}
.apexcharts-menu-icon,
.apexcharts-reset-icon,
.apexcharts-zoom-icon {
transform: scale(.85)
}
.apexcharts-zoomin-icon,
.apexcharts-zoomout-icon {
transform: scale(.7)
}
.apexcharts-zoomout-icon {
margin-right: 3px
}
.apexcharts-pan-icon {
transform: scale(.62);
position: relative;
left: 1px;
top: 0
}
.apexcharts-pan-icon svg {
fill: #fff;
stroke: #6e8192;
stroke-width: 2
}
.apexcharts-pan-icon.apexcharts-selected svg {
stroke: #008ffb
}
.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {
stroke: #333
}
.apexcharts-toolbar {
position: absolute;
z-index: 11;
max-width: 176px;
text-align: right;
border-radius: 3px;
padding: 0 6px 2px;
display: flex;
justify-content: space-between;
align-items: center
}
.apexcharts-menu {
background: #fff;
position: absolute;
top: 100%;
border: 1px solid #ddd;
border-radius: 3px;
padding: 3px;
right: 10px;
opacity: 0;
min-width: 110px;
transition: .15s ease all;
pointer-events: none
}
.apexcharts-menu.apexcharts-menu-open {
opacity: 1;
pointer-events: all;
transition: .15s ease all
}
.apexcharts-menu-item {
padding: 6px 7px;
font-size: 12px;
cursor: pointer
}
.apexcharts-theme-light .apexcharts-menu-item:hover {
background: #eee
}
.apexcharts-theme-dark .apexcharts-menu {
background: rgba(0, 0, 0, .7);
color: #fff
}
@media screen and (min-width:768px) {
.apexcharts-canvas:hover .apexcharts-toolbar {
opacity: 1
}
}
.apexcharts-canvas .apexcharts-element-hidden,
.apexcharts-datalabel.apexcharts-element-hidden,
.apexcharts-hide .apexcharts-series-points {
opacity: 0;
}
.apexcharts-hidden-element-shown {
opacity: 1;
transition: 0.25s ease all;
}
.apexcharts-datalabel,
.apexcharts-datalabel-label,
.apexcharts-datalabel-value,
.apexcharts-datalabels,
.apexcharts-pie-label {
cursor: default;
pointer-events: none
}
.apexcharts-pie-label-delay {
opacity: 0;
animation-name: opaque;
animation-duration: .3s;
animation-fill-mode: forwards;
animation-timing-function: ease
}
.apexcharts-radialbar-label {
cursor: pointer;
}
.apexcharts-annotation-rect,
.apexcharts-area-series .apexcharts-area,
.apexcharts-area-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,
.apexcharts-gridline,
.apexcharts-line,
.apexcharts-line-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,
.apexcharts-point-annotation-label,
.apexcharts-radar-series path:not(.apexcharts-marker),
.apexcharts-radar-series polygon,
.apexcharts-toolbar svg,
.apexcharts-tooltip .apexcharts-marker,
.apexcharts-xaxis-annotation-label,
.apexcharts-yaxis-annotation-label,
.apexcharts-zoom-rect {
pointer-events: none
}
.apexcharts-tooltip-active .apexcharts-marker {
transition: .15s ease all
}
.resize-triggers {
animation: 1ms resizeanim;
visibility: hidden;
opacity: 0;
height: 100%;
width: 100%;
overflow: hidden
}
.contract-trigger:before,
.resize-triggers,
.resize-triggers>div {
content: " ";
display: block;
position: absolute;
top: 0;
left: 0
}
.resize-triggers>div {
height: 100%;
width: 100%;
background: #eee;
overflow: auto
}
.contract-trigger:before {
overflow: hidden;
width: 200%;
height: 200%
}
.apexcharts-bar-goals-markers {
pointer-events: none
}
.apexcharts-bar-shadows {
pointer-events: none
}
.apexcharts-rangebar-goals-markers {
pointer-events: none
}
`;var ce=((re=h.opts.chart)===null||re===void 0?void 0:re.nonce)||h.w.config.chart.nonce;ce&&G.setAttribute("nonce",ce),I?k.prepend(G):B.head.appendChild(G)}var ue=h.create(h.w.config.series,{});if(!ue)return p(h);h.mount(ue).then(function(){typeof h.w.config.chart.events.mounted=="function"&&h.w.config.chart.events.mounted(h,h.w),h.events.fireEvent("mounted",[h,h.w]),p(ue)}).catch(function(ge){S(ge)})}else S(new Error("Element not found"))})}},{key:"create",value:function(h,p){var S=this,_=this.w;new zn(this).initModules();var k=this.w.globals;if(k.noData=!1,k.animationEnded=!1,this.responsive.checkResponsiveConfig(p),_.config.xaxis.convertedCatToNumeric&&new de(_.config).convertCatToNumericXaxis(_.config,this.ctx),this.el===null||(this.core.setupElements(),_.config.chart.type==="treemap"&&(_.config.grid.show=!1,_.config.yaxis[0].show=!1),k.svgWidth===0))return k.animationEnded=!0,null;var I=h;h.forEach(function(ge,Ae){ge.hidden&&(I=S.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:Ae}))});var B=X.checkComboSeries(I,_.config.chart.type);k.comboCharts=B.comboCharts,k.comboBarCount=B.comboBarCount;var G=I.every(function(ge){return ge.data&&ge.data.length===0});(I.length===0||G&&k.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(I),this.theme.init(),new be(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),k.noData&&k.collapsedSeries.length!==k.series.length&&!_.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),k.axisCharts&&(this.core.coreCalculations(),_.config.xaxis.type!=="category"&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=_.globals.minX,this.ctx.toolbar.maxX=_.globals.maxX),this.formatters.heatmapLabelFormatters(),new X(this).getLargestMarkerSize(),this.dimensions.plotCoords();var re=this.core.xySettings();this.grid.createGridMask();var ce=this.core.plotChartType(I,re),ue=new Ie(this);return ue.bringForward(),_.config.dataLabels.background.enabled&&ue.dataLabelsBackground(),this.core.shiftGraphPosition(),{elGraph:ce,xyRatios:re,dimensions:{plot:{left:_.globals.translateX,top:_.globals.translateY,width:_.globals.gridWidth,height:_.globals.gridHeight}}}}},{key:"mount",value:function(){var h=this,p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,S=this,_=S.w;return new Promise(function(k,I){if(S.el===null)return I(new Error("Not enough data to display or target element not found"));(p===null||_.globals.allSeriesCollapsed)&&S.series.handleNoData(),S.grid=new tt(S);var B,G,re=S.grid.drawGrid();if(S.annotations=new V(S),S.annotations.drawImageAnnos(),S.annotations.drawTextAnnos(),_.config.grid.position==="back"&&(re&&_.globals.dom.elGraphical.add(re.el),re!=null&&(B=re.elGridBorders)!==null&&B!==void 0&&B.node&&_.globals.dom.elGraphical.add(re.elGridBorders)),Array.isArray(p.elGraph))for(var ce=0;ce<p.elGraph.length;ce++)_.globals.dom.elGraphical.add(p.elGraph[ce]);else _.globals.dom.elGraphical.add(p.elGraph);_.config.grid.position==="front"&&(re&&_.globals.dom.elGraphical.add(re.el),re!=null&&(G=re.elGridBorders)!==null&&G!==void 0&&G.node&&_.globals.dom.elGraphical.add(re.elGridBorders)),_.config.xaxis.crosshairs.position==="front"&&S.crosshairs.drawXCrosshairs(),_.config.yaxis[0].crosshairs.position==="front"&&S.crosshairs.drawYCrosshairs(),_.config.chart.type!=="treemap"&&S.axes.drawAxis(_.config.chart.type,re);var ue=new dt(h.ctx,re),ge=new Be(h.ctx,re);if(re!==null&&(ue.xAxisLabelCorrections(re.xAxisTickWidth),ge.setYAxisTextAlignments(),_.config.yaxis.map(function(ke,Me){_.globals.ignoreYAxisIndexes.indexOf(Me)===-1&&ge.yAxisTitleRotate(Me,ke.opposite)})),S.annotations.drawAxesAnnotations(),!_.globals.noData){if(_.config.tooltip.enabled&&!_.globals.noData&&S.w.globals.tooltip.drawTooltip(p.xyRatios),_.globals.axisCharts&&(_.globals.isXNumeric||_.config.xaxis.convertedCatToNumeric||_.globals.isRangeBar))(_.config.chart.zoom.enabled||_.config.chart.selection&&_.config.chart.selection.enabled||_.config.chart.pan&&_.config.chart.pan.enabled)&&S.zoomPanSelection.init({xyRatios:p.xyRatios});else{var Ae=_.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach(function(ke){Ae[ke]=!1})}_.config.chart.toolbar.show&&!_.globals.allSeriesCollapsed&&S.toolbar.createToolbar()}_.globals.memory.methodsToExec.length>0&&_.globals.memory.methodsToExec.forEach(function(ke){ke.method(ke.params,!1,ke.context)}),_.globals.axisCharts||_.globals.noData||S.core.resizeNonAxisCharts(),k(S)})}},{key:"destroy",value:function(){var h,p;window.removeEventListener("resize",this.windowResizeHandler),this.el.parentNode,h=this.parentResizeHandler,(p=Ft.get(h))&&(p.disconnect(),Ft.delete(h));var S=this.w.config.chart.id;S&&Apex._chartInstances.forEach(function(_,k){_.id===F.escapeString(S)&&Apex._chartInstances.splice(k,1)}),new Zn(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(h){var p=this,S=arguments.length>1&&arguments[1]!==void 0&&arguments[1],_=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],I=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],B=this.w;return B.globals.selection=void 0,h.series&&(this.series.resetSeries(!1,!0,!1),h.series.length&&h.series[0].data&&(h.series=h.series.map(function(G,re){return p.updateHelpers._extendSeries(G,re)})),this.updateHelpers.revertDefaultAxisMinMax()),h.xaxis&&(h=this.updateHelpers.forceXAxisUpdate(h)),h.yaxis&&(h=this.updateHelpers.forceYAxisUpdate(h)),B.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),h.theme&&(h=this.theme.updateThemeOptions(h)),this.updateHelpers._updateOptions(h,S,_,k,I)}},{key:"updateSeries",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(h,p,S)}},{key:"appendSeries",value:function(h){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],_=this.w.config.series.slice();return _.push(h),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(_,p,S)}},{key:"appendData",value:function(h){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=this;S.w.globals.dataChanged=!0,S.series.getPreviousPaths();for(var _=S.w.config.series.slice(),k=0;k<_.length;k++)if(h[k]!==null&&h[k]!==void 0)for(var I=0;I<h[k].data.length;I++)_[k].data.push(h[k].data[I]);return S.w.config.series=_,p&&(S.w.globals.initialSeries=F.clone(S.w.config.series)),this.update()}},{key:"update",value:function(h){var p=this;return new Promise(function(S,_){new Zn(p.ctx).clear({isUpdating:!0});var k=p.create(p.w.config.series,h);if(!k)return S(p);p.mount(k).then(function(){typeof p.w.config.chart.events.updated=="function"&&p.w.config.chart.events.updated(p,p.w),p.events.fireEvent("updated",[p,p.w]),p.w.globals.isDirty=!0,S(p)}).catch(function(I){_(I)})})}},{key:"getSyncedCharts",value:function(){var h=this.getGroupedCharts(),p=[this];return h.length&&(p=[],h.forEach(function(S){p.push(S)})),p}},{key:"getGroupedCharts",value:function(){var h=this;return Apex._chartInstances.filter(function(p){if(p.group)return!0}).map(function(p){return h.w.config.chart.group===p.group?p.chart:h})}},{key:"toggleSeries",value:function(h){return this.series.toggleSeries(h)}},{key:"highlightSeriesOnLegendHover",value:function(h,p){return this.series.toggleSeriesOnHover(h,p)}},{key:"showSeries",value:function(h){this.series.showSeries(h)}},{key:"hideSeries",value:function(h){this.series.hideSeries(h)}},{key:"highlightSeries",value:function(h){this.series.highlightSeries(h)}},{key:"isSeriesHidden",value:function(h){this.series.isSeriesHidden(h)}},{key:"resetSeries",value:function(){var h=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.series.resetSeries(h,p)}},{key:"addEventListener",value:function(h,p){this.events.addEventListener(h,p)}},{key:"removeEventListener",value:function(h,p){this.events.removeEventListener(h,p)}},{key:"addXaxisAnnotation",value:function(h){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,_=this;S&&(_=S),_.annotations.addXaxisAnnotationExternal(h,p,_)}},{key:"addYaxisAnnotation",value:function(h){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,_=this;S&&(_=S),_.annotations.addYaxisAnnotationExternal(h,p,_)}},{key:"addPointAnnotation",value:function(h){var p=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,_=this;S&&(_=S),_.annotations.addPointAnnotationExternal(h,p,_)}},{key:"clearAnnotations",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,p=this;h&&(p=h),p.annotations.clearAnnotations(p)}},{key:"removeAnnotation",value:function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,S=this;p&&(S=p),S.annotations.removeAnnotation(S,h)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(h,p){return this.coreUtils.getSeriesTotalsXRange(h,p)}},{key:"getHighestValueInSeries",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Le(this.ctx).getMinYMaxY(h).highestY}},{key:"getLowestValueInSeries",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Le(this.ctx).getMinYMaxY(h).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(h,p){return this.updateHelpers.toggleDataPointSelection(h,p)}},{key:"zoomX",value:function(h,p){this.ctx.toolbar.zoomUpdateOptions(h,p)}},{key:"setLocale",value:function(h){this.localization.setCurrentLocaleValues(h)}},{key:"dataURI",value:function(h){return new Ke(this.ctx).dataURI(h)}},{key:"exportToCSV",value:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Ke(this.ctx).exportToCSV(h)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var h=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout(function(){h.w.globals.resized=!0,h.w.globals.dataChanged=!1,h.ctx.update()},150)}},{key:"_windowResizeHandler",value:function(){var h=this.w.config.chart.redrawOnWindowResize;typeof h=="function"&&(h=h()),h&&this._windowResize()}}],[{key:"getChartByID",value:function(h){var p=F.escapeString(h);if(Apex._chartInstances){var S=Apex._chartInstances.filter(function(_){return _.id===p})[0];return S&&S.chart}}},{key:"initOnLoad",value:function(){for(var h=document.querySelectorAll("[data-apexcharts]"),p=0;p<h.length;p++)new Ee(h[p],JSON.parse(h[p].getAttribute("data-options"))).render()}},{key:"exec",value:function(h,p){var S=this.getChartByID(h);if(S){S.w.globals.isExecCalled=!0;var _=null;if(S.publicMethods.indexOf(p)!==-1){for(var k=arguments.length,I=new Array(k>2?k-2:0),B=2;B<k;B++)I[B-2]=arguments[B];_=S[p].apply(S,I)}return _}}},{key:"merge",value:function(h,p){return F.extend(h,p)}}]),Ee}();t.exports=En}(jF,jF.exports)),jF.exports}var G4e;function Qon(){if(G4e)return AF;G4e=1,Object.defineProperty(AF,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},e=Object.assign||function(C){for(var N=1;N<arguments.length;N++){var P,T=arguments[N];for(P in T)Object.prototype.hasOwnProperty.call(T,P)&&(C[P]=T[P])}return C},n=function(){function C(N,P){for(var T=0;T<P.length;T++){var M=P[T];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(N,M.key,M)}}return function(N,P,T){return P&&C(N.prototype,P),T&&C(N,T),N}}(),r=Xon(),s=u(r),a=xx(),o=u(a),l=_U(),c=u(l);function u(C){return C&&C.__esModule?C:{default:C}}function d(C,N,P){return N in C?Object.defineProperty(C,N,{value:P,enumerable:!0,configurable:!0,writable:!0}):C[N]=P,C}function f(C,N){var P,T={};for(P in C)0<=N.indexOf(P)||Object.prototype.hasOwnProperty.call(C,P)&&(T[P]=C[P]);return T}function x(C,N){if(!(C instanceof N))throw new TypeError("Cannot call a class as a function")}function g(C,N){if(C)return!N||typeof N!="object"&&typeof N!="function"?C:N;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function y(C,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);C.prototype=Object.create(N&&N.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(C,N):C.__proto__=N)}window.ApexCharts=s.default;var v=function(){function C(N){x(this,C);var P=g(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,N));return o.default.createRef?P.chartRef=o.default.createRef():P.setRef=function(T){return P.chartRef=T},P.chart=null,P}return y(C,a.Component),n(C,[{key:"render",value:function(){var N=f(this.props,[]);return o.default.createElement("div",e({ref:o.default.createRef?this.chartRef:this.setRef},N))}},{key:"componentDidMount",value:function(){var N=o.default.createRef?this.chartRef.current:this.chartRef;this.chart=new s.default(N,this.getConfig()),this.chart.render()}},{key:"getConfig",value:function(){var F=this.props,N=F.type,P=F.height,T=F.width,M=F.series,F=F.options;return this.extend(F,{chart:{type:N,height:P,width:T},series:M})}},{key:"isObject",value:function(N){return N&&(N===void 0?"undefined":t(N))==="object"&&!Array.isArray(N)&&N!=null}},{key:"extend",value:function(N,P){var T=this,M=(typeof Object.assign!="function"&&(Object.assign=function(F){if(F==null)throw new TypeError("Cannot convert undefined or null to object");for(var $=Object(F),L=1;L<arguments.length;L++){var z=arguments[L];if(z!=null)for(var X in z)z.hasOwnProperty(X)&&($[X]=z[X])}return $}),Object.assign({},N));return this.isObject(N)&&this.isObject(P)&&Object.keys(P).forEach(function(F){T.isObject(P[F])&&F in N?M[F]=T.extend(N[F],P[F]):Object.assign(M,d({},F,P[F]))}),M}},{key:"componentDidUpdate",value:function(N){if(!this.chart)return null;var M=this.props,L=M.options,P=M.series,T=M.height,M=M.width,F=JSON.stringify(N.options),$=JSON.stringify(N.series),L=JSON.stringify(L),z=JSON.stringify(P);F===L&&$===z&&T===N.height&&M===N.width||($!==z&&F===L&&T===N.height&&M===N.width?this.chart.updateSeries(P):this.chart.updateOptions(this.getConfig()))}},{key:"componentWillUnmount",value:function(){this.chart&&typeof this.chart.destroy=="function"&&this.chart.destroy()}}]),C}();return(AF.default=v).propTypes={type:c.default.string.isRequired,width:c.default.oneOfType([c.default.string,c.default.number]),height:c.default.oneOfType([c.default.string,c.default.number]),series:c.default.array.isRequired,options:c.default.object.isRequired},v.defaultProps={type:"line",width:"100%",height:"auto"},AF}var Zon=Qon();const $D=Ii(Zon),Jon=()=>{const[t,e]=m.useState([]),[n,r]=m.useState(localStorage.getItem("discover_period")==0?"day":localStorage.getItem("discover_period")==1?"week":localStorage.getItem("discover_period")==2?"month":localStorage.getItem("discover_period")==3?"threeMonth":"allTime"),[s,a]=m.useState("pnlHistory"),[o,l]=m.useState("perp only"),c=g2(),u=(c==null?void 0:c.walletAddress)||"",d=n==="day",{setLatestPnL:f}=m.useContext(Qr);m.useEffect(()=>{const y=async()=>{var N,P,T,M,F,$,L,z,X,ne,J,K,te,fe,q,se,ae,W,V,ee,oe,de,Ce;const C=o==="combined"?n:`perp${n.charAt(0).toUpperCase()+n.slice(1)}`;try{const we=(await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"portfolio",user:u},{headers:{Accept:"*/*","Content-Type":"application/json"}})).data,be=Date.now()-90*24*60*60*1e3,je=(It,hn=!1)=>{const Yt=(It==null?void 0:It.filter(([Rt])=>Number(Rt)>=be))||[];if(hn&&Yt.length>0){const Rt=parseFloat(Yt[0][1]);return Yt.map(([ot,De])=>[ot,(parseFloat(De)-Rt).toString()])}return Yt},Ie=we.find(It=>It[0]==="allTime"),Re=we.find(It=>It[0]==="perpAllTime"),Qe={accountValueHistory:je((N=Ie==null?void 0:Ie[1])==null?void 0:N.accountValueHistory,!1),pnlHistory:je((P=Ie==null?void 0:Ie[1])==null?void 0:P.pnlHistory,!0),vlm:(T=Ie==null?void 0:Ie[1])==null?void 0:T.vlm},Ke={accountValueHistory:je((M=Re==null?void 0:Re[1])==null?void 0:M.accountValueHistory,!1),pnlHistory:je((F=Re==null?void 0:Re[1])==null?void 0:F.pnlHistory,!0),vlm:($=Re==null?void 0:Re[1])==null?void 0:$.vlm},dt=[...we,["threeMonth",Qe],["perpThreeMonth",Ke]],tt=((z=(L=dt.find(It=>It[0]===C))==null?void 0:L[1])==null?void 0:z[s])||[];e(tt);const nt=o==="combined"?"day":"perpDay",Le=o==="combined"?"week":"perpWeek",Be=o==="combined"?"month":"perpMonth",ht=o==="combined"?"allTime":"perpAllTime",pt=o==="combined"?"threeMonth":"perpThreeMonth",Gt=((ne=(X=dt.find(It=>It[0]===nt))==null?void 0:X[1])==null?void 0:ne.pnlHistory)||[],wt=((K=(J=dt.find(It=>It[0]===Le))==null?void 0:J[1])==null?void 0:K.pnlHistory)||[],nn=((fe=(te=dt.find(It=>It[0]===Be))==null?void 0:te[1])==null?void 0:fe.pnlHistory)||[],cn=((se=(q=dt.find(It=>It[0]===ht))==null?void 0:q[1])==null?void 0:se.pnlHistory)||[],Un=((W=(ae=dt.find(It=>It[0]===pt))==null?void 0:ae[1])==null?void 0:W.pnlHistory)||[],Xt=((V=Gt[Gt.length-1])==null?void 0:V[1])??0,an=((ee=wt[wt.length-1])==null?void 0:ee[1])??0,Jt=((oe=nn[nn.length-1])==null?void 0:oe[1])??0,Ye=((de=Un[Un.length-1])==null?void 0:de[1])??0,Je=((Ce=cn[cn.length-1])==null?void 0:Ce[1])??0;f({activeRange:n,day:Xt,week:an,month:Jt,threeMonth:Ye,all:Je})}catch(me){console.error("Error fetching data:",me)}};y();const v=setInterval(y,3e4);return()=>clearInterval(v)},[n,s,o,u]);const x=m.useMemo(()=>({colors:["#67FFBD"],stroke:{width:3,curve:"smooth"},chart:{type:"area",stacked:!1,background:"transparent",foreColor:"#ffffff",height:"100%",zoom:{type:"x",enabled:!0,autoScaleYaxis:!0},toolbar:{autoSelected:"zoom",show:!1}},theme:{mode:"dark"},grid:{borderColor:"#2E2E2E",strokeDashArray:5,xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},dataLabels:{enabled:!1},markers:{size:0,colors:["#3CAD7C"]},fill:{type:"gradient",gradient:{shadeIntensity:1,inverseColors:!1,opacityFrom:.5,opacityTo:0,stops:[0,90,100],gradientToColors:["#67FFBD52"]}},yaxis:{labels:{formatter:y=>`$${_r(y)}.00`,style:{colors:"#909090",fontSize:"14px",fontWeight:500,fontFamily:"Manrope",letterSpacing:"0.72px"}}},xaxis:{type:"datetime",labels:{style:{colors:"#FFFFFF",fontSize:"12px",fontWeight:500,fontFamily:"Manrope",letterSpacing:"0.72px"},formatter:function(y,v){const C=new Date(v);if(d)return C.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});const N=`'${C.getFullYear().toString().slice(-2)}`;return`${C.toLocaleDateString("en-US",{month:"short",day:"2-digit"}).toUpperCase()} ${N}`}}},tooltip:{custom:function({series:y,seriesIndex:v,dataPointIndex:C,w:N}){var $,L;const P=y[v][C],T=(L=($=N.globals.seriesX)==null?void 0:$[v])==null?void 0:L[C],M=N.globals.seriesNames[v];return`
<div class="p-2 rounded-2xl">
<p class="text-[12px] font-medium text-[#909090]">${T?new Date(T).toLocaleDateString("en-GB",{month:"short",day:"2-digit"}).toUpperCase():"-"}</p>
<div class="text-[14px] font-semibold flex items-center">
<span class="inline-block w-[10px] h-[10px] bg-[#67FFBD] rounded-full mr-1"></span>
<span class="text-[#67FFBD] mr-2">${M}</span>
<span>$${_r(P)}</span>
</div>
</div>`},followCursor:!0,intersect:!1,shared:!0}}),[n]),g=[{name:s==="pnlHistory"?"PnL":"Account Value",data:t.map(([y,v])=>[parseInt(y),parseFloat(v)])}];return i.jsxs("div",{className:"p-0 lg:p-[16px] pb-0 bg-[#1B1B1B] rounded-2xl ml-0 lg:ml-2 mt-2 lg:mt-0 mb-2 lg:mb-0",children:[i.jsxs("div",{className:"flex flex-col lg:flex-row justify-start items-center px-2 lg:px-0",children:[i.jsx("div",{className:"flex justify-center w-full lg:flex-none lg:w-auto bg-[#202020] rounded-2xl p-1 text-[12px] font-semibold mt-2 lg:mt-0",children:["24H","1W","1M","3M","All"].map(y=>i.jsx("button",{className:`flex-1 rounded-2xl hover:border-[#67FFBD] hover:rounded-2xl ${n==={"24H":"day","1W":"week","1M":"month","3M":"threeMonth",All:"allTime"}[y]?"text-white bg-[#353535] rounded-2xl":"text-white bg-transparent"}`,onClick:()=>{r({"24H":"day","1W":"week","1M":"month","3M":"threeMonth",All:"allTime"}[y]),localStorage.setItem("discover_period",{"24H":0,"1W":1,"1M":2,"3M":3,All:4}[y])},children:y},y))}),i.jsx("div",{className:"flex justify-center w-full lg:flex-none lg:w-auto ml-0 lg:ml-auto bg-[#202020] rounded-2xl p-1 text-[12px] font-semibold mr-0 lg:mr-8 mt-2 lg:mt-0",children:["Combined","Perp Only"].map(y=>i.jsx("button",{className:`rounded-2xl hover:border-[#67FFBD] hover:rounded-2xl ${o===y.toLowerCase()?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)] rounded-2xl":"text-white bg-transparent"}`,onClick:()=>l(y.toLowerCase()),children:y},y))}),i.jsx("div",{className:"flex justify-center w-full lg:flex-none lg:w-auto bg-[#202020] rounded-2xl p-1 text-[12px] font-semibold mt-2 lg:mt-0",children:["PnL","Account Value"].map(y=>i.jsx("button",{className:`rounded-2xl hover:border-[#67FFBD] hover:rounded-2xl ${s===(y==="PnL"?"pnlHistory":"accountValueHistory")?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)] rounded-2xl":"text-white bg-transparent"}`,onClick:()=>a(y==="PnL"?"pnlHistory":"accountValueHistory"),children:y},y))})]}),i.jsxs("div",{className:" text-white relative",children:[i.jsxs("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none ",children:[i.jsx("h1",{className:"sr-only",children:"Hyperliquid Wallet Overview & Trade History"}),i.jsx("span",{className:"text-[70px] sm:text-[100px] md:text-[140px] lg:text-[100px] xl:text-[140px] text-gray-600 opacity-20 font-bold font-manrope",children:"dextrabot"})]}),i.jsx($D,{options:x,series:g,type:"area",height:410})]})]})};var rg={},v7={},K4e;function EVe(){if(K4e)return v7;K4e=1,Object.defineProperty(v7,"__esModule",{value:!0}),v7.parseLengthAndUnit=e,v7.cssValue=n;var t={cm:!0,mm:!0,in:!0,px:!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vw:!0,vh:!0,vmin:!0,vmax:!0,"%":!0};function e(r){if(typeof r=="number")return{value:r,unit:"px"};var s,a=(r.match(/^[0-9.]*/)||"").toString();a.includes(".")?s=parseFloat(a):s=parseInt(a,10);var o=(r.match(/[^0-9]*$/)||"").toString();return t[o]?{value:s,unit:o}:(console.warn("React Spinners: ".concat(r," is not a valid css value. Defaulting to ").concat(s,"px.")),{value:s,unit:"px"})}function n(r){var s=e(r);return"".concat(s.value).concat(s.unit)}return v7}var w7={},Y4e;function _Ve(){if(Y4e)return w7;Y4e=1,Object.defineProperty(w7,"__esModule",{value:!0}),w7.createAnimation=void 0;var t=function(e,n,r){var s="react-spinners-".concat(e,"-").concat(r);if(typeof window>"u"||!window.document)return s;var a=document.createElement("style");document.head.appendChild(a);var o=a.sheet,l=`
@keyframes `.concat(s,` {
`).concat(n,`
}
`);return o&&o.insertRule(l,0),s};return w7.createAnimation=t,w7}var X4e;function eln(){if(X4e)return rg;X4e=1;var t=rg.__assign||function(){return t=Object.assign||function(d){for(var f,x=1,g=arguments.length;x<g;x++){f=arguments[x];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(d[y]=f[y])}return d},t.apply(this,arguments)},e=rg.__createBinding||(Object.create?function(d,f,x,g){g===void 0&&(g=x);var y=Object.getOwnPropertyDescriptor(f,x);(!y||("get"in y?!f.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return f[x]}}),Object.defineProperty(d,g,y)}:function(d,f,x,g){g===void 0&&(g=x),d[g]=f[x]}),n=rg.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=rg.__importStar||function(){var d=function(f){return d=Object.getOwnPropertyNames||function(x){var g=[];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(g[g.length]=y);return g},d(f)};return function(f){if(f&&f.__esModule)return f;var x={};if(f!=null)for(var g=d(f),y=0;y<g.length;y++)g[y]!=="default"&&e(x,f,g[y]);return n(x,f),x}}(),s=rg.__rest||function(d,f){var x={};for(var g in d)Object.prototype.hasOwnProperty.call(d,g)&&f.indexOf(g)<0&&(x[g]=d[g]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var y=0,g=Object.getOwnPropertySymbols(d);y<g.length;y++)f.indexOf(g[y])<0&&Object.prototype.propertyIsEnumerable.call(d,g[y])&&(x[g[y]]=d[g[y]]);return x};Object.defineProperty(rg,"__esModule",{value:!0});var a=r(xx()),o=EVe(),l=_Ve(),c=(0,l.createAnimation)("ClipLoader","0% {transform: rotate(0deg) scale(1)} 50% {transform: rotate(180deg) scale(0.8)} 100% {transform: rotate(360deg) scale(1)}","clip");function u(d){var f=d.loading,x=f===void 0?!0:f,g=d.color,y=g===void 0?"#000000":g,v=d.speedMultiplier,C=v===void 0?1:v,N=d.cssOverride,P=N===void 0?{}:N,T=d.size,M=T===void 0?35:T,F=s(d,["loading","color","speedMultiplier","cssOverride","size"]),$=t({background:"transparent !important",width:(0,o.cssValue)(M),height:(0,o.cssValue)(M),borderRadius:"100%",border:"2px solid",borderTopColor:y,borderBottomColor:"transparent",borderLeftColor:y,borderRightColor:y,display:"inline-block",animation:"".concat(c," ").concat(.75/C,"s 0s infinite linear"),animationFillMode:"both"},P);return x?a.createElement("span",t({style:$},F)):null}return rg.default=u,rg}var tln=eln();const f2=Ii(tln),zg=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),o9=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,ude=({className:t="h-5"})=>i.jsx("div",{className:`w-full bg-gray-700/40 rounded animate-pulse ${t}`}),nln=t=>{var n;const e={totalTrades:t.length,totalPnL:0,totalFees:0,longPnL:0,shortPnL:0,wins:0,durSum:0,minDur:1/0,maxDur:-1/0,medianDur:0,perfByAsset:{},bestTrades:[],liquidations:{}};for(const r of t){e.totalPnL+=r.total_pnl||0,e.totalFees+=Math.abs(r.total_fee),r.position_side==="Long"?e.longPnL+=r.total_pnl||0:e.shortPnL+=r.total_pnl||0,r.total_pnl>0&&e.wins++,e.durSum+=r.duration_hours||0,e.minDur=Math.min(e.minDur,r.duration_hours||0),e.maxDur=Math.max(e.maxDur,r.duration_hours||0);const s=e.perfByAsset[r.coin]??(e.perfByAsset[r.coin]={coin:r.coin,pnl:0,fee:0,count:0});if(s.pnl+=r.total_pnl,s.fee+=r.total_fee,s.count++,r.isLiquidated){const a=r.coin,o=((n=e.liquidations)==null?void 0:n[a])??{coin:a,count:0,totalPrice:0,totalPnL:0};o.count+=r.liquidationCount||1,o.totalPrice+=r.isLiqudationPrice||0,o.totalPnL+=r.total_pnl||0,e.liquidations[a]=o}e.bestTrades.length<6?(e.bestTrades.push(r),e.bestTrades.sort((a,o)=>o.total_pnl-a.total_pnl)):r.total_pnl>e.bestTrades[5].total_pnl&&(e.bestTrades[5]=r,e.bestTrades.sort((a,o)=>o.total_pnl-a.total_pnl))}return e.grossPnL=e.totalPnL-e.totalFees,e.longPct=e.longPnL/(e.longPnL+e.shortPnL||1)*100,e.shortPct=100-e.longPct,e.winRate=e.totalTrades?e.wins/e.totalTrades*100:0,e.avgDur=e.totalTrades?e.durSum/e.totalTrades:0,e.medianDur=(e.minDur+e.maxDur)/2,e.perfByAsset=Object.values(e.perfByAsset).sort((r,s)=>s.pnl-r.pnl),e.liquidations=Object.values(e.liquidations).sort((r,s)=>s.count-r.count),e};function rln({trades:t}){const[e,n]=m.useState(!1),r=m.useMemo(()=>t?nln(t):null,[t]),s=m.useMemo(()=>{var c;return(c=r==null?void 0:r.perfByAsset)!=null&&c.length?Math.max(...r.perfByAsset.map(u=>Math.abs(u.pnl))):1},[r]),a=!r,o=r?new Date(Math.min(...t.map(c=>c.open_time))).toLocaleDateString():"-",l=r?new Date(Math.max(...t.map(c=>c.close_time??Date.now()))).toLocaleDateString():"-";return i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>n(!0),className:"bg-[rgba(255,255,255,0.16)] text-[#ffffff] h-6 sm:h-8 px-1 sm:px-3 py-[1px] sm:py-[5px] rounded-[256px] inline-flex items-center gap-2 text-[14px] font-semibold",children:"Trade Details"}),i.jsxs(yp,{isOpen:e,onClose:()=>n(!1),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h1",{className:"text-lg font-semibold text-white",children:"Trade Details"}),a&&i.jsx(f2,{color:"#fff",size:20})]}),i.jsxs("div",{className:"mb-4 text-xs text-white",children:[o," – ",l]}),!a&&(!r||r.totalTrades===0)?i.jsx(sln,{}):i.jsx(iln,{stats:r,maxCoinPnl:s,loading:a})]})]})}function sln(){return i.jsxs("div",{className:"w-full h-[60vh] flex flex-col items-center justify-center text-white text-sm",children:[i.jsx(ESt,{className:"w-14 h-14 mb-4"}),i.jsx("p",{children:"No Trade Details"}),i.jsx("p",{className:"opacity-70",children:"Not enough trading activity detected to generate statistics."})]})}function iln({stats:t,maxCoinPnl:e,loading:n}){return i.jsxs("div",{className:"flex flex-col sm:flex-row w-[90vw] gap-6 max-h-[80vh] h-[80vh] font-manrope",children:[i.jsxs("div",{className:"space-y-6 w-full sm:w-3/2 overflow-y-auto",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsx(C7,{title:"Total PnL",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:`text-xl font-semibold ${t.totalPnL-t.totalFees>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:["$",zg(t.totalPnL-t.totalFees)]}),i.jsx(_b,{label:"Gross:",value:`$${zg(t.grossPnL+t.totalFees)}`}),i.jsx(_b,{label:"Fees:",value:`$${zg(t.totalFees)}`,red:!0})]})}),i.jsx(C7,{title:"Position Split",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx(_b,{label:"Long PnL",value:`$${zg(Math.abs(t.longPnL))}`,green:!0}),i.jsx(_b,{label:"Short PnL",value:`$${zg(Math.abs(t.shortPnL))}`,green:!0}),i.jsx("div",{className:"h-2 bg-gray-700 rounded mt-2 overflow-hidden",children:i.jsx("div",{className:"h-2 bg-[#67FFBD]",style:{width:`${t.longPct}%`}})})]})}),i.jsx(C7,{title:"Performance",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{className:"text-xl font-semibold text-white",children:[t.winRate.toFixed(2),"%"]}),i.jsx(_b,{label:"Winning:",value:t.wins}),i.jsx(_b,{label:"Total:",value:t.totalTrades})]})}),i.jsx(C7,{title:"Trade Duration",loading:n,children:t&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xl font-semibold text-white",children:o9(t.avgDur)}),i.jsx(_b,{label:"Range:",value:`${o9(t.minDur)} – ${o9(t.maxDur)}`}),i.jsx(_b,{label:"Median:",value:o9(t.medianDur)})]})})]}),i.jsx(oln,{stats:t,loading:n})]}),i.jsxs("div",{className:"rounded-2xl w-full sm:w-1/3 h-full flex flex-col gap-4",children:[i.jsx(lln,{stats:t,loading:n,maxCoinPnl:e}),i.jsx(C7,{title:"Liquidations",loading:n,children:t&&t.liquidations.length>0?i.jsx(aln,{data:t.liquidations}):i.jsx("p",{className:"text-white text-lg text-center font-bold",children:"No liquidations"})})]})]})}function C7({title:t,loading:e,children:n}){return i.jsxs("div",{className:"bg-[#161616] p-4 rounded-2xl flex flex-col justify-between min-h-[140px]",children:[i.jsx("h2",{className:"text-sm uppercase tracking-wider text-white font-bold mb-3",children:t}),e?i.jsx(ude,{className:"h-10"}):n]})}function aln({data:t}){return i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm font-bold text-white",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-600 text-sm font-bold",children:[i.jsx("th",{className:"py-1 text-left",children:"Coin"}),i.jsx("th",{className:"py-1 text-right",children:"Total Loss"}),i.jsx("th",{className:"py-1 text-right",children:"Total Liqs"})]})}),i.jsx("tbody",{children:t.map(e=>i.jsxs("tr",{className:"border-b border-gray-700 last:border-0",children:[i.jsx("td",{className:"py-1",children:i.jsxs("a",{href:`/terminal/${e.coin}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-white hover:text-gray-400",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${e.coin}.svg`,alt:e.coin,className:"w-5 h-5 mr-2",loading:"lazy",onError:n=>replaceBrokenImgSrc(n)}),e.coin]})}),i.jsxs("td",{className:"py-1 text-right text-[#FF7173]",children:["$",zg(Math.abs(e.totalPnL))]}),i.jsx("td",{className:"py-1 text-right",children:e.count})]},e.coin))})]})})}function _b({label:t,value:e,red:n,green:r}){return i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"text-white font-semibold",children:t}),i.jsx("span",{className:n?"text-[#FF7173] font-semibold":r?"text-[#67FFBD] font-semibold":"font-semibold text-white",children:e})]})}function oln({stats:t,loading:e}){return i.jsxs("div",{className:"bg-[#161616] p-4 rounded-2xl",children:[i.jsx("h2",{className:"text-sm uppercase tracking-wider text-white mb-4 font-bold",children:"Best Trades"}),e?i.jsx("div",{className:"grid grid-cols-2 gap-4",children:Array.from({length:6}).map((n,r)=>i.jsx(ude,{className:"h-20"},r))}):i.jsx("div",{className:"grid grid-cols-2 gap-4",children:t.bestTrades.map(n=>i.jsxs("div",{className:"bg-[#111] p-3 rounded-2xl space-y-1 text-sm",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"font-semibold text-white",children:n.coin}),i.jsx("span",{className:n.position_side==="Long"?"text-[#67FFBD]":"text-[#FF7173]",children:i.jsxs("span",{className:"text-lg font-bold",children:["$",zg(Math.abs(n.total_pnl))]})})]}),i.jsx("span",{className:`px-2 py-[1px] rounded text-[11px] font-semibold ${n.position_side==="Long"?"bg-[#67FFBD]/20 text-[#67FFBD]":"bg-[#FF7173]/30 text-[#FF7173]"}`,children:n.position_side}),i.jsxs("div",{className:"text-white font-semibold",children:["Duration: ",o9(n.duration_hours)]}),i.jsx("div",{className:"text-white text-xs font-semibold",children:new Date(n.close_time).toLocaleDateString()})]},n.id??`${n.coin}-${n.close_time}`))})]})}function lln({stats:t,loading:e,maxCoinPnl:n}){return i.jsxs("div",{className:"bg-[#161616] p-4 overflow-y-auto",children:[i.jsx("h2",{className:"text-sm uppercase tracking-wider text-white mb-4 font-bold",children:"Performance by Asset"}),e?i.jsx("div",{className:"space-y-3",children:Array.from({length:10}).map((r,s)=>i.jsx(ude,{className:"h-6"},s))}):t.perfByAsset.map(r=>{const s=`${Math.abs(r.pnl)/n*100}%`;return i.jsxs("div",{className:"mb-4 space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-sm font-semibold",children:[i.jsxs("span",{className:"text-white",children:[r.coin,i.jsxs("span",{className:"text-white text-xs ml-2",children:[r.count," trades"]})]}),i.jsxs("span",{className:"text-[#67FFBD]",children:["$",zg(Math.abs(r.pnl))]})]}),i.jsxs("div",{className:"text-[11px] text-white font-semibold",children:["Fees: $",zg(Math.abs(r.fee))]}),i.jsx("div",{className:"relative h-1 bg-gray-700 rounded overflow-hidden",children:i.jsx("div",{className:"absolute h-1 left-0 top-0 bg-[#67FFBD]",style:{width:s}})})]},r.coin)})]})}const kVe="https://api.hyperliquid.xyz/info",Qre=2e3,TVe=365*24*60*60*1e3*2;async function PVe(t,e){const{data:n}=await ps.post(kVe,{type:"userFillsByTime",user:t,startTime:e,aggregateByTime:!0},{headers:{"Content-Type":"application/json"},timeout:1e4});return n}async function dde(t){let e=Date.now()-TVe;const n=[],r=new Set;for(;;){const s=await PVe(t,e);if(!(s!=null&&s.length))break;for(const a of s)r.has(a.tid)||(r.add(a.tid),n.push(a));if(s.length<Qre)break;e=Math.max(...s.map(a=>a.time))+1}return n.sort((s,a)=>s.time-a.time)}async function fde(t){const{data:e}=await ps.post(kVe,{type:"userTwapSliceFills",user:t},{headers:{"Content-Type":"application/json"},timeout:1e4});return e}async function cln(t,e){let n=Date.now()-TVe;const r=[],s=new Set;let a=0;for(;;){const c=await PVe(t,n);if(!(c!=null&&c.length))break;for(const f of c)s.has(f.tid)||(s.add(f.tid),r.push(f));a++;let u=0,d=0;if(r.forEach(f=>{f.fee&&(u+=parseFloat(f.fee)),f.builderFee&&(d+=parseFloat(f.builderFee))}),e({totalFee:u,totalBuilderFee:d,totalFills:r.length,requestCount:a,hasMoreData:c.length>=Qre,fills:r.slice(0,10),isComplete:!1}),c.length<Qre)break;n=Math.max(...c.map(f=>f.time))+1}let o=0,l=0;return r.forEach(c=>{c.fee&&(o+=parseFloat(c.fee)),c.builderFee&&(l+=parseFloat(c.builderFee))}),e({totalFee:o,totalBuilderFee:l,totalFills:r.length,requestCount:a,hasMoreData:!1,fills:r.slice(0,10),isComplete:!0}),r.sort((c,u)=>c.time-u.time)}function Q4e(t,e,n=1e-9,r=0){if(n<0||r<0)throw new RangeError("tolerances must be non-negative");if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;const s=Math.abs(e-t);return s<=Math.abs(n*e)||s<=Math.abs(n*t)||s<=r}function hde(t){const e=[],n={},r=t.slice().sort((s,a)=>s.time-a.time);for(const s of r)try{const a=s.coin,o=s.dir,l=Math.abs(+s.sz),c=+s.px,u=Math.abs(+s.startPosition),d=+s.builderFee||0,f=+s.fee||0,x=+s.closedPnl||0,g=+s.time,y=s.twapId??null,v=o.startsWith("Open"),C=o.startsWith("Close"),N=o.includes(">"),P=!!s.liquidation;if(v){if(Q4e(u,0))n[a]={coin:a,open_time:g,last_fill_time:g,position_side:o.includes("Long")?"Long":"Short",total_size:l,close_size:0,entry_price_wma:c,close_px:c,total_fee:f,total_pnl:0,transaction_count:1,isClosed:!1,oids:[s.oid],has_builder_fee:d!==0,builder_fee:d,twapId:y};else{const T=n[a]??(n[a]={}),M=(T.total_size||0)+l;T.oids=(T.oids||[]).concat(s.oid),T.entry_price_wma=((T.entry_price_wma||0)*(T.total_size||0)+c*l)/M,T.total_size=M,T.last_fill_time=g,T.transaction_count=(T.transaction_count||0)+1,T.total_fee=(T.total_fee||0)+f,T.has_builder_fee=T.has_builder_fee||d!==0,T.builder_fee=(T.builder_fee||0)+d,T.twapId=y}continue}if(N){const T=n[a];T&&(T.close_size+=l,T.total_pnl+=x,T.total_fee+=f,T.last_fill_time=g,T.close_px=c,T.transaction_count++,T.oids.push(s.oid),T.has_builder_fee=T.has_builder_fee||d!==0,T.builder_fee=(T.builder_fee||0)+d,T.twapId=y,T.isClosed=!0,T.close_time=g,T.duration_hours=(g-T.open_time)/36e5,e.push(T),delete n[a]);const M=Math.max(Math.abs(l)-Math.abs(u),0);M>0&&(n[a]={coin:a,open_time:g,last_fill_time:g,position_side:o.includes("Long")?"Long":"Short",total_size:M,close_size:0,entry_price_wma:c,close_px:c,total_fee:f,total_pnl:0,transaction_count:1,isClosed:!1,isLiquidated:!1,oids:[s.oid],has_builder_fee:d!==0,builder_fee:d,twapId:y});continue}if(C||P){const T=n[a];if(!T)continue;T.close_size+=l,T.total_pnl+=x,T.total_fee+=f,T.last_fill_time=g,T.close_px=c,T.transaction_count++,T.oids.push(s.oid),T.has_builder_fee=T.has_builder_fee||d!==0,T.builder_fee=(T.builder_fee||0)+d,T.twapId=y,P&&(T.isLiquidated=!0,T.liquidation_px_sum=(T.liquidation_px_sum||0)+c,T.liquidationCount=(T.liquidationCount||0)+1),Q4e(Math.abs(l),Math.abs(u),1e-6)&&(T.isClosed=!0,T.close_time=g,T.duration_hours=(g-T.open_time)/36e5,e.push(T),delete n[a])}}catch{}return{closed_positions:e,current_positions:n,min_open_time:e.length?Math.min(...e.map(s=>s.open_time)):null,end_time:Date.now()}}const Xf=({className:t})=>i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[i.jsx("path",{d:"M15.1668 11.6665C15.1668 11.9398 14.9402 12.1665 14.6668 12.1665H10.0002V12.3332C10.0002 13.3332 9.40016 13.6665 8.66683 13.6665H4.66683C3.9335 13.6665 3.3335 13.3332 3.3335 12.3332V12.1665H1.3335C1.06016 12.1665 0.833496 11.9398 0.833496 11.6665C0.833496 11.3932 1.06016 11.1665 1.3335 11.1665H3.3335V10.9998C3.3335 9.99984 3.9335 9.6665 4.66683 9.6665H8.66683C9.40016 9.6665 10.0002 9.99984 10.0002 10.9998V11.1665H14.6668C14.9402 11.1665 15.1668 11.3932 15.1668 11.6665Z",fill:"currentColor"}),i.jsx("path",{d:"M15.1668 4.3335C15.1668 4.60683 14.9402 4.8335 14.6668 4.8335H12.6668V5.00016C12.6668 6.00016 12.0668 6.3335 11.3335 6.3335H7.3335C6.60016 6.3335 6.00016 6.00016 6.00016 5.00016V4.8335H1.3335C1.06016 4.8335 0.833496 4.60683 0.833496 4.3335C0.833496 4.06016 1.06016 3.8335 1.3335 3.8335H6.00016V3.66683C6.00016 2.66683 6.60016 2.3335 7.3335 2.3335H11.3335C12.0668 2.3335 12.6668 2.66683 12.6668 3.66683V3.8335H14.6668C14.9402 3.8335 15.1668 4.06016 15.1668 4.3335Z",fill:"currentColor"})]});function eP({open:t,setOpen:e,data:n,setTradeInfo:r,pnlTitle:s="UNREALIZED PNL",showPnl:a=!0}){const o=m.useRef(null),l=async()=>{if(o.current)try{await document.fonts.ready,await new Promise(C=>setTimeout(C,500));const y=await V1(o.current,{cacheBust:!0,backgroundColor:null,useCORS:!1,style:{transform:"scale(1)",transformOrigin:"top left"}}),v=document.createElement("a");v.href=y,v.download="dextrabot.png",document.body.appendChild(v),v.click(),document.body.removeChild(v),tn.success("PNG successfully downloaded!")}catch(y){console.error("Error generating PNG:",y),tn.error("Failed to download PNG.")}},[c,u]=m.useState(),[d,f]=m.useState(!0),x=async y=>{f(!0);try{const C=await(await fetch(`https://api.cors.lol/?url=${encodeURIComponent(y)}`)).blob();return new Promise((N,P)=>{const T=new FileReader;T.onloadend=()=>N(T.result),T.onerror=P,T.readAsDataURL(C)})}catch(v){throw console.error("Image conversion failed:",v),v}finally{f(!1)}},g={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return m.useEffect(()=>{var y;n!=null&&n.coin&&x(`https://app.hyperliquid.xyz/coins/${g[n==null?void 0:n.coin]||((y=n==null?void 0:n.coin)==null?void 0:y.split("/")[0])}.svg`).then(v=>u(v)).catch(()=>u(qa))},[n==null?void 0:n.coin]),i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(y=>({...y,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:o,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start ",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 relative mt-6",children:[i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:d?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("img",{src:c||qa,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:y=>oa(y)})})}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope flex items-center",children:n!=null&&n.coin?n==null?void 0:n.coin.replace("xyz:",""):"--"}),i.jsx("div",{className:`${(n==null?void 0:n.type)=="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 w-20 min-w-[80px] w-auto px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope uppercase tracking-wide`,children:n!=null&&n.type?n==null?void 0:n.type:"--"}),i.jsxs("div",{className:`${(n==null?void 0:n.type)=="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 w-16 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide`,children:[n!=null&&n.leverage?n==null?void 0:n.leverage:"--","x"]})]}),i.jsxs("div",{className:`${(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center min-w-max`,children:[(n==null?void 0:n.roe)>=0?"+":"-",uo(Math.abs(n==null?void 0:n.roe)),"%"]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-[45px] pt-[12px]",children:[s&&i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:s}),i.jsx("div",{className:`${(n==null?void 0:n.pnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-[32px] font-semibold font-manrope leading-none flex`,children:n!=null&&n.pnl?`$${uo(Math.abs(n==null?void 0:n.pnl).toFixed(2))}`:uo(Math.abs(n==null?void 0:n.pnl))})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"ENTRY PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.entryPrice?`$${_r(n==null?void 0:n.entryPrice)}`:_r(n==null?void 0:n.entryPrice)})]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[45px] pt-[12px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"MARK PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.markPrice?`$${_r(n==null?void 0:n.markPrice)}`:_r(n==null?void 0:n.markPrice)})]})}),(n==null?void 0:n.referral)&&(n==null?void 0:n.referral)!="--"&&i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[20px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?"pt-[8px]":"pt-[90px]"} flex justify-start items-start`,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[378px] overflow-hidden",children:(n==null?void 0:n.roe)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?i.jsxs("span",{children:["Profit like the pros! 🤑 Copy top traders automatically with Dextrabot. Use my referral"," ",n==null?void 0:n.referral," & save 4% on fees! @Dextrabot 🚀"]}):i.jsx("span",{children:"Profit like the pros! 🤑 Copy top traders automatically with @Dextrabot 🚀"})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:y=>{y.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral&&(n==null?void 0:n.referral)!="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:y=>{y.preventDefault(),d||l()},className:`${d?"cursor-not-allowed":"cursor-pointer"} w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:d?"Hang tight! Your image is on the way... 🚀":"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Profit%20like%20the%20pros!%20🤑%20Copy%20top%20traders%20automatically${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20with%20Dextrabot.%20Use%20my%20referral%20${n==null?void 0:n.referral}%20and%20save%204%25%20on%20fees!`:"%20with%20%40Dextrabot"}%20🚀%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}function uln({open:t,setOpen:e,data:n,setTradeInfo:r}){var o,l;const s=m.useRef(null),a=async()=>{if(s.current)try{await document.fonts.ready,await new Promise(d=>setTimeout(d,500));const c=await V1(s.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),u=document.createElement("a");u.href=c,u.download="dextrabot.png",document.body.appendChild(u),u.click(),document.body.removeChild(u),tn.success("PNG successfully downloaded!")}catch(c){console.error("Error generating PNG:",c),tn.error("Failed to download PNG.")}};return i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),setTimeout(()=>{r(c=>({...c,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:s,style:{overflow:"visible",position:"relative"},className:"w-[878px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[870px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[522px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[20px] py-[30px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 relative mt-[30px]",children:[i.jsx("div",{className:`${(n==null?void 0:n.type)=="LONG"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 min-w-[80px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope uppercase tracking-wide`,children:n!=null&&n.type?n==null?void 0:n.type:"--"}),i.jsx("div",{className:`${(n==null?void 0:n.type)=="LONG"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide`,children:n!=null&&n.leverage?(n==null?void 0:n.leverage)==null||isNaN(parseFloat(n==null?void 0:n.leverage))?"--":parseFloat(n==null?void 0:n.leverage).toFixed(2)+"x":"--"})]}),i.jsxs("div",{className:`${n!=null&&n.roe&&(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center`,children:[n!=null&&n.roe&&(n==null?void 0:n.roe)>=0?"+":"-",(n==null?void 0:n.roe)==null||isNaN(parseFloat(n==null?void 0:n.roe))?"":Ms(Math.abs(n==null?void 0:n.roe))+"%"]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-[30px] pt-[18px]",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"UNREALIZED PNL"}),i.jsx("div",{className:`${(n==null?void 0:n.entryPrice)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[32px] font-semibold font-manrope leading-none flex min-w-[180px]`,children:n!=null&&n.entryPrice?`$${_r(Math.abs(n==null?void 0:n.entryPrice))}`:"--"})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex min-w-max",children:"POSITION DISTRIBUTION"}),i.jsx("div",{className:"text-white text-[24px] font-semibold font-manrope leading-none flex min-w-max pt-1",children:n!=null&&n.positionDistribution?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[#67ffbd]",children:n==null?void 0:n.positionDistribution.split("/")[0].trim()}),i.jsx("span",{className:"text-white mx-1",children:"/"}),i.jsx("span",{className:"text-[#ff6767]",children:(o=n==null?void 0:n.positionDistribution.split("/")[1])==null?void 0:o.trim()})]}):i.jsx("span",{className:"text-white",children:"--"})})]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[8px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"CURRENT WIN RATE"}),i.jsx("div",{className:"text-[24px] font-semibold font-manrope leading-none flex min-w-max",children:n!=null&&n.markPrice?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[#67ffbd]",children:n==null?void 0:n.markPrice.split("/")[0].trim()}),i.jsx("span",{className:"text-white mx-1",children:"/"}),i.jsx("span",{className:"text-white",children:(l=n==null?void 0:n.markPrice.split("/")[1])==null?void 0:l.trim()})]}):i.jsx("span",{className:"text-white",children:"--"})})]})}),(n==null?void 0:n.referral)&&i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[16px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:`${n!=null&&n.referral?"pt-[1px]":"pt-[90px]"} flex justify-start items-start`,children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[398px] overflow-hidden",children:n!=null&&n.entryPrice&&(n==null?void 0:n.entryPrice)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Profit like the pros! 🤑 Copy top traders automatically with Dextrabot. Use my referral"," ",n==null?void 0:n.referral," & save 4% on fees! @Dextrabot 🚀"]}):i.jsx("span",{children:"Profit like the pros! 🤑 Copy top traders automatically with @Dextrabot 🚀"})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:()=>{a()},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Profit%20like%20the%20pros!%20🤑%20Copy%20top%20traders%20automatically${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20with%20Dextrabot.%20Use%20my%20referral%20${n==null?void 0:n.referral}%20and%20save%204%25%20on%20fees!`:"%20with%20%40Dextrabot"}%20🚀%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}function dln({open:t,setOpen:e,data:n,setShare:r,setTradeInfo:s}){var x;const a=m.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(v=>setTimeout(v,500));const g=await V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),y=document.createElement("a");y.href=g,y.download="dextrabot.png",document.body.appendChild(y),y.click(),document.body.removeChild(y),tn.success("PNG successfully downloaded!")}catch(g){console.error("Error generating PNG:",g),tn.error("Failed to download PNG.")}},[l,c]=m.useState(),[u,d]=m.useState(!0),f=async g=>{d(!0);try{const v=await(await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(g)}`)).blob();return new Promise((C,N)=>{const P=new FileReader;P.onloadend=()=>C(P.result),P.onerror=N,P.readAsDataURL(v)})}catch(y){throw console.error("Image conversion failed:",y),y}finally{d(!1)}};return m.useEffect(()=>{n!=null&&n.coin&&f(`https://app.hyperliquid.xyz/coins/${n==null?void 0:n.coin}.svg`).then(g=>c(g)).catch(()=>c(qa))},[n==null?void 0:n.coin]),i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(!1),setTimeout(()=>{s(g=>({...g,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,positionDistribution:0,pnl:0,closePx:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start ",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 relative mt-6",children:[i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:u?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",class:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{class:"sr-only",children:"Loading..."})]}):i.jsx("img",{src:l||qa,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:g=>oa(g)})})}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope flex items-center",children:n!=null&&n.coin?n==null?void 0:n.coin:"--"}),i.jsx("div",{className:`${(x=n==null?void 0:n.type)!=null&&x.includes("Long")?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 w-auto px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope uppercase tracking-wide`,children:n!=null&&n.type?n==null?void 0:n.type:"-"})]}),i.jsxs("div",{className:`${(n==null?void 0:n.pnl)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center min-w-max`,children:[(n==null?void 0:n.pnl)>=0?"+":"-","$",uo(Math.abs((n==null?void 0:n.pnl)-(n!=null&&n.builderFee?n.builderFee:0)))]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-[45px] pt-[12px]",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"ENTRY PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.entryPrice?`$${Ay(n==null?void 0:n.entryPrice)}`:Ay(n==null?void 0:n.entryPrice)})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"MARK PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.markPrice?`$${Ay(n==null?void 0:n.markPrice)}`:Ay(n==null?void 0:n.markPrice)})]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[20px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:"flex justify-start items-start pt-[8px]",children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[378px] overflow-hidden",children:(n==null?void 0:n.roe)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Profit like the pros! 🤑 Copy top traders automatically with Dextrabot. Use my referral"," ",n==null?void 0:n.referral," & save 4% on fees! @Dextrabot 🚀"]}):i.jsx("span",{children:"Profit like the pros! 🤑 Copy top traders automatically with @Dextrabot 🚀"})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:g=>{g.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:g=>{g.preventDefault(),u||o()},className:`${u?"cursor-not-allowed":"cursor-pointer"} w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:u?"Hang tight! Your image is on the way... 🚀":"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Profit%20like%20the%20pros!%20🤑%20Copy%20top%20traders%20automatically${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20with%20Dextrabot.%20Use%20my%20referral%20${n==null?void 0:n.referral}%20and%20save%204%25%20on%20fees!`:"%20with%20%40Dextrabot"}%20🚀%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}const fln=({wallet:t,wallets:e})=>{const[n,r]=m.useState([]),[s,a]=m.useState(!0),[o,l]=m.useState("oid"),[c,u]=m.useState(""),[d,f]=m.useState(!1),x=m.useRef(null),g=m.useRef(null),[y,v]=m.useState(!1),[C,N]=m.useState(null);m.useContext(Qr);const[P,T]=m.useState({key:null,direction:null});m.useEffect(()=>{function fe(q){g.current&&!g.current.contains(q.target)&&setIsDropdownOpen(!1),x.current&&!x.current.contains(q.target)&&f(!1)}return document.addEventListener("mousedown",fe),()=>document.removeEventListener("mousedown",fe)},[]);const M=fe=>`${fe.time}_${fe.coin}_${fe.dir}_${fe.px}_${fe.sz}`;m.useEffect(()=>{if(!e||e.length===0)return;const fe=e.map(se=>se.wallet_address.toLowerCase());if(fe.length===0)return;let q=!0;return(async()=>{try{const se=(await Promise.all(fe.map(W=>ps.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:W})))).flatMap(W=>W.data??[]);if(!q)return;const ae=new Map;se.forEach(W=>{const V=M(W);ae.has(V)||ae.set(V,W)}),r(Array.from(ae.values()).sort((W,V)=>V.time-W.time))}catch(se){console.error("Multi-wallet trade fetch error:",se)}finally{q&&a(!1)}})(),()=>{q=!1}},[e]),m.useEffect(()=>{const fe=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");return fe.onopen=()=>{fe.send(JSON.stringify({method:"subscribe",subscription:{type:"userFills",user:t,aggregateByTime:!0}}))},fe.onmessage=q=>{const se=JSON.parse(q.data);se&&se.data&&Array.isArray(se.data.fills)&&r(ae=>{const W=[...ae];return se.data.fills.forEach(V=>{const ee=M(V);W.some(oe=>M(oe)===ee)||W.push(V)}),W.sort((V,ee)=>ee.time-V.time)})},()=>fe.close()},[]),m.useEffect(()=>{(async()=>{try{const q=await ps.post("https://api-ui.hyperliquid.xyz/info",{aggregateByTime:!0,type:"userFills",user:t});r(q.data||[])}catch(q){console.error("Error fetching trade data:",q)}finally{a(!1)}})()},[t]);const F=fe=>{let q="asc";P.key===fe&&(P.direction==="asc"?q="desc":P.direction==="desc"&&(q=null)),T({key:fe,direction:q})};let $=[...n];c&&($=$.filter(fe=>String(fe.oid).includes(c)));const L=$.sort((fe,q)=>{if(!P.key||!P.direction)return 0;const se=(V,ee)=>{switch(ee){case"sz":return parseFloat(V.sz);case"closedPnl":return parseFloat(V.closedPnl||0)-parseFloat(V.fee||0);case"fee":return parseFloat(V.fee);case"tradeValue":return parseFloat(V.px)*parseFloat(V.sz);default:return V[ee]}},ae=se(fe,P.key),W=se(q,P.key);return ae<W?P.direction==="asc"?-1:1:ae>W?P.direction==="asc"?1:-1:0}),z=fe=>{if(P.key===fe){if(P.direction==="asc")return i.jsx(i2,{className:"inline ml-2 text-white"});if(P.direction==="desc")return i.jsx(s2,{className:"inline ml-2 text-white"})}return i.jsx(a2,{className:"inline ml-2 text-white"})},ne=localStorage.getItem("isDateTradeHistoryFormat")||"date",[J,K]=m.useState(ne);m.useEffect(()=>{localStorage.setItem("isDateTradeHistoryFormat",J)},[J]);function te({date:fe}){const[q,se]=m.useState($o(fe));return m.useEffect(()=>{const ae=setInterval(()=>{se($o(fe))},1e3);return()=>clearInterval(ae)},[fe]),i.jsx("span",{className:"text-white leading-[13px] tracking-[0.26px] text-[13px] font-semibold font-manrope",children:q.dateTime})}return i.jsxs("div",{className:"relative w-full text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx(dln,{open:y,setOpen:v,data:C,setShare:()=>{},setTradeInfo:()=>{}}),i.jsx("div",{className:"w-full overflow-x-auto min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] border-collapse rounded-lg pb-24",children:i.jsxs("table",{className:"w-max sm:w-full relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 z-[3] whitespace-nowrap bg-[#161616]",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[13px] font-manrope relative h-[32px] max-h-[32px] text-white",children:[i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("time"),children:["Time ",z("time")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("coin"),children:["Coin ",z("coin")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("dir"),children:["Direction ",z("dir")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("px"),children:["Price ",z("px")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("sz"),children:["Size ",z("sz")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("tradeValue"),children:["Trade Value ",z("tradeValue")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("fee"),children:["Fee (USDC) ",z("fee")]}),i.jsxs("th",{className:" text-left cursor-pointer",onClick:()=>F("closedPnl"),children:["Closed PNL ",z("closedPnl")]}),i.jsx("th",{children:i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx(mi,{title:"Order ID",sortKey:"oid",sortOption:o,setSortOption:l,isFilterIcon:!0}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>f(!d),className:`${c?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${c?"text-blue-500":"text-white"}`})}),d&&i.jsxs("div",{ref:x,className:`absolute right-[30px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>u(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"number",value:c,onChange:fe=>u(fe.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Order ID"})]})]})]})})]})}),i.jsx("tbody",{children:s?i.jsx("tr",{children:i.jsx("td",{colSpan:"8",className:"text-center p-4",children:"Loading..."})}):L.map((fe,q)=>{var se,ae;return i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",children:[i.jsx("td",{onClick:()=>{K(J=="time"?"date":"time")},className:"text-left rounded-l-2xl cursor-pointer",children:J=="time"?i.jsx(te,{date:fe.time}):cu(fe.time)}),i.jsx("td",{className:"text-left",children:i.jsx("a",{href:`/terminal/${fe.coin}`,target:"_blank",rel:"noopener noreferrer",className:"text-white hover:text-gray-400",children:fe.coin})}),i.jsx("td",{className:`text-left ${fe!=null&&fe.liquidation?"text-[#ff787b]":(se=fe.dir)!=null&&se.includes("Short")?"text-[#ff6b6b]":(ae=fe.dir)!=null&&ae.includes("Long")?"text-[#4ae3b5]":"text-white"}`,children:fe!=null&&fe.liquidation?`Market Liquidation: ${(fe==null?void 0:fe.dir)=="Sell"?"Sell":(fe==null?void 0:fe.dir)=="Buy"?"Buy":(fe==null?void 0:fe.dir)=="Close Short"?"Close Short":(fe==null?void 0:fe.dir)=="Close Long"?"Close Long":(fe==null?void 0:fe.dir)=="Open Short"?"Close Short":(fe==null?void 0:fe.dir)=="Open Long"?"Close Long":"Close "+(fe==null?void 0:fe.dir)}`:fe==null?void 0:fe.dir}),i.jsxs("td",{className:"text-left",children:["$",parseFloat(fe.px).toFixed(2)]}),i.jsx("td",{className:"text-left",children:_r(parseFloat(fe.sz))}),i.jsxs("td",{className:"text-left",children:["$",_r(parseFloat(fe.px)*parseFloat(fe.sz))]}),i.jsxs("td",{className:"text-left",children:[_r(parseFloat(fe.fee)),fe.builderFee&&i.jsxs("span",{className:"text-xs",children:["(",_r(parseFloat(fe.builderFee))," ","builder fee)"]})]}),i.jsxs("td",{className:`text-left ${parseFloat(fe.closedPnl)-parseFloat(fe.fee)>0?"text-[#4ae3b5]":parseFloat(fe.closedPnl)-parseFloat(fe.fee)<0?"text-[#ff6b6b]":"text-white"}`,children:["$",_r(parseFloat(fe.closedPnl)-parseFloat(fe.fee))]}),i.jsx("td",{className:"rounded-r-2xl ",children:fe.oid})]},q)})})]})})]})};var l9={exports:{}};/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/var hln=l9.exports,Z4e;function pln(){return Z4e||(Z4e=1,function(t,e){(function(){var n,r="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",l="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",u=500,d="__lodash_placeholder__",f=1,x=2,g=4,y=1,v=2,C=1,N=2,P=4,T=8,M=16,F=32,$=64,L=128,z=256,X=512,ne=30,J="...",K=800,te=16,fe=1,q=2,se=3,ae=1/0,W=9007199254740991,V=17976931348623157e292,ee=NaN,oe=4294967295,de=oe-1,Ce=oe>>>1,me=[["ary",L],["bind",C],["bindKey",N],["curry",T],["curryRight",M],["flip",X],["partial",F],["partialRight",$],["rearg",z]],we="[object Arguments]",xe="[object Array]",be="[object AsyncFunction]",je="[object Boolean]",Ie="[object Date]",Re="[object DOMException]",Qe="[object Error]",Ke="[object Function]",dt="[object GeneratorFunction]",tt="[object Map]",nt="[object Number]",Le="[object Null]",Be="[object Object]",ht="[object Promise]",pt="[object Proxy]",Gt="[object RegExp]",wt="[object Set]",nn="[object String]",cn="[object Symbol]",Un="[object Undefined]",Xt="[object WeakMap]",an="[object WeakSet]",Jt="[object ArrayBuffer]",Ye="[object DataView]",Je="[object Float32Array]",It="[object Float64Array]",hn="[object Int8Array]",Yt="[object Int16Array]",Rt="[object Int32Array]",ot="[object Uint8Array]",De="[object Uint8ClampedArray]",At="[object Uint16Array]",ze="[object Uint32Array]",rt=/\b__p \+= '';/g,mt=/\b(__p \+=) '' \+/g,Lt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,kt=/&(?:amp|lt|gt|quot|#39);/g,dn=/[&<>"']/g,rn=RegExp(kt.source),gn=RegExp(dn.source),An=/<%-([\s\S]+?)%>/g,kn=/<%([\s\S]+?)%>/g,yn=/<%=([\s\S]+?)%>/g,Vn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kn=/^\w*$/,Dn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xn=/[\\^$.*+?()[\]{}|]/g,Nn=RegExp(Xn.source),on=/^\s+/,Oe=/\s/,Zt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,sn=/\{\n\/\* \[wrapped with (.+)\] \*/,jt=/,? & /,Qn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,bn=/[()=,{}\[\]\/\s]/,Dt=/\\(\\)?/g,en=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Pn=/\w*$/,tr=/^[-+]0x[0-9a-f]+$/i,ar=/^0b[01]+$/i,hr=/^\[object .+?Constructor\]$/,qt=/^0o[0-7]+$/i,zn=/^(?:0|[1-9]\d*)$/,Zn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ft=/($^)/,En=/['\n\r\u2028\u2029\\]/g,Ee="\\ud800-\\udfff",h="\\u0300-\\u036f",p="\\ufe20-\\ufe2f",S="\\u20d0-\\u20ff",_=h+p+S,k="\\u2700-\\u27bf",I="a-z\\xdf-\\xf6\\xf8-\\xff",B="\\xac\\xb1\\xd7\\xf7",G="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",re="\\u2000-\\u206f",ce=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ue="A-Z\\xc0-\\xd6\\xd8-\\xde",ge="\\ufe0e\\ufe0f",Ae=B+G+re+ce,ke="['’]",Me="["+Ee+"]",qe="["+Ae+"]",Fe="["+_+"]",at="\\d+",ie="["+k+"]",Se="["+I+"]",$e="[^"+Ee+Ae+at+k+I+ue+"]",Ue="\\ud83c[\\udffb-\\udfff]",_e="(?:"+Fe+"|"+Ue+")",st="[^"+Ee+"]",ut="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="["+ue+"]",Kt="\\u200d",un="(?:"+Se+"|"+$e+")",Xe="(?:"+Mt+"|"+$e+")",Pt="(?:"+ke+"(?:d|ll|m|re|s|t|ve))?",Wt="(?:"+ke+"(?:D|LL|M|RE|S|T|VE))?",ct=_e+"?",Ge="["+ge+"]?",Tt="(?:"+Kt+"(?:"+[st,ut,yt].join("|")+")"+Ge+ct+")*",fn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Yn="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fn=Ge+ct+Tt,Gn="(?:"+[ie,ut,yt].join("|")+")"+Fn,Sr="(?:"+[st+Fe+"?",Fe,ut,yt,Me].join("|")+")",ur=RegExp(ke,"g"),kr=RegExp(Fe,"g"),Bn=RegExp(Ue+"(?="+Ue+")|"+Sr+Fn,"g"),Sn=RegExp([Mt+"?"+Se+"+"+Pt+"(?="+[qe,Mt,"$"].join("|")+")",Xe+"+"+Wt+"(?="+[qe,Mt+un,"$"].join("|")+")",Mt+"?"+un+"+"+Pt,Mt+"+"+Wt,Yn,fn,at,Gn].join("|"),"g"),Mn=RegExp("["+Kt+Ee+_+ge+"]"),rr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ls=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cs=-1,et={};et[Je]=et[It]=et[hn]=et[Yt]=et[Rt]=et[ot]=et[De]=et[At]=et[ze]=!0,et[we]=et[xe]=et[Jt]=et[je]=et[Ye]=et[Ie]=et[Qe]=et[Ke]=et[tt]=et[nt]=et[Be]=et[Gt]=et[wt]=et[nn]=et[Xt]=!1;var gt={};gt[we]=gt[xe]=gt[Jt]=gt[Ye]=gt[je]=gt[Ie]=gt[Je]=gt[It]=gt[hn]=gt[Yt]=gt[Rt]=gt[tt]=gt[nt]=gt[Be]=gt[Gt]=gt[wt]=gt[nn]=gt[cn]=gt[ot]=gt[De]=gt[At]=gt[ze]=!0,gt[Qe]=gt[Ke]=gt[Xt]=!1;var Tn={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},sr={"&":"&","<":"<",">":">",'"':""","'":"'"},Tr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Lr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$r=parseFloat,lr=parseInt,wr=typeof Ru=="object"&&Ru&&Ru.Object===Object&&Ru,ss=typeof self=="object"&&self&&self.Object===Object&&self,mr=wr||ss||Function("return this")(),es=e&&!e.nodeType&&e,Ys=es&&!0&&t&&!t.nodeType&&t,_s=Ys&&Ys.exports===es,br=_s&&wr.process,zt=function(){try{var St=Ys&&Ys.require&&Ys.require("util").types;return St||br&&br.binding&&br.binding("util")}catch{}}(),he=zt&&zt.isArrayBuffer,it=zt&&zt.isDate,Ct=zt&&zt.isMap,vt=zt&&zt.isRegExp,ln=zt&&zt.isSet,xn=zt&&zt.isTypedArray;function dr(St,$t,Ht){switch(Ht.length){case 0:return St.call($t);case 1:return St.call($t,Ht[0]);case 2:return St.call($t,Ht[0],Ht[1]);case 3:return St.call($t,Ht[0],Ht[1],Ht[2])}return St.apply($t,Ht)}function Er(St,$t,Ht,jn){for(var xr=-1,Nr=St==null?0:St.length;++xr<Nr;){var jr=St[xr];$t(jn,jr,Ht(jr),St)}return jn}function pr(St,$t){for(var Ht=-1,jn=St==null?0:St.length;++Ht<jn&&$t(St[Ht],Ht,St)!==!1;);return St}function fr(St,$t){for(var Ht=St==null?0:St.length;Ht--&&$t(St[Ht],Ht,St)!==!1;);return St}function Yr(St,$t){for(var Ht=-1,jn=St==null?0:St.length;++Ht<jn;)if(!$t(St[Ht],Ht,St))return!1;return!0}function is(St,$t){for(var Ht=-1,jn=St==null?0:St.length,xr=0,Nr=[];++Ht<jn;){var jr=St[Ht];$t(jr,Ht,St)&&(Nr[xr++]=jr)}return Nr}function Ir(St,$t){var Ht=St==null?0:St.length;return!!Ht&&Wn(St,$t,0)>-1}function yr(St,$t,Ht){for(var jn=-1,xr=St==null?0:St.length;++jn<xr;)if(Ht($t,St[jn]))return!0;return!1}function Jn(St,$t){for(var Ht=-1,jn=St==null?0:St.length,xr=Array(jn);++Ht<jn;)xr[Ht]=$t(St[Ht],Ht,St);return xr}function gs(St,$t){for(var Ht=-1,jn=$t.length,xr=St.length;++Ht<jn;)St[xr+Ht]=$t[Ht];return St}function Zs(St,$t,Ht,jn){var xr=-1,Nr=St==null?0:St.length;for(jn&&Nr&&(Ht=St[++xr]);++xr<Nr;)Ht=$t(Ht,St[xr],xr,St);return Ht}function oi(St,$t,Ht,jn){var xr=St==null?0:St.length;for(jn&&xr&&(Ht=St[--xr]);xr--;)Ht=$t(Ht,St[xr],xr,St);return Ht}function Fr(St,$t){for(var Ht=-1,jn=St==null?0:St.length;++Ht<jn;)if($t(St[Ht],Ht,St))return!0;return!1}var wn=Ls("length");function On(St){return St.split("")}function lt(St){return St.match(Qn)||[]}function Bt(St,$t,Ht){var jn;return Ht(St,function(xr,Nr,jr){if($t(xr,Nr,jr))return jn=Nr,!1}),jn}function nr(St,$t,Ht,jn){for(var xr=St.length,Nr=Ht+(jn?1:-1);jn?Nr--:++Nr<xr;)if($t(St[Nr],Nr,St))return Nr;return-1}function Wn(St,$t,Ht){return $t===$t?O(St,$t,Ht):nr(St,Pr,Ht)}function Or(St,$t,Ht,jn){for(var xr=Ht-1,Nr=St.length;++xr<Nr;)if(jn(St[xr],$t))return xr;return-1}function Pr(St){return St!==St}function ts(St,$t){var Ht=St==null?0:St.length;return Ht?Vr(St,$t)/Ht:ee}function Ls(St){return function($t){return $t==null?n:$t[St]}}function Et(St){return function($t){return St==null?n:St[$t]}}function or(St,$t,Ht,jn,xr){return xr(St,function(Nr,jr,Ns){Ht=jn?(jn=!1,Nr):$t(Ht,Nr,jr,Ns)}),Ht}function Hn(St,$t){var Ht=St.length;for(St.sort($t);Ht--;)St[Ht]=St[Ht].value;return St}function Vr(St,$t){for(var Ht,jn=-1,xr=St.length;++jn<xr;){var Nr=$t(St[jn]);Nr!==n&&(Ht=Ht===n?Nr:Ht+Nr)}return Ht}function us(St,$t){for(var Ht=-1,jn=Array(St);++Ht<St;)jn[Ht]=$t(Ht);return jn}function as(St,$t){return Jn($t,function(Ht){return[Ht,St[Ht]]})}function xs(St){return St&&St.slice(0,le(St)+1).replace(on,"")}function bs(St){return function($t){return St($t)}}function zi(St,$t){return Jn($t,function(Ht){return St[Ht]})}function Us(St,$t){return St.has($t)}function ys(St,$t){for(var Ht=-1,jn=St.length;++Ht<jn&&Wn($t,St[Ht],0)>-1;);return Ht}function Ss(St,$t){for(var Ht=St.length;Ht--&&Wn($t,St[Ht],0)>-1;);return Ht}function pc(St,$t){for(var Ht=St.length,jn=0;Ht--;)St[Ht]===$t&&++jn;return jn}var ks=Et(Tn),ka=Et(sr);function Wu(St){return"\\"+Lr[St]}function va(St,$t){return St==null?n:St[$t]}function Yo(St){return Mn.test(St)}function qu(St){return rr.test(St)}function Yl(St){for(var $t,Ht=[];!($t=St.next()).done;)Ht.push($t.value);return Ht}function yi(St){var $t=-1,Ht=Array(St.size);return St.forEach(function(jn,xr){Ht[++$t]=[xr,jn]}),Ht}function Ed(St,$t){return function(Ht){return St($t(Ht))}}function ft(St,$t){for(var Ht=-1,jn=St.length,xr=0,Nr=[];++Ht<jn;){var jr=St[Ht];(jr===$t||jr===d)&&(St[Ht]=d,Nr[xr++]=Ht)}return Nr}function w(St){var $t=-1,Ht=Array(St.size);return St.forEach(function(jn){Ht[++$t]=jn}),Ht}function E(St){var $t=-1,Ht=Array(St.size);return St.forEach(function(jn){Ht[++$t]=[jn,jn]}),Ht}function O(St,$t,Ht){for(var jn=Ht-1,xr=St.length;++jn<xr;)if(St[jn]===$t)return jn;return-1}function U(St,$t,Ht){for(var jn=Ht+1;jn--;)if(St[jn]===$t)return jn;return jn}function H(St){return Yo(St)?Te(St):wn(St)}function Q(St){return Yo(St)?Ze(St):On(St)}function le(St){for(var $t=St.length;$t--&&Oe.test(St.charAt($t)););return $t}var ve=Et(Tr);function Te(St){for(var $t=Bn.lastIndex=0;Bn.test(St);)++$t;return $t}function Ze(St){return St.match(Bn)||[]}function xt(St){return St.match(Sn)||[]}var _t=function St($t){$t=$t==null?mr:Qt.defaults(mr.Object(),$t,Qt.pick(mr,ls));var Ht=$t.Array,jn=$t.Date,xr=$t.Error,Nr=$t.Function,jr=$t.Math,Ns=$t.Object,Js=$t.RegExp,mc=$t.String,no=$t.TypeError,ro=Ht.prototype,ha=Nr.prototype,Ta=Ns.prototype,Xo=$t["__core-js_shared__"],_d=ha.toString,Oi=Ta.hasOwnProperty,Lm=0,W1=function(){var D=/[^.]+$/.exec(Xo&&Xo.keys&&Xo.keys.IE_PROTO||"");return D?"Symbol(src)_1."+D:""}(),z2=Ta.toString,X5=_d.call(Ns),fP=mr._,hP=Js("^"+_d.call(Oi).replace(Xn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H2=_s?$t.Buffer:n,Np=$t.Symbol,V2=$t.Uint8Array,$j=H2?H2.allocUnsafe:n,Sf=Ed(Ns.getPrototypeOf,Ns),Q5=Ns.create,Z5=Ta.propertyIsEnumerable,J5=ro.splice,pP=Np?Np.isConcatSpreadable:n,Ap=Np?Np.iterator:n,Sx=Np?Np.toStringTag:n,W2=function(){try{var D=Km(Ns,"defineProperty");return D({},"",{}),D}catch{}}(),mP=$t.clearTimeout!==mr.clearTimeout&&$t.clearTimeout,Ga=jn&&jn.now!==mr.Date.now&&jn.now,Uj=$t.setTimeout!==mr.setTimeout&&$t.setTimeout,Nx=jr.ceil,Dm=jr.floor,e6=Ns.getOwnPropertySymbols,zj=H2?H2.isBuffer:n,q1=$t.isFinite,t6=ro.join,G1=Ed(Ns.keys,Ns),Qo=jr.max,xc=jr.min,Rz=jn.now,xP=$t.parseInt,q2=jr.random,n6=ro.reverse,G2=Km($t,"DataView"),Ax=Km($t,"Map"),K2=Km($t,"Promise"),Bm=Km($t,"Set"),Y2=Km($t,"WeakMap"),K1=Km(Ns,"create"),r6=Y2&&new Y2,Y1={},Hj=Ym(G2),$m=Ym(Ax),gP=Ym(K2),X1=Ym(Bm),uh=Ym(Y2),Um=Np?Np.prototype:n,Gu=Um?Um.valueOf:n,s6=Um?Um.toString:n;function Ot(D){if(Jo(D)&&!Ai(D)&&!(D instanceof Ni)){if(D instanceof gc)return D;if(Oi.call(D,"__wrapped__"))return WP(D)}return new gc(D)}var Q1=function(){function D(){}return function(Y){if(!zo(Y))return{};if(Q5)return Q5(Y);D.prototype=Y;var ye=new D;return D.prototype=n,ye}}();function dh(){}function gc(D,Y){this.__wrapped__=D,this.__actions__=[],this.__chain__=!!Y,this.__index__=0,this.__values__=n}Ot.templateSettings={escape:An,evaluate:kn,interpolate:yn,variable:"",imports:{_:Ot}},Ot.prototype=dh.prototype,Ot.prototype.constructor=Ot,gc.prototype=Q1(dh.prototype),gc.prototype.constructor=gc;function Ni(D){this.__wrapped__=D,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=oe,this.__views__=[]}function i6(){var D=new Ni(this.__wrapped__);return D.__actions__=Hc(this.__actions__),D.__dir__=this.__dir__,D.__filtered__=this.__filtered__,D.__iteratees__=Hc(this.__iteratees__),D.__takeCount__=this.__takeCount__,D.__views__=Hc(this.__views__),D}function Vj(){if(this.__filtered__){var D=new Ni(this);D.__dir__=-1,D.__filtered__=!0}else D=this.clone(),D.__dir__*=-1;return D}function Z1(){var D=this.__wrapped__.value(),Y=this.__dir__,ye=Ai(D),We=Y<0,bt=ye?D.length:0,Vt=b8(0,bt,this.__views__),mn=Vt.start,In=Vt.end,qn=In-mn,Mr=We?In:mn-1,Rr=this.__iteratees__,Hr=Rr.length,ds=0,Ds=xc(qn,this.__takeCount__);if(!ye||!We&&bt==qn&&Ds==qn)return ab(D,this.__actions__);var ei=[];e:for(;qn--&&ds<Ds;){Mr+=Y;for(var Li=-1,ti=D[Mr];++Li<Hr;){var Ki=Rr[Li],Zi=Ki.iteratee,Ff=Ki.type,Zu=Zi(ti);if(Ff==q)ti=Zu;else if(!Zu){if(Ff==fe)continue e;break e}}ei[ds++]=ti}return ei}Ni.prototype=Q1(dh.prototype),Ni.prototype.constructor=Ni;function hu(D){var Y=-1,ye=D==null?0:D.length;for(this.clear();++Y<ye;){var We=D[Y];this.set(We[0],We[1])}}function Ka(){this.__data__=K1?K1(null):{},this.size=0}function za(D){var Y=this.has(D)&&delete this.__data__[D];return this.size-=Y?1:0,Y}function zm(D){var Y=this.__data__;if(K1){var ye=Y[D];return ye===c?n:ye}return Oi.call(Y,D)?Y[D]:n}function bc(D){var Y=this.__data__;return K1?Y[D]!==n:Oi.call(Y,D)}function pu(D,Y){var ye=this.__data__;return this.size+=this.has(D)?0:1,ye[D]=K1&&Y===n?c:Y,this}hu.prototype.clear=Ka,hu.prototype.delete=za,hu.prototype.get=zm,hu.prototype.has=bc,hu.prototype.set=pu;function zc(D){var Y=-1,ye=D==null?0:D.length;for(this.clear();++Y<ye;){var We=D[Y];this.set(We[0],We[1])}}function J1(){this.__data__=[],this.size=0}function mu(D){var Y=this.__data__,ye=vc(Y,D);if(ye<0)return!1;var We=Y.length-1;return ye==We?Y.pop():J5.call(Y,ye,1),--this.size,!0}function a6(D){var Y=this.__data__,ye=vc(Y,D);return ye<0?n:Y[ye][1]}function bP(D){return vc(this.__data__,D)>-1}function yP(D,Y){var ye=this.__data__,We=vc(ye,D);return We<0?(++this.size,ye.push([D,Y])):ye[We][1]=Y,this}zc.prototype.clear=J1,zc.prototype.delete=mu,zc.prototype.get=a6,zc.prototype.has=bP,zc.prototype.set=yP;function kd(D){var Y=-1,ye=D==null?0:D.length;for(this.clear();++Y<ye;){var We=D[Y];this.set(We[0],We[1])}}function vP(){this.size=0,this.__data__={hash:new hu,map:new(Ax||zc),string:new hu}}function jp(D){var Y=dv(this,D).delete(D);return this.size-=Y?1:0,Y}function o6(D){return dv(this,D).get(D)}function Wj(D){return dv(this,D).has(D)}function wP(D,Y){var ye=dv(this,D),We=ye.size;return ye.set(D,Y),this.size+=ye.size==We?0:1,this}kd.prototype.clear=vP,kd.prototype.delete=jp,kd.prototype.get=o6,kd.prototype.has=Wj,kd.prototype.set=wP;function jx(D){var Y=-1,ye=D==null?0:D.length;for(this.__data__=new kd;++Y<ye;)this.add(D[Y])}function Hm(D){return this.__data__.set(D,c),this}function eb(D){return this.__data__.has(D)}jx.prototype.add=jx.prototype.push=Hm,jx.prototype.has=eb;function yc(D){var Y=this.__data__=new zc(D);this.size=Y.size}function l6(){this.__data__=new zc,this.size=0}function c6(D){var Y=this.__data__,ye=Y.delete(D);return this.size=Y.size,ye}function Td(D){return this.__data__.get(D)}function Pd(D){return this.__data__.has(D)}function Ex(D,Y){var ye=this.__data__;if(ye instanceof zc){var We=ye.__data__;if(!Ax||We.length<s-1)return We.push([D,Y]),this.size=++ye.size,this;ye=this.__data__=new kd(We)}return ye.set(D,Y),this.size=ye.size,this}yc.prototype.clear=l6,yc.prototype.delete=c6,yc.prototype.get=Td,yc.prototype.has=Pd,yc.prototype.set=Ex;function fh(D,Y){var ye=Ai(D),We=!ye&&Sv(D),bt=!ye&&!We&&xb(D),Vt=!ye&&!We&&!bt&&eC(D),mn=ye||We||bt||Vt,In=mn?us(D.length,mc):[],qn=In.length;for(var Mr in D)(Y||Oi.call(D,Mr))&&!(mn&&(Mr=="length"||bt&&(Mr=="offset"||Mr=="parent")||Vt&&(Mr=="buffer"||Mr=="byteLength"||Mr=="byteOffset")||io(Mr,qn)))&&In.push(Mr);return In}function hh(D){var Y=D.length;return Y?D[sb(0,Y-1)]:n}function _x(D,Y){return M6(Hc(D),Ep(Y,0,D.length))}function CP(D){return M6(Hc(D))}function X2(D,Y,ye){(ye!==n&&!Lp(D[Y],ye)||ye===n&&!(Y in D))&&ph(D,Y,ye)}function kx(D,Y,ye){var We=D[Y];(!(Oi.call(D,Y)&&Lp(We,ye))||ye===n&&!(Y in D))&&ph(D,Y,ye)}function vc(D,Y){for(var ye=D.length;ye--;)if(Lp(D[ye][0],Y))return ye;return-1}function Ku(D,Y,ye,We){return xh(D,function(bt,Vt,mn){Y(We,bt,ye(bt),mn)}),We}function Ya(D,Y){return D&&Af(Y,Sc(Y),D)}function Nf(D,Y){return D&&Af(Y,$d(Y),D)}function ph(D,Y,ye){Y=="__proto__"&&W2?W2(D,Y,{configurable:!0,enumerable:!0,value:ye,writable:!0}):D[Y]=ye}function u6(D,Y){for(var ye=-1,We=Y.length,bt=Ht(We),Vt=D==null;++ye<We;)bt[ye]=Vt?n:sH(D,Y[ye]);return bt}function Ep(D,Y,ye){return D===D&&(ye!==n&&(D=D<=ye?D:ye),Y!==n&&(D=D>=Y?D:Y)),D}function xu(D,Y,ye,We,bt,Vt){var mn,In=Y&f,qn=Y&x,Mr=Y&g;if(ye&&(mn=bt?ye(D,We,bt,Vt):ye(D)),mn!==n)return mn;if(!zo(D))return D;var Rr=Ai(D);if(Rr){if(mn=hv(D),!In)return Hc(D,mn)}else{var Hr=Zl(D),ds=Hr==Ke||Hr==dt;if(xb(D))return a8(D,In);if(Hr==Be||Hr==we||ds&&!bt){if(mn=qn||ds?{}:Jl(D),!In)return qn?Dz(D,Nf(mn,D)):S6(D,Ya(mn,D))}else{if(!gt[Hr])return bt?D:{};mn=Bz(D,Hr,In)}}Vt||(Vt=new yc);var Ds=Vt.get(D);if(Ds)return Ds;Vt.set(D,mn),Ofe(D)?D.forEach(function(ti){mn.add(xu(ti,Y,ye,ti,D,Vt))}):Ife(D)&&D.forEach(function(ti,Ki){mn.set(Ki,xu(ti,Y,ye,Ki,D,Vt))});var ei=Mr?qn?uv:cv:qn?$d:Sc,Li=Rr?n:ei(D);return pr(Li||D,function(ti,Ki){Li&&(Ki=ti,ti=D[Ki]),kx(mn,Ki,xu(ti,Y,ye,Ki,D,Vt))}),mn}function SP(D){var Y=Sc(D);return function(ye){return Q2(ye,D,Y)}}function Q2(D,Y,ye){var We=ye.length;if(D==null)return!We;for(D=Ns(D);We--;){var bt=ye[We],Vt=Y[bt],mn=D[bt];if(mn===n&&!(bt in D)||!Vt(mn))return!1}return!0}function qj(D,Y,ye){if(typeof D!="function")throw new no(o);return hb(function(){D.apply(n,ye)},Y)}function mh(D,Y,ye,We){var bt=-1,Vt=Ir,mn=!0,In=D.length,qn=[],Mr=Y.length;if(!In)return qn;ye&&(Y=Jn(Y,bs(ye))),We?(Vt=yr,mn=!1):Y.length>=s&&(Vt=Us,mn=!1,Y=new jx(Y));e:for(;++bt<In;){var Rr=D[bt],Hr=ye==null?Rr:ye(Rr);if(Rr=We||Rr!==0?Rr:0,mn&&Hr===Hr){for(var ds=Mr;ds--;)if(Y[ds]===Hr)continue e;qn.push(Rr)}else Vt(Y,Hr,We)||qn.push(Rr)}return qn}var xh=Rd(Yu),NP=Rd(Vm,!0);function Z2(D,Y){var ye=!0;return xh(D,function(We,bt,Vt){return ye=!!Y(We,bt,Vt),ye}),ye}function Tx(D,Y,ye){for(var We=-1,bt=D.length;++We<bt;){var Vt=D[We],mn=Y(Vt);if(mn!=null&&(In===n?mn===mn&&!If(mn):ye(mn,In)))var In=mn,qn=Vt}return qn}function AP(D,Y,ye,We){var bt=D.length;for(ye=Ri(ye),ye<0&&(ye=-ye>bt?0:bt+ye),We=We===n||We>bt?bt:Ri(We),We<0&&(We+=bt),We=ye>We?0:Rfe(We);ye<We;)D[ye++]=Y;return D}function Gj(D,Y){var ye=[];return xh(D,function(We,bt,Vt){Y(We,bt,Vt)&&ye.push(We)}),ye}function ko(D,Y,ye,We,bt){var Vt=-1,mn=D.length;for(ye||(ye=I6),bt||(bt=[]);++Vt<mn;){var In=D[Vt];Y>0&&ye(In)?Y>1?ko(In,Y-1,ye,We,bt):gs(bt,In):We||(bt[bt.length]=In)}return bt}var d6=A6(),J2=A6(!0);function Yu(D,Y){return D&&d6(D,Y,Sc)}function Vm(D,Y){return D&&J2(D,Y,Sc)}function tb(D,Y){return is(Y,function(ye){return zx(D[ye])})}function _p(D,Y){Y=yh(Y,D);for(var ye=0,We=Y.length;D!=null&&ye<We;)D=D[kf(Y[ye++])];return ye&&ye==We?D:n}function f6(D,Y,ye){var We=Y(D);return Ai(D)?We:gs(We,ye(D))}function Xl(D){return D==null?D===n?Un:Le:Sx&&Sx in Ns(D)?P6(D):v8(D)}function Wm(D,Y){return D>Y}function Id(D,Y){return D!=null&&Oi.call(D,Y)}function Px(D,Y){return D!=null&&Y in Ns(D)}function Kj(D,Y,ye){return D>=xc(Y,ye)&&D<Qo(Y,ye)}function h6(D,Y,ye){for(var We=ye?yr:Ir,bt=D[0].length,Vt=D.length,mn=Vt,In=Ht(Vt),qn=1/0,Mr=[];mn--;){var Rr=D[mn];mn&&Y&&(Rr=Jn(Rr,bs(Y))),qn=xc(Rr.length,qn),In[mn]=!ye&&(Y||bt>=120&&Rr.length>=120)?new jx(mn&&Rr):n}Rr=D[0];var Hr=-1,ds=In[0];e:for(;++Hr<bt&&Mr.length<qn;){var Ds=Rr[Hr],ei=Y?Y(Ds):Ds;if(Ds=ye||Ds!==0?Ds:0,!(ds?Us(ds,ei):We(Mr,ei,ye))){for(mn=Vt;--mn;){var Li=In[mn];if(!(Li?Us(Li,ei):We(D[mn],ei,ye)))continue e}ds&&ds.push(ei),Mr.push(Ds)}}return Mr}function kp(D,Y,ye,We){return Yu(D,function(bt,Vt,mn){Y(We,ye(bt),Vt,mn)}),We}function Fd(D,Y,ye){Y=yh(Y,D),D=Il(D,Y);var We=D==null?D:D[kf(qc(Y))];return We==null?n:dr(We,D,ye)}function p6(D){return Jo(D)&&Xl(D)==we}function jP(D){return Jo(D)&&Xl(D)==Jt}function Tp(D){return Jo(D)&&Xl(D)==Ie}function Od(D,Y,ye,We,bt){return D===Y?!0:D==null||Y==null||!Jo(D)&&!Jo(Y)?D!==D&&Y!==Y:m6(D,Y,ye,We,Od,bt)}function m6(D,Y,ye,We,bt,Vt){var mn=Ai(D),In=Ai(Y),qn=mn?xe:Zl(D),Mr=In?xe:Zl(Y);qn=qn==we?Be:qn,Mr=Mr==we?Be:Mr;var Rr=qn==Be,Hr=Mr==Be,ds=qn==Mr;if(ds&&xb(D)){if(!xb(Y))return!1;mn=!0,Rr=!1}if(ds&&!Rr)return Vt||(Vt=new yc),mn||eC(D)?x8(D,Y,ye,We,bt,Vt):g8(D,Y,qn,ye,We,bt,Vt);if(!(ye&y)){var Ds=Rr&&Oi.call(D,"__wrapped__"),ei=Hr&&Oi.call(Y,"__wrapped__");if(Ds||ei){var Li=Ds?D.value():D,ti=ei?Y.value():Y;return Vt||(Vt=new yc),bt(Li,ti,ye,We,Vt)}}return ds?(Vt||(Vt=new yc),LP(D,Y,ye,We,bt,Vt)):!1}function EP(D){return Jo(D)&&Zl(D)==tt}function nb(D,Y,ye,We){var bt=ye.length,Vt=bt,mn=!We;if(D==null)return!Vt;for(D=Ns(D);bt--;){var In=ye[bt];if(mn&&In[2]?In[1]!==D[In[0]]:!(In[0]in D))return!1}for(;++bt<Vt;){In=ye[bt];var qn=In[0],Mr=D[qn],Rr=In[1];if(mn&&In[2]){if(Mr===n&&!(qn in D))return!1}else{var Hr=new yc;if(We)var ds=We(Mr,Rr,qn,D,Y,Hr);if(!(ds===n?Od(Rr,Mr,y|v,We,Hr):ds))return!1}}return!0}function Yj(D){if(!zo(D)||$P(D))return!1;var Y=zx(D)?hP:hr;return Y.test(Ym(D))}function ev(D){return Jo(D)&&Xl(D)==Gt}function gh(D){return Jo(D)&&Zl(D)==wt}function tv(D){return Jo(D)&&iI(D.length)&&!!et[Xl(D)]}function rb(D){return typeof D=="function"?D:D==null?Ud:typeof D=="object"?Ai(D)?so(D[0],D[1]):x6(D):Gfe(D)}function Pp(D){if(!Mp(D))return G1(D);var Y=[];for(var ye in Ns(D))Oi.call(D,ye)&&ye!="constructor"&&Y.push(ye);return Y}function Xj(D){if(!zo(D))return HP(D);var Y=Mp(D),ye=[];for(var We in D)We=="constructor"&&(Y||!Oi.call(D,We))||ye.push(We);return ye}function qm(D,Y){return D<Y}function Qj(D,Y){var ye=-1,We=Bd(D)?Ht(D.length):[];return xh(D,function(bt,Vt,mn){We[++ye]=Y(bt,Vt,mn)}),We}function x6(D){var Y=fv(D);return Y.length==1&&Y[0][2]?F6(Y[0][0],Y[0][1]):function(ye){return ye===D||nb(ye,D,Y)}}function so(D,Y){return vs(D)&&mv(Y)?F6(kf(D),Y):function(ye){var We=sH(ye,D);return We===n&&We===Y?iH(ye,D):Od(Y,We,y|v)}}function Ix(D,Y,ye,We,bt){D!==Y&&d6(Y,function(Vt,mn){if(bt||(bt=new yc),zo(Vt))Zj(D,Y,mn,ye,Ix,We,bt);else{var In=We?We(Ch(D,mn),Vt,mn+"",D,Y,bt):n;In===n&&(In=Vt),X2(D,mn,In)}},$d)}function Zj(D,Y,ye,We,bt,Vt,mn){var In=Ch(D,ye),qn=Ch(Y,ye),Mr=mn.get(qn);if(Mr){X2(D,ye,Mr);return}var Rr=Vt?Vt(In,qn,ye+"",D,Y,mn):n,Hr=Rr===n;if(Hr){var ds=Ai(qn),Ds=!ds&&xb(qn),ei=!ds&&!Ds&&eC(qn);Rr=qn,ds||Ds||ei?Ai(In)?Rr=In:xl(In)?Rr=Hc(In):Ds?(Hr=!1,Rr=a8(qn,!0)):ei?(Hr=!1,Rr=IP(qn,!0)):Rr=[]:D8(qn)||Sv(qn)?(Rr=In,Sv(In)?Rr=Lfe(In):(!zo(In)||zx(In))&&(Rr=Jl(qn))):Hr=!1}Hr&&(mn.set(qn,Rr),bt(Rr,qn,We,Vt,mn),mn.delete(qn)),X2(D,ye,Rr)}function g6(D,Y){var ye=D.length;if(ye)return Y+=Y<0?ye:0,io(Y,ye)?D[Y]:n}function nv(D,Y,ye){Y.length?Y=Jn(Y,function(Vt){return Ai(Vt)?function(mn){return _p(mn,Vt.length===1?Vt[0]:Vt)}:Vt}):Y=[Ud];var We=-1;Y=Jn(Y,bs(Gs()));var bt=Qj(D,function(Vt,mn,In){var qn=Jn(Y,function(Mr){return Mr(Vt)});return{criteria:qn,index:++We,value:Vt}});return Hn(bt,function(Vt,mn){return Lz(Vt,mn,ye)})}function Jj(D,Y){return Gm(D,Y,function(ye,We){return iH(D,We)})}function Gm(D,Y,ye){for(var We=-1,bt=Y.length,Vt={};++We<bt;){var mn=Y[We],In=_p(D,mn);ye(In,mn)&&Ox(Vt,yh(mn,D),In)}return Vt}function go(D){return function(Y){return _p(Y,D)}}function Uo(D,Y,ye,We){var bt=We?Or:Wn,Vt=-1,mn=Y.length,In=D;for(D===Y&&(Y=Hc(Y)),ye&&(In=Jn(D,bs(ye)));++Vt<mn;)for(var qn=0,Mr=Y[Vt],Rr=ye?ye(Mr):Mr;(qn=bt(In,Rr,qn,We))>-1;)In!==D&&J5.call(In,qn,1),J5.call(D,qn,1);return D}function hl(D,Y){for(var ye=D?Y.length:0,We=ye-1;ye--;){var bt=Y[ye];if(ye==We||bt!==Vt){var Vt=bt;io(bt)?J5.call(D,bt,1):v6(D,bt)}}return D}function sb(D,Y){return D+Dm(q2()*(Y-D+1))}function rv(D,Y,ye,We){for(var bt=-1,Vt=Qo(Nx((Y-D)/(ye||1)),0),mn=Ht(Vt);Vt--;)mn[We?Vt:++bt]=D,D+=ye;return mn}function Fx(D,Y){var ye="";if(!D||Y<1||Y>W)return ye;do Y%2&&(ye+=D),Y=Dm(Y/2),Y&&(D+=D);while(Y);return ye}function Mi(D,Y){return Xu(O6(D,Y,Ud),D+"")}function wc(D){return hh(tC(D))}function e8(D,Y){var ye=tC(D);return M6(ye,Ep(Y,0,ye.length))}function Ox(D,Y,ye,We){if(!zo(D))return D;Y=yh(Y,D);for(var bt=-1,Vt=Y.length,mn=Vt-1,In=D;In!=null&&++bt<Vt;){var qn=kf(Y[bt]),Mr=ye;if(qn==="__proto__"||qn==="constructor"||qn==="prototype")return D;if(bt!=mn){var Rr=In[qn];Mr=We?We(Rr,qn,In):n,Mr===n&&(Mr=zo(Rr)?Rr:io(Y[bt+1])?[]:{})}kx(In,qn,Mr),In=In[qn]}return D}var b6=r6?function(D,Y){return r6.set(D,Y),D}:Ud,bh=W2?function(D,Y){return W2(D,"toString",{configurable:!0,enumerable:!1,value:oH(Y),writable:!0})}:Ud;function Md(D){return M6(tC(D))}function Cc(D,Y,ye){var We=-1,bt=D.length;Y<0&&(Y=-Y>bt?0:bt+Y),ye=ye>bt?bt:ye,ye<0&&(ye+=bt),bt=Y>ye?0:ye-Y>>>0,Y>>>=0;for(var Vt=Ht(bt);++We<bt;)Vt[We]=D[We+Y];return Vt}function t8(D,Y){var ye;return xh(D,function(We,bt,Vt){return ye=Y(We,bt,Vt),!ye}),!!ye}function ib(D,Y,ye){var We=0,bt=D==null?We:D.length;if(typeof Y=="number"&&Y===Y&&bt<=Ce){for(;We<bt;){var Vt=We+bt>>>1,mn=D[Vt];mn!==null&&!If(mn)&&(ye?mn<=Y:mn<Y)?We=Vt+1:bt=Vt}return bt}return y6(D,Y,Ud,ye)}function y6(D,Y,ye,We){var bt=0,Vt=D==null?0:D.length;if(Vt===0)return 0;Y=ye(Y);for(var mn=Y!==Y,In=Y===null,qn=If(Y),Mr=Y===n;bt<Vt;){var Rr=Dm((bt+Vt)/2),Hr=ye(D[Rr]),ds=Hr!==n,Ds=Hr===null,ei=Hr===Hr,Li=If(Hr);if(mn)var ti=We||ei;else Mr?ti=ei&&(We||ds):In?ti=ei&&ds&&(We||!Ds):qn?ti=ei&&ds&&!Ds&&(We||!Li):Ds||Li?ti=!1:ti=We?Hr<=Y:Hr<Y;ti?bt=Rr+1:Vt=Rr}return xc(Vt,de)}function n8(D,Y){for(var ye=-1,We=D.length,bt=0,Vt=[];++ye<We;){var mn=D[ye],In=Y?Y(mn):mn;if(!ye||!Lp(In,qn)){var qn=In;Vt[bt++]=mn===0?0:mn}}return Vt}function r8(D){return typeof D=="number"?D:If(D)?ee:+D}function gu(D){if(typeof D=="string")return D;if(Ai(D))return Jn(D,gu)+"";if(If(D))return s6?s6.call(D):"";var Y=D+"";return Y=="0"&&1/D==-1/0?"-0":Y}function Ip(D,Y,ye){var We=-1,bt=Ir,Vt=D.length,mn=!0,In=[],qn=In;if(ye)mn=!1,bt=yr;else if(Vt>=s){var Mr=Y?null:RP(D);if(Mr)return w(Mr);mn=!1,bt=Us,qn=new jx}else qn=Y?[]:In;e:for(;++We<Vt;){var Rr=D[We],Hr=Y?Y(Rr):Rr;if(Rr=ye||Rr!==0?Rr:0,mn&&Hr===Hr){for(var ds=qn.length;ds--;)if(qn[ds]===Hr)continue e;Y&&qn.push(Hr),In.push(Rr)}else bt(qn,Hr,ye)||(qn!==In&&qn.push(Hr),In.push(Rr))}return In}function v6(D,Y){return Y=yh(Y,D),D=Il(D,Y),D==null||delete D[kf(qc(Y))]}function s8(D,Y,ye,We){return Ox(D,Y,ye(_p(D,Y)),We)}function sv(D,Y,ye,We){for(var bt=D.length,Vt=We?bt:-1;(We?Vt--:++Vt<bt)&&Y(D[Vt],Vt,D););return ye?Cc(D,We?0:Vt,We?Vt+1:bt):Cc(D,We?Vt+1:0,We?bt:Vt)}function ab(D,Y){var ye=D;return ye instanceof Ni&&(ye=ye.value()),Zs(Y,function(We,bt){return bt.func.apply(bt.thisArg,gs([We],bt.args))},ye)}function w6(D,Y,ye){var We=D.length;if(We<2)return We?Ip(D[0]):[];for(var bt=-1,Vt=Ht(We);++bt<We;)for(var mn=D[bt],In=-1;++In<We;)In!=bt&&(Vt[bt]=mh(Vt[bt]||mn,D[In],Y,ye));return Ip(ko(Vt,1),Y,ye)}function iv(D,Y,ye){for(var We=-1,bt=D.length,Vt=Y.length,mn={};++We<bt;){var In=We<Vt?Y[We]:n;ye(mn,D[We],In)}return mn}function ob(D){return xl(D)?D:[]}function C6(D){return typeof D=="function"?D:Ud}function yh(D,Y){return Ai(D)?D:vs(D,Y)?[D]:S8(Pa(D))}var _P=Mi;function Fp(D,Y,ye){var We=D.length;return ye=ye===n?We:ye,!Y&&ye>=We?D:Cc(D,Y,ye)}var i8=mP||function(D){return mr.clearTimeout(D)};function a8(D,Y){if(Y)return D.slice();var ye=D.length,We=$j?$j(ye):new D.constructor(ye);return D.copy(We),We}function av(D){var Y=new D.constructor(D.byteLength);return new V2(Y).set(new V2(D)),Y}function kP(D,Y){var ye=Y?av(D.buffer):D.buffer;return new D.constructor(ye,D.byteOffset,D.byteLength)}function TP(D){var Y=new D.constructor(D.source,Pn.exec(D));return Y.lastIndex=D.lastIndex,Y}function PP(D){return Gu?Ns(Gu.call(D)):{}}function IP(D,Y){var ye=Y?av(D.buffer):D.buffer;return new D.constructor(ye,D.byteOffset,D.length)}function o8(D,Y){if(D!==Y){var ye=D!==n,We=D===null,bt=D===D,Vt=If(D),mn=Y!==n,In=Y===null,qn=Y===Y,Mr=If(Y);if(!In&&!Mr&&!Vt&&D>Y||Vt&&mn&&qn&&!In&&!Mr||We&&mn&&qn||!ye&&qn||!bt)return 1;if(!We&&!Vt&&!Mr&&D<Y||Mr&&ye&&bt&&!We&&!Vt||In&&ye&&bt||!mn&&bt||!qn)return-1}return 0}function Lz(D,Y,ye){for(var We=-1,bt=D.criteria,Vt=Y.criteria,mn=bt.length,In=ye.length;++We<mn;){var qn=o8(bt[We],Vt[We]);if(qn){if(We>=In)return qn;var Mr=ye[We];return qn*(Mr=="desc"?-1:1)}}return D.index-Y.index}function FP(D,Y,ye,We){for(var bt=-1,Vt=D.length,mn=ye.length,In=-1,qn=Y.length,Mr=Qo(Vt-mn,0),Rr=Ht(qn+Mr),Hr=!We;++In<qn;)Rr[In]=Y[In];for(;++bt<mn;)(Hr||bt<Vt)&&(Rr[ye[bt]]=D[bt]);for(;Mr--;)Rr[In++]=D[bt++];return Rr}function l8(D,Y,ye,We){for(var bt=-1,Vt=D.length,mn=-1,In=ye.length,qn=-1,Mr=Y.length,Rr=Qo(Vt-In,0),Hr=Ht(Rr+Mr),ds=!We;++bt<Rr;)Hr[bt]=D[bt];for(var Ds=bt;++qn<Mr;)Hr[Ds+qn]=Y[qn];for(;++mn<In;)(ds||bt<Vt)&&(Hr[Ds+ye[mn]]=D[bt++]);return Hr}function Hc(D,Y){var ye=-1,We=D.length;for(Y||(Y=Ht(We));++ye<We;)Y[ye]=D[ye];return Y}function Af(D,Y,ye,We){var bt=!ye;ye||(ye={});for(var Vt=-1,mn=Y.length;++Vt<mn;){var In=Y[Vt],qn=We?We(ye[In],D[In],In,ye,D):n;qn===n&&(qn=D[In]),bt?ph(ye,In,qn):kx(ye,In,qn)}return ye}function S6(D,Y){return Af(D,jf(D),Y)}function Dz(D,Y){return Af(D,DP(D),Y)}function N6(D,Y){return function(ye,We){var bt=Ai(ye)?Er:Ku,Vt=Y?Y():{};return bt(ye,D,Gs(We,2),Vt)}}function lb(D){return Mi(function(Y,ye){var We=-1,bt=ye.length,Vt=bt>1?ye[bt-1]:n,mn=bt>2?ye[2]:n;for(Vt=D.length>3&&typeof Vt=="function"?(bt--,Vt):n,mn&&Wc(ye[0],ye[1],mn)&&(Vt=bt<3?n:Vt,bt=1),Y=Ns(Y);++We<bt;){var In=ye[We];In&&D(Y,In,We,Vt)}return Y})}function Rd(D,Y){return function(ye,We){if(ye==null)return ye;if(!Bd(ye))return D(ye,We);for(var bt=ye.length,Vt=Y?bt:-1,mn=Ns(ye);(Y?Vt--:++Vt<bt)&&We(mn[Vt],Vt,mn)!==!1;);return ye}}function A6(D){return function(Y,ye,We){for(var bt=-1,Vt=Ns(Y),mn=We(Y),In=mn.length;In--;){var qn=mn[D?In:++bt];if(ye(Vt[qn],qn,Vt)===!1)break}return Y}}function j6(D,Y,ye){var We=Y&C,bt=cb(D);function Vt(){var mn=this&&this!==mr&&this instanceof Vt?bt:D;return mn.apply(We?ye:this,arguments)}return Vt}function c8(D){return function(Y){Y=Pa(Y);var ye=Yo(Y)?Q(Y):n,We=ye?ye[0]:Y.charAt(0),bt=ye?Fp(ye,1).join(""):Y.slice(1);return We[D]()+bt}}function Mx(D){return function(Y){return Zs(Wfe(Vfe(Y).replace(ur,"")),D,"")}}function cb(D){return function(){var Y=arguments;switch(Y.length){case 0:return new D;case 1:return new D(Y[0]);case 2:return new D(Y[0],Y[1]);case 3:return new D(Y[0],Y[1],Y[2]);case 4:return new D(Y[0],Y[1],Y[2],Y[3]);case 5:return new D(Y[0],Y[1],Y[2],Y[3],Y[4]);case 6:return new D(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);case 7:return new D(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5],Y[6])}var ye=Q1(D.prototype),We=D.apply(ye,Y);return zo(We)?We:ye}}function u8(D,Y,ye){var We=cb(D);function bt(){for(var Vt=arguments.length,mn=Ht(Vt),In=Vt,qn=Op(bt);In--;)mn[In]=arguments[In];var Mr=Vt<3&&mn[0]!==qn&&mn[Vt-1]!==qn?[]:ft(mn,qn);if(Vt-=Mr.length,Vt<ye)return Vc(D,Y,ub,bt.placeholder,n,mn,Mr,n,n,ye-Vt);var Rr=this&&this!==mr&&this instanceof bt?We:D;return dr(Rr,this,mn)}return bt}function Rx(D){return function(Y,ye,We){var bt=Ns(Y);if(!Bd(Y)){var Vt=Gs(ye,3);Y=Sc(Y),ye=function(In){return Vt(bt[In],In,bt)}}var mn=D(Y,ye,We);return mn>-1?bt[Vt?Y[mn]:mn]:n}}function E6(D){return wh(function(Y){var ye=Y.length,We=ye,bt=gc.prototype.thru;for(D&&Y.reverse();We--;){var Vt=Y[We];if(typeof Vt!="function")throw new no(o);if(bt&&!mn&&db(Vt)=="wrapper")var mn=new gc([],!0)}for(We=mn?We:ye;++We<ye;){Vt=Y[We];var In=db(Vt),qn=In=="wrapper"?T6(Vt):n;qn&&pv(qn[0])&&qn[1]==(L|T|F|z)&&!qn[4].length&&qn[9]==1?mn=mn[db(qn[0])].apply(mn,qn[3]):mn=Vt.length==1&&pv(Vt)?mn[In]():mn.thru(Vt)}return function(){var Mr=arguments,Rr=Mr[0];if(mn&&Mr.length==1&&Ai(Rr))return mn.plant(Rr).value();for(var Hr=0,ds=ye?Y[Hr].apply(this,Mr):Rr;++Hr<ye;)ds=Y[Hr].call(this,ds);return ds}})}function ub(D,Y,ye,We,bt,Vt,mn,In,qn,Mr){var Rr=Y&L,Hr=Y&C,ds=Y&N,Ds=Y&(T|M),ei=Y&X,Li=ds?n:cb(D);function ti(){for(var Ki=arguments.length,Zi=Ht(Ki),Ff=Ki;Ff--;)Zi[Ff]=arguments[Ff];if(Ds)var Zu=Op(ti),Of=pc(Zi,Zu);if(We&&(Zi=FP(Zi,We,bt,Ds)),Vt&&(Zi=l8(Zi,Vt,mn,Ds)),Ki-=Of,Ds&&Ki<Mr){var gl=ft(Zi,Zu);return Vc(D,Y,ub,ti.placeholder,ye,Zi,gl,In,qn,Mr-Ki)}var Dp=Hr?ye:this,Vx=ds?Dp[D]:D;return Ki=Zi.length,In?Zi=Ef(Zi,In):ei&&Ki>1&&Zi.reverse(),Rr&&qn<Ki&&(Zi.length=qn),this&&this!==mr&&this instanceof ti&&(Vx=Li||cb(Vx)),Vx.apply(Dp,Zi)}return ti}function OP(D,Y){return function(ye,We){return kp(ye,D,Y(We),{})}}function ov(D,Y){return function(ye,We){var bt;if(ye===n&&We===n)return Y;if(ye!==n&&(bt=ye),We!==n){if(bt===n)return We;typeof ye=="string"||typeof We=="string"?(ye=gu(ye),We=gu(We)):(ye=r8(ye),We=r8(We)),bt=D(ye,We)}return bt}}function _6(D){return wh(function(Y){return Y=Jn(Y,bs(Gs())),Mi(function(ye){var We=this;return D(Y,function(bt){return dr(bt,We,ye)})})})}function lv(D,Y){Y=Y===n?" ":gu(Y);var ye=Y.length;if(ye<2)return ye?Fx(Y,D):Y;var We=Fx(Y,Nx(D/H(Y)));return Yo(Y)?Fp(Q(We),0,D).join(""):We.slice(0,D)}function MP(D,Y,ye,We){var bt=Y&C,Vt=cb(D);function mn(){for(var In=-1,qn=arguments.length,Mr=-1,Rr=We.length,Hr=Ht(Rr+qn),ds=this&&this!==mr&&this instanceof mn?Vt:D;++Mr<Rr;)Hr[Mr]=We[Mr];for(;qn--;)Hr[Mr++]=arguments[++In];return dr(ds,bt?ye:this,Hr)}return mn}function d8(D){return function(Y,ye,We){return We&&typeof We!="number"&&Wc(Y,ye,We)&&(ye=We=n),Y=Hx(Y),ye===n?(ye=Y,Y=0):ye=Hx(ye),We=We===n?Y<ye?1:-1:Hx(We),rv(Y,ye,We,D)}}function k6(D){return function(Y,ye){return typeof Y=="string"&&typeof ye=="string"||(Y=Sh(Y),ye=Sh(ye)),D(Y,ye)}}function Vc(D,Y,ye,We,bt,Vt,mn,In,qn,Mr){var Rr=Y&T,Hr=Rr?mn:n,ds=Rr?n:mn,Ds=Rr?Vt:n,ei=Rr?n:Vt;Y|=Rr?F:$,Y&=~(Rr?$:F),Y&P||(Y&=-4);var Li=[D,Y,bt,Ds,Hr,ei,ds,In,qn,Mr],ti=ye.apply(n,Li);return pv(D)&&w8(ti,Li),ti.placeholder=We,C8(ti,D,Y)}function Ql(D){var Y=jr[D];return function(ye,We){if(ye=Sh(ye),We=We==null?0:xc(Ri(We),292),We&&q1(ye)){var bt=(Pa(ye)+"e").split("e"),Vt=Y(bt[0]+"e"+(+bt[1]+We));return bt=(Pa(Vt)+"e").split("e"),+(bt[0]+"e"+(+bt[1]-We))}return Y(ye)}}var RP=Bm&&1/w(new Bm([,-0]))[1]==ae?function(D){return new Bm(D)}:uH;function f8(D){return function(Y){var ye=Zl(Y);return ye==tt?yi(Y):ye==wt?E(Y):as(Y,D(Y))}}function vh(D,Y,ye,We,bt,Vt,mn,In){var qn=Y&N;if(!qn&&typeof D!="function")throw new no(o);var Mr=We?We.length:0;if(Mr||(Y&=-97,We=bt=n),mn=mn===n?mn:Qo(Ri(mn),0),In=In===n?In:Ri(In),Mr-=bt?bt.length:0,Y&$){var Rr=We,Hr=bt;We=bt=n}var ds=qn?n:T6(D),Ds=[D,Y,ye,We,bt,Rr,Hr,Vt,mn,In];if(ds&&zP(Ds,ds),D=Ds[0],Y=Ds[1],ye=Ds[2],We=Ds[3],bt=Ds[4],In=Ds[9]=Ds[9]===n?qn?0:D.length:Qo(Ds[9]-Mr,0),!In&&Y&(T|M)&&(Y&=-25),!Y||Y==C)var ei=j6(D,Y,ye);else Y==T||Y==M?ei=u8(D,Y,In):(Y==F||Y==(C|F))&&!bt.length?ei=MP(D,Y,ye,We):ei=ub.apply(n,Ds);var Li=ds?b6:w8;return C8(Li(ei,Ds),D,Y)}function h8(D,Y,ye,We){return D===n||Lp(D,Ta[ye])&&!Oi.call(We,ye)?Y:D}function p8(D,Y,ye,We,bt,Vt){return zo(D)&&zo(Y)&&(Vt.set(Y,D),Ix(D,Y,n,p8,Vt),Vt.delete(Y)),D}function m8(D){return D8(D)?n:D}function x8(D,Y,ye,We,bt,Vt){var mn=ye&y,In=D.length,qn=Y.length;if(In!=qn&&!(mn&&qn>In))return!1;var Mr=Vt.get(D),Rr=Vt.get(Y);if(Mr&&Rr)return Mr==Y&&Rr==D;var Hr=-1,ds=!0,Ds=ye&v?new jx:n;for(Vt.set(D,Y),Vt.set(Y,D);++Hr<In;){var ei=D[Hr],Li=Y[Hr];if(We)var ti=mn?We(Li,ei,Hr,Y,D,Vt):We(ei,Li,Hr,D,Y,Vt);if(ti!==n){if(ti)continue;ds=!1;break}if(Ds){if(!Fr(Y,function(Ki,Zi){if(!Us(Ds,Zi)&&(ei===Ki||bt(ei,Ki,ye,We,Vt)))return Ds.push(Zi)})){ds=!1;break}}else if(!(ei===Li||bt(ei,Li,ye,We,Vt))){ds=!1;break}}return Vt.delete(D),Vt.delete(Y),ds}function g8(D,Y,ye,We,bt,Vt,mn){switch(ye){case Ye:if(D.byteLength!=Y.byteLength||D.byteOffset!=Y.byteOffset)return!1;D=D.buffer,Y=Y.buffer;case Jt:return!(D.byteLength!=Y.byteLength||!Vt(new V2(D),new V2(Y)));case je:case Ie:case nt:return Lp(+D,+Y);case Qe:return D.name==Y.name&&D.message==Y.message;case Gt:case nn:return D==Y+"";case tt:var In=yi;case wt:var qn=We&y;if(In||(In=w),D.size!=Y.size&&!qn)return!1;var Mr=mn.get(D);if(Mr)return Mr==Y;We|=v,mn.set(D,Y);var Rr=x8(In(D),In(Y),We,bt,Vt,mn);return mn.delete(D),Rr;case cn:if(Gu)return Gu.call(D)==Gu.call(Y)}return!1}function LP(D,Y,ye,We,bt,Vt){var mn=ye&y,In=cv(D),qn=In.length,Mr=cv(Y),Rr=Mr.length;if(qn!=Rr&&!mn)return!1;for(var Hr=qn;Hr--;){var ds=In[Hr];if(!(mn?ds in Y:Oi.call(Y,ds)))return!1}var Ds=Vt.get(D),ei=Vt.get(Y);if(Ds&&ei)return Ds==Y&&ei==D;var Li=!0;Vt.set(D,Y),Vt.set(Y,D);for(var ti=mn;++Hr<qn;){ds=In[Hr];var Ki=D[ds],Zi=Y[ds];if(We)var Ff=mn?We(Zi,Ki,ds,Y,D,Vt):We(Ki,Zi,ds,D,Y,Vt);if(!(Ff===n?Ki===Zi||bt(Ki,Zi,ye,We,Vt):Ff)){Li=!1;break}ti||(ti=ds=="constructor")}if(Li&&!ti){var Zu=D.constructor,Of=Y.constructor;Zu!=Of&&"constructor"in D&&"constructor"in Y&&!(typeof Zu=="function"&&Zu instanceof Zu&&typeof Of=="function"&&Of instanceof Of)&&(Li=!1)}return Vt.delete(D),Vt.delete(Y),Li}function wh(D){return Xu(O6(D,n,L6),D+"")}function cv(D){return f6(D,Sc,jf)}function uv(D){return f6(D,$d,DP)}var T6=r6?function(D){return r6.get(D)}:uH;function db(D){for(var Y=D.name+"",ye=Y1[Y],We=Oi.call(Y1,Y)?ye.length:0;We--;){var bt=ye[We],Vt=bt.func;if(Vt==null||Vt==D)return bt.name}return Y}function Op(D){var Y=Oi.call(Ot,"placeholder")?Ot:D;return Y.placeholder}function Gs(){var D=Ot.iteratee||lH;return D=D===lH?rb:D,arguments.length?D(arguments[0],arguments[1]):D}function dv(D,Y){var ye=D.__data__;return fb(Y)?ye[typeof Y=="string"?"string":"hash"]:ye.map}function fv(D){for(var Y=Sc(D),ye=Y.length;ye--;){var We=Y[ye],bt=D[We];Y[ye]=[We,bt,mv(bt)]}return Y}function Km(D,Y){var ye=va(D,Y);return Yj(ye)?ye:n}function P6(D){var Y=Oi.call(D,Sx),ye=D[Sx];try{D[Sx]=n;var We=!0}catch{}var bt=z2.call(D);return We&&(Y?D[Sx]=ye:delete D[Sx]),bt}var jf=e6?function(D){return D==null?[]:(D=Ns(D),is(e6(D),function(Y){return Z5.call(D,Y)}))}:dH,DP=e6?function(D){for(var Y=[];D;)gs(Y,jf(D)),D=Sf(D);return Y}:dH,Zl=Xl;(G2&&Zl(new G2(new ArrayBuffer(1)))!=Ye||Ax&&Zl(new Ax)!=tt||K2&&Zl(K2.resolve())!=ht||Bm&&Zl(new Bm)!=wt||Y2&&Zl(new Y2)!=Xt)&&(Zl=function(D){var Y=Xl(D),ye=Y==Be?D.constructor:n,We=ye?Ym(ye):"";if(We)switch(We){case Hj:return Ye;case $m:return tt;case gP:return ht;case X1:return wt;case uh:return Xt}return Y});function b8(D,Y,ye){for(var We=-1,bt=ye.length;++We<bt;){var Vt=ye[We],mn=Vt.size;switch(Vt.type){case"drop":D+=mn;break;case"dropRight":Y-=mn;break;case"take":Y=xc(Y,D+mn);break;case"takeRight":D=Qo(D,Y-mn);break}}return{start:D,end:Y}}function BP(D){var Y=D.match(sn);return Y?Y[1].split(jt):[]}function y8(D,Y,ye){Y=yh(Y,D);for(var We=-1,bt=Y.length,Vt=!1;++We<bt;){var mn=kf(Y[We]);if(!(Vt=D!=null&&ye(D,mn)))break;D=D[mn]}return Vt||++We!=bt?Vt:(bt=D==null?0:D.length,!!bt&&iI(bt)&&io(mn,bt)&&(Ai(D)||Sv(D)))}function hv(D){var Y=D.length,ye=new D.constructor(Y);return Y&&typeof D[0]=="string"&&Oi.call(D,"index")&&(ye.index=D.index,ye.input=D.input),ye}function Jl(D){return typeof D.constructor=="function"&&!Mp(D)?Q1(Sf(D)):{}}function Bz(D,Y,ye){var We=D.constructor;switch(Y){case Jt:return av(D);case je:case Ie:return new We(+D);case Ye:return kP(D,ye);case Je:case It:case hn:case Yt:case Rt:case ot:case De:case At:case ze:return IP(D,ye);case tt:return new We;case nt:case nn:return new We(D);case Gt:return TP(D);case wt:return new We;case cn:return PP(D)}}function $z(D,Y){var ye=Y.length;if(!ye)return D;var We=ye-1;return Y[We]=(ye>1?"& ":"")+Y[We],Y=Y.join(ye>2?", ":" "),D.replace(Zt,`{
/* [wrapped with `+Y+`] */
`)}function I6(D){return Ai(D)||Sv(D)||!!(pP&&D&&D[pP])}function io(D,Y){var ye=typeof D;return Y=Y??W,!!Y&&(ye=="number"||ye!="symbol"&&zn.test(D))&&D>-1&&D%1==0&&D<Y}function Wc(D,Y,ye){if(!zo(ye))return!1;var We=typeof Y;return(We=="number"?Bd(ye)&&io(Y,ye.length):We=="string"&&Y in ye)?Lp(ye[Y],D):!1}function vs(D,Y){if(Ai(D))return!1;var ye=typeof D;return ye=="number"||ye=="symbol"||ye=="boolean"||D==null||If(D)?!0:Kn.test(D)||!Vn.test(D)||Y!=null&&D in Ns(Y)}function fb(D){var Y=typeof D;return Y=="string"||Y=="number"||Y=="symbol"||Y=="boolean"?D!=="__proto__":D===null}function pv(D){var Y=db(D),ye=Ot[Y];if(typeof ye!="function"||!(Y in Ni.prototype))return!1;if(D===ye)return!0;var We=T6(ye);return!!We&&D===We[0]}function $P(D){return!!W1&&W1 in D}var Uz=Xo?zx:fH;function Mp(D){var Y=D&&D.constructor,ye=typeof Y=="function"&&Y.prototype||Ta;return D===ye}function mv(D){return D===D&&!zo(D)}function F6(D,Y){return function(ye){return ye==null?!1:ye[D]===Y&&(Y!==n||D in Ns(ye))}}function UP(D){var Y=Xr(D,function(We){return ye.size===u&&ye.clear(),We}),ye=Y.cache;return Y}function zP(D,Y){var ye=D[1],We=Y[1],bt=ye|We,Vt=bt<(C|N|L),mn=We==L&&ye==T||We==L&&ye==z&&D[7].length<=Y[8]||We==(L|z)&&Y[7].length<=Y[8]&&ye==T;if(!(Vt||mn))return D;We&C&&(D[2]=Y[2],bt|=ye&C?0:P);var In=Y[3];if(In){var qn=D[3];D[3]=qn?FP(qn,In,Y[4]):In,D[4]=qn?ft(D[3],d):Y[4]}return In=Y[5],In&&(qn=D[5],D[5]=qn?l8(qn,In,Y[6]):In,D[6]=qn?ft(D[5],d):Y[6]),In=Y[7],In&&(D[7]=In),We&L&&(D[8]=D[8]==null?Y[8]:xc(D[8],Y[8])),D[9]==null&&(D[9]=Y[9]),D[0]=Y[0],D[1]=bt,D}function HP(D){var Y=[];if(D!=null)for(var ye in Ns(D))Y.push(ye);return Y}function v8(D){return z2.call(D)}function O6(D,Y,ye){return Y=Qo(Y===n?D.length-1:Y,0),function(){for(var We=arguments,bt=-1,Vt=Qo(We.length-Y,0),mn=Ht(Vt);++bt<Vt;)mn[bt]=We[Y+bt];bt=-1;for(var In=Ht(Y+1);++bt<Y;)In[bt]=We[bt];return In[Y]=ye(mn),dr(D,this,In)}}function Il(D,Y){return Y.length<2?D:_p(D,Cc(Y,0,-1))}function Ef(D,Y){for(var ye=D.length,We=xc(Y.length,ye),bt=Hc(D);We--;){var Vt=Y[We];D[We]=io(Vt,ye)?bt[Vt]:n}return D}function Ch(D,Y){if(!(Y==="constructor"&&typeof D[Y]=="function")&&Y!="__proto__")return D[Y]}var w8=_f(b6),hb=Uj||function(D,Y){return mr.setTimeout(D,Y)},Xu=_f(bh);function C8(D,Y,ye){var We=Y+"";return Xu(D,$z(We,VP(BP(We),ye)))}function _f(D){var Y=0,ye=0;return function(){var We=Rz(),bt=te-(We-ye);if(ye=We,bt>0){if(++Y>=K)return arguments[0]}else Y=0;return D.apply(n,arguments)}}function M6(D,Y){var ye=-1,We=D.length,bt=We-1;for(Y=Y===n?We:Y;++ye<Y;){var Vt=sb(ye,bt),mn=D[Vt];D[Vt]=D[ye],D[ye]=mn}return D.length=Y,D}var S8=UP(function(D){var Y=[];return D.charCodeAt(0)===46&&Y.push(""),D.replace(Dn,function(ye,We,bt,Vt){Y.push(bt?Vt.replace(Dt,"$1"):We||ye)}),Y});function kf(D){if(typeof D=="string"||If(D))return D;var Y=D+"";return Y=="0"&&1/D==-1/0?"-0":Y}function Ym(D){if(D!=null){try{return _d.call(D)}catch{}try{return D+""}catch{}}return""}function VP(D,Y){return pr(me,function(ye){var We="_."+ye[0];Y&ye[1]&&!Ir(D,We)&&D.push(We)}),D.sort()}function WP(D){if(D instanceof Ni)return D.clone();var Y=new gc(D.__wrapped__,D.__chain__);return Y.__actions__=Hc(D.__actions__),Y.__index__=D.__index__,Y.__values__=D.__values__,Y}function R6(D,Y,ye){(ye?Wc(D,Y,ye):Y===n)?Y=1:Y=Qo(Ri(Y),0);var We=D==null?0:D.length;if(!We||Y<1)return[];for(var bt=0,Vt=0,mn=Ht(Nx(We/Y));bt<We;)mn[Vt++]=Cc(D,bt,bt+=Y);return mn}function N8(D){for(var Y=-1,ye=D==null?0:D.length,We=0,bt=[];++Y<ye;){var Vt=D[Y];Vt&&(bt[We++]=Vt)}return bt}function Ld(){var D=arguments.length;if(!D)return[];for(var Y=Ht(D-1),ye=arguments[0],We=D;We--;)Y[We-1]=arguments[We];return gs(Ai(ye)?Hc(ye):[ye],ko(Y,1))}var Qi=Mi(function(D,Y){return xl(D)?mh(D,ko(Y,1,xl,!0)):[]}),Fl=Mi(function(D,Y){var ye=qc(Y);return xl(ye)&&(ye=n),xl(D)?mh(D,ko(Y,1,xl,!0),Gs(ye,2)):[]}),Zo=Mi(function(D,Y){var ye=qc(Y);return xl(ye)&&(ye=n),xl(D)?mh(D,ko(Y,1,xl,!0),n,ye):[]});function ec(D,Y,ye){var We=D==null?0:D.length;return We?(Y=ye||Y===n?1:Ri(Y),Cc(D,Y<0?0:Y,We)):[]}function Qu(D,Y,ye){var We=D==null?0:D.length;return We?(Y=ye||Y===n?1:Ri(Y),Y=We-Y,Cc(D,0,Y<0?0:Y)):[]}function pb(D,Y){return D&&D.length?sv(D,Gs(Y,3),!0,!0):[]}function pl(D,Y){return D&&D.length?sv(D,Gs(Y,3),!0):[]}function xv(D,Y,ye,We){var bt=D==null?0:D.length;return bt?(ye&&typeof ye!="number"&&Wc(D,Y,ye)&&(ye=0,We=bt),AP(D,Y,ye,We)):[]}function Xm(D,Y,ye){var We=D==null?0:D.length;if(!We)return-1;var bt=ye==null?0:Ri(ye);return bt<0&&(bt=Qo(We+bt,0)),nr(D,Gs(Y,3),bt)}function gv(D,Y,ye){var We=D==null?0:D.length;if(!We)return-1;var bt=We-1;return ye!==n&&(bt=Ri(ye),bt=ye<0?Qo(We+bt,0):xc(bt,We-1)),nr(D,Gs(Y,3),bt,!0)}function L6(D){var Y=D==null?0:D.length;return Y?ko(D,1):[]}function bv(D){var Y=D==null?0:D.length;return Y?ko(D,ae):[]}function bu(D,Y){var ye=D==null?0:D.length;return ye?(Y=Y===n?1:Ri(Y),ko(D,Y)):[]}function A8(D){for(var Y=-1,ye=D==null?0:D.length,We={};++Y<ye;){var bt=D[Y];We[bt[0]]=bt[1]}return We}function Lx(D){return D&&D.length?D[0]:n}function Rp(D,Y,ye){var We=D==null?0:D.length;if(!We)return-1;var bt=ye==null?0:Ri(ye);return bt<0&&(bt=Qo(We+bt,0)),Wn(D,Y,bt)}function D6(D){var Y=D==null?0:D.length;return Y?Cc(D,0,-1):[]}var j8=Mi(function(D){var Y=Jn(D,ob);return Y.length&&Y[0]===D[0]?h6(Y):[]}),Qm=Mi(function(D){var Y=qc(D),ye=Jn(D,ob);return Y===qc(ye)?Y=n:ye.pop(),ye.length&&ye[0]===D[0]?h6(ye,Gs(Y,2)):[]}),B6=Mi(function(D){var Y=qc(D),ye=Jn(D,ob);return Y=typeof Y=="function"?Y:n,Y&&ye.pop(),ye.length&&ye[0]===D[0]?h6(ye,n,Y):[]});function Zm(D,Y){return D==null?"":t6.call(D,Y)}function qc(D){var Y=D==null?0:D.length;return Y?D[Y-1]:n}function yv(D,Y,ye){var We=D==null?0:D.length;if(!We)return-1;var bt=We;return ye!==n&&(bt=Ri(ye),bt=bt<0?Qo(We+bt,0):xc(bt,We-1)),Y===Y?U(D,Y,bt):nr(D,Pr,bt,!0)}function E8(D,Y){return D&&D.length?g6(D,Ri(Y)):n}var $6=Mi(vv);function vv(D,Y){return D&&D.length&&Y&&Y.length?Uo(D,Y):D}function Gc(D,Y,ye){return D&&D.length&&Y&&Y.length?Uo(D,Y,Gs(ye,2)):D}function Jm(D,Y,ye){return D&&D.length&&Y&&Y.length?Uo(D,Y,n,ye):D}var Tf=wh(function(D,Y){var ye=D==null?0:D.length,We=u6(D,Y);return hl(D,Jn(Y,function(bt){return io(bt,ye)?+bt:bt}).sort(o8)),We});function yu(D,Y){var ye=[];if(!(D&&D.length))return ye;var We=-1,bt=[],Vt=D.length;for(Y=Gs(Y,3);++We<Vt;){var mn=D[We];Y(mn,We,D)&&(ye.push(mn),bt.push(We))}return hl(D,bt),ye}function U6(D){return D==null?D:n6.call(D)}function _8(D,Y,ye){var We=D==null?0:D.length;return We?(ye&&typeof ye!="number"&&Wc(D,Y,ye)?(Y=0,ye=We):(Y=Y==null?0:Ri(Y),ye=ye===n?We:Ri(ye)),Cc(D,Y,ye)):[]}function k8(D,Y){return ib(D,Y)}function zz(D,Y,ye){return y6(D,Y,Gs(ye,2))}function e0(D,Y){var ye=D==null?0:D.length;if(ye){var We=ib(D,Y);if(We<ye&&Lp(D[We],Y))return We}return-1}function qP(D,Y){return ib(D,Y,!0)}function T8(D,Y,ye){return y6(D,Y,Gs(ye,2),!0)}function Dx(D,Y){var ye=D==null?0:D.length;if(ye){var We=ib(D,Y,!0)-1;if(Lp(D[We],Y))return We}return-1}function P8(D){return D&&D.length?n8(D):[]}function Bx(D,Y){return D&&D.length?n8(D,Gs(Y,2)):[]}function GP(D){var Y=D==null?0:D.length;return Y?Cc(D,1,Y):[]}function KP(D,Y,ye){return D&&D.length?(Y=ye||Y===n?1:Ri(Y),Cc(D,0,Y<0?0:Y)):[]}function I8(D,Y,ye){var We=D==null?0:D.length;return We?(Y=ye||Y===n?1:Ri(Y),Y=We-Y,Cc(D,Y<0?0:Y,We)):[]}function z6(D,Y){return D&&D.length?sv(D,Gs(Y,3),!1,!0):[]}function Hz(D,Y){return D&&D.length?sv(D,Gs(Y,3)):[]}var Vz=Mi(function(D){return Ip(ko(D,1,xl,!0))}),YP=Mi(function(D){var Y=qc(D);return xl(Y)&&(Y=n),Ip(ko(D,1,xl,!0),Gs(Y,2))}),XP=Mi(function(D){var Y=qc(D);return Y=typeof Y=="function"?Y:n,Ip(ko(D,1,xl,!0),n,Y)});function $x(D){return D&&D.length?Ip(D):[]}function Wz(D,Y){return D&&D.length?Ip(D,Gs(Y,2)):[]}function mb(D,Y){return Y=typeof Y=="function"?Y:n,D&&D.length?Ip(D,n,Y):[]}function H6(D){if(!(D&&D.length))return[];var Y=0;return D=is(D,function(ye){if(xl(ye))return Y=Qo(ye.length,Y),!0}),us(Y,function(ye){return Jn(D,Ls(ye))})}function bo(D,Y){if(!(D&&D.length))return[];var ye=H6(D);return Y==null?ye:Jn(ye,function(We){return dr(Y,n,We)})}var qz=Mi(function(D,Y){return xl(D)?mh(D,Y):[]}),QP=Mi(function(D){return w6(is(D,xl))}),Gz=Mi(function(D){var Y=qc(D);return xl(Y)&&(Y=n),w6(is(D,xl),Gs(Y,2))}),Kz=Mi(function(D){var Y=qc(D);return Y=typeof Y=="function"?Y:n,w6(is(D,xl),n,Y)}),ZP=Mi(H6);function JP(D,Y){return iv(D||[],Y||[],kx)}function Yz(D,Y){return iv(D||[],Y||[],Ox)}var Dd=Mi(function(D){var Y=D.length,ye=Y>1?D[Y-1]:n;return ye=typeof ye=="function"?(D.pop(),ye):n,bo(D,ye)});function V6(D){var Y=Ot(D);return Y.__chain__=!0,Y}function Xz(D,Y){return Y(D),D}function Pf(D,Y){return Y(D)}var W6=wh(function(D){var Y=D.length,ye=Y?D[0]:0,We=this.__wrapped__,bt=function(Vt){return u6(Vt,D)};return Y>1||this.__actions__.length||!(We instanceof Ni)||!io(ye)?this.thru(bt):(We=We.slice(ye,+ye+(Y?1:0)),We.__actions__.push({func:Pf,args:[bt],thisArg:n}),new gc(We,this.__chain__).thru(function(Vt){return Y&&!Vt.length&&Vt.push(n),Vt}))});function Ux(){return V6(this)}function q6(){return new gc(this.value(),this.__chain__)}function F8(){this.__values__===n&&(this.__values__=Mfe(this.value()));var D=this.__index__>=this.__values__.length,Y=D?n:this.__values__[this.__index__++];return{done:D,value:Y}}function O8(){return this}function Qz(D){for(var Y,ye=this;ye instanceof dh;){var We=WP(ye);We.__index__=0,We.__values__=n,Y?bt.__wrapped__=We:Y=We;var bt=We;ye=ye.__wrapped__}return bt.__wrapped__=D,Y}function M8(){var D=this.__wrapped__;if(D instanceof Ni){var Y=D;return this.__actions__.length&&(Y=new Ni(this)),Y=Y.reverse(),Y.__actions__.push({func:Pf,args:[U6],thisArg:n}),new gc(Y,this.__chain__)}return this.thru(U6)}function Zz(){return ab(this.__wrapped__,this.__actions__)}var eI=N6(function(D,Y,ye){Oi.call(D,ye)?++D[ye]:ph(D,ye,1)});function tI(D,Y,ye){var We=Ai(D)?Yr:Z2;return ye&&Wc(D,Y,ye)&&(Y=n),We(D,Gs(Y,3))}function G6(D,Y){var ye=Ai(D)?is:Gj;return ye(D,Gs(Y,3))}var K6=Rx(Xm),nI=Rx(gv);function R8(D,Y){return ko(Z6(D,Y),1)}function rI(D,Y){return ko(Z6(D,Y),ae)}function L8(D,Y,ye){return ye=ye===n?1:Ri(ye),ko(Z6(D,Y),ye)}function wv(D,Y){var ye=Ai(D)?pr:xh;return ye(D,Gs(Y,3))}function Y6(D,Y){var ye=Ai(D)?fr:NP;return ye(D,Gs(Y,3))}var X6=N6(function(D,Y,ye){Oi.call(D,ye)?D[ye].push(Y):ph(D,ye,[Y])});function sI(D,Y,ye,We){D=Bd(D)?D:tC(D),ye=ye&&!We?Ri(ye):0;var bt=D.length;return ye<0&&(ye=Qo(bt+ye,0)),aI(D)?ye<=bt&&D.indexOf(Y,ye)>-1:!!bt&&Wn(D,Y,ye)>-1}var Jz=Mi(function(D,Y,ye){var We=-1,bt=typeof Y=="function",Vt=Bd(D)?Ht(D.length):[];return xh(D,function(mn){Vt[++We]=bt?dr(Y,mn,ye):Fd(mn,Y,ye)}),Vt}),Q6=N6(function(D,Y,ye){ph(D,ye,Y)});function Z6(D,Y){var ye=Ai(D)?Jn:Qj;return ye(D,Gs(Y,3))}function Cv(D,Y,ye,We){return D==null?[]:(Ai(Y)||(Y=Y==null?[]:[Y]),ye=We?n:ye,Ai(ye)||(ye=ye==null?[]:[ye]),nv(D,Y,ye))}var eH=N6(function(D,Y,ye){D[ye?0:1].push(Y)},function(){return[[],[]]});function J6(D,Y,ye){var We=Ai(D)?Zs:or,bt=arguments.length<3;return We(D,Gs(Y,4),ye,bt,xh)}function A(D,Y,ye){var We=Ai(D)?oi:or,bt=arguments.length<3;return We(D,Gs(Y,4),ye,bt,NP)}function R(D,Y){var ye=Ai(D)?is:Gj;return ye(D,Fs(Gs(Y,3)))}function Z(D){var Y=Ai(D)?hh:wc;return Y(D)}function pe(D,Y,ye){(ye?Wc(D,Y,ye):Y===n)?Y=1:Y=Ri(Y);var We=Ai(D)?_x:e8;return We(D,Y)}function Pe(D){var Y=Ai(D)?CP:Md;return Y(D)}function Ve(D){if(D==null)return 0;if(Bd(D))return aI(D)?H(D):D.length;var Y=Zl(D);return Y==tt||Y==wt?D.size:Pp(D).length}function Nt(D,Y,ye){var We=Ai(D)?Fr:t8;return ye&&Wc(D,Y,ye)&&(Y=n),We(D,Gs(Y,3))}var pn=Mi(function(D,Y){if(D==null)return[];var ye=Y.length;return ye>1&&Wc(D,Y[0],Y[1])?Y=[]:ye>2&&Wc(Y[0],Y[1],Y[2])&&(Y=[Y[0]]),nv(D,ko(Y,1),[])}),_n=Ga||function(){return mr.Date.now()};function cr(D,Y){if(typeof Y!="function")throw new no(o);return D=Ri(D),function(){if(--D<1)return Y.apply(this,arguments)}}function zr(D,Y,ye){return Y=ye?n:Y,Y=D&&Y==null?D.length:Y,vh(D,L,n,n,n,n,Y)}function Wr(D,Y){var ye;if(typeof Y!="function")throw new no(o);return D=Ri(D),function(){return--D>0&&(ye=Y.apply(this,arguments)),D<=1&&(Y=n),ye}}var Ur=Mi(function(D,Y,ye){var We=C;if(ye.length){var bt=ft(ye,Op(Ur));We|=F}return vh(D,We,Y,ye,bt)}),hs=Mi(function(D,Y,ye){var We=C|N;if(ye.length){var bt=ft(ye,Op(hs));We|=F}return vh(Y,We,D,ye,bt)});function As(D,Y,ye){Y=ye?n:Y;var We=vh(D,T,n,n,n,n,n,Y);return We.placeholder=As.placeholder,We}function Is(D,Y,ye){Y=ye?n:Y;var We=vh(D,M,n,n,n,n,n,Y);return We.placeholder=Is.placeholder,We}function To(D,Y,ye){var We,bt,Vt,mn,In,qn,Mr=0,Rr=!1,Hr=!1,ds=!0;if(typeof D!="function")throw new no(o);Y=Sh(Y)||0,zo(ye)&&(Rr=!!ye.leading,Hr="maxWait"in ye,Vt=Hr?Qo(Sh(ye.maxWait)||0,Y):Vt,ds="trailing"in ye?!!ye.trailing:ds);function Ds(gl){var Dp=We,Vx=bt;return We=bt=n,Mr=gl,mn=D.apply(Vx,Dp),mn}function ei(gl){return Mr=gl,In=hb(Ki,Y),Rr?Ds(gl):mn}function Li(gl){var Dp=gl-qn,Vx=gl-Mr,Kfe=Y-Dp;return Hr?xc(Kfe,Vt-Vx):Kfe}function ti(gl){var Dp=gl-qn,Vx=gl-Mr;return qn===n||Dp>=Y||Dp<0||Hr&&Vx>=Vt}function Ki(){var gl=_n();if(ti(gl))return Zi(gl);In=hb(Ki,Li(gl))}function Zi(gl){return In=n,ds&&We?Ds(gl):(We=bt=n,mn)}function Ff(){In!==n&&i8(In),Mr=0,We=qn=bt=In=n}function Zu(){return In===n?mn:Zi(_n())}function Of(){var gl=_n(),Dp=ti(gl);if(We=arguments,bt=this,qn=gl,Dp){if(In===n)return ei(qn);if(Hr)return i8(In),In=hb(Ki,Y),Ds(qn)}return In===n&&(In=hb(Ki,Y)),mn}return Of.cancel=Ff,Of.flush=Zu,Of}var er=Mi(function(D,Y){return qj(D,1,Y)}),Ln=Mi(function(D,Y,ye){return qj(D,Sh(Y)||0,ye)});function ir(D){return vh(D,X)}function Xr(D,Y){if(typeof D!="function"||Y!=null&&typeof Y!="function")throw new no(o);var ye=function(){var We=arguments,bt=Y?Y.apply(this,We):We[0],Vt=ye.cache;if(Vt.has(bt))return Vt.get(bt);var mn=D.apply(this,We);return ye.cache=Vt.set(bt,mn)||Vt,mn};return ye.cache=new(Xr.Cache||kd),ye}Xr.Cache=kd;function Fs(D){if(typeof D!="function")throw new no(o);return function(){var Y=arguments;switch(Y.length){case 0:return!D.call(this);case 1:return!D.call(this,Y[0]);case 2:return!D.call(this,Y[0],Y[1]);case 3:return!D.call(this,Y[0],Y[1],Y[2])}return!D.apply(this,Y)}}function Vs(D){return Wr(2,D)}var Ws=_P(function(D,Y){Y=Y.length==1&&Ai(Y[0])?Jn(Y[0],bs(Gs())):Jn(ko(Y,1),bs(Gs()));var ye=Y.length;return Mi(function(We){for(var bt=-1,Vt=xc(We.length,ye);++bt<Vt;)We[bt]=Y[bt].call(this,We[bt]);return dr(D,this,We)})}),Qs=Mi(function(D,Y){var ye=ft(Y,Op(Qs));return vh(D,F,n,Y,ye)}),ml=Mi(function(D,Y){var ye=ft(Y,Op(ml));return vh(D,$,n,Y,ye)}),ca=wh(function(D,Y){return vh(D,z,n,n,n,Y)});function t0(D,Y){if(typeof D!="function")throw new no(o);return Y=Y===n?Y:Ri(Y),Mi(D,Y)}function tH(D,Y){if(typeof D!="function")throw new no(o);return Y=Y==null?0:Qo(Ri(Y),0),Mi(function(ye){var We=ye[Y],bt=Fp(ye,0,Y);return We&&gs(bt,We),dr(D,this,bt)})}function EKe(D,Y,ye){var We=!0,bt=!0;if(typeof D!="function")throw new no(o);return zo(ye)&&(We="leading"in ye?!!ye.leading:We,bt="trailing"in ye?!!ye.trailing:bt),To(D,Y,{leading:We,maxWait:Y,trailing:bt})}function _Ke(D){return zr(D,1)}function kKe(D,Y){return Qs(C6(Y),D)}function TKe(){if(!arguments.length)return[];var D=arguments[0];return Ai(D)?D:[D]}function PKe(D){return xu(D,g)}function IKe(D,Y){return Y=typeof Y=="function"?Y:n,xu(D,g,Y)}function FKe(D){return xu(D,f|g)}function OKe(D,Y){return Y=typeof Y=="function"?Y:n,xu(D,f|g,Y)}function MKe(D,Y){return Y==null||Q2(D,Y,Sc(Y))}function Lp(D,Y){return D===Y||D!==D&&Y!==Y}var RKe=k6(Wm),LKe=k6(function(D,Y){return D>=Y}),Sv=p6(function(){return arguments}())?p6:function(D){return Jo(D)&&Oi.call(D,"callee")&&!Z5.call(D,"callee")},Ai=Ht.isArray,DKe=he?bs(he):jP;function Bd(D){return D!=null&&iI(D.length)&&!zx(D)}function xl(D){return Jo(D)&&Bd(D)}function BKe(D){return D===!0||D===!1||Jo(D)&&Xl(D)==je}var xb=zj||fH,$Ke=it?bs(it):Tp;function UKe(D){return Jo(D)&&D.nodeType===1&&!D8(D)}function zKe(D){if(D==null)return!0;if(Bd(D)&&(Ai(D)||typeof D=="string"||typeof D.splice=="function"||xb(D)||eC(D)||Sv(D)))return!D.length;var Y=Zl(D);if(Y==tt||Y==wt)return!D.size;if(Mp(D))return!Pp(D).length;for(var ye in D)if(Oi.call(D,ye))return!1;return!0}function HKe(D,Y){return Od(D,Y)}function VKe(D,Y,ye){ye=typeof ye=="function"?ye:n;var We=ye?ye(D,Y):n;return We===n?Od(D,Y,n,ye):!!We}function nH(D){if(!Jo(D))return!1;var Y=Xl(D);return Y==Qe||Y==Re||typeof D.message=="string"&&typeof D.name=="string"&&!D8(D)}function WKe(D){return typeof D=="number"&&q1(D)}function zx(D){if(!zo(D))return!1;var Y=Xl(D);return Y==Ke||Y==dt||Y==be||Y==pt}function Pfe(D){return typeof D=="number"&&D==Ri(D)}function iI(D){return typeof D=="number"&&D>-1&&D%1==0&&D<=W}function zo(D){var Y=typeof D;return D!=null&&(Y=="object"||Y=="function")}function Jo(D){return D!=null&&typeof D=="object"}var Ife=Ct?bs(Ct):EP;function qKe(D,Y){return D===Y||nb(D,Y,fv(Y))}function GKe(D,Y,ye){return ye=typeof ye=="function"?ye:n,nb(D,Y,fv(Y),ye)}function KKe(D){return Ffe(D)&&D!=+D}function YKe(D){if(Uz(D))throw new xr(a);return Yj(D)}function XKe(D){return D===null}function QKe(D){return D==null}function Ffe(D){return typeof D=="number"||Jo(D)&&Xl(D)==nt}function D8(D){if(!Jo(D)||Xl(D)!=Be)return!1;var Y=Sf(D);if(Y===null)return!0;var ye=Oi.call(Y,"constructor")&&Y.constructor;return typeof ye=="function"&&ye instanceof ye&&_d.call(ye)==X5}var rH=vt?bs(vt):ev;function ZKe(D){return Pfe(D)&&D>=-9007199254740991&&D<=W}var Ofe=ln?bs(ln):gh;function aI(D){return typeof D=="string"||!Ai(D)&&Jo(D)&&Xl(D)==nn}function If(D){return typeof D=="symbol"||Jo(D)&&Xl(D)==cn}var eC=xn?bs(xn):tv;function JKe(D){return D===n}function eYe(D){return Jo(D)&&Zl(D)==Xt}function tYe(D){return Jo(D)&&Xl(D)==an}var nYe=k6(qm),rYe=k6(function(D,Y){return D<=Y});function Mfe(D){if(!D)return[];if(Bd(D))return aI(D)?Q(D):Hc(D);if(Ap&&D[Ap])return Yl(D[Ap]());var Y=Zl(D),ye=Y==tt?yi:Y==wt?w:tC;return ye(D)}function Hx(D){if(!D)return D===0?D:0;if(D=Sh(D),D===ae||D===-1/0){var Y=D<0?-1:1;return Y*V}return D===D?D:0}function Ri(D){var Y=Hx(D),ye=Y%1;return Y===Y?ye?Y-ye:Y:0}function Rfe(D){return D?Ep(Ri(D),0,oe):0}function Sh(D){if(typeof D=="number")return D;if(If(D))return ee;if(zo(D)){var Y=typeof D.valueOf=="function"?D.valueOf():D;D=zo(Y)?Y+"":Y}if(typeof D!="string")return D===0?D:+D;D=xs(D);var ye=ar.test(D);return ye||qt.test(D)?lr(D.slice(2),ye?2:8):tr.test(D)?ee:+D}function Lfe(D){return Af(D,$d(D))}function sYe(D){return D?Ep(Ri(D),-9007199254740991,W):D===0?D:0}function Pa(D){return D==null?"":gu(D)}var iYe=lb(function(D,Y){if(Mp(Y)||Bd(Y)){Af(Y,Sc(Y),D);return}for(var ye in Y)Oi.call(Y,ye)&&kx(D,ye,Y[ye])}),Dfe=lb(function(D,Y){Af(Y,$d(Y),D)}),oI=lb(function(D,Y,ye,We){Af(Y,$d(Y),D,We)}),aYe=lb(function(D,Y,ye,We){Af(Y,Sc(Y),D,We)}),oYe=wh(u6);function lYe(D,Y){var ye=Q1(D);return Y==null?ye:Ya(ye,Y)}var cYe=Mi(function(D,Y){D=Ns(D);var ye=-1,We=Y.length,bt=We>2?Y[2]:n;for(bt&&Wc(Y[0],Y[1],bt)&&(We=1);++ye<We;)for(var Vt=Y[ye],mn=$d(Vt),In=-1,qn=mn.length;++In<qn;){var Mr=mn[In],Rr=D[Mr];(Rr===n||Lp(Rr,Ta[Mr])&&!Oi.call(D,Mr))&&(D[Mr]=Vt[Mr])}return D}),uYe=Mi(function(D){return D.push(n,p8),dr(Bfe,n,D)});function dYe(D,Y){return Bt(D,Gs(Y,3),Yu)}function fYe(D,Y){return Bt(D,Gs(Y,3),Vm)}function hYe(D,Y){return D==null?D:d6(D,Gs(Y,3),$d)}function pYe(D,Y){return D==null?D:J2(D,Gs(Y,3),$d)}function mYe(D,Y){return D&&Yu(D,Gs(Y,3))}function xYe(D,Y){return D&&Vm(D,Gs(Y,3))}function gYe(D){return D==null?[]:tb(D,Sc(D))}function bYe(D){return D==null?[]:tb(D,$d(D))}function sH(D,Y,ye){var We=D==null?n:_p(D,Y);return We===n?ye:We}function yYe(D,Y){return D!=null&&y8(D,Y,Id)}function iH(D,Y){return D!=null&&y8(D,Y,Px)}var vYe=OP(function(D,Y,ye){Y!=null&&typeof Y.toString!="function"&&(Y=z2.call(Y)),D[Y]=ye},oH(Ud)),wYe=OP(function(D,Y,ye){Y!=null&&typeof Y.toString!="function"&&(Y=z2.call(Y)),Oi.call(D,Y)?D[Y].push(ye):D[Y]=[ye]},Gs),CYe=Mi(Fd);function Sc(D){return Bd(D)?fh(D):Pp(D)}function $d(D){return Bd(D)?fh(D,!0):Xj(D)}function SYe(D,Y){var ye={};return Y=Gs(Y,3),Yu(D,function(We,bt,Vt){ph(ye,Y(We,bt,Vt),We)}),ye}function NYe(D,Y){var ye={};return Y=Gs(Y,3),Yu(D,function(We,bt,Vt){ph(ye,bt,Y(We,bt,Vt))}),ye}var AYe=lb(function(D,Y,ye){Ix(D,Y,ye)}),Bfe=lb(function(D,Y,ye,We){Ix(D,Y,ye,We)}),jYe=wh(function(D,Y){var ye={};if(D==null)return ye;var We=!1;Y=Jn(Y,function(Vt){return Vt=yh(Vt,D),We||(We=Vt.length>1),Vt}),Af(D,uv(D),ye),We&&(ye=xu(ye,f|x|g,m8));for(var bt=Y.length;bt--;)v6(ye,Y[bt]);return ye});function EYe(D,Y){return $fe(D,Fs(Gs(Y)))}var _Ye=wh(function(D,Y){return D==null?{}:Jj(D,Y)});function $fe(D,Y){if(D==null)return{};var ye=Jn(uv(D),function(We){return[We]});return Y=Gs(Y),Gm(D,ye,function(We,bt){return Y(We,bt[0])})}function kYe(D,Y,ye){Y=yh(Y,D);var We=-1,bt=Y.length;for(bt||(bt=1,D=n);++We<bt;){var Vt=D==null?n:D[kf(Y[We])];Vt===n&&(We=bt,Vt=ye),D=zx(Vt)?Vt.call(D):Vt}return D}function TYe(D,Y,ye){return D==null?D:Ox(D,Y,ye)}function PYe(D,Y,ye,We){return We=typeof We=="function"?We:n,D==null?D:Ox(D,Y,ye,We)}var Ufe=f8(Sc),zfe=f8($d);function IYe(D,Y,ye){var We=Ai(D),bt=We||xb(D)||eC(D);if(Y=Gs(Y,4),ye==null){var Vt=D&&D.constructor;bt?ye=We?new Vt:[]:zo(D)?ye=zx(Vt)?Q1(Sf(D)):{}:ye={}}return(bt?pr:Yu)(D,function(mn,In,qn){return Y(ye,mn,In,qn)}),ye}function FYe(D,Y){return D==null?!0:v6(D,Y)}function OYe(D,Y,ye){return D==null?D:s8(D,Y,C6(ye))}function MYe(D,Y,ye,We){return We=typeof We=="function"?We:n,D==null?D:s8(D,Y,C6(ye),We)}function tC(D){return D==null?[]:zi(D,Sc(D))}function RYe(D){return D==null?[]:zi(D,$d(D))}function LYe(D,Y,ye){return ye===n&&(ye=Y,Y=n),ye!==n&&(ye=Sh(ye),ye=ye===ye?ye:0),Y!==n&&(Y=Sh(Y),Y=Y===Y?Y:0),Ep(Sh(D),Y,ye)}function DYe(D,Y,ye){return Y=Hx(Y),ye===n?(ye=Y,Y=0):ye=Hx(ye),D=Sh(D),Kj(D,Y,ye)}function BYe(D,Y,ye){if(ye&&typeof ye!="boolean"&&Wc(D,Y,ye)&&(Y=ye=n),ye===n&&(typeof Y=="boolean"?(ye=Y,Y=n):typeof D=="boolean"&&(ye=D,D=n)),D===n&&Y===n?(D=0,Y=1):(D=Hx(D),Y===n?(Y=D,D=0):Y=Hx(Y)),D>Y){var We=D;D=Y,Y=We}if(ye||D%1||Y%1){var bt=q2();return xc(D+bt*(Y-D+$r("1e-"+((bt+"").length-1))),Y)}return sb(D,Y)}var $Ye=Mx(function(D,Y,ye){return Y=Y.toLowerCase(),D+(ye?Hfe(Y):Y)});function Hfe(D){return aH(Pa(D).toLowerCase())}function Vfe(D){return D=Pa(D),D&&D.replace(Zn,ks).replace(kr,"")}function UYe(D,Y,ye){D=Pa(D),Y=gu(Y);var We=D.length;ye=ye===n?We:Ep(Ri(ye),0,We);var bt=ye;return ye-=Y.length,ye>=0&&D.slice(ye,bt)==Y}function zYe(D){return D=Pa(D),D&&gn.test(D)?D.replace(dn,ka):D}function HYe(D){return D=Pa(D),D&&Nn.test(D)?D.replace(Xn,"\\$&"):D}var VYe=Mx(function(D,Y,ye){return D+(ye?"-":"")+Y.toLowerCase()}),WYe=Mx(function(D,Y,ye){return D+(ye?" ":"")+Y.toLowerCase()}),qYe=c8("toLowerCase");function GYe(D,Y,ye){D=Pa(D),Y=Ri(Y);var We=Y?H(D):0;if(!Y||We>=Y)return D;var bt=(Y-We)/2;return lv(Dm(bt),ye)+D+lv(Nx(bt),ye)}function KYe(D,Y,ye){D=Pa(D),Y=Ri(Y);var We=Y?H(D):0;return Y&&We<Y?D+lv(Y-We,ye):D}function YYe(D,Y,ye){D=Pa(D),Y=Ri(Y);var We=Y?H(D):0;return Y&&We<Y?lv(Y-We,ye)+D:D}function XYe(D,Y,ye){return ye||Y==null?Y=0:Y&&(Y=+Y),xP(Pa(D).replace(on,""),Y||0)}function QYe(D,Y,ye){return(ye?Wc(D,Y,ye):Y===n)?Y=1:Y=Ri(Y),Fx(Pa(D),Y)}function ZYe(){var D=arguments,Y=Pa(D[0]);return D.length<3?Y:Y.replace(D[1],D[2])}var JYe=Mx(function(D,Y,ye){return D+(ye?"_":"")+Y.toLowerCase()});function eXe(D,Y,ye){return ye&&typeof ye!="number"&&Wc(D,Y,ye)&&(Y=ye=n),ye=ye===n?oe:ye>>>0,ye?(D=Pa(D),D&&(typeof Y=="string"||Y!=null&&!rH(Y))&&(Y=gu(Y),!Y&&Yo(D))?Fp(Q(D),0,ye):D.split(Y,ye)):[]}var tXe=Mx(function(D,Y,ye){return D+(ye?" ":"")+aH(Y)});function nXe(D,Y,ye){return D=Pa(D),ye=ye==null?0:Ep(Ri(ye),0,D.length),Y=gu(Y),D.slice(ye,ye+Y.length)==Y}function rXe(D,Y,ye){var We=Ot.templateSettings;ye&&Wc(D,Y,ye)&&(Y=n),D=Pa(D),Y=oI({},Y,We,h8);var bt=oI({},Y.imports,We.imports,h8),Vt=Sc(bt),mn=zi(bt,Vt),In,qn,Mr=0,Rr=Y.interpolate||Ft,Hr="__p += '",ds=Js((Y.escape||Ft).source+"|"+Rr.source+"|"+(Rr===yn?en:Ft).source+"|"+(Y.evaluate||Ft).source+"|$","g"),Ds="//# sourceURL="+(Oi.call(Y,"sourceURL")?(Y.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cs+"]")+`
`;D.replace(ds,function(ti,Ki,Zi,Ff,Zu,Of){return Zi||(Zi=Ff),Hr+=D.slice(Mr,Of).replace(En,Wu),Ki&&(In=!0,Hr+=`' +
__e(`+Ki+`) +
'`),Zu&&(qn=!0,Hr+=`';
`+Zu+`;
__p += '`),Zi&&(Hr+=`' +
((__t = (`+Zi+`)) == null ? '' : __t) +
'`),Mr=Of+ti.length,ti}),Hr+=`';
`;var ei=Oi.call(Y,"variable")&&Y.variable;if(!ei)Hr=`with (obj) {
`+Hr+`
}
`;else if(bn.test(ei))throw new xr(l);Hr=(qn?Hr.replace(rt,""):Hr).replace(mt,"$1").replace(Lt,"$1;"),Hr="function("+(ei||"obj")+`) {
`+(ei?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(In?", __e = _.escape":"")+(qn?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Hr+`return __p
}`;var Li=qfe(function(){return Nr(Vt,Ds+"return "+Hr).apply(n,mn)});if(Li.source=Hr,nH(Li))throw Li;return Li}function sXe(D){return Pa(D).toLowerCase()}function iXe(D){return Pa(D).toUpperCase()}function aXe(D,Y,ye){if(D=Pa(D),D&&(ye||Y===n))return xs(D);if(!D||!(Y=gu(Y)))return D;var We=Q(D),bt=Q(Y),Vt=ys(We,bt),mn=Ss(We,bt)+1;return Fp(We,Vt,mn).join("")}function oXe(D,Y,ye){if(D=Pa(D),D&&(ye||Y===n))return D.slice(0,le(D)+1);if(!D||!(Y=gu(Y)))return D;var We=Q(D),bt=Ss(We,Q(Y))+1;return Fp(We,0,bt).join("")}function lXe(D,Y,ye){if(D=Pa(D),D&&(ye||Y===n))return D.replace(on,"");if(!D||!(Y=gu(Y)))return D;var We=Q(D),bt=ys(We,Q(Y));return Fp(We,bt).join("")}function cXe(D,Y){var ye=ne,We=J;if(zo(Y)){var bt="separator"in Y?Y.separator:bt;ye="length"in Y?Ri(Y.length):ye,We="omission"in Y?gu(Y.omission):We}D=Pa(D);var Vt=D.length;if(Yo(D)){var mn=Q(D);Vt=mn.length}if(ye>=Vt)return D;var In=ye-H(We);if(In<1)return We;var qn=mn?Fp(mn,0,In).join(""):D.slice(0,In);if(bt===n)return qn+We;if(mn&&(In+=qn.length-In),rH(bt)){if(D.slice(In).search(bt)){var Mr,Rr=qn;for(bt.global||(bt=Js(bt.source,Pa(Pn.exec(bt))+"g")),bt.lastIndex=0;Mr=bt.exec(Rr);)var Hr=Mr.index;qn=qn.slice(0,Hr===n?In:Hr)}}else if(D.indexOf(gu(bt),In)!=In){var ds=qn.lastIndexOf(bt);ds>-1&&(qn=qn.slice(0,ds))}return qn+We}function uXe(D){return D=Pa(D),D&&rn.test(D)?D.replace(kt,ve):D}var dXe=Mx(function(D,Y,ye){return D+(ye?" ":"")+Y.toUpperCase()}),aH=c8("toUpperCase");function Wfe(D,Y,ye){return D=Pa(D),Y=ye?n:Y,Y===n?qu(D)?xt(D):lt(D):D.match(Y)||[]}var qfe=Mi(function(D,Y){try{return dr(D,n,Y)}catch(ye){return nH(ye)?ye:new xr(ye)}}),fXe=wh(function(D,Y){return pr(Y,function(ye){ye=kf(ye),ph(D,ye,Ur(D[ye],D))}),D});function hXe(D){var Y=D==null?0:D.length,ye=Gs();return D=Y?Jn(D,function(We){if(typeof We[1]!="function")throw new no(o);return[ye(We[0]),We[1]]}):[],Mi(function(We){for(var bt=-1;++bt<Y;){var Vt=D[bt];if(dr(Vt[0],this,We))return dr(Vt[1],this,We)}})}function pXe(D){return SP(xu(D,f))}function oH(D){return function(){return D}}function mXe(D,Y){return D==null||D!==D?Y:D}var xXe=E6(),gXe=E6(!0);function Ud(D){return D}function lH(D){return rb(typeof D=="function"?D:xu(D,f))}function bXe(D){return x6(xu(D,f))}function yXe(D,Y){return so(D,xu(Y,f))}var vXe=Mi(function(D,Y){return function(ye){return Fd(ye,D,Y)}}),wXe=Mi(function(D,Y){return function(ye){return Fd(D,ye,Y)}});function cH(D,Y,ye){var We=Sc(Y),bt=tb(Y,We);ye==null&&!(zo(Y)&&(bt.length||!We.length))&&(ye=Y,Y=D,D=this,bt=tb(Y,Sc(Y)));var Vt=!(zo(ye)&&"chain"in ye)||!!ye.chain,mn=zx(D);return pr(bt,function(In){var qn=Y[In];D[In]=qn,mn&&(D.prototype[In]=function(){var Mr=this.__chain__;if(Vt||Mr){var Rr=D(this.__wrapped__),Hr=Rr.__actions__=Hc(this.__actions__);return Hr.push({func:qn,args:arguments,thisArg:D}),Rr.__chain__=Mr,Rr}return qn.apply(D,gs([this.value()],arguments))})}),D}function CXe(){return mr._===this&&(mr._=fP),this}function uH(){}function SXe(D){return D=Ri(D),Mi(function(Y){return g6(Y,D)})}var NXe=_6(Jn),AXe=_6(Yr),jXe=_6(Fr);function Gfe(D){return vs(D)?Ls(kf(D)):go(D)}function EXe(D){return function(Y){return D==null?n:_p(D,Y)}}var _Xe=d8(),kXe=d8(!0);function dH(){return[]}function fH(){return!1}function TXe(){return{}}function PXe(){return""}function IXe(){return!0}function FXe(D,Y){if(D=Ri(D),D<1||D>W)return[];var ye=oe,We=xc(D,oe);Y=Gs(Y),D-=oe;for(var bt=us(We,Y);++ye<D;)Y(ye);return bt}function OXe(D){return Ai(D)?Jn(D,kf):If(D)?[D]:Hc(S8(Pa(D)))}function MXe(D){var Y=++Lm;return Pa(D)+Y}var RXe=ov(function(D,Y){return D+Y},0),LXe=Ql("ceil"),DXe=ov(function(D,Y){return D/Y},1),BXe=Ql("floor");function $Xe(D){return D&&D.length?Tx(D,Ud,Wm):n}function UXe(D,Y){return D&&D.length?Tx(D,Gs(Y,2),Wm):n}function zXe(D){return ts(D,Ud)}function HXe(D,Y){return ts(D,Gs(Y,2))}function VXe(D){return D&&D.length?Tx(D,Ud,qm):n}function WXe(D,Y){return D&&D.length?Tx(D,Gs(Y,2),qm):n}var qXe=ov(function(D,Y){return D*Y},1),GXe=Ql("round"),KXe=ov(function(D,Y){return D-Y},0);function YXe(D){return D&&D.length?Vr(D,Ud):0}function XXe(D,Y){return D&&D.length?Vr(D,Gs(Y,2)):0}return Ot.after=cr,Ot.ary=zr,Ot.assign=iYe,Ot.assignIn=Dfe,Ot.assignInWith=oI,Ot.assignWith=aYe,Ot.at=oYe,Ot.before=Wr,Ot.bind=Ur,Ot.bindAll=fXe,Ot.bindKey=hs,Ot.castArray=TKe,Ot.chain=V6,Ot.chunk=R6,Ot.compact=N8,Ot.concat=Ld,Ot.cond=hXe,Ot.conforms=pXe,Ot.constant=oH,Ot.countBy=eI,Ot.create=lYe,Ot.curry=As,Ot.curryRight=Is,Ot.debounce=To,Ot.defaults=cYe,Ot.defaultsDeep=uYe,Ot.defer=er,Ot.delay=Ln,Ot.difference=Qi,Ot.differenceBy=Fl,Ot.differenceWith=Zo,Ot.drop=ec,Ot.dropRight=Qu,Ot.dropRightWhile=pb,Ot.dropWhile=pl,Ot.fill=xv,Ot.filter=G6,Ot.flatMap=R8,Ot.flatMapDeep=rI,Ot.flatMapDepth=L8,Ot.flatten=L6,Ot.flattenDeep=bv,Ot.flattenDepth=bu,Ot.flip=ir,Ot.flow=xXe,Ot.flowRight=gXe,Ot.fromPairs=A8,Ot.functions=gYe,Ot.functionsIn=bYe,Ot.groupBy=X6,Ot.initial=D6,Ot.intersection=j8,Ot.intersectionBy=Qm,Ot.intersectionWith=B6,Ot.invert=vYe,Ot.invertBy=wYe,Ot.invokeMap=Jz,Ot.iteratee=lH,Ot.keyBy=Q6,Ot.keys=Sc,Ot.keysIn=$d,Ot.map=Z6,Ot.mapKeys=SYe,Ot.mapValues=NYe,Ot.matches=bXe,Ot.matchesProperty=yXe,Ot.memoize=Xr,Ot.merge=AYe,Ot.mergeWith=Bfe,Ot.method=vXe,Ot.methodOf=wXe,Ot.mixin=cH,Ot.negate=Fs,Ot.nthArg=SXe,Ot.omit=jYe,Ot.omitBy=EYe,Ot.once=Vs,Ot.orderBy=Cv,Ot.over=NXe,Ot.overArgs=Ws,Ot.overEvery=AXe,Ot.overSome=jXe,Ot.partial=Qs,Ot.partialRight=ml,Ot.partition=eH,Ot.pick=_Ye,Ot.pickBy=$fe,Ot.property=Gfe,Ot.propertyOf=EXe,Ot.pull=$6,Ot.pullAll=vv,Ot.pullAllBy=Gc,Ot.pullAllWith=Jm,Ot.pullAt=Tf,Ot.range=_Xe,Ot.rangeRight=kXe,Ot.rearg=ca,Ot.reject=R,Ot.remove=yu,Ot.rest=t0,Ot.reverse=U6,Ot.sampleSize=pe,Ot.set=TYe,Ot.setWith=PYe,Ot.shuffle=Pe,Ot.slice=_8,Ot.sortBy=pn,Ot.sortedUniq=P8,Ot.sortedUniqBy=Bx,Ot.split=eXe,Ot.spread=tH,Ot.tail=GP,Ot.take=KP,Ot.takeRight=I8,Ot.takeRightWhile=z6,Ot.takeWhile=Hz,Ot.tap=Xz,Ot.throttle=EKe,Ot.thru=Pf,Ot.toArray=Mfe,Ot.toPairs=Ufe,Ot.toPairsIn=zfe,Ot.toPath=OXe,Ot.toPlainObject=Lfe,Ot.transform=IYe,Ot.unary=_Ke,Ot.union=Vz,Ot.unionBy=YP,Ot.unionWith=XP,Ot.uniq=$x,Ot.uniqBy=Wz,Ot.uniqWith=mb,Ot.unset=FYe,Ot.unzip=H6,Ot.unzipWith=bo,Ot.update=OYe,Ot.updateWith=MYe,Ot.values=tC,Ot.valuesIn=RYe,Ot.without=qz,Ot.words=Wfe,Ot.wrap=kKe,Ot.xor=QP,Ot.xorBy=Gz,Ot.xorWith=Kz,Ot.zip=ZP,Ot.zipObject=JP,Ot.zipObjectDeep=Yz,Ot.zipWith=Dd,Ot.entries=Ufe,Ot.entriesIn=zfe,Ot.extend=Dfe,Ot.extendWith=oI,cH(Ot,Ot),Ot.add=RXe,Ot.attempt=qfe,Ot.camelCase=$Ye,Ot.capitalize=Hfe,Ot.ceil=LXe,Ot.clamp=LYe,Ot.clone=PKe,Ot.cloneDeep=FKe,Ot.cloneDeepWith=OKe,Ot.cloneWith=IKe,Ot.conformsTo=MKe,Ot.deburr=Vfe,Ot.defaultTo=mXe,Ot.divide=DXe,Ot.endsWith=UYe,Ot.eq=Lp,Ot.escape=zYe,Ot.escapeRegExp=HYe,Ot.every=tI,Ot.find=K6,Ot.findIndex=Xm,Ot.findKey=dYe,Ot.findLast=nI,Ot.findLastIndex=gv,Ot.findLastKey=fYe,Ot.floor=BXe,Ot.forEach=wv,Ot.forEachRight=Y6,Ot.forIn=hYe,Ot.forInRight=pYe,Ot.forOwn=mYe,Ot.forOwnRight=xYe,Ot.get=sH,Ot.gt=RKe,Ot.gte=LKe,Ot.has=yYe,Ot.hasIn=iH,Ot.head=Lx,Ot.identity=Ud,Ot.includes=sI,Ot.indexOf=Rp,Ot.inRange=DYe,Ot.invoke=CYe,Ot.isArguments=Sv,Ot.isArray=Ai,Ot.isArrayBuffer=DKe,Ot.isArrayLike=Bd,Ot.isArrayLikeObject=xl,Ot.isBoolean=BKe,Ot.isBuffer=xb,Ot.isDate=$Ke,Ot.isElement=UKe,Ot.isEmpty=zKe,Ot.isEqual=HKe,Ot.isEqualWith=VKe,Ot.isError=nH,Ot.isFinite=WKe,Ot.isFunction=zx,Ot.isInteger=Pfe,Ot.isLength=iI,Ot.isMap=Ife,Ot.isMatch=qKe,Ot.isMatchWith=GKe,Ot.isNaN=KKe,Ot.isNative=YKe,Ot.isNil=QKe,Ot.isNull=XKe,Ot.isNumber=Ffe,Ot.isObject=zo,Ot.isObjectLike=Jo,Ot.isPlainObject=D8,Ot.isRegExp=rH,Ot.isSafeInteger=ZKe,Ot.isSet=Ofe,Ot.isString=aI,Ot.isSymbol=If,Ot.isTypedArray=eC,Ot.isUndefined=JKe,Ot.isWeakMap=eYe,Ot.isWeakSet=tYe,Ot.join=Zm,Ot.kebabCase=VYe,Ot.last=qc,Ot.lastIndexOf=yv,Ot.lowerCase=WYe,Ot.lowerFirst=qYe,Ot.lt=nYe,Ot.lte=rYe,Ot.max=$Xe,Ot.maxBy=UXe,Ot.mean=zXe,Ot.meanBy=HXe,Ot.min=VXe,Ot.minBy=WXe,Ot.stubArray=dH,Ot.stubFalse=fH,Ot.stubObject=TXe,Ot.stubString=PXe,Ot.stubTrue=IXe,Ot.multiply=qXe,Ot.nth=E8,Ot.noConflict=CXe,Ot.noop=uH,Ot.now=_n,Ot.pad=GYe,Ot.padEnd=KYe,Ot.padStart=YYe,Ot.parseInt=XYe,Ot.random=BYe,Ot.reduce=J6,Ot.reduceRight=A,Ot.repeat=QYe,Ot.replace=ZYe,Ot.result=kYe,Ot.round=GXe,Ot.runInContext=St,Ot.sample=Z,Ot.size=Ve,Ot.snakeCase=JYe,Ot.some=Nt,Ot.sortedIndex=k8,Ot.sortedIndexBy=zz,Ot.sortedIndexOf=e0,Ot.sortedLastIndex=qP,Ot.sortedLastIndexBy=T8,Ot.sortedLastIndexOf=Dx,Ot.startCase=tXe,Ot.startsWith=nXe,Ot.subtract=KXe,Ot.sum=YXe,Ot.sumBy=XXe,Ot.template=rXe,Ot.times=FXe,Ot.toFinite=Hx,Ot.toInteger=Ri,Ot.toLength=Rfe,Ot.toLower=sXe,Ot.toNumber=Sh,Ot.toSafeInteger=sYe,Ot.toString=Pa,Ot.toUpper=iXe,Ot.trim=aXe,Ot.trimEnd=oXe,Ot.trimStart=lXe,Ot.truncate=cXe,Ot.unescape=uXe,Ot.uniqueId=MXe,Ot.upperCase=dXe,Ot.upperFirst=aH,Ot.each=wv,Ot.eachRight=Y6,Ot.first=Lx,cH(Ot,function(){var D={};return Yu(Ot,function(Y,ye){Oi.call(Ot.prototype,ye)||(D[ye]=Y)}),D}(),{chain:!1}),Ot.VERSION=r,pr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(D){Ot[D].placeholder=Ot}),pr(["drop","take"],function(D,Y){Ni.prototype[D]=function(ye){ye=ye===n?1:Qo(Ri(ye),0);var We=this.__filtered__&&!Y?new Ni(this):this.clone();return We.__filtered__?We.__takeCount__=xc(ye,We.__takeCount__):We.__views__.push({size:xc(ye,oe),type:D+(We.__dir__<0?"Right":"")}),We},Ni.prototype[D+"Right"]=function(ye){return this.reverse()[D](ye).reverse()}}),pr(["filter","map","takeWhile"],function(D,Y){var ye=Y+1,We=ye==fe||ye==se;Ni.prototype[D]=function(bt){var Vt=this.clone();return Vt.__iteratees__.push({iteratee:Gs(bt,3),type:ye}),Vt.__filtered__=Vt.__filtered__||We,Vt}}),pr(["head","last"],function(D,Y){var ye="take"+(Y?"Right":"");Ni.prototype[D]=function(){return this[ye](1).value()[0]}}),pr(["initial","tail"],function(D,Y){var ye="drop"+(Y?"":"Right");Ni.prototype[D]=function(){return this.__filtered__?new Ni(this):this[ye](1)}}),Ni.prototype.compact=function(){return this.filter(Ud)},Ni.prototype.find=function(D){return this.filter(D).head()},Ni.prototype.findLast=function(D){return this.reverse().find(D)},Ni.prototype.invokeMap=Mi(function(D,Y){return typeof D=="function"?new Ni(this):this.map(function(ye){return Fd(ye,D,Y)})}),Ni.prototype.reject=function(D){return this.filter(Fs(Gs(D)))},Ni.prototype.slice=function(D,Y){D=Ri(D);var ye=this;return ye.__filtered__&&(D>0||Y<0)?new Ni(ye):(D<0?ye=ye.takeRight(-D):D&&(ye=ye.drop(D)),Y!==n&&(Y=Ri(Y),ye=Y<0?ye.dropRight(-Y):ye.take(Y-D)),ye)},Ni.prototype.takeRightWhile=function(D){return this.reverse().takeWhile(D).reverse()},Ni.prototype.toArray=function(){return this.take(oe)},Yu(Ni.prototype,function(D,Y){var ye=/^(?:filter|find|map|reject)|While$/.test(Y),We=/^(?:head|last)$/.test(Y),bt=Ot[We?"take"+(Y=="last"?"Right":""):Y],Vt=We||/^find/.test(Y);bt&&(Ot.prototype[Y]=function(){var mn=this.__wrapped__,In=We?[1]:arguments,qn=mn instanceof Ni,Mr=In[0],Rr=qn||Ai(mn),Hr=function(Ki){var Zi=bt.apply(Ot,gs([Ki],In));return We&&ds?Zi[0]:Zi};Rr&&ye&&typeof Mr=="function"&&Mr.length!=1&&(qn=Rr=!1);var ds=this.__chain__,Ds=!!this.__actions__.length,ei=Vt&&!ds,Li=qn&&!Ds;if(!Vt&&Rr){mn=Li?mn:new Ni(this);var ti=D.apply(mn,In);return ti.__actions__.push({func:Pf,args:[Hr],thisArg:n}),new gc(ti,ds)}return ei&&Li?D.apply(this,In):(ti=this.thru(Hr),ei?We?ti.value()[0]:ti.value():ti)})}),pr(["pop","push","shift","sort","splice","unshift"],function(D){var Y=ro[D],ye=/^(?:push|sort|unshift)$/.test(D)?"tap":"thru",We=/^(?:pop|shift)$/.test(D);Ot.prototype[D]=function(){var bt=arguments;if(We&&!this.__chain__){var Vt=this.value();return Y.apply(Ai(Vt)?Vt:[],bt)}return this[ye](function(mn){return Y.apply(Ai(mn)?mn:[],bt)})}}),Yu(Ni.prototype,function(D,Y){var ye=Ot[Y];if(ye){var We=ye.name+"";Oi.call(Y1,We)||(Y1[We]=[]),Y1[We].push({name:Y,func:ye})}}),Y1[ub(n,N).name]=[{name:"wrapper",func:n}],Ni.prototype.clone=i6,Ni.prototype.reverse=Vj,Ni.prototype.value=Z1,Ot.prototype.at=W6,Ot.prototype.chain=Ux,Ot.prototype.commit=q6,Ot.prototype.next=F8,Ot.prototype.plant=Qz,Ot.prototype.reverse=M8,Ot.prototype.toJSON=Ot.prototype.valueOf=Ot.prototype.value=Zz,Ot.prototype.first=Ot.prototype.head,Ap&&(Ot.prototype[Ap]=O8),Ot},Qt=_t();Ys?((Ys.exports=Qt)._=Qt,es._=Qt):mr._=Qt}).call(hln)}(l9,l9.exports)),l9.exports}var mln=pln();const J4e=Ii(mln),xln=({wallet:t="",wallets:e=[]})=>{const[n,r]=m.useState([]),[s,a]=m.useState(!0),[o,l]=m.useState({key:null,direction:null}),c=C=>C.filter(Boolean).map(N=>{var P,T;return typeof N=="string"?N.toLowerCase():((T=(P=N==null?void 0:N.wallet_address)==null?void 0:P.toLowerCase)==null?void 0:T.call(P))||""}).filter(Boolean);m.useEffect(()=>{(async()=>{a(!0);const N=e&&e.length?c(e):[t];if(!N[0]){r([]),a(!1);return}const P=Date.now()-30*24*60*60*1e3;try{const M=(await Promise.all(N.map(F=>ps.post("https://api-ui.hyperliquid.xyz/info",{type:"userNonFundingLedgerUpdates",user:F,startTime:P})))).flatMap(F=>F.data||[]).sort((F,$)=>$.time-F.time);r(M)}catch(T){console.error("Error fetching transaction data:",T)}finally{a(!1)}})()},[t,JSON.stringify(e)]);const u=C=>{let N="asc";o.key===C&&(o.direction==="asc"?N="desc":o.direction==="desc"&&(N=null)),l({key:C,direction:N})},d=[...n].sort((C,N)=>{if(!o.key||!o.direction)return 0;const P=J4e.get(C,o.key),T=J4e.get(N,o.key);return P<T?o.direction==="asc"?-1:1:P>T?o.direction==="asc"?1:-1:0}),f=C=>{if(o.key===C){if(o.direction==="asc")return i.jsx(i2,{className:"inline ml-2 text-white"});if(o.direction==="desc")return i.jsx(s2,{className:"inline ml-2 text-white"})}return i.jsx(a2,{className:"inline ml-2 text-white"})},x=localStorage.getItem("isDateDepositWithdrawFormat")||"date",[g,y]=m.useState(x);m.useEffect(()=>{localStorage.setItem("isDateDepositWithdrawFormat",g)},[g]);const v=({date:C})=>{const[N,P]=m.useState($o(C));return m.useEffect(()=>{const T=setInterval(()=>P($o(C)),1e3);return()=>clearInterval(T)},[C]),i.jsx("span",{className:"text-white text-[13px] font-semibold font-manrope",children:N.dateTime})};return i.jsx("div",{className:"relative w-full text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:i.jsx("div",{className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full mt-1 mb-3 bg-[#161616] rounded-lg pb-24",children:i.jsxs("table",{className:"w-full table-auto relative border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"sticky top-0 bg-[#161616]",children:i.jsxs("tr",{className:"text-[#9b9b9b] text-left",children:[i.jsxs("th",{onClick:()=>u("time"),className:"cursor-pointer",children:["Time ",f("time")]}),i.jsxs("th",{onClick:()=>u("delta.type"),className:"cursor-pointer",children:["Type ",f("delta.type")]}),i.jsxs("th",{onClick:()=>u("asset"),className:"cursor-pointer",children:["Asset ",f("asset")]}),i.jsxs("th",{onClick:()=>u("delta.usdc"),className:"cursor-pointer",children:["Amount ",f("delta.usdc")]}),i.jsx("th",{children:"Transaction"})]})}),i.jsx("tbody",{children:s?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-4",children:"Loading…"})}):d.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center p-4",children:"No transactions available"})}):d.map((C,N)=>i.jsxs("tr",{className:"bg-[#1b1b1b] hover:bg-[#222222] h-[32px] text-white",children:[i.jsx("td",{className:"cursor-pointer",onClick:()=>y(g==="time"?"date":"time"),children:g==="time"?i.jsx(v,{date:C.time}):cu(C.time)}),i.jsx("td",{className:C.delta.type==="deposit"?"text-[#4ae3b5]":C.delta.type==="withdraw"?"text-[#ff6b6b]":"",children:C.delta.type?C.delta.type[0].toUpperCase()+C.delta.type.slice(1):"Unknown"}),i.jsx("td",{children:"-"}),i.jsxs("td",{children:["$",_r(+C.delta.usdc)]}),i.jsx("td",{className:"break-all",children:KB(C.hash)})]},N))})]})})})};function Zre(){return Zre=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Zre.apply(null,arguments)}function eSe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Jre(t,e){return Jre=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Jre(t,e)}function gln(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Jre(t,e)}var tSe=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function bln(t,e){return!!(t===e||tSe(t)&&tSe(e))}function yln(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!bln(t[n],e[n]))return!1;return!0}function YX(t,e){e===void 0&&(e=yln);var n,r=[],s,a=!1;function o(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];return a&&n===this&&e(l,r)||(s=t.apply(this,l),a=!0,n=this,r=l),s}return o}var vln=typeof performance=="object"&&typeof performance.now=="function",nSe=vln?function(){return performance.now()}:function(){return Date.now()};function rSe(t){cancelAnimationFrame(t.id)}function wln(t,e){var n=nSe();function r(){nSe()-n>=e?t.call(null):s.id=requestAnimationFrame(r)}var s={id:requestAnimationFrame(r)};return s}var XX=-1;function sSe(t){if(t===void 0&&(t=!1),XX===-1||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(e),XX=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return XX}var EC=null;function iSe(t){if(t===void 0&&(t=!1),EC===null||t){var e=document.createElement("div"),n=e.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),s=r.style;return s.width="100px",s.height="100px",e.appendChild(r),document.body.appendChild(e),e.scrollLeft>0?EC="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?EC="negative":EC="positive-ascending"),document.body.removeChild(e),EC}return EC}var Cln=150,Sln=function(e,n){return e};function Nln(t){var e,n=t.getItemOffset,r=t.getEstimatedTotalSize,s=t.getItemSize,a=t.getOffsetForIndexAndAlignment,o=t.getStartIndexForOffset,l=t.getStopIndexForStartIndex,c=t.initInstanceProps,u=t.shouldResetStyleCacheOnItemSizeChange,d=t.validateProps;return e=function(f){gln(x,f);function x(y){var v;return v=f.call(this,y)||this,v._instanceProps=c(v.props,eSe(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:eSe(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=YX(function(C,N,P,T){return v.props.onItemsRendered({overscanStartIndex:C,overscanStopIndex:N,visibleStartIndex:P,visibleStopIndex:T})}),v._callOnScroll=void 0,v._callOnScroll=YX(function(C,N,P){return v.props.onScroll({scrollDirection:C,scrollOffset:N,scrollUpdateWasRequested:P})}),v._getItemStyle=void 0,v._getItemStyle=function(C){var N=v.props,P=N.direction,T=N.itemSize,M=N.layout,F=v._getItemStyleCache(u&&T,u&&M,u&&P),$;if(F.hasOwnProperty(C))$=F[C];else{var L=n(v.props,C,v._instanceProps),z=s(v.props,C,v._instanceProps),X=P==="horizontal"||M==="horizontal",ne=P==="rtl",J=X?L:0;F[C]=$={position:"absolute",left:ne?void 0:J,right:ne?J:void 0,top:X?0:L,height:X?"100%":z,width:X?z:"100%"}}return $},v._getItemStyleCache=void 0,v._getItemStyleCache=YX(function(C,N,P){return{}}),v._onScrollHorizontal=function(C){var N=C.currentTarget,P=N.clientWidth,T=N.scrollLeft,M=N.scrollWidth;v.setState(function(F){if(F.scrollOffset===T)return null;var $=v.props.direction,L=T;if($==="rtl")switch(iSe()){case"negative":L=-T;break;case"positive-descending":L=M-P-T;break}return L=Math.max(0,Math.min(L,M-P)),{isScrolling:!0,scrollDirection:F.scrollOffset<L?"forward":"backward",scrollOffset:L,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(C){var N=C.currentTarget,P=N.clientHeight,T=N.scrollHeight,M=N.scrollTop;v.setState(function(F){if(F.scrollOffset===M)return null;var $=Math.max(0,Math.min(M,T-P));return{isScrolling:!0,scrollDirection:F.scrollOffset<$?"forward":"backward",scrollOffset:$,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(C){var N=v.props.outerRef;v._outerRef=C,typeof N=="function"?N(C):N!=null&&typeof N=="object"&&N.hasOwnProperty("current")&&(N.current=C)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&rSe(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=wln(v._resetIsScrolling,Cln)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}x.getDerivedStateFromProps=function(v,C){return Aln(v,C),d(v),null};var g=x.prototype;return g.scrollTo=function(v){v=Math.max(0,v),this.setState(function(C){return C.scrollOffset===v?null:{scrollDirection:C.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(v,C){C===void 0&&(C="auto");var N=this.props,P=N.itemCount,T=N.layout,M=this.state.scrollOffset;v=Math.max(0,Math.min(v,P-1));var F=0;if(this._outerRef){var $=this._outerRef;T==="vertical"?F=$.scrollWidth>$.clientWidth?sSe():0:F=$.scrollHeight>$.clientHeight?sSe():0}this.scrollTo(a(this.props,v,C,M,this._instanceProps,F))},g.componentDidMount=function(){var v=this.props,C=v.direction,N=v.initialScrollOffset,P=v.layout;if(typeof N=="number"&&this._outerRef!=null){var T=this._outerRef;C==="horizontal"||P==="horizontal"?T.scrollLeft=N:T.scrollTop=N}this._callPropsCallbacks()},g.componentDidUpdate=function(){var v=this.props,C=v.direction,N=v.layout,P=this.state,T=P.scrollOffset,M=P.scrollUpdateWasRequested;if(M&&this._outerRef!=null){var F=this._outerRef;if(C==="horizontal"||N==="horizontal")if(C==="rtl")switch(iSe()){case"negative":F.scrollLeft=-T;break;case"positive-ascending":F.scrollLeft=T;break;default:var $=F.clientWidth,L=F.scrollWidth;F.scrollLeft=L-$-T;break}else F.scrollLeft=T;else F.scrollTop=T}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&rSe(this._resetIsScrollingTimeoutId)},g.render=function(){var v=this.props,C=v.children,N=v.className,P=v.direction,T=v.height,M=v.innerRef,F=v.innerElementType,$=v.innerTagName,L=v.itemCount,z=v.itemData,X=v.itemKey,ne=X===void 0?Sln:X,J=v.layout,K=v.outerElementType,te=v.outerTagName,fe=v.style,q=v.useIsScrolling,se=v.width,ae=this.state.isScrolling,W=P==="horizontal"||J==="horizontal",V=W?this._onScrollHorizontal:this._onScrollVertical,ee=this._getRangeToRender(),oe=ee[0],de=ee[1],Ce=[];if(L>0)for(var me=oe;me<=de;me++)Ce.push(m.createElement(C,{data:z,key:ne(me,z),index:me,isScrolling:q?ae:void 0,style:this._getItemStyle(me)}));var we=r(this.props,this._instanceProps);return m.createElement(K||te||"div",{className:N,onScroll:V,ref:this._outerRefSetter,style:Zre({position:"relative",height:T,width:se,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:P},fe)},m.createElement(F||$||"div",{children:Ce,ref:M,style:{height:W?"100%":we,pointerEvents:ae?"none":void 0,width:W?we:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var C=this._getRangeToRender(),N=C[0],P=C[1],T=C[2],M=C[3];this._callOnItemsRendered(N,P,T,M)}}if(typeof this.props.onScroll=="function"){var F=this.state,$=F.scrollDirection,L=F.scrollOffset,z=F.scrollUpdateWasRequested;this._callOnScroll($,L,z)}},g._getRangeToRender=function(){var v=this.props,C=v.itemCount,N=v.overscanCount,P=this.state,T=P.isScrolling,M=P.scrollDirection,F=P.scrollOffset;if(C===0)return[0,0,0,0];var $=o(this.props,F,this._instanceProps),L=l(this.props,$,F,this._instanceProps),z=!T||M==="backward"?Math.max(1,N):1,X=!T||M==="forward"?Math.max(1,N):1;return[Math.max(0,$-z),Math.max(0,Math.min(C-1,L+X)),$,L]},x}(m.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},e}var Aln=function(e,n){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,n.instance},jln=Nln({getItemOffset:function(e,n){var r=e.itemSize;return n*r},getItemSize:function(e,n){var r=e.itemSize;return r},getEstimatedTotalSize:function(e){var n=e.itemCount,r=e.itemSize;return r*n},getOffsetForIndexAndAlignment:function(e,n,r,s,a,o){var l=e.direction,c=e.height,u=e.itemCount,d=e.itemSize,f=e.layout,x=e.width,g=l==="horizontal"||f==="horizontal",y=g?x:c,v=Math.max(0,u*d-y),C=Math.min(v,n*d),N=Math.max(0,n*d-y+d+o);switch(r==="smart"&&(s>=N-y&&s<=C+y?r="auto":r="center"),r){case"start":return C;case"end":return N;case"center":{var P=Math.round(N+(C-N)/2);return P<Math.ceil(y/2)?0:P>v+Math.floor(y/2)?v:P}case"auto":default:return s>=N&&s<=C?s:s<N?N:C}},getStartIndexForOffset:function(e,n){var r=e.itemCount,s=e.itemSize;return Math.max(0,Math.min(r-1,Math.floor(n/s)))},getStopIndexForStartIndex:function(e,n,r){var s=e.direction,a=e.height,o=e.itemCount,l=e.itemSize,c=e.layout,u=e.width,d=s==="horizontal"||c==="horizontal",f=n*l,x=d?u:a,g=Math.ceil((x+r-f)/l);return Math.max(0,Math.min(o-1,n+g-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}}),xM={exports:{}},Eln=xM.exports,aSe;function _ln(){return aSe||(aSe=1,function(t,e){(function(n,r){t.exports=r()})(Eln,function(){var n=1e3,r=6e4,s=36e5,a="millisecond",o="second",l="minute",c="hour",u="day",d="week",f="month",x="quarter",g="year",y="date",v="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,P={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(fe){var q=["th","st","nd","rd"],se=fe%100;return"["+fe+(q[(se-20)%10]||q[se]||q[0])+"]"}},T=function(fe,q,se){var ae=String(fe);return!ae||ae.length>=q?fe:""+Array(q+1-ae.length).join(se)+fe},M={s:T,z:function(fe){var q=-fe.utcOffset(),se=Math.abs(q),ae=Math.floor(se/60),W=se%60;return(q<=0?"+":"-")+T(ae,2,"0")+":"+T(W,2,"0")},m:function fe(q,se){if(q.date()<se.date())return-fe(se,q);var ae=12*(se.year()-q.year())+(se.month()-q.month()),W=q.clone().add(ae,f),V=se-W<0,ee=q.clone().add(ae+(V?-1:1),f);return+(-(ae+(se-W)/(V?W-ee:ee-W))||0)},a:function(fe){return fe<0?Math.ceil(fe)||0:Math.floor(fe)},p:function(fe){return{M:f,y:g,w:d,d:u,D:y,h:c,m:l,s:o,ms:a,Q:x}[fe]||String(fe||"").toLowerCase().replace(/s$/,"")},u:function(fe){return fe===void 0}},F="en",$={};$[F]=P;var L="$isDayjsObject",z=function(fe){return fe instanceof K||!(!fe||!fe[L])},X=function fe(q,se,ae){var W;if(!q)return F;if(typeof q=="string"){var V=q.toLowerCase();$[V]&&(W=V),se&&($[V]=se,W=V);var ee=q.split("-");if(!W&&ee.length>1)return fe(ee[0])}else{var oe=q.name;$[oe]=q,W=oe}return!ae&&W&&(F=W),W||!ae&&F},ne=function(fe,q){if(z(fe))return fe.clone();var se=typeof q=="object"?q:{};return se.date=fe,se.args=arguments,new K(se)},J=M;J.l=X,J.i=z,J.w=function(fe,q){return ne(fe,{locale:q.$L,utc:q.$u,x:q.$x,$offset:q.$offset})};var K=function(){function fe(se){this.$L=X(se.locale,null,!0),this.parse(se),this.$x=this.$x||se.x||{},this[L]=!0}var q=fe.prototype;return q.parse=function(se){this.$d=function(ae){var W=ae.date,V=ae.utc;if(W===null)return new Date(NaN);if(J.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var ee=W.match(C);if(ee){var oe=ee[2]-1||0,de=(ee[7]||"0").substring(0,3);return V?new Date(Date.UTC(ee[1],oe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,de)):new Date(ee[1],oe,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,de)}}return new Date(W)}(se),this.init()},q.init=function(){var se=this.$d;this.$y=se.getFullYear(),this.$M=se.getMonth(),this.$D=se.getDate(),this.$W=se.getDay(),this.$H=se.getHours(),this.$m=se.getMinutes(),this.$s=se.getSeconds(),this.$ms=se.getMilliseconds()},q.$utils=function(){return J},q.isValid=function(){return this.$d.toString()!==v},q.isSame=function(se,ae){var W=ne(se);return this.startOf(ae)<=W&&W<=this.endOf(ae)},q.isAfter=function(se,ae){return ne(se)<this.startOf(ae)},q.isBefore=function(se,ae){return this.endOf(ae)<ne(se)},q.$g=function(se,ae,W){return J.u(se)?this[ae]:this.set(W,se)},q.unix=function(){return Math.floor(this.valueOf()/1e3)},q.valueOf=function(){return this.$d.getTime()},q.startOf=function(se,ae){var W=this,V=!!J.u(ae)||ae,ee=J.p(se),oe=function(Ie,Re){var Qe=J.w(W.$u?Date.UTC(W.$y,Re,Ie):new Date(W.$y,Re,Ie),W);return V?Qe:Qe.endOf(u)},de=function(Ie,Re){return J.w(W.toDate()[Ie].apply(W.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Re)),W)},Ce=this.$W,me=this.$M,we=this.$D,xe="set"+(this.$u?"UTC":"");switch(ee){case g:return V?oe(1,0):oe(31,11);case f:return V?oe(1,me):oe(0,me+1);case d:var be=this.$locale().weekStart||0,je=(Ce<be?Ce+7:Ce)-be;return oe(V?we-je:we+(6-je),me);case u:case y:return de(xe+"Hours",0);case c:return de(xe+"Minutes",1);case l:return de(xe+"Seconds",2);case o:return de(xe+"Milliseconds",3);default:return this.clone()}},q.endOf=function(se){return this.startOf(se,!1)},q.$set=function(se,ae){var W,V=J.p(se),ee="set"+(this.$u?"UTC":""),oe=(W={},W[u]=ee+"Date",W[y]=ee+"Date",W[f]=ee+"Month",W[g]=ee+"FullYear",W[c]=ee+"Hours",W[l]=ee+"Minutes",W[o]=ee+"Seconds",W[a]=ee+"Milliseconds",W)[V],de=V===u?this.$D+(ae-this.$W):ae;if(V===f||V===g){var Ce=this.clone().set(y,1);Ce.$d[oe](de),Ce.init(),this.$d=Ce.set(y,Math.min(this.$D,Ce.daysInMonth())).$d}else oe&&this.$d[oe](de);return this.init(),this},q.set=function(se,ae){return this.clone().$set(se,ae)},q.get=function(se){return this[J.p(se)]()},q.add=function(se,ae){var W,V=this;se=Number(se);var ee=J.p(ae),oe=function(me){var we=ne(V);return J.w(we.date(we.date()+Math.round(me*se)),V)};if(ee===f)return this.set(f,this.$M+se);if(ee===g)return this.set(g,this.$y+se);if(ee===u)return oe(1);if(ee===d)return oe(7);var de=(W={},W[l]=r,W[c]=s,W[o]=n,W)[ee]||1,Ce=this.$d.getTime()+se*de;return J.w(Ce,this)},q.subtract=function(se,ae){return this.add(-1*se,ae)},q.format=function(se){var ae=this,W=this.$locale();if(!this.isValid())return W.invalidDate||v;var V=se||"YYYY-MM-DDTHH:mm:ssZ",ee=J.z(this),oe=this.$H,de=this.$m,Ce=this.$M,me=W.weekdays,we=W.months,xe=W.meridiem,be=function(Re,Qe,Ke,dt){return Re&&(Re[Qe]||Re(ae,V))||Ke[Qe].slice(0,dt)},je=function(Re){return J.s(oe%12||12,Re,"0")},Ie=xe||function(Re,Qe,Ke){var dt=Re<12?"AM":"PM";return Ke?dt.toLowerCase():dt};return V.replace(N,function(Re,Qe){return Qe||function(Ke){switch(Ke){case"YY":return String(ae.$y).slice(-2);case"YYYY":return J.s(ae.$y,4,"0");case"M":return Ce+1;case"MM":return J.s(Ce+1,2,"0");case"MMM":return be(W.monthsShort,Ce,we,3);case"MMMM":return be(we,Ce);case"D":return ae.$D;case"DD":return J.s(ae.$D,2,"0");case"d":return String(ae.$W);case"dd":return be(W.weekdaysMin,ae.$W,me,2);case"ddd":return be(W.weekdaysShort,ae.$W,me,3);case"dddd":return me[ae.$W];case"H":return String(oe);case"HH":return J.s(oe,2,"0");case"h":return je(1);case"hh":return je(2);case"a":return Ie(oe,de,!0);case"A":return Ie(oe,de,!1);case"m":return String(de);case"mm":return J.s(de,2,"0");case"s":return String(ae.$s);case"ss":return J.s(ae.$s,2,"0");case"SSS":return J.s(ae.$ms,3,"0");case"Z":return ee}return null}(Re)||ee.replace(":","")})},q.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},q.diff=function(se,ae,W){var V,ee=this,oe=J.p(ae),de=ne(se),Ce=(de.utcOffset()-this.utcOffset())*r,me=this-de,we=function(){return J.m(ee,de)};switch(oe){case g:V=we()/12;break;case f:V=we();break;case x:V=we()/3;break;case d:V=(me-Ce)/6048e5;break;case u:V=(me-Ce)/864e5;break;case c:V=me/s;break;case l:V=me/r;break;case o:V=me/n;break;default:V=me}return W?V:J.a(V)},q.daysInMonth=function(){return this.endOf(f).$D},q.$locale=function(){return $[this.$L]},q.locale=function(se,ae){if(!se)return this.$L;var W=this.clone(),V=X(se,ae,!0);return V&&(W.$L=V),W},q.clone=function(){return J.w(this.$d,this)},q.toDate=function(){return new Date(this.valueOf())},q.toJSON=function(){return this.isValid()?this.toISOString():null},q.toISOString=function(){return this.$d.toISOString()},q.toString=function(){return this.$d.toUTCString()},fe}(),te=K.prototype;return ne.prototype=te,[["$ms",a],["$s",o],["$m",l],["$H",c],["$W",u],["$M",f],["$y",g],["$D",y]].forEach(function(fe){te[fe[1]]=function(q){return this.$g(q,fe[0],fe[1])}}),ne.extend=function(fe,q){return fe.$i||(fe(q,K,ne),fe.$i=!0),ne},ne.locale=X,ne.isDayjs=z,ne.unix=function(fe){return ne(1e3*fe)},ne.en=$[F],ne.Ls=$,ne.p={},ne})}(xM)),xM.exports}var kln=_ln();const QX=Ii(kln),Tln=Ne.forwardRef(function({style:e,...n},r){const s=e&&e.pointerEvents==="none"?{...e,pointerEvents:"auto"}:e;return i.jsx("div",{ref:r,style:s,...n})}),zu=({data:t,columns:e,tableClassName:n,theadClassName:r,tbodyClassName:s,rowClassName:a,cellClassName:o,rowHeight:l=36,listHeight:c=500,rowKey:u,onVisibleRows:d,onRowClick:f,loading:x=!1,skeletonRowCount:g=10,skeletonRenderer:y,emptyState:v=null,loadingState:C=null})=>{const[N,P]=m.useState({key:null,direction:null}),[T,M]=m.useState({}),[F,$]=m.useState(null),[L,z]=m.useState(null),[X,ne]=m.useState({top:0,left:0}),J=m.useRef(null),K=m.useRef(null);m.useEffect(()=>{function tt(nt){J.current&&!J.current.contains(nt.target)&&($(null),z(null))}return document.addEventListener("mousedown",tt),()=>document.removeEventListener("mousedown",tt)},[]),m.useEffect(()=>{F&&(L==null?void 0:L.filterType)==="text"&&setTimeout(()=>{var tt;return(tt=K.current)==null?void 0:tt.focus()},0)},[F,L]);function te(tt,nt,Le){return tt.filter(Be=>nt.every(ht=>{const pt=Le[ht.key];if(!ht.filterType||!pt)return!0;const Gt=Be[ht.key];if(pt.filterType==="text"){const wt=pt.value||"";return Gt==null?void 0:Gt.toString().toLowerCase().includes(wt.toLowerCase())}if(pt.filterType==="select")return!pt.values||pt.values.length===0?!0:pt.values.includes(Gt);if(pt.filterType==="dateRange"){if(!Gt)return!1;const wt=QX(Gt);return!(pt.start&&wt.isBefore(QX(pt.start))||pt.end&&wt.isAfter(QX(pt.end)))}if(pt.filterType==="numberRange"){const wt=parseFloat(pt.min),nn=parseFloat(pt.max),cn=parseFloat(Gt);return!(!isNaN(wt)&&cn<wt||!isNaN(nn)&&cn>nn)}return!0}))}function fe(tt,nt){if(!nt.key||!nt.direction)return tt;const Le=e.find(Be=>Be.key===nt.key);return Le?[...tt].sort((Be,ht)=>{const pt=Le.sortValue?Le.sortValue(Be):Be[nt.key],Gt=Le.sortValue?Le.sortValue(ht):ht[nt.key],wt=pt==null||pt==="-",nn=Gt==null||Gt==="-";return wt&&nn?0:wt?1:nn?-1:typeof pt=="number"&&typeof Gt=="number"?nt.direction==="asc"?pt-Gt:Gt-pt:typeof pt=="string"&&typeof Gt=="string"?nt.direction==="asc"?pt.localeCompare(Gt):Gt.localeCompare(pt):pt<Gt?nt.direction==="asc"?-1:1:pt>Gt?nt.direction==="asc"?1:-1:0}):tt}function q(tt){P(nt=>nt.key===tt?nt.direction==="asc"?{key:tt,direction:"desc"}:nt.direction==="desc"?{key:null,direction:null}:{key:tt,direction:"asc"}:{key:tt,direction:"asc"})}function se(tt){if(N.key===tt){if(N.direction==="asc")return i.jsx(i2,{className:"inline ml-1"});if(N.direction==="desc")return i.jsx(s2,{className:"inline ml-1"})}return i.jsx(a2,{className:"inline ml-1"})}function ae(tt,nt){M(Le=>{const Be=Le[tt]||{};return{...Le,[tt]:{...Be,...nt}}})}function W(tt){M(nt=>{const Le={...nt};return delete Le[tt],Le})}function V(tt,nt){const Le=tt.currentTarget.getBoundingClientRect(),Be=Le.left+Le.width/2-192/2+window.scrollX,ht=Le.bottom+window.scrollY;if(ne({top:ht,left:Be}),F===nt.key)$(null),z(null);else{$(nt.key);const pt=T[nt.key]||{};z({filterType:nt.filterType,value:pt.value||"",values:pt.values||[],start:pt.start||"",end:pt.end||"",min:pt.min||"",max:pt.max||""})}}function ee(tt){L&&ae(tt,L),$(null),z(null)}function oe(tt){if(!L)return null;const nt=L.filterType;return Kse.createPortal(i.jsxs("div",{ref:J,style:{position:"absolute",top:X.top,left:X.left,zIndex:9999},children:[nt==="text"&&i.jsxs("div",{className:"bg-black/10 border border-gray-400 text-white p-2 font-inter font-semibold shadow-xl w-48 rounded-2xl backdrop-blur-lg",children:[i.jsx("input",{ref:K,type:"text",value:L.value,onChange:Le=>z(Be=>({...Be,value:Le.target.value})),className:"p-1 mb-2 border border-gray-600 bg-gray-600 text-white rounded w-full h-6"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{W(tt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ee(tt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),nt==="select"&&i.jsxs("div",{className:"bg-black/10 border border-gray-400 text-white p-2 font-inter font-semibold shadow-xl w-48 max-h-48 overflow-y-auto rounded-2xl backdrop-blur-lg",children:[(tt.options||[]).map(Le=>{const Be=L.values,ht=Be.includes(Le);return i.jsxs("label",{className:"block cursor-pointer hover:bg-gray-700 p-1 rounded",children:[i.jsx("input",{type:"checkbox",className:"mr-2",checked:ht,onChange:()=>{z(ht?pt=>({...pt,values:Be.filter(Gt=>Gt!==Le)}):pt=>({...pt,values:[...Be,Le]}))}}),Le]},Le)}),i.jsxs("div",{className:"flex justify-between mt-2",children:[i.jsx("button",{onClick:()=>{W(tt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ee(tt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),nt==="dateRange"&&i.jsxs("div",{className:"bg-black/10 border border-gray-400 text-white p-2 font-inter font-semibold shadow-xl w-52 rounded-2xl backdrop-blur-lg",children:[i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"Start"}),i.jsx("input",{type:"date",className:"p-1 mb-2 border border-gray-600 bg-gray-700 text-white rounded w-full h-6 text-xs",value:L.start,onChange:Le=>z(Be=>({...Be,start:Le.target.value}))})]}),i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"End"}),i.jsx("input",{type:"date",className:"p-1 border border-gray-600 bg-gray-700 text-white rounded w-full h-6 text-xs",value:L.end,onChange:Le=>z(Be=>({...Be,end:Le.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{W(tt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ee(tt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]}),nt==="numberRange"&&i.jsxs("div",{className:"bg-black/10 border-2 border-gray-700 text-white p-2 font-inter font-semibold shadow-xl w-48 rounded-2xl backdrop-blur-lg",children:[i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"Min"}),i.jsx("input",{type:"number",step:"any",className:"p-1 mb-2 border border-gray-600 bg-gray-700 text-white rounded w-full h-6",value:L.min,onChange:Le=>z(Be=>({...Be,min:Le.target.value}))})]}),i.jsxs("div",{className:"mb-2",children:[i.jsx("label",{className:"block text-xs mb-1",children:"Max"}),i.jsx("input",{type:"number",step:"any",className:"p-1 border border-gray-600 bg-gray-700 text-white rounded w-full h-6",value:L.max,onChange:Le=>z(Be=>({...Be,max:Le.target.value}))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("button",{onClick:()=>{W(tt.key),$(null),z(null)},className:"text-xs px-2 py-1 bg-black/10 border border-[#FF797C] text-[#FF797C] font-semibold hover:bg-black/50",children:"Clear"}),i.jsx("button",{onClick:()=>ee(tt.key),className:"text-xs px-2 py-1 bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-semibold",children:"Apply"})]})]})]}),document.body)}const de=Array.isArray(t)?t:[],Ce=x?[]:fe(te(de,e,T),N),me=e.map(tt=>tt.width||"minmax(0, 100%)").join(" "),we=e.map((tt,nt)=>typeof tt.skeletonWidth=="number"?tt.skeletonWidth:60+nt*23%80),xe=Object.keys(T).length>0,be=!x&&Ce.length===0;function je({w:tt}){return i.jsx("span",{className:"block h-[14px] rounded bg-[#242424] animate-pulse",style:{width:tt}})}function Ie({index:tt,style:nt}){return i.jsx("div",{style:{...nt,display:"grid",gridTemplateColumns:me,alignItems:"center"},className:`relative bg-[#1b1b1b] text-white rounded-xl my-[1px] h-[32px] max-h-[32px] leading-[32px] font-inter text-sm font-semibold ${typeof a=="function"?a({},tt)||"":a||""}`,children:e.map((Le,Be)=>i.jsx("div",{className:`px-4 ${typeof o=="function"?o(Le,{},tt)||"":o||""}`,children:y?y({column:Le,index:tt,width:we[Be]}):i.jsx(je,{w:we[Be]})},`sk-${Le.key}-${Be}`))})}function Re({index:tt,style:nt}){if(tt<0||tt>=Ce.length)return null;const Le=Ce[tt];return i.jsx("div",{onClick:()=>f&&f(Le),style:{...nt,display:"grid",gridTemplateColumns:me,alignItems:"center"},className:`relative group bg-[#1b1b1b] hover:bg-[#222222] text-white rounded-xl my-[1px] h-[32px] max-h-[32px] leading-[32px] font-inter text-sm font-semibold ${typeof a=="function"?a(Le,tt)||"":a||""}`,children:e.map(Be=>{const ht=Be.render?Be.render(Le[Be.key],Le,tt):Le[Be.key];return i.jsx("div",{className:`px-4 overflow-hidden whitespace-nowrap ${typeof o=="function"?o(Be,Le,tt)||"":o||""}`,children:ht},Be.key)})})}const Qe=x?g:Ce.length,Ke=x?void 0:u?tt=>u(Ce[tt]):void 0,dt=tt=>tt.headerTooltip?i.jsx(gi,{content:tt.headerTooltip,align:tt.headerTooltipAlign||"center",children:i.jsx("span",{className:"inline-flex underline decoration-dotted underline-offset-2 cursor-help pointer-events-auto",children:tt.label})}):tt.label;return i.jsx("div",{className:`w-full relative ${n||""}`,children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("div",{className:"min-w-max",children:[i.jsx("div",{className:`sticky top-0 z-10 bg-[#161616] font-inter text-sm font-bold text-white ${r||""}`,style:{display:"grid",gridTemplateColumns:me},children:e.map(tt=>i.jsxs("div",{className:"px-3 py-1 text-left inline-flex items-center w-fit hover:bg-[#262626] hover:rounded-[6px] hover:text-white cursor-pointer transition-all",onClick:()=>!x&&tt.sortable&&q(tt.key),children:[dt(tt),tt.sortable&&i.jsx("span",{className:"ml-1",children:se(tt.key)}),tt.filterType&&i.jsx("span",{className:"ml-2 cursor-pointer",onClick:nt=>{nt.stopPropagation(),x||V(nt,tt)},children:i.jsx(_St,{className:"w-3 h-3"})}),F===tt.key&&oe(tt)]},tt.key))}),x&&C?i.jsx("div",{className:`${s||""} min-w-max`,children:typeof C=="function"?C({hasFilters:xe}):C}):be?i.jsx("div",{className:`${s||""} min-w-max text-xs text-center text-[#9B9B9B]`,children:typeof v=="function"?v({hasFilters:xe}):v}):i.jsx(jln,{className:`${s||""} min-w-max`,height:c,itemCount:Qe,itemSize:l,itemKey:Ke,innerElementType:Tln,width:"100%",onItemsRendered:({visibleStartIndex:tt,visibleStopIndex:nt})=>!x&&d&&d(Ce.slice(tt,nt+1)),children:x?Ie:Re})]})})})},EF=t=>Number(t).toLocaleString("en-US",{maximumFractionDigits:2}),Pln=t=>!isFinite(t)||isNaN(t)?"-":`${Math.floor(t)}h ${Math.round((t-Math.floor(t))*60)}m`,Iln=(t,e,n,r)=>{const s=t*e/n;return r/s*100};function Fln({trades:t,generatedWallets:e,wallet:n,wallets:r}){const[s,a]=m.useState(!1),[o,l]=m.useState(null),[c,u]=m.useState(()=>new Map),[d,f]=m.useState(new Map),[x,g]=m.useState(new Map),[y,v]=m.useState([]),[C,N]=m.useState(!0),P=m.useRef(new Set),T=m.useRef(new Set),{isReferralCodeName:M}=m.useContext(Qr),F=m.useCallback(W=>{const V=W==null?void 0:W.toLowerCase();return V?(r==null?void 0:r.length)>0?r.some(ee=>{var oe;return((oe=ee.wallet_address)==null?void 0:oe.toLowerCase())===V}):(n==null?void 0:n.toLowerCase())===V:!1},[r,n]),$=m.useMemo(()=>r&&r.length?y:Array.isArray(t)?t:[],[r,y,t]),L=m.useCallback(async W=>{const V=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken");if(!(!V||!ee||W.length===0))try{const{data:oe}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:V,token:ee,position_oids:W},{headers:{"Content-Type":"application/json"}});if(oe&&oe.success){const de=parseFloat(oe.leverage);f(Ce=>{const me=new Map(Ce);return W.forEach(we=>me.set(String(we),de)),me})}}catch(oe){console.error("leverage fetch error:",oe)}},[]),z=m.useCallback(async W=>{const V=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken");if(!(!V||!ee||W.length===0))try{const{data:oe}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_position_details_with_oids/",{address:V,token:ee,position_oids:W},{headers:{"Content-Type":"application/json"}});oe&&oe.success&&g(de=>{const Ce=new Map(de);return oe.data.forEach(me=>Ce.set(String(me.oid),me)),Ce})}catch(oe){console.error("source details fetch error:",oe)}},[]),X=m.useMemo(()=>(r??[]).map(W=>{var V;return(V=W.wallet_address)==null?void 0:V.toLowerCase()}).sort().join(","),[r]);m.useEffect(()=>{if(X===""){N(!1),v([]);return}let W=!1;return N(!0),a(!1),P.current.clear(),T.current.clear(),f(new Map),g(new Map),u(new Map),(async()=>{try{const V=X.split(","),ee=(await Promise.all(V.map(async de=>{const[Ce,me]=await Promise.all([dde(de),fde(de)]),we=[...Ce,...me.map(({fill:xe,twapId:be})=>({...xe,twapId:be}))];return hde(we).closed_positions||[]}))).flat();if(W)return;const oe=ee.sort((de,Ce)=>(Ce.close_time||0)-(de.close_time||0));v(oe),l(null)}catch(V){console.error("multi-wallet completed-trades fetch:",V)}finally{W||N(!1)}})(),()=>{W=!0}},[X]);const ne=m.useCallback(W=>{const V=new Set,ee=new Set;W.forEach(oe=>{((e==null?void 0:e.some(Ce=>F(Ce.wallet_address)))||!1)&&oe.has_builder_fee&&(oe.oids||[]).forEach(Ce=>{P.current.has(Ce)||V.add(Ce),T.current.has(Ce)||ee.add(Ce)})}),V.size>0&&(V.forEach(oe=>P.current.add(oe)),L([...V])),ee.size>0&&(ee.forEach(oe=>T.current.add(oe)),z([...ee]))},[e,F,L,z]);function J({date:W}){const[V,ee]=m.useState($o(W));return m.useEffect(()=>{const oe=setInterval(()=>{ee($o(W))},1e3);return()=>clearInterval(oe)},[W]),i.jsx("span",{className:"text-white text-sm font-bold font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:V.dateTime})}const K=W=>u(V=>new Map(V).set(W,!V.get(W))),te=(W,V)=>c.get(V)?i.jsx(J,{date:W}):cu(W),fe=m.useMemo(()=>[...new Set($.map(W=>W.coin))],[$]),q=m.useMemo(()=>$.map(W=>({...W,uid:W.trade_id||W.oid||`${W.open_time}_${W.close_time}`,liqStatus:W.isLiquidated?"Liquidated":"Not Liquidated"})).sort((W,V)=>(V.close_time||0)-(W.close_time||0)),[$]),se=async W=>{var we;const V=localStorage.getItem("hyperAddress"),ee=localStorage.getItem("hyperToken"),oe=W.oids??[];let de=W.leverage??W.positionDistribution??0;if(V&&ee&&oe.length>0)try{de=((we=(await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:V,token:ee,position_oids:oe},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:we.leverage)??de}catch(xe){console.error("Leverage fetch failed:",xe)}const Ce=Iln(W.entry_price_wma,W.total_size,de,W.total_pnl),me=xe=>Math.abs(xe)<1?xe.toFixed(4):xe.toFixed(2);l({coin:W.coin,type:W.position_side,leverage:de,roe:me(Ce),entryPrice:W.entry_price_wma,markPrice:W.close_px,positionDistribution:W.total_size,pnl:W.total_pnl-W.total_fee,closePx:W.close_px,referral:M??"--"}),a(!0)},ae=m.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,filterType:"text",render:(W,V)=>i.jsxs("a",{href:`/terminal/${V.coin}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-white hover:text-gray-400",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${V.coin}.svg`,alt:V.coin,className:"w-5 h-5 mr-2",loading:"lazy",onError:oa}),V.coin]})},{key:"source_tag",label:"Source Tag",sortable:!0,filterType:"text",render:(W,V)=>{const ee=x.get(V.oids&&String(V.oids[0]));return ee?i.jsx("a",{href:`/wallet-details/${ee.copy_trader_wallet}`,className:"text-white hover:text-white",children:ee.source_tag||"--"}):"--"}},{key:"position_side",label:"Direction",sortable:!0,filterType:"text",render:(W,V)=>{const oe={Sell:"Sell",Buy:"Buy","Close Short":"Short","Close Long":"Long","Open Short":"Short","Open Long":"Long"}[W]??W??"--",de=["buy","long"].includes(oe.toLowerCase()),Ce=["sell","short"].includes(oe.toLowerCase()),me=(()=>{if(!(((e==null?void 0:e.some(be=>F(be.wallet_address)))||!1)&&V.has_builder_fee))return"";const xe=d.get(V.oids&&String(V.oids[0]));return xe?` - ${xe}x`:""})();return i.jsxs("div",{className:`h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5 ${de?"text-[#67ffbd] bg-[#67ffbd]/20":Ce?"text-[#ff787b] bg-[#ff797c]/20":"text-white"}`,children:[i.jsx(Os,{className:`w-3 h-3 ${de?"fill-[#67ffbd] rotate-180":Ce?"fill-[#ff787b]":""}`}),i.jsxs("span",{className:"text-[11px] font-semibold uppercase",children:[oe,me," "]})]})}},{key:"total_size",label:"Size",sortable:!0,filterType:"numberRange",render:EF},{key:"entry_price_wma",label:"Entry Price",sortable:!0,filterType:"numberRange",render:EF},{key:"close_px",label:"Close Price",sortable:!0,filterType:"numberRange",render:EF},{key:"total_pnl",label:"PnL",sortable:!0,filterType:"numberRange",sortValue:W=>W.total_pnl-W.total_fee,render:(W,V)=>{const ee=(e==null?void 0:e.some(oe=>F(oe.wallet_address)))||!1;return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:V.total_pnl-V.total_fee>0?"text-[#4ae3b5]":V.total_pnl-V.total_fee<0?"text-[#ff6b6b]":"text-white",children:["$",EF(Math.abs(V.total_pnl-V.total_fee))]}),ee&&V.has_builder_fee&&i.jsx("img",{src:Am,alt:"share",className:"w-4 h-4 cursor-pointer",onClick:oe=>{oe.stopPropagation(),se(V)}})]})}},{key:"total_fee",label:"Fee (USDC)",sortable:!0,filterType:"numberRange",width:"240px",render:(W,V)=>i.jsxs("span",{children:[_r(parseFloat(V.total_fee))," ",V.builder_fee?i.jsxs("span",{className:"text-xs",children:["(",_r(parseFloat(V.builder_fee))," builder fee)"]}):""]})},{key:"duration_hours",label:"Duration",sortable:!0,filterType:"numberRange",render:Pln},{key:"open_time",label:"Opened",sortable:!0,filterType:"dateRange",render:(W,V)=>i.jsx("div",{onClick:()=>K(V.uid),className:"cursor-pointer",children:te(V.open_time,V.uid)}),width:"200px"},{key:"close_time",label:"Closed",sortable:!0,filterType:"dateRange",render:(W,V)=>i.jsx("div",{onClick:()=>K(V.uid),className:"cursor-pointer",children:te(V.close_time,V.uid)}),width:"200px"}],[fe,c,d,x,e,F]);return i.jsxs(i.Fragment,{children:[C?i.jsx("div",{className:"py-4 text-center text-white font-bold",children:"Loading…"}):$.length===0?i.jsx("div",{className:"py-4 text-center text-white font-bold",children:"No completed trades"}):i.jsx(zu,{data:q,columns:ae,tableClassName:"min-w-full border-separate border-spacing-y-1",theadClassName:"sticky top-0 bg-[#161616]",rowClassName:"bg-[#1b1b1b] hover:bg-[#222222] text-white",rowKey:W=>W.uid,onVisibleRows:ne}),s&&i.jsx(eP,{open:s,setOpen:a,data:o,setShare:()=>{},setTradeInfo:()=>{},pnlTitle:"REALIZED PNL"})]})}const Oln=({data:t,setData:e,wallet:n,coinNameData:r})=>{var W;const[s,a]=m.useState(!1),[o,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(""),[x,g]=m.useState(""),y=m.useRef(null),v=m.useRef(null),N=localStorage.getItem("isDateTwapFillsFormat")||"date",[P,T]=m.useState(N);m.useEffect(()=>{localStorage.setItem("isDateTwapFillsFormat",P)},[P]);const M="-time",[F,$]=m.useState(M),L=V=>{const ee=r.find(oe=>oe.label===V);return ee?ee.value.toUpperCase():V==null?void 0:V.toUpperCase()},z=t==null?void 0:t.filter(V=>d?L(V.coin).includes(d.toUpperCase()):!0).filter(V=>{var ee,oe;return x?(oe=(ee=V==null?void 0:V.oid)==null?void 0:ee.toString())==null?void 0:oe.includes(x):!0}),X=V=>z==null?void 0:z.sort((ee,oe)=>{const de=ee.coin?ee.coin.toUpperCase():"",Ce=oe.coin?oe.coin.toUpperCase():"",me=je=>parseFloat(je.closedPnl||0)-parseFloat(je.fee||0),we=(je="")=>{const Ie=je.toLowerCase(),Re=Ie.includes("long")||Ie==="buy",Qe=Ie.includes("short")||Ie==="sell";return Re&&!Qe?3:Re&&Qe?2:Qe&&!Re?1:0},xe=parseFloat(ee.sz)*parseFloat(ee.px),be=parseFloat(oe.sz)*parseFloat(oe.px);return V==="-price"?oe.px-ee.px:V==="price"?ee.px-oe.px:V==="-size"?oe.sz-ee.sz:V==="size"?ee.sz-oe.sz:V==="-fee"?oe.fee-ee.fee:V==="fee"?ee.fee-oe.fee:V==="-closedPnl"?me(oe)-me(ee):V==="closedPnl"?me(ee)-me(oe):V==="-oid"?oe.oid-ee.oid:V==="oid"?ee.oid-oe.oid:V==="-coin"?de<Ce?-1:de>Ce?1:0:V==="coin"?de>Ce?-1:de<Ce?1:0:V==="-time"?new Date(oe.time)-new Date(ee.time):V==="time"?new Date(ee.time)-new Date(oe.time):V==="-dir"?we(oe.dir)-we(ee.dir):V==="dir"?we(ee.dir)-we(oe.dir):V==="-tradeValue"?be-xe:V==="tradeValue"?xe-be:0});m.useEffect(()=>{(async()=>{try{a(!0);const ee=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"userTwapSliceFills",user:n}),de=((ee==null?void 0:ee.data)||[]).map(Ce=>({...Ce.fill,twapId:Ce.twapId||null}));e(de==null?void 0:de.sort((Ce,me)=>me.time-Ce.time))}catch(ee){console.error("Error fetching twap data:",ee)}finally{a(!1)}})()},[n]),m.useEffect(()=>{function V(ee){y.current&&!y.current.contains(ee.target)&&l(!1),v.current&&!v.current.contains(ee.target)&&u(!1)}return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[]);const ne=m.useRef(null),J=()=>{ne.current&&(ne.current.scrollLeft-=200)},K=()=>{ne.current&&(ne.current.scrollLeft+=200)},te=()=>{ne.current&&(ne.current.scrollTop+=200)},fe=()=>{ne.current&&(ne.current.scrollTop-=200)},q=V=>V>=640&&V<1024?5:V>=1024&&V<1240?8:V>=1240&&V<1540||V>=1540?9:4;function se({date:V}){const[ee,oe]=m.useState($o(V));return m.useEffect(()=>{const de=setInterval(()=>{oe($o(V))},1e3);return()=>clearInterval(de)},[V]),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:ee.dateTime})}const ae={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 justify-start items-center gap-2 hidden lg:flex",children:[i.jsx("button",{onClick:J,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:K,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:fe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:te,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:ne,className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] rounded-lg pb-24",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-3",children:[i.jsx(oSe,{className:"bg-[#161616] h-10 pl-2 sm:pl-6 min-w-[180px] sm:min-w-[220px] z-[8]",title:"Time",sortKey:"time",sortOption:F,setSortOption:$}),i.jsx("th",{scope:"col",className:"pl-4 min-w-[120px] max-w-[120px] sm:min-w-[150px] sm:max-w-[150px] px-1",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 relative",children:[i.jsx(mi,{title:"Coin",sortKey:"coin",sortOption:F,setSortOption:$,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>l(!o),className:`${d?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${d?"text-blue-500":"text-white"}`})}),o&&i.jsxs("div",{ref:y,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>f(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:d,onChange:V=>f(V.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),i.jsx(oSe,{className:"pl-4 min-w-[120px] max-w-[120px] sm:min-w-[130px] sm:max-w-[130px] px-1",title:"Direction",sortKey:"dir",sortOption:F,setSortOption:$}),i.jsx(S7,{className:"min-w-[70px] max-w-[70px] sm:min-w-[100px] sm:max-w-[100px] px-1",title:"Price",sortKey:"price",sortOption:F,setSortOption:$}),i.jsx(S7,{className:"min-w-[90px] max-w-[90px] sm:min-w-[130px] sm:max-w-[130px] px-1",title:"Size",sortKey:"size",sortOption:F,setSortOption:$}),i.jsx(S7,{className:"min-w-[130px] max-w-[130px] sm:min-w-[150px] sm:max-w-[150px] px-1",title:"Trade Value",sortKey:"tradeValue",sortOption:F,setSortOption:$}),i.jsx(S7,{className:"min-w-[90px] max-w-[90px] sm:min-w-[120px] sm:max-w-[120px] px-1",title:"Fee",sortKey:"fee",sortOption:F,setSortOption:$}),i.jsx(S7,{className:"min-w-[120px] max-w-[120px] sm:min-w-[150px] sm:max-w-[150px] px-1",title:"Closed PnL",sortKey:"closedPnl",sortOption:F,setSortOption:$}),i.jsx("th",{scope:"col",className:"min-w-[160px] max-w-[160px] sm:min-w-[200px] sm:max-w-[200px] pl-1 pr-8",children:i.jsxs("div",{className:"flex justify-end items-center gap-2",children:[i.jsx(mi,{title:"Order ID",sortKey:"oid",sortOption:F,setSortOption:$,isFilterIcon:!0}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>u(!c),className:`${x?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${x?"text-blue-500":"text-white"}`})}),c&&i.jsxs("div",{ref:v,className:`absolute right-[30px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>g(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"number",value:x,onChange:V=>g(V.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Order ID"})]})]})]})})]})}),i.jsx("tbody",{children:s||X(F).length==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:q(window.innerWidth),className:"h-[36vh]",children:i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:s?i.jsx($a,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No TWAP fills available at the moment."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"Your TWAP orders will appear here once they start executing."})})]})]})})})})}):(W=X(F))==null?void 0:W.map((V,ee)=>{var oe,de,Ce,me,we,xe;return i.jsxs(Ne.Fragment,{children:[i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",style:{margin:"2px"},children:[i.jsx("td",{scope:"row",onClick:()=>{T(P=="time"?"date":"time")},className:"bg-[#1b1b1b] group-hover:bg-[#222222] sm:rounded-l-2xl cursor-pointer",children:i.jsx("div",{className:"pl-2 sm:pl-5 flex flex-col items-start gap-2 font-manrope min-w-max text-white text-sm font-normal leading-[13px] tracking-[0.18px]",children:P=="time"?i.jsx(se,{date:V.time}):cu(V.time)})}),i.jsx("td",{className:"text-left cursor-pointer",children:i.jsx("div",{onClick:()=>{var be;window.open(`/terminal/${((be=r==null?void 0:r.find(je=>je.label===V.coin))==null?void 0:be.value)||V.coin}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-4 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${((oe=r==null?void 0:r.find(be=>be.label===V.coin))==null?void 0:oe.value)||ae[V.coin]||((de=V.coin)==null?void 0:de.split("/")[0])}.svg`||qa,alt:V==null?void 0:V.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:be=>oa(be)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const be=r.find(je=>je.label===V.coin);return be?be.value:V.coin})()})]})})}),i.jsx("td",{scope:"row",className:"z-[2] pl-3 bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsx("div",{className:"text-white h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex",children:i.jsx("div",{className:`text-left ${V!=null&&V.liquidation?"text-white":(Ce=V.dir)!=null&&Ce.includes("Short")||(me=V.dir)!=null&&me.includes("Sell")?"text-[#ff6b6b]":(we=V.dir)!=null&&we.includes("Long")||(xe=V.dir)!=null&&xe.includes("Buy")?"text-[#4ae3b5]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:V!=null&&V.liquidation?"Liquidation":V.dir?V.dir:"--"})})})}),i.jsx("td",{scope:"row",className:"z-[2] pl-4 bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-end items-center gap-2 h-8 max-h-8",children:i.jsx("div",{className:"text-white h-5 pl-1 pr-1.5 py-1 rounded-md justify-end items-center gap-0.5 inline-flex",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:V.px!=null&&!isNaN(parseFloat(V.px))?`$${parseFloat(V.px).toFixed(2)}`:"--"})})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:V.sz!=null&&!isNaN(parseFloat(V.sz))?_r(parseFloat(V.sz)):"--"})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:V.px!=null&&V.sz!=null&&!isNaN(parseFloat(V.px))&&!isNaN(parseFloat(V.sz))?i.jsxs(i.Fragment,{children:["$",_r(parseFloat(V.px)*parseFloat(V.sz))]}):"--"})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:V.fee!=null&&!isNaN(parseFloat(V.fee))?_r(parseFloat(V.fee)):"--"})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:`text-left ${parseFloat(V.closedPnl)-parseFloat(V.fee)>0?"text-[#4ae3b5]":parseFloat(V.closedPnl)-parseFloat(V.fee)<0?"text-[#ff6b6b]":"text-white"} text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]`,children:V.closedPnl!=null&&V.fee!=null&&!isNaN(parseFloat(V.closedPnl))&&!isNaN(parseFloat(V.fee))?i.jsxs(i.Fragment,{children:["$",_r(Math.abs(parseFloat(V.closedPnl)-parseFloat(V.fee)))]}):"--"})})}),i.jsx("td",{className:"sm:rounded-r-2xl mr-3",children:i.jsx("div",{className:"pl-1 pr-8 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-left text-[#979797] text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]",children:V!=null&&V.oid?V==null?void 0:V.oid:"--"})})})]},ee),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},ee)})})]})})]})},S7=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),oSe=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})}),_C="https://api-ui.hyperliquid.xyz/info",Mln="wss://api.hyperliquid.xyz/ws",IVe=({initialAddress:t="",wallets:e})=>{var _s,br,zt;m.useState(t);const[n,r]=m.useState([]),[s,a]=m.useState([]),o=m.useRef({}),[l,c]=m.useState(!1),[u,d]=m.useState(!0),[f,x]=m.useState(1),[g,y]=m.useState(null),[v,C]=m.useState(!1),[N,P]=m.useState("positions"),T=m.useRef(null),M=jo(),F=m.useRef(t),$=m.useRef(null),L=m.useRef(null),[z,X]=m.useState({});m.useState(!1),m.useState("");const[ne,J]=m.useState(null),{getTrackedWatchList:K,hyperToken:te,copyTradeWatchList:fe,getCopyTradeWatchList:q,setTelegramChatId:se,setSubscriberRole:ae,setSubsExpireDay:W,setMushboomerETH:V,setMushboomerSOL:ee,setIsReferralCode:oe,isReferralCodeName:de,setIsReferralCodeName:Ce,setIsWhitelist:me,setHyperToken:we,setHyperAddress:xe,setSignModalOpen:be,latestPnL:je}=m.useContext(Qr),{isConnected:Ie,address:Re}=ns();m.useState(!1),m.useState(!1),m.useState(null),m.useState("");const[Qe,Ke]=m.useState(!1);m.useState(!1);const[dt,tt]=m.useState({}),[nt,Le]=m.useState(!1),[Be,ht]=m.useState([]),[pt,Gt]=m.useState(null);pt||je.activeRange;const wt=Kl(),nn=wt.pathname.includes("/wallet-management");m.useEffect(()=>{Gt(null)},[je.activeRange]);const cn=[{label:"@10",value:"GMEOW"},{label:"@112",value:"MEOW"},{label:"@115",value:"HOLD"},{label:"@117",value:"BERA"},{label:"@12",value:"XULIAN"},{label:"@123",value:"FARM"},{label:"@131",value:"ORA"},{label:"@132",value:"LIQD"},{label:"@134",value:"STAR"},{label:"@135",value:"SENT"},{label:"@136",value:"SOLV"},{label:"@16",value:"CZ"},{label:"@18",value:"ANSEM"},{label:"@21",value:"KOBE"},{label:"@22",value:"HAPPY"},{label:"@25",value:"BIGBEN"},{label:"@3",value:"MANLET"},{label:"@30",value:"FARMED"},{label:"@31",value:"GPT"},{label:"@32",value:"PURRPS"},{label:"@33",value:"BID"},{label:"@34",value:"HODL"},{label:"@1",value:"HFUN"},{label:"@100",value:"UP"},{label:"@101",value:"NIGGO"},{label:"@102",value:"HOP"},{label:"@103",value:"LUCKY"},{label:"@104",value:"COPE"},{label:"@105",value:"HPYH"},{label:"@106",value:"YAP"},{label:"@107",value:"HYPE"},{label:"@108",value:"CHEF"},{label:"@109",value:"WOW"},{label:"@11",value:"PEPE"},{label:"@110",value:"STEEL"},{label:"@111",value:"RETARD"},{label:"@113",value:"NEIRO"},{label:"@114",value:"PEAR"},{label:"@116",value:"MUNCH"},{label:"@118",value:"GENESY"},{label:"@119",value:"BUBZ"},{label:"@120",value:"PICKL"},{label:"@121",value:"SHEEP"},{label:"@122",value:"LAUNCH"},{label:"@124",value:"FLASK"},{label:"@125",value:"VAULT"},{label:"@126",value:"CAT"},{label:"@127",value:"HYENA"},{label:"@128",value:"DEPIN"},{label:"@129",value:"MON"},{label:"@13",value:"RUG"},{label:"@130",value:"BEATS"},{label:"@133",value:"H"},{label:"@137",value:"FLY"},{label:"@138",value:"TIME"},{label:"@139",value:"SOVRN"},{label:"@14",value:"ILIENS"},{label:"@15",value:"FUCKY"},{label:"@17",value:"BAGS"},{label:"@19",value:"TATE"},{label:"@2",value:"LICK"},{label:"@20",value:"PUMP"},{label:"@23",value:"SCHIZO"},{label:"@24",value:"SELL"},{label:"@26",value:"CATNIP"},{label:"@27",value:"HBOOST"},{label:"@28",value:"SUCKY"},{label:"@29",value:"GUP"},{label:"@35",value:"VEGAS"},{label:"@37",value:"VAPOR"},{label:"@38",value:"PANDA"},{label:"@39",value:"PILL"},{label:"@40",value:"ADHD"},{label:"@41",value:"FUN"},{label:"@42",value:"LADY"},{label:"@46",value:"DROP"},{label:"@47",value:"MBAPPE"},{label:"@48",value:"TEST"},{label:"@49",value:"RAGE"},{label:"@5",value:"SIX"},{label:"@50",value:"FRAC"},{label:"@51",value:"ATEHUN"},{label:"@52",value:"COZY"},{label:"@53",value:"ARI"},{label:"@54",value:"WASH"},{label:"@55",value:"ANT"},{label:"@59",value:"CATBAL"},{label:"@60",value:"TJIF"},{label:"@61",value:"GUESS"},{label:"@62",value:"MAXI"},{label:"@63",value:"NMTD"},{label:"@66",value:"RISE"},{label:"@67",value:"CINDY"},{label:"@70",value:"FRIED"},{label:"@73",value:"RANK"},{label:"@74",value:"OMNIX"},{label:"@75",value:"RIP"},{label:"@76",value:"G"},{label:"@77",value:"BOZO"},{label:"@78",value:"SPH"},{label:"@82",value:"BUSSY"},{label:"@83",value:"FATCAT"},{label:"@84",value:"SHREK"},{label:"@85",value:"PIP"},{label:"@86",value:"LQNA"},{label:"@87",value:"NASDAQ"},{label:"@88",value:"YEETI"},{label:"@9",value:"TRUMP"},{label:"@90",value:"FEIT"},{label:"@92",value:"VIZN"},{label:"@93",value:"STRICT"},{label:"@94",value:"AUTIST"},{label:"@96",value:"HGOD"},{label:"@97",value:"LIQUID"},{label:"@36",value:"ASI"},{label:"@4",value:"JEFF"},{label:"@43",value:"MOG"},{label:"@44",value:"HPEPE"},{label:"@45",value:"JEET"},{label:"@57",value:"RICH"},{label:"@58",value:"LORA"},{label:"@6",value:"WAGMI"},{label:"@65",value:"PIGEON"},{label:"@64",value:"HPUMP"},{label:"@69",value:"STACK"},{label:"@7",value:"CAPPY"},{label:"@72",value:"NOCEX"},{label:"@79",value:"SHOE"},{label:"@80",value:"MONAD"},{label:"@81",value:"HOPE"},{label:"@89",value:"SYLVI"},{label:"@91",value:"FRUDO"},{label:"@95",value:"MAGA"},{label:"@99",value:"EARTH"},{label:"@56",value:"NFT"},{label:"@8",value:"POINTS"},{label:"@68",value:"CHINA"},{label:"@141",value:"GOD"}];function Un(he,it){const Ct=it.map(({fill:vt,twapId:ln})=>({...vt,twapId:ln}));return[...he,...Ct]}const Xt=(he,it)=>{const Ct=Rt(it,he);o.current={...o.current,[he]:Ct},a(Object.values(o.current).flat()),d(!1)};m.useEffect(()=>{t&&(async()=>{const he=await dde(t),it=await fde(t),Ct=Un(he,it),{closed_positions:vt}=hde(Ct);J(vt)})()},[t]);const an=(e??[]).map(he=>{var it;return(it=he.wallet_address)==null?void 0:it.toLowerCase()}).filter(Boolean),Jt=m.useMemo(()=>[...new Set(an)].sort().join("|"),[an.join("|")]);m.useEffect(()=>{if(!e||e.length===0)return;const he=e.map(Ct=>Ct.wallet_address.toLowerCase());if(he.length===0)return;let it=!0;return c(!0),d(!0),(async()=>{try{const Ct=await Promise.all(he.map(async Er=>{const[pr,fr]=await Promise.all([ps.post(_C,{aggregateByTime:!0,type:"userFills",user:Er}),ps.post(_C,{type:"clearinghouseState",user:Er})]);return{addr:Er,fills:pr.data??[],state:fr.data}}));if(!it)return;const vt=Ct.flatMap(Er=>Er.fills),ln=It(vt);r(ln);const xn=Ct.flatMap(Er=>{var pr;return(pr=Er.state)!=null&&pr.assetPositions?Er.state.assetPositions.map(fr=>({...fr,_wallet:Er.addr})):[]}),dr=Rt({assetPositions:xn});a(dr),Ye(he)}catch(Ct){console.error("Multi-wallet fetch error:",Ct)}finally{it&&c(!1)}})(),()=>{it=!1}},[Jt]),m.useEffect(()=>(t&&(F.current=t,Je(t)),()=>{T.current&&(T.current.close(),T.current=null),$.current&&(clearTimeout($.current),$.current=null),L.current&&(clearInterval(L.current),L.current=null)}),[t]),m.useEffect(()=>{const he=async()=>{var it;document.visibilityState==="visible"&&(((it=T.current)==null?void 0:it.readyState)!==WebSocket.OPEN&&Ye(F.current.split("|")),F.current.split("|").forEach(Ct=>{ps.post(_C,{type:"clearinghouseState",user:Ct}).then(vt=>Xt(Ct,vt.data))}))};return document.addEventListener("visibilitychange",he),()=>document.removeEventListener("visibilitychange",he)},[]),m.useEffect(()=>{const he=localStorage.getItem("favoriteAddresses");he&&X(JSON.parse(he))},[]);const Ye=he=>{var Ct;const it=Array.isArray(he)?he:[he];o.current={},a([]),!(((Ct=T.current)==null?void 0:Ct.readyState)===WebSocket.OPEN&&F.current===Re)&&(L.current&&(clearInterval(L.current),L.current=null),$.current&&(clearTimeout($.current),$.current=null),T.current&&(T.current.close(),T.current=null),F.current=it.join("|"),T.current=new WebSocket(Mln),T.current.onopen=()=>{console.log("WebSocket Connected"),C(!0);const vt=[];it.forEach(ln=>{vt.push({method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:ln}},{method:"subscribe",subscription:{type:"user",user:ln}},{method:"subscribe",subscription:{type:"webData2",user:ln}},{method:"subscribe",subscription:{type:"userTwapSliceFills",user:ln}})}),vt.forEach(ln=>{T.current.send(JSON.stringify(ln))}),L.current=setInterval(()=>{var ln;if(((ln=T.current)==null?void 0:ln.readyState)===WebSocket.OPEN){const xn={id:99,method:"ping"};T.current.send(JSON.stringify(xn))}},3e4)},T.current.onclose=vt=>{C(!1),L.current&&(clearInterval(L.current),L.current=null),vt.code!==1e3&&($.current||($.current=setTimeout(()=>{$.current=null,F.current===Re&&Ye([Re])},5e3)))},T.current.onerror=vt=>{console.error("WebSocket Error:",vt),C(!1)},T.current.onmessage=vt=>{var ln,xn,dr,Er;try{const pr=JSON.parse(vt.data);if(pr.method==="pong"||pr.result==="success")return;if(pr.channel==="userFills"&&((ln=pr.data)!=null&&ln.fills)&&F.current.toLowerCase()===pr.data.user.toLowerCase()&&r(fr=>{const Yr=fr.flatMap(Jn=>Jn.fills),is=new Map;Yr.forEach(Jn=>{is.set(Jn.hash,!0)});const Ir=pr.data.fills.filter(Jn=>!is.has(Jn.hash));if(Ir.length===0)return fr;const yr=[...Ir,...Yr];return It(yr)}),pr.channel==="webData2"&&((xn=pr.data)!=null&&xn.clearinghouseState)&&(y(pr.data.clearinghouseState),Xt(pr.data.user.toLowerCase(),pr.data.clearinghouseState)),pr.channel==="user"&&((dr=pr.data)!=null&&dr.fills&&r(fr=>{const Yr=fr.flatMap(Jn=>Jn.fills),is=new Map;Yr.forEach(Jn=>{is.set(Jn.hash,!0)});const Ir=pr.data.fills.filter(Jn=>!is.has(Jn.hash));if(Ir.length===0)return fr;const yr=[...Ir,...Yr];return It(yr)}),(Er=pr.data)!=null&&Er.state)){y(pr.data.state);const fr=Rt(pr.data.state);a(fr)}if(pr.channel==="userTwapSliceFills"){const fr=pr==null?void 0:pr.data;if(!Be||Be.length===0||!fr||fr.length===0)return;const Yr=fr==null?void 0:fr.map(Ir=>({...Ir.fill,twapId:Ir.twapId||null})),is=[...Be];Yr.forEach(Ir=>{const yr=is==null?void 0:is.findIndex(Jn=>Jn.oid===Ir.oid);yr!==-1?is[yr]={...is[yr],...Ir}:is.unshift(Ir)}),ht(is)}}catch(pr){console.error("Error processing WebSocket message:",pr),console.error("Raw message that caused error:",vt.data)}})},Je=async he=>{const[it,Ct]=await Promise.all([ps.post(_C,{aggregateByTime:!0,type:"userFills",user:he}),ps.post(_C,{type:"clearinghouseState",user:he})]);if(Ct.data&&Xt(he.toLowerCase(),Ct.data),!he){tn.error("Please enter a wallet address");return}if(!he.match(/^0x[a-fA-F0-9]{40}$/)){tn.error("Please enter a valid Ethereum address");return}c(!0),d(!0);try{he!==t&&M(`/wallet-details/${he}`),Ye(he);const vt=await ps.post(_C,{aggregateByTime:!0,type:"userFills",user:he});if(vt.data&&Array.isArray(vt.data)){const ln=It(vt.data);r(ln),x(1)}else console.error("Invalid response format:",vt.data)}catch(vt){console.error("Error fetching data:",vt)}finally{c(!1)}},It=he=>{const it=[...he].sort((vt,ln)=>ln.time-vt.time),Ct=new Map;return it.forEach(vt=>{var xn;const ln=vt.oid;if(!Ct.has(ln)){const dr=it.filter(yr=>yr.oid===vt.oid),Er=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.sz),0),pr=dr.map(yr=>parseFloat(yr.startPosition));let fr;pr.includes(0)?fr=0:pr.every(yr=>yr>0)?fr=Math.max(...pr):pr.every(yr=>yr<0)?fr=Math.min(...pr):fr=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.startPosition),0);const Yr=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.sz)*parseFloat(Jn.px),0),is=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.closedPnl||0),0),Ir=((xn=dr.find(yr=>yr.dir==="Long > Short"||yr.dir==="Short > Long"))==null?void 0:xn.dir)||"";Ct.set(ln,{oid:vt.oid,asset:vt.coin,direction:Ir==""?vt.dir:Ir,fills:dr,totalSize:Er,totalStartPositions:fr,totalValue:Yr,pnl:is,latestFill:vt.time,isLiquidation:!!vt.liquidation})}}),Array.from(Ct.values()).sort((vt,ln)=>ln.latestFill-vt.latestFill)},hn=he=>{const it=new Date(he),Ct=it.toLocaleString("en-US",{month:"short"}),vt=it.getDate(),ln=it.getFullYear(),xn=it.getHours().toString().padStart(2,"0"),dr=it.getMinutes().toString().padStart(2,"0"),Er=it.getHours()>=12?" PM":" AM";return`${Ct} ${vt}, ${ln}, ${xn}:${dr} ${Er}`},Yt=n,Rt=(he,it="")=>{if(!(he!=null&&he.assetPositions))return[];const Ct=new Map;return n.forEach(vt=>{vt.fills.forEach(ln=>{let xn="";ln.dir.includes("Open")?xn=ln.dir.includes("Long")?"Long":"Short":ln.side==="B"?xn="Long":ln.side==="S"&&(xn="Short");const dr=`${ln.coin}-${xn}`;(!Ct.has(dr)||ln.time<Ct.get(dr))&&Ct.set(dr,ln.time)})}),he.assetPositions.filter(vt=>{if(!vt.position||!vt.position.szi)return!1;const ln=parseFloat(vt.position.szi);return!isNaN(ln)&&ln!==0}).map(vt=>{const ln=vt._wallet||it||(t==null?void 0:t.toLowerCase()),xn=vt.position,dr=parseFloat(xn.szi),Er=parseFloat(xn.entryPx),pr=parseFloat(xn.positionValue),fr=parseFloat(xn.unrealizedPnl),Yr=parseFloat(xn.returnOnEquity)*100,is=parseFloat(xn.marginUsed),Ir=xn.leverage.value,yr=xn.leverage.type,Jn=parseFloat(xn.cumFunding.sinceOpen),gs=dr>0?"Long":"Short",Zs=Ct.get(`${xn.coin}-${gs}`);return{wallet:ln,asset:xn.coin,type:gs,size:dr,entryPrice:Er.toFixed(4),currentPrice:(pr/Math.abs(dr)).toFixed(4),leverage:Ir,marginMode:yr,positionValue:pr.toFixed(2),marginUsed:is.toFixed(2),unrealizedPnl:fr.toFixed(2),roe:Yr.toFixed(2),funding:Jn.toFixed(4),startTime:Zs?hn(Zs):"N/A",liquidationPrice:xn.liquidationPx?parseFloat(xn.liquidationPx).toFixed(2):"N/A"}})};m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(K(),q())},[]);const ot=m.useRef(null),De=()=>{ot.current&&(ot.current.scrollLeft-=200)},At=()=>{ot.current&&(ot.current.scrollLeft+=200)},ze=()=>{ot.current&&(ot.current.scrollTop+=200)},rt=()=>{ot.current&&(ot.current.scrollTop-=200)};m.useRef(null);const mt=m.useRef(null),Lt=()=>{mt.current&&(mt.current.scrollLeft-=200)},kt=()=>{mt.current&&(mt.current.scrollLeft+=200)},dn=()=>{mt.current&&(mt.current.scrollTop+=200)},rn=()=>{mt.current&&(mt.current.scrollTop-=200)};m.useRef(null),m.useEffect(()=>{(async()=>{var vt,ln;const it=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!(!it||!Ct))try{const xn=await ki(Ct.toLowerCase(),it);xn!=null&&xn.success?(se(xn==null?void 0:xn.telegram_chat_id),ae(xn==null?void 0:xn.subscriber_role),W(xn==null?void 0:xn.subs_expire_day),V((vt=xn==null?void 0:xn.mushboomer_counts)==null?void 0:vt.eth),ee((ln=xn==null?void 0:xn.mushboomer_counts)==null?void 0:ln.sol),oe(xn==null?void 0:xn.referral_code),Ce(xn==null?void 0:xn.refcode),me(xn==null?void 0:xn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),we(""),xe(""))}catch(xn){console.error("Token verification error:",xn),console.error(xn.message||"An unknown error occurred.")}})()},[]);const gn=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Liquidation"],An="-latestFill",[kn,yn]=m.useState(An),[Vn,Kn]=m.useState([]),[Dn,Xn]=m.useState(""),[Nn,on]=m.useState(""),[Oe,Zt]=m.useState(""),[sn,jt]=m.useState(!1),[Qn,bn]=m.useState(!1),[Dt,en]=m.useState(!1),[Pn,tr]=m.useState(!1),ar=m.useRef(null),hr=m.useRef(null),qt=m.useRef(null),zn=m.useRef(null),Zn=he=>{Kn(it=>it.includes(he)?it.filter(Ct=>Ct!==he):[...it,he])};m.useEffect(()=>{function he(it){ar.current&&!ar.current.contains(it.target)&&jt(!1),hr.current&&!hr.current.contains(it.target)&&bn(!1),qt.current&&!qt.current.contains(it.target)&&en(!1),zn.current&&!zn.current.contains(it.target)&&tr(!1)}return document.addEventListener("mousedown",he),()=>document.removeEventListener("mousedown",he)},[]);const Ft=Yt.map(he=>{let it=he.isLiquidation?"Liquidation":he.totalStartPositions==0?"Open Position":he.direction!="Short > Long"&&he.direction!="Long > Short"?(he==null?void 0:he.totalSize)-Math.abs(he==null?void 0:he.totalStartPositions)==0&&(he.direction=="Close Long"||he.direction=="Close Short")?"Position Closed":he.direction=="Open Short"||he.direction=="Open Long"?"Increase":he.direction=="Close Long"||he.direction=="Close Short"?"Decrease":he.direction=="Sell"||he.direction=="Buy"?"Spot":"Changed Position":he.direction=="Short > Long"||he.direction=="Long > Short"?"Changed Position":"Open Position";return{...he,computedType:it}}),En=he=>{const it=cn.find(Ct=>Ct.label===he);return it?it.value.toUpperCase():he==null?void 0:he.toUpperCase()},Ee=Ft.filter(he=>Vn.length?Vn.includes(he.computedType):!0).filter(he=>{var it,Ct;return Dn?(Ct=(it=he==null?void 0:he.oid)==null?void 0:it.toString())==null?void 0:Ct.includes(Dn):!0}).filter(he=>Nn?En(he.asset).includes(Nn.toUpperCase()):!0),h=he=>Ee==null?void 0:Ee.sort((it,Ct)=>{var is,Ir,yr,Jn;const vt=it.totalSize?it.totalValue/it.totalSize:0,ln=Ct.totalSize?Ct.totalValue/Ct.totalSize:0,xn=gs=>{const Zs=cn.find(oi=>oi.label===gs);return Zs?Zs.value.toUpperCase():gs==null?void 0:gs.toUpperCase()},dr=xn(it.asset),Er=xn(Ct.asset),pr=gs=>{if(!gs)return"";const Zs=gs.toLowerCase();return Zs.includes("short")?"Short":Zs.includes("long")?"Long":Zs==="buy"?"Buy":Zs==="sell"?"Sell":gs},fr=pr(it.direction),Yr=pr(Ct.direction);if(he==="-totalSize")return Ct.totalSize-it.totalSize;if(he==="totalSize")return it.totalSize-Ct.totalSize;if(he==="-pnl")return Ct.pnl-it.pnl;if(he==="pnl")return it.pnl-Ct.pnl;if(he==="-fills")return(((is=Ct.fills)==null?void 0:is.length)||0)-(((Ir=it.fills)==null?void 0:Ir.length)||0);if(he==="fills")return(((yr=it.fills)==null?void 0:yr.length)||0)-(((Jn=Ct.fills)==null?void 0:Jn.length)||0);if(he==="-latestFill")return new Date(Ct.latestFill)-new Date(it.latestFill);if(he==="latestFill")return new Date(it.latestFill)-new Date(Ct.latestFill);if(he==="-avgPrice")return ln-vt;if(he==="avgPrice")return vt-ln;if(he==="-oid")return Ct.oid-it.oid;if(he==="oid")return it.oid-Ct.oid;if(he==="direction"){const gs={Short:1,Sell:2,Long:3,Buy:4};return(gs[fr]||99)-(gs[Yr]||99)}else if(he==="-direction"){const gs={Long:1,Buy:2,Short:3,Sell:4};return(gs[fr]||99)-(gs[Yr]||99)}else{if(he==="-coin")return dr<Er?-1:dr>Er?1:0;if(he==="coin")return dr>Er?-1:dr<Er?1:0}return 0}),p=h(kn).filter(he=>(he.totalStartPositions==0?"Open Position":he.direction!="Short > Long"&&he.direction!="Long > Short"?(he==null?void 0:he.totalSize)-Math.abs(he==null?void 0:he.totalStartPositions)==0&&(he.direction=="Close Long"||he.direction=="Close Short")?"Position Closed":he.direction=="Open Short"||he.direction=="Open Long"?"Increase":he.direction=="Close Long"||he.direction=="Close Short"?"Decrease":he.direction=="Sell"||he.direction=="Buy"?"Spot":"Changed Position":he.direction=="Short > Long"||he.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),S={};p.forEach(he=>{var vt;const it=he==null?void 0:he.asset,Ct=new Date(he==null?void 0:he.latestFill).getTime();if(!S[it])S[it]=he;else{const ln=new Date((vt=S[it])==null?void 0:vt.latestFill).getTime();Ct>ln&&(S[it]=he)}});const _=Object.values(S),[k,I]=m.useState([]),B=s==null?void 0:s.filter(he=>{var it;return Oe?(it=he.asset)==null?void 0:it.toLowerCase().includes(Oe.toLowerCase()):!0}).map(he=>{const it=_.find(vt=>(vt==null?void 0:vt.asset)===(he==null?void 0:he.asset)),Ct=k.find(vt=>vt.coin===he.asset&&(vt.wallet||"").toLowerCase()===(he.wallet||"").toLowerCase());return{...he,latestFill:(it==null?void 0:it.latestFill)||null,tagName:(Ct==null?void 0:Ct.tag)||null,tagWallet:(Ct==null?void 0:Ct.cp_wallet)||null}}),G="-unrealizedPnl",[re,ce]=m.useState(G),ue=he=>B==null?void 0:B.sort((it,Ct)=>{const vt=it.tagName?it.tagName.toUpperCase():"",ln=Ct.tagName?Ct.tagName.toUpperCase():"",xn=it.asset?it.asset.toUpperCase():"",dr=Ct.asset?Ct.asset.toUpperCase():"",Er=it.type==="Long"?1:0,pr=Ct.type==="Long"?1:0,fr=it.type==="Short"?1:0,Yr=Ct.type==="Short"?1:0;return he==="-unrealizedPnl"?Ct.unrealizedPnl-it.unrealizedPnl:he==="unrealizedPnl"?it.unrealizedPnl-Ct.unrealizedPnl:he==="-roe"?Ct.roe-it.roe:he==="roe"?it.roe-Ct.roe:he==="-size"?Ct.size-it.size:he==="size"?it.size-Ct.size:he==="-entryPrice"?Ct.entryPrice-it.entryPrice:he==="entryPrice"?it.entryPrice-Ct.entryPrice:he==="-currentPrice"?Ct.currentPrice-it.currentPrice:he==="currentPrice"?it.currentPrice-Ct.currentPrice:he==="-leverage"?Ct.leverage-it.leverage:he==="leverage"?it.leverage-Ct.leverage:he==="-positionValue"?Ct.positionValue-it.positionValue:he==="positionValue"?it.positionValue-Ct.positionValue:he==="-marginUsed"?Ct.marginUsed-it.marginUsed:he==="marginUsed"?it.marginUsed-Ct.marginUsed:he==="funding"?Ct.funding-it.funding:he==="-funding"?it.funding-Ct.funding:he==="-liquidationPrice"?Ct.liquidationPrice-it.liquidationPrice:he==="liquidationPrice"?it.liquidationPrice-Ct.liquidationPrice:he==="-entryTime"?new Date(Ct.latestFill)-new Date(it.latestFill):he==="entryTime"?new Date(it.latestFill)-new Date(Ct.latestFill):he==="-source_tag"?vt<ln?-1:vt>ln?1:0:he==="source_tag"?vt>ln?-1:vt<ln?1:0:he==="-type_leverage"?Er!==pr?pr-Er:Ct.leverage-it.leverage:he==="type_leverage"?fr!==Yr?Yr-fr:Ct.leverage-it.leverage:he==="-asset"?xn<dr?-1:xn>dr?1:0:he==="asset"?xn>dr?-1:xn<dr?1:0:0}),[ge,Ae]=m.useState([]),[ke,Me]=m.useState(!0),[qe,Fe]=m.useState(null),[at,ie]=m.useState([]),[Se,$e]=m.useState(!0),[Ue,_e]=m.useState(null),[st,ut]=m.useState([]),[yt,Mt]=m.useState(!0),[Kt,un]=m.useState(null);async function Xe(){try{Me(!0);const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=1&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();Ae(it.results)}catch(he){console.error("Error resetting filters:",he),Fe(he.message)}finally{Me(!1)}}async function Pt(){try{$e(!0);const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=7&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();ie(it.results)}catch(he){console.error("Error resetting filters:",he),_e(he.message)}finally{$e(!1)}}async function Wt(){try{Mt(!0);const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=30&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();ut(it.results)}catch(he){console.error("Error resetting filters:",he),un(he.message)}finally{Mt(!1)}}m.useEffect(()=>{Xe(),Pt(),Wt()},[]),m.useState("7D"),m.useState("7D"),s.length,s.filter(he=>he.unrealizedPnl>=0).length;const[ct,Ge]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0});((_s=ue(re))==null?void 0:_s.reduce((he,it)=>he+((it==null?void 0:it.leverage)||0),0))/(((br=ue(re))==null?void 0:br.length)||1),(zt=ue(re))==null||zt.reduce((he,it)=>{const Ct=parseFloat(it==null?void 0:it.funding)||0;return he+Ct},0);const Yn=localStorage.getItem("isDateOpenPositionsFormat")||"date",[Fn,Gn]=m.useState(Yn);m.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",Fn)},[Fn]);const ur=localStorage.getItem("isDateFillsFormat")||"date",[kr,Bn]=m.useState(ur);m.useEffect(()=>{localStorage.setItem("isDateFillsFormat",kr)},[kr]);function Sn({date:he}){const[it,Ct]=m.useState($o(he));return m.useEffect(()=>{const vt=setInterval(()=>{Ct($o(he))},1e3);return()=>clearInterval(vt)},[he]),i.jsx("span",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:it.dateTime})}const[Mn,rr]=m.useState([]),ls=async()=>{try{const he=window.localStorage.getItem("hyperToken");if(!he){be(!0);return}const it="https://dextrabothypev2.nftinit.io/api/wallet/list",Ct=window.localStorage.getItem("hyperAddress"),ln=await(await fetch(it,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():Ct,token:he,balance:"false"})})).json();ln!=null&&ln.success?(rr(ln.data||[]),Lr(ln.data)):console.log(ln.error_message)}catch(he){console.error("Error fetching generate wallet list:",he)}};m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&ls()},[te]);const[cs,et]=m.useState([]),[gt,Tn]=m.useState(!0),[sr,Tr]=m.useState(!1);m.useEffect(()=>{B&&B.length>0&&($r(),Mn.length>0&>&&Lr())},[B]);const Lr=()=>{cs.length!==0&&(lr(cs),gt&&Tn(!1))};m.useEffect(()=>{const he=window.localStorage.getItem("hyperToken");cs.length&&he&&lr(cs)},[cs]);const $r=()=>{const he=window.localStorage.getItem("hyperToken");let it=!1;const Ct=[...cs];B.forEach(vt=>{var Er;const ln=vt.asset,xn=(Er=vt.wallet||t)==null?void 0:Er.toLowerCase();Ct.some(pr=>pr.coin===ln&&(pr.wallet||"").toLowerCase()===xn)||(Ct.push({coin:ln,wallet:xn}),it=!0)}),it&&(et(Ct),Mn.some(ln=>ln.wallet_address===(t==null?void 0:t.toLowerCase()))&&he&&lr(Ct))},lr=async he=>{if(!sr)try{Tr(!0);const it=window.localStorage.getItem("hyperToken"),Ct="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!it||!he){Tr(!1);return}it||be(!0);const vt=window.localStorage.getItem("hyperAddress"),xn=await(await fetch(Ct,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():vt,token:it,positions:he})})).json();xn.success?I(xn==null?void 0:xn.data):(console.log(xn.error_message),tn.error(xn.error_message))}catch(it){console.error("Error tag request",it),tn.error(it.message)}finally{Tr(!1)}},wr=(e==null?void 0:e.length)>1||Mn.some(he=>he.wallet_address===(t==null?void 0:t.toLowerCase())),ss=async(he,it,Ct,vt,ln)=>{if(!he||!Ct||!vt||!ln){console.error("Close order called with invalid parameters"),tn.error("Close order called with invalid parameters");return}const xn=`${vt}_${Ct}_${ln}`;try{tt(is=>({...is,[xn]:!0}));const dr=window.localStorage.getItem("hyperToken"),Er="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_new/";if(!dr){be(!0),tt(is=>({...is,[xn]:!1}));return}const pr=window.localStorage.getItem("hyperAddress"),fr=await fetch(Er,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():pr,token:dr,coin:Ct,wallet_id:he.toString(),leverage:vt,size:ln})});if(!fr.ok)throw new Error(`Server responded with status ${fr.status}`);const Yr=await fr.json();Yr.success?(tt(is=>({...is,[xn]:!1})),tn.success("Close order operation successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):Yr.status=="ok"?(tt(is=>({...is,[xn]:!1})),tn.success("Close order operation successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):(console.error("Something went wrong!"),tn.error("Something went wrong!"),tt(is=>({...is,[xn]:!1})))}catch{console.error("Something went wrong!"),tn.error("Something went wrong!"),tt(Er=>({...Er,[xn]:!1}))}},mr=async(he=[])=>{if(he.length!==0){Le(!0);try{await Promise.all(he.map(it=>es(it)))}finally{Le(!1)}}},es=async he=>{if((B==null?void 0:B.length)===0){tn.success("There are no open positions to closes.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(!he){console.error("Close order called with invalid parameters"),tn.error("Close order called with invalid parameters");return}try{Le(!0);const it=window.localStorage.getItem("hyperToken"),Ct="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!it){be(!0),Le(!1);return}const vt=window.localStorage.getItem("hyperAddress"),ln=await fetch(Ct,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Re?Re.toLowerCase():vt,token:it,wallet_id:he.toString()})});if(!ln.ok)throw new Error(`Server responded with status ${ln.status}`);const xn=await ln.json();xn.status=="ok"?(Le(!1),tn.success("Close order operation successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"400px",minWidth:"400px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):xn.success?(Le(!1),tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log("Close order operation failed."),tn.error("Close order operation failed."),Le(!1))}catch(it){throw console.error("Something went wrong!"),tn.error("Something went wrong!"),Le(!1),it}},Ys={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(eP,{open:Qe,setOpen:Ke,data:ct,setTradeInfo:Ge}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 mb-2 mx-4 mt-4 relative overflow-x-auto whitespace-nowrap scrollbar-hide [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[i.jsx("div",{className:"absolute bottom-0 left-0 w-[80%] h-[1px] bg-[#2A2A2A]"}),i.jsx("div",{onClick:()=>P("positions"),className:`${N==="positions"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsxs("div",{className:"flex items-center text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none min-w-max",children:[i.jsx("span",{className:"mr-2",children:"Open Positions"}),i.jsx("span",{className:"flex w-[22px] h-[22px] px-3 justify-center items-center gap-[2px] flex-shrink-0 rounded-md bg-[rgba(103,255,189,0.16)] text-[14px] font-semibold font-manrope",children:s.length})]})}),i.jsx("div",{onClick:()=>P("fills"),className:`${N==="fills"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:"text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Fills"})}),i.jsx("div",{onClick:()=>P("trade-history"),className:`${N==="trade-history"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Trade History"})}),i.jsx("div",{onClick:()=>P("twap-history"),className:`${N==="twap-history"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} ${wt.pathname.startsWith("/wallet-details")?"":"hidden"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Twap History"})}),i.jsx("div",{onClick:()=>P("completed-trades"),className:`${N==="completed-trades"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Completed Trades"})}),i.jsx("div",{onClick:()=>P("deposit-withdraw"),className:`${N==="deposit-withdraw"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsx("div",{className:" text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Deposits & Withdrawals"})}),!nn&&i.jsxs("div",{onClick:()=>window.open(`https://hypurrscan.io/address/${t}`,"_blank"),className:"h-6 px-2 py-3 justify-center items-center gap-2.5 inline-flex cursor-pointer",children:[i.jsx("img",{src:Slt,className:"w-[19px] h-[18px]"}),i.jsx("div",{className:"text-[#C1C1C1] text-[13px] font-semibold font-manrope leading-[8px] hover:text-[#67FFBD]",children:"HypurrScan"})]})]}),N==="fills"?i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 justify-start items-center gap-2 hidden lg:flex",children:[i.jsx("button",{onClick:Lt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:kt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:rn,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:dn,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:mt,className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] rounded-lg pb-24",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky bg-[#161616] left-0 h-10 pl-2 sm:pl-6 min-w-[130px] max-w-[130px] sm:min-w-[150px] sm:max-w-[150px] z-[8]",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 relative",children:[i.jsx(mi,{title:"Coin",sortKey:"coin",sortOption:kn,setSortOption:yn,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>en(!Dt),className:`${Nn?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${Nn?"text-blue-500":"text-white"}`})}),Dt&&i.jsxs("div",{ref:qt,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>on(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:Nn,onChange:he=>on(he.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),i.jsx(ZX,{className:"pl-4 min-w-[120px] max-w-[120px] sm:min-w-[144px] sm:max-w-[144px] px-1",title:"Direction",sortKey:"direction",sortOption:kn,setSortOption:yn}),i.jsx("th",{scope:"col",className:"pl-4 min-w-[150px] max-w-[150px] px-1 relative",children:i.jsxs("div",{className:"flex items-center justify-start w-full gap-1 min-w-max max-w-max",children:[i.jsx("div",{className:"flex items-center justify-start group",children:"Type"}),i.jsx("button",{onClick:()=>jt(!sn),className:`${Vn.length>0?"bg-gray-900":"bg-[#555555]"} ml-2 inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${Vn.length>0?"text-blue-500":"text-white"}`})}),sn&&i.jsxs("div",{ref:ar,className:"absolute left-[60px] mt-60 w-48 bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10",children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>Kn([]),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),gn.map(he=>i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-6 relative rounded hover:bg-[#464646] cursor-pointer text-white text-[13px] font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",checked:Vn.includes(he),onChange:()=>Zn(he),className:"mr-2 bg-[#3b3b3b] hidden "}),i.jsx("div",{className:`w-4 h-4 max-w-4 max-h-4 flex items-center justify-center border ${Vn.includes(he)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Vn.includes(he)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),he]},he))]})]})}),i.jsx(Hd,{className:"min-w-[80px] max-w-[80px] px-1",title:"Size",sortKey:"totalSize",sortOption:kn,setSortOption:yn}),i.jsx(Hd,{className:"min-w-[110px] max-w-[110px] sm:min-w-[130px] sm:max-w-[130px] px-1",title:"Avg. Price",sortKey:"avgPrice",sortOption:kn,setSortOption:yn}),i.jsx(Hd,{className:"min-w-[100px] max-w-[100px] sm:min-w-[120px] sm:max-w-[120px] px-1",title:"PnL",sortKey:"pnl",sortOption:kn,setSortOption:yn}),i.jsx(Hd,{className:"min-w-[100px] max-w-[100px] sm:min-w-[120px] sm:max-w-[120px] px-1",title:"Fill Count",sortKey:"fills",sortOption:kn,setSortOption:yn}),i.jsx(Hd,{className:"min-w-[200px] max-w-[200px] px-1",title:"Latest Fill",sortKey:"latestFill",sortOption:kn,setSortOption:yn}),i.jsx("th",{scope:"col",className:"min-w-[160px] max-w-[160px] pl-1 pr-8 relative",children:i.jsxs("div",{className:"flex justify-end items-center gap-2",children:[i.jsx(mi,{title:"Order ID",sortKey:"oid",sortOption:kn,setSortOption:yn,isFilterIcon:!0}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>bn(!Qn),className:`${Dn?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${Dn?"text-blue-500":"text-white"}`})}),Qn&&i.jsxs("div",{ref:hr,className:`absolute right-[30px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>Xn(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"number",value:Dn,onChange:he=>Xn(he.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Order ID"})]})]})]})})]})}),i.jsx("tbody",{children:h(kn).length==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:window.innerWidth>=640&&window.innerWidth<768?5:window.innerWidth>=768&&window.innerWidth<1024?6:window.innerWidth>=1024&&window.innerWidth<1240?8:window.innerWidth>=1240&&window.innerWidth<1540?10:window.innerWidth>=1540?12:4,className:"h-[36vh]",children:i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No fills are currently available"}),i.jsx("div",{className:"text-center -mt-2",children:i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"To view completed trades, please check your order history"})})]})]})})})})}):h(kn).map((he,it)=>{var vt,ln,xn,dr,Er,pr;const Ct=he.totalValue/he.totalSize;return(vt=he==null?void 0:he.direction)==null||vt.includes("Long"),i.jsxs(Ne.Fragment,{children:[i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",style:{margin:"2px"},children:[i.jsx("td",{scope:"row",className:"sticky left-0 z-[2] bg-[#1b1b1b] group-hover:bg-[#222222] sm:rounded-l-2xl",children:i.jsx("div",{onClick:()=>{var fr;window.open(`/terminal/${((fr=cn.find(Yr=>Yr.label===he.asset))==null?void 0:fr.value)||he.asset}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 sm:pl-6 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${((ln=cn.find(fr=>fr.label===he.asset))==null?void 0:ln.value)||Ys[he.asset]||((xn=he.asset)==null?void 0:xn.split("/")[0])}.svg`||qa,alt:he==null?void 0:he.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:fr=>oa(fr)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:(()=>{const fr=cn.find(Yr=>Yr.label===he.asset);return fr?fr.value:he.asset})()})]})})}),i.jsx("td",{scope:"row",className:"z-[2] pl-4 bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${(dr=he.direction)!=null&&dr.includes("Long")?he.direction==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":he.direction==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":he.direction=="Buy"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:(Er=he.direction)!=null&&Er.includes("Long")?he.direction==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):he.direction==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):he.direction=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:he.direction=="Sell"?"Sell":he.direction=="Buy"?"Buy":he.direction=="Close Short"?"Short":he.direction=="Close Long"?"Long":he.direction=="Open Short"?"Short":he.direction=="Open Long"?"Long":he.direction})]})})}),i.jsx("td",{scope:"row",className:"z-[2] pl-4 bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsx("div",{className:"text-white h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex",children:i.jsx("div",{className:`${he!=null&&he.isLiquidation?"text-[#ff787b]":"text-white"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] min-w-max`,children:he!=null&&he.isLiquidation?`Market Liquidation: ${he.direction=="Sell"?"Sell":he.direction=="Buy"?"Buy":he.direction=="Close Short"?"Close Short":he.direction=="Close Long"?"Close Long":he.direction=="Open Short"?"Close Short":he.direction=="Open Long"?"Close Long":"Close "+he.direction} `:he.totalStartPositions==0?"Open Position":he.direction!="Short > Long"&&he.direction!="Long > Short"?(he==null?void 0:he.totalSize)-Math.abs(he==null?void 0:he.totalStartPositions)==0&&(he.direction=="Close Long"||he.direction=="Close Short")?"Position Closed":he.direction=="Open Short"||he.direction=="Open Long"?"Increase":he.direction=="Close Long"||he.direction=="Close Short"?"Decrease":he.direction=="Sell"||he.direction=="Buy"?"Spot":"Changed Position":he.direction=="Short > Long"||he.direction=="Long > Short"?"Changed Position":"Open Position"})})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:uo(he.totalSize)})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:Ct?`$${zv(Ct)}`:zv(Ct)})})}),i.jsx("td",{children:i.jsx("div",{className:`${he.pnl,""} px-1 flex justify-end gap-2 font-manrope min-w-max`,children:i.jsx("div",{className:`${he.pnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:he.pnl?`$${zv(Math.abs(he.pnl))}`:zv(Math.abs(he.pnl))})})}),i.jsx("td",{children:i.jsx("div",{className:"px-1 flex flex-col items-end gap-2 font-manrope",children:i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:[(pr=he==null?void 0:he.fills)==null?void 0:pr.length," Fills"]})})}),i.jsx("td",{children:i.jsx("div",{onClick:()=>{Bn(kr=="time"?"date":"time")},className:"px-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx("div",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]",children:kr=="time"?i.jsx(Sn,{date:he.latestFill}):cu(he.latestFill)})})}),i.jsx("td",{className:"sm:rounded-r-2xl mr-3",children:i.jsx("div",{className:"pl-1 pr-8 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-[#979797] text-sm font-normal font-manrope leading-[13px] tracking-[0.18px]",children:he==null?void 0:he.oid})})})]},it),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},it)})})]})})]}):N==="positions"?i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 hidden lg:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:De,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:At,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:rt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:ze,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:ot,className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] border-collapse rounded-lg pb-24",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky bg-[#161616] left-0 h-10 pl-2 sm:pl-6 min-w-[130px] sm:min-w-[145px] z-[8]",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 relative",children:[i.jsx(mi,{title:"Coin",sortKey:"asset",sortOption:re,setSortOption:ce,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>tr(!Pn),className:`${Oe?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${Oe?"text-blue-500":"text-white"}`})}),Pn&&i.jsxs("div",{ref:zn,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>Zt(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:Oe,onChange:he=>Zt(he.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),wr&&i.jsx(ZX,{className:"min-w-[130px] sm:min-w-[130px] px-1",title:"Source Tag",sortKey:"source_tag",sortOption:re,setSortOption:ce}),i.jsx(ZX,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Liq. Price",sortKey:"liquidationPrice",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:re,setSortOption:ce}),i.jsx(Hd,{className:`${wr?"pr-0":"pr-8"} min-w-[185px] sm:min-w-[185px] pl-1`,title:"Entry Time",sortKey:"entryTime",sortOption:re,setSortOption:ce}),wr&&i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[150px] pl-1 pr-5",children:i.jsx("div",{className:"flex items-center justify-end w-full gap-1 min-w-max",children:i.jsx("div",{className:"flex items-center justify-end group",children:i.jsxs("div",{onClick:he=>{if(he.preventDefault(),nt)return;const Ct=(e!=null&&e.length?e.map(vt=>vt.wallet_address.toLowerCase()):[t==null?void 0:t.toLowerCase()]).map(vt=>{var ln;return(ln=Mn.find(xn=>xn.wallet_address===vt))==null?void 0:ln.wallet_id}).filter(Boolean);mr(Ct)},className:"h-[26px] pl-1 pr-2 py-1.5 bg-[#67ffbd]/20 hover:bg-[#67ffbd]/30 rounded-md inline-flex justify-start items-center gap-2 cursor-pointer",children:[i.jsx("div",{className:"",children:i.jsx("img",{src:hae,alt:"",className:"w-4 h-4"})}),nt?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[66px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Fast Close All"})]})})})})]})}),i.jsx("tbody",{children:!s||s.length==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:window.innerWidth>=640&&window.innerWidth<768?5:window.innerWidth>=768&&window.innerWidth<1024?6:window.innerWidth>=1024&&window.innerWidth<1240?8:window.innerWidth>=1240&&window.innerWidth<1540?10:window.innerWidth>=1540?12:4,className:"h-[36vh]",children:i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:u?i.jsx($a,{}):i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No open positions are currently available"}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["To discover a different wallet, you can use the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Discover Wallets'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","tab above."]})]})]})]})})})})}):B==null?void 0:B.map((he,it)=>{var Ct,vt,ln,xn,dr;return i.jsxs(Ne.Fragment,{children:[i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",style:{margin:"2px"},children:[i.jsx("td",{scope:"row",className:"sticky left-0 z-[2] bg-[#1b1b1b] group-hover:bg-[#222222] sm:rounded-l-2xl",children:i.jsx("div",{onClick:()=>{window.open(`/terminal/${he==null?void 0:he.asset}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 sm:pl-6 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Ys[he.asset]||((Ct=he.asset)==null?void 0:Ct.split("/")[0])}.svg`||qa,alt:he==null?void 0:he.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Er=>oa(Er)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:he.asset})]})})}),wr&&i.jsx("td",{children:i.jsx("div",{onClick:Er=>{Er.preventDefault(),he!=null&&he.tagWallet&&(he==null?void 0:he.tagWallet)!=null&&window.open(`/wallet-details/${he==null?void 0:he.tagWallet}`,"_blank")},className:`${he!=null&&he.tagWallet&&(he==null?void 0:he.tagWallet)!=null?"cursor-pointer":""} pl-1 pr-2 flex flex-col items-start gap-2 font-manrope`,children:i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] has-tooltip relative",children:[(he==null?void 0:he.tagName)==null||(he==null?void 0:he.tagName)==""?"--":((vt=he==null?void 0:he.tagName)==null?void 0:vt.length)>10?((ln=he==null?void 0:he.tagName)==null?void 0:ln.slice(0,10))+"...":he==null?void 0:he.tagName,(he==null?void 0:he.tagName)&&(he==null?void 0:he.tagName.length)>10&&i.jsx("span",{children:i.jsx(Ma,{content:`${he==null?void 0:he.tagName}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:"z-[2] bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${he.type==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:he.type==="Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[he.type," - ",he==null?void 0:he.leverage,"x"]})]})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:uo(Math.abs(he.size))})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:he.positionValue?`$${uo(he.positionValue)}`:uo(he.positionValue)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:he.entryPrice?`$${_r(he.entryPrice)}`:_r(he.entryPrice)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:he.currentPrice?`$${_r(he.currentPrice)}`:_r(he.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{Ge(Er=>({...Er,coin:he.asset,type:he.type,leverage:he.leverage,roe:he.roe,entryPrice:he.entryPrice,markPrice:he.currentPrice,pnl:he.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?de:null})),Ke(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${he.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[he.unrealizedPnl?`$${uo(Math.abs(he.unrealizedPnl))}`:uo(Math.abs(he.unrealizedPnl)),` (${uo(Math.abs(he==null?void 0:he.roe))}%)`]}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:he.liquidationPrice!=null&&he.liquidationPrice!==""&&!isNaN(he.liquidationPrice)?`$${uo(he.liquidationPrice)}`:uo(he.liquidationPrice)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:[he.marginUsed?`$${uo(he.marginUsed)}`:uo(he.marginUsed)," (",((xn=he==null?void 0:he.marginMode)==null?void 0:xn.charAt(0).toUpperCase())+((dr=he==null?void 0:he.marginMode)==null?void 0:dr.slice(1)),")"]})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:`${he.funding<=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:he.funding?`$${zv(Math.abs(he.funding))}`:zv(Math.abs(he.funding))})})}),i.jsx("td",{className:`${wr?"":"pr-8 sm:rounded-r-2xl"}`,children:i.jsx("div",{onClick:()=>{Gn(Fn=="time"?"date":"time")},className:"pl-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx("div",{className:"text-white text-sm font-normal font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:he!=null&&he.latestFill?Fn=="time"?i.jsx(Sn,{date:he==null?void 0:he.latestFill}):cu(he==null?void 0:he.latestFill):i.jsx("span",{className:"text-[#979797]",children:"--"})})})}),wr&&i.jsx("td",{className:"pr-5 sm:rounded-r-2xl",children:i.jsx("div",{className:"pl-1 flex flex-col items-end gap-2 font-manrope",children:dt[`${he==null?void 0:he.leverage}_${he==null?void 0:he.asset}_${he==null?void 0:he.size}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{const Er=Mn.find(Yr=>{var is;return Yr.wallet_address===((is=he.wallet||t)==null?void 0:is.toLowerCase())}),pr=Er==null?void 0:Er.wallet_id,fr=Er==null?void 0:Er.wallet_address;pr&&ss(pr,fr,he==null?void 0:he.asset,he==null?void 0:he.leverage,he==null?void 0:he.size)},className:"h-5 px-2 py-1.5 rounded-md border border-white justify-start items-center gap-2 inline-flex",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight cursor-pointer",children:"Market"})})})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},it)})})]})})]}):N==="twap-history"&&wt.pathname.startsWith("/wallet-details")?i.jsx(Oln,{data:Be,setData:ht,wallet:t,coinNameData:cn}):N==="trade-history"?i.jsx(fln,{wallet:t,wallets:e}):N==="completed-trades"?i.jsx(Fln,{trades:ne,generatedWallets:Mn,wallet:t,wallets:e}):N==="deposit-withdraw"?i.jsx(xln,{wallet:t,wallets:e}):""]})},Hd=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),ZX=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})});function JX({walletAddress:t}){const[e,n]=m.useState(!1),[r,s]=m.useState(0),[a,o]=m.useState([]),[l,c]=m.useState({}),[u,d]=m.useState(null),[f,x]=m.useState(""),[g,y]=m.useState(""),v=()=>{ps.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getwalletreportsdetail/",{wallet_address:t}).then(P=>{s(P.data.report_count||0);const T=P.data.report_detail.reduce((M,F)=>(M[F.report_type_id]=(M[F.report_type_id]||0)+1,M),{});c(T)})};m.useEffect(()=>{v()},[t]),m.useEffect(()=>{const P=T=>{T.key==="Escape"&&n(!1)};return e&&window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P)}},[e]);const C=()=>{a.length||ps.get("https://dextrabothypev2.nftinit.io/api/hyper/wallet/getreporttypes/").then(P=>{var T;return o(((T=P.data)==null?void 0:T.data)||[])})},N=()=>{if(!u){y("Please select a report type");return}const P=localStorage.getItem("hyperAddress"),T=localStorage.getItem("hyperToken");ps.post("https://dextrabothypev2.nftinit.io/api/hyper/wallet/walletreport/",{address:P,token:T,reported_wallet_address:t,report_type_id:u,message:f}).then(()=>{n(!1),d(null),x(""),v()})};return i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>{n(!0),C()},className:"relative flex items-center gap-2 px-5 py-2 rounded-full bg-[#2d2d2d] hover:bg-[#3b3b3b] text-sm font-semibold text-white font-manrope",children:["Report",r>0&&i.jsx("span",{className:"bg-red-600 text-white text-xs font-bold rounded-full px-1 font-manrope w-5 h-5 flex justify-center items-center",children:r})]}),e&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:()=>n(!1),children:i.jsxs("div",{className:"w-full max-w-md rounded-2xl bg-[#1b1b1b] p-6 text-white shadow-lg relative border border-[#3B3B3B]",onClick:P=>P.stopPropagation(),children:[i.jsx("div",{className:"absolute top-4 right-4 w-7 h-7 rounded-[8px] bg-[#3D3D3D] flex items-center justify-center text-sm cursor-pointer hover:bg-[#565656]",onClick:()=>n(!1),children:i.jsx(NOe,{className:"text-[#CECECE] mt-[1px]"})}),i.jsx("h2",{className:"text-lg font-bold mb-1 font-manrope",children:"Report Trader"}),i.jsx("p",{className:"text-xs mb-6 text-[#a1a1a1] font-manrope",children:"You can report this wallet to help determine if it is Delta Neutral or Bot."}),i.jsx("div",{className:"flex justify-center w-full gap-4 mb-6",children:a.map(P=>i.jsxs("button",{onClick:()=>{d(P.id),y("")},className:`flex items-center gap-2 px-3 py-3 rounded-full text-[13px] font-semibold transition-all hover:bg-white hover:text-[#161616] ${u===P.id?"bg-white text-[#161616]":"bg-[#1f1f1f] border border-[#353535]"}`,children:[P.name,i.jsx("span",{className:"bg-[#FFC940] text-[#30260E] text-13px font-bold rounded-[6px] px-2",children:l[P.id]||0})]},P.id))}),i.jsx("label",{className:"block text-xs mb-1",children:"Comment (Optional)"}),i.jsx("textarea",{value:f,onChange:P=>x(P.target.value),placeholder:"Describe the behavior or issue you're reporting...",className:"w-full h-24 rounded-lg bg-[#111] border border-[#2d2d2d] p-3 text-sm outline-none placeholder-[#555] resize-none mb-6"}),g&&i.jsx("p",{className:"text-red-500 text-xs font-semibold mb-4 text-center",children:g}),i.jsx("div",{className:"w-full flex justify-center",children:i.jsx("button",{onClick:N,className:"flex bg-[#1f1f1f] w-[128px] h-[32px] px-[16px] py-[12px] justify-center items-center gap-[10px] shrink-0 rounded-[12px] border border-[#353535] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] text-white font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-white hover:text-[#161616]",disabled:!localStorage.getItem("hyperAddress"),children:"Report"})})]})})]})}const lSe="https://api-ui.hyperliquid.xyz/info",Rln="wss://api.hyperliquid.xyz/ws",Lln=({initialAddress:t=""})=>{var _s,br,zt;const[e,n]=m.useState(t),[r,s]=m.useState([]),[a,o]=m.useState([]),[l,c]=m.useState(!1),[u,d]=m.useState(1),[f,x]=m.useState(null),[g,y]=m.useState(!1),v=m.useRef(null),C=jo(),N=m.useRef(t),P=m.useRef(null),T=m.useRef(null),M=m.useRef(null),[F,$]=m.useState({}),[L,z]=m.useState(!1),[X,ne]=m.useState(""),[J,K]=m.useState(null),{trackedWatchList:te,getTrackedWatchList:fe,hyperToken:q,copyTradeWatchList:se,getCopyTradeWatchList:ae,setTelegramChatId:W,setSubscriberRole:V,setSubsExpireDay:ee,setMushboomerETH:oe,setMushboomerSOL:de,setIsReferralCode:Ce,isReferralCodeName:me,setIsReferralCodeName:we,setIsWhitelist:xe,setHyperToken:be,setHyperAddress:je,setSignModalOpen:Ie,latestPnL:Re}=m.useContext(Qr),{isConnected:Qe,address:Ke}=ns(),[dt,tt]=m.useState(!1),[nt,Le]=m.useState(!1),[Be,ht]=m.useState(null),[pt,Gt]=m.useState(null),[wt,nn]=m.useState(""),[cn,Un]=m.useState(!1),[Xt,an]=m.useState(localStorage.getItem("discover_period")==0?"day":localStorage.getItem("discover_period")==1?"week":localStorage.getItem("discover_period")==2?"month":localStorage.getItem("discover_period")==3?"threeMonth":null),Jt=Xt||Re.activeRange;m.useEffect(()=>{an(null)},[Re.activeRange]);const Ye=[{label:"@10",value:"GMEOW"},{label:"@112",value:"MEOW"},{label:"@115",value:"HOLD"},{label:"@117",value:"BERA"},{label:"@12",value:"XULIAN"},{label:"@123",value:"FARM"},{label:"@131",value:"ORA"},{label:"@132",value:"LIQD"},{label:"@134",value:"STAR"},{label:"@135",value:"SENT"},{label:"@136",value:"SOLV"},{label:"@16",value:"CZ"},{label:"@18",value:"ANSEM"},{label:"@21",value:"KOBE"},{label:"@22",value:"HAPPY"},{label:"@25",value:"BIGBEN"},{label:"@3",value:"MANLET"},{label:"@30",value:"FARMED"},{label:"@31",value:"GPT"},{label:"@32",value:"PURRPS"},{label:"@33",value:"BID"},{label:"@34",value:"HODL"},{label:"@1",value:"HFUN"},{label:"@100",value:"UP"},{label:"@101",value:"NIGGO"},{label:"@102",value:"HOP"},{label:"@103",value:"LUCKY"},{label:"@104",value:"COPE"},{label:"@105",value:"HPYH"},{label:"@106",value:"YAP"},{label:"@107",value:"HYPE"},{label:"@108",value:"CHEF"},{label:"@109",value:"WOW"},{label:"@11",value:"PEPE"},{label:"@110",value:"STEEL"},{label:"@111",value:"RETARD"},{label:"@113",value:"NEIRO"},{label:"@114",value:"PEAR"},{label:"@116",value:"MUNCH"},{label:"@118",value:"GENESY"},{label:"@119",value:"BUBZ"},{label:"@120",value:"PICKL"},{label:"@121",value:"SHEEP"},{label:"@122",value:"LAUNCH"},{label:"@124",value:"FLASK"},{label:"@125",value:"VAULT"},{label:"@126",value:"CAT"},{label:"@127",value:"HYENA"},{label:"@128",value:"DEPIN"},{label:"@129",value:"MON"},{label:"@13",value:"RUG"},{label:"@130",value:"BEATS"},{label:"@133",value:"H"},{label:"@137",value:"FLY"},{label:"@138",value:"TIME"},{label:"@139",value:"SOVRN"},{label:"@14",value:"ILIENS"},{label:"@15",value:"FUCKY"},{label:"@17",value:"BAGS"},{label:"@19",value:"TATE"},{label:"@2",value:"LICK"},{label:"@20",value:"PUMP"},{label:"@23",value:"SCHIZO"},{label:"@24",value:"SELL"},{label:"@26",value:"CATNIP"},{label:"@27",value:"HBOOST"},{label:"@28",value:"SUCKY"},{label:"@29",value:"GUP"},{label:"@35",value:"VEGAS"},{label:"@37",value:"VAPOR"},{label:"@38",value:"PANDA"},{label:"@39",value:"PILL"},{label:"@40",value:"ADHD"},{label:"@41",value:"FUN"},{label:"@42",value:"LADY"},{label:"@46",value:"DROP"},{label:"@47",value:"MBAPPE"},{label:"@48",value:"TEST"},{label:"@49",value:"RAGE"},{label:"@5",value:"SIX"},{label:"@50",value:"FRAC"},{label:"@51",value:"ATEHUN"},{label:"@52",value:"COZY"},{label:"@53",value:"ARI"},{label:"@54",value:"WASH"},{label:"@55",value:"ANT"},{label:"@59",value:"CATBAL"},{label:"@60",value:"TJIF"},{label:"@61",value:"GUESS"},{label:"@62",value:"MAXI"},{label:"@63",value:"NMTD"},{label:"@66",value:"RISE"},{label:"@67",value:"CINDY"},{label:"@70",value:"FRIED"},{label:"@73",value:"RANK"},{label:"@74",value:"OMNIX"},{label:"@75",value:"RIP"},{label:"@76",value:"G"},{label:"@77",value:"BOZO"},{label:"@78",value:"SPH"},{label:"@82",value:"BUSSY"},{label:"@83",value:"FATCAT"},{label:"@84",value:"SHREK"},{label:"@85",value:"PIP"},{label:"@86",value:"LQNA"},{label:"@87",value:"NASDAQ"},{label:"@88",value:"YEETI"},{label:"@9",value:"TRUMP"},{label:"@90",value:"FEIT"},{label:"@92",value:"VIZN"},{label:"@93",value:"STRICT"},{label:"@94",value:"AUTIST"},{label:"@96",value:"HGOD"},{label:"@97",value:"LIQUID"},{label:"@36",value:"ASI"},{label:"@4",value:"JEFF"},{label:"@43",value:"MOG"},{label:"@44",value:"HPEPE"},{label:"@45",value:"JEET"},{label:"@57",value:"RICH"},{label:"@58",value:"LORA"},{label:"@6",value:"WAGMI"},{label:"@65",value:"PIGEON"},{label:"@64",value:"HPUMP"},{label:"@69",value:"STACK"},{label:"@7",value:"CAPPY"},{label:"@72",value:"NOCEX"},{label:"@79",value:"SHOE"},{label:"@80",value:"MONAD"},{label:"@81",value:"HOPE"},{label:"@89",value:"SYLVI"},{label:"@91",value:"FRUDO"},{label:"@95",value:"MAGA"},{label:"@99",value:"EARTH"},{label:"@56",value:"NFT"},{label:"@8",value:"POINTS"},{label:"@68",value:"CHINA"},{label:"@141",value:"GOD"}];function Je(he,it){const Ct=it.map(({fill:vt,twapId:ln})=>({...vt,twapId:ln}));return[...he,...Ct]}m.useEffect(()=>{t&&(async()=>{const he=await dde(t),it=await fde(t),Ct=Je(he,it),{closed_positions:vt}=hde(Ct);K(vt)})()},[t]),m.useEffect(()=>(t&&(N.current=t,Yt(t),ze(t)),()=>{v.current&&(v.current.close(),v.current=null),P.current&&(clearTimeout(P.current),P.current=null),T.current&&(clearInterval(T.current),T.current=null),M.current&&(clearInterval(M.current),M.current=null)}),[t]),m.useEffect(()=>{const he=localStorage.getItem("favoriteAddresses");he&&$(JSON.parse(he))},[]),m.useCallback(()=>{if(F[e]){const he={...F};delete he[e],$(he),localStorage.setItem("favoriteAddresses",JSON.stringify(he))}else z(!0),ne("")},[e,F]),m.useCallback(()=>{if(!X.trim())return;const he={...F,[e]:{name:X,address:e}};$(he),localStorage.setItem("favoriteAddresses",JSON.stringify(he)),z(!1)},[X,e,F]),m.useCallback(he=>{he&&(n(he),Yt(he),C(`/wallet-details/${he}`))},[]);const It=he=>{var it;((it=v.current)==null?void 0:it.readyState)===WebSocket.OPEN&&N.current===he||(T.current&&(clearInterval(T.current),T.current=null),P.current&&(clearTimeout(P.current),P.current=null),v.current&&(v.current.close(),v.current=null),N.current=he,v.current=new WebSocket(Rln),v.current.onopen=()=>{console.log("WebSocket Connected"),y(!0),[{method:"subscribe",subscription:{aggregateByTime:!0,type:"userFills",user:he}},{method:"subscribe",subscription:{type:"user",user:he}}].forEach(vt=>{v.current.send(JSON.stringify(vt))}),T.current=setInterval(()=>{var vt;if(((vt=v.current)==null?void 0:vt.readyState)===WebSocket.OPEN){const ln={id:99,method:"ping"};v.current.send(JSON.stringify(ln))}},3e4)},v.current.onclose=Ct=>{y(!1),T.current&&(clearInterval(T.current),T.current=null),Ct.code!==1e3&&(P.current||(P.current=setTimeout(()=>{P.current=null,N.current===he&&It(he)},5e3)))},v.current.onerror=Ct=>{console.error("WebSocket Error:",Ct),y(!1)},v.current.onmessage=Ct=>{var vt,ln,xn;try{const dr=JSON.parse(Ct.data);if(dr.method==="pong"||dr.result==="success")return;if(dr.channel==="userFills"&&((vt=dr.data)!=null&&vt.fills)&&N.current.toLowerCase()===dr.data.user.toLowerCase()&&(s(Er=>{const pr=Er.flatMap(Ir=>Ir.fills),fr=new Map;pr.forEach(Ir=>{fr.set(Ir.hash,!0)});const Yr=dr.data.fills.filter(Ir=>!fr.has(Ir.hash));if(Yr.length===0)return Er;const is=[...Yr,...pr];return Rt(is)}),M.current||ze(N.current)),dr.channel==="user"&&((ln=dr.data)!=null&&ln.fills&&s(Er=>{const pr=Er.flatMap(Ir=>Ir.fills),fr=new Map;pr.forEach(Ir=>{fr.set(Ir.hash,!0)});const Yr=dr.data.fills.filter(Ir=>!fr.has(Ir.hash));if(Yr.length===0)return Er;const is=[...Yr,...pr];return Rt(is)}),(xn=dr.data)!=null&&xn.state)){x(dr.data.state);const Er=At(dr.data.state);o(Er)}}catch(dr){console.error("Error processing WebSocket message:",dr),console.error("Raw message that caused error:",Ct.data)}})},hn=async he=>{try{tt(!0);const it=await ps.post(lSe,{type:"clearinghouseState",user:he});if(it.data){x(it.data);const Ct=At(it.data);o(Ct),tt(!1),Ct.length>0&&!M.current?ze(he):Ct.length===0&&M.current&&(clearInterval(M.current),M.current=null)}}catch(it){console.error("Error fetching user state:",it),tt(!1)}},Yt=async he=>{if(!he){tn.error("Please enter a wallet address");return}if(!he.match(/^0x[a-fA-F0-9]{40}$/)){tn.error("Please enter a valid Ethereum address");return}c(!0);try{he!==t&&C(`/wallet-details/${he}`),It(he);const[it]=await Promise.all([ps.post(lSe,{aggregateByTime:!0,type:"userFills",user:he}),hn(he)]);if(it.data&&Array.isArray(it.data)){const Ct=Rt(it.data);s(Ct),d(1)}else console.error("Invalid response format:",it.data)}catch(it){console.error("Error fetching data:",it)}finally{c(!1)}},Rt=he=>{const it=[...he].sort((vt,ln)=>ln.time-vt.time),Ct=new Map;return it.forEach(vt=>{var xn;const ln=vt.oid;if(!Ct.has(ln)){const dr=it.filter(yr=>yr.oid===vt.oid),Er=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.sz),0),pr=dr.map(yr=>parseFloat(yr.startPosition));let fr;pr.includes(0)?fr=0:pr.every(yr=>yr>0)?fr=Math.max(...pr):pr.every(yr=>yr<0)?fr=Math.min(...pr):fr=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.startPosition),0);const Yr=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.sz)*parseFloat(Jn.px),0),is=dr.reduce((yr,Jn)=>yr+parseFloat(Jn.closedPnl||0),0),Ir=((xn=dr.find(yr=>yr.dir==="Long > Short"||yr.dir==="Short > Long"))==null?void 0:xn.dir)||"";Ct.set(ln,{oid:vt.oid,asset:vt.coin,direction:Ir==""?vt.dir:Ir,fills:dr,totalSize:Er,totalStartPositions:fr,totalValue:Yr,pnl:is,latestFill:vt.time})}}),Array.from(Ct.values()).sort((vt,ln)=>ln.latestFill-vt.latestFill)},ot=he=>{const it=new Date(he),Ct=it.toLocaleString("en-US",{month:"short"}),vt=it.getDate(),ln=it.getFullYear(),xn=it.getHours().toString().padStart(2,"0"),dr=it.getMinutes().toString().padStart(2,"0"),Er=it.getHours()>=12?" PM":" AM";return`${Ct} ${vt}, ${ln}, ${xn}:${dr} ${Er}`},De=r,At=he=>{if(!(he!=null&&he.assetPositions))return[];const it=new Map;return r.forEach(Ct=>{Ct.fills.forEach(vt=>{let ln="";vt.dir.includes("Open")?ln=vt.dir.includes("Long")?"Long":"Short":vt.side==="B"?ln="Long":vt.side==="S"&&(ln="Short");const xn=`${vt.coin}-${ln}`;(!it.has(xn)||vt.time<it.get(xn))&&it.set(xn,vt.time)})}),he.assetPositions.filter(Ct=>{if(!Ct.position||!Ct.position.szi)return!1;const vt=parseFloat(Ct.position.szi);return!isNaN(vt)&&vt!==0}).map(Ct=>{const vt=Ct.position,ln=parseFloat(vt.szi),xn=parseFloat(vt.entryPx),dr=parseFloat(vt.positionValue),Er=parseFloat(vt.unrealizedPnl),pr=parseFloat(vt.returnOnEquity)*100,fr=parseFloat(vt.marginUsed),Yr=vt.leverage.value,is=vt.leverage.type,Ir=parseFloat(vt.cumFunding.sinceOpen),yr=ln>0?"Long":"Short",Jn=it.get(`${vt.coin}-${yr}`);return{asset:vt.coin,type:yr,size:ln,entryPrice:xn.toFixed(4),currentPrice:(dr/Math.abs(ln)).toFixed(4),leverage:Yr,marginMode:is,positionValue:dr.toFixed(2),marginUsed:fr.toFixed(2),unrealizedPnl:Er.toFixed(2),roe:pr.toFixed(2),funding:Ir.toFixed(4),startTime:Jn?ot(Jn):"N/A",liquidationPrice:vt.liquidationPx?parseFloat(vt.liquidationPx).toFixed(2):"N/A"}})},ze=he=>{M.current&&(clearInterval(M.current),M.current=null),M.current=setInterval(()=>{hn(he)},7e3)},rt=he=>he>=1e6?`${(he/1e6).toFixed(2)}M`:he>=1e3?`${(he/1e3).toFixed(2)}K`:he.toFixed(2);m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(fe(),ae())},[]);const mt=m.useRef(null),Lt=()=>{mt.current&&(mt.current.scrollLeft-=200)},kt=()=>{mt.current&&(mt.current.scrollLeft+=200)};m.useEffect(()=>{(async()=>{var vt,ln;const it=window.localStorage.getItem("hyperToken"),Ct=window.localStorage.getItem("hyperAddress");if(!(!it||!Ct))try{const xn=await ki(Ct.toLowerCase(),it);xn!=null&&xn.success?(W(xn==null?void 0:xn.telegram_chat_id),V(xn==null?void 0:xn.subscriber_role),ee(xn==null?void 0:xn.subs_expire_day),oe((vt=xn==null?void 0:xn.mushboomer_counts)==null?void 0:vt.eth),de((ln=xn==null?void 0:xn.mushboomer_counts)==null?void 0:ln.sol),Ce(xn==null?void 0:xn.referral_code),we(xn==null?void 0:xn.refcode),xe(xn==null?void 0:xn.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),be(""),je(""))}catch(xn){console.error("Token verification error:",xn),console.error(xn.message||"An unknown error occurred.")}})()},[]);const dn=async({walletAddress:he,isFollow:it,isScalper:Ct})=>{try{nn(he);const vt=window.localStorage.getItem("hyperToken"),ln=window.localStorage.getItem("hyperAddress");if(!vt){Ie(!0);return}const xn=it?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",dr=it?{address:Ke?Ke.toLowerCase():ln,token:vt,follow_address:he.toLowerCase()}:{address:Ke?Ke.toLowerCase():ln,token:vt},Er=await fetch(xn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(dr)});if(!Er.ok)throw new Error(`Server responded with status ${Er.status}`);const pr=await Er.json();pr.success?(ht(Array.isArray(pr==null?void 0:pr.data)?[...pr.data].sort((fr,Yr)=>new Date(Yr.created_at||0)-new Date(fr.created_at||0)):pr==null?void 0:pr.data),Gt(Ct),Le(!0)):(console.log(pr.error_message),tn.error(pr.error_message))}catch(vt){console.error("Error in like function:",vt),tn.error(vt.message||"Something went wrong!")}},rn="-latestFill",[gn,An]=m.useState(rn),[kn,yn]=m.useState([]),[Vn,Kn]=m.useState(""),[Dn,Xn]=m.useState(""),[Nn,on]=m.useState(""),[Oe,Zt]=m.useState(!1),[sn,jt]=m.useState(!1),[Qn,bn]=m.useState(!1),[Dt,en]=m.useState(!1),Pn=m.useRef(null),tr=m.useRef(null),ar=m.useRef(null),hr=m.useRef(null);m.useEffect(()=>{function he(it){Pn.current&&!Pn.current.contains(it.target)&&Zt(!1),tr.current&&!tr.current.contains(it.target)&&jt(!1),ar.current&&!ar.current.contains(it.target)&&bn(!1),hr.current&&!hr.current.contains(it.target)&&en(!1)}return document.addEventListener("mousedown",he),()=>document.removeEventListener("mousedown",he)},[]);const qt=De.map(he=>{let it=he.totalStartPositions==0?"Open Position":he.direction!="Short > Long"&&he.direction!="Long > Short"?(he==null?void 0:he.totalSize)-Math.abs(he==null?void 0:he.totalStartPositions)==0&&(he.direction=="Close Long"||he.direction=="Close Short")?"Position Closed":he.direction=="Open Short"||he.direction=="Open Long"?"Increase":he.direction=="Close Long"||he.direction=="Close Short"?"Decrease":he.direction=="Sell"||he.direction=="Buy"?"Spot":"Changed Position":he.direction=="Short > Long"||he.direction=="Long > Short"?"Changed Position":"Open Position";return{...he,computedType:it}}),zn=he=>{const it=Ye.find(Ct=>Ct.label===he);return it?it.value.toUpperCase():he==null?void 0:he.toUpperCase()},Zn=qt.filter(he=>kn.length?kn.includes(he.computedType):!0).filter(he=>{var it,Ct;return Vn?(Ct=(it=he==null?void 0:he.oid)==null?void 0:it.toString())==null?void 0:Ct.includes(Vn):!0}).filter(he=>Dn?zn(he.asset).includes(Dn.toUpperCase()):!0),En=(he=>Zn==null?void 0:Zn.sort((it,Ct)=>{var is,Ir,yr,Jn;const vt=it.totalSize?it.totalValue/it.totalSize:0,ln=Ct.totalSize?Ct.totalValue/Ct.totalSize:0,xn=gs=>{const Zs=Ye.find(oi=>oi.label===gs);return Zs?Zs.value.toUpperCase():gs==null?void 0:gs.toUpperCase()},dr=xn(it.asset),Er=xn(Ct.asset),pr=gs=>{if(!gs)return"";const Zs=gs.toLowerCase();return Zs.includes("short")?"Short":Zs.includes("long")?"Long":Zs==="buy"?"Buy":Zs==="sell"?"Sell":gs},fr=pr(it.direction),Yr=pr(Ct.direction);if(he==="-totalSize")return Ct.totalSize-it.totalSize;if(he==="totalSize")return it.totalSize-Ct.totalSize;if(he==="-pnl")return Ct.pnl-it.pnl;if(he==="pnl")return it.pnl-Ct.pnl;if(he==="-fills")return(((is=Ct.fills)==null?void 0:is.length)||0)-(((Ir=it.fills)==null?void 0:Ir.length)||0);if(he==="fills")return(((yr=it.fills)==null?void 0:yr.length)||0)-(((Jn=Ct.fills)==null?void 0:Jn.length)||0);if(he==="-latestFill")return new Date(Ct.latestFill)-new Date(it.latestFill);if(he==="latestFill")return new Date(it.latestFill)-new Date(Ct.latestFill);if(he==="-avgPrice")return ln-vt;if(he==="avgPrice")return vt-ln;if(he==="-oid")return Ct.oid-it.oid;if(he==="oid")return it.oid-Ct.oid;if(he==="direction"){const gs={Short:1,Sell:2,Long:3,Buy:4};return(gs[fr]||99)-(gs[Yr]||99)}else if(he==="-direction"){const gs={Long:1,Buy:2,Short:3,Sell:4};return(gs[fr]||99)-(gs[Yr]||99)}else{if(he==="-coin")return dr<Er?-1:dr>Er?1:0;if(he==="coin")return dr>Er?-1:dr<Er?1:0}return 0}))(gn).filter(he=>(he.totalStartPositions==0?"Open Position":he.direction!="Short > Long"&&he.direction!="Long > Short"?(he==null?void 0:he.totalSize)-Math.abs(he==null?void 0:he.totalStartPositions)==0&&(he.direction=="Close Long"||he.direction=="Close Short")?"Position Closed":he.direction=="Open Short"||he.direction=="Open Long"?"Increase":he.direction=="Close Long"||he.direction=="Close Short"?"Decrease":he.direction=="Sell"||he.direction=="Buy"?"Spot":"Changed Position":he.direction=="Short > Long"||he.direction=="Long > Short"?"Changed Position":"Open Position")==="Open Position"),Ee={};En.forEach(he=>{var vt;const it=he==null?void 0:he.asset,Ct=new Date(he==null?void 0:he.latestFill).getTime();if(!Ee[it])Ee[it]=he;else{const ln=new Date((vt=Ee[it])==null?void 0:vt.latestFill).getTime();Ct>ln&&(Ee[it]=he)}});const h=Object.values(Ee),[p,S]=m.useState([]),_=a==null?void 0:a.filter(he=>{var it;return Nn?(it=he.asset)==null?void 0:it.toLowerCase().includes(Nn.toLowerCase()):!0}).map(he=>{const it=h.find(vt=>(vt==null?void 0:vt.asset)===(he==null?void 0:he.asset)),Ct=p.find(vt=>(vt==null?void 0:vt.coin)===(he==null?void 0:he.asset));return{...he,latestFill:(it==null?void 0:it.latestFill)||null,tagName:(Ct==null?void 0:Ct.tag)||null,tagWallet:(Ct==null?void 0:Ct.cp_wallet)||null}}),k="-unrealizedPnl",[I,B]=m.useState(k),G=he=>_==null?void 0:_.sort((it,Ct)=>{const vt=it.tagName?it.tagName.toUpperCase():"",ln=Ct.tagName?Ct.tagName.toUpperCase():"",xn=it.asset?it.asset.toUpperCase():"",dr=Ct.asset?Ct.asset.toUpperCase():"",Er=it.type==="Long"?1:0,pr=Ct.type==="Long"?1:0,fr=it.type==="Short"?1:0,Yr=Ct.type==="Short"?1:0;return he==="-unrealizedPnl"?Ct.unrealizedPnl-it.unrealizedPnl:he==="unrealizedPnl"?it.unrealizedPnl-Ct.unrealizedPnl:he==="-roe"?Ct.roe-it.roe:he==="roe"?it.roe-Ct.roe:he==="-size"?Ct.size-it.size:he==="size"?it.size-Ct.size:he==="-entryPrice"?Ct.entryPrice-it.entryPrice:he==="entryPrice"?it.entryPrice-Ct.entryPrice:he==="-currentPrice"?Ct.currentPrice-it.currentPrice:he==="currentPrice"?it.currentPrice-Ct.currentPrice:he==="-leverage"?Ct.leverage-it.leverage:he==="leverage"?it.leverage-Ct.leverage:he==="-positionValue"?Ct.positionValue-it.positionValue:he==="positionValue"?it.positionValue-Ct.positionValue:he==="-marginUsed"?Ct.marginUsed-it.marginUsed:he==="marginUsed"?it.marginUsed-Ct.marginUsed:he==="funding"?Ct.funding-it.funding:he==="-funding"?it.funding-Ct.funding:he==="-liquidationPrice"?Ct.liquidationPrice-it.liquidationPrice:he==="liquidationPrice"?it.liquidationPrice-Ct.liquidationPrice:he==="-entryTime"?new Date(Ct.latestFill)-new Date(it.latestFill):he==="entryTime"?new Date(it.latestFill)-new Date(Ct.latestFill):he==="-source_tag"?vt<ln?-1:vt>ln?1:0:he==="source_tag"?vt>ln?-1:vt<ln?1:0:he==="-type_leverage"?Er!==pr?pr-Er:Ct.leverage-it.leverage:he==="type_leverage"?fr!==Yr?Yr-fr:Ct.leverage-it.leverage:he==="-asset"?xn<dr?-1:xn>dr?1:0:he==="asset"?xn>dr?-1:xn<dr?1:0:0}),[re,ce]=m.useState([]),[ue,ge]=m.useState([]),[Ae,ke]=m.useState([]),[Me,qe]=m.useState([]),[Fe,at]=m.useState([]);async function ie(){try{const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=1&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();ce(it.results)}catch(he){console.error("Error resetting filters:",he)}}async function Se(){try{const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=7&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();ge(it.results)}catch(he){console.error("Error resetting filters:",he)}}async function $e(){try{const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=30&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();ke(it.results)}catch(he){console.error("Error resetting filters:",he)}}async function Ue(){try{const he=await fetch(`https://dextradata.nftinit.io/api/hyper/get_wallets_profit_new/?period=90&order=-perp_pnl&offset=0&limit=50&user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();qe(it.results)}catch(he){console.error("Error resetting filters:",he)}}async function _e(){try{const he=await fetch(`https://dextradata.nftinit.io/api/hyper/wallet/details/?user_token=${t}`);if(!he.ok)throw new Error(`HTTP error! status: ${he.status}`);const it=await he.json();at(it)}catch(he){console.error("Error pnlSharpeRateData:",he)}}m.useEffect(()=>{ie(),Se(),$e(),Ue(),_e()},[]);const[st,ut]=m.useState(localStorage.getItem("discover_period")==0?"1D":localStorage.getItem("discover_period")==1?"7D":localStorage.getItem("discover_period")==2?"30D":localStorage.getItem("discover_period")==3||localStorage.getItem("discover_period")==4?"90D":"7D"),[yt,Mt]=m.useState(localStorage.getItem("discover_period")==0?"1D":localStorage.getItem("discover_period")==1?"7D":localStorage.getItem("discover_period")==2?"30D":localStorage.getItem("discover_period")==3||localStorage.getItem("discover_period")==4?"90D":"7D"),[Kt,un]=m.useState(localStorage.getItem("discover_period")==1?"7D":localStorage.getItem("discover_period")==2?"30D":localStorage.getItem("discover_period")==3||localStorage.getItem("discover_period")==4?"90D":"7D"),Xe=st==="1D"?re:st==="7D"?ue:st==="30D"?Ae:Me,Pt=yt==="1D"?re:yt==="7D"?ue:yt==="30D"?Ae:Me,Wt=a.length,ct=a.filter(he=>he.unrealizedPnl>=0).length,Ge=Wt>0?ct/Wt*100:0,[Tt,fn]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),Fn=((_s=G(I))==null?void 0:_s.reduce((he,it)=>he+((it==null?void 0:it.leverage)||0),0))/(((br=G(I))==null?void 0:br.length)||1),Gn=(zt=G(I))==null?void 0:zt.reduce((he,it)=>{const Ct=parseFloat(it==null?void 0:it.funding)||0;return he+Ct},0),ur=localStorage.getItem("isDateOpenPositionsFormat")||"date",[kr,Bn]=m.useState(ur);m.useEffect(()=>{localStorage.setItem("isDateOpenPositionsFormat",kr)},[kr]);const Mn=localStorage.getItem("isDateFillsFormat")||"date",[rr,ls]=m.useState(Mn);m.useEffect(()=>{localStorage.setItem("isDateFillsFormat",rr)},[rr]);const[cs,et]=m.useState([]),gt=async()=>{try{const he=window.localStorage.getItem("hyperToken");if(!he){Ie(!0);return}const it="https://dextrabothypev2.nftinit.io/api/wallet/list",Ct=window.localStorage.getItem("hyperAddress"),ln=await(await fetch(it,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Ke?Ke.toLowerCase():Ct,token:he,balance:"false"})})).json();ln!=null&&ln.success?(et(ln.data||[]),mr(ln.data)):console.log(ln.error_message)}catch(he){console.error("Error fetching generate wallet list:",he)}};m.useEffect(()=>{window.localStorage.getItem("hyperToken")&>()},[q]);const Tn=cs==null?void 0:cs.find(he=>(he==null?void 0:he.wallet_address)===(t==null?void 0:t.toLowerCase())),sr=se==null?void 0:se.find(he=>(he==null?void 0:he.wallet_address)===(t==null?void 0:t.toLowerCase())),[Tr,Lr]=m.useState([]),[$r,lr]=m.useState(!0),[wr,ss]=m.useState(!1);m.useEffect(()=>{_&&_.length>0&&(es(),cs.length>0&&$r&&mr())},[_]);const mr=he=>{const it=[...Tr];it.length>0&&((he==null?void 0:he.some(vt=>(vt==null?void 0:vt.wallet_address)===(t==null?void 0:t.toLowerCase())))?Ys(it):$r&&(Ys(it),lr(!1)))},es=()=>{const he=window.localStorage.getItem("hyperToken");let it=!1;const Ct=[...Tr];_==null||_.forEach(vt=>{const ln=vt.asset;(Ct==null?void 0:Ct.some(dr=>dr.coin===ln))||(Ct==null||Ct.push({coin:ln,wallet:t}),it=!0)}),it&&(Lr(Ct),cs!=null&&cs.some(ln=>(ln==null?void 0:ln.wallet_address)===(t==null?void 0:t.toLowerCase()))&&he&&Ys(Ct))},Ys=async he=>{if(!wr)try{ss(!0);const it=window.localStorage.getItem("hyperToken"),Ct="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!it||!he){ss(!1);return}it||Ie(!0);const vt=window.localStorage.getItem("hyperAddress"),xn=await(await fetch(Ct,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:Ke?Ke.toLowerCase():vt,token:it,positions:he})})).json();xn.success?S(xn==null?void 0:xn.data):(console.log(xn.error_message),tn.error(xn.error_message))}catch(it){console.error("Error tag request",it),tn.error(it.message)}finally{ss(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(yVe,{}),i.jsx($5,{open:nt,setOpen:Le,copyTradeData:Be,copyTradeWallet:wt,setCopyTradeWallet:nn,isScalper:pt,setCopyTradeData:ht}),i.jsx(uln,{open:cn,setOpen:Un,data:Tt,setTradeInfo:fn}),i.jsxs("div",{className:"min-h-max flex flex-col items-center justify-start text-white bg-[#161616] dark:bg-inherit w-full gap-1 overflow-hidden font-manrope",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-4 w-full mt-1 sm-mt-0",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1 h-max min-h-[45px] sm:min-h-max relative w-full",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row items-start justify-start sm:items-center gap-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx(U$e,{wallet:t,className:"w-10 h-10 rounded-full"}),i.jsxs("div",{className:`${cs.some(he=>(he==null?void 0:he.wallet_address)==(t==null?void 0:t.toLowerCase()))?"bg-[#67ffbd]/20 rounded-xl p-[7px]":""} flex justify-start items-center gap-1 ml-1`,children:[i.jsx("div",{className:"flex flex-col items-start justify-center gap-1",children:i.jsx("div",{className:`${cs.some(he=>(he==null?void 0:he.wallet_address)==(t==null?void 0:t.toLowerCase()))?"text-[#67ffbd]":"text-white"} text-base sm:text-[24px] font-semibold font-manrope leading-none tracking-wide`,children:t&&t.slice(0,6)+"..."+t.slice(-4)})}),i.jsxs("svg",{onClick:he=>{he.stopPropagation(),navigator.clipboard.writeText(t),tn.success("Successfully copied.")},className:"cursor-pointer",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M12 9.675V12.825C12 15.45 10.95 16.5 8.325 16.5H5.175C2.55 16.5 1.5 15.45 1.5 12.825V9.675C1.5 7.05 2.55 6 5.175 6H8.325C10.95 6 12 7.05 12 9.675Z",stroke:`${cs.some(he=>(he==null?void 0:he.wallet_address)==(t==null?void 0:t.toLowerCase()))?"#67FFBD":"#909090"}`,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M16.5 5.175V8.325C16.5 10.95 15.45 12 12.825 12H12V9.675C12 7.05 10.95 6 8.325 6H6V5.175C6 2.55 7.05 1.5 9.675 1.5H12.825C15.45 1.5 16.5 2.55 16.5 5.175Z",stroke:`${cs.some(he=>(he==null?void 0:he.wallet_address)==(t==null?void 0:t.toLowerCase()))?"#67FFBD":"#909090"}`,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),i.jsxs("div",{className:`${cs.some(he=>(he==null?void 0:he.wallet_address)==(t==null?void 0:t.toLowerCase()))?"ml-1 p-1":""} flex justify-start items-center h-6 bg-[#67ffbd]/20 rounded-md gap-0.5 has-tooltip relative min-w-max`,children:[Tn&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:Tn.wallet_name.length>13?Tn.wallet_name.slice(0,13)+"...":Tn.wallet_name}),Tn&&Tn.wallet_name.length>13&&i.jsx("span",{className:"",children:i.jsx(Ma,{content:`${Tn==null?void 0:Tn.wallet_name}`,positionTop:!1,alignRight:!1})})]}),i.jsxs("div",{className:`${se.some(he=>he.wallet_address===t)?Tn?"ml-1 p-1":"ml-0.5 mr-2 p-1":""} flex justify-start items-center h-6 bg-[#67ffbd]/20 rounded-md gap-0.5 has-tooltip relative min-w-max`,children:[sr&&i.jsx("div",{className:"text-[#67ffbd] text-sm font-semibold font-manrope leading-[8px]",children:(sr==null?void 0:sr.tag.length)>13?(sr==null?void 0:sr.tag.slice(0,13))+"...":sr==null?void 0:sr.tag}),sr&&sr.tag.length>13&&i.jsx("span",{className:"",children:i.jsx(Ma,{content:`${sr==null?void 0:sr.tag}`,positionTop:!1,alignRight:!1})})]})]}),i.jsx(B5,{walletAddress:t,children:i.jsx("div",{className:`${te.some(he=>he.wallet_address===t),"bg-[rgba(255,217,121,0.16)]"} w-6 h-6sm:w-8 sm:h-8 px-2 sm:px-4 py-1 rounded-full justify-center items-center inline-flex cursor-pointer`,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex",children:te.some(he=>he.wallet_address===t)?i.jsx("img",{src:N5,alt:"",className:"w-4 h-4 min-w-4 min-h-4"}):i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"w-4 h-4",children:i.jsx("path",{d:"M10.2967 2.6325L11.6167 5.2725C11.7967 5.64 12.2767 5.9925 12.6817 6.06L15.0742 6.4575C16.6042 6.7125 16.9642 7.8225 15.8617 8.9175L14.0017 10.7775C13.6867 11.0925 13.5142 11.7 13.6117 12.135L14.1442 14.4375C14.5642 16.26 13.5967 16.965 11.9842 16.0125L9.7417 14.685C9.3367 14.445 8.6692 14.445 8.2567 14.685L6.0142 16.0125C4.4092 16.965 3.4342 16.2525 3.8542 14.4375L4.3867 12.135C4.4842 11.7 4.3117 11.0925 3.9967 10.7775L2.1367 8.9175C1.0417 7.8225 1.3942 6.7125 2.9242 6.4575L5.3167 6.06C5.7142 5.9925 6.1942 5.64 6.3742 5.2725L7.6942 2.6325C8.4142 1.2 9.5842 1.2 10.2967 2.6325Z",stroke:"#FFD979",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})})})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{onClick:he=>{var vt;he.preventDefault();const it=se==null?void 0:se.some(ln=>ln.wallet_address===t),Ct=(ue==null?void 0:ue.length)>0?(vt=ue[0])==null?void 0:vt.is_scalper:!1;dn({walletAddress:t,isFollow:it,isScalper:Ct})},className:`${se.some(he=>he.wallet_address===t)?"bg-[#ffd979]/60 text-white/80":"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]"} h-6 sm:h-8 px-2 sm:px-3 py-[1px] sm:py-[5px] rounded-[256px] justify-start items-center gap-2 inline-flex cursor-pointer min-w-max has-tooltip relative ml-8 sm:ml-2`,children:i.jsx("div",{className:"text-[14px] font-semibold font-manrope leading-[8px]min-w-max",children:se.some(he=>he.wallet_address===t)?"Edit Copy Trade":"Copy Trade"})}),i.jsx("div",{className:"sm:hidden h-6 flex justify-end",children:q&&i.jsx(JX,{walletAddress:t})})]}),i.jsx(rln,{traderWallet:t,trades:J})]}),i.jsxs("div",{className:"absolute right-0 flex justify-end",children:[q&&i.jsx(JX,{walletAddress:t}),i.jsx("div",{className:"absolute right-0 hidden sm:flex",children:q&&i.jsx(JX,{walletAddress:t})})]})]}),i.jsxs("div",{className:"flex w-full flex-wrap",children:[i.jsxs("div",{className:"w-full lg:w-4/12 order-2 lg:order-1",children:[i.jsx("div",{ref:mt,className:"flex w-full justify-start items-center",children:i.jsxs("div",{className:"grid grid-cols-2 gap-2 w-full",children:[i.jsxs("div",{className:"flex flex-col justify-between items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Perp Equity"}),i.jsxs("div",{className:"text-white font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]",children:["$",f?_r(f==null?void 0:f.marginSummary.accountValue):"-"]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-3 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between gap-1 w-full",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px] tracking-[0.18px]",children:"Margin Usage"}),i.jsxs("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px] tracking-[0.18px]",children:[f?(parseFloat(f.marginSummary.totalMarginUsed)/parseFloat(f.marginSummary.accountValue)*100).toFixed(2):"-","%"]})]}),i.jsx("div",{className:"w-full h-1 bg-[#414141] rounded-[256px]",children:i.jsx("div",{style:f?{width:`${parseFloat(f.marginSummary.totalMarginUsed)/parseFloat(f.marginSummary.accountValue)*100}%`}:{width:"0%"},className:"h-1 bg-white rounded-[256px]"})})]})]}),i.jsxs("div",{className:"flex flex-col justify-between items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsxs("div",{onClick:()=>{fn(he=>({...he,coin:"--",type:f?parseFloat(f.marginSummary.totalNtlPos)===0?"NEUTRAL":a.reduce((it,Ct)=>it+(Ct.type==="Long"?parseFloat(Ct.positionValue):-parseFloat(Ct.positionValue)),0)>0?"LONG":"SHORT":"--",leverage:Fn&&Fn!=0?`${parseFloat(Fn).toFixed(2)}x`:"--",roe:Pt.length>0?Pt.map(it=>it==null?void 0:it.margin_roi).join(", "):"--",entryPrice:f?a.reduce((it,Ct)=>it+parseFloat(Ct.unrealizedPnl||0),0):"-",markPrice:Wt>0?`${ct} / ${Wt} (${ct/Wt*100===0||ct/Wt*100===100?ct/Wt*100:(ct/Wt*100).toFixed(2)}%)`:"--",positionDistribution:f?`${isNaN(a.reduce((it,Ct)=>Ct.type==="Long"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((it,Ct)=>Ct.type==="Long"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((it,Ct)=>Ct.type==="Long"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((it,Ct)=>Ct.type==="Long"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((it,Ct)=>Ct.type==="Long"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}% / ${isNaN(a.reduce((it,Ct)=>Ct.type==="Short"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:a.reduce((it,Ct)=>Ct.type==="Short"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100===0||a.reduce((it,Ct)=>Ct.type==="Short"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100===100?a.reduce((it,Ct)=>Ct.type==="Short"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100:(a.reduce((it,Ct)=>Ct.type==="Short"?it+parseFloat(Ct.positionValue):it,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2)}%`:"-",referral:window.localStorage.getItem("hyperToken")?me:null})),Un(!0)},className:"flex justify-start items-center gap-2.5 cursor-pointer",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"uPnL"}),i.jsxs("div",{className:"flex justify-center items-center rounded-[8px] bg-[rgba(103,255,189,0.16)] gap-1 py-1 px-2",children:[i.jsx("span",{children:i.jsx("img",{src:Tlt,alt:"Dextrabot"})}),i.jsx("span",{className:"text-[#67FFBD] font-manrope text-[11px] not-italic font-semibold leading-[8px] tracking-[0.11px]",children:"Share"})]})]}),i.jsxs("div",{className:`${f&&a.reduce((he,it)=>he+parseFloat(it.unrealizedPnl),0)>=0?"text-[#67FFBD]":"text-[#FF7173]"} font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]`,children:["$",f?_r(Math.abs(a.reduce((he,it)=>he+parseFloat(it.unrealizedPnl||0),0))):"-"]})]}),i.jsx("div",{className:"flex flex-col justify-start items-start",children:i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Current Win Rate"}),i.jsxs("div",{className:"text-white font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px] min-w-max",children:[i.jsx("span",{className:"text-[#67FFBD]",children:ct})," ","/ ",Wt," (",Ge==0?"0":Ge!=0&&Ge!=100?Ge.toFixed(2):Ge,"%)"]})]})})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4 relative",children:[i.jsxs("div",{className:"flex justify-end items-center gap-1 w-auto absolute right-1.5 top-1.5 bg-[#272727] rounded-2xl",children:[i.jsx("div",{onClick:()=>{ut("1D"),localStorage.setItem("discover_period",0)},className:`${st==="1D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"1D"})}),i.jsx("div",{onClick:()=>{ut("7D"),localStorage.setItem("discover_period",1)},className:`${st==="7D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"7D"})}),i.jsx("div",{onClick:()=>{ut("30D"),localStorage.setItem("discover_period",2)},className:`${st==="30D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})}),i.jsx("div",{onClick:()=>{ut("90D"),localStorage.setItem("discover_period",3)},className:`${st==="90D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"90D"})})]}),(Xe==null?void 0:Xe.length)>0?Xe==null?void 0:Xe.map((he,it)=>i.jsxs("div",{className:"flex flex-col space-y-4 sm:space-y-6 mt-4 sm:mt-0 lg:space-y-4 lg:mt-4 xl:space-y-6 xl:mt-0 justify-center items-start",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Win Rate"}),i.jsx("div",{className:"text-white text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:(he==null?void 0:he.win_complated_rate)==null||isNaN(parseFloat(he==null?void 0:he.win_complated_rate))?"--":(he==null?void 0:he.win_complated_rate)+"%"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Tx Count"}),i.jsx("div",{className:"text-white text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:(he==null?void 0:he.rtx_count)==null||isNaN(parseFloat(he==null?void 0:he.rtx_count))?"--":Ms(he==null?void 0:he.rtx_count)})]})]},it)):i.jsxs("div",{className:"flex flex-col justify-start items-start",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center mt-4 sm:mt-0 lg:mt-4 xl:mt-0 gap-1 sm:gap-2 lg:gap-1 xl:gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Win Rate"}),i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"}),i.jsx("div",{className:"w-36 h-px mt-2 sm:mt-[6px] xl:mt-[8px] mb-[8px] sm:mb-[14px] lg:mb-[8px] xl:mb-[14px] bg-[#353535]"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Trade Count"}),i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})]})]})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4 relative",children:[i.jsxs("div",{className:"flex justify-end items-center gap-0.5 absolute right-1.5 top-1.5 bg-[#272727] w-auto rounded-2xl",children:[i.jsx("div",{onClick:()=>{an("day"),Mt("1D"),localStorage.setItem("discover_period",0)},className:`${Jt==="day"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"1D"})}),i.jsx("div",{onClick:()=>{an("week"),Mt("7D"),localStorage.setItem("discover_period",1)},className:`${Jt==="week"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"7D"})}),i.jsx("div",{onClick:()=>{an("month"),Mt("30D"),localStorage.setItem("discover_period",2)},className:`${Jt==="month"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})}),i.jsx("div",{onClick:()=>{an("threeMonth"),Mt("90D"),localStorage.setItem("discover_period",3)},className:`${Jt==="threeMonth"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"90D"})}),i.jsx("div",{onClick:()=>{an("allTime"),Mt("90D"),localStorage.setItem("discover_period",4)},className:`${Jt==="allTime"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"All"})})]}),i.jsxs("div",{className:`${!(Pt!=null&&Pt.length)>0?"space-y-1.5 sm:space-y-3.5 lg:space-y-1.5 xl:space-y-3.5":"space-y-4 sm:space-y-6 lg:space-y-4 xl:space-y-6"} flex flex-col justify-center items-start mt-4 sm:mt-0 lg:mt-4 xl:mt-0`,children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"PnL"}),Re?i.jsx("div",{className:`${Re.day===0||Re.week===0||Re.month===0||Re.threeMonth===0||Re.all===0?"text-white":Jt==="day"?Re.day>0?"text-[#67FFBD]":Re.day<0?"text-[#FF7173]":"text-white":Jt==="week"?Re.week>0?"text-[#67FFBD]":Re.week<0?"text-[#FF7173]":"text-white":Jt==="month"?Re.month>0?"text-[#67FFBD]":Re.month<0?"text-[#FF7173]":"text-white":Jt==="threeMonth"?Re.threeMonth>0?"text-[#67FFBD]":Re.threeMonth<0?"text-[#FF7173]":"text-white":Jt==="allTime"?Re.all>0?"text-[#67FFBD]":Re.all<0?"text-[#FF7173]":"text-white":"text-white"} text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:(()=>{const he={day:Re.day,week:Re.week,month:Re.month,threeMonth:Re.threeMonth,allTime:Re.all}[Jt];return`$${Ms(Math.abs(he))}`})()}):i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})]}),!(Pt!=null&&Pt.length)>0&&i.jsx("div",{className:"w-36 h-px bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"ROE"}),(Pt==null?void 0:Pt.length)>0?Pt==null?void 0:Pt.map((he,it)=>i.jsx("div",{className:`${(he==null?void 0:he.margin_roi)==null||isNaN(parseFloat(he==null?void 0:he.margin_roi))||(he==null?void 0:he.margin_roi)==0?"text-white":(he==null?void 0:he.margin_roi)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-lg font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:(he==null?void 0:he.margin_roi)==null||isNaN(parseFloat(he==null?void 0:he.margin_roi))?"--":Ms(Math.abs(he==null?void 0:he.margin_roi))+"%"})):i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})]})]})]}),i.jsxs("div",{className:"flex flex-col justify-between items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Direction Bias"}),i.jsx("div",{className:"text-white font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]",children:f?parseFloat(f.marginSummary.totalNtlPos)===0?i.jsx("span",{children:"NEUTRAL"}):a.reduce((he,it)=>he+(it.type==="Long"?parseFloat(it.positionValue):-parseFloat(it.positionValue)),0)>0?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"direction-icon text-[#67FFBD]",children:"↗"}),i.jsx("span",{className:"text-[#67FFBD]",children:"LONG"})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"direction-icon text-[#FF7173]",children:"↘"}),i.jsx("span",{className:"text-[#FF7173]",children:"SHORT"})]}):"-"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-3 w-full",children:[i.jsxs("div",{className:"flex items-center justify-between gap-1 w-full",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px] tracking-[0.18px]",children:"Long Exposure"}),i.jsxs("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px] tracking-[0.18px]",children:[f?(a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2):"-","%"]})]}),i.jsx("div",{className:"w-full h-1 bg-[#414141] rounded-[256px]",children:i.jsx("div",{style:f?{width:`${a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100}%`}:{width:"0%"},className:"h-1 bg-white rounded-[256px]"})})]})]}),i.jsxs("div",{className:"flex flex-col justify-between items-start w-full h-32 bg-[#1c1c1c] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[13px] font-manrope leading-[13px] font-medium tracking-[0.18px]",children:"Position Distribution"}),i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[13px] tracking-[0.18px] text-[18px]",children:i.jsxs("span",{className:"float-right flex gap-3",children:[i.jsxs("span",{className:"text-[#67FFBD]",children:[f?isNaN(a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2):"-","%"]}),i.jsxs("span",{className:"text-[#FF7173]",children:[f?isNaN(a.reduce((he,it)=>it.type==="Short"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?0:(a.reduce((he,it)=>it.type==="Short"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100).toFixed(2):"-","%"]})]})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 w-full",children:[i.jsx("div",{className:"text-white bg-transparent text-xs font-medium font-inter leading-[8px] tracking-[0.18px] w-full",children:i.jsxs("span",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-[#67ffbd]",children:f?rt(a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)):"-"}),i.jsx("span",{className:"text-[#ff787b]",children:f?rt(a.reduce((he,it)=>it.type==="Short"?he+parseFloat(it.positionValue):he,0)):"-"})]})}),i.jsxs("div",{className:"h-1 w-full bg-[#161616] rounded-[256px] flex gap-[2px] overflow-hidden",children:[i.jsx("div",{style:f?isNaN(a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((he,it)=>it.type==="Long"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100}%`}:{width:"0%"},className:"flex justify-center items-center h-1 bg-[#67FFBD] rounded-[256px] text-[#67ffbd] text-[11px] font-bold font-inter leading-[8px] tracking-[0.18px]"}),i.jsx("div",{style:f?isNaN(a.reduce((he,it)=>it.type==="Short"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100)?{width:"0%"}:{width:`${a.reduce((he,it)=>it.type==="Short"?he+parseFloat(it.positionValue):he,0)/parseFloat(f.marginSummary.totalNtlPos)*100}%`}:{width:"0%"},className:"bg-[#FF797C] h-1 rounded-[256px] flex justify-center items-center text-[#67ffbd] text-[11px] font-bold font-inter leading-[8px] tracking-[0.18px]"})]})]})]}),i.jsxs("div",{className:"col-span-2 flex gap-2 w-full",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start flex-[0.7] h-[92px] bg-[#1c1c1c] rounded-2xl p-[11px] relative gap-[14px]",children:[i.jsx("div",{className:"flex flex-col justify-start items-start",children:i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px]",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[10px] font-semibold font-['Manrope'] leading-[13px] tracking-wide uppercase",children:"Avg Leverage"}),i.jsx("div",{className:"text-white text-sm font-semibold font-['Manrope'] leading-[13px] tracking-tight",children:Fn&&Fn!=0?`${parseFloat(Fn).toFixed(2)}x`:"--"})]})}),i.jsx("div",{className:"flex flex-col justify-start items-start",children:i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px]",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[10px] font-semibold font-['Manrope'] leading-[13px] tracking-wide uppercase",children:"Funding"}),i.jsx("div",{className:`${Gn<=0?"text-[#67FFBD]":"text-[#FF7173]"} text-sm font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Gn&&Gn!=0?`$${zv(Math.abs(Gn))}`:"--"})]})})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start flex-[2] h-[92px] bg-[#1c1c1c] rounded-2xl p-1 relative w-full",children:[i.jsx("div",{className:"absolute left-2.5 top-[11px] text-[#9b9b9b] text-[13px] font-medium font-['Manrope'] leading-none tracking-tight",children:"Performance"}),i.jsxs("div",{className:"flex justify-end items-center gap-1 w-auto absolute right-[9px] top-[9px] bg-[#272727] rounded-2xl",children:[i.jsx("div",{onClick:()=>{un("7D"),localStorage.setItem("discover_period",1)},className:`${Kt==="7D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"7D"})}),i.jsx("div",{onClick:()=>{un("30D"),localStorage.setItem("discover_period",2)},className:`${Kt==="30D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"30D"})}),i.jsx("div",{onClick:()=>{un("90D"),localStorage.setItem("discover_period",3)},className:`${Kt==="90D"?"text-[#67FFBD] bg-[rgba(103,255,189,0.16)]":"bg-[#272727] text-[#959595]"} h-[18px] px-1.5 py-[5px] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px]",children:"90D"})})]}),Fe?i.jsxs("div",{className:"flex justify-between items-start gap-1 w-full mt-[43px]",children:[i.jsxs("div",{className:"flex-[0.6] p-1.5 h-[41px] bg-[#2e2e2e] rounded-[10px] flex flex-col items-start justify-center gap-[2px]",children:[i.jsxs("div",{className:"text-[#9b9b9b] text-[10px] font-semibold font-['Manrope'] leading-[13px] tracking-wide uppercase flex justify-start items-center gap-0.5",children:["Sharpe",i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-3 min-w-3 min-h-3 h-3"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:"Sharpe_tooltip",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[80px] min-w-[80px] leading-[16px] -mb-12"})})]})})]}),i.jsx("div",{className:`${(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_sharpe:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_sharpe:Fe==null?void 0:Fe.portfolio_perp_3month_sharpe)>=1&&(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_sharpe:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_sharpe:Fe==null?void 0:Fe.portfolio_perp_3month_sharpe)<=2?"text-[#E5BB18]":(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_sharp:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_sharpe:Fe==null?void 0:Fe.portfolio_perp_3month_sharpe)>2?"text-[#1DE6A3]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Kt==="7D"?(Fe==null?void 0:Fe.portfolio_perp_week_sharpe)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_week_sharpe))?"--":_r(Fe==null?void 0:Fe.portfolio_perp_week_sharpe):Kt==="30D"?(Fe==null?void 0:Fe.portfolio_perp_month_sharpe)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_month_sharpe))?"--":_r(Fe==null?void 0:Fe.portfolio_perp_month_sharpe):(Fe==null?void 0:Fe.portfolio_perp_3month_sharpe)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_3month_sharpe))?"--":_r(Fe==null?void 0:Fe.portfolio_perp_3month_sharpe)})]}),i.jsxs("div",{className:"flex-1 p-1.5 h-[41px] bg-[#2e2e2e] rounded-[10px] flex flex-col items-start justify-center gap-[2px]",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[10px] font-semibold font-['Manrope'] leading-[13px] tracking-wide min-w-max uppercase",children:"Growth Rate"}),i.jsx("div",{className:`${(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_growth_rate:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_growth_rate:Fe==null?void 0:Fe.portfolio_perp_3month_growth_rate)==0?"text-white":(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_growth_rate:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_growth_rate:Fe==null?void 0:Fe.portfolio_perp_3month_growth_rate)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Kt==="7D"?(Fe==null?void 0:Fe.portfolio_perp_week_growth_rate)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_week_growth_rate))?"--":Ms(Fe==null?void 0:Fe.portfolio_perp_week_growth_rate)+"%":Kt==="30D"?(Fe==null?void 0:Fe.portfolio_perp_month_growth_rate)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_month_growth_rate))?"--":Ms(Fe==null?void 0:Fe.portfolio_perp_month_growth_rate)+"%":(Fe==null?void 0:Fe.portfolio_perp_3month_growth_rate)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_3month_growth_rate))?"--":Ms(Fe==null?void 0:Fe.portfolio_perp_3month_growth_rate)+"%"})]}),i.jsxs("div",{className:"flex-[0.9] p-1.5 h-[41px] bg-[#2e2e2e] rounded-[10px] flex flex-col items-start justify-center gap-[2px]",children:[i.jsx("div",{className:"text-[#9b9b9b] text-[10px] font-semibold font-['Manrope'] leading-[13px] tracking-wide uppercase",children:"Drawdown"}),i.jsx("div",{className:`${(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_dd:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_dd:Fe==null?void 0:Fe.portfolio_perp_3month_dd)==0?"text-white":(Kt==="7D"?Fe==null?void 0:Fe.portfolio_perp_week_dd:Kt==="30D"?Fe==null?void 0:Fe.portfolio_perp_month_dd:Fe==null?void 0:Fe.portfolio_perp_3month_dd)>0?"text-[#67FFBD]":"text-[#FF7173]"} text-base font-semibold font-['Manrope'] leading-[13px] tracking-tight`,children:Kt==="7D"?(Fe==null?void 0:Fe.portfolio_perp_week_dd)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_week_dd))?"--":Ms(Math.abs(Fe==null?void 0:Fe.portfolio_perp_week_dd))+"%":Kt==="30D"?(Fe==null?void 0:Fe.portfolio_perp_month_dd)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_month_dd))?"--":Ms(Math.abs(Fe==null?void 0:Fe.portfolio_perp_month_dd))+"%":(Fe==null?void 0:Fe.portfolio_perp_3month_dd)==null||isNaN(parseFloat(Fe==null?void 0:Fe.portfolio_perp_3month_dd))?"--":Ms(Math.abs(Fe==null?void 0:Fe.portfolio_perp_3month_dd))+"%"})]})]}):i.jsx("div",{className:"flex flex-col justify-start items-start mt-[43px] mx-auto",children:i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:"No trades in this period"})})]})]})]})}),i.jsxs("div",{className:"absolute sm:hidden -bottom-8 right-2 z-10 flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:Lt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:kt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-90"})})})]})]}),i.jsx("div",{className:"w-full lg:w-8/12 h-full order-1 lg:order-2",children:i.jsx(Jon,{})})]})]}),i.jsx(IVe,{initialAddress:t})]})]})},Dln=()=>{const t=g2(),e=(t==null?void 0:t.walletAddress.toLowerCase())||"";return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsxs("title",{children:["Explore ",`${e}`," - Hyperliquid Wallet Overview & History - Dextrabot"]}),i.jsx("meta",{name:"description",content:`Explore real-time transactions, holdings, and insights for ${e} on HyperLiquid. Track wallet activity and make data-driven trading decisions.`}),i.jsx("meta",{name:"og:title",content:`Explore ${e} - Hyperliquid Wallet Overview & History - Dextrabot`}),i.jsx("meta",{name:"og:description",content:`Explore real-time transactions, holdings, and insights for ${e} on HyperLiquid. Track wallet activity and make data-driven trading decisions.`}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:`https://app.dextrabot.com/wallet-details/${e}`})]})}),i.jsx("div",{className:"flex justify-center items-start w-full h-screen min-h-max px-2 pt-3 sm:px-6 sm:pt-4 bg-[#161616]",children:i.jsx(Lln,{initialAddress:e})})]})},Bln=({isOpen:t,onClose:e,children:n,zIndex:r=9999,closeOnBackdropClick:s=!0})=>(m.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?Kse.createPortal(i.jsxs("div",{className:"fixed inset-0 flex justify-center items-center pointer-events-auto",style:{zIndex:r},children:[i.jsx("div",{onClick:s?e:void 0,className:"absolute inset-0 bg-black bg-opacity-50 backdrop-blur-sm transition-opacity duration-300"}),i.jsx("div",{className:"relative bg-[#252525] rounded-3xl shadow-lg w-[400px] max-w-full pointer-events-auto",children:n})]}),document.body):null);function $ln(){const{signModalOpen:t,setSignModalOpen:e,signIn:n,hyperToken:r,walletLogin:s}=m.useContext(Qr),{isConnected:a}=ns(),{openConnectModal:o}=D5(),l=typeof window<"u"&&window.matchMedia("(max-width:640px)").matches,c=()=>{window.localStorage.getItem("hyperToken")&&r?s():(n(1),e(!1))};return i.jsx(Bln,{isOpen:t,onClose:()=>e(!1),children:i.jsxs("div",{className:"flex flex-col items-center gap-8 w-[400px] bg-[#252525] rounded-3xl py-4 relative pointer-events-auto",children:[i.jsx("span",{onClick:()=>e(!1),className:"absolute top-2 right-2 w-9 h-9 rounded-full flex items-center justify-center hover:bg-[#7535FE] cursor-pointer",children:i.jsx("img",{src:Ua,alt:"close",className:"p-1"})}),i.jsx("img",{src:Yi,alt:"dextrabot",className:"w-[86px] h-[86px] mt-4"}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("div",{className:"text-white text-[32px] leading-none",children:"Welcome Dextrabot"}),i.jsx("div",{className:"text-white/60 text-sm leading-none",children:l?"Scan the QR code to continue":"Connect your wallet to continue"})]}),i.jsx("div",{className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer text-center",children:a?l?i.jsx(D_,{}):i.jsx("div",{onClick:c,className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer",children:i.jsx("span",{className:"text-white text-sm leading-none",children:"Wallet Sign‑in"})}):l?i.jsx("div",{className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl",children:i.jsx("span",{className:"text-white text-sm leading-none",children:i.jsx(D_,{})})}):i.jsx("div",{onClick:o,className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer",children:i.jsx("div",{className:"text-center text-white text-sm font-manrope leading-none",children:"Connect Wallet"})})}),i.jsxs("div",{className:"text-center pt-2",children:[i.jsx("span",{className:"text-white/60 text-xs",children:"Do you need support? "}),i.jsx("span",{onClick:()=>window.open("https://discord.gg/dextrabot","_blank"),className:"text-[#b593ff] text-xs cursor-pointer",children:"Join Discord"})]})]})})}const Vl=()=>i.jsxs("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:[i.jsx("div",{className:"p-4 bg-[#ff356629] rounded-full",children:i.jsx("img",{src:hlt,alt:"",className:"w-8 h-8"})}),i.jsxs("div",{className:"flex flex-col items-center justify-center gap-1",children:[i.jsx("div",{className:"text-[#FF3566]",children:"Error"}),i.jsxs("div",{className:"text-[#767676]",children:["We encountered a problem"," ",i.jsxs("span",{children:["wait a",i.jsx("br",{})," moment before try again"]})]})]})]}),Uln=({data:t,loading:e,error:n,trackerData:r,isRequest:s,setIsRequest:a})=>{var xe;const{trackedWatchList:o,getTrackedWatchList:l,setSignModalOpen:c}=m.useContext(Qr),{isConnected:u,address:d}=ns(),[f,x]=m.useState(!1),[g,y]=m.useState(null),[v,C]=m.useState(null),[N,P]=m.useState(""),[T,M]=m.useState([]),[F,$]=m.useState(!1),[L,z]=m.useState({}),X="-tag",[ne,J]=m.useState(X),K=be=>r.sort((je,Ie)=>{const Re=T.find(ht=>ht.wallet_address===je.wallet_address)||{},Qe=T.find(ht=>ht.wallet_address===Ie.wallet_address)||{},Ke=Re.data?Re.data.reduce((ht,pt)=>ht+parseFloat(pt.unrealizedPnl||0),0):Re.unrealizedPnl||0,dt=Qe.data?Qe.data.reduce((ht,pt)=>ht+parseFloat(pt.unrealizedPnl||0),0):Qe.unrealizedPnl||0,tt=je.tag?je.tag.toUpperCase():"",nt=Ie.tag?Ie.tag.toUpperCase():"",Le=je.wallet_address?je.wallet_address.toLowerCase():"",Be=Ie.wallet_address?Ie.wallet_address.toLowerCase():"";return be==="tag"?tt<nt?-1:tt>nt?1:0:be==="-tag"?tt>nt?-1:tt<nt?1:0:be==="-wallet_address"?Le<Be?-1:Le>Be?1:0:be==="wallet_address"?Le>Be?-1:Le<Be?1:0:be==="perp_equity"?(Re.perp_equity||0)-(Qe.perp_equity||0):be==="-perp_equity"?(Qe.perp_equity||0)-(Re.perp_equity||0):be==="margin_usage"?(Re.margin_usage||0)-(Qe.margin_usage||0):be==="-margin_usage"?(Qe.margin_usage||0)-(Re.margin_usage||0):be==="unrealizedPnl"?Ke-dt:be==="-unrealizedPnl"?dt-Ke:be==="-expire_date"?new Date(Ie.expire_date)-new Date(je.expire_date):be==="expire_date"?new Date(je.expire_date)-new Date(Ie.expire_date):0}),te=async({walletAddress:be,isFollow:je,isScalper:Ie})=>{try{P(be);const Re=window.localStorage.getItem("hyperToken"),Qe=window.localStorage.getItem("hyperAddress");if(!Re){c(!0);return}const Ke=je?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",dt=je?{address:d?d.toLowerCase():Qe,token:Re,follow_address:be.toLowerCase()}:{address:d?d.toLowerCase():Qe,token:Re},tt=await fetch(Ke,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(dt)});if(!tt.ok)throw new Vl(`Server responded with status ${tt.status}`);const nt=await tt.json();nt.success?(y(Array.isArray(nt==null?void 0:nt.data)?[...nt.data].sort((Le,Be)=>new Date(Be.created_at||0)-new Date(Le.created_at||0)):nt==null?void 0:nt.data),C(Ie),x(!0)):(console.log(nt.error_message),tn.error(nt.error_message))}catch(Re){console.error("Error in like function:",Re),tn.error(Re.message||"Something went wrong!")}},fe=be=>be!=null&&be.assetPositions?be.assetPositions.filter(je=>{if(!je.position||!je.position.szi)return!1;const Ie=parseFloat(je.position.szi);return!isNaN(Ie)&&Ie!==0}).map(je=>{const Ie=je.position,Re=parseFloat(Ie.szi),Qe=parseFloat(Ie.entryPx),Ke=parseFloat(Ie.positionValue),dt=parseFloat(Ie.unrealizedPnl),tt=parseFloat(Ie.returnOnEquity)*100,nt=parseFloat(Ie.marginUsed),Le=Ie.leverage.value,Be=parseFloat(Ie.cumFunding.sinceOpen),ht=Re>0?"Long":"Short";return{asset:Ie.coin,type:ht,size:Math.abs(Re),entryPrice:Qe.toFixed(2),currentPrice:(Ke/Math.abs(Re)).toFixed(2),leverage:Le,positionValue:Ke.toFixed(2),marginUsed:nt.toFixed(2),unrealizedPnl:dt.toFixed(2),roe:tt.toFixed(2),funding:Be.toFixed(4),liquidationPrice:Ie.liquidationPx?parseFloat(Ie.liquidationPx).toFixed(2):"N/A"}}):[],q=async be=>{try{const Ie=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:be});if(Ie.data){const Re=fe(Ie.data);M(Qe=>{var Ke,dt,tt,nt;return[...Qe,{wallet_address:be,perp_equity:(dt=(Ke=Ie==null?void 0:Ie.data)==null?void 0:Ke.marginSummary)==null?void 0:dt.accountValue,margin_usage:parseFloat((tt=Ie==null?void 0:Ie.data)==null?void 0:tt.marginSummary.totalMarginUsed)/parseFloat((nt=Ie==null?void 0:Ie.data)==null?void 0:nt.marginSummary.accountValue),data:Re}]})}}catch(je){console.error("Error fetching user state from HyperState:",je)}},se=async be=>{try{const je=window.localStorage.getItem("hyperToken"),Ie="https://dextrabothypev2.nftinit.io/api/hyper/tracker/getclearinghousestate/",Re=window.localStorage.getItem("hyperAddress"),Qe=await fetch(Ie,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():Re,token:je,follow_address:be})});if(Qe.ok){const Ke=await Qe.json();if(Ke.success){const dt=fe(Ke==null?void 0:Ke.data);M(tt=>{var nt;return[...tt,{wallet_address:be,perp_equity:(nt=Ke==null?void 0:Ke.data.marginSummary)==null?void 0:nt.accountValue,margin_usage:parseFloat(Ke==null?void 0:Ke.data.marginSummary.totalMarginUsed)/parseFloat(Ke==null?void 0:Ke.data.marginSummary.accountValue),data:dt}]})}}else if(Qe.status===500)console.warn(`Received 500 error for ${be}, retrying with getUserHyperState`),await q(be);else throw new Vl(`Request failed with status ${Qe.status}`)}catch(je){console.error("Error fetching user state:",je)}},ae=m.useRef(!1);m.useEffect(()=>{!e&&s&&!ae.current&&(ae.current=!0,(async()=>{for(let je=0;je<r.length;je++){const Ie=r[je];se(Ie==null?void 0:Ie.wallet_address.toLowerCase()).catch(Re=>{console.error(`Error fetching user state for wallet ${Ie.wallet_address}:`,Re)}),await new Promise(Re=>setTimeout(Re,500))}})())},[s,e,r]);const W=async(be,je)=>{try{const Ie=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/hyper/tracker/extend_tracker_expiry/";if(!Ie||!be||!je)return;z(tt=>({...tt,[je]:!0}));const Qe=window.localStorage.getItem("hyperAddress"),Ke=await fetch(Re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d==null?void 0:d.toLowerCase():Qe,token:Ie,tracker_id:be})});if(!Ke.ok)throw new Vl(`Failed to unlike: ${Ke.status} ${Ke.statusText}`);const dt=await Ke.json();dt.success?(z(tt=>({...tt,[je]:!1})),l(),tn.success(`${je.slice(0,5)}...${je.slice(-3)} Tracker successfully renewed`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",minWidth:"400px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):(tn.error(dt.error_message),z(tt=>({...tt,[je]:!1})))}catch(Ie){tn.error(Ie.message||"Something went wrong!"),z(Re=>({...Re,[je]:!1}))}},V=m.useRef(null),ee=()=>{V.current&&(V.current.scrollLeft-=100)},oe=()=>{V.current&&(V.current.scrollLeft+=100)},de=()=>{V.current&&(V.current.scrollTop+=200)},Ce=()=>{V.current&&(V.current.scrollTop-=200)},me=be=>{const je=new Date(be),Ie=new Date,Re=new Date(je.getFullYear(),je.getMonth(),je.getDate()),Qe=new Date(Ie.getFullYear(),Ie.getMonth(),Ie.getDate());return(Re-Qe)/(1e3*60*60*24)<=3},we=be=>be>=640&&be<1024?5:be>=1024&&be<1240?6:be>=1240&&be<1540||be>=1540?7:3;return i.jsxs(i.Fragment,{children:[i.jsx($5,{open:f,setOpen:x,copyTradeData:g,copyTradeWallet:N,setCopyTradeWallet:P,isScalper:v,setCopyTradeData:y}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white bg-[#161616] w-full h-full font-manrope",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 font-manrope max-w-full w-full bg-[#161616] pl-2 sm:pl-0 pt-4",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px]",children:"Tracked Wallets"})})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute hidden -top-6 right-4 z-10 lg:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:ee,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:oe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:Ce,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:de,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full max-w-[1260px] h-full overflow-x-scroll relative overflow-y-scroll flex-grow",ref:V,children:i.jsxs("table",{className:"w-full relative mb-20",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[130px] sm:min-w-[130px] z-[8]",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max sticky left-0 h-8",children:i.jsx("div",{className:"flex items-center justify-start",children:"Actions"})})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[130px] h-10 px-1 min-w-[130px] sm:min-w-[150px] z-[8]",children:i.jsx(mi,{title:"Tag",sortKey:"tag",sortOption:ne,setSortOption:J,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] left-[260px] sm:left-[280px] h-10 px-1 min-w-[135px] sm:min-w-[195px] z-[8]",children:i.jsx(mi,{title:"Wallet",sortKey:"wallet_address",sortOption:ne,setSortOption:J,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[140px] sm:min-w-[130px] px-1",children:i.jsx(mi,{title:"Perp Equity",sortKey:"perp_equity",sortOption:ne,setSortOption:J,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[144px] px-1",children:i.jsx(mi,{title:"Margin Usage",sortKey:"margin_usage",sortOption:ne,setSortOption:J,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[120px] sm:min-w-[150px] px-1",children:i.jsx(mi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:ne,setSortOption:J,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-max pl-6 sm:pl-12 pr-1",children:i.jsxs("div",{className:"flex justify-end items-center w-full gap-1",children:[i.jsx("div",{className:"flex justify-end items-center gap-1 w-full",children:i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:"Trackers stay active for 15 days. If not renewed, they will automatically stop after that period.",positionTop:!1,alignRight:!1,tooltipCss:"max-w-[200px] min-w-[200px] leading-[16px] -mb-[52px]"})})]})}),i.jsx(mi,{title:"Expire Date",sortKey:"expire_date",sortOption:ne,setSortOption:J,isFilterIcon:!0})]})}),i.jsx("th",{scope:"col",className:"min-w-max pl-1 pr-4",children:i.jsx("div",{className:"flex justify-end items-center w-full gap-1"})})]})}),i.jsx("tbody",{children:!r||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(window.innerWidth),className:"h-[30vh]",children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-16 ml-[45%] w-max",children:i.jsx($a,{})})})}):n&&!r?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(window.innerWidth),className:"h-[30vh]",children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center ml-[33%] w-max",children:i.jsx(Vl,{})})})}):(r==null?void 0:r.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:we(window.innerWidth),className:"h-[30vh]",children:i.jsx("div",{className:"flex min-h-[44vh] h-66 flex-col justify-center items-center ml-[33%] w-max",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You have not yet added a wallet to your follow list."}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Please visit the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Discover Wallets'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","page to follow wallets."]})]})]})]})})})})}):(xe=K(ne))==null?void 0:xe.map((be,je)=>{var Re,Qe;const Ie=T.find(Ke=>Ke.wallet_address===be.wallet_address);return i.jsxs("tr",{className:`${je%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${je%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{onClick:Ke=>{Ke.preventDefault();const dt=t==null?void 0:t.some(tt=>tt.wallet_address===(be==null?void 0:be.wallet_address));te({walletAddress:be==null?void 0:be.wallet_address,isFollow:dt,isScalper:be==null?void 0:be.is_scalper})},className:`${t!=null&&t.some(Ke=>Ke.wallet_address===(be==null?void 0:be.wallet_address))?"bg-[#67ffbd] text-[#161616] font-semibold":"border border-[#67ffbd] bg-[#161616] text-[#67ffbd] hover:bg-[#67ffbd] hover:text-[#161616] font-bold"} h-[22px] rounded-[256px] justify-center items-center gap-1 inline-flex cursor-pointer text-xs font-['Manrope'] leading-[8px] tracking-tight px-2 min-w-max`,children:"Copy Trade"}),i.jsx(B5,{walletAddress:be==null?void 0:be.wallet_address,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:o.some(Ke=>Ke.wallet_address===(be==null?void 0:be.wallet_address))?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${je%2===0,"bg-[#161616]"} sm:sticky sm:left-[130px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5 has-tooltip relative",children:[i.jsx(ua,{info1:be!=null&&be.tag?(be==null?void 0:be.tag.length)>=13?(be==null?void 0:be.tag).slice(0,13)+"...":be==null?void 0:be.tag:"--",info1_Color:"text-white",rowTwo:!1}),(be==null?void 0:be.tag)&&(be==null?void 0:be.tag.length)>=13&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ma,{content:`${be==null?void 0:be.tag}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${je%2===0,"bg-[#161616]"} sm:sticky sm:left-[280px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${be==null?void 0:be.wallet_address}`,"_blank")},className:"cursor-pointer group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:[i.jsx("div",{className:"fle justify-center items-center",children:i.jsx("div",{className:"w-4 h-4 sm:w-8 sm:h-8 bg-[#4a4a4a] rounded-full",children:i.jsx("img",{src:Yi,alt:"dextra",className:"w-4 h-4 sm:w-8 sm:h-8",loading:"lazy",onError:Ke=>{Ke.target.onerror=null,Ke.target.src="https://app.dextrabot.com/dextrabotIcon.png"}})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(be==null?void 0:be.wallet_address).slice(0,5)+"..."+(be==null?void 0:be.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Ke=>{Ke.stopPropagation(),navigator.clipboard.writeText(be==null?void 0:be.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"pr-1",children:F?i.jsx(l0,{info:"Loading...",textColor:"text-white"}):Ie?i.jsx(l0,{info:(Ie==null?void 0:Ie.perp_equity)!=0?`$${_r(Ie==null?void 0:Ie.perp_equity)}`:"$0",textColor:"text-white"}):i.jsx(l0,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{className:"pr-1",children:F?i.jsx(l0,{info:"Loading...",textColor:"text-white"}):Ie?i.jsx(l0,{info:isNaN(Ie==null?void 0:Ie.margin_usage)?"0%":`${((Ie==null?void 0:Ie.margin_usage)*100).toFixed(2)}%`,textColor:"text-white"}):i.jsx(l0,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{className:"pr-1",children:F?i.jsx(l0,{info:"Loading...",textColor:"text-white"}):Ie?i.jsx(l0,{info:(Ie==null?void 0:Ie.data)!=0?`$${_r(Math.abs((Re=Ie==null?void 0:Ie.data)==null?void 0:Re.reduce((Ke,dt)=>Ke+parseFloat(dt.unrealizedPnl||0),0)))}`:"$0",textColor:`${((Qe=Ie==null?void 0:Ie.data)==null?void 0:Qe.reduce((Ke,dt)=>Ke+parseFloat(dt.unrealizedPnl),0))>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`}):i.jsx(l0,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{className:"pr-1 min-w-max pl-6 sm:pl-12",children:i.jsxs("div",{className:"flex justify-end items-center gap-0.5 min-w-max",children:[me(be==null?void 0:be.expire_date)&&i.jsxs("div",{className:"flex justify-end items-center has-tooltip relative min-w-max",children:[i.jsx("img",{src:Zlt,alt:"",className:"w-[14px] min-w-[14px] min-h-[14px] h-[14px]"}),i.jsx("span",{className:"",children:i.jsx(oo,{content:`This tracker will expire on ${O3(be==null?void 0:be.expire_date)}. Click ‘Renew’ to keep it active.`,positionTop:!1,alignRight:!1,tooltipCss:"max-w-[210px] min-w-[210px] leading-[16px] -mb-[36px]"})})]}),i.jsx(l0,{info:be!=null&&be.expire_date?O3(be==null?void 0:be.expire_date):"--",textColor:"text-white"})]})}),i.jsx("td",{className:"pr-4 min-w-max pl-1",children:i.jsx("div",{className:"flex justify-end items-center gap-0.5 min-w-max",children:me(be==null?void 0:be.expire_date)&&(L[be==null?void 0:be.wallet_address]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[67px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-[14px] h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsxs("div",{onClick:()=>{W(be==null?void 0:be.id,be==null?void 0:be.wallet_address)},className:"h-[21px] px-1 py-1.5 bg-[#ffaa47]/20 hover:bg-[#ffaa47]/30 rounded-md flex justify-start items-center gap-1 cursor-pointer ml-[6px]",children:[i.jsx("img",{src:Jlt,alt:""}),i.jsx("div",{className:"justify-start text-[#ffaa46] text-[11px] font-semibold font-['Manrope'] leading-[8px]",children:"Renew"})]}))})})]},je)})})]})})]})]})]})},l0=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5`,children:t})}),fz=()=>{const{isConnected:t}=ns(),{openConnectModal:e}=D5(),{walletLogin:n,signIn:r}=m.useContext(Qr),s=typeof window<"u"&&window.matchMedia("(max-width: 640px)").matches,a=()=>{window.localStorage.getItem("hyperToken")?n():r(1)};return i.jsxs("div",{className:"flex flex-col justify-center items-center gap-8 w-[400px] h-max bg-[#252525] rounded-3xl py-4 font-manrope",children:[i.jsx("img",{src:Yi,alt:"",className:"w-[86px] h-[86px] mt-4"}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx("div",{className:"text-white text-[32px] leading-none",children:"Welcome Dextrabot"}),i.jsx("div",{className:"text-white/60 text-sm leading-none",children:s?"Scan the QR code to continue":"Connect your wallet to continue"})]}),i.jsx("div",{className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer my-10 text-center",children:t?s?i.jsx(D_,{}):i.jsx("div",{onClick:a,className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer",children:i.jsx("span",{className:"text-white text-sm leading-none",children:"Wallet Sign‑in"})}):i.jsx("div",{onClick:()=>s?null:e(),className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer",children:i.jsx("span",{className:"text-white text-sm leading-none",children:s?i.jsx(D_,{}):"Connect Wallet"})})}),i.jsxs("div",{className:"text-center pt-2",children:[i.jsx("span",{className:"text-white/60 text-xs",children:"Do you need support? "}),i.jsx("span",{className:"text-[#b593ff] text-xs cursor-not-allowed",children:"Join Discord"})]})]})},zln=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState(!1);ns();const{hyperToken:s,copyTradeWatchList:a,getCopyTradeWatchList:o,trackedWatchList:l,setTrackedWatchList:c,getTrackedWatchList:u,trackedWatchListLoading:d,trackedWatchListError:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setMushboomerSOL:C,setIsReferralCode:N,setIsReferralCodeName:P,setIsWhitelist:T,setHyperToken:M,setHyperAddress:F}=m.useContext(Qr);return m.useEffect(()=>{!n&&window.localStorage.getItem("hyperToken")&&(o(),u(),e(!0),r(!0))},[n,s]),m.useEffect(()=>{(async()=>{var X,ne;const L=window.localStorage.getItem("hyperToken"),z=window.localStorage.getItem("hyperAddress");if(!(!L||!z))try{const J=await ki(z,L);J!=null&&J.success?(x(J==null?void 0:J.telegram_chat_id),g(J==null?void 0:J.subscriber_role),y(J==null?void 0:J.subs_expire_day),v((X=J==null?void 0:J.mushboomer_counts)==null?void 0:X.eth),C((ne=J==null?void 0:J.mushboomer_counts)==null?void 0:ne.sol),N(J==null?void 0:J.referral_code),P(J==null?void 0:J.refcode),T(J==null?void 0:J.whitelist),M(L),F(z)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),M(""),F(""))}catch(J){console.error("Token verification error:",J),console.error(J.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Track & Follow Your Favorite Hyperliquids Wallets - Dextrabot"}),i.jsx("meta",{name:"description",content:"Track and follow your favorite HyperLiquid wallets with DextraBot. Get real-time updates on their transactions and trading activity to make smarter moves."}),i.jsx("meta",{name:"og:title",content:"Track & Follow Your Favorite Hyperliquids Wallets - Dextrabot"}),i.jsx("meta",{name:"og:description",content:"Track and follow your favorite HyperLiquid wallets with DextraBot. Get real-time updates on their transactions and trading activity to make smarter moves."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/tracked-wallets"})]})}),i.jsx("div",{style:{height:"calc(100vh - 5rem)"},className:"flex justify-center items-center w-full h-full px-1 pt-1 sm:px-6 sm:pt-6 bg-[#161616] overflow-hidden",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full xl:w-max flex-grow xl:flex-grow-0",children:window.localStorage.getItem("hyperToken")?i.jsx(Uln,{data:a,loading:d,error:f,trackerData:l,isRequest:t,setIsRequest:e}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(fz,{})})})})]})},Hln=()=>{m.useRef([]);const t=m.useRef(null),{isConnected:e,address:n}=ns(),{setSignModalOpen:r,trackedWatchList:s,hyperToken:a}=m.useContext(Qr),o=m.useRef(a),[l,c]=m.useState(!1),d=localStorage.getItem("isDateTrackedWalletsFormat")||"date",[f,x]=m.useState(d);m.useEffect(()=>{localStorage.setItem("isDateTrackedWalletsFormat",f)},[f]);const[g,y]=m.useState([]);function v(L){const z={};return L.forEach(ne=>{const{oid:J,px:K,dir:te,side:fe,crossed:q,feeToken:se,listen_user:ae,cloid:W,coin:V,subs_address:ee,sz:oe,closedPnl:de,fee:Ce,time:me,startPosition:we,insert_date:xe,hash:be}=ne;z[J]||(z[J]={oid:J,px:K,dir:te,side:fe,crossed:q,feeToken:se,listen_user:ae,cloid:W,coin:V,subs_address:ee,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:me,earliestStartPosition:we,insertDate:xe,hashes:[],hasZeroStartPosition:!1}),parseFloat(we)===0&&(z[J].hasZeroStartPosition=!0),z[J].hasZeroStartPosition?z[J].totalStartPositions=0:z[J].totalStartPositions+=parseFloat(we),z[J].totalSize+=parseFloat(oe),z[J].totalClosedPnl+=parseFloat(de),z[J].totalFee+=parseFloat(Ce),new Date(me)>new Date(z[J].closestTime)&&(z[J].closestTime=me),new Date(me)>new Date(z[J].insertDate)&&(z[J].insertDate=xe),new Date(me)<new Date(z[J].closestTime)&&(z[J].earliestStartPosition=we),z[J].hashes.push(be)}),Object.keys(z).map(ne=>({oid:ne,...z[ne]}))}async function C(){const L=window.localStorage.getItem("hyperToken");try{c(!0);const z="https://dextrabothypev2.nftinit.io/api/hyper/feed/",X=window.localStorage.getItem("hyperAddress");L||r(!0);const ne=await fetch(z,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():X,token:L,offset:0})});if(!ne.ok)throw new Error(`Server responded with status ${ne.status}`);const J=await ne.json();if(J.success){const K=v(J==null?void 0:J.data);y(K)}else console.log(J.error_message)}catch(z){console.log("Error :>> ",z),c(!1)}finally{c(!1)}}m.useEffect(()=>{C()},[window.localStorage.getItem("hyperToken")]);function N(L,z){const X={};return L.forEach(ne=>{X[ne.oid]={...ne}}),z.forEach(ne=>{const{oid:J,px:K,dir:te,side:fe,crossed:q,feeToken:se,listen_user:ae,cloid:W,coin:V,subs_address:ee,sz:oe,closedPnl:de,fee:Ce,time:me,startPosition:we,insert_date:xe,hash:be}=ne;X[J]||(X[J]={oid:J,px:K,dir:te,side:fe,crossed:q,feeToken:se,listen_user:ae,cloid:W,coin:V,subs_address:ee,totalSize:0,totalStartPositions:0,totalClosedPnl:0,totalFee:0,closestTime:me,earliestStartPosition:we,insertDate:xe,hashes:[],hasZeroStartPosition:!1}),parseFloat(we)===0&&(X[J].hasZeroStartPosition=!0),X[J].hasZeroStartPosition?X[J].totalStartPositions=0:X[J].totalStartPositions+=parseFloat(we),X[J].totalSize+=parseFloat(oe),X[J].totalClosedPnl+=parseFloat(de),X[J].totalFee+=parseFloat(Ce),new Date(me)>new Date(X[J].closestTime)&&(X[J].closestTime=me),new Date(me)>new Date(X[J].insertDate)&&(X[J].insertDate=xe),new Date(me)<new Date(X[J].closestTime)&&(X[J].earliestStartPosition=we),X[J].hashes.push(be)}),Object.values(X).sort((ne,J)=>new Date(J.closestTime)-new Date(ne.closestTime))}const P=m.useRef(!1),T=m.useRef(n),M=m.useRef(s);m.useEffect(()=>{T.current=n},[n]),m.useEffect(()=>{o.current=a},[a]),m.useEffect(()=>{M.current=s},[s]);const F="hyper_get_message";m.useEffect(()=>{if(!a||P.current)return;const L=Dy("https://dextrabothypesocketv2.nftinit.io/");return t.current=L,P.current=!0,t.current.on("connect",()=>{console.log("Socket connected");const z=()=>{var J;const X=(J=T.current)==null?void 0:J.toLowerCase(),ne=o.current;X&&ne?L.emit("subscribe",{login:X,token:ne}):setTimeout(z,300)};z()}),t.current.on(F,function(z){if(z){const X=Array.isArray(z)?z:[z];y(ne=>{const J=N([],X);let K=ne.filter(q=>X.some(se=>se.oid===q.oid)),te=[];K.length>0?te=N(J,K):te=J;const fe=ne.filter(q=>!X.some(se=>se.oid===q.oid));return[...te,...fe]})}}),t.current.io.on("reconnect_attempt",z=>{console.log("reconnect_attempt",z)}),t.current.io.on("reconnect",z=>{console.log("reconnect",z),t.current.emit("room",F)}),t.current.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),t.current.io.on("reconnect_error",z=>{console.log("reconnect_error",z)}),t.current.io.on("error",z=>{console.log("error",z)}),t.current.on("disconnect",()=>{console.log("Socket disconnected"),P.current=!1}),()=>{t.current.disconnect(),console.log("Socket cleanup on unmount")}},[a]);function $({date:L}){const[z,X]=m.useState($o(L));return m.useEffect(()=>{const ne=setInterval(()=>{X($o(L))},1e3);return()=>clearInterval(ne)},[L]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:z.dateTime})}return i.jsx("div",{className:"flex flex-col items-start justify-start mt-4 overflow-scroll max-h-full",children:!g||g.length==0?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] min-w-[880px] max-w-[700px] justify-center items-center text-center mt-44",children:l?i.jsx($a,{}):i.jsx("div",{className:"flex justify-center items-center min-w-[480px]",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 min-w-max overflow-x-hidden",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"The activities of the favorited wallets will be displayed on this page."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Feed page includes the activities occur after a wallet is favorited."," "]})})]})]})})})}):i.jsx("ul",{className:"flex flex-col items-start justify-start gap-1",children:Array.isArray(g)&&g.slice(0,250).map(L=>{var z,X,ne,J,K,te,fe;return i.jsx("li",{children:i.jsxs("div",{className:"flex justify-start items-start gap-[11px]",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start h-full",children:[i.jsx("div",{className:`${(z=L==null?void 0:L.dir)!=null&&z.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?"bg-[#67ffbd]/20":(L==null?void 0:L.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(L==null?void 0:L.dir)=="Buy"?"bg-[#67ffbd]/20":"bg-[#ff797c]/20"} flex justify-center items-center w-6 h-6 rounded-full`,children:i.jsx("div",{className:"w-3 h-3 relative",children:(X=L==null?void 0:L.dir)!=null&&X.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"flex justify-center w-6",children:i.jsx("div",{className:"w-[1px] min-h-[123px] h-full border border-[#242424]"})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[6px] min-w-[640px] w-full h-[138px] min-h-[138px] rounded-[18px] border border-[#232323] p-2",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full px-1",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full",children:i.jsx("img",{src:Yi,alt:"",className:"w-8 h-8"})}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] ",children:[i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${L==null?void 0:L.listen_user}`,"_blank")},className:"flex justify-start items-center gap-1.5 cursor-pointer",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-none",children:(L==null?void 0:L.listen_user)&&((ne=L==null?void 0:L.listen_user)==null?void 0:ne.slice(0,5))+"..."+((J=L==null?void 0:L.listen_user)==null?void 0:J.slice(-4))}),i.jsx("img",{onClick:q=>{q.stopPropagation(),navigator.clipboard.writeText(L==null?void 0:L.listen_user),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:[i.jsxs("span",{className:"text-white text-[11px] font-normal font-['Manrope'] leading-[13px] tracking-tight min-w-max ml-[1px]",children:["Order ID:"," ",i.jsx("span",{className:"text-[#a5a5a5]",children:(L==null?void 0:L.oid)&&(L==null?void 0:L.oid)})]}),i.jsx("span",{onClick:q=>{q.stopPropagation(),navigator.clipboard.writeText(L==null?void 0:L.oid),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"cursor-pointer pr-0.5",children:i.jsx("img",{src:Eo,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})]})]})]}),i.jsxs("div",{className:"flex flex-col items-end justify-start gap-[2px] w-full pl-2 pt-2",children:[i.jsx("div",{onClick:()=>{x(f=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:f=="time"?i.jsx($,{date:L==null?void 0:L.closestTime}):cu(L==null?void 0:L.closestTime)}),i.jsxs("div",{className:"flex justify-start items-center gap-2 -m-[2px]",children:[i.jsxs("div",{children:[i.jsxs("span",{className:"text-[#9b9b9b] text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:["opened a new"," ",(L==null?void 0:L.dir)=="Sell"?"spot sell":(L==null?void 0:L.dir)=="Buy"?"spot buy":(K=L==null?void 0:L.dir)==null?void 0:K.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[L==null?void 0:L.coin,"/",L==null?void 0:L.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${L==null?void 0:L.coin}.svg`||qa,alt:L==null?void 0:L.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:q=>oa(q)})})]})]})]}),i.jsx("div",{className:"w-full min-w-[850px] h-[72px] min-h-[72px] bg-[#232323] rounded-xl border border-[#353535] pt-4 pl-4",children:i.jsxs("div",{className:"flex justify-start items-center gap-4 overflow-x-scroll scroll-smooth",children:[i.jsxs("div",{className:"sticky left-0 z-[8] bg-[#232323] flex justify-start items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide",children:"Asset"}),i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${L==null?void 0:L.coin}.svg`||qa,alt:L==null?void 0:L.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:q=>oa(q)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[L==null?void 0:L.coin,"/",L==null?void 0:L.feeToken]})]})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide",children:"Direction"}),i.jsx("div",{className:"flex justify-start items-center",children:i.jsxs("div",{className:`${(te=L==null?void 0:L.dir)!=null&&te.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(L==null?void 0:L.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(L==null?void 0:L.dir)=="Buy"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex min-w-max`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:(fe=L==null?void 0:L.dir)!=null&&fe.includes("Long")?(L==null?void 0:L.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(L==null?void 0:L.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:(L==null?void 0:L.dir)=="Sell"?"Sell":(L==null?void 0:L.dir)=="Buy"?"Buy":(L==null?void 0:L.dir)=="Close Short"?"Short":(L==null?void 0:L.dir)=="Close Long"?"Long":(L==null?void 0:L.dir)=="Open Short"?"Short":(L==null?void 0:L.dir)=="Open Long"?"Long":L==null?void 0:L.dir})]})})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"Type",value:(L==null?void 0:L.totalStartPositions)==0?"Open Position":(L==null?void 0:L.dir)!="Short > Long"&&(L==null?void 0:L.dir)!="Long > Short"?(L==null?void 0:L.totalSize)-Math.abs(L==null?void 0:L.totalStartPositions)==0&&((L==null?void 0:L.dir)=="Close Long"||(L==null?void 0:L.dir)=="Close Short")?"Position Closed":(L==null?void 0:L.dir)=="Open Short"||(L==null?void 0:L.dir)=="Open Long"?"Increase":(L==null?void 0:L.dir)=="Close Long"||(L==null?void 0:L.dir)=="Close Short"?"Decrease":(L==null?void 0:L.dir)=="Sell"||(L==null?void 0:L.dir)=="Buy"?"Spot":"Changed Position":(L==null?void 0:L.dir)=="Short > Long"||(L==null?void 0:L.dir)=="Long > Short"?"Changed Position":"Open Position",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"Price",value:_r(L==null?void 0:L.px),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"Size",value:_r(L==null?void 0:L.totalSize),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"PnL",value:L!=null&&L.totalClosedPnl?`$${_r(Math.abs(L==null?void 0:L.totalClosedPnl))}`:_r(Math.abs(L==null?void 0:L.totalClosedPnl)),color:`${(L==null?void 0:L.totalClosedPnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"Fee",value:L!=null&&L.totalFee?`$${_r(Math.abs(L==null?void 0:L.totalFee))}`:_r(Math.abs(L==null?void 0:L.totalFee)),color:`${(L==null?void 0:L.totalFee)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(kC,{title:"Margin Mode",value:L!=null&&L.crossed?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})]})]})},L.oid)})})})},kC=({title:t,value:e,color:n})=>i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1 min-w-max",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide min-w-max",children:t}),i.jsx("div",{className:"flex justify-start items-center min-w-max",children:i.jsx("div",{className:`${n} text-sm font-semibold font-manrope leading-[13px] tracking-tight min-w-max`,children:e})})]}),Vln="https://dextrabothypesocketv2.nftinit.io/";function Wln(){var X,ne;const{isConnected:t,address:e}=ns(),{setSignModalOpen:n,trackedWatchList:r,hyperToken:s}=m.useContext(Qr),a=m.useRef(null),[o,l]=m.useState([]),[c,u]=m.useState(!1),f=localStorage.getItem("isDateTrackedWalletsFormat")||"date",[x,g]=m.useState(f),[y,v]=m.useState(null);function C({date:J}){const[K,te]=m.useState($o(J));return m.useEffect(()=>{const fe=setInterval(()=>te($o(J)),1e3);return()=>clearInterval(fe)},[J]),i.jsx("span",{className:"text-[11px] text-[#a5a5a5] font-normal",children:K.dateTime})}m.useEffect(()=>{localStorage.setItem("isDateTrackedWalletsFormat",x)},[x]);function N(J){const K={};return J.forEach(te=>{const{oid:fe,px:q,dir:se,side:ae,crossed:W,feeToken:V,listen_user:ee,cloid:oe,coin:de,subs_address:Ce,sz:me,closedPnl:we,fee:xe,time:be,startPosition:je,insert_date:Ie,hash:Re}=te;K[fe]||(K[fe]={oid:fe,px:q,dir:se,side:ae,crossed:W,feeToken:V,listen_user:ee,cloid:oe,coin:de,subs_address:Ce,totalSize:0,totalClosedPnl:0,totalFee:0,earliestStartPosition:je,hasZeroStartPosition:!1,closestTime:be,insertDate:Ie,hashes:[]}),parseFloat(je)===0&&(K[fe].hasZeroStartPosition=!0),K[fe].totalSize+=parseFloat(me),K[fe].totalClosedPnl+=parseFloat(we),K[fe].totalFee+=parseFloat(xe),new Date(be)>new Date(K[fe].closestTime)&&(K[fe].closestTime=be),new Date(be)>new Date(K[fe].insertDate)&&(K[fe].insertDate=Ie),K[fe].hashes.push(Re)}),Object.keys(K).map(te=>({oid:te,...K[te]}))}async function P(){const J=window.localStorage.getItem("hyperToken");try{u(!0),J||n(!0);const K=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/feed/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e.toLowerCase(),token:J,offset:0})});if(!K.ok)throw new Error(`Server responded with status ${K.status}`);const te=await K.json();if(te.success){const fe=N(te==null?void 0:te.data);l(fe)}}catch(K){console.log("Error :>> ",K)}finally{u(!1)}}function T(J,K){const te={};return J.forEach(fe=>{te[fe.oid]={...fe}}),K.forEach(fe=>{const{oid:q,px:se,dir:ae,side:W,crossed:V,feeToken:ee,listen_user:oe,cloid:de,coin:Ce,subs_address:me,sz:we,closedPnl:xe,fee:be,time:je,startPosition:Ie,insert_date:Re,hash:Qe}=fe;te[q]||(te[q]={oid:q,px:se,dir:ae,side:W,crossed:V,feeToken:ee,listen_user:oe,cloid:de,coin:Ce,subs_address:me,totalSize:0,totalClosedPnl:0,totalFee:0,hasZeroStartPosition:!1,earliestStartPosition:Ie,closestTime:je,insertDate:Re,hashes:[]}),parseFloat(Ie)===0&&(te[q].hasZeroStartPosition=!0),te[q].totalSize+=parseFloat(we),te[q].totalClosedPnl+=parseFloat(xe),te[q].totalFee+=parseFloat(be),new Date(je)>new Date(te[q].closestTime)&&(te[q].closestTime=je),new Date(je)>new Date(te[q].insertDate)&&(te[q].insertDate=Re),te[q].hashes.push(Qe)}),Object.values(te).sort((fe,q)=>new Date(q.closestTime)-new Date(fe.closestTime))}m.useEffect(()=>{P()},[window.localStorage.getItem("hyperToken")]),m.useEffect(()=>{a.current=Dy(Vln);const J=window.localStorage.getItem("hyperToken");return a.current.on("connect",()=>{r==null||r.map(K=>K.wallet_address),a.current.emit("subscribe",{login:e.toLowerCase(),token:J})}),a.current.on("hyper_get_message",K=>{if(K){const te=Array.isArray(K)?K:[K];l(fe=>{const q=T([],te);let se=fe.filter(V=>te.some(ee=>ee.oid===V.oid)),ae=[];se.length>0?ae=T(q,se):ae=q;const W=fe.filter(V=>!te.some(ee=>ee.oid===V.oid));return[...ae,...W]})}}),()=>{a.current.disconnect()}},[s]);const M=J=>J?J.includes("Long")?J==="Short > Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":J==="Long > Short"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#67ffbd]/20 text-[#67ffbd]":J==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]",F=J=>J?J.includes("Long")?J==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):J==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):J==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#767676] w-3 h-3"}),$=J=>{const K=J==null?void 0:J.hasZeroStartPosition,te=J.dir==="Close Short"||J.dir==="Close Long"||J.dir==="Short > Long"||J.dir==="Long > Short";return K||te?{text:"Closed",icon:qM}:{text:"Open",icon:GM}},L=J=>v(J),z=()=>v(null);return i.jsxs("div",{className:"flex flex-col w-full pb-2",children:[!o||o.length===0?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-full sm:w-[75%] max-w-[700px] justify-center items-center text-center mt-44",children:c?i.jsx($a,{}):i.jsx("div",{className:"flex justify-center items-center min-w-[320px]",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 min-w-max overflow-x-hidden",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"The activities of the favorited wallets will be displayed on this page."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"Feed page includes the activities occur after a wallet is favorited."})})]})]})})})}):i.jsx("div",{className:"flex flex-col gap-3 w-full mt-3",children:o.slice(0,250).map(J=>($(J),i.jsxs("div",{className:"border-2 border-[#232323] rounded-xl p-3 flex items-start gap-3 cursor-pointer",onClick:()=>L(J),children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Yi,alt:"",className:"w-6 h-6"})}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white text-sm font-semibold",children:[J!=null&&J.listen_user?J.listen_user.slice(0,5)+"..."+J.listen_user.slice(-4):"-",i.jsx("img",{src:Eo,alt:"",className:"w-4 h-4 cursor-pointer",onClick:K=>{K.stopPropagation(),navigator.clipboard.writeText((J==null?void 0:J.listen_user)||""),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})}})]}),i.jsxs("div",{className:"flex flex-col text-xs text-[#a5a5a5]",children:[i.jsx("span",{children:cu(J==null?void 0:J.closestTime)}),i.jsx(C,{date:J==null?void 0:J.closestTime})]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",J!=null&&J.totalSize?_r(J==null?void 0:J.totalSize):"-"]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",J!=null&&J.px?"$"+_r(J==null?void 0:J.px):"-"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${J==null?void 0:J.coin}.svg`||qa,alt:J==null?void 0:J.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:K=>oa(K)})}),i.jsxs("div",{className:"text-[13px] text-white font-bold font-manrope leading-[13px] tracking-tight",children:[J==null?void 0:J.coin,"/",J==null?void 0:J.feeToken]})]}),i.jsxs("div",{className:`${M(J==null?void 0:J.dir)} h-5 pl-2 pr-2 py-1 rounded-md flex items-center gap-1 w-max mt-1`,children:[i.jsx("div",{className:"w-3 h-3",children:F(J==null?void 0:J.dir)}),i.jsx("div",{className:"text-[11px] font-semibold",children:(J==null?void 0:J.dir)||"-"})]})]})]})]},J.oid)))}),y&&i.jsx(yp,{isOpen:!!y,onClose:()=>z(),children:i.jsxs("div",{className:"flex flex-col gap-4 p-2",children:[i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Yi,alt:"",className:"w-6 h-6"})}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("div",{className:"text-white text-sm font-semibold",children:y!=null&&y.listen_user?y.listen_user.slice(0,5)+"..."+y.listen_user.slice(-4):"-"}),i.jsx("img",{src:Eo,alt:"",className:"w-4 h-4 cursor-pointer",onClick:J=>{J.stopPropagation(),navigator.clipboard.writeText((y==null?void 0:y.listen_user)||"")}})]}),i.jsx("div",{className:"flex flex-col text-[11px] text-[#a5a5a5]",children:x==="time"?i.jsx(C,{date:y==null?void 0:y.closestTime}):cu(y==null?void 0:y.closestTime)})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 text-sm text-[#9b9b9b]",children:[i.jsxs("div",{className:"text-white flex items-center gap-2",children:[i.jsx("img",{src:$(y).icon,alt:"",className:"w-4 h-4"}),"Status: ",$(y).text]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Order ID:"})," ",(y==null?void 0:y.oid)||"-"]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-white",children:"Direction:"}),i.jsxs("div",{className:`${M(y==null?void 0:y.dir)} h-5 pl-2 pr-2 py-1 rounded-md flex items-center gap-1`,children:[i.jsx("div",{className:"w-3 h-3",children:F(y==null?void 0:y.dir)}),i.jsx("div",{className:"text-[11px] font-semibold",children:(y==null?void 0:y.dir)||"-"})]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",y!=null&&y.px?"$"+_r(y==null?void 0:y.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",y!=null&&y.totalSize?_r(y==null?void 0:y.totalSize):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",y!=null&&y.totalClosedPnl?"$"+_r(Math.abs(y==null?void 0:y.totalClosedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",y!=null&&y.totalFee?"$"+_r(Math.abs(y==null?void 0:y.totalFee)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Margin Mode:"})," ",y!=null&&y.crossed?"Cross":"Isolated"]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${y==null?void 0:y.coin}.svg`||qa,onError:J=>oa(J),alt:"",className:"w-5 h-5"}),i.jsxs("span",{className:"font-bold text-white",children:[y==null?void 0:y.coin,"/",(y==null?void 0:y.feeToken)||"USDC"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fills:"})," ",(X=y==null?void 0:y.hashes)!=null&&X.length?((ne=y==null?void 0:y.hashes)==null?void 0:ne.length)+" fill(s)":"0"]})]})]})})]})}const qln=({open:t,setOpen:e,handleTelegramClick:n})=>(m.useContext(Qr),ns(),D5(),i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-8",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:"text-center text-white text-[32px] font-manrope leading-none",children:"Welcome Dextrabot"}),i.jsx("div",{className:"text-center text-white/60 text-sm font-manrope leading-none",children:"You can connect to Telegram here."})]}),i.jsx("div",{onClick:()=>{n(),e(!1)},className:"flex justify-center items-center w-[348px] h-12 bg-[#7536ff] rounded-2xl cursor-pointer",children:i.jsx("div",{className:"text-center font-semibold text-white text-sm font-manrope leading-3",children:"Join Telegram"})})]})})})})})]})),Gln=({open:t,setOpen:e,setIsfilterModal:n,handleTelegramClick:r})=>{const[s,a]=m.useState(!1),o=()=>{a(!1),n(!1),e(!1)};return i.jsxs(_a,{open:t,onClose:o,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[310px] sm:w-[400px] h-max relative bg-white rounded-3xl pt-4 pb-8",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:l=>{l.preventDefault(),s?(e(!1),n(!1),a(!1)):e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:`${s?"bg-[#1DE674] hover:bg-[#16c765]":"bg-[#e3e3e3] hover:bg-[#d4d4d4]"} absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center `,children:i.jsx(u$e,{className:"w-4 h-4 text-black"})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:nct,alt:"",className:""})}),i.jsx("div",{className:"flex flex-col justify-start items-center gap-2 -mt-5",children:i.jsx("div",{className:"text-[#232323] text-[21px] font-semibold font-['Manrope']",children:"Telegram Setup"})}),i.jsx("div",{onClick:l=>{l.preventDefault(),s||r(),setTimeout(()=>{a(!0)},500)},className:`${s?"bg-[#1DE674] cursor-text":"bg-[#e3e3e3] hover:bg-[#d4d4d4] cursor-pointer"} w-60 h-8 px-6 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] inline-flex justify-center items-center gap-2.5 mb-2 select-none`,children:i.jsx("div",{className:"justify-start text-[#0a321c] text-[13px] font-semibold font-['Inter'] leading-[8px] min-w-max",children:s?"Successful":"Join Telegram"})})]})})})})})]})},Kln=({open:t,setOpen:e,handleTelegramClick:n})=>{const{setSignModalOpen:r}=m.useContext(Qr),{address:s}=ns(),[a,o]=m.useState([]),[l,c]=m.useState([]),[u,d]=m.useState(null),[f,x]=m.useState(!1),[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(""),[T,M]=m.useState(!1),[F]=m.useState(["Open Position","Increase","Decrease","Changed Position","Position Closed","Twaps"]),[$,L]=m.useState([]),[z,X]=m.useState(!1),ne=async()=>{var xe;const me=window.localStorage.getItem("hyperToken"),we=window.localStorage.getItem("hyperAddress");if(!me){r(!0);return}try{x(!0);const je=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed/tag_list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:s?s==null?void 0:s.toLowerCase():we,token:me})})).json();if(je.success){const Ie=(je==null?void 0:je.data)||[],Re=u?((xe=u==null?void 0:u.message_filters)==null?void 0:xe.source)||[]:[],Qe=[...Ie].sort((Ke,dt)=>{const tt=Re==null?void 0:Re.includes(Ke.wallet_address),nt=Re==null?void 0:Re.includes(dt.wallet_address);return Number(nt)-Number(tt)});o(Qe),await J(Qe)}else P((je==null?void 0:je.error_message)||"Failed to fetch source wallets"),console.error("API Error:",je==null?void 0:je.error_message)}catch(be){console.error("Fetch Error:",be),P("Failed to fetch source wallets")}finally{setTimeout(()=>{x(!1)},200)}},J=async me=>{var be;const we=window.localStorage.getItem("hyperToken"),xe=window.localStorage.getItem("hyperAddress");if(!we){r(!0);return}try{y(!0);const Ie=await(await fetch("https://dextrabothypev2.nftinit.io/api/subscriber/get_telegram_filter/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:s?s==null?void 0:s.toLowerCase():xe,token:we})})).json();if(Ie.success){const Re=Ie==null?void 0:Ie.filters;if(d(Re),Re===null){const Qe=me==null?void 0:me.map(Ke=>`${Ke.wallet_address}::${Ke.tag}`);c(Qe),L([...F])}else{const Qe=((be=Re==null?void 0:Re.message_filters)==null?void 0:be.source)||[],Ke=[...me].sort((dt,tt)=>{const nt=Qe==null?void 0:Qe.includes(dt.wallet_address),Le=Qe==null?void 0:Qe.includes(tt.wallet_address);return Number(Le)-Number(nt)});o(Ke)}}else P((Ie==null?void 0:Ie.error_message)||"Failed to fetch filter info"),console.error("API telegram filter info error:",Ie==null?void 0:Ie.error_message)}catch(je){console.error("Fetch Error:",je),P("Failed to fetch filter info")}finally{y(!1)}},K=async()=>{const me=window.localStorage.getItem("hyperToken"),we=window.localStorage.getItem("hyperAddress");if(!me){r(!0);return}const xe=[...new Set(l==null?void 0:l.map(Re=>Re.split("::")[0]))];let be={};xe.length>0&&(be.source=xe);const je=$.filter(Re=>!Re.includes("Spot"));je.length>0&&(be.type=je),xe.length===0&&$.length===0&&(be={});const Ie={address:s?s==null?void 0:s.toLowerCase():we,token:me,filters:be};try{C(!0);const Re=await fetch("https://dextrabothypev2.nftinit.io/api/subscriber/telegram_filter_save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Ie)}),Qe=await Re.json();Re.ok&&Qe.success?(d(Qe.filters),de(Qe.filters),M(!0),tn.success("Filter saved successfully",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"40px",width:"340px",minWidth:"340px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):(P((Qe==null?void 0:Qe.error_message)||"Failed to save filter"),console.error("API telegram filter save error:",Qe==null?void 0:Qe.error_message))}catch(Re){console.error("Fetch Error:",Re),P("Failed to save filter")}finally{C(!1)}};m.useEffect(()=>{a.length>0&&u&&de(u)},[a,u]),m.useEffect(()=>{t&&ne()},[t]);const te=me=>{const{value:we,checked:xe}=me.target;if(we==="all"){const be=a.map(je=>`${je.wallet_address}::${je.tag}`);c(xe?be:[])}else c(be=>xe?[...be,we]:be.filter(je=>je!==we))},fe=a==null?void 0:a.map(me=>`${me.wallet_address}::${me.tag}`),q=a.length>0&&(fe==null?void 0:fe.every(me=>l==null?void 0:l.includes(me))),se=me=>{const{value:we,checked:xe}=me.target;if(we==="all")if(xe){const be=F==null?void 0:F.filter(je=>!(je!=null&&je.includes("Spot")));L(be)}else L([]);else L(be=>xe?[...be,we]:be.filter(je=>je!==we))},W=(F==null?void 0:F.filter(me=>!me.includes("Spot"))).length,ee=$.filter(me=>!me.includes("Spot")).length,oe=ee===W&&W>0,de=me=>{const we=me==null?void 0:me.message_filters;if(we&&(Array.isArray(we.type)&&L(we.type.filter(xe=>!xe.includes("Spot"))),Array.isArray(we.source))){const xe=a.filter(be=>{var je;return(je=we.source)==null?void 0:je.includes(be.wallet_address)}).map(be=>`${be.wallet_address}::${be.tag}`);c(xe)}},Ce=()=>{e(!1),X(!1),o([]),L([]),c([])};return i.jsxs(i.Fragment,{children:[i.jsx(Gln,{open:T,setOpen:M,handleTelegramClick:n,setIsfilterModal:e}),i.jsxs(_a,{open:t,onClose:Ce,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full justify-center p-4 text-center items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#242424] text-left shadow-xl transition-all rounded-3xl",children:i.jsxs("div",{style:{boxShadow:"0px 4px 24px 0px rgba(0, 0, 0, 0.32)",backdropFilter:"blur(16px)"},className:"flex flex-col items-center gap-6 w-[300px] sm:w-[411px] bg-[#242424] rounded-3xl pt-[33px] pb-8",children:[i.jsx("div",{onClick:()=>Ce(),className:`${l.length===0&&$.length===0?"hover:bg-[rgba(103,255,189,0.16)]":"hover:bg-[#787070]"} cursor-pointer absolute top-2 right-2 sm:top-8 sm:right-6 w-9 h-9 rounded-full flex justify-center items-center `,children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"flex justify-start items-center gap-3 w-full px-6 sm:px-10",children:i.jsx("div",{className:"text-white text-[21px] font-semibold font-['Manrope']",children:"Telegram Notifications"})}),i.jsxs("div",{className:"w-full pl-6 sm:pl-8 pr-2",children:[i.jsx("div",{className:"flex justify-between items-center mb-2 pr-6 max-w-[244px] sm:max-w-full",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 pl-2",children:[i.jsx("span",{className:"text-white text-xs sm:text-sm font-manrope font-semibold leading-[8px]",children:"Source Wallet"}),i.jsx("span",{className:"text-[10px] sm:text-sm text-white font-semibold",children:(l==null?void 0:l.length)>0?`(${l==null?void 0:l.length} of ${a==null?void 0:a.length} selected)`:""})]})}),i.jsx("div",{className:"relative max-w-[244px] sm:max-w-full",children:i.jsx("div",{className:"w-full bg-transparent rounded-md mt-[2px] transition-all duration-200",children:i.jsx("div",{className:"max-h-[186px] overflow-y-auto scrollbar-custom-scrollbar-dark pr-0 sm:pr-[17px]",children:f?i.jsx("div",{className:"flex w-full h-full justify-center items-center min-h-[160px]",children:i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 w-[32px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-10 h-10 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]})}):i.jsxs(i.Fragment,{children:[(a==null?void 0:a.length)>0?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"flex sticky top-0 z-10 bg-[#242424] justify-between items-center gap-2 cursor-pointer text-white font-semibold pt-1 pb-2 px-2 text-[13px] font-manrope leading-[8px]",children:[i.jsx("span",{className:`${q?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:q,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${q?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${q?"translate-x-[14px]":"translate-x-0"}`})})]}),i.jsx("div",{className:"h-[1px] w-full bg-[#353535]"})]}):i.jsx("div",{className:"py-2 text-center text-[#7c7c7c] text-sm font-semibold",children:"No source wallet"}),a==null?void 0:a.map((me,we)=>{var je,Ie,Re,Qe,Ke;const xe=`${me==null?void 0:me.wallet_address}::${me==null?void 0:me.tag}`,be=l==null?void 0:l.includes(xe);return i.jsxs("label",{className:"flex justify-between items-center gap-2 h-8 px-2 cursor-pointer text-white text-sm font-semibold rounded-md bg-[#353535] my-1 hover:bg-[#464646]",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("div",{className:`${be?"text-white":"text-[#7C7C7C]"} text-[13px] font-semibold min-w-[88px]`,children:((je=me.wallet_address)==null?void 0:je.slice(0,5))+"..."+((Ie=me.wallet_address)==null?void 0:Ie.slice(-4))}),i.jsx("span",{className:`${be?"text-white":"text-[#7C7C7C]"} sm:hidden h-[18px] bg-[#424242] rounded-[256px] px-1.5 text-[13px] font-medium font-['Manrope'] leading-[8px] tracking-tight flex justify-center items-center`,children:((Re=me.tag)==null?void 0:Re.length)>10?`${(Qe=me==null?void 0:me.tag)==null?void 0:Qe.slice(0,10)}...`:`${me==null?void 0:me.tag}`}),i.jsx("span",{className:`${be?"text-white":"text-[#7C7C7C]"} hidden sm:flex h-[18px] bg-[#424242] rounded-[256px] px-1.5 text-[13px] font-medium font-['Manrope'] leading-[8px] tracking-tight justify-center items-center`,children:((Ke=me.tag)==null?void 0:Ke.length)>24?`${me==null?void 0:me.tag.slice(0,24)}...`:`${me==null?void 0:me.tag}`})]}),i.jsx("input",{type:"checkbox",value:`${me==null?void 0:me.wallet_address}::${me==null?void 0:me.tag}`,checked:be,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${be?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${be?"translate-x-[14px]":"translate-x-0"}`})})]},we)})]})})})})]}),i.jsxs("div",{className:`${(a==null?void 0:a.length)>4?"pr-[36px] sm:pr-[30px]":"pr-6"} w-full pl-6 sm:pl-8`,children:[i.jsx("div",{className:"flex justify-between items-center mb-2 mt-4 max-w-[244px] sm:max-w-full",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 pl-2",children:[i.jsx("span",{className:"text-white text-xs sm:text-sm font-manrope font-semibold leading-[8px]",children:"Source Wallet Type"}),i.jsx("span",{className:"text-[10px] sm:text-sm text-white font-semibold",children:ee>0?`(${ee} of ${W} selected)`:""})]})}),i.jsx("div",{className:"relative max-w-[244px] sm:max-w-full",children:i.jsx("div",{className:"w-full rounded-md mt-[2px] transition-all duration-200",children:i.jsxs("div",{className:"max-h-[296px] overflow-y-auto scrollbar-custom-scrollbar-dark",children:[i.jsxs("label",{className:"flex sticky top-0 z-10 justify-between items-center gap-2 cursor-pointer text-white font-semibold py-1 px-2 text-[13px] font-manrope leading-[8px]",children:[i.jsx("span",{className:`${oe?"text-white":"text-[#7C7C7C]"}`,children:"All"}),i.jsx("input",{type:"checkbox",value:"all",checked:oe,onChange:se,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${oe?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${oe?"translate-x-[14px]":"translate-x-0"}`})})]}),i.jsx("div",{className:"h-[1px] w-full bg-[#353535] my-1"}),F==null?void 0:F.map((me,we)=>{const xe=$==null?void 0:$.includes(me);return i.jsxs("label",{className:"flex justify-between items-center gap-2 h-8 hover:bg-[#464646] cursor-pointer text-white text-[13px] font-semibold rounded-md px-2 leading-[8px] bg-[#353535] my-1",children:[i.jsx("span",{className:`${xe?"text-white":"text-[#7C7C7C]"}`,children:me}),i.jsx("input",{type:"checkbox",value:me,checked:xe,onChange:se,className:"hidden"}),i.jsx("div",{className:`w-[32px] h-[18px] flex items-center px-[2px] rounded-full transition-colors duration-200 ${xe?"bg-[#1DE674]":"bg-white/10"}`,children:i.jsx("div",{className:`w-[14px] h-[14px] bg-white rounded-full shadow transform transition-transform duration-200 ${xe?"translate-x-[14px]":"translate-x-0"}`})})]},we)})]})})})]}),i.jsx("div",{onClick:me=>{if(me.preventDefault(),!f&&!g&&!v)if((l==null?void 0:l.length)===0||($==null?void 0:$.length)===0){tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Select at least one wallet or type."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"350px",minWidth:"350px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}else K()},className:`${!f&&!g&&!v&&(l==null?void 0:l.length)>0&&($==null?void 0:$.length)>0?"cursor-pointer bg-[rgba(103,255,189,0.16)] text-[#67FFBD] hover:bg-[rgba(103,255,189,0.26)]":"cursor-pointer bg-[#787070] text-[#A6A6A6] border border-[#787070]"} w-full max-w-[230px] sm:max-w-[341px] mr-2 sm:mr-0 sm:ml-2 h-8 px-6 py-3 rounded-[10px] flex justify-center items-center gap-2.5`,children:i.jsx("div",{className:"pointer-events-none text-[13px] font-semibold font-['Inter'] leading-[8px]",children:f||g||v?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[32px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):"Next"})}),N&&i.jsx("p",{className:"mt-2 text-sm text-red-500",children:N})]})})})})]})]})},Yln=({isMenu:t})=>{const[e,n]=m.useState(!1),[r,s]=m.useState(!1),{setSignModalOpen:a,setTelegramChatId:o,setSubscriberRole:l,setIsReferralCode:c,setIsReferralCodeName:u,setMushboomerETH:d,setIsWhitelist:f,setMushboomerSOL:x,telegramChatId:g}=m.useContext(Qr);ns();const y=async()=>{var C,N;let v="";try{const P=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!P){a(!0);return}if(T&&P){const M=await ki(T,P);if(!M.success){console.error("Account check failed:",M.message);return}if(o(M==null?void 0:M.telegram_chat_id),l(M==null?void 0:M.subscriber_role),d((C=M==null?void 0:M.mushboomer_counts)==null?void 0:C.eth),x((N=M==null?void 0:M.mushboomer_counts)==null?void 0:N.sol),c(M==null?void 0:M.referral_code),u(M==null?void 0:M.refcode),f(M==null?void 0:M.whitelist),M.telegram_chat_id==null||M.telegram_chat_id==""||M.telegram_chat_id=="0"){const F=await Mwt(T,P);if(!F.success){console.error("Telegram-ID kunne ikke hentes:",M.message),tn.error(F.message);return}F.success&&(v=t=="My Activities"?`https://t.me/DextraCopyTraderBot?start=${F.telegram_temp_password}`:`https://t.me/DextraTraderBot?start=${F.telegram_temp_password}`)}else v=t=="My Activities"?"https://t.me/DextraCopyTraderBot":"https://t.me/DextraTraderBot"}v?window.open(v,"_blank"):(console.error("Failed to generate Telegram URL"),tn.error("Failed to generate Telegram URL"))}catch(P){console.error("Error during Telegram handling:",P),tn.error(P.message)}};return i.jsxs(i.Fragment,{children:[i.jsx(qln,{open:e,setOpen:n,handleTelegramClick:y}),i.jsx(Kln,{open:r,setOpen:s,handleTelegramClick:y}),i.jsx("div",{className:"flex justify-center items-center",children:g==null||g==""||g=="0"?i.jsx("div",{onClick:v=>{v.preventDefault(),window.localStorage.getItem("hyperToken")?t=="My Activities"?s(!0):n(!0):a(!0)},className:`${t=="My Activities"?"bg-[#7445ff] hover:bg-[#7445ff]/80":"bg-white/40 hover:bg-white/50"} h-8 min-h-8 px-3 py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer`,children:i.jsx("div",{className:"min-w-max text-white text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:t=="My Activities"?"My Activities - Telegram":"Tracked Wallets - Telegram"})}):i.jsx("div",{onClick:v=>{v.preventDefault(),t=="My Activities"?s(!0):y()},className:`${t=="My Activities"?"bg-[#7445ff] hover:bg-[#7445ff]/80":"bg-white/40 hover:bg-white/50"} h-8 min-h-8 px-3 py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer`,children:i.jsx("div",{className:"min-w-max text-white text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none",children:t=="My Activities"?"My Activities - Telegram":"Tracked Wallets - Telegram"})})})]})};function Xln(t){var Un,Xt,an,Jt,Ye,Je,It,hn,Yt,Rt,ot,De,At,ze,rt,mt,Lt,kt,dn,rn,gn,An,kn,yn,Vn,Kn,Dn,Xn,Nn,on,Oe,Zt,sn,jt,Qn,bn,Dt,en,Pn,tr,ar,hr;const[e,n]=m.useState(!1),r=m.useRef(null),{isConnected:s,address:a}=ns(),[o,l]=m.useState([]);m.useEffect(()=>{var zn,Zn;const qt=(zn=t.advancedFilters)==null?void 0:zn.coinFeed;if(qt&&((Zn=t.dataCoin)==null?void 0:Zn.length)>0){const Ft=qt.map(En=>t.dataCoin.find(Ee=>Ee.value===En)).filter(Boolean);t.setSelectedCoins(Ft)}},[t.dataCoin]);const c=qt=>{if(!qt)return;const Zn=Array.isArray(qt)?qt:[qt],Ft=t.selectedCoins||[],En=[...Ft,...Zn.filter(h=>!Ft.some(p=>p.value===h.value))],Ee=En.map(h=>h.value);Ee.join(","),t.setSelectedCoins(En),t.setAdvancedFilters(h=>({...h,coinFeed:Ee}))},[u,d]=m.useState(!1),[f,x]=m.useState(!1),[g,y]=m.useState(!1),[v,C]=m.useState(!1),[N,P]=m.useState(!1),[T,M]=m.useState(!1),F=()=>{d(qt=>!qt)},$=()=>{x(qt=>!qt)},L=()=>{y(qt=>!qt)},z=()=>{C(qt=>!qt)},X=()=>{P(qt=>!qt)},ne=()=>{M(qt=>!qt)},J=qt=>{const{value:zn,checked:Zn}=qt.target;t.setAdvancedFilters(Ft=>{let En=[...Ft.positionFeed];return zn==="all"?En=Zn?[...je]:[]:Zn?En.push(zn):En=En.filter(Ee=>Ee!==zn),localStorage.setItem("positionFeed",JSON.stringify(En)),{...Ft,positionFeed:En}})},K=()=>{localStorage.setItem("positionFeed",JSON.stringify([])),t.setAdvancedFilters(qt=>({...qt,positionFeed:[]}))},te=qt=>{const{value:zn,checked:Zn}=qt.target;t.setAdvancedFilters(Ft=>{let En=[...Ft.typeFeed];return zn==="all"?En=Zn?[...Qe]:[]:Zn?En.push(zn):En=En.filter(Ee=>Ee!==zn),{...Ft,typeFeed:En}})},fe=()=>{t.setAdvancedFilters(qt=>({...qt,typeFeed:[]}))},q=qt=>{const{value:zn,checked:Zn}=qt.target;t.setAdvancedFilters(Ft=>{let En=[...Ft.dexMarket];return zn==="all"?En=Zn?[...Ke]:[]:Zn?En.push(zn):En=En.filter(Ee=>Ee!==zn),{...Ft,dexMarket:En}})},se=()=>{t.setAdvancedFilters(qt=>({...qt,dexMarket:[]}))},ae=()=>{t.setSearchTagSellect([])},W=((Un=t.selectTradeWalletData)==null?void 0:Un.length)>0?o:t.walletTags,V=qt=>{const{value:zn,checked:Zn}=qt.target;t.setSearchTagSellect(Ft=>{let En=[...Ft];return zn==="all"?En=Zn?W==null?void 0:W.map(Ee=>Ee.tag):[]:Zn?En==null||En.push(zn):En=En==null?void 0:En.filter(Ee=>Ee!==zn),En})},ee=qt=>{t.setAdvancedFilters(zn=>({...zn,directionFeed:qt})),M(!1)},oe=()=>{t.setAdvancedFilters(qt=>({...qt,directionFeed:""})),M(!1)},de=()=>{t.setSelectTradeWalletData([])},[Ce,me]=m.useState(!1),we=async qt=>{const{value:zn,checked:Zn}=qt.target;let Ft;t.setSelectTradeWalletData(En=>{var Ee;return zn==="all"?Ft=Zn?(Ee=t.tradeWalletData)==null?void 0:Ee.map(h=>h.wallet):[]:(Ft=Zn?[...En,zn]:En==null?void 0:En.filter(h=>h!==zn),!Zn&&En.includes("all")&&(Ft=Ft==null?void 0:Ft.filter(h=>h!=="all"))),Ft}),t.setSearchTagSellect([]),setTimeout(async()=>{var En;if((Ft==null?void 0:Ft.length)!==0)try{me(!0);const Ee=window.localStorage.getItem("hyperToken");if(!Ee){setSignModalOpen(!0);return}const p=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed/tag_list/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a,token:Ee,trader_wallets:Ft})});if(!p.ok)throw new Error(`Server responded with status ${p.status}`);const S=await p.json();if(S.success){const _=(En=S==null?void 0:S.data)==null?void 0:En.map(k=>({tag:k==null?void 0:k.tag,wallet:k==null?void 0:k.wallet_address}));l(_),me(!1)}else console.log(S.error_message),me(!1)}catch(Ee){console.log("Error :>> ",Ee),me(!1)}},0)},xe={control:(qt,{isFocused:zn})=>{var Zn,Ft,En,Ee;return{...qt,display:"flex",alignItems:"center",paddingLeft:"21px",backgroundColor:"#353535",minHeight:"32px",maxHeight:"32px",minWidth:"244px",maxWidth:"244px",border:((Ft=(Zn=t.advancedFilters)==null?void 0:Zn.coinFeed)==null?void 0:Ft.length)>0?"1px solid #8d67ff":"none",boxShadow:"none",borderRadius:"6px",":hover":{border:((Ee=(En=t.advancedFilters)==null?void 0:En.coinFeed)==null?void 0:Ee.length)>0?"1px solid #8d67ff":"none"}}},menu:qt=>({...qt,backgroundColor:"#353535",maxWidth:"244px"}),menuList:qt=>({...qt,backgroundColor:"#353535",maxHeight:"180px",zIndex:4}),clearIndicator:qt=>({...qt,color:"#b3b3b3",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",padding:"0px",paddingRight:"5px",":hover":{color:"white"}}),dropdownIndicator:qt=>({...qt,color:"#b3b3b3",cursor:"pointer",alignItems:"center",justifyContent:"center",width:"25px",height:"25px",minWidth:"25px",minHeight:"25px",padding:"0px",paddingRight:"5px",paddingLeft:"5px",display:"none",":hover":{color:"white"}}),indicatorSeparator:()=>({display:"none"}),option:(qt,{data:zn,isDisabled:Zn,isFocused:Ft,isSelected:En})=>{const Ee=bi(zn.color);return{...qt,fontSize:"14px",fontWeight:"600",backgroundColor:Zn?void 0:En?zn.color:Ft?Ee.alpha(.1).css():void 0,color:"white",cursor:Zn?"not-allowed":"pointer",":active":{...qt[":active"],backgroundColor:Zn?void 0:En?zn.color:Ee.alpha(.9).css()}}},multiValue:(qt,{data:zn})=>{const Zn=bi(zn.color);return{...qt,backgroundColor:Zn.alpha(.4).css()}},multiValueLabel:(qt,{data:zn})=>({...qt,color:"white"}),multiValueRemove:(qt,{data:zn})=>({...qt,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.3)",color:"white"}}),input:qt=>({...qt,color:"white"}),valueContainer:qt=>({...qt,paddingTop:"0px",fontSize:"14px",fontWeight:"600"})},be=(qt,zn)=>{var Ft;const Zn=(Ft=zn.selectedCoins)==null?void 0:Ft.filter(En=>En.value!==qt.value);Zn.map(En=>En.value).join(","),zn.setSelectedCoins(Zn),zn.setAdvancedFilters(En=>({...En,coinFeed:Zn==null?void 0:Zn.map(Ee=>Ee.value)}))};m.useEffect(()=>{const qt=zn=>{r.current&&!r.current.contains(zn.target)&&n(!1)};return document.addEventListener("mousedown",qt),()=>{document.removeEventListener("mousedown",qt)}},[]);const je=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],Ie=(Xt=t.advancedFilters.positionFeed)==null?void 0:Xt.length,Re=je.length,Qe=["Open Position","Increase","Decrease","Changed Position","Position Closed","Spot","Twaps"],Ke=["HyperLiquid","Lighter"],dt=(an=t.advancedFilters.typeFeed)==null?void 0:an.length,tt=Qe.length,nt=(Jt=t.advancedFilters.dexMarket)==null?void 0:Jt.length,Le=Ke.length,Be=(Ye=t.searchTagSellect)==null?void 0:Ye.length,ht=W==null?void 0:W.length,pt=(Je=t.selectTradeWalletData)==null?void 0:Je.length,Gt=(It=t.tradeWalletData)==null?void 0:It.length,wt=["Long","Short"],nn=({src:qt,alt:zn})=>{const[Zn,Ft]=Ne.useState(!1);return Zn?i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 mr-1 bg-[#4F4F4F] flex items-center justify-center",children:i.jsx("span",{className:"text-white text-xs"})}):i.jsx("img",{src:qt,alt:zn,className:"rounded-full w-4 h-4 min-w-4 min-h-4 mr-1",loading:"lazy",onError:()=>Ft(!0)})},cn=qt=>{const{data:zn,innerRef:Zn,innerProps:Ft,selectProps:En}=qt,Ee=En.styles.option({},qt);return i.jsxs("div",{ref:Zn,...Ft,style:Ee,className:"flex items-center p-2",children:[i.jsx(nn,{src:zn.icon,alt:zn.label}),zn.label]})};return i.jsxs("div",{className:"text-white flex flex-wrap justify-center font-manrope gap-4 pt-2",children:[i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"DEX"}),i.jsx("div",{onClick:se,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${nt>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:L,children:[i.jsx("span",{className:`${nt>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:nt>0?`${nt} of ${Le} selected`:"Select Dex"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${g?"rotate-180":""}`})]}),g&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsxs("div",{className:"max-h-[260px] overflow-y-auto",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((Yt=(hn=t.advancedFilters)==null?void 0:hn.dexMarket)==null?void 0:Yt.length)===Ke.length,onChange:q,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((ot=(Rt=t.advancedFilters)==null?void 0:Rt.dexMarket)==null?void 0:ot.length)===Ke.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((At=(De=t.advancedFilters)==null?void 0:De.dexMarket)==null?void 0:At.length)===(Ke==null?void 0:Ke.length)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),Ke==null?void 0:Ke.map((qt,zn)=>{var Zn,Ft,En,Ee,h,p;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:qt,checked:(Ft=(Zn=t.advancedFilters)==null?void 0:Zn.dexMarket)==null?void 0:Ft.includes(qt),onChange:q,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ee=(En=t.advancedFilters)==null?void 0:En.dexMarket)!=null&&Ee.includes(qt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(h=t.advancedFilters)==null?void 0:h.dexMarket)==null?void 0:p.includes(qt))&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),qt==="HyperLiquid"?i.jsx("img",{src:I1,alt:"hyper",className:"w-4 h-4 rounded-sm"}):qt==="Lighter"?i.jsx(bf,{className:"w-4 h-4 text-[#fff]"}):null,qt]},zn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Follower Wallet"}),i.jsx("div",{onClick:de,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${pt>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:X,children:[i.jsx("span",{className:`${pt>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:pt>0?`${pt} of ${Gt} selected`:"Select Wallet"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${N?"rotate-180":""}`})]}),N&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsxs("div",{className:"max-h-40 overflow-y-auto scrollbar-custom-scrollbar-dark",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((ze=t.selectTradeWalletData)==null?void 0:ze.length)===((rt=t.tradeWalletData)==null?void 0:rt.length),onChange:we,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((mt=t.selectTradeWalletData)==null?void 0:mt.length)===((Lt=t.tradeWalletData)==null?void 0:Lt.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((kt=t.selectTradeWalletData)==null?void 0:kt.length)===((dn=t.tradeWalletData)==null?void 0:dn.length)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),t.isWalletLoading?i.jsx("span",{className:"text-[#7c7c7c] text-center py-2 text-sm font-semibold font-manrope leading-[8px]",children:'"Loading..."'}):(rn=t.tradeWalletData)==null?void 0:rn.map((qt,zn)=>{var Zn,Ft,En,Ee,h,p,S;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:qt==null?void 0:qt.wallet,checked:(Zn=t.selectTradeWalletData)==null?void 0:Zn.includes(qt==null?void 0:qt.wallet),onChange:we,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ft=t.selectTradeWalletData)!=null&&Ft.includes(qt==null?void 0:qt.wallet)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((En=t.selectTradeWalletData)==null?void 0:En.includes(qt==null?void 0:qt.wallet))&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),((Ee=qt==null?void 0:qt.wallet)==null?void 0:Ee.slice(0,5))+"..."+((h=qt==null?void 0:qt.wallet)==null?void 0:h.slice(-4)),` (${((p=qt==null?void 0:qt.name)==null?void 0:p.length)>10?((S=qt==null?void 0:qt.name)==null?void 0:S.slice(0,10))+"...":qt==null?void 0:qt.name})`]},zn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Source Wallet"}),i.jsx("div",{onClick:ae,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${Be>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:z,children:[i.jsx("span",{className:`${Be>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:Be>0?`${Be} of ${ht} selected`:"Select Wallet"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${v?"rotate-180":""}`})]}),v&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:Ce?i.jsx("p",{className:"text-[#7c7c7c] text-center py-2 text-sm font-semibold font-manrope leading-[8px]",children:"Loading..."}):i.jsxs("div",{className:"max-h-40 overflow-y-auto scrollbar-custom-scrollbar-dark",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((gn=t.searchTagSellect)==null?void 0:gn.length)===(W==null?void 0:W.length),onChange:V,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((An=t.searchTagSellect)==null?void 0:An.length)===(W==null?void 0:W.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((kn=t.searchTagSellect)==null?void 0:kn.length)===(W==null?void 0:W.length)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),W==null?void 0:W.map((qt,zn)=>{var Zn,Ft,En,Ee,h,p;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope",children:[i.jsx("input",{type:"checkbox",value:qt==null?void 0:qt.tag,checked:(Zn=t.searchTagSellect)==null?void 0:Zn.includes(qt==null?void 0:qt.tag),onChange:V,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ft=t.searchTagSellect)!=null&&Ft.includes(qt==null?void 0:qt.tag)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((En=t.searchTagSellect)==null?void 0:En.includes(qt==null?void 0:qt.tag))&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),(qt==null?void 0:qt.wallet)&&((Ee=qt==null?void 0:qt.wallet)==null?void 0:Ee.slice(0,5))+"..."+((h=qt==null?void 0:qt.wallet)==null?void 0:h.slice(-4))," ",qt!=null&&qt.tag&&(qt==null?void 0:qt.tag.length)>10?`(${(p=qt==null?void 0:qt.tag)==null?void 0:p.slice(0,10)}...)`:`(${qt==null?void 0:qt.tag})`]},zn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[7px] justify-start max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("div",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Search Coin"}),i.jsx("div",{onClick:()=>{t.setSelectedCoins([]),t.setAdvancedFilters(qt=>({...qt,coinFeed:""}))},className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear Coins"})})]}),i.jsx("div",{className:"float-left w-full",ref:r,children:i.jsxs("div",{className:"min-w-full relative",children:[i.jsx(zy,{className:"text-[#646464] absolute left-[6px] top-[6px] z-10"}),i.jsx(jl,{closeMenuOnSelect:!1,value:[],isMulti:!0,options:t.dataCoin.filter(qt=>Array.isArray(t.selectedCoins)&&!t.selectedCoins.some(zn=>zn.value===qt.value)),components:{Option:cn},styles:xe,onChange:c,menuIsOpen:e,onMenuOpen:()=>n(!0),placeholder:t.isLoadingCoin?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Search Coin"}),noOptionsMessage:()=>t.isLoadingCoin?i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"Loading..."}):i.jsx("span",{className:"text-[#7e7e7e] text-sm font-medium font-inter leading-[8px]",children:"No data available"})}),i.jsx("div",{className:`absolute top-[220px] z-[4] left-0 w-full max-w-[244px] bg-[#303030] flex flex-wrap gap-1 p-1 border border-[#3a3a3a] mt-1 ${e?"block":"hidden"} ${e&&((yn=t.selectedCoins)==null?void 0:yn.length)>0?"block":"hidden"}`,children:t.selectedCoins&&((Vn=t.selectedCoins)==null?void 0:Vn.map(qt=>i.jsxs("div",{className:"h-6 pl-1.5 rounded-md border border-[#3a3a3a] justify-start items-center gap-0.5 flex",children:[i.jsx(nn,{src:qt==null?void 0:qt.icon,alt:qt==null?void 0:qt.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:qt.label}),i.jsx("div",{onClick:zn=>{zn.stopPropagation(),be(qt,t)},className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},qt.value)))}),i.jsx("div",{className:`${((Kn=t.selectedCoins)==null?void 0:Kn.length)>0?"mt-2.5":""} flex flex-wrap gap-1 max-w-[244px]`,children:t.selectedCoins&&((Dn=t.selectedCoins)==null?void 0:Dn.map(qt=>i.jsxs("div",{className:"h-6 pl-1.5 rounded-md border border-[#3a3a3a] justify-start items-center gap-0.5 flex ",children:[i.jsx(nn,{src:qt==null?void 0:qt.icon,alt:qt==null?void 0:qt.value}),i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] py-1 min-w-max",children:qt.label}),i.jsx("div",{onClick:()=>be(qt,t),className:"cursor-pointer group w-full h-full flex justify-center items-center pr-1.5 py-1",children:i.jsx(ww,{className:"group-hover:text-[#cdcdcd] text-[#7C7C7C] w-[5.66px] h-[5.66px] min-w-[5.66px] min-h-[5.66px]"})})]},qt.value)))})]})})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Source Wallet Type"}),i.jsx("div",{onClick:fe,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${dt>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:$,children:[i.jsx("span",{className:`${dt>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:dt>0?`${dt} of ${tt} selected`:"Select Type"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${f?"rotate-180":""}`})]}),f&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsxs("div",{className:"max-h-[260px] overflow-y-auto",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((Nn=(Xn=t.advancedFilters)==null?void 0:Xn.typeFeed)==null?void 0:Nn.length)===Qe.length,onChange:te,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((Oe=(on=t.advancedFilters)==null?void 0:on.typeFeed)==null?void 0:Oe.length)===Qe.length?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((sn=(Zt=t.advancedFilters)==null?void 0:Zt.typeFeed)==null?void 0:sn.length)===(Qe==null?void 0:Qe.length)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),Qe==null?void 0:Qe.map((qt,zn)=>{var Zn,Ft,En,Ee,h,p;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:qt,checked:(Ft=(Zn=t.advancedFilters)==null?void 0:Zn.typeFeed)==null?void 0:Ft.includes(qt),onChange:te,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ee=(En=t.advancedFilters)==null?void 0:En.typeFeed)!=null&&Ee.includes(qt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(h=t.advancedFilters)==null?void 0:h.typeFeed)==null?void 0:p.includes(qt))&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),qt]},zn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Follower Wallet Status"}),i.jsx("div",{onClick:K,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${Ie>0?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:F,children:[i.jsx("span",{className:`${Ie>0?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:Ie>0?`${Ie} of ${Re} selected`:"Select Status"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${u?"rotate-180":""}`})]}),u&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsxs("div",{className:"max-h-[228px] overflow-y-auto",children:[i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:"all",checked:((Qn=(jt=t.advancedFilters)==null?void 0:jt.positionFeed)==null?void 0:Qn.length)===(je==null?void 0:je.length),onChange:J,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${((Dt=(bn=t.advancedFilters)==null?void 0:bn.positionFeed)==null?void 0:Dt.length)===(je==null?void 0:je.length)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((Pn=(en=t.advancedFilters)==null?void 0:en.positionFeed)==null?void 0:Pn.length)===(je==null?void 0:je.length)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),"All"]}),i.jsx("div",{className:"h-[2px] w-full bg-[#404040]"}),je==null?void 0:je.map((qt,zn)=>{var Zn,Ft,En,Ee,h,p;return i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px]",children:[i.jsx("input",{type:"checkbox",value:qt,checked:(Ft=(Zn=t.advancedFilters)==null?void 0:Zn.positionFeed)==null?void 0:Ft.includes(qt),onChange:J,className:"hidden"}),i.jsx("div",{className:`w-4 h-4 flex items-center justify-center border ${(Ee=(En=t.advancedFilters)==null?void 0:En.positionFeed)!=null&&Ee.includes(qt)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:((p=(h=t.advancedFilters)==null?void 0:h.positionFeed)==null?void 0:p.includes(qt))&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),qt==="Other"?"System Message":qt]},zn)})]})})]})]}),i.jsxs("div",{className:"col-span-1 flex flex-col gap-[13px] justify-start w-full max-w-full z-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px]",children:"Direction"}),i.jsx("div",{onClick:oe,className:"h-5 px-2 py-1.5 rounded-md border border-[#353535] justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear"})})]}),i.jsxs("div",{className:"relative w-full max-w-[244px]",children:[i.jsxs("div",{className:`${(tr=t.advancedFilters)!=null&&tr.directionFeed?"border border-[#8d67ff]":""} flex justify-between items-center bg-[#353535] text-white rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,onClick:ne,children:[i.jsx("span",{className:`${(ar=t.advancedFilters)!=null&&ar.directionFeed?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:((hr=t.advancedFilters)==null?void 0:hr.directionFeed)||"Select Direction"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${T?"rotate-180":""}`})]}),T&&i.jsx("div",{className:"w-full bg-[#353535] rounded-md mt-[2px] p-1 transition-all duration-200",children:i.jsx("div",{className:"max-h-40 overflow-y-auto",children:wt==null?void 0:wt.map((qt,zn)=>i.jsx("div",{onClick:()=>ee(qt),className:"flex items-center gap-2 p-[7px] h-8 relative rounded hover:bg-[#464646] cursor-pointer text-white text-sm font-semibold font-manrope",children:qt},zn))})})]})]})]})}const Qln=({advancedFilters:t,setAdvancedFilters:e,getFeedClearData:n,getFeedData:r,dataCoin:s,selectedCoins:a,setSelectedCoins:o,isLoadingCoin:l,setIsLoadingCoin:c,walletTagData:u,walletTags:d,searchWalletSellect:f,setSearchWalletSellect:x,walletTagLoading:g,tradeWalletData:y,selectTradeWalletData:v,setSelectTradeWalletData:C,searchTagSellect:N,setSearchTagSellect:P,isWalletLoading:T})=>i.jsxs("div",{className:"bg-[#232323] rounded-2xl min-h-[380px] min-w-max lg:min-w-[286px] max-w-[286px] p-1 py-3 font-manrope overflow-hidden relative h-[calc(100vh-236px)] mt-4",children:[i.jsxs("div",{className:"w-full flex justify-between items-center pt-[2px] pl-4 pr-1 pb-[10px]",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[8px]",children:"Filters"}),i.jsx("div",{onClick:()=>{n()},className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex mr-3 cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("div",{className:"h-full w-full overflow-y-scroll font-manrope py-1 pl-4 pr-3",children:i.jsx("div",{className:"font-manrope font-normal pb-[120px] sm:pb-[80px] max-w-[256px]",children:i.jsx(Xln,{advancedFilters:t,setAdvancedFilters:e,dataCoin:s,selectedCoins:a,setSelectedCoins:o,isLoadingCoin:l,setIsLoadingCoin:c,walletTagData:u,searchWalletSellect:f,setSearchWalletSellect:x,walletTagLoading:g,tradeWalletData:y,selectTradeWalletData:v,setSelectTradeWalletData:C,searchTagSellect:N,setSearchTagSellect:P,walletTags:d,isWalletLoading:T})})}),i.jsx("div",{className:"absolute bottom-0 w-full",children:i.jsx("div",{className:"sticky h-12 bg-[#1b1b1b]/30 rounded-bl-2xl rounded-br-2xl border-t border-[#353535] backdrop-blur-[32px] min-h-14 pt-[11px] w-full z-10",children:i.jsx("div",{className:"flex justify-center -ml-3",children:i.jsx("div",{onClick:()=>r(),className:"w-[234px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] pointer-events-none",children:"Apply Filters"})})})})})]});var Zln={cm:!0,mm:!0,in:!0,px:!0,pt:!0,pc:!0,em:!0,ex:!0,ch:!0,rem:!0,vw:!0,vh:!0,vmin:!0,vmax:!0,"%":!0};function Jln(t){if(typeof t=="number")return{value:t,unit:"px"};var e,n=(t.match(/^[0-9.]*/)||"").toString();n.includes(".")?e=parseFloat(n):e=parseInt(n,10);var r=(t.match(/[^0-9]*$/)||"").toString();return Zln[r]?{value:e,unit:r}:(console.warn("React Spinners: ".concat(t," is not a valid css value. Defaulting to ").concat(e,"px.")),{value:e,unit:"px"})}function Ew(t){var e=Jln(t);return"".concat(e.value).concat(e.unit)}var ese=function(t,e,n){var r="react-spinners-".concat(t,"-").concat(n);if(typeof window>"u"||!window.document)return r;var s=document.createElement("style");document.head.appendChild(s);var a=s.sheet,o=`
@keyframes `.concat(r,` {
`).concat(e,`
}
`);return a&&a.insertRule(o,0),r},UD=function(){return UD=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},UD.apply(this,arguments)},ecn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n},tcn=ese("BeatLoader","50% {transform: scale(0.75);opacity: 0.2} 100% {transform: scale(1);opacity: 1}","beat");function FVe(t){var e=t.loading,n=e===void 0?!0:e,r=t.color,s=r===void 0?"#000000":r,a=t.speedMultiplier,o=a===void 0?1:a,l=t.cssOverride,c=l===void 0?{}:l,u=t.size,d=u===void 0?15:u,f=t.margin,x=f===void 0?2:f,g=ecn(t,["loading","color","speedMultiplier","cssOverride","size","margin"]),y=UD({display:"inherit"},c),v=function(C){return{display:"inline-block",backgroundColor:s,width:Ew(d),height:Ew(d),margin:Ew(x),borderRadius:"100%",animation:"".concat(tcn," ").concat(.7/o,"s ").concat(C%2?"0s":"".concat(.35/o,"s")," infinite linear"),animationFillMode:"both"}};return n?m.createElement("span",UD({style:y},g),m.createElement("span",{style:v(1)}),m.createElement("span",{style:v(2)}),m.createElement("span",{style:v(3)})):null}var zD=function(){return zD=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},zD.apply(this,arguments)},ncn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n},cSe=[ese("PuffLoader","0% {transform: scale(0)} 100% {transform: scale(1.0)}","puff-1"),ese("PuffLoader","0% {opacity: 1} 100% {opacity: 0}","puff-2")];function OVe(t){var e=t.loading,n=e===void 0?!0:e,r=t.color,s=r===void 0?"#000000":r,a=t.speedMultiplier,o=a===void 0?1:a,l=t.cssOverride,c=l===void 0?{}:l,u=t.size,d=u===void 0?60:u,f=ncn(t,["loading","color","speedMultiplier","cssOverride","size"]),x=zD({display:"inherit",position:"relative",width:Ew(d),height:Ew(d)},c),g=function(y){return{position:"absolute",height:Ew(d),width:Ew(d),border:"thick solid ".concat(s),borderRadius:"50%",opacity:"1",top:"0",left:"0",animationFillMode:"both",animation:"".concat(cSe[0],", ").concat(cSe[1]),animationDuration:"".concat(2/o,"s"),animationIterationCount:"infinite",animationTimingFunction:"cubic-bezier(0.165, 0.84, 0.44, 1), cubic-bezier(0.3, 0.61, 0.355, 1)",animationDelay:y===1?"-1s":"0s"}};return n?m.createElement("span",zD({style:x},f),m.createElement("span",{style:g(1)}),m.createElement("span",{style:g(2)})):null}function rcn({feedData:t}){var l,c;const[e,n]=m.useState(null);function r({date:u}){const[d,f]=m.useState($o(u));return m.useEffect(()=>{const x=setInterval(()=>{f($o(u))},1e3);return()=>clearInterval(x)},[u]),i.jsx("span",{className:"text-xs text-[#a5a5a5] font-normal",children:d.dateTime})}const s=u=>n(u),a=()=>n(null),o=u=>u?["Sell","Close Short","Open Short"].includes(u)||u.includes("Short")?"Short":["Buy","Close Long","Open Long"].includes(u)||u.includes("Long")?"Long":u:"-";return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex lg:hidden flex-col gap-3 w-full font-manrope font-semibold pb-2",children:[(!t||t.length===0)&&i.jsx("div",{className:"flex justify-center items-center w-full py-10",children:i.jsx(OVe,{color:"#ffffff",size:40})}),t==null?void 0:t.map((u,d)=>{var f,x,g,y,v,C;return i.jsxs("div",{children:[i.jsxs("div",{className:"w-full border-2 border-[#232323] rounded-tl-xl rounded-tr-xl p-3 flex items-start gap-3 cursor-pointer",onClick:()=>s(u),children:[i.jsxs("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center relative",children:[i.jsx("img",{src:Yi,alt:"",className:"w-6 h-6"}),(u==null?void 0:u.target_platform)==="hyper"?i.jsx("div",{className:"absolute top-12 flex justify-start items-center gap-2",children:i.jsx("img",{src:I1,alt:"hyper",className:"w-4 h-4 rounded-sm"})}):(u==null?void 0:u.target_platform)==="lighter"?i.jsx("div",{className:"absolute top-12 flex justify-start items-center gap-2",children:i.jsx(bf,{className:"w-4 h-4 text-[#fff]"})}):""]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white text-sm font-semibold",children:[u!=null&&u.listen_user?u.listen_user.slice(0,5)+"..."+u.listen_user.slice(-4):"-",i.jsx("img",{src:Eo,alt:"",className:"w-4 h-4 cursor-pointer",onClick:N=>{N.stopPropagation(),navigator.clipboard.writeText((u==null?void 0:u.listen_user)||""),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})}})]}),i.jsxs("div",{className:"flex flex-col text-xs text-[#a5a5a5]",children:[i.jsx("span",{children:cu(u==null?void 0:u.time)}),i.jsx(r,{date:u==null?void 0:u.time})]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",u!=null&&u.sz?_r(u==null?void 0:u.sz):"-"]}),i.jsxs("div",{className:"text-xs font-semibold",children:[i.jsx("span",{className:"text-white",children:"Entry Price:"})," ",u!=null&&u.markPrice?"$"+_r(u==null?void 0:u.markPrice):"-"]}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${u==null?void 0:u.coin}.svg`||qa,onError:N=>oa(N),alt:"",className:"w-5 h-5"}),i.jsxs("div",{className:"text-[13px] text-white font-bold",children:[u==null?void 0:u.coin,"/",(u==null?void 0:u.feeToken)||"USDC"]}),i.jsxs("div",{className:`${o(u==null?void 0:u.dir)==="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":o(u==null?void 0:u.dir)==="Short"?"bg-[#ff797c]/20 text-[#ff797c]":(u==null?void 0:u.dir)==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":(u==null?void 0:u.dir)==="Sell"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]"} h-5 pl-2 pr-2 py-1 rounded-md flex items-center gap-1 w-max`,children:[i.jsx("div",{className:"w-3 h-3",children:(f=u==null?void 0:u.dir)!=null&&f.includes("Long")?(u==null?void 0:u.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(u==null?void 0:u.dir)==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold",children:[(u==null?void 0:u.dir)||"-"," ",u!=null&&u.leverage?`${u.leverage}x`:""]})]})]})]})]}),i.jsx("div",{className:`${u!=null&&u.success?"bg-[#67ffbd]/20 border-[#67ffbd]/25":"bg-[#ff797c]/20 border-[#ff797c]/25"} flex justify-start items-center h-8 max-h-8 rounded-bl-[18px] rounded-br-[18px] border-t w-full py-1.5`,children:i.jsxs("div",{className:"text-white text-sm font-manrope leading-none flex justify-start items-center px-2 gap-2",children:[u!=null&&u.success?i.jsx("img",{src:qM,alt:""}):i.jsx("img",{src:GM,alt:""}),i.jsx("div",{className:`${u!=null&&u.success?"text-[#67ffbd]":"text-[#ff787b]"} text-xs font-bold font-manrope leading-3 tracking-tight`,children:u!=null&&u.success?"Status:":"System Message:"}),i.jsx("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-1",children:u!=null&&u.success?((x=u==null?void 0:u.message)==null?void 0:x.split("-")[0])||"-":"For details, use web version"}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${u==null?void 0:u.trader_wallet}`,"_blank")},className:"h-[18px] px-1.5 py-1 bg-white rounded-[256px] justify-center items-center gap-0.5 inline-flex cursor-pointer -ml-0.5",children:i.jsx("div",{className:"w-14 text-center truncate overflow-hidden whitespace-nowrap text-[#273f35] text-xs font-semibold font-manrope leading-[13px]",children:u!=null&&u.wallet_name?u==null?void 0:u.wallet_name:u!=null&&u.trader_wallet?((g=u==null?void 0:u.trader_wallet)==null?void 0:g.slice(0,5))+"..."+((y=u==null?void 0:u.trader_wallet)==null?void 0:y.slice(-4)):"--"})}),i.jsxs("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-0.5",children:["by"," "]}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${u==null?void 0:u.listen_user}`,"_blank")},className:"h-[18px] px-1.5 py-1 bg-[#a5ffd8] rounded-[256px] justify-center items-center gap-0.5 inline-flex -ml-0.5 cursor-pointer",children:i.jsx("div",{className:"w-14 text-center truncate overflow-hidden whitespace-nowrap text-[#1e563e] text-xs font-semibold font-manrope leading-[13px]",children:u!=null&&u.tag?u==null?void 0:u.tag:u!=null&&u.listen_user?((v=u==null?void 0:u.listen_user)==null?void 0:v.slice(0,5))+"..."+((C=u==null?void 0:u.listen_user)==null?void 0:C.slice(-4)):"--"})})]})})]},d)})]}),e&&i.jsx(yp,{isOpen:!!e,onClose:a,children:i.jsxs("div",{className:"flex flex-col gap-4 p-2 font-manrope font-semibold",children:[i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full flex items-center justify-center",children:i.jsx("img",{src:Yi,alt:"",className:"w-6 h-6"})}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"inline-flex items-center gap-2",children:[i.jsx("div",{className:"text-white text-sm font-semibold",children:e!=null&&e.listen_user?e.listen_user.slice(0,5)+"..."+e.listen_user.slice(-4):"-"}),i.jsx("span",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.listen_user)||"")},children:i.jsx("img",{src:Eo,alt:"",className:"w-4 h-4 cursor-pointer",onClick:u=>{u.stopPropagation(),navigator.clipboard.writeText((e==null?void 0:e.listen_user)||"")}})})]}),i.jsxs("div",{className:"flex flex-col text-[11px] text-[#a5a5a5]",children:[i.jsx("span",{children:cu(e==null?void 0:e.time)}),i.jsx(r,{date:e==null?void 0:e.time})]})]})]}),i.jsxs("div",{className:"flex flex-col gap-2 text-sm text-[#9b9b9b]",children:[i.jsxs("div",{className:"text-white flex items-center gap-2",children:[i.jsx("img",{src:e!=null&&e.success?qM:GM,alt:"",className:"w-4 h-4"}),"Status: ",e!=null&&e.success?"Success":"Failed"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Order ID:"})," ",(e==null?void 0:e.oid)||"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Type:"})," ",(e==null?void 0:e.fill_direction_type)||"-"]}),i.jsxs("div",{className:"flex items-center gap-1 text-white",children:["Direction:",i.jsxs("div",{className:`${o(e==null?void 0:e.dir)==="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":o(e==null?void 0:e.dir)==="Short"?"bg-[#ff797c]/20 text-[#ff797c]":(e==null?void 0:e.dir)==="Buy"?"bg-[#67ffbd]/20 text-[#67ffbd]":(e==null?void 0:e.dir)==="Sell"?"bg-[#ff797c]/20 text-[#ff797c]":"bg-[#767676]/20 text-[#cccccc]"} h-5 pl-1 pr-1.5 py-1 rounded-md flex items-center gap-1`,children:[i.jsx("div",{className:"w-3 h-3",children:(l=e==null?void 0:e.dir)!=null&&l.includes("Long")?(e==null?void 0:e.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"}):i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):(e==null?void 0:e.dir)==="Buy"?i.jsx(Os,{className:"text-[#67ffbd] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#ff797c] w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold",children:[(e==null?void 0:e.dir)||"-"," ",e!=null&&e.leverage?`${e.leverage}x`:""]})]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Price:"})," ",e!=null&&e.px?"$"+_r(e==null?void 0:e.px):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Size:"})," ",e!=null&&e.sz?_r(e==null?void 0:e.sz):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Entry Price:"})," ",e!=null&&e.markPrice?"$"+_r(e==null?void 0:e.markPrice):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"PnL:"})," ",e!=null&&e.closedPnl?"$"+_r(Math.abs(e==null?void 0:e.closedPnl)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Fee:"})," ",e!=null&&e.fee?"$"+_r(Math.abs(e==null?void 0:e.fee)):"-"]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Margin Mode:"})," ",(e==null?void 0:e.is_cross)==null||e!=null&&e.is_cross?"Cross":"Isolated"]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${e==null?void 0:e.coin}.svg`||qa,onError:u=>oa(u),alt:"",className:"w-5 h-5"}),i.jsxs("span",{className:"font-bold text-white",children:[e==null?void 0:e.coin,"/",(e==null?void 0:e.feeToken)||"USDC"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:"Message: "}),((c=e==null?void 0:e.message)==null?void 0:c.split("-")[0])||"-"]})]})]})})]})}const scn=()=>{var Jt;const{isConnected:t,address:e}=ns(),{setSignModalOpen:n,copyTradeWatchList:r,hyperToken:s}=m.useContext(Qr),[a,o]=m.useState(!1),[l,c]=m.useState(!1),[u,d]=m.useState([]),f=m.useRef(null),[x,g]=m.useState(0),[y,v]=m.useState(!1),[C,N]=m.useState(!0),[P,T]=m.useState([]),[M,F]=m.useState(!0),[$,L]=m.useState([]),[z,X]=m.useState([]),[ne,J]=m.useState([]),[K,te]=m.useState([]),[fe,q]=m.useState([]),[se,ae]=m.useState(!1),[W,V]=m.useState([]),[ee,oe]=m.useState([]),Ce=localStorage.getItem("isDateCopyTradeFormat")||"date",[me,we]=m.useState(Ce),[xe,be]=m.useState(!1);m.useEffect(()=>{localStorage.setItem("isDateCopyTradeFormat",me)},[me]),m.useEffect(()=>{(async()=>{var Je,It;try{const Yt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/")).json(),Rt=()=>bi.random().hex(),ot=(It=(Je=Yt.coins)==null?void 0:Je.filter(De=>!De.startsWith("@")&&!De.endsWith("/USDC")))==null?void 0:It.map(De=>({value:De,label:De.endsWith("/USDC")?De+" (Spot)":De,icon:`https://app.hyperliquid.xyz/coins/${De}.svg`,color:Rt()}));T(ot),F(!1)}catch(hn){console.error("Data extraction error:",hn),F(!1)}})()},[]);const[je,Ie]=m.useState({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:"",dexMarket:[]});m.useEffect(()=>{const Ye=["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"],Je=localStorage.getItem("positionFeed"),It=Je&&Array.isArray(JSON.parse(Je))?JSON.parse(Je):Ye;Ie(hn=>({...hn,positionFeed:It}))},[]);const Re=m.useRef(je);m.useEffect(()=>{Re.current=je},[je]);const Qe=async(Ye=!1)=>{var It,hn,Yt;g(0),v(!0),N(!0);const Je=window.localStorage.getItem("hyperToken");try{o(!0),c(!0);const Rt=window.localStorage.getItem("hyperAddress");if(!Je){n(!0);return}const ot={};(W==null?void 0:W.length)>0&&(ot.copy_trader=W),(ne==null?void 0:ne.length)>0&&(ot.trader=ne),(ee==null?void 0:ee.length)>0&&(ot.tag=ee),((It=je==null?void 0:je.coinFeed)==null?void 0:It.length)>0&&(ot.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(An=>An.trim()):je.coinFeed);const De=localStorage.getItem("positionFeed"),At=Ye?De&&JSON.parse(De)||["Open Position","Increase","Decrease","Changed Position","Position Closed","Other"]:je.positionFeed;(At==null?void 0:At.length)>0&&(At==null?void 0:At.length)<6&&(ot.position=At),((hn=je==null?void 0:je.typeFeed)==null?void 0:hn.length)>0&&((Yt=je==null?void 0:je.typeFeed)==null?void 0:Yt.length)<7&&(ot.type=je.typeFeed),je!=null&&je.directionFeed&&(ot.direction=je.directionFeed),je!=null&&je.statusFeed&&(je.statusFeed==="On"?ot.status=!0:je.statusFeed==="Off"?ot.status=!1:je.statusFeed==="All"&&delete ot.status);const ze=((je==null?void 0:je.dexMarket)||[]).map(An=>An.toLowerCase()),rt=ze.includes("hyperliquid"),mt=ze.includes("lighter"),Lt=[];rt&&!mt?Lt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):mt&&!rt?Lt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):Lt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const kt=await Promise.all(Lt.map(An=>fetch(An,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Rt,token:Je,offset:0,...Object.keys(ot).length&&{filters:ot}})}))),rn=(await Promise.all(kt.map(An=>An.json()))).filter(An=>An.success&&Array.isArray(An.data)).flatMap(An=>An.data).sort((An,kn)=>new Date(kn.time)-new Date(An.time));d(rn),g(An=>An+50),rn.length<50&&N(!1);const gn=rn.map(An=>({wallet:An.trader_wallet,name:An.wallet_name}));X(An=>{const kn=new Map(An.map(yn=>[yn.wallet,yn.name]));return gn.forEach(yn=>{kn.has(yn.wallet)||kn.set(yn.wallet,yn.name)}),Array.from(kn,([yn,Vn])=>({wallet:yn,name:Vn}))})}catch(Rt){console.log("Error :>> ",Rt)}finally{o(!1),c(!1),v(!1)}},Ke=async()=>{const Ye=window.localStorage.getItem("hyperToken");try{ae(!0);const Je="https://dextrabothypev2.nftinit.io/api/hyper/trade/feed/tag_list/",It=window.localStorage.getItem("hyperAddress");if(!Ye){n(!0);return}const hn=await fetch(Je,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():It,token:Ye})});if(!hn.ok)throw new Error(`Server responded with status ${hn.status}`);const Yt=await hn.json();if(Yt.success){te(Yt==null?void 0:Yt.data);const Rt=Yt==null?void 0:Yt.data.map(ot=>ot.tag?{tag:ot.tag,wallet:ot.wallet_address}:null).filter(ot=>ot!==null);q(Rt)}else console.log(Yt.error_message)}catch(Je){console.log("Error :>> ",Je)}finally{ae(!1)}};m.useEffect(()=>{Qe(!0),Ke()},[s]);const dt=async()=>{g(0),v(!0),N(!0);const Ye=window.localStorage.getItem("hyperToken");try{o(!0);const Je=window.localStorage.getItem("hyperAddress");if(!Ye){n(!0);return}const It=((je==null?void 0:je.dexMarket)||[]).map(ze=>ze.toLowerCase()),hn=It.includes("hyperliquid"),Yt=It.includes("lighter"),Rt=[];hn&&!Yt?Rt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):Yt&&!hn?Rt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):Rt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const ot=await Promise.all(Rt.map(ze=>fetch(ze,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Je,token:Ye,offset:0})}))),At=(await Promise.all(ot.map(ze=>ze.json()))).filter(ze=>ze.success&&Array.isArray(ze.data)).flatMap(ze=>ze.data).sort((ze,rt)=>new Date(rt.time)-new Date(ze.time));d(At),g(ze=>ze+50),At.length<50&&N(!1),localStorage.setItem("positionFeed",JSON.stringify([])),Ie({userWalletFeed:"",coinFeed:"",positionFeed:[],directionFeed:"",statusFeed:"",typeFeed:[],dexMarket:[]}),L([]),V([]),J([]),oe([])}catch(Je){console.log("Error :>> ",Je)}finally{o(!1),v(!1)}},tt=async()=>{var Je,It,hn,Yt,Rt;if(y)return;v(!0);const Ye=window.localStorage.getItem("hyperToken");try{const ot=window.localStorage.getItem("hyperAddress");if(!Ye){n(!0);return}const De={};(W==null?void 0:W.length)>0&&(De.copy_trader=W),(ne==null?void 0:ne.length)>0&&(De.trader=ne),(ee==null?void 0:ee.length)>0&&(De.tag=ee),je!=null&&je.coinFeed&&((Je=je==null?void 0:je.coinFeed)==null?void 0:Je.length)>0&&(De.coin=je.coinFeed.includes(",")?je.coinFeed.split(",").map(gn=>gn.trim()):je.coinFeed),((It=je==null?void 0:je.positionFeed)==null?void 0:It.length)>0&&((hn=je==null?void 0:je.positionFeed)==null?void 0:hn.length)<6&&(De.position=je.positionFeed),((Yt=je==null?void 0:je.typeFeed)==null?void 0:Yt.length)>0&&((Rt=je==null?void 0:je.typeFeed)==null?void 0:Rt.length)<7&&(De.type=je.typeFeed),je!=null&&je.directionFeed&&(De.direction=je.directionFeed),je!=null&&je.statusFeed&&(je.statusFeed==="On"?De.status=!0:je.statusFeed==="Off"?De.status=!1:je.statusFeed==="All"&&delete De.status);const At=((je==null?void 0:je.dexMarket)||[]).map(gn=>gn.toLowerCase()),ze=At.includes("hyperliquid"),rt=At.includes("lighter"),mt=[];ze&&!rt?mt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/"):rt&&!ze?mt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/"):mt.push("https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new/","https://dextrabothypev2.nftinit.io/api/hyper/trade/feed_new_lg/");const Lt=await Promise.all(mt.map(gn=>fetch(gn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():ot,token:Ye,offset:x,...Object.keys(De).length&&{filters:De}})}))),dn=(await Promise.all(Lt.map(gn=>gn.json()))).filter(gn=>gn.success&&Array.isArray(gn.data)).flatMap(gn=>gn.data).sort((gn,An)=>new Date(An.time)-new Date(gn.time));d(gn=>[...gn,...dn].sort((kn,yn)=>new Date(yn.time)-new Date(kn.time))),g(gn=>gn+50),dn.length<50&&N(!1);const rn=dn.map(gn=>({wallet:gn.trader_wallet,name:gn.wallet_name}));X(gn=>{const An=new Set(gn.map(yn=>yn.wallet)),kn=[...gn];return rn.forEach(yn=>{An.has(yn.wallet)||(An.add(yn.wallet),kn.push(yn))}),kn})}catch(ot){console.log("Error :>> ",ot)}finally{v(!1)}},nt=(Ye,Je)=>{let It;return function(...hn){clearTimeout(It),It=setTimeout(()=>{Ye.apply(this,hn)},Je)}},Le=()=>{const Ye=f.current;Ye.scrollTop+Ye.clientHeight>=Ye.scrollHeight-10&&C&&!y&&tt()};m.useEffect(()=>{const Ye=nt(Le,300),Je=f.current;return Je.addEventListener("scroll",Ye),()=>{Je.removeEventListener("scroll",Ye)}},[x,C,y]);const Be=m.useRef(null),ht=m.useRef(!1),pt=m.useRef(e),Gt=m.useRef(r),wt=m.useRef(s);m.useEffect(()=>{pt.current=e},[e]),m.useEffect(()=>{Gt.current=r},[r]),m.useEffect(()=>{wt.current=s},[s]);const nn="hyper_get_trade_message";m.useEffect(()=>{if(!s||ht.current)return;const Ye=Dy("https://dextrabothypesocketv2.nftinit.io/");return Be.current=Ye,ht.current=!0,Ye.on("connect",()=>{console.log("Socket connected");const Je=()=>{var Yt;const It=(Yt=pt.current)==null?void 0:Yt.toLowerCase(),hn=wt.current;It&&hn?Ye.emit("subscribe",{login:It,token:hn}):setTimeout(Je,300)};Je()}),Ye.on(nn,function(Je){var At;const It=Re.current,hn=(At=(It==null?void 0:It.dexMarket)||[])==null?void 0:At.map(ze=>ze.toLowerCase()),Yt=hn.includes("hyperliquid"),Rt=hn.includes("lighter"),De=(Array.isArray(Je)?Je:[Je]).filter(ze=>ze!=null&&ze.target_platform?Yt&&!Rt?ze.target_platform==="hyper":Rt&&!Yt?ze.target_platform==="lighter":!0:!1);d(ze=>{const rt=[...De,...ze],mt=Re.current;return rt==null?void 0:rt.filter(kt=>{var dn,rn,gn,An,kn,yn,Vn,Kn,Dn;if(!kt||(W==null?void 0:W.length)>0&&!(W!=null&&W.includes((dn=kt==null?void 0:kt.listen_user)==null?void 0:dn.toLowerCase()))||(ne==null?void 0:ne.length)>0&&!(ne!=null&&ne.includes((rn=kt==null?void 0:kt.trader_wallet)==null?void 0:rn.toLowerCase()))||(ee==null?void 0:ee.length)>0&&!(ee!=null&&ee.includes(kt==null?void 0:kt.tag))||((gn=mt.coinFeed)==null?void 0:gn.length)>0&&!((An=mt.coinFeed)!=null&&An.includes(kt==null?void 0:kt.coin)))return!1;if(((kn=mt==null?void 0:mt.typeFeed)==null?void 0:kn.length)>0){const Nn=((yn=mt==null?void 0:mt.typeFeed)==null?void 0:yn.includes("Twaps"))&&(kt==null?void 0:kt.is_twap)===!0,on=(kt==null?void 0:kt.fill_direction_type)&&((Vn=mt==null?void 0:mt.typeFeed)==null?void 0:Vn.includes(kt==null?void 0:kt.fill_direction_type));if(!(Nn||on))return!1}if(((Kn=mt==null?void 0:mt.positionFeed)==null?void 0:Kn.length)>0){const Xn=Un(kt);if(!((Dn=mt==null?void 0:mt.positionFeed)!=null&&Dn.includes(Xn)))return!1}else return!0;return!(mt!=null&&mt.directionFeed&&cn(kt)!==(mt==null?void 0:mt.directionFeed))})})}),Ye.io.on("reconnect_attempt",Je=>{console.log("reconnect_attempt",Je)}),Ye.io.on("reconnect",Je=>{console.log("reconnect",Je),Ye.emit("room",nn)}),Ye.io.on("reconnect_failed",()=>{console.log("reconnect_failed")}),Ye.io.on("reconnect_error",Je=>{console.log("reconnect_error",Je)}),Ye.io.on("error",Je=>{console.log("error",Je)}),Ye.on("disconnect",()=>{console.log("Socket disconnected"),ht.current=!1}),()=>{Ye.disconnect(),console.log("Socket cleanup on unmount")}},[s]);const cn=Ye=>Ye!=null&&Ye.dir?["Sell","Close Short","Open Short"].includes(Ye==null?void 0:Ye.dir)?"Short":["Buy","Close Long","Open Long"].includes(Ye==null?void 0:Ye.dir)?"Long":(Ye==null?void 0:Ye.dir)||"--":"--",Un=Ye=>{var hn,Yt;const Je=(Yt=(hn=Ye.message)==null?void 0:hn.split("-")[0])==null?void 0:Yt.trim();if(!Je)return"Other";const It=/^Position Changed \(/;return Je==="Close Position"?"Position Closed":Je==="Position Increase"?"Increase":Je==="Position Decreased"?"Decrease":It.test(Je)?"Changed Position":Je==="Open Position"?"Open Position":"Other"};function Xt({date:Ye}){const[Je,It]=m.useState($o(Ye));return m.useEffect(()=>{const hn=setInterval(()=>{It($o(Ye))},1e3);return()=>clearInterval(hn)},[Ye]),i.jsx("span",{className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:Je.dateTime})}const an={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"lg:hidden flex flex-col w-full p-2",children:i.jsx("button",{className:"px-2 py-2 text-xs font-medium rounded border border-gray-600 text-white hover:bg-[#1D1D1D] w-full bg-[#171717]",onClick:()=>be(!xe),children:xe?"Hide Filters":"Show Filters"})}),i.jsx("div",{className:`${xe?"block":"hidden"} lg:block mx-auto`,children:i.jsx(Qln,{advancedFilters:je,setAdvancedFilters:Ie,getFeedData:Qe,getFeedClearData:dt,dataCoin:P,selectedCoins:$,setSelectedCoins:L,isLoadingCoin:M,setIsLoadingCoin:F,walletTagData:K,walletTags:fe,searchWalletSellect:W,setSearchWalletSellect:V,walletTagLoading:se,tradeWalletData:z,selectTradeWalletData:ne,setSelectTradeWalletData:J,searchTagSellect:ee,setSearchTagSellect:oe,isWalletLoading:l})}),i.jsx(rcn,{feedData:u}),i.jsx("div",{ref:f,className:"hidden lg:flex flex-col items-start justify-start mt-4 overflow-scroll xl:min-w-max max-h-[calc(100%-50px)]",children:!u||(u==null?void 0:u.length)==0||a?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[72vh] w-[100%] sm:w-[75%] min-w-[970px] justify-center items-center text-center",children:a?i.jsx($a,{}):i.jsx("div",{className:"flex justify-center items-center min-w-[480px]",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 min-w-max overflow-x-hidden",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"The activities of the follower wallets will be displayed on this page."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Feed page includes the activities occur after a wallet is favorited."," "]})})]})]})})})}):i.jsx("ul",{className:"flex flex-col items-start justify-start gap-1",children:Array.isArray(u)&&u.length>0&&((Jt=u==null?void 0:u.map)==null?void 0:Jt.call(u,(Ye,Je)=>{var It,hn,Yt,Rt,ot,De,At,ze,rt,mt,Lt,kt,dn,rn,gn,An;return i.jsx("li",{children:i.jsxs("div",{className:"flex justify-start items-start gap-[11px]",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start h-full",children:[i.jsx("div",{className:`${(It=Ye==null?void 0:Ye.dir)!=null&&It.includes("Long")?(Ye==null?void 0:Ye.dir)==="Short > Long"?"bg-[#67ffbd]/20":(Ye==null?void 0:Ye.dir)==="Long > Short"?"bg-[#ff797c]/20":"bg-[#67ffbd]/20":(Ye==null?void 0:Ye.dir)=="Buy"?"bg-[#67ffbd]/20":"bg-[#ff797c]/20"} flex justify-center items-center w-6 h-6 rounded-full`,children:i.jsx("div",{className:"w-3 h-3 relative",children:(hn=Ye==null?void 0:Ye.dir)!=null&&hn.includes("Long")?(Ye==null?void 0:Ye.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(Ye==null?void 0:Ye.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(Ye==null?void 0:Ye.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsx("div",{className:"flex justify-center w-6",children:i.jsx("div",{className:"w-[1px] min-h-[163px] h-full border border-[#242424]"})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[6px] w-full min-w-max h-[176px] min-h-[176px] rounded-[18px] border border-[#232323]",children:[i.jsxs("div",{className:"flex justify-between items-center gap-2 w-full px-3 py-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("div",{className:"w-8 h-8 bg-[#6ed8ff] rounded-full relative",children:i.jsx("img",{src:Yi,alt:"",className:"w-8 h-8"})}),(Ye==null?void 0:Ye.target_platform)==="hyper"?i.jsxs("div",{className:"flex justify-start items-center gap-2 min-w-max",children:[i.jsx("img",{src:I1,alt:"hyper",className:"w-4 h-4 rounded-sm"}),i.jsx("span",{className:"text-white text-[13px] font-normal font-['Manrope'] leading-[13px] tracking-tight",children:"Hyperliquid"})]}):(Ye==null?void 0:Ye.target_platform)==="lighter"?i.jsxs("div",{className:"flex justify-start items-center gap-2 min-w-max",children:[i.jsx(bf,{className:"w-4 h-4 text-[#fff]"}),i.jsx("span",{className:"text-white text-[13px] font-normal font-['Manrope'] leading-[13px] tracking-tight",children:"Lighter"})]}):""]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px]",children:[i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${Ye==null?void 0:Ye.listen_user}`,"_blank")},className:"flex justify-start items-center gap-1.5 cursor-pointer",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-none ",children:(Ye==null?void 0:Ye.listen_user)&&((Yt=Ye==null?void 0:Ye.listen_user)==null?void 0:Yt.slice(0,5))+"..."+((Rt=Ye==null?void 0:Ye.listen_user)==null?void 0:Rt.slice(-4))}),i.jsx("img",{onClick:kn=>{kn.stopPropagation(),navigator.clipboard.writeText(Ye==null?void 0:Ye.listen_user),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight",children:[i.jsxs("span",{className:"text-white text-[11px] font-normal font-['Manrope'] leading-[13px] tracking-tight min-w-max ml-[1px]",children:["Order ID:"," ",i.jsx("span",{className:"text-[#a5a5a5]",children:(Ye==null?void 0:Ye.oid)&&(Ye==null?void 0:Ye.oid)})]}),i.jsx("span",{onClick:kn=>{kn.stopPropagation(),navigator.clipboard.writeText(Ye==null?void 0:Ye.oid),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"cursor-pointer pr-0.5",children:i.jsx("img",{src:Eo,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})]})]})]}),i.jsxs("div",{className:"flex flex-col items-end justify-start gap-[2px] w-full pl-2 pt-2 relative",children:[i.jsx("div",{onClick:()=>{we(me=="time"?"date":"time")},className:"text-[#a5a5a5] text-[11px] font-normal font-manrope leading-[13px] tracking-tight cursor-pointer",children:me=="time"?i.jsx(Xt,{date:Ye==null?void 0:Ye.time}):cu(Ye==null?void 0:Ye.time)}),i.jsxs("div",{className:"flex justify-start items-center gap-2 -m-[2px]",children:[i.jsxs("div",{children:[i.jsxs("span",{className:"text-[#9b9b9b] text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:["opened a new"," ",(Ye==null?void 0:Ye.dir)=="Sell"?"spot sell":(Ye==null?void 0:Ye.dir)=="Buy"?"spot buy":(ot=Ye==null?void 0:Ye.dir)==null?void 0:ot.toLowerCase()," ","position for"," "]}),i.jsxs("span",{className:"pl-1 text-white text-[13px] font-normal font-manrope leading-[21px] tracking-tight",children:[Ye==null?void 0:Ye.coin,"/",(Ye==null?void 0:Ye.feeToken)==null?"USDC":Ye==null?void 0:Ye.feeToken]})]}),i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${an[Ye==null?void 0:Ye.coin]||((De=Ye==null?void 0:Ye.coin)==null?void 0:De.split("/")[0])}.svg`||qa,alt:Ye==null?void 0:Ye.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:kn=>oa(kn)})})]})]})]}),i.jsx("div",{className:"px-2",children:i.jsx("div",{className:"w-full min-w-auto min-w-[920px] h-[72px] min-h-[72px] bg-[#232323] rounded-xl border border-[#353535] pt-4 pl-4",children:i.jsxs("div",{className:"flex justify-start items-center gap-4 overflow-x-scroll scroll-smooth",children:[i.jsxs("div",{className:"sticky left-0 z-[8] bg-[#232323] flex justify-start items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide",children:"Asset"}),i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{className:"w-5 h-5 bg-transparent rounded-[256px]",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${an[Ye==null?void 0:Ye.coin]||((At=Ye==null?void 0:Ye.coin)==null?void 0:At.split("/")[0])}.svg`||qa,alt:Ye==null?void 0:Ye.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:kn=>oa(kn)})}),i.jsxs("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:[Ye==null?void 0:Ye.coin,"/",(Ye==null?void 0:Ye.feeToken)==null?"USDC":Ye==null?void 0:Ye.feeToken]})]})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide",children:"Direction"}),i.jsx("div",{className:"flex justify-start items-center",children:i.jsxs("div",{className:`${(ze=Ye==null?void 0:Ye.dir)!=null&&ze.includes("Long")?(Ye==null?void 0:Ye.dir)==="Short > Long"?"text-[#67ffbd] bg-[#67ffbd]/20":(Ye==null?void 0:Ye.dir)==="Long > Short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20":(Ye==null?void 0:Ye.dir)=="Buy"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex min-w-max`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:(rt=Ye==null?void 0:Ye.dir)!=null&&rt.includes("Long")?(Ye==null?void 0:Ye.dir)==="Short > Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(Ye==null?void 0:Ye.dir)==="Long > Short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):(Ye==null?void 0:Ye.dir)=="Buy"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:[(Ye==null?void 0:Ye.dir)=="Sell"?"Sell":(Ye==null?void 0:Ye.dir)=="Buy"?"Buy":(Ye==null?void 0:Ye.dir)=="Close Short"?"Short":(Ye==null?void 0:Ye.dir)=="Close Long"?"Long":(Ye==null?void 0:Ye.dir)=="Open Short"?"Short":(Ye==null?void 0:Ye.dir)=="Open Long"?"Long":Ye!=null&&Ye.dir?Ye==null?void 0:Ye.dir:"--",Ye!=null&&Ye.leverage?" - "+(Ye==null?void 0:Ye.leverage)+"x":""]})]})})]}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Type",value:Ye!=null&&Ye.fill_direction_type?Ye!=null&&Ye.is_twap?`${Ye==null?void 0:Ye.fill_direction_type} - Twap`:Ye==null?void 0:Ye.fill_direction_type:"--",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Price",value:_r(Ye==null?void 0:Ye.px),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Size",value:_r(Ye==null?void 0:Ye.sz),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Entry Price",value:Ye!=null&&Ye.markPrice?`$${_r(Ye==null?void 0:Ye.markPrice)}`:_r(Ye==null?void 0:Ye.markPrice),color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"PnL",value:Ye!=null&&Ye.closedPnl?`$${_r(Math.abs(Ye==null?void 0:Ye.closedPnl))}`:_r(Math.abs(Ye==null?void 0:Ye.closedPnl)),color:`${(Ye==null?void 0:Ye.closedPnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"}`}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Fee",value:Ye!=null&&Ye.fee?`$${_r(Math.abs(Ye==null?void 0:Ye.fee))}`:_r(Math.abs(Ye==null?void 0:Ye.fee)),color:"text-[#ff787b]"}),i.jsx("div",{className:"w-px h-8 bg-[#353535]"})]}),i.jsxs("div",{className:"flex justify-start items-center gap-4",children:[i.jsx(Tv,{title:"Margin Mode",value:(Ye==null?void 0:Ye.is_cross)==null||Ye!=null&&Ye.is_cross?"Cross":"Isolated",color:"text-white"}),i.jsx("div",{className:"w-px h-8 bg-transparent"})]})]})})}),i.jsx("div",{className:`${Ye!=null&&Ye.success?"bg-[#67ffbd]/20 border-[#67ffbd]/25":"bg-[#ff797c]/20 border-[#ff797c]/25"} flex justify-start items-center h-8 max-h-8 rounded-bl-[18px] rounded-br-[18px] border-t w-full py-1.5`,children:i.jsxs("div",{className:"text-white text-sm font-manrope leading-none flex justify-start items-center px-2 gap-2",children:[Ye!=null&&Ye.success?i.jsx("img",{src:qM,alt:""}):i.jsx("img",{src:GM,alt:""}),i.jsx("div",{className:`${Ye!=null&&Ye.success?"text-[#67ffbd]":"text-[#ff787b]"} text-xs font-semibold font-manrope leading-3 tracking-tight`,children:Ye!=null&&Ye.success?"Status:":"System Message:"}),i.jsxs("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-1",children:[Ye!=null&&Ye.message&&((mt=Ye==null?void 0:Ye.message)==null?void 0:mt.length)>100?`${(Lt=Ye==null?void 0:Ye.message)==null?void 0:Lt.slice(0,100)}...`:Ye==null?void 0:Ye.message," ","on"]}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${Ye==null?void 0:Ye.trader_wallet}`,"_blank")},className:"h-[18px] px-1.5 py-1 bg-white rounded-[256px] justify-center items-center gap-0.5 inline-flex cursor-pointer -ml-0.5",children:i.jsx("div",{className:"text-[#273f35] text-xs font-semibold font-manrope leading-[13px]",children:Ye!=null&&Ye.wallet_name?Ye==null?void 0:Ye.wallet_name:Ye!=null&&Ye.trader_wallet?((kt=Ye==null?void 0:Ye.trader_wallet)==null?void 0:kt.slice(0,5))+"..."+((dn=Ye==null?void 0:Ye.trader_wallet)==null?void 0:dn.slice(-4)):"--"})}),i.jsxs("div",{className:"text-white text-xs font-semibold font-manrope leading-3 tracking-tight -ml-0.5",children:["by"," "]}),i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${Ye==null?void 0:Ye.listen_user}`,"_blank")},className:"h-[18px] px-1.5 py-1 bg-[#a5ffd8] rounded-[256px] justify-center items-center gap-0.5 inline-flex -ml-0.5 cursor-pointer",children:i.jsx("div",{className:"text-[#1e563e] text-xs font-semibold font-manrope leading-[13px]",children:Ye!=null&&Ye.tag?Ye==null?void 0:Ye.tag:Ye!=null&&Ye.listen_user?((rn=Ye==null?void 0:Ye.listen_user)==null?void 0:rn.slice(0,5))+"..."+((gn=Ye==null?void 0:Ye.listen_user)==null?void 0:gn.slice(-4)):"--"})}),(Ye==null?void 0:Ye.message)&&((An=Ye==null?void 0:Ye.message)==null?void 0:An.trim())=="Reverse Direction detected: Action skipped."&&i.jsx("a",{href:"https://docs.dextrabot.com/copy-trade/copytrade/reverse-direction",target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-lg shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-center items-center gap-2.5 cursor-pointer bg-white",children:i.jsx("div",{className:"text-[#1b1b1b] text-[11px] font-medium font-['Inter'] leading-[8px]",children:"Read Details"})})]})})]})]})},Je)}))})})]})},Tv=({title:t,value:e,color:n})=>i.jsxs("div",{className:"flex flex-col justify-start items-start gap-1 min-w-max",children:[i.jsx("div",{className:"text-[#9b9b9b] text-xs font-normal font-manrope leading-[13px] tracking-wide min-w-max",children:t}),i.jsx("div",{className:"flex justify-start items-center min-w-max",children:i.jsx("div",{className:`${n} text-sm font-semibold font-manrope leading-[13px] tracking-tight min-w-max`,children:e})})]}),icn=({isMenu:t,setIsMenu:e,handleMenuChange:n})=>{const{trackedWatchList:r,getTrackedWatchList:s,copyTradeWatchList:a,getCopyTradeWatchList:o}=m.useContext(Qr);return m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&(s(),o())},[t]),i.jsx("div",{className:"flex flex-col items-start gap-4 justify-start text-white w-full h-full font-manrope",children:i.jsxs("div",{className:"flex flex-col items-start justify-start w-full gap-[17px] bg-[#161616] max-w-full font-manrope h-full",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 font-manrope max-w-full w-full bg-[#161616] ",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px] min-w-max",children:"My Activities"})})]}),i.jsxs("div",{className:"flex justify-center sm:justify-between items-center gap-2 flex-wrap sm:flex-nowrap max-h-max w-full sm:pr-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx(uSe,{title:"My Activities",isMenu:t,setIsMenu:e,handleMenuChange:n,lengthInfo:a?a.length:0}),i.jsx(uSe,{title:"Tracked Wallets",isMenu:t,setIsMenu:e,handleMenuChange:n,lengthInfo:r?r.length:0})]}),i.jsx("div",{className:"flex justify-center w-full sm:justify-end",children:i.jsx(Yln,{isMenu:t})})]}),i.jsx("div",{className:"flex items-start justify-start gap-2 w-full lg:w-auto lg:min-w-[860px] lg:max-w-max h-full",children:t==="Tracked Wallets"?i.jsxs("div",{className:"w-full",children:[i.jsx("div",{className:"hidden lg:block",children:i.jsx(Hln,{})}),i.jsx("div",{className:"block lg:hidden",children:i.jsx(Wln,{})})]}):t==="My Activities"?i.jsx("div",{className:"flex flex-col lg:flex-row items-start justify-start gap-2 w-full lg:min-w-[900px] lg:max-w-max h-full",children:i.jsx(scn,{})}):i.jsx("div",{className:"flex items-start justify-start gap-2 w-full min-w-[860px] max-w-[1180px] h-full",children:"An unexpected error occurred."})})]})})},uSe=({title:t,lengthInfo:e,isMenu:n,setIsMenu:r,handleMenuChange:s})=>i.jsxs("div",{onClick:()=>s(t),className:`${n===t?"bg-white text-[#161616]":"bg-[#1b1b1b] text-[#9b9b9b]"} h-8 px-3 py-2 rounded-[256px] justify-center items-center gap-2 inline-flex cursor-pointer`,children:[i.jsx("div",{className:"text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:t}),i.jsx("div",{className:`${n===t?"text-white bg-[#ff5a5a]":"text-[#9b9b9b] bg-[#282828]"} p-1 rounded-md justify-center items-center gap-0.5 flex`,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-wide min-w-max",children:e})})]}),acn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,isReferralCode:a,setIsReferralCode:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u,setSignModalOpen:d}=m.useContext(Qr),f=Kl(),[x,g]=m.useState(null);m.useEffect(()=>{const v=f.hash;v==="#tracked-wallets"?g("Tracked Wallets"):(v==="#my-activities"||window.history.replaceState(null,"",`${window.location.pathname}#my-activities`),g("My Activities"))},[f.hash]);const y=v=>{g(v),v==="Tracked Wallets"?window.history.replaceState(null,"",`${window.location.pathname}#tracked-wallets`):v==="My Activities"&&window.history.replaceState(null,"",`${window.location.pathname}#my-activities`)};return m.useEffect(()=>{(async()=>{var P,T;const C=window.localStorage.getItem("hyperToken"),N=window.localStorage.getItem("hyperAddress");if(!(!C||!N))try{const M=await ki(N.toLowerCase(),C);M!=null&&M.success?(t(M==null?void 0:M.telegram_chat_id),e(M==null?void 0:M.subscriber_role),n(M==null?void 0:M.subs_expire_day),r((P=M==null?void 0:M.mushboomer_counts)==null?void 0:P.eth),s((T=M==null?void 0:M.mushboomer_counts)==null?void 0:T.sol),o(M==null?void 0:M.referral_code),l(M==null?void 0:M.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(M){console.error("Token verification error:",M),console.error(M.message||"An unknown error occurred.")}})()},[]),x?i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Live Transaction Feed for Your Favorite Hyperliquid Wallets - Dextrabot"}),i.jsx("meta",{name:"description",content:"Stay updated with live transactions from your favorite HyperLiquid wallets. Monitor trades in real time and react instantly with DextraBot’s transaction feed."}),i.jsx("meta",{name:"og:title",content:"Live Transaction Feed for Your Favorite Hyperliquid Wallets - Dextrabot"}),i.jsx("meta",{name:"og:description",content:"Stay updated with live transactions from your favorite HyperLiquid wallets. Monitor trades in real time and react instantly with DextraBot’s transaction feed."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/my-activities"})]})}),i.jsx("div",{className:"flex justify-center items-center w-full h-screen min-h-max px-4 pt-4 bg-[#161616]",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full xl:w-max flex-grow xl:flex-grow-0",children:i.jsx(icn,{isMenu:x,setIsMenu:g,handleMenuChange:y})})})]}):null},ocn=({open:t,setOpen:e,handleEnterCode:n,inputValue:r,isEnterLoading:s})=>i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-6 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2",children:[i.jsx("div",{className:"text-center text-white text-[24px] font-manrope leading-none",children:"Join now"}),i.jsx("div",{className:"w-[300px] text-center text-white/60 text-sm font-medium font-manrope leading-[18px] tracking-[0.28px] pt-4 pb-2 px-2",children:"Using a referral code will give you a 4% discount on your fees."})]}),i.jsxs("div",{role:"status",className:`${s?"":"hidden"} flex justify-center items-center w-full max-h-8`,children:[i.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}),i.jsx("div",{onClick:a=>{a.preventDefault(),s||n()},className:`${s?"cursor-not-allowed":"cursor-pointer"} w-[286px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex`,children:i.jsxs("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:["Join with code: ",r]})})]})})})})})]}),lcn=({handleEnterCode:t,handleChange:e,error:n,handleGenerateCode:r,handleGenerateChange:s,generateError:a,generateData:o,userReferansCode:l,setInputValue:c,inputValue:u,setGenerateValue:d,generateValue:f,setIsMenu:x,isMenu:g,setGenerateCode:y,generateCode:v,setIsGenerateLoading:C,isGenerateLoading:N,setIsEnterLoading:P,isEnterLoading:T,divRef:M,isEnterModal:F,setIsEnterModal:$})=>{const{mushboomerETH:L,mushboomerSOL:z,isReferralCode:X,isWhitelist:ne}=m.useContext(Qr),J=v?`https://app.dextrabot.com/referral/${v}`:"";return i.jsxs(i.Fragment,{children:[!l&&i.jsx(ocn,{open:F,setOpen:$,handleEnterCode:t,inputValue:u,isEnterLoading:T}),i.jsxs("div",{ref:M,className:"flex flex-col justify-start items-start gap-[30px] h-max relative bg-[#232323] rounded-2xl overflow-hidden pt-[18px] px-[18px] w-max mx-auto lg:mx-0",children:[i.jsx("div",{className:"text-white text-2xl font-semibold font-manrope leading-[8px]",children:"Referrals"}),i.jsxs("div",{className:"flex flex-col justify-start items-start",children:[i.jsxs("div",{className:"flex justify-start items-center w-full gap-[8px] pt-[2px]",children:[i.jsx("div",{onClick:()=>x("Enter Code"),className:`${g=="Enter Code"?"text-white":"text-[#8b8b8b]"} w-[136px] h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer`,children:"Enter Code"}),i.jsx("div",{onClick:()=>x("Create Code"),className:`${g=="Create Code"?"text-white":"text-[#8b8b8b]"} w-[136px] h-[37px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer min-w-max`,children:"Create Code"})]}),i.jsxs("div",{className:"flex justify-start items-center w-full",children:[i.jsx("div",{className:`${g=="Enter Code"?"bg-white":"bg-[#8b8b8b]"} w-[143px] h-0.5 `}),i.jsx("div",{className:`${g=="Create Code"?"bg-white":"bg-[#8b8b8b]"} w-[143px] h-0.5 `})]})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-2 w-full",children:[i.jsxs("div",{className:`${l&&g=="Enter Code"||g=="Create Code"&&v||!(ne||L>0||z>0)||g=="Claim"?"hidden":""} flex justify-start items-center gap-[4px] has-tooltip relative`,children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:g=="Enter Code"?"Referral Code":"Set your Referral Code"}),i.jsx(ji,{className:"text-[#7C7C7C]"}),i.jsx("span",{className:`${g=="Enter Code"?"ml-44":"ml-32"}`,children:i.jsx(Ma,{content:"Valid characters: '_', '-', 0-9, A-Z, 4-10 length",positionTop:!0,alignRight:!1})})]}),g=="Enter Code"?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:u,onChange:e,placeholder:"Code",className:`${u!=null&&u!=null&&u!=""?"border border-[#8d67ff]":""} ${l?"hidden":""} py-[4px] bg-[#1b1b1b] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-[286px] min-w-[286px] px-4 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[38px]`}),i.jsx("div",{className:`${!l&&n?"block":"hidden"} w-[286px] h-8 px-3 py-2 bg-[#3b2626] rounded-md justify-start items-center gap-2.5 inline-flex`,children:i.jsx("div",{className:"text-[#ff787b] text-xs font-semibold font-manrope leading-none",children:n&&n})}),T?i.jsxs("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:[i.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:`${l?"block":"hidden"} w-[286px] h-8 px-3 py-2 rounded-md justify-start items-center gap-2.5 inline-flex mt-[40px] mb-[60px]`,children:i.jsxs("div",{className:"text-white text-base font-semibold font-manrope leading-[8px] flex flex-col items-center justify-center gap-[18px] w-full",children:[i.jsx("img",{src:ylt,alt:""}),l&&`'${l}' has been applied.`]})}),i.jsx("div",{onClick:()=>{t()},className:`${l?"hidden":""} w-[286px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex mt-2 cursor-pointer`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Enter Code"})}),i.jsx("div",{className:`${l?"hidden":""} w-[286px] h-14 p-2.5 bg-[#ffd979]/20 rounded-md justify-start items-center gap-2.5 inline-flex`,children:i.jsx("div",{className:"w-[266px] text-[#ffd978] text-[13px] font-semibold font-manrope leading-none",children:"Using a referral code will give you a 4% discount on your fees"})})]}):g=="Claim"?i.jsx(i.Fragment,{children:i.jsx("div",{className:"flex justify-center items-cente w-[286px] mt-[54px] mb-[70px]",children:i.jsx("div",{className:"text-[#7c7c7c] text-[16px] font-semibold font-['Manrope'] leading-[8px] ",children:"Coming soon"})})}):ne||L>0||z>0?i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",value:f,onChange:s,placeholder:"Code",className:`${f!=null&&f!=null&&f!=""?"border border-[#8d67ff]":""} ${v?"hidden":""} py-[4px] bg-[#1b1b1b] rounded-md block text-white text-sm font-medium font-inter leading-[8px] w-[286px] min-w-[286px] px-4 focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#7F7F7F] placeholder:font-inter placeholder:text-sm placeholder:font-medium placeholder:leading-[8px] h-[38px]`,disabled:!!v}),i.jsx("div",{className:`${!v&&a?"block":"hidden"} w-[286px] h-8 px-3 py-2 bg-[#3b2626] rounded-md justify-start items-center gap-2.5 inline-flex`,children:i.jsx("div",{className:"text-[#ff787b] text-xs font-semibold font-manrope leading-none",children:a&&a})}),N?i.jsxs("div",{role:"status",className:"flex justify-center items-center w-full my-[30px]",children:[i.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:`${v?"block":"hidden"} w-full h-8 px-3 py-2 rounded-md justify-start items-center gap-2.5 inline-flex mt-[40px] mb-[60px]`,children:i.jsxs("div",{className:"text-white text-base font-semibold font-manrope leading-[8px] flex flex-col items-center justify-center gap-[18px] w-full",children:[i.jsx("img",{src:vlt,alt:""}),v&&`'${v}' created successfully!`]})}),i.jsx("div",{onClick:()=>{r()},className:`${v?"hidden":""} w-[286px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex mt-2 cursor-pointer`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Create Code"})})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center w-[286px] gap-4 px-4 text-white",children:[i.jsx("span",{className:"text-center mb-5 font-bold underline",children:"You need to have at least 1 Mushboomer ETH or 1 Mushboomer SOL, or have entered a referral code to be able to copy trade."}),i.jsx("div",{onClick:()=>{window.open("https://blur.io/collection/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Eth"})}),i.jsx("div",{onClick:()=>{window.open("https://www.tensor.trade/trade/mushboomers","_blank")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Mushboomers Sol"})}),i.jsx("div",{onClick:()=>{x("Enter Code")},className:"w-[184px] h-8 px-6 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Referral Code"})})]})]}),i.jsx("div",{className:`${v&&g=="Create Code"||l&&g=="Enter Code"||g=="Claim"?"hidden":"block"} w-[286px] h-px bg-[#3e3e3e] -mt-[14px]`}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[25px] -mt-[14px] bg-[#393939] -mx-[18px] px-4 py-4 h-full w-[328px] border-t border-dashed border-neutral-500",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[10px]",children:[i.jsx("div",{className:"text-[#cfcfcf] text-[13px] font-semibold font-manrope leading-[8px]",children:"Your Referral Code"}),i.jsxs("div",{onClick:K=>{K.preventDefault(),v&&(navigator.clipboard.writeText(v||""),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}))},className:`${v?"cursor-pointer":"cursor-not-allowed"} flex justify-start items-center gap-1.5`,children:[i.jsx("img",{src:WM,alt:"",className:"text-white w-[18px] h-[18px]"}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[21px]",children:v||"You haven't created a referral code yet"})]})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[10px]",children:[i.jsx("div",{className:"text-[#cfcfcf] text-[13px] font-semibold font-manrope leading-[8px]",children:"Your Referral URL"}),i.jsxs("div",{onClick:K=>{K.preventDefault(),(v||o)&&(navigator.clipboard.writeText(v?`https://app.dextrabot.com/referral/${v}`:o&&o),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}))},className:`${v||o?"cursor-pointer":"cursor-not-allowed"} flex justify-start items-center gap-1.5`,children:[i.jsx("img",{src:WM,alt:"",className:"text-white w-[18px] h-[18px]"}),i.jsx("div",{className:`${v||o?"underline":"no-underline"} text-[#82ffc8] text-sm font-medium font-manrope leading-[21px]`,children:v?J.slice(0,36)+"...":o?o.slice(0,30)+"...":i.jsx("span",{className:"text-white",children:"-"})})]})]})]})]})]})},TC=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s})=>{const a=()=>{r(n===e?`-${e}`:e)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>a(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope`,children:[i.jsx("div",{className:`${n.includes(e)?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(uz,{sortKey:e,state:n,className:""})]})})};function ccn({open:t,setOpen:e}){return i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:fae,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2",children:[i.jsx("div",{className:"text-center text-white text-[24px] font-manrope leading-none",children:"Your claim is being processed"}),i.jsx("div",{className:"w-[300px] text-center text-white/60 text-sm font-medium font-manrope leading-[18px] tracking-[0.28px] pt-4 pb-8 px-2",children:"Referral Claim process may take 24h to verify and complete your transaction. If anything goes wrong after 24h, you can open a ticket on discord."})]})]})})})})})]})}const ucn=({data:t,dataLoading:e,dataError:n,height:r,handleRefTable:s,dataUsage:a,dataUsageLoading:o,dataUsageError:l,setIsOnTableTab:c,isOnTableTab:u})=>{var fe,q,se,ae;const{isConnected:d,address:f}=ns(),{setSignModalOpen:x,hyperToken:g}=m.useContext(Qr),[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState(!1),M=m.useMemo(()=>{var V;const W=new Map;return(V=t==null?void 0:t.claim_lists)==null||V.forEach(ee=>{var de;const oe=((de=ee==null?void 0:ee.subscriber_address)==null?void 0:de.toLowerCase())||"";if(!W.has(oe))W.set(oe,{...ee,total_ref_claimable:parseFloat(ee==null?void 0:ee.total_ref_claimable)||0});else{const Ce=W.get(oe);W.set(oe,{...Ce,total_ref_claimable:(Ce==null?void 0:Ce.total_ref_claimable)+(parseFloat(ee==null?void 0:ee.total_ref_claimable)||0)})}}),Array.from(W.values())},[t]),F="-total_ref_claimable",[$,L]=m.useState(F),z=W=>M==null?void 0:M.sort((V,ee)=>{const oe=V.subscriber_address?V.subscriber_address.toLowerCase():"",de=ee.subscriber_address?ee.subscriber_address.toLowerCase():"";return W==="-level"?ee.level-V.level:W==="level"?V.level-ee.level:W==="-subscriber_address"?oe<de?-1:oe>de?1:0:W==="subscriber_address"?oe>de?-1:oe<de?1:0:W==="-total_ref_claimable"?ee.total_ref_claimable-V.total_ref_claimable:W==="total_ref_claimable"?V.total_ref_claimable-ee.total_ref_claimable:W==="-last_active_date"?new Date(ee.last_active_date)-new Date(V.last_active_date):W==="last_active_date"?new Date(V.last_active_date)-new Date(ee.last_active_date):0}),X="-created_at",[ne,J]=m.useState(X),K=W=>{var V;return(V=a.claim_lists)==null?void 0:V.sort((ee,oe)=>{const de=ee.address?ee.address.toLowerCase():"",Ce=oe.address?oe.address.toLowerCase():"";return W==="-level"?oe.level-ee.level:W==="level"?ee.level-oe.level:W==="-address"?de<Ce?-1:de>Ce?1:0:W==="address"?de>Ce?-1:de<Ce?1:0:W==="-created_at"?new Date(oe.created_at)-new Date(ee.created_at):W==="created_at"?new Date(ee.created_at)-new Date(oe.created_at):0})},te=async()=>{try{v(!0);const W=window.localStorage.getItem("hyperToken"),V="https://dextrabothypev2.nftinit.io/api/subscriber/claim/request/";if(!W){x(!0),v(!1);return}const ee=window.localStorage.getItem("hyperAddress"),de=await(await fetch(V,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():ee,token:W})})).json();de.success?(s(),T(!0)):(console.log(de.error_message),N(de.error_message),tn.error(de.error_message))}catch(W){console.error("Error in like function:",W),N(W.message||"An unknown error occurred.")}finally{v(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(ccn,{open:P,setOpen:T}),i.jsxs("div",{style:r==0?{maxHeight:"450px"}:{maxHeight:r},className:"flex flex-col justify-start items-start text-white font-manrope rounded-2xl h-auto sm:h-full w-full lg:w-max overflow-auto gap-3",children:[i.jsx("div",{className:"flex justify-between items-center w-full px-6 bg-[#232323] p-4 roundend-[16px]",children:i.jsxs("div",{className:"flex flex-col items-start justify-end gap-2",children:[i.jsxs("div",{className:"flex justify-start items-start gap-2",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start w-full h-full gap-2",children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:"Total Earnings"}),i.jsx("div",{className:"text-[#67ffbd] text-[21px] font-semibold font-manrope leading-[21px]",children:t!=null&&t.total_claim_fee?`$${_r(t==null?void 0:t.total_claim_fee)}`:"--"})]}),i.jsx("div",{className:"w-px h-10 bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-start w-full h-full gap-2",children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:"Claimed"}),i.jsx("div",{className:"text-[#67ffbd] text-[21px] font-semibold font-manrope leading-[21px]",children:t!=null&&t.total_claimed_fee?`$${_r(t==null?void 0:t.total_claimed_fee)}`:"--"})]}),i.jsx("div",{className:"w-px h-10 bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-start w-full h-full gap-2",children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:"Pending Earnings"}),i.jsx("div",{className:"text-[#67ffbd] text-[21px] font-semibold font-manrope leading-[21px]",children:t!=null&&t.unexpired_fee?`$${_r(t==null?void 0:t.unexpired_fee)}`:"--"})]}),i.jsx("div",{className:"w-px h-10 bg-[#353535]"}),i.jsxs("div",{className:"flex flex-col items-start justify-start w-full h-full gap-2",children:[i.jsx("div",{className:"text-[#7c7c7c] text-[13px] font-semibold font-manrope leading-[8px] min-w-max",children:"Available to Claim"}),i.jsx("div",{className:"text-[#67ffbd] text-[21px] font-semibold font-manrope leading-[21px]",children:t!=null&&t.total_claimable_fee?`$${_r(t==null?void 0:t.total_claimable_fee)}`:"--"})]}),i.jsx("div",{onClick:W=>{W.preventDefault(),g?y||((t==null?void 0:t.total_claimable_fee)<50?tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:"Minimum claim limit is"}),i.jsx("span",{style:{color:"#ffffff",paddingLeft:"5px"},children:"$50."})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}):(t==null?void 0:t.total_claimable_fee)>=50&&te()):x(!0)},className:`${y?"cursor-not-allowed":"cursor-pointer"} claim-button-claim-button flex justify-center items-center px-4 rounded-md font-inter font-semibold text-[13px] not-italic h-8 leading-[8px] text-white min-w-[80px] ml-4`,children:y?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[40px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",class:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{class:"sr-only",children:"Loading..."})]}):i.jsx("span",{className:"min-w-max",children:"Claim"})})]}),i.jsxs("div",{className:"flex justify-between items-center w-full h-full gap-1.5",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start",children:[i.jsxs("div",{className:"flex justify-start items-center w-full gap-[8px]",children:[i.jsx("div",{onClick:()=>c("Earnings"),className:`${u=="Earnings"?"text-white":"text-[#8b8b8b]"} w-[116px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer`,children:"Earnings"}),i.jsx("div",{onClick:()=>c("Referrals"),className:`${u=="Referrals"?"text-white":"text-[#8b8b8b]"} w-[116px] px-2 py-1.5 justify-center items-center gap-2 inline-flex text-[13px] font-semibold font-manrope leading-[8px] cursor-pointer min-w-max`,children:"Referrals"})]}),i.jsxs("div",{className:"flex justify-start items-center w-full pt-1.5",children:[i.jsx("div",{className:`${u=="Earnings"?"bg-white":"bg-[#8b8b8b]"} w-[123px] h-0.5 `}),i.jsx("div",{className:`${u=="Referrals"?"bg-white":"bg-[#8b8b8b]"} w-[123px] h-0.5 `})]})]}),i.jsx("div",{className:"text-[#aaaaaa] text-xs font-semibold font-manrope leading-none max-w-max mr-2",children:"• Minimum Withdrawal Amount: $50"})]})]})}),i.jsx("div",{className:"w-full min-w-[600px] max-w-[790px] h-full overflow-x-scroll relative overflow-y-scroll flex-grow bg-[#242424]",children:u=="Earnings"?i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#242424] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sticky left-0 h-8 pl-6 min-w-[150px] sm:min-w-[170px] z-[8] bg-[#242424] rounded-tl-2xl",children:i.jsx(TC,{title:"Referred Wallet",sortKey:"subscriber_address",sortOption:$,setSortOption:L,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(TC,{title:"Level",sortKey:"level",sortOption:$,setSortOption:L,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 min-w-[110px] sm:min-w-[110px] rounded-tr-2xl pl-1 pr-4",children:i.jsx(TC,{title:"Earnings",sortKey:"total_ref_claimable",sortOption:$,setSortOption:L,isFilterIcon:!1})})]})}),i.jsx("tbody",{children:!t||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[45%] w-max",children:i.jsx($a,{})})})}):n&&!(t!=null&&t.claim_lists)?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[27%] w-max",children:i.jsx(Vl,{})})})}):(t==null?void 0:t.length)==0||((fe=t==null?void 0:t.claim_lists)==null?void 0:fe.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[30%] w-max",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No referral earnings yet."}),i.jsxs("div",{className:"flex flex-col items-center justify-start text-center -mt-1",children:[i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"Share your referral link and watch your earnings appear"}),i.jsx("br",{}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide -mt-5",children:[" ","here as users start trading."]})]})]})]})})})})}):(q=z($))==null?void 0:q.map((W,V)=>i.jsxs("tr",{className:`${V%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${V%2==0,"bg-[#242424]"} sticky left-0 z-[2] group-hover:bg-[#353535]`,children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 pl-4 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(ua,{info1:`${(W==null?void 0:W.subscriber_address).slice(0,5)+"..."+(W==null?void 0:W.subscriber_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:"group-hover:bg-[#353535]",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-4 min-h-[32px] px-1",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-white text-sm font-semibold font-manrope leading-[8px]",children:W!=null&&W.level?`L${W==null?void 0:W.level}`:"--"})})})}),i.jsx("td",{children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-4 min-h-[32px] pl-1 pr-4",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-[#1ce6a2] text-sm font-semibold font-manrope leading-[8px]",children:W!=null&&W.total_ref_claimable?`$${_r(W==null?void 0:W.total_ref_claimable)}`:"--"})})})]},V))})]}):i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#242424] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sticky left-0 h-8 pl-6 min-w-[150px] sm:min-w-[170px] z-[8] bg-[#242424] rounded-tl-2xl",children:i.jsx(TC,{title:"Referred Wallet",sortKey:"address",sortOption:ne,setSortOption:J,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 px-1 min-w-[100px] sm:min-w-[120px]",children:i.jsx(TC,{title:"Level",sortKey:"level",sortOption:ne,setSortOption:J,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#242424] h-10 min-w-[110px] sm:min-w-[110px] rounded-tr-2xl pl-1 pr-4",children:i.jsx(TC,{title:"Join Date",sortKey:"created_at",sortOption:ne,setSortOption:J,isFilterIcon:!1})})]})}),i.jsx("tbody",{children:!a||o?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[45%] w-max",children:i.jsx($a,{})})})}):l&&!(a!=null&&a.claim_lists)?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[27%] w-max",children:i.jsx(Vl,{})})})}):(a==null?void 0:a.length)==0||((se=a==null?void 0:a.claim_lists)==null?void 0:se.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:3,children:i.jsx("div",{className:"flex min-h-[25vh] flex-col justify-center items-center ml-[30%] w-max",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No referral yet."}),i.jsxs("div",{className:"flex flex-col items-center justify-start text-center -mt-1",children:[i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"Share your referral link and watch your referrals appear"}),i.jsx("br",{}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide -mt-5",children:[" ","here as users start trading."]})]})]})]})})})})}):(ae=K(ne))==null?void 0:ae.map((W,V)=>i.jsxs("tr",{className:`${V%2===0,"bg-[#242424]"} relative group hover:bg-[#353535] h-[32px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${V%2==0,"bg-[#242424]"} sticky left-0 z-[2] group-hover:bg-[#353535]`,children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 pl-4 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(ua,{info1:`${(W==null?void 0:W.address).slice(0,5)+"..."+(W==null?void 0:W.address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:"group-hover:bg-[#353535]",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-4 min-h-[32px] px-1",children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-2 h-[32px] max-h-[32px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-white text-sm font-semibold font-manrope leading-[8px]",children:W!=null&&W.level?`L${W==null?void 0:W.level}`:"--"})})})}),i.jsx("td",{children:i.jsx("div",{className:"group-hover:bg-[#353535] flex justify-start items-center gap-4 min-h-[32px] pl-1 pr-4",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-white text-sm font-semibold font-manrope leading-[8px]",children:W!=null&&W.created_at?Zft(W==null?void 0:W.created_at):"--"})})})]},V))})]})})]})]})},dcn=({open:t,setOpen:e})=>i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:NEe,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-4",children:[i.jsx("div",{className:"text-center text-white text-sm font-medium font-['Inter'] leading-4 tracking-[-0.28px]",children:"Trial activated!"}),i.jsx("div",{className:"w-[200px] text-center text-white text-[13px] font-normal font-['Inter'] leading-4",children:"Enjoy your 2-day premium trial."}),i.jsx("div",{className:"flex flex-col items-center gap-6 mt-[33px]",children:i.jsx("div",{onClick:()=>{window.open("https://app.dextrabot.com/referral#lighter-farming","_blank")},className:"w-[345px] h-10 px-6 py-3 bg-white hover:bg-[#E5E5E5] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] inline-flex justify-center items-center gap-2.5 cursor-pointer",children:i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-none",children:"Try Lighter Farming"})})})]})]})})})})})]}),fcn=()=>{const{isConnected:t,address:e}=ns(),{setSignModalOpen:n,hyperToken:r,setTelegramChatId:s,setSubscriberRole:a,setSubsExpireDay:o,setMushboomerETH:l,setMushboomerSOL:c,setIsReferralCode:u,setIsReferralCodeName:d,setIsWhitelist:f,setHyperToken:x,setHyperAddress:g}=m.useContext(Qr),[y,v]=m.useState("Enter Code"),[C,N]=m.useState("Earnings"),P=g2(),T=(P==null?void 0:P.code)||"",[M,F]=m.useState(""),[$,L]=m.useState(""),[z,X]=m.useState(null),[ne,J]=m.useState(""),[K,te]=m.useState(""),[fe,q]=m.useState(""),[se,ae]=m.useState(""),[W,V]=m.useState(!1),[ee,oe]=m.useState(!1),[de,Ce]=m.useState([]),[me,we]=m.useState(!1),[xe,be]=m.useState(!1),[je,Ie]=m.useState(!1),[Re,Qe]=m.useState([]),[Ke,dt]=m.useState(!1),[tt,nt]=m.useState(!1),[Le,Be]=m.useState(!1),ht=m.useRef(null),[pt,Gt]=m.useState(0);m.useEffect(()=>{T&&(F(T),Ie(!0))},[T]);const wt=It=>{let hn=It.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(hn)&&(F(hn),L(""))},nn=It=>{let hn=It.target.value.toUpperCase();/^[0-9A-Z_-]{0,10}$/.test(hn)&&(J(hn),te(""))},cn=async()=>{var It,hn;try{const Yt=window.localStorage.getItem("hyperToken"),Rt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/info/";if(!Yt){n(!0);return}const ot=window.localStorage.getItem("hyperAddress"),At=await(await fetch(Rt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():ot,token:Yt})})).json();At.success?(X((It=At==null?void 0:At.data)==null?void 0:It.referrer_code),ae((hn=At==null?void 0:At.data)==null?void 0:hn.my_refcode)):console.log(At.error_message)}catch(Yt){console.error("Error referans request:",Yt)}};m.useEffect(()=>{cn(),Ye(),Je()},[r]);const Un=async It=>{try{V(!0);const hn=window.localStorage.getItem("hyperToken"),Yt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/set/";hn||(n(!0),V(!1));const Rt=window.localStorage.getItem("hyperAddress"),De=await(await fetch(Yt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Rt,token:hn,refcode:It})})).json();De.success?(X(It),V(!1),Ie(!1),tn.success("Referral code add successfully",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.32)",width:"380px",minWidth:"380px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),De!=null&&De.trial_farming&&Be(!0)):(console.log(De.error_message),L(De.error_message),je&&tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{children:De.error_message})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"360px",minWidth:"360px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}),V(!1))}catch(hn){console.error("Error in like function:",hn),L(hn.message),je&&tn.error(hn.message),V(!1)}},Xt=async It=>{try{oe(!0);const hn=window.localStorage.getItem("hyperToken"),Yt="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/generate/";hn||(n(!0),oe(!1));const Rt=window.localStorage.getItem("hyperAddress"),De=await(await fetch(Yt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Rt,token:hn,refcode:It})})).json();De.success?(q(`https://app.dextrabot.com/referral/${De==null?void 0:De.refcode}`),ae(De==null?void 0:De.refcode),oe(!1)):(console.log(De.error_message),oe(!1),te(De.error_message))}catch(hn){console.error("Error in like function:",hn),te(hn.message),oe(!1)}},an=()=>{M.length<4?(L("You must enter at least 4 characters!"),je&&tn.error("This refcode is wrong")):(L(""),Un(M))},Jt=()=>{ne.length<4?te(se?"You have a generated code, you cannot generate it again.":"You must enter at least 4 characters!"):(te(""),Xt(ne))};m.useEffect(()=>{(async()=>{var Rt,ot;const hn=window.localStorage.getItem("hyperToken"),Yt=window.localStorage.getItem("hyperAddress");if(!(!hn||!Yt))try{const De=await ki(Yt.toLowerCase(),hn);De!=null&&De.success?(s(De==null?void 0:De.telegram_chat_id),a(De==null?void 0:De.subscriber_role),o(De==null?void 0:De.subs_expire_day),l((Rt=De==null?void 0:De.mushboomer_counts)==null?void 0:Rt.eth),c((ot=De==null?void 0:De.mushboomer_counts)==null?void 0:ot.sol),u(De==null?void 0:De.referral_code),d(De==null?void 0:De.refcode),f(De==null?void 0:De.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),x(""),g(""))}catch(De){console.error("Token verification error:",De),console.error(De.message||"An unknown error occurred.")}})()},[z]);const Ye=async()=>{try{we(!0);const It=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/claims/";if(!It){n(!0),we(!1);return}const Yt=window.localStorage.getItem("hyperAddress"),ot=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Yt,token:It})})).json();ot.success?(Ce(ot==null?void 0:ot.data),we(!1)):(console.log(ot.error_message),be(ot.error_message),we(!1))}catch(It){console.error("Error in like function:",It),be(It.message),we(!1)}},Je=async()=>{try{dt(!0);const It=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/subscriber/refcode/usage/";if(!It){n(!0),dt(!1);return}const Yt=window.localStorage.getItem("hyperAddress"),ot=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():Yt,token:It})})).json();ot.success?(Qe(ot==null?void 0:ot.data),dt(!1)):(console.log(ot.error_message),nt(ot.error_message),dt(!1))}catch(It){console.error("Error in like function:",It),nt(It.message),dt(!1)}};return m.useEffect(()=>{const It=()=>{ht.current&&Gt(ht.current.clientHeight)},hn=new ResizeObserver(It);return ht.current&&hn.observe(ht.current),()=>{hn.disconnect()}},[]),i.jsxs(i.Fragment,{children:[i.jsx(dcn,{open:Le,setOpen:Be}),i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Invite & Earn – DextraBot Referral Program"}),i.jsx("link",{rel:"canonical",href:"https://app.dextrabot.com/referral"}),i.jsx("meta",{name:"description",content:"Earn passive income by referring friends to DextraBot! Get a share of the trading fees from every transaction they make. Invite, grow your network, and start earning today!"}),i.jsx("meta",{name:"og:title",content:"Invite & Earn – DextraBot Referral Program"}),i.jsx("meta",{name:"og:description",content:"Earn passive income by referring friends to DextraBot! Get a share of the trading fees from every transaction they make. Invite, grow your network, and start earning today!"}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/referral"})]})}),i.jsx("div",{className:"flex justify-center items-start w-full h-[calc(100vh-5rem)] min-h-max px-4 pt-4 pb-10 bg-[#161616]",children:i.jsx("div",{className:"flex flex-col items-stretch justify-start h-full gap-[26px] w-full lg:w-max flex-grow lg:flex-grow-0",children:i.jsxs("div",{className:"flex flex-col items-stretch justify-start w-full gap-8",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-start items-start gap-8 min-w-full w-full",children:[i.jsx(lcn,{handleEnterCode:an,handleChange:wt,error:$,handleGenerateCode:Jt,handleGenerateChange:nn,generateError:K,generateData:fe,userReferansCode:z,setInputValue:F,setGenerateValue:J,inputValue:M,generateValue:ne,setIsMenu:v,isMenu:y,setGenerateCode:ae,generateCode:se,setIsGenerateLoading:oe,isGenerateLoading:ee,setIsEnterLoading:V,isEnterLoading:W,divRef:ht,isEnterModal:je,setIsEnterModal:Ie}),i.jsx(ucn,{data:de,dataLoading:me,dataError:xe,height:pt,handleRefTable:Ye,dataUsage:Re,dataUsageLoading:Ke,dataUsageError:tt,setIsOnTableTab:N,isOnTableTab:C})]}),i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 bg-[#232323] rounded-2xl mb-10 p-4",children:[i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/refferal","_blank"),className:"flex justify-center items-center w-max gap-1.5 rounded-[10px] cursor-pointer",children:[i.jsx("div",{className:"text-white text-sm font-medium font-manrope leading-[18px] tracking-tight w-full sm:max-w-[500px] mb-2",children:"See the full Referral System with Bonuses Details"}),i.jsx("img",{src:Am,alt:"Dextrabot - Referral",className:"w-3 h-3 mb-2"})]}),i.jsx("img",{src:blt,alt:"",className:"text-center text-xs w-[900px] h-max sm:h-[450px] mb-10 lg:mb-0"})]})]})})})]})};function pde({open:t,setOpen:e,data:n,walletData:r,withdrawableUsdc:s,setWithdrawableUsdc:a,modalWalletId:o,setModalWalletId:l}){const{setSignModalOpen:c}=m.useContext(Qr),{isConnected:u,address:d}=ns(),[f,x]=m.useState(""),[g,y]=m.useState(!1),[v,C]=m.useState("");m.useEffect(()=>{const T=n.find(M=>M.wallet_address===r);T&&a(T==null?void 0:T.withdrawableUsdc)},[n]);const N=async()=>{var T,M,F,$,L,z;try{y(!0);const X=window.localStorage.getItem("hyperToken"),ne="https://dextrabothypev2.nftinit.io/api/wallet/request-withdraw";X||(c(!0),y(!1)),C("");const J=window.localStorage.getItem("hyperAddress"),te=await(await fetch(ne,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():J,token:X,wallet_id:o??null,amount:f??0,destination:d?d.toLowerCase():J})})).json();te.success?(((M=(T=te==null?void 0:te.result)==null?void 0:T.result)==null?void 0:M.status)=="err"?(y(!1),C(($=(F=te==null?void 0:te.result)==null?void 0:F.result)==null?void 0:$.response)):((z=(L=te==null?void 0:te.result)==null?void 0:L.result)==null?void 0:z.status)=="ok"&&(y(!1),x(""),tn.success("The operation was successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"380px",maxWidth:"none",whiteSpace:"nowrap"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),e(!1)),y(!1)):(console.log(te.error_message),y(!1),C("The transaction failed, please try again."))}catch(X){console.error("Error widthdraw amount:",X),y(!1),C(X.message)}},P=T=>{x(T.target.value)};return i.jsx(i.Fragment,{children:i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[440px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),x(""),a(null),C("")},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2 text-white",children:[i.jsx("div",{className:"w-[365px] text-center text-white text-xl font-semibold font-manrope leading-7",children:"The withdrawal amount will be sent to your Login wallet on the Arbitrum network."}),i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("span",{className:"text-white/60 text-sm font-medium font-manrope leading-none tracking-tight",children:"Connected(Login) Wallet:"}),i.jsx("span",{className:"text-sm font-medium font-inter leading-none",children:d&&d.slice(0,6)+"..."+d.slice(-4)}),i.jsx("img",{onClick:T=>{T.stopPropagation(),navigator.clipboard.writeText(d),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]}),i.jsx("div",{className:"flex justify-start mt-4 relative",children:i.jsx("input",{type:"text",value:r&&`${r}`,placeholder:"wallet",disabled:!0,className:"shadow-sm py-0.5 bg-[#303030] block sm:text-sm font-semibold font-manrope leading-none rounded-md px-2 outline-[#404040] placeholder:text-[#7F7F7F] cursor-not-allowed text-white/50 h-8 w-[360px]"})}),i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsxs("div",{className:"flex relative",children:[i.jsx("input",{value:f,onChange:T=>{let M=T.target.value;M.includes("-")?M=M.replace("-",""):(M===""||parseFloat(M)>=0)&&P({...T,target:{...T.target,value:M}})},type:"number",name:"widthdrawAmount",placeholder:"Amount",min:0,max:s,className:`shadow-sm py-0.5 bg-[#303030] block sm:text-sm font-semibold font-manrope leading-none rounded-md w-36 min-w-36 pl-2 pr-7 ${f!=null&&f!==""?"border border-[#C5C5C5]":""} outline-[#404040] placeholder:text-[#7F7F7F] h-8 w-[305px]`}),i.jsx("p",{className:`${f!=null&&f!==""?"text-white":"text-[#7F7F7F]"} absolute right-1.5 top-1`,children:"$"})]}),i.jsx("button",{onClick:()=>x(s),className:"bg-[#505050] text-white text-xs px-[11px] py-0.5 rounded-md cursor-pointer hover:bg-[#606060] h-8 focus:outline-none focus:ring-0 border-none",children:"Max"})]}),i.jsx("span",{className:"text-white",children:s!=0&&!isNaN(s)?`$${_r(s)}`:"$0"})]}),g&&i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 rounded-md -my-6",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}),i.jsx("div",{onClick:T=>{T.preventDefault(),f!=null&&f!==""?g||N():tn.error("Please enter amount")},className:`${g?"cursor-not-allowed":"cursor-pointer"} h-8 pl-2 pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex w-44 mb-3`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Apply"})}),v&&i.jsx("div",{className:"h-6 p-2 w-[355px] bg-[#ff6f67]/20 rounded-lg justify-start items-center gap-2.5 inline-flex overflow-hidden -mt-7",children:i.jsx("span",{className:"text-[#ff6e67] text-xs font-semibold font-manrope leading-none tracking-tight",children:v})})]})})})})})]})})}function mde({open:t,setOpen:e,walletAddress:n}){return i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-center justify-start gap-2.5",children:[i.jsx("div",{className:"pt-4",children:i.jsx(Pie,{className:"text-[#848484] w-[48px] h-[48px] rotate-180"})}),i.jsx("div",{className:"w-80 text-center text-white text-2xl font-semibold font-manrope leading-7",children:"Deposit Funds"}),i.jsxs("div",{className:"flex justify-start items-start gap-2 pt-[18px]",children:[i.jsx("div",{className:"w-8 h-8 bg-[#67ffbd]/20 rounded-[256px] justify-center items-center inline-flex",children:i.jsx("div",{className:"text-center text-[#67ffbd] text-base font-semibold font-manrope leading-7",children:"1"})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-[9px]",children:[i.jsxs("div",{className:"w-[283px]",children:[i.jsxs("span",{className:"text-white text-sm font-medium font-manrope leading-none",children:["Copy your"," "]}),i.jsx("span",{className:"text-white text-sm font-bold font-manrope leading-none",children:"wallet address"})]}),i.jsxs("div",{className:"w-[283px] flex justify-start items-center gap-1.5",children:[i.jsx("span",{className:"text-white/60 text-[13px] font-light font-inter leading-none",children:n&&n.slice(0,5)+"..."+n.slice(-4)}),i.jsx("img",{onClick:r=>{r.stopPropagation(),navigator.clipboard.writeText(n),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-2 pt-[10px]",children:[i.jsx("div",{className:"w-8 h-8 bg-[#67ffbd]/20 rounded-[256px] justify-center items-center inline-flex",children:i.jsx("div",{className:"text-center text-[#67ffbd] text-base font-semibold font-manrope leading-7",children:"2"})}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[9px]",children:[i.jsx("div",{className:"w-[217px] text-white text-sm font-medium font-manrope leading-none tracking-tight",children:"Deposit USDC on the Arbitrum Network."}),i.jsxs("div",{className:"w-[283px]",children:[i.jsxs("span",{className:"text-white/60 text-[13px] font-light font-inter leading-none",children:["Minimum Deposit:"," "]}),i.jsx("span",{className:"text-[#67ffbd] text-[13px] font-semibold font-manrope leading-none",children:"15 USDC"})]})]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-2 pt-[10px]",children:[i.jsx("div",{className:"w-8 h-8 bg-[#67ffbd]/20 rounded-[256px] justify-center items-center inline-flex",children:i.jsx("div",{className:"text-center text-[#67ffbd] text-base font-semibold font-manrope leading-7",children:"3"})}),i.jsx("div",{className:"w-[283px] text-white text-sm font-medium font-manrope leading-none tracking-tight",children:i.jsx("div",{className:"w-[250px]",children:"Any deposit from other networks or below the minimum amount will be lost."})})]}),i.jsxs("div",{className:"flex justify-start items-start gap-2 pt-[10px]",children:[i.jsx("div",{className:"w-8 h-8 bg-[#67ffbd]/20 rounded-[256px] justify-center items-center inline-flex",children:i.jsx("div",{className:"text-center text-[#67ffbd] text-base font-semibold font-manrope leading-7",children:"4"})}),i.jsxs("div",{className:"w-[283px] text-white text-sm font-medium font-manrope leading-none",children:["Once funds arrive, you are ready ",i.jsx("br",{}),"for Copy Trade"]})]})]})]})})})})})]})}const xde=({open:t,setOpen:e,handleDeleteWallet:n,deleteWalleInfo:r,confirmClosePositions:s,setConfirmClosePositions:a,confirmWithdrawEquity:o,setConfirmWithdrawEquity:l})=>{const c=(r==null?void 0:r.unrealizedPnL)!=0&&(r==null?void 0:r.unrealizedPnL)!=null&&(r==null?void 0:r.unrealizedPnL)!=null&&!s||(r==null?void 0:r.perpEquity)!=0&&(r==null?void 0:r.perpEquity)!=null&&(r==null?void 0:r.perpEquity)!=null&&!o;return i.jsx(i.Fragment,{children:i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[490px] h-max relative bg-[#252525] rounded-3xl py-4 text-white",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),a(!1),l(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:" text-center text-white text-2xl font-semibold font-manrope leading-7",children:(r==null?void 0:r.unrealizedPnL)!=0&&(r==null?void 0:r.unrealizedPnL)!=null&&(r==null?void 0:r.unrealizedPnL)!=null?"Cannot Delete Wallet: Open Positions":(r==null?void 0:r.perpEquity)!=0&&(r==null?void 0:r.perpEquity)!=null&&(r==null?void 0:r.perpEquity)!=null?"Wallet Has Remaining Perp Equity":"Confirm Wallet Deletion"}),i.jsx("div",{className:"w-[398px] text-center text-white/60 text-[16px] font-medium font-manrope leading-5",children:(r==null?void 0:r.unrealizedPnL)!=0&&(r==null?void 0:r.unrealizedPnL)!=null&&(r==null?void 0:r.unrealizedPnL)!=null||(r==null?void 0:r.perpEquity)!=0&&(r==null?void 0:r.perpEquity)!=null&&(r==null?void 0:r.perpEquity)!=null?"":"Are you sure you want to delete this Follower Wallet? This action cannot be undone."}),i.jsxs("div",{className:`${((r==null?void 0:r.unrealizedPnL)==0||(r==null?void 0:r.unrealizedPnL)==null||(r==null?void 0:r.unrealizedPnL)==null)&&(r==null?void 0:r.perpEquity)!=0&&(r==null?void 0:r.perpEquity)!=null&&(r==null?void 0:r.perpEquity)!=null?"ml-32":"ml-4"} flex flex-col gap-3 items-start w-[398px]`,children:[(r==null?void 0:r.unrealizedPnL)!=0&&(r==null?void 0:r.unrealizedPnL)!=null&&(r==null?void 0:r.unrealizedPnL)!=null&&i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>a(u.target.checked),className:"hidden peer"}),i.jsx("div",{className:`w-[18px] h-[18px] flex items-center justify-center rounded border transition-all duration-200 ${s?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"}`,children:s&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),i.jsx("span",{className:"text-white/60 text-[16px] font-medium font-manrope leading-5",children:"I have closed all my open positions in this wallet."})]}),(r==null?void 0:r.perpEquity)!=0&&(r==null?void 0:r.perpEquity)!=null&&(r==null?void 0:r.perpEquity)!=null&&i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",checked:o,onChange:u=>l(u.target.checked),className:"hidden peer"}),i.jsx("div",{className:`w-[18px] h-[18px] flex items-center justify-center rounded border transition-all duration-200 ${o?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"}`,children:o&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[2px]"})}),i.jsx("span",{className:"text-white/60 text-[16px] font-medium font-manrope leading-5",children:"I've withdrawn all my perp equity."})]})]})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4 mb-3",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:u=>{u.preventDefault(),c||n(r==null?void 0:r.walletId,r==null?void 0:r.walletName,r==null?void 0:r.wallet)},className:`${c?"bg-gray-500 border-gray-600 cursor-not-allowed":"bg-[#7445ff] border-[#8860ff] cursor-pointer"} h-8 px-2 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] justify-center items-center gap-1.5 inline-flex`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Delete"})})]})]})})})})})]})})},gde=({rowData:t})=>t?i.jsxs("div",{className:"flex flex-col gap-4 p-4 bg-[#2e2e2e]/40 rounded-2xl",children:[i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Name"}),i.jsx("span",{className:"text-sm font-semibold text-white",children:t.wallet_name})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Follower Wallet"}),i.jsx("span",{className:"text-sm font-medium text-white break-all",children:t.wallet_address})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Creation Date"}),i.jsx("span",{className:"text-sm font-medium text-white",children:O3(t.wallet_created_data)})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Perp Equity"}),i.jsxs("span",{className:"text-sm font-semibold text-white",children:["$",_r(t.perpEquity)??0]})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"uPnL"}),i.jsxs("span",{className:`text-sm font-semibold ${t.unrealizedPnl>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`,children:["$",_r(Math.abs(t.unrealizedPnl))]})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Margin Used"}),i.jsxs("span",{className:"text-sm font-semibold text-white",children:["$",_r(t.marginUsed)??0]})]}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-xs text-[#ababab]",children:"Available Balance"}),i.jsxs("span",{className:"text-sm font-semibold text-white",children:["$",_r(t.withdrawableUsdc)??0]})]})]}):null,hcn=({data:t,loading:e,error:n,socketLoading:r,currentPage:s,handlePageChange:a,allWallets:o,handleListRequest:l})=>{var Le;m.useState(!1);const{setSignModalOpen:c}=m.useContext(Qr),{isConnected:u,address:d}=ns(),f=5,[x,g]=m.useState(null),[y,v]=m.useState(null),[C,N]=m.useState(!1),[P,T]=m.useState(null),[M,F]=m.useState(!1),[$,L]=m.useState("");m.useState({});const[z,X]=m.useState({}),[ne,J]=m.useState(!1),[K,te]=m.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[fe,q]=m.useState(!1),[se,ae]=m.useState(!1),W="-perpEquity",[V,ee]=m.useState(W),oe=Be=>t.sort((ht,pt)=>{if(ht.version===3&&pt.version!==3)return-1;if(pt.version===3&&ht.version!==3)return 1;const Gt=ht.wallet_name?ht.wallet_name.toUpperCase():"",wt=pt.wallet_name?pt.wallet_name.toUpperCase():"",nn=ht.wallet_address?ht.wallet_address.toLowerCase():"",cn=pt.wallet_address?pt.wallet_address.toLowerCase():"";return Be==="wallet_name"?Gt<wt?-1:Gt>wt?1:0:Be==="-wallet_name"?Gt>wt?-1:Gt<wt?1:0:Be==="-wallet_address"?nn<cn?-1:nn>cn?1:0:Be==="wallet_address"?nn>cn?-1:nn<cn?1:0:Be==="-wallet_created_data"?new Date(pt.wallet_created_data)-new Date(ht.wallet_created_data):Be==="wallet_created_data"?new Date(ht.wallet_created_data)-new Date(pt.wallet_created_data):Be==="-perpEquity"?pt.perpEquity-ht.perpEquity:Be==="perpEquity"?ht.perpEquity-pt.perpEquity:Be==="-unrealizedPnl"?pt.unrealizedPnl-ht.unrealizedPnl:Be==="unrealizedPnl"?ht.unrealizedPnl-pt.unrealizedPnl:Be==="-marginUsed"?pt.marginUsed-ht.marginUsed:Be==="marginUsed"?ht.marginUsed-pt.marginUsed:Be==="-withdrawableUsdc"?pt.withdrawableUsdc-ht.withdrawableUsdc:Be==="withdrawableUsdc"?ht.withdrawableUsdc-pt.withdrawableUsdc:0}),de=async(Be,ht,pt)=>{if(!Be||!ht||!pt){console.error("Delete order called with invalid parameters"),tn.error("Delete order called with invalid parameters");return}const Gt=`${Be}_${ht}`;try{X(an=>({...an,[Gt]:!0}));const wt=window.localStorage.getItem("hyperToken"),nn="https://dextrabothypev2.nftinit.io/api/wallet/delete";if(!wt){c(!0),X(an=>({...an,[Gt]:!1}));return}const cn=window.localStorage.getItem("hyperAddress"),Un=await fetch(nn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:d?d.toLowerCase():cn,token:wt,wallet_id:Be.toString()})});if(!Un.ok)throw new Vl(`Server responded with status ${Un.status}`);const Xt=await Un.json();Xt.success?(l(),te({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),q(!1),ae(!1),J(!1),X(an=>({...an,[Gt]:!1})),tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:pt.slice(0,5)+"..."+pt.slice(-3)}),i.jsxs("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:[" ","removed from generated wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"440px",minWidth:"440px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log(Xt.error_message),tn.error(Xt.error_message),X(an=>({...an,[Gt]:!1})))}catch(wt){console.error("Error deleting wallet:",wt),tn.error(wt.message),X(nn=>({...nn,[Gt]:!1}))}},Ce=m.useRef(null),me=()=>{Ce.current&&(Ce.current.scrollLeft-=100)},we=()=>{Ce.current&&(Ce.current.scrollLeft+=100)},xe=()=>{Ce.current&&(Ce.current.scrollTop+=200)},be=()=>{Ce.current&&(Ce.current.scrollTop-=200)},je=Be=>Be>=640&&Be<1024?4:Be>=1024&&Be<1240?7:Be>=1240&&Be<1540||Be>=1540?8:3,[Ie,Re]=m.useState(null),[Qe,Ke]=m.useState(!1),[dt,tt]=m.useState(!1);m.useEffect(()=>{const Be=()=>{tt(window.innerWidth<640)};return window.addEventListener("resize",Be),Be(),()=>window.removeEventListener("resize",Be)},[]);const nt=Be=>{dt&&(Re(Be),Ke(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(pde,{open:C,setOpen:N,data:t,walletData:x,withdrawableUsdc:P,setWithdrawableUsdc:T,modalWalletId:y,setModalWalletId:v}),i.jsx(mde,{open:M,setOpen:F,walletAddress:$}),i.jsx(xde,{open:ne,setOpen:J,handleDeleteWallet:de,deleteWalleInfo:K,confirmClosePositions:fe,setConfirmClosePositions:q,confirmWithdrawEquity:se,setConfirmWithdrawEquity:ae}),i.jsx(yp,{isOpen:Qe,onClose:()=>Ke(!1),children:i.jsx(gde,{rowData:Ie})}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white bg-[#161616] w-full h-full sm:min-h-[280px] max-h-max font-manrope relative",children:[i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute -top-5 right-4 z-10 hidden justify-start items-center gap-2",children:[i.jsx("button",{onClick:me,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:we,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:be,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full h-auto sm:h-max max-w-[100%] overflow-scroll relative flex-grow",ref:Ce,children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[120px] sm:min-w-[140px] z-[8]",children:i.jsx(mi,{title:"Name",sortKey:"wallet_name",sortOption:V,setSortOption:ee,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[140px] h-10 px-1 min-w-[160px] sm:min-w-[190px] z-[8]",children:i.jsx(mi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:V,setSortOption:ee,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[110px] px-1 hidden sm:table-cell",children:i.jsx(mi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:V,setSortOption:ee,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[120px] sm:min-w-[120px] px-1",children:i.jsx(mi,{title:"Perp Equity",sortKey:"perpEquity",sortOption:V,setSortOption:ee,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[134px] sm:min-w-[134px] px-1",children:i.jsx(mi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:V,setSortOption:ee,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[104px] sm:min-w-[104px] px-1 hidden sm:table-cell",children:i.jsx(mi,{title:"Margin",sortKey:"marginUsed",sortOption:V,setSortOption:ee,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[130px] px-1 hidden sm:table-cell",children:i.jsx(mi,{title:"Avail. Balance",sortKey:"withdrawableUsdc",sortOption:V,setSortOption:ee,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[330px] sm:min-w-[330px] pl-1 pr-4 hidden sm:table-cell",children:i.jsx("div",{className:"font-medium flex items-center justify-start w-full min-w-max",children:i.jsx("div",{className:"flex items-center justify-end w-full"})})})]})}),i.jsx("tbody",{children:!t||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:je(window.innerWidth),children:i.jsx("div",{className:"fixed top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10 min-h-[30vh] flex flex-col justify-center items-center",children:i.jsx($a,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:je(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[10%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx(Vl,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:je(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[15%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 ml-1 sm:-ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You have not created a wallet yet."}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Please use the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Add Account'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","button to create a wallet."]})]})]})]})})})})}):(Le=oe(V))==null?void 0:Le.map((Be,ht)=>{const pt=!isNaN(Be==null?void 0:Be.perpEquity)&&!isNaN(Be==null?void 0:Be.marginUsed)?(Be==null?void 0:Be.perpEquity)-(Be==null?void 0:Be.marginUsed):0,Gt=dt?{onClick:()=>nt(Be),className:"cursor-pointer"}:{};return i.jsxs("tr",{...Gt,className:`${ht%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${ht%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 h-[44px] max-h-[44px] ",children:(Be==null?void 0:Be.version)==3?i.jsx(gi,{content:"This is an API wallet created from your login wallet. It enables copy trading without withdrawal permissions, keeping your funds safe.",children:i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5 min-w-max",children:(Be==null?void 0:Be.wallet_name.length)>=12?(Be==null?void 0:Be.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(Be==null?void 0:Be.wallet_name)+"(API-AGENT) Wallet"}),(Be==null?void 0:Be.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Be==null?void 0:Be.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})]})}):i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Be==null?void 0:Be.wallet_name.length)>=12?(Be==null?void 0:Be.wallet_name).slice(0,12)+"...":Be==null?void 0:Be.wallet_name}),(Be==null?void 0:Be.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Be==null?void 0:Be.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${ht%2===0,"bg-[#161616]"} sm:sticky sm:left-[140px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[44px] max-h-[44px]",children:i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${Be==null?void 0:Be.wallet_address}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-[44px] max-h-[44px] cursor-pointer",children:[i.jsx("div",{className:"fle justify-center items-center",children:i.jsx("div",{className:"w-4 h-4 sm:w-6 sm:h-6 bg-[#4a4a4a] rounded-full",children:i.jsx("img",{src:Yi,alt:"",className:"w-4 h-4 sm:w-6 sm:h-6"})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(Be==null?void 0:Be.wallet_address).slice(0,5)+"..."+(Be==null?void 0:Be.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:wt=>{wt.stopPropagation(),navigator.clipboard.writeText(Be==null?void 0:Be.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsx("div",{className:"flex flex-col items-start gap-0.5",children:i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Be==null?void 0:Be.wallet_created_data)&&O3(Be==null?void 0:Be.wallet_created_data)})})}),i.jsx("td",{children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5 text-white",children:r?"Loading...":(Be==null?void 0:Be.perpEquity)!=0&&!isNaN(Be==null?void 0:Be.perpEquity)?`$${_r(Be==null?void 0:Be.perpEquity)}`:"$0"})})}),i.jsx("td",{children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${(Be==null?void 0:Be.unrealizedPnl)>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"} text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5`,children:r?i.jsx("span",{className:"text-white",children:"Loading..."}):(Be==null?void 0:Be.unrealizedPnl)!=0&&!isNaN(Be==null?void 0:Be.unrealizedPnl)?`$${_r(Math.abs(Be==null?void 0:Be.unrealizedPnl))}`:"$0"})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:r?i.jsx("span",{className:"text-white",children:"Loading..."}):(Be==null?void 0:Be.marginUsed)!=0&&!isNaN(Be==null?void 0:Be.marginUsed)?`$${_r(Be==null?void 0:Be.marginUsed)}`:"$0"})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${!r&&pt<0?"text-[#ff6b6b]":"text-white"} text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5`,children:r?i.jsx("span",{children:"Loading..."}):isNaN(pt)?"$0":`$${_r(Math.abs(pt))}`})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 pr-3",children:[(Be==null?void 0:Be.version)===3?i.jsx(gi,{content:"Deposits are not available for API wallets. Please fund your login wallet on Hyperliquid to start trading.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}):i.jsxs("div",{onClick:()=>{F(!0),L(Be==null?void 0:Be.wallet_address)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Deposit"})]}),(Be==null?void 0:Be.version)===3?i.jsx(gi,{content:"Withdrawals cannot be made with API wallets. Use your login wallet on Hyperliquid for withdrawals.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}):i.jsxs("div",{onClick:()=>{T(Be==null?void 0:Be.withdrawableUsdc),N(!0),g(Be==null?void 0:Be.wallet_address),v(Be==null?void 0:Be.wallet_id)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Withdraw"})]}),z[`${Be==null?void 0:Be.wallet_id}_${Be==null?void 0:Be.wallet_name.toLowerCase()}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[90px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):(Be==null?void 0:Be.version)===3?i.jsx(gi,{content:"API wallets cannot be deleted here. To remove this wallet, please delete it from the Hyperliquid API page.",children:i.jsx("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Delete"})})}):i.jsx("div",{onClick:()=>{te({wallet:Be==null?void 0:Be.wallet_address,walletId:Be==null?void 0:Be.wallet_id,walletName:Be==null?void 0:Be.wallet_name.toLowerCase(),unrealizedPnL:Be==null?void 0:Be.unrealizedPnl,perpEquity:Be==null?void 0:Be.perpEquity}),J(!0)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Delete"})})]})})]},ht)})})]})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2 absolute -top-[16px] sm:-top-[18px] right-1 sm:translate-x-0 sm:right-4 z-50",children:[i.jsx("button",{onClick:()=>a(s-1),disabled:s===1,className:`${s===1?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1 lg:py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Previous"})}),i.jsxs("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px] w-20 sm:w-auto text-center",children:["Page ",s," / ",Math.ceil(o.length/f)]}),i.jsx("button",{onClick:()=>a(s+1),disabled:s*f>=o.length,className:`${s*f>=o.length?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Next"})})]})]})]})};function MVe({open:t,setOpen:e,data:n,setShare:r,setTradeInfo:s}){const a=m.useRef(null),o=async()=>{if(a.current)try{await document.fonts.ready,await new Promise(y=>setTimeout(y,500));const x=await V1(a.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),g=document.createElement("a");g.href=x,g.download="dextrabot.png",document.body.appendChild(g),g.click(),document.body.removeChild(g),tn.success("PNG successfully downloaded!")}catch(x){console.error("Error generating PNG:",x),tn.error("Failed to download PNG.")}},[l,c]=m.useState(),[u,d]=m.useState(!0),f=async x=>{d(!0);try{const y=await(await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(x)}`)).blob();return new Promise((v,C)=>{const N=new FileReader;N.onloadend=()=>v(N.result),N.onerror=C,N.readAsDataURL(y)})}catch(g){throw console.error("Image conversion failed:",g),g}finally{d(!1)}};return m.useEffect(()=>{n!=null&&n.coin&&f(`https://app.hyperliquid.xyz/coins/${n==null?void 0:n.coin}.svg`).then(x=>c(x)).catch(()=>c(qa))},[n==null?void 0:n.coin]),i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 scale-75",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-max relative bg-[#1b1b1b] rounded-2xl",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1),r(!1),setTimeout(()=>{s(x=>({...x,coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,pnl:0}))},300)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-4 w-full",children:[i.jsx("div",{className:"flex justify-start items-center w-full pt-6 pl-6 text-white text-base font-semibold font-manrope leading-[8px]",children:"Share PnL"}),i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 px-2 pb-2.5",children:[i.jsx("div",{ref:a,style:{overflow:"visible",position:"relative"},className:"w-[858px] h-[608px] rounded-2xl border border-dashed border-[#353535] justify-center items-center inline-flex overflow-hidden",children:i.jsxs("div",{className:"w-[850px] h-[600px] rounded-xl flex justify-start items-center bg-[#0F1211]",children:[i.jsx("div",{className:"flex justify-start items-center w-[502px] max-h-[600px] bg-[#0F1211] rounded-xl share-pnl-background",children:i.jsxs("div",{className:"flex flex-col items-start gap-4 px-[22px] py-[40px] h-full w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-4 relative",children:[i.jsx("img",{src:VA,alt:"",className:"w-12 h-12 max-w-12 min-h-12"}),i.jsx("p",{className:"flex justify-center items-center text-white text-2xl font-semibold font-manrope",children:"Dextrabot - Copy Trade"})]}),i.jsxs("div",{className:"flex flex-col items-start justify-start ",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 relative mt-6",children:[i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:i.jsx("div",{className:"w-8 h-8 rounded-full flex justify-center items-center",children:u?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("img",{src:l||qa,alt:"",className:"rounded-full w-8 h-8",loading:"lazy",onError:x=>oa(x)})})}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope flex items-center",children:n!=null&&n.coin?n==null?void 0:n.coin:"--"}),i.jsx("div",{className:`${(n==null?void 0:n.type)=="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 w-20 min-w-[80px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope uppercase tracking-wide`,children:n!=null&&n.type?n==null?void 0:n.type:"--"}),i.jsxs("div",{className:`${(n==null?void 0:n.type)=="Long"?"bg-[#67ffbd]/20 text-[#67ffbd]":"bg-[#ff797c]/20 text-[#ff787b]"} h-9 w-16 min-w-[64px] px-3 flex-shrink-0 rounded-md flex justify-center items-center text-[20px] font-semibold font-manrope tracking-wide`,children:[n!=null&&n.leverage?n==null?void 0:n.leverage:"--","x"]})]}),i.jsxs("div",{className:`${(n==null?void 0:n.roe)>=0?"text-[#67ffbd]":"text-[#ff6767]"} text-[86px] font-semibold font-manrope leading-[92px] inline-flex justify-center items-center min-w-max`,children:[(n==null?void 0:n.roe)>=0?"+":"-",uo(Math.abs(n==null?void 0:n.roe)),"%"]})]}),i.jsxs("div",{className:"flex justify-start items-start gap-[45px] pt-[12px]",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"UNREALIZED PNL"}),i.jsx("div",{className:`${(n==null?void 0:n.pnl)>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-[32px] font-semibold font-manrope leading-none flex`,children:n!=null&&n.pnl?`$${uo(Math.abs(n==null?void 0:n.pnl))}`:uo(Math.abs(n==null?void 0:n.pnl))})]}),i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"ENTRY PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.entryPrice?`$${Ay(n==null?void 0:n.entryPrice)}`:Ay(n==null?void 0:n.entryPrice)})]})]}),i.jsx("div",{className:"flex justify-start items-start gap-[45px] pt-[12px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope tracking-wider flex",children:"MARK PRICE"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.markPrice?`$${Ay(n==null?void 0:n.markPrice)}`:Ay(n==null?void 0:n.markPrice)})]})}),i.jsx("div",{className:"flex justify-start items-start gap-[65px] pt-[26px]",children:i.jsxs("div",{className:"flex flex-col justify-start items-start gap-[2px] max-h-max",children:[i.jsx("div",{className:"text-white/50 text-lg font-medium font-manrope leading-loose tracking-wider flex",children:"REFERRAL"}),i.jsx("div",{className:"text-white text-[32px] font-semibold font-manrope leading-none flex",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]})}),i.jsx("div",{className:"flex justify-start items-start pt-[1px]",children:i.jsx("div",{className:"text-[#828483] text-lg font-medium font-manrope leading-loose tracking-wide",children:n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"})})]})}),i.jsx("div",{className:"flex justify-center items-center h-[600px] max-h-[600px] bg-[#0F1211] rounded-tr-xl rounded-br-xl max-w-[378px] overflow-hidden",children:n!=null&&n.roe&&(n==null?void 0:n.roe)>=0?i.jsx("img",{src:zA,alt:"",className:"h-full"}):i.jsx("img",{src:HA,alt:"",className:"h-full"})})]})}),i.jsxs("div",{className:"flex flex-col items-start justify-between gap-4 w-[400px] h-[600px] bg-[#232323] rounded-2xl p-4",children:[i.jsxs("div",{className:"flex flex-col justify-start items-start w-full gap-4",children:[i.jsx("div",{className:"text-white text-base font-semibold font-manrope leading-[21px]",children:"Customization"}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Referral Code"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 px-2.5 w-full h-8 bg-[#1b1b1b] rounded-md border border-[#303030]",children:[i.jsx("div",{className:"text-[#7b7b7b] text-sm font-medium font-inter leading-[8px]",children:"#"}),i.jsx("div",{className:"text-white text-sm font-medium font-inter leading-[8px]",children:n!=null&&n.referral?n==null?void 0:n.referral:"--"})]}),i.jsx("div",{className:"text-[#b1b1b1] text-[13px] font-semibold font-manrope leading-[8px] pt-0.5",children:"Comment"}),i.jsx("div",{className:"flex justify-start items-center gap-2 p-2 w-full h-max bg-[#1b1b1b] rounded-lg border border-[#303030]",children:i.jsx("div",{className:"w-max text-[#909090] text-sm font-normal font-inter leading-[18px]",children:n!=null&&n.referral?i.jsxs("span",{children:["Profit like the pros! 🤑 Copy top traders automatically with Dextrabot. Use my referral"," ",n==null?void 0:n.referral," & save 4% on fees! @Dextrabot 🚀"]}):i.jsx("span",{children:"Profit like the pros! 🤑 Copy top traders automatically with @Dextrabot 🚀"})})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-2.5 w-full",children:[i.jsx("div",{onClick:x=>{x.stopPropagation(),navigator.clipboard.writeText(n!=null&&n.referral?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},className:"w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Copy URL"})}),i.jsx("div",{onClick:x=>{x.preventDefault(),u||o()},className:`${u?"cursor-not-allowed":"cursor-pointer"} w-full h-8 px-4 py-3 rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#353535] justify-center items-center gap-2.5 inline-flex has-tooltip relative`,children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:u?"Hang tight! Your image is on the way... 🚀":"Download PNG"})}),i.jsx("a",{href:`https://x.com/intent/post?url=${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`https://app.dextrabot.com/referral/${n==null?void 0:n.referral}`:"https://app.dextrabot.com"}&text=Profit%20like%20the%20pros!%20🤑%20Copy%20top%20traders%20automatically${n!=null&&n.referral&&(n==null?void 0:n.referral)!=="--"?`%20with%20Dextrabot.%20Use%20my%20referral%20${n==null?void 0:n.referral}%20and%20save%204%25%20on%20fees!`:"%20with%20%40Dextrabot"}%20🚀%0A`,target:"_blank",className:"w-full h-8 px-6 py-3 bg-white rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#363636] text-[13px] font-medium font-inter leading-[8px]",children:"Share on X"})})]})]})]})]})]})})})})})]})}const pcn=({data:t})=>{const{isConnected:e,address:n}=ns(),{setSignModalOpen:r,hyperToken:s,isReferralCodeName:a}=m.useContext(Qr),[o,l]=m.useState("");m.useState({});const[c,u]=m.useState(!1),[d,f]=m.useState(""),[x,g]=m.useState(!1),y=m.useRef(null),v=m.useRef(null),[C,N]=m.useState(!1),[P,T]=m.useState(!1),[M,F]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),$="-unrealizedPnl",[L,z]=m.useState($),[X,ne]=m.useState([]),[J,K]=m.useState(!1);m.useEffect(()=>{if(t.length===0||J)return;const de=t.reduce((Ce,me)=>parseFloat(me.perpEquity||0)>parseFloat(Ce.perpEquity||0)?me:Ce);de.wallet_address&&l(de.wallet_address)},[t,J]);const te=(de,Ce,me)=>{const we=de==null?void 0:de.filter(xe=>xe&&xe.walletAddress&&xe.asset).filter(xe=>{var be,je;return me?(je=(be=xe==null?void 0:xe.asset)==null?void 0:be.toString())==null?void 0:je.toUpperCase().includes(me.toUpperCase()):!0});return we==null?void 0:we.sort((xe,be)=>{const je=xe.wallet_name?xe.wallet_name.toUpperCase():"",Ie=be.wallet_name?be.wallet_name.toUpperCase():"",Re=xe.tag?xe.tag.toUpperCase():"",Qe=be.tag?be.tag.toUpperCase():"",Ke=xe.asset?xe.asset.toUpperCase():"",dt=be.asset?be.asset.toUpperCase():"",tt=xe.type==="Long"?1:0,nt=be.type==="Long"?1:0,Le=xe.type==="Short"?1:0,Be=be.type==="Short"?1:0;return Ce==="wallet_name"?je<Ie?-1:je>Ie?1:0:Ce==="-wallet_name"?je>Ie?-1:je<Ie?1:0:Ce==="-unrealizedPnl"?be.unrealizedPnl-xe.unrealizedPnl:Ce==="unrealizedPnl"?xe.unrealizedPnl-be.unrealizedPnl:Ce==="-roe"?be.roe-xe.roe:Ce==="roe"?xe.roe-be.roe:Ce==="-size"?be.size-xe.size:Ce==="size"?xe.size-be.size:Ce==="-entryPrice"?be.entryPrice-xe.entryPrice:Ce==="entryPrice"?xe.entryPrice-be.entryPrice:Ce==="-currentPrice"?be.currentPrice-xe.currentPrice:Ce==="currentPrice"?xe.currentPrice-be.currentPrice:Ce==="-leverage"?be.leverage-xe.leverage:Ce==="leverage"?xe.leverage-be.leverage:Ce==="-positionValue"?be.positionValue-xe.positionValue:Ce==="positionValue"?xe.positionValue-be.positionValue:Ce==="-marginUsed"?be.marginUsed-xe.marginUsed:Ce==="marginUsed"?xe.marginUsed-be.marginUsed:Ce==="funding"?be.funding-xe.funding:Ce==="-funding"?xe.funding-be.funding:Ce==="-liquidationPrice"?be.liquidationPrice-xe.liquidationPrice:Ce==="liquidationPrice"?xe.liquidationPrice-be.liquidationPrice:Ce==="-tag"?Re<Qe?-1:Re>Qe?1:0:Ce==="tag"?Re>Qe?-1:Re<Qe?1:0:Ce==="-coin"?Ke<dt?-1:Ke>dt?1:0:Ce==="coin"?Ke>dt?-1:Ke<dt?1:0:Ce==="-type_leverage"?tt!==nt?nt-tt:be.leverage-xe.leverage:Ce==="type_leverage"?Le!==Be?Be-Le:be.leverage-xe.leverage:0})},fe=async de=>{if(de===""&&X.filter(Ce=>Ce!==void 0).length===0||de===""&&te(X,L,d).length===0||te(X,L,d).length===0){tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(de===""&&(t==null?void 0:t.length)>0){const Ce=te(X,L,d),me=[...new Set(Ce.map(we=>we.wallet_id))];if(me.length===0){tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}try{if(u(!0),!window.localStorage.getItem("hyperToken")){r(!0),u(!1);return}await Promise.all(me.map(xe=>q(xe,!1))),tn.success("All close order operations successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",width:"400px",minWidth:"400px",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})}catch(we){console.error("Error closing all orders:",we)}finally{u(!1)}return}await q(de)},q=async(de,Ce=!0)=>{if(X.filter(me=>me!==void 0).length===0){tn.success("There are no open positions to closes.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(!de){console.error("Close order called with invalid parameters"),tn.error("Close order called with invalid parameters");return}try{u(!0);const me=window.localStorage.getItem("hyperToken"),we="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!me){r(!0),u(!1);return}const xe=window.localStorage.getItem("hyperAddress"),be=await fetch(we,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():xe,token:me,wallet_id:de.toString()})});if(!be.ok)throw new Error(`Server responded with status ${be.status}`);const je=await be.json();je.status=="ok"?(u(!1),Ce&&tn.success("Close order operation successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"400px",minWidth:"400px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):je.success?(u(!1),Ce&&tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log("Close order operation failed."),tn.error("Close order operation failed."),u(!1))}catch(me){throw console.error("Something went wrong!"),tn.error("Something went wrong!"),u(!1),me}},[se,ae]=m.useState(!1);m.useEffect(()=>{const de=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&ae(!0)};de();const Ce=setInterval(()=>{de()},1e3*60*30);return()=>{clearInterval(Ce)}},[]);const W=async de=>{try{const Ce=window.localStorage.getItem("hyperToken"),me="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!Ce){r(!0);return}const we=de==null?void 0:de.filter(Ie=>Ie&&Ie.walletAddress&&Ie.asset).map(Ie=>({wallet:Ie.walletAddress,coin:Ie.asset})),xe=window.localStorage.getItem("hyperAddress"),je=await(await fetch(me,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():xe,token:Ce,positions:we})})).json();je.success?ne(Ie=>Ie.map(Re=>{const Qe=je==null?void 0:je.data.find(Ke=>(Ke==null?void 0:Ke.wallet)===(Re==null?void 0:Re.walletAddress)&&(Ke==null?void 0:Ke.coin)===(Re==null?void 0:Re.asset));return{...Re,tag:Qe==null?void 0:Qe.tag,tagWallet:Qe==null?void 0:Qe.cp_wallet}})):(console.log(je.error_message),tn.error(je.error_message))}catch(Ce){console.error("Error tag request",Ce),tn.error(Ce.message)}},V=m.useRef(X==null?void 0:X.filter(de=>(de==null?void 0:de.walletAddress)&&(de==null?void 0:de.asset)).length),ee=m.useRef(),oe=m.useRef(!0);return m.useEffect(()=>{const de=X==null?void 0:X.filter(me=>me!==void 0&&(me==null?void 0:me.walletAddress)&&(me==null?void 0:me.asset)),Ce=de==null?void 0:de.length;if(Ce>0&&Ce>V.current){const me=o===""?X:X.filter(we=>(we==null?void 0:we.wallet_id)==o);oe.current?(W(me),oe.current=!1):(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{W(me)},5e3))}V.current=Ce},[X]),m.useEffect(()=>{if((X==null?void 0:X.filter(de=>de!==void 0&&(de==null?void 0:de.walletAddress)&&(de==null?void 0:de.asset)).length)>0){const de=o==""?X:X==null?void 0:X.filter(Ce=>(Ce==null?void 0:Ce.wallet_id)==o);(de==null?void 0:de.length)>0&&W(de)}},[o]),m.useEffect(()=>{function de(Ce){y.current&&!y.current.contains(Ce.target)&&setIsDropdownOpen(!1),v.current&&!v.current.contains(Ce.target)&&g(!1)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(MVe,{open:C,setOpen:N,data:M,setShare:T,setTradeInfo:F}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[12px] text-white bg-[#161616] w-full h-full min-h-[500px] max-h-max font-manrope relative sm:pt-3",children:[i.jsxs("div",{className:"flex items-center justify-start gap-4",children:[i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px] w-full",children:"Manage Positions"}),i.jsx("div",{className:"flex sm:hidden items-center justify-end w-full gap-1 min-w-max",children:i.jsx("div",{className:"flex items-center justify-end group",children:i.jsxs("div",{onClick:de=>{de.preventDefault(),c||fe(o)},className:"h-[26px] pl-1 pr-2 py-1.5 bg-[#67ffbd]/20 hover:bg-[#67ffbd]/30 rounded-md inline-flex justify-start items-center gap-2 cursor-pointer",children:[i.jsx("div",{className:"",children:i.jsx("img",{src:hae,alt:"",className:"w-4 h-4"})}),c?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[66px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Fast Close All"})]})})})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("span",{className:"font-bold sm:min-w-[200px] lg:min-w-max text-xs sm:text-[14px]",children:"Select wallet to see your current positions:"}),i.jsxs("div",{className:"relative w-full min-w-[150px]",children:[i.jsxs("select",{className:"rounded-md py-0.5 bg-[#303030] text-white text-base font-medium outline-none w-full h-8 pl-2 pr-4 appearance-none border border-[#404040]",onChange:de=>{l(de.target.value),K(!0)},value:o,children:[i.jsx("option",{value:"",children:"All"}),t==null?void 0:t.map(de=>i.jsx("option",{value:de==null?void 0:de.wallet_address,children:`${de==null?void 0:de.wallet_name} - (${(de==null?void 0:de.wallet_address.slice(0,5))+"..."+(de==null?void 0:de.wallet_address.slice(-4))})`},de==null?void 0:de.wallet_id))]}),i.jsx(ld,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[#9b9b9b]"})]})]}),se&&i.jsxs("div",{className:"hidden sm:flex justify-center items-center ml-10 h-16 pl-3 py-4 pr-5 bg-[#ff9800]/20 rounded-lg gap-3 w-max min-w-max relative",children:[i.jsx("div",{onClick:de=>{de.stopPropagation(),localStorage.setItem("walletManagementInfo",`${Date.now()}`),ae(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute -top-0.5 -right-1.5 w-7 h-7 rounded-full p-0.5 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("img",{src:Clt,alt:""}),i.jsx("div",{className:"font-semibold flex justify-start items-center text-white text-md outline-none max-w-[600px]",children:"Make sure you are performing all the actions on Dextrabot for the Copy Trade account. Don't close or open positions manually on Hyperliquid."})]})]}),i.jsx("div",{className:"w-full h-max max-w-[100%] min-h-[60vh] sm:min-h-[36vh] overflow-scroll relative flex-grow",children:i.jsx(IVe,{initialAddress:o,wallets:o===""?t:void 0})})]})]})]})})},mcn=({initialAddress:t="",wallets:e,positions:n,setPositions:r,isWalletIndex:s,posLoading:a,setPosLoading:o,setGenerateWalletData:l})=>{var Ye;const{getTrackedWatchList:c,hyperToken:u,copyTradeWatchList:d,getCopyTradeWatchList:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setMushboomerSOL:C,setIsReferralCode:N,isReferralCodeName:P,setIsReferralCodeName:T,setIsWhitelist:M,setHyperToken:F,setHyperAddress:$,setSignModalOpen:L,latestPnL:z}=m.useContext(Qr),{address:X}=ns(),[ne,J]=m.useState(!1);m.useState({}),m.useState(!1),m.useEffect(()=>{if(!(s!=null&&s.index))return;const Je=new WebSocket("wss://mainnet.zklighter.elliot.ai/stream");let It;Je.onopen=()=>{console.log("Lighter WebSocket connected"),Je.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`})),It=setInterval(()=>{Je.readyState===WebSocket.OPEN&&Je.send(JSON.stringify({type:"subscribe",channel:`account_all/${s.index}`}))},5e3)},Je.onmessage=Yt=>{const Rt=JSON.parse(Yt==null?void 0:Yt.data);if(Rt!=null&&Rt.positions&&Object.keys(Rt.positions).length>0){const ot=Object.values(Rt.positions).filter(rt=>Number(rt.position)!==0).map(rt=>({funding:0,leverage:rt.initial_margin_fraction?Math.round(100/Number(rt.initial_margin_fraction)):0,positionValue:Number(rt.position_value??0),unrealizedPnl:Number(rt.unrealized_pnl??0),currentPrice:rt.avg_entry_price&&rt.unrealized_pnl&&rt.position&&rt.sign?Number(rt.avg_entry_price)+Number(rt.unrealized_pnl)/(Number(rt.position)*Number(rt.sign)):Number(rt.position_value)/Math.abs(Number(rt.position)),entryPrice:Number(rt.avg_entry_price??0),size:Number(rt.position??0),type:Number(rt.sign)>0?"Long":"Short",asset:rt.symbol??"",sign:Number(rt.sign??1)})),De=ot.reduce((rt,mt)=>rt+mt.unrealizedPnl,0),At=ot.reduce((rt,mt)=>{const Lt=mt.leverage>0?mt.leverage:1,kt=mt.positionValue/Lt;return rt+(isFinite(kt)?kt:0)},0),ze=Number(Rt.available_balance??0);l(rt=>rt==null?void 0:rt.map(mt=>{var Lt;return((Lt=mt.wallet_address)==null?void 0:Lt.toLowerCase())===(t==null?void 0:t.toLowerCase())?{...mt,unrealizedPnl:De.toFixed(6),withdrawableUsdc:ze.toFixed(6),marginUsed:At.toFixed(6),positions:ot}:mt})),r(ot),(me==null?void 0:me.length)>0&&o(!1)}else r([]),a&&o(!1)},Je.onclose=Yt=>{console.log("🔌 ZkLighter WebSocket disconnected",Yt.code,Yt.reason),clearInterval(It)},Je.onerror=Yt=>{console.error("❌ ZkLighter WS error:",Yt),clearInterval(It)};const hn=()=>{Je.readyState===WebSocket.OPEN&&Je.send(JSON.stringify({type:"unsubscribe",channel:`account_all/${s.index}`})),clearInterval(It),Je.close()};return window.addEventListener("beforeunload",hn),()=>{hn(),window.removeEventListener("beforeunload",hn)}},[s]);const K=m.useRef(null),te=()=>{K.current&&(K.current.scrollLeft-=200)},fe=()=>{K.current&&(K.current.scrollLeft+=200)},q=()=>{K.current&&(K.current.scrollTop+=200)},se=()=>{K.current&&(K.current.scrollTop-=200)};m.useEffect(()=>{(async()=>{var Yt,Rt;const It=window.localStorage.getItem("hyperToken"),hn=window.localStorage.getItem("hyperAddress");if(!(!It||!hn))try{const ot=await ki(hn.toLowerCase(),It);ot!=null&&ot.success?(x(ot==null?void 0:ot.telegram_chat_id),g(ot==null?void 0:ot.subscriber_role),y(ot==null?void 0:ot.subs_expire_day),v((Yt=ot==null?void 0:ot.mushboomer_counts)==null?void 0:Yt.eth),C((Rt=ot==null?void 0:ot.mushboomer_counts)==null?void 0:Rt.sol),N(ot==null?void 0:ot.referral_code),T(ot==null?void 0:ot.refcode),M(ot==null?void 0:ot.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),F(""),$(""))}catch(ot){console.error("Token verification error:",ot),console.error(ot.message||"An unknown error occurred.")}})()},[]);const[ae,W]=m.useState(""),[V,ee]=m.useState(!1),oe=m.useRef(null);m.useEffect(()=>{function Je(It){oe.current&&!oe.current.contains(It.target)&&ee(!1)}return document.addEventListener("mousedown",Je),()=>document.removeEventListener("mousedown",Je)},[]);const[de,Ce]=m.useState([]),me=n==null?void 0:n.filter(Je=>{var It;return ae?(It=Je.asset)==null?void 0:It.toLowerCase().includes(ae.toLowerCase()):!0}).map(Je=>{const It=de.find(hn=>hn.coin===Je.asset&&(hn.wallet||"").toLowerCase()===(Je.wallet||"").toLowerCase());return{...Je,tagName:(It==null?void 0:It.tag)||null,tagWallet:(It==null?void 0:It.cp_wallet)||null}}),we="-unrealizedPnl",[xe,be]=m.useState(we),je=Je=>{const ot=me==null?void 0:me.map(De=>{const At=De!=null&&De.positionValue&&(De!=null&&De.leverage)?De.unrealizedPnl*De.leverage*100/De.positionValue:0,ze=.004+6e-4*De.leverage;let rt=0;(De==null?void 0:De.type)==="Long"?rt=De.entryPrice*(De.leverage/(De.leverage+1-De.leverage*ze)):rt=De.entryPrice*(De.leverage/(De.leverage-1+De.leverage*ze));const mt=rt*5.05,Lt=De.leverage?De.positionValue/De.leverage:0,kt=De.positionValue*1e-4*(De.sign??-1);return{...De,roe:At,liquidationPrice:mt,marginUsed:Lt,funding:kt}});return ot==null?void 0:ot.sort((De,At)=>{const ze=De.tagName?De.tagName.toUpperCase():"",rt=At.tagName?At.tagName.toUpperCase():"",mt=De.asset?De.asset.toUpperCase():"",Lt=At.asset?At.asset.toUpperCase():"",kt=De.type==="Long"?1:0,dn=At.type==="Long"?1:0,rn=De.type==="Short"?1:0,gn=At.type==="Short"?1:0;return Je==="-unrealizedPnl"?At.unrealizedPnl-De.unrealizedPnl:Je==="unrealizedPnl"?De.unrealizedPnl-At.unrealizedPnl:Je==="-roe"?At.roe-De.roe:Je==="roe"?De.roe-At.roe:Je==="-size"?At.size-De.size:Je==="size"?De.size-At.size:Je==="-entryPrice"?At.entryPrice-De.entryPrice:Je==="entryPrice"?De.entryPrice-At.entryPrice:Je==="-currentPrice"?At.currentPrice-De.currentPrice:Je==="currentPrice"?De.currentPrice-At.currentPrice:Je==="-leverage"?At.leverage-De.leverage:Je==="leverage"?De.leverage-At.leverage:Je==="-positionValue"?At.positionValue-De.positionValue:Je==="positionValue"?De.positionValue-At.positionValue:Je==="-marginUsed"?At.marginUsed-De.marginUsed:Je==="marginUsed"?De.marginUsed-At.marginUsed:Je==="-funding"?At.funding-De.funding:Je==="funding"?De.funding-At.funding:Je==="-liquidationPrice"?At.liquidationPrice-De.liquidationPrice:Je==="liquidationPrice"?De.liquidationPrice-At.liquidationPrice:Je==="-entryTime"?new Date(At.latestFill)-new Date(De.latestFill):Je==="entryTime"?new Date(De.latestFill)-new Date(At.latestFill):Je==="-source_tag"?ze<rt?-1:ze>rt?1:0:Je==="source_tag"?ze>rt?-1:ze<rt?1:0:Je==="-type_leverage"?kt!==dn?dn-kt:At.leverage-De.leverage:Je==="type_leverage"?rn!==gn?gn-rn:At.leverage-De.leverage:Je==="-asset"?mt<Lt?-1:mt>Lt?1:0:Je==="asset"?mt>Lt?-1:mt<Lt?1:0:0})};n.length,n.filter(Je=>Je.unrealizedPnl>=0).length;const[Ie,Re]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),Ke=localStorage.getItem("isDateOpenPositionsLighterFormat")||"date",[dt,tt]=m.useState(Ke);m.useEffect(()=>{localStorage.setItem("isDateOpenPositionsLighterFormat",dt)},[dt]);const[nt,Le]=m.useState([]),Be=async()=>{try{const Je=window.localStorage.getItem("hyperToken");if(!Je){L(!0);return}const It="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",hn=window.localStorage.getItem("hyperAddress"),Rt=await(await fetch(It,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:X?X.toLowerCase():hn,token:Je,balance:"false"})})).json();Rt!=null&&Rt.success?(Le(Rt.data||[]),Un(Rt.data)):console.log(Rt.error_message)}catch(Je){console.error("Error fetching generate wallet list:",Je)}};m.useEffect(()=>{window.localStorage.getItem("hyperToken")&&Be()},[u]);const[ht,pt]=m.useState([]),[Gt,wt]=m.useState(!0),[nn,cn]=m.useState(!1);m.useEffect(()=>{me&&me.length>0&&(Xt(),nt.length>0&&Gt&&Un())},[me]);const Un=()=>{ht.length!==0&&(an(ht),Gt&&wt(!1))};m.useEffect(()=>{const Je=window.localStorage.getItem("hyperToken");ht.length&&Je&&an(ht)},[ht]);const Xt=()=>{const Je=window.localStorage.getItem("hyperToken");let It=!1;const hn=[...ht];me.forEach(Yt=>{var At;const Rt=Yt.asset,ot=(At=Yt.wallet||t)==null?void 0:At.toLowerCase();hn.some(ze=>ze.coin===Rt&&(ze.wallet||"").toLowerCase()===ot)||(hn.push({coin:Rt,wallet:ot}),It=!0)}),It&&(pt(hn),nt.some(Rt=>Rt.wallet_address===(t==null?void 0:t.toLowerCase()))&&Je&&an(hn))},an=async Je=>{if(!nn)try{cn(!0);const It=window.localStorage.getItem("hyperToken"),hn="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!It||!Je){cn(!1);return}It||L(!0);const Yt=window.localStorage.getItem("hyperAddress"),ot=await(await fetch(hn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:X?X.toLowerCase():Yt,token:It,positions:Je})})).json();ot.success?Ce(ot==null?void 0:ot.data):(console.log(ot.error_message),tn.error(ot.error_message))}catch(It){console.error("Error tag request",It),tn.error(It.message)}finally{cn(!1)}};(e==null?void 0:e.length)>1||nt.some(Je=>Je.wallet_address===(t==null?void 0:t.toLowerCase()));const Jt={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs("div",{className:"w-full",children:[i.jsx(eP,{open:ne,setOpen:J,data:Ie,setTradeInfo:Re}),i.jsxs("div",{className:"relative w-full ",children:[i.jsxs("div",{className:"absolute -top-6 right-2 z-10 hidden lg:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:te,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:fe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:se,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:q,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ul,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{ref:K,className:"w-full overflow-scroll min-h-[60vh] max-h-[60vh] h-full flex-grow mt-1 mb-3 bg-[#161616] border-collapse rounded-lg pb-24",children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] font-semibold leading-[13px] tracking-[0.26px] text-[#9b9b9b] text-[13px] font-manrope mr-3",children:[i.jsx("th",{scope:"col",className:"sticky bg-[#161616] left-0 h-10 pl-2 sm:pl-6 min-w-[130px] sm:min-w-[145px] z-[8]",children:i.jsxs("div",{className:"flex justify-start items-center gap-2 relative",children:[i.jsx(mi,{title:"Coin",sortKey:"asset",sortOption:xe,setSortOption:be,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>ee(!V),className:`${ae?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${ae?"text-blue-500":"text-white"}`})}),V&&i.jsxs("div",{ref:oe,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>W(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:ae,onChange:Je=>W(Je.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),i.jsx(xcn,{className:"min-w-[100px] sm:min-w-[120px] px-1",title:"Type",sortKey:"type_leverage",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[80px] sm:min-w-[80px] px-1",title:"Size",sortKey:"size",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[130px] sm:min-w-[145px] px-1",title:"Position Value",sortKey:"positionValue",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Entry Price",sortKey:"entryPrice",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[120px] sm:min-w-[120px] px-1",title:"Mark Price",sortKey:"currentPrice",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[100px] sm:min-w-[160px] px-1",title:"PnL(ROE%)",sortKey:"unrealizedPnl",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[120px] sm:min-w-[130px] px-1",title:"Margin",sortKey:"marginUsed",sortOption:xe,setSortOption:be}),i.jsx(Pv,{className:"min-w-[110px] sm:min-w-[130px] px-1",title:"Funding",sortKey:"funding",sortOption:xe,setSortOption:be})]})}),i.jsx("tbody",{children:a?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:window.innerWidth>=640&&window.innerWidth<768?5:window.innerWidth>=768&&window.innerWidth<1024?6:window.innerWidth>=1024&&window.innerWidth<1240?8:window.innerWidth>=1240&&window.innerWidth<1540?10:window.innerWidth>=1540?12:4,className:"h-[36vh]",children:i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:i.jsx($a,{})})})})}):(me==null?void 0:me.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:window.innerWidth>=640&&window.innerWidth<768?5:window.innerWidth>=768&&window.innerWidth<1024?6:window.innerWidth>=1024&&window.innerWidth<1240?8:window.innerWidth>=1240&&window.innerWidth<1540?10:window.innerWidth>=1540?12:4,className:"h-[36vh]",children:i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No open positions are currently available"}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["To discover a different wallet, you can use the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Discover Wallets'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","tab above."]})]})]})]})})})})}):(Ye=je(xe))==null?void 0:Ye.map((Je,It)=>{var At;const hn=Je!=null&&Je.positionValue&&(Je!=null&&Je.leverage)?(Je==null?void 0:Je.unrealizedPnl)*(Je==null?void 0:Je.leverage)*100/(Je==null?void 0:Je.positionValue):0,Yt=.004+6e-4*Je.leverage;Je.entryPrice*(Je.leverage/(Je.sign===1?Je.leverage+1-Je.leverage*Yt:Je.leverage-1+Je.leverage*Yt));const Rt=Je!=null&&Je.leverage?(Je==null?void 0:Je.positionValue)/(Je==null?void 0:Je.leverage):0,De=(Je==null?void 0:Je.positionValue)*1e-4*(Je==null?void 0:Je.sign);return i.jsxs(Ne.Fragment,{children:[i.jsxs("tr",{className:"relative group bg-[#1b1b1b] hover:bg-[#222222] h-[32px] max-h-[32px] text-white rounded-2xl",style:{margin:"2px"},children:[i.jsx("td",{scope:"row",className:"sticky left-0 z-[2] bg-[#1b1b1b] group-hover:bg-[#222222] sm:rounded-l-2xl",children:i.jsx("div",{onClick:()=>{window.open(`/terminal/${Je==null?void 0:Je.asset}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 sm:pl-6 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Jt[Je.asset]||((At=Je.asset)==null?void 0:At.split("/")[0])}.svg`||qa,alt:Je==null?void 0:Je.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:ze=>oa(ze)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:Je.asset})]})})}),i.jsx("td",{scope:"row",className:"z-[2] bg-[#1b1b1b] group-hover:bg-[#222222]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${Je.type==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:Je.type==="Long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"})})}),i.jsxs("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase",children:[Je.type," - ",Je==null?void 0:Je.leverage,"x"]})]})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-tight",children:uo(Math.abs(Je.size))})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:Je.positionValue?`$${uo(Je.positionValue)}`:uo(Je.positionValue)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:Je.entryPrice?`$${_r(Je.entryPrice)}`:_r(Je.entryPrice)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:Je.currentPrice?`$${_r(Je.currentPrice)}`:_r(Je.currentPrice)})})}),i.jsx("td",{children:i.jsxs("div",{onClick:()=>{Re(ze=>({...ze,coin:Je.asset,type:Je.type,leverage:Je.leverage,roe:hn,entryPrice:Je.entryPrice,markPrice:Je.currentPrice,pnl:Je.unrealizedPnl,referral:window.localStorage.getItem("hyperToken")?P:null})),J(!0)},className:"pl-1 pr-2 flex justify-end gap-2 font-manrope cursor-pointer min-w-max",children:[i.jsxs("div",{className:`${Je.unrealizedPnl>=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:[Je.unrealizedPnl?`$${uo(Math.abs(Je.unrealizedPnl))}`:uo(Math.abs(Je.unrealizedPnl)),` (${uo(Math.abs(hn.toFixed(2)))}%)`]}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px] min-w-max",children:Rt?`$${uo(Rt)}`:uo(Rt)})})}),i.jsx("td",{children:i.jsx("div",{className:"pl-1 pr-2 flex flex-col items-end gap-2 font-manrope",children:i.jsx("div",{className:`${!isNaN(Number(De))&&Number(De)<=0?"text-[#67ffbd]":"text-[#ff787b]"} text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]`,children:isNaN(Number(De))?"$0.00":`$${Math.abs(Number(De)).toFixed(4)}`})})})]}),i.jsx("tr",{children:i.jsx("td",{colSpan:"100",style:{height:"2px"}})})]},It)})})]})})]})]})},Pv=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!0})}),xcn=({className:t,title:e,sortKey:n,sortOption:r,setSortOption:s})=>i.jsx("th",{scope:"col",className:t,children:i.jsx(mi,{title:e,sortKey:n,sortOption:r,setSortOption:s,isFilterIcon:!1})}),gcn=({initialAddress:t="",wallets:e,isWalletIndex:n,posLoading:r,setPosLoading:s,setGenerateWalletData:a})=>{const[o,l]=m.useState("positions"),[c,u]=m.useState([]);return i.jsxs("div",{className:"w-full",children:[i.jsxs("div",{className:"flex justify-start items-center w-full gap-2 mb-2 mx-4 mt-4 relative overflow-x-auto whitespace-nowrap scrollbar-hide [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[i.jsx("div",{className:"absolute bottom-0 left-0 w-[80%] h-[1px] bg-[#2A2A2A]"}),i.jsx("div",{onClick:()=>l("positions"),className:`${o==="positions"?"active text-[#67FFBD] border-b border-[#67FFBD] z-20":"text-[#C1C1C1]"} h-6 px-2 py-3 flex justify-center items-center gap-2.5 cursor-pointer font-manrope font-semibold pb-4 hover:text-[#67FFBD]`,children:i.jsxs("div",{className:"flex items-center text-[13px] font-semibold font-manrope leading-[8px] pointer-events-none min-w-max",children:[i.jsx("span",{className:"mr-2",children:"Open Positions"}),i.jsx("span",{className:"flex w-[22px] h-[22px] px-3 justify-center items-center gap-[2px] flex-shrink-0 rounded-md bg-[rgba(103,255,189,0.16)] text-[14px] font-semibold font-manrope",children:c.length})]})})]}),o==="positions"?i.jsx(mcn,{initialAddress:t,wallets:e,positions:c,setPositions:u,isWalletIndex:n,posLoading:r,setPosLoading:s,setGenerateWalletData:a}):""]})},bcn=({data:t,isWalletIndex:e,fetchAllIndex:n,setGenerateWalletData:r})=>{const{isConnected:s,address:a}=ns(),{setSignModalOpen:o,hyperToken:l,isReferralCodeName:c}=m.useContext(Qr),[u,d]=m.useState(""),[f,x]=m.useState(!0);m.useState({});const[g,y]=m.useState(!1),[v,C]=m.useState(""),[N,P]=m.useState(!1),T=m.useRef(null),M=m.useRef(null),[F,$]=m.useState(!1),[L,z]=m.useState(!1),[X,ne]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",pnl:0}),J="-unrealizedPnl",[K,te]=m.useState(J),[fe,q]=m.useState([]),[se,ae]=m.useState(!1);m.useEffect(()=>{if(t.length===0||se)return;const be=t.reduce((je,Ie)=>parseFloat(Ie.perpEquity||0)>parseFloat(je.perpEquity||0)?Ie:je);be.wallet_address&&d(be.wallet_address)},[t,se]);const W=(be,je,Ie)=>{const Re=be==null?void 0:be.filter(Qe=>Qe&&Qe.walletAddress&&Qe.asset).filter(Qe=>{var Ke,dt;return Ie?(dt=(Ke=Qe==null?void 0:Qe.asset)==null?void 0:Ke.toString())==null?void 0:dt.toUpperCase().includes(Ie.toUpperCase()):!0});return Re==null?void 0:Re.sort((Qe,Ke)=>{const dt=Qe.wallet_name?Qe.wallet_name.toUpperCase():"",tt=Ke.wallet_name?Ke.wallet_name.toUpperCase():"",nt=Qe.tag?Qe.tag.toUpperCase():"",Le=Ke.tag?Ke.tag.toUpperCase():"",Be=Qe.asset?Qe.asset.toUpperCase():"",ht=Ke.asset?Ke.asset.toUpperCase():"",pt=Qe.type==="Long"?1:0,Gt=Ke.type==="Long"?1:0,wt=Qe.type==="Short"?1:0,nn=Ke.type==="Short"?1:0;return je==="wallet_name"?dt<tt?-1:dt>tt?1:0:je==="-wallet_name"?dt>tt?-1:dt<tt?1:0:je==="-unrealizedPnl"?Ke.unrealizedPnl-Qe.unrealizedPnl:je==="unrealizedPnl"?Qe.unrealizedPnl-Ke.unrealizedPnl:je==="-roe"?Ke.roe-Qe.roe:je==="roe"?Qe.roe-Ke.roe:je==="-size"?Ke.size-Qe.size:je==="size"?Qe.size-Ke.size:je==="-entryPrice"?Ke.entryPrice-Qe.entryPrice:je==="entryPrice"?Qe.entryPrice-Ke.entryPrice:je==="-currentPrice"?Ke.currentPrice-Qe.currentPrice:je==="currentPrice"?Qe.currentPrice-Ke.currentPrice:je==="-leverage"?Ke.leverage-Qe.leverage:je==="leverage"?Qe.leverage-Ke.leverage:je==="-positionValue"?Ke.positionValue-Qe.positionValue:je==="positionValue"?Qe.positionValue-Ke.positionValue:je==="-marginUsed"?Ke.marginUsed-Qe.marginUsed:je==="marginUsed"?Qe.marginUsed-Ke.marginUsed:je==="funding"?Ke.funding-Qe.funding:je==="-funding"?Qe.funding-Ke.funding:je==="-liquidationPrice"?Ke.liquidationPrice-Qe.liquidationPrice:je==="liquidationPrice"?Qe.liquidationPrice-Ke.liquidationPrice:je==="-tag"?nt<Le?-1:nt>Le?1:0:je==="tag"?nt>Le?-1:nt<Le?1:0:je==="-coin"?Be<ht?-1:Be>ht?1:0:je==="coin"?Be>ht?-1:Be<ht?1:0:je==="-type_leverage"?pt!==Gt?Gt-pt:Ke.leverage-Qe.leverage:je==="type_leverage"?wt!==nn?nn-wt:Ke.leverage-Qe.leverage:0})},V=async be=>{if(be===""&&fe.filter(je=>je!==void 0).length===0||be===""&&W(fe,K,v).length===0||W(fe,K,v).length===0){tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(be===""&&(t==null?void 0:t.length)>0){const je=W(fe,K,v),Ie=[...new Set(je.map(Re=>Re.wallet_id))];if(Ie.length===0){tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}try{if(y(!0),!window.localStorage.getItem("hyperToken")){o(!0),y(!1);return}await Promise.all(Ie.map(Qe=>ee(Qe,!1))),tn.success("All close order operations successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",width:"400px",minWidth:"400px",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})}catch(Re){console.error("Error closing all orders:",Re)}finally{y(!1)}return}await ee(be)},ee=async(be,je=!0)=>{if(fe.filter(Ie=>Ie!==void 0).length===0){tn.success("There are no open positions to closes.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}});return}if(!be){console.error("Close order called with invalid parameters"),tn.error("Close order called with invalid parameters");return}try{y(!0);const Ie=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/hyper/order/close_order_all_new/";if(!Ie){o(!0),y(!1);return}const Qe=window.localStorage.getItem("hyperAddress"),Ke=await fetch(Re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Qe,token:Ie,wallet_id:be.toString()})});if(!Ke.ok)throw new Error(`Server responded with status ${Ke.status}`);const dt=await Ke.json();dt.status=="ok"?(y(!1),je&&tn.success("Close order operation successful.",{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px",width:"400px",minWidth:"400px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):dt.success?(y(!1),je&&tn.success("There are no open positions to close.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log("Close order operation failed."),tn.error("Close order operation failed."),y(!1))}catch(Ie){throw console.error("Something went wrong!"),tn.error("Something went wrong!"),y(!1),Ie}},[oe,de]=m.useState(!1);m.useEffect(()=>{const be=()=>{(localStorage.getItem("walletManagementInfo")!==void 0||localStorage.getItem("walletManagementInfo")!==null)&&Date.now()-Number(localStorage.getItem("walletManagementInfo"))>=864e5&&de(!0)};be();const je=setInterval(()=>{be()},1e3*60*30);return()=>{clearInterval(je)}},[]);const Ce=async be=>{try{const je=window.localStorage.getItem("hyperToken"),Ie="https://dextrabothypev2.nftinit.io/api/hyper/following/position_info/";if(!je){o(!0);return}const Re=be==null?void 0:be.filter(tt=>tt&&tt.walletAddress&&tt.asset).map(tt=>({wallet:tt.walletAddress,coin:tt.asset})),Qe=window.localStorage.getItem("hyperAddress"),dt=await(await fetch(Ie,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Qe,token:je,positions:Re})})).json();dt.success?q(tt=>tt.map(nt=>{const Le=dt==null?void 0:dt.data.find(Be=>(Be==null?void 0:Be.wallet)===(nt==null?void 0:nt.walletAddress)&&(Be==null?void 0:Be.coin)===(nt==null?void 0:nt.asset));return{...nt,tag:Le==null?void 0:Le.tag,tagWallet:Le==null?void 0:Le.cp_wallet}})):(console.log(dt.error_message),tn.error(dt.error_message))}catch(je){console.error("Error tag request",je),tn.error(je.message)}},me=m.useRef(fe==null?void 0:fe.filter(be=>(be==null?void 0:be.walletAddress)&&(be==null?void 0:be.asset)).length),we=m.useRef(),xe=m.useRef(!0);return m.useEffect(()=>{const be=fe==null?void 0:fe.filter(Ie=>Ie!==void 0&&(Ie==null?void 0:Ie.walletAddress)&&(Ie==null?void 0:Ie.asset)),je=be==null?void 0:be.length;if(je>0&&je>me.current){const Ie=u===""?fe:fe.filter(Re=>(Re==null?void 0:Re.wallet_id)==u);xe.current?(Ce(Ie),xe.current=!1):(we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{Ce(Ie)},5e3))}me.current=je},[fe]),m.useEffect(()=>{if((fe==null?void 0:fe.filter(be=>be!==void 0&&(be==null?void 0:be.walletAddress)&&(be==null?void 0:be.asset)).length)>0){const be=u==""?fe:fe==null?void 0:fe.filter(je=>(je==null?void 0:je.wallet_id)==u);(be==null?void 0:be.length)>0&&Ce(be)}},[u]),m.useEffect(()=>{function be(je){T.current&&!T.current.contains(je.target)&&setIsDropdownOpen(!1),M.current&&!M.current.contains(je.target)&&P(!1)}return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]),i.jsx(i.Fragment,{children:i.jsxs(i.Fragment,{children:[i.jsx(MVe,{open:F,setOpen:$,data:X,setShare:z,setTradeInfo:ne}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[12px] text-white bg-[#161616] w-full h-full min-h-[500px] max-h-max font-manrope relative sm:pt-3",children:[i.jsxs("div",{className:"flex items-center justify-start gap-4",children:[i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px] w-full",children:"Manage Positions"}),i.jsx("div",{className:"flex sm:hidden items-center justify-end w-full gap-1 min-w-max",children:i.jsx("div",{className:"flex items-center justify-end group",children:i.jsxs("div",{onClick:be=>{be.preventDefault(),g||V(u)},className:"h-[26px] pl-1 pr-2 py-1.5 bg-[#67ffbd]/20 hover:bg-[#67ffbd]/30 rounded-md inline-flex justify-start items-center gap-2 cursor-pointer",children:[i.jsx("div",{className:"",children:i.jsx("img",{src:hae,alt:"",className:"w-4 h-4"})}),g?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[66px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:"justify-start text-[#67ffbd] text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Fast Close All"})]})})})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsx("div",{className:"flex justify-start items-center gap-2",children:i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsx("span",{className:"font-bold min-w-[200px] lg:min-w-max text-xs sm:text-[14px]",children:"Select wallet to see your current positions:"}),i.jsxs("div",{className:"relative w-full min-w-[150px]",children:[i.jsx("select",{className:"rounded-md py-0.5 bg-[#303030] text-white text-md outline-none w-full h-8 min-w-[150px] px-2 appearance-none border border-[#404040]",onChange:be=>{d(be.target.value),ae(!0),n(be.target.value),x(!0),r(je=>je==null?void 0:je.map(Ie=>({...Ie,unrealizedPnl:0,marginUsed:0})))},value:u,children:t==null?void 0:t.map(be=>i.jsx("option",{value:be==null?void 0:be.wallet_address,children:`${be==null?void 0:be.wallet_name} - (${(be==null?void 0:be.wallet_address).slice(0,5)+"..."+(be==null?void 0:be.wallet_address).slice(-4)})`},be==null?void 0:be.wallet_id))}),i.jsx(ld,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[#9b9b9b]"})]})]})}),i.jsx("div",{className:"w-full h-max max-w-[100%] min-h-[60vh] sm:min-h-[36vh] overflow-scroll relative flex-grow",children:i.jsx(gcn,{initialAddress:u,wallets:u===""?t:void 0,isWalletIndex:e,posLoading:f,setPosLoading:x,setGenerateWalletData:r})})]})]})]})})},ycn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var nt;m.useState(!1);const{setSignModalOpen:l}=m.useContext(Qr),{isConnected:c,address:u}=ns(),d=5,[f,x]=m.useState(null),[g,y]=m.useState(null),[v,C]=m.useState(!1),[N,P]=m.useState(null),[T,M]=m.useState(!1),[F,$]=m.useState("");m.useState({});const[L,z]=m.useState({}),[X,ne]=m.useState(!1),[J,K]=m.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[te,fe]=m.useState(!1),[q,se]=m.useState(!1),ae="-perpEquity",[W,V]=m.useState(ae),ee=Le=>t.sort((Be,ht)=>{if(Be.version===3&&ht.version!==3)return-1;if(ht.version===3&&Be.version!==3)return 1;const pt=Be.wallet_name?Be.wallet_name.toUpperCase():"",Gt=ht.wallet_name?ht.wallet_name.toUpperCase():"",wt=Be.wallet_address?Be.wallet_address.toLowerCase():"",nn=ht.wallet_address?ht.wallet_address.toLowerCase():"";return Le==="wallet_name"?pt<Gt?-1:pt>Gt?1:0:Le==="-wallet_name"?pt>Gt?-1:pt<Gt?1:0:Le==="-wallet_address"?wt<nn?-1:wt>nn?1:0:Le==="wallet_address"?wt>nn?-1:wt<nn?1:0:Le==="-wallet_created_data"?new Date(ht.wallet_created_data)-new Date(Be.wallet_created_data):Le==="wallet_created_data"?new Date(Be.wallet_created_data)-new Date(ht.wallet_created_data):Le==="-perpEquity"?ht.perpEquity-Be.perpEquity:Le==="perpEquity"?Be.perpEquity-ht.perpEquity:Le==="-unrealizedPnl"?ht.unrealizedPnl-Be.unrealizedPnl:Le==="unrealizedPnl"?Be.unrealizedPnl-ht.unrealizedPnl:Le==="-marginUsed"?ht.marginUsed-Be.marginUsed:Le==="marginUsed"?Be.marginUsed-ht.marginUsed:Le==="-withdrawableUsdc"?ht.withdrawableUsdc-Be.withdrawableUsdc:Le==="withdrawableUsdc"?Be.withdrawableUsdc-ht.withdrawableUsdc:0}),oe=async(Le,Be,ht)=>{if(!Le||!Be||!ht){console.error("Delete order called with invalid parameters"),tn.error("Delete order called with invalid parameters");return}const pt=`${Le}_${Be}`;try{z(Xt=>({...Xt,[pt]:!0}));const Gt=window.localStorage.getItem("hyperToken"),wt="https://dextrabothypev2.nftinit.io/api/wallet/delete-lighter";if(!Gt){l(!0),z(Xt=>({...Xt,[pt]:!1}));return}const nn=window.localStorage.getItem("hyperAddress"),cn=await fetch(wt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():nn,token:Gt,wallet_id:Le})});if(!cn.ok)throw new Vl(`Server responded with status ${cn.status}`);const Un=await cn.json();Un.success?(o(),K({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),fe(!1),se(!1),ne(!1),z(Xt=>({...Xt,[pt]:!1})),tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:ht.slice(0,5)+"..."+ht.slice(-3)}),i.jsxs("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:[" ","removed from generated wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"440px",minWidth:"440px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log(Un.error_message),tn.error(Un.error_message),z(Xt=>({...Xt,[pt]:!1})))}catch(Gt){console.error("Error deleting wallet:",Gt),tn.error(Gt.message),z(wt=>({...wt,[pt]:!1}))}},de=m.useRef(null),Ce=()=>{de.current&&(de.current.scrollLeft-=100)},me=()=>{de.current&&(de.current.scrollLeft+=100)},we=()=>{de.current&&(de.current.scrollTop+=200)},xe=()=>{de.current&&(de.current.scrollTop-=200)},be=Le=>Le>=640&&Le<1024?4:Le>=1024&&Le<1240?7:Le>=1240&&Le<1540||Le>=1540?8:3,[je,Ie]=m.useState(null),[Re,Qe]=m.useState(!1),[Ke,dt]=m.useState(!1);m.useEffect(()=>{const Le=()=>{dt(window.innerWidth<640)};return window.addEventListener("resize",Le),Le(),()=>window.removeEventListener("resize",Le)},[]);const tt=Le=>{Ke&&(Ie(Le),Qe(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(pde,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:N,setWithdrawableUsdc:P,modalWalletId:g,setModalWalletId:y}),i.jsx(mde,{open:T,setOpen:M,walletAddress:F}),i.jsx(xde,{open:X,setOpen:ne,handleDeleteWallet:oe,deleteWalleInfo:J,confirmClosePositions:te,setConfirmClosePositions:fe,confirmWithdrawEquity:q,setConfirmWithdrawEquity:se}),i.jsx(yp,{isOpen:Re,onClose:()=>Qe(!1),children:i.jsx(gde,{rowData:je})}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white bg-[#161616] w-full h-full sm:min-h-[280px] max-h-max font-manrope relative",children:[i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute -top-5 right-4 z-10 hidden justify-start items-center gap-2",children:[i.jsx("button",{onClick:Ce,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:me,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:we,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full h-auto sm:h-max max-w-[100%] overflow-scroll relative flex-grow",ref:de,children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[120px] sm:min-w-[140px] z-[8]",children:i.jsx(mi,{title:"Name",sortKey:"wallet_name",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[140px] h-10 px-1 min-w-[160px] sm:min-w-[190px] z-[8]",children:i.jsx(mi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[110px] px-1 hidden sm:table-cell",children:i.jsx(mi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[330px] sm:min-w-[330px] pl-1 pr-4 hidden sm:table-cell",children:i.jsx("div",{className:"font-medium flex items-center justify-start w-full min-w-max",children:i.jsx("div",{className:"flex items-center justify-end w-full"})})})]})}),i.jsx("tbody",{children:!t||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"fixed top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10 min-h-[30vh] flex flex-col justify-center items-center",children:i.jsx($a,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[10%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx(Vl,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[15%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 ml-1 sm:-ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You have not created a wallet yet."}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Please use the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Add Account'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","button to create a wallet."]})]})]})]})})})})}):(nt=ee(W))==null?void 0:nt.map((Le,Be)=>{!isNaN(Le==null?void 0:Le.perpEquity)&&!isNaN(Le==null?void 0:Le.marginUsed)&&(Le==null?void 0:Le.perpEquity)-(Le==null?void 0:Le.marginUsed);const ht=Ke?{onClick:()=>tt(Le),className:"cursor-pointer"}:{};return i.jsxs("tr",{...ht,className:`${Be%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${Be%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 h-[44px] max-h-[44px] ",children:(Le==null?void 0:Le.version)==3?i.jsx(gi,{content:"This is an API wallet created from your login wallet. It enables copy trading without withdrawal permissions, keeping your funds safe.",children:i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5 min-w-max",children:(Le==null?void 0:Le.wallet_name.length)>=12?(Le==null?void 0:Le.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(Le==null?void 0:Le.wallet_name)+"(API-AGENT) Wallet"}),(Le==null?void 0:Le.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Le==null?void 0:Le.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})]})}):i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Le==null?void 0:Le.wallet_name.length)>=12?(Le==null?void 0:Le.wallet_name).slice(0,12)+"...":Le==null?void 0:Le.wallet_name}),(Le==null?void 0:Le.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Le==null?void 0:Le.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${Be%2===0,"bg-[#161616]"} sm:sticky sm:left-[140px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[44px] max-h-[44px]",children:i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${Le==null?void 0:Le.wallet_address}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-[44px] max-h-[44px] cursor-pointer",children:[i.jsx("div",{className:"fle justify-center items-center",children:i.jsx("div",{className:"w-4 h-4 sm:w-6 sm:h-6 bg-[#4a4a4a] rounded-full",children:i.jsx("img",{src:Yi,alt:"",className:"w-4 h-4 sm:w-6 sm:h-6"})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(Le==null?void 0:Le.wallet_address).slice(0,5)+"..."+(Le==null?void 0:Le.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:pt=>{pt.stopPropagation(),navigator.clipboard.writeText(Le==null?void 0:Le.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsx("div",{className:"flex flex-col items-start gap-0.5",children:i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Le==null?void 0:Le.wallet_created_data)&&O3(Le==null?void 0:Le.wallet_created_data)})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 pr-3",children:[i.jsx(gi,{content:"Deposits are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}),i.jsx(gi,{content:"Withdrawals are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}),L[`${Le==null?void 0:Le.wallet_id}_${Le==null?void 0:Le.wallet_name.toLowerCase()}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[90px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):(Le==null?void 0:Le.version)===3?i.jsx(gi,{content:"API wallets cannot be deleted here. To remove this wallet, please delete it from the Hyperliquid API page.",children:i.jsx("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Delete"})})}):i.jsx("div",{onClick:()=>{K({wallet:Le==null?void 0:Le.wallet_address,walletId:Le==null?void 0:Le.wallet_id,walletName:Le==null?void 0:Le.wallet_name.toLowerCase(),unrealizedPnL:Le==null?void 0:Le.unrealizedPnl,perpEquity:Le==null?void 0:Le.perpEquity}),ne(!0)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Delete"})})]})})]},Be)})})]})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2 absolute -top-[16px] sm:-top-[18px] right-1 sm:translate-x-0 sm:right-4 z-50",children:[i.jsx("button",{onClick:()=>s(r-1),disabled:r===1,className:`${r===1?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1 lg:py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Previous"})}),i.jsxs("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px] w-20 sm:w-auto text-center",children:["Page ",r," / ",Math.ceil(a.length/d)]}),i.jsx("button",{onClick:()=>s(r+1),disabled:r*d>=a.length,className:`${r*d>=a.length?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1 lg:py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Next"})})]})]})]})},vcn=({lighterWalletList:t})=>{const{isConnected:e,address:n}=ns(),{setSignModalOpen:r,hyperToken:s}=m.useContext(Qr),[a,o]=m.useState([]),[l,c]=m.useState(!1),[u,d]=m.useState(null),[f,x]=m.useState(!0),[g,y]=m.useState(null),[v,C]=m.useState([]),[N,P]=m.useState(()=>parseInt(localStorage.getItem("walletManagementLighterPage"))||1),T=5,[M,F]=m.useState(!1),[$,L]=m.useState(!1);m.useEffect(()=>{window.localStorage.getItem("hyperToken")?z():(r(!0),o([]),window.localStorage.setItem("walletManagementLighterPage",1))},[e,s]);const z=async()=>{var K;try{c(!0);const te=window.localStorage.getItem("hyperToken");if(!te){r(!0);return}const fe="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",q=window.localStorage.getItem("hyperAddress"),ae=await(await fetch(fe,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():q,token:te})})).json();if(ae.success){t(),C(ae.data||[]),F(!0);const W=parseInt(localStorage.getItem("walletManagementLighterPage"))||1,V=Math.max(Math.ceil(((ae==null?void 0:ae.data)||[]).length/T),1),ee=Math.min(W,V);P(ee),localStorage.setItem("walletManagementLighterPage",ee),ne(ee,ae.data||[]);const oe=(ee-1)*T,de=(K=ae.data)==null?void 0:K[oe];de&&X(de==null?void 0:de.wallet_address)}else console.log(ae.error_message),c(!1),d(ae.error_message)}catch(te){console.error("Error fetching lighter wallet list:",te),c(!1),d(te.message)}},X=async K=>{try{const fe=`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${Tc(K)}`,se=await(await fetch(fe,{method:"GET",headers:{accept:"application/json"}})).json();if(se.sub_accounts&&se.sub_accounts.length>0){const ae=se.sub_accounts[0],W=(ae==null?void 0:ae.collateral)??ae.collateral??"",V=(ae==null?void 0:ae.margin_used)??"",ee=(ae==null?void 0:ae.available_balance)??"",oe=(ae==null?void 0:ae.unrealized_pnl)??"",de=(ae==null?void 0:ae.positions)??[];o(Ce=>Ce==null?void 0:Ce.map(me=>me.wallet_address.toLowerCase()===K.toLowerCase()?{...me,perpEquity:W,unrealizedPnl:oe,withdrawableUsdc:ee,marginUsed:V,positions:de}:me)),y(ae),L(!0),c(!1),x(!1)}}catch(te){console.error("Error fetching lighter index:",te)}};m.useEffect(()=>{const K=()=>{const te=parseInt(localStorage.getItem("walletManagementLighterPage"))||1;te!==N&&M&&$&&(P(te),ne(te,v))};return window.addEventListener("storage",K),()=>{window.removeEventListener("storage",K)}},[N,v,M,$]);const ne=(K,te)=>{if(!te||te.length===0){c(!1);return}c(!0);const fe=(K-1)*T,q=fe+T,se=te.slice(fe,q);o(se)},J=K=>{K<1||K>Math.ceil(v.length/T)||(c(!0),P(K),localStorage.setItem("walletManagementLighterPage",K),ne(K,v))};return i.jsxs(i.Fragment,{children:[i.jsx(ycn,{data:a,loading:l,error:u,handlePageChange:J,handleListRequest:z,currentPage:N,allWallets:v}),i.jsx(bcn,{data:a,setGenerateWalletData:o,isWalletIndex:g,fetchAllIndex:X})]})},wcn=({data:t,loading:e,error:n,currentPage:r,handlePageChange:s,allWallets:a,handleListRequest:o})=>{var nt;m.useState(!1);const{setSignModalOpen:l}=m.useContext(Qr),{isConnected:c,address:u}=ns(),d=5,[f,x]=m.useState(null),[g,y]=m.useState(null),[v,C]=m.useState(!1),[N,P]=m.useState(null),[T,M]=m.useState(!1),[F,$]=m.useState("");m.useState({});const[L,z]=m.useState({}),[X,ne]=m.useState(!1),[J,K]=m.useState({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),[te,fe]=m.useState(!1),[q,se]=m.useState(!1),ae="-perpEquity",[W,V]=m.useState(ae),ee=Le=>t.sort((Be,ht)=>{if(Be.version===3&&ht.version!==3)return-1;if(ht.version===3&&Be.version!==3)return 1;const pt=Be.wallet_name?Be.wallet_name.toUpperCase():"",Gt=ht.wallet_name?ht.wallet_name.toUpperCase():"",wt=Be.wallet_address?Be.wallet_address.toLowerCase():"",nn=ht.wallet_address?ht.wallet_address.toLowerCase():"";return Le==="wallet_name"?pt<Gt?-1:pt>Gt?1:0:Le==="-wallet_name"?pt>Gt?-1:pt<Gt?1:0:Le==="-wallet_address"?wt<nn?-1:wt>nn?1:0:Le==="wallet_address"?wt>nn?-1:wt<nn?1:0:Le==="-wallet_created_data"?new Date(ht.wallet_created_data)-new Date(Be.wallet_created_data):Le==="wallet_created_data"?new Date(Be.wallet_created_data)-new Date(ht.wallet_created_data):Le==="-perpEquity"?ht.perpEquity-Be.perpEquity:Le==="perpEquity"?Be.perpEquity-ht.perpEquity:Le==="-unrealizedPnl"?ht.unrealizedPnl-Be.unrealizedPnl:Le==="unrealizedPnl"?Be.unrealizedPnl-ht.unrealizedPnl:Le==="-marginUsed"?ht.marginUsed-Be.marginUsed:Le==="marginUsed"?Be.marginUsed-ht.marginUsed:Le==="-withdrawableUsdc"?ht.withdrawableUsdc-Be.withdrawableUsdc:Le==="withdrawableUsdc"?Be.withdrawableUsdc-ht.withdrawableUsdc:0}),oe=async(Le,Be,ht)=>{if(!Le||!Be||!ht){console.error("Delete order called with invalid parameters"),tn.error("Delete order called with invalid parameters");return}const pt=`${Le}_${Be}`;try{z(Xt=>({...Xt,[pt]:!0}));const Gt=window.localStorage.getItem("hyperToken"),wt="https://dextrabothypev2.nftinit.io/api/wallet/delete-extended";if(!Gt){l(!0),z(Xt=>({...Xt,[pt]:!1}));return}const nn=window.localStorage.getItem("hyperAddress"),cn=await fetch(wt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:u?u.toLowerCase():nn,token:Gt,wallet_id:Le})});if(!cn.ok)throw new Vl(`Server responded with status ${cn.status}`);const Un=await cn.json();Un.success?(o(),K({wallet:"",walletId:"",walletName:"",unrealizedPnL:"",perpEquity:""}),fe(!1),se(!1),ne(!1),z(Xt=>({...Xt,[pt]:!1})),tn.success(i.jsxs(i.Fragment,{children:[i.jsx("span",{children:ht.slice(0,5)+"..."+ht.slice(-3)}),i.jsxs("span",{style:{color:"#ff797c",paddingLeft:"5px"},children:[" ","removed from generated wallets"]})]}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"440px",minWidth:"440px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}})):(console.log(Un.error_message),tn.error(Un.error_message),z(Xt=>({...Xt,[pt]:!1})))}catch(Gt){console.error("Error deleting wallet:",Gt),tn.error(Gt.message),z(wt=>({...wt,[pt]:!1}))}},de=m.useRef(null),Ce=()=>{de.current&&(de.current.scrollLeft-=100)},me=()=>{de.current&&(de.current.scrollLeft+=100)},we=()=>{de.current&&(de.current.scrollTop+=200)},xe=()=>{de.current&&(de.current.scrollTop-=200)},be=Le=>Le>=640&&Le<1024?4:Le>=1024&&Le<1240?7:Le>=1240&&Le<1540||Le>=1540?8:3,[je,Ie]=m.useState(null),[Re,Qe]=m.useState(!1),[Ke,dt]=m.useState(!1);m.useEffect(()=>{const Le=()=>{dt(window.innerWidth<640)};return window.addEventListener("resize",Le),Le(),()=>window.removeEventListener("resize",Le)},[]);const tt=Le=>{Ke&&(Ie(Le),Qe(!0))};return i.jsxs(i.Fragment,{children:[i.jsx(pde,{open:v,setOpen:C,data:t,walletData:f,withdrawableUsdc:N,setWithdrawableUsdc:P,modalWalletId:g,setModalWalletId:y}),i.jsx(mde,{open:T,setOpen:M,walletAddress:F}),i.jsx(xde,{open:X,setOpen:ne,handleDeleteWallet:oe,deleteWalleInfo:J,confirmClosePositions:te,setConfirmClosePositions:fe,confirmWithdrawEquity:q,setConfirmWithdrawEquity:se}),i.jsx(yp,{isOpen:Re,onClose:()=>Qe(!1),children:i.jsx(gde,{rowData:je})}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white bg-[#161616] w-full h-full sm:min-h-[280px] max-h-max font-manrope relative",children:[i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute -top-5 right-4 z-10 hidden justify-start items-center gap-2",children:[i.jsx("button",{onClick:Ce,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:me,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:xe,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:we,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full h-auto sm:h-max max-w-[100%] overflow-scroll relative flex-grow",ref:de,children:i.jsxs("table",{className:"w-full relative",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[120px] sm:min-w-[140px] z-[8]",children:i.jsx(mi,{title:"Name",sortKey:"wallet_name",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] sm:left-[140px] h-10 px-1 min-w-[160px] sm:min-w-[190px] z-[8]",children:i.jsx(mi,{title:"Follower Wallet",sortKey:"wallet_address",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] sm:min-w-[110px] px-1 hidden sm:table-cell",children:i.jsx(mi,{title:"Creation Date",sortKey:"wallet_created_data",sortOption:W,setSortOption:V,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[330px] sm:min-w-[330px] pl-1 pr-4 hidden sm:table-cell",children:i.jsx("div",{className:"font-medium flex items-center justify-start w-full min-w-max",children:i.jsx("div",{className:"flex items-center justify-end w-full"})})})]})}),i.jsx("tbody",{children:!t||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"fixed top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-10 min-h-[30vh] flex flex-col justify-center items-center",children:i.jsx($a,{})})})}):n&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[10%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx(Vl,{})})})}):(t==null?void 0:t.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:be(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[30vh] flex-col justify-center items-center top-[7%] lg:top-[15%] left-[20%] sm:left-[40%] lg:left-[50%] 2xl:left-[45%] z-10",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 ml-1 sm:-ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You have not created a wallet yet."}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["Please use the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Add Account'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","button to create a wallet."]})]})]})]})})})})}):(nt=ee(W))==null?void 0:nt.map((Le,Be)=>{!isNaN(Le==null?void 0:Le.perpEquity)&&!isNaN(Le==null?void 0:Le.marginUsed)&&(Le==null?void 0:Le.perpEquity)-(Le==null?void 0:Le.marginUsed);const ht=Ke?{onClick:()=>tt(Le),className:"cursor-pointer"}:{};return i.jsxs("tr",{...ht,className:`${Be%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[44px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${Be%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-2 h-[44px] max-h-[44px] ",children:(Le==null?void 0:Le.version)==3?i.jsx(gi,{content:"This is an API wallet created from your login wallet. It enables copy trading without withdrawal permissions, keeping your funds safe.",children:i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5 min-w-max",children:(Le==null?void 0:Le.wallet_name.length)>=12?(Le==null?void 0:Le.wallet_name).slice(0,12)+"... (API-AGENT) Wallet":(Le==null?void 0:Le.wallet_name)+"(API-AGENT) Wallet"}),(Le==null?void 0:Le.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Le==null?void 0:Le.wallet_name}`,positionTop:!0,alignRight:!1})}),i.jsx(ji,{className:"text-[#7C7C7C] w-4 min-w-4 min-h-4 h-4 ml-1"})]})}):i.jsxs("div",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Le==null?void 0:Le.wallet_name.length)>=12?(Le==null?void 0:Le.wallet_name).slice(0,12)+"...":Le==null?void 0:Le.wallet_name}),(Le==null?void 0:Le.wallet_name.length)>=12&&i.jsx("span",{className:"ml-3",children:i.jsx(Ma,{content:`${Le==null?void 0:Le.wallet_name}`,positionTop:!0,alignRight:!1})})]})})}),i.jsx("td",{scope:"row",className:`${Be%2===0,"bg-[#161616]"} sm:sticky sm:left-[140px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[44px] max-h-[44px]",children:i.jsxs("div",{onClick:()=>{window.open(`/wallet-details/${Le==null?void 0:Le.wallet_address}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-[44px] max-h-[44px] cursor-pointer",children:[i.jsx("div",{className:"fle justify-center items-center",children:i.jsx("div",{className:"w-4 h-4 sm:w-6 sm:h-6 bg-[#4a4a4a] rounded-full",children:i.jsx("img",{src:Yi,alt:"",className:"w-4 h-4 sm:w-6 sm:h-6"})})}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(Le==null?void 0:Le.wallet_address).slice(0,5)+"..."+(Le==null?void 0:Le.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:pt=>{pt.stopPropagation(),navigator.clipboard.writeText(Le==null?void 0:Le.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})]})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsx("div",{className:"flex flex-col items-start gap-0.5",children:i.jsx("div",{className:"text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5",children:(Le==null?void 0:Le.wallet_created_data)&&O3(Le==null?void 0:Le.wallet_created_data)})})}),i.jsx("td",{className:"hidden sm:table-cell",children:i.jsxs("div",{className:"flex items-center justify-end gap-2 pr-3",children:[i.jsx(gi,{content:"Deposits are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px] rotate-180"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Deposit"})]})}),i.jsx(gi,{content:"Withdrawals are currently unavailable.",children:i.jsxs("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:[i.jsx(ky,{className:"text-[#848484] w-[14px] h-[14px]"}),i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Withdraw"})]})}),L[`${Le==null?void 0:Le.wallet_id}_${Le==null?void 0:Le.wallet_name.toLowerCase()}`]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[90px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):(Le==null?void 0:Le.version)===3?i.jsx(gi,{content:"API wallets cannot be deleted here. To remove this wallet, please delete it from the Hyperliquid API page.",children:i.jsx("div",{className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex opacity-80",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight opacity-60",children:"Delete"})})}):i.jsx("div",{onClick:()=>{K({wallet:Le==null?void 0:Le.wallet_address,walletId:Le==null?void 0:Le.wallet_id,walletName:Le==null?void 0:Le.wallet_name.toLowerCase(),unrealizedPnL:Le==null?void 0:Le.unrealizedPnl,perpEquity:Le==null?void 0:Le.perpEquity}),ne(!0)},className:"w-[91px] h-[26px] px-2 py-1.5 rounded-md border border-[#353535] justify-center items-center gap-2 hidden sm:inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:"Delete"})})]})})]},Be)})})]})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2 absolute -top-[16px] sm:-top-[18px] right-1 sm:translate-x-0 sm:right-4 z-50",children:[i.jsx("button",{onClick:()=>s(r-1),disabled:r===1,className:`${r===1?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1 lg:py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Previous"})}),i.jsxs("div",{className:"text-white text-[14px] font-medium font-inter leading-[8px] w-20 sm:w-auto text-center",children:["Page ",r," / ",Math.ceil(a.length/d)]}),i.jsx("button",{onClick:()=>s(r+1),disabled:r*d>=a.length,className:`${r*d>=a.length?"cursor-not-allowed":"cursor-pointer"} h-6 lg:h-7 px-2 sm:px-3 py-1 lg:py-1.5 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex bg-transparent`,children:i.jsx("div",{className:"text-white text-[11px] lg:text-[13px] font-medium font-inter leading-[8px]",children:"Next"})})]})]})]})},dSe=({fetchAllWalletList:t})=>{const{isConnected:e,address:n}=ns(),{setSignModalOpen:r,hyperToken:s}=m.useContext(Qr),[a,o]=m.useState([]),[l,c]=m.useState(!1),[u,d]=m.useState(null);m.useState(null);const[f,x]=m.useState([]),[g,y]=m.useState(()=>parseInt(localStorage.getItem("walletManagementExtendedPage"))||1),v=5,[C,N]=m.useState(!1),[P,T]=m.useState(!1);m.useEffect(()=>{window.localStorage.getItem("hyperToken")?M():(r(!0),o([]),window.localStorage.setItem("walletManagementExtendedPage",1))},[e,s]);const M=async()=>{var L,z;try{c(!0);const X=window.localStorage.getItem("hyperToken");if(!X){r(!0);return}const ne="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",J=window.localStorage.getItem("hyperAddress"),te=await(await fetch(ne,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():J,token:X})})).json();if(te.success&&((L=te==null?void 0:te.data)==null?void 0:L.length)>0){t(),x(te.data||[]),N(!0);const fe=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1,q=Math.max(Math.ceil(((te==null?void 0:te.data)||[]).length/v),1),se=Math.min(fe,q);y(se),localStorage.setItem("walletManagementExtendedPage",se),F(se,te.data||[]);const ae=(se-1)*v,W=(z=te.data)==null?void 0:z[ae];c(!1)}else console.log(te.error_message),c(!1),d(te.error_message),o([])}catch(X){console.error("Error fetching lighter wallet list:",X),c(!1),d(X.message)}};m.useEffect(()=>{const L=()=>{const z=parseInt(localStorage.getItem("walletManagementExtendedPage"))||1;z!==g&&C&&P&&(y(z),F(z,f))};return window.addEventListener("storage",L),()=>{window.removeEventListener("storage",L)}},[g,f,C,P]);const F=(L,z)=>{if(!z||z.length===0){c(!1);return}c(!0);const X=(L-1)*v,ne=X+v,J=z.slice(X,ne);o(J)},$=L=>{L<1||L>Math.ceil(f.length/v)||(c(!0),y(L),localStorage.setItem("walletManagementExtendedPage",L),F(L,f))};return i.jsx(i.Fragment,{children:i.jsx(wcn,{data:a,loading:l,error:u,handlePageChange:$,handleListRequest:M,currentPage:g,allWallets:f})})},Ccn=({handleListRequest:t,handlePageChange:e,isGenWalletModal:n,setIsGenWalletModal:r})=>{const{setSignModalOpen:s}=m.useContext(Qr);return i.jsxs(i.Fragment,{children:[i.jsx(P5,{open:n,setOpen:r,handleListRequest:t,handlePageChange:e}),i.jsx("div",{className:"flex justify-center items-center w-max h-max",children:i.jsxs("div",{onClick:a=>{a.preventDefault(),window.localStorage.getItem("hyperToken")?r(!0):s(!0)},className:"h-8 pl-2 pr-2 sm:pl-2 sm:pr-3.5 py-3 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer my-2",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Add Account"})]})})]})},Scn=({value:t,onChange:e,allWallets:n,lighterWallet:r,extendedWallet:s,pacificaWallet:a})=>{const[o,l]=m.useState(!1),c=[{key:"HYPER",label:"HyperLiquid",icon:i.jsx("img",{src:I1,className:"w-4 h-4"}),count:(n==null?void 0:n.length)||0},{key:"LIGHTER",label:"Lighter",icon:i.jsx(bf,{className:"w-4 h-4 text-white"}),count:(r==null?void 0:r.length)||0},{key:"EXTENDED",label:"Extended",icon:i.jsx("img",{src:"https://app.extended.exchange/assets/logo/extended.svg",className:"w-4 h-4"}),count:(s==null?void 0:s.length)||0}],u=c.find(d=>d.key===t);return i.jsxs("div",{className:"relative w-max sm:w-[250px]",children:[i.jsxs("div",{onClick:()=>l(!o),className:`${t?"border border-[#67ffbd]/20":""} flex justify-between items-center bg-[#67ffbd]/20 text-[#67FFBD] rounded-md py-3 px-2.5 cursor-pointer select-none h-8`,children:[i.jsx("span",{className:`${t?"text-white":"text-[#7c7c7c]"} text-sm font-semibold font-manrope leading-[8px]`,children:u?`${u.label} (⚡${u.count} wallet)`:"Select Dex"}),i.jsx(ld,{className:`w-3.5 h-3.5 transition ${o?"rotate-180":""}`})]}),o&&i.jsx("div",{className:"absolute z-[55] top-full left-0 w-full bg-[#353535] rounded-md mt-[2px] p-1",children:i.jsx("div",{className:"max-h-[260px] overflow-y-auto",children:c.map(d=>i.jsxs("div",{onClick:()=>{e(d.key),l(!1)},className:`flex justify-between items-center p-[7px] h-8 rounded cursor-pointer text-white text-sm font-semibold font-manrope leading-[8px] min-w-max ${t===d.key?"bg-[#67ffbd]/20 text-[#67FFBD]":"hover:bg-[#464646]"}`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[d.icon,i.jsx("span",{children:d.label})]}),i.jsxs("span",{className:"text-[#9b9b9b] text-xs",children:["⚡",d.count," wallet"]})]},d.key))})})]})},Ncn=({isSelectMenu:t,setIsSelectMenu:e,handlePageChange:n,handleListRequest:r,allWallets:s,lighterWallet:a,extendedWallet:o,pacificaWallet:l})=>{const[c,u]=m.useState(!1);m.useEffect(()=>{const f=window.location.hash;if(!f)return;const x=f.split("#").filter(Boolean);x.includes("add-account")&&(u(!0),x[0]==="hyperliquid"&&(e("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")),x[0]==="lighter"&&(e("LIGHTER"),localStorage.setItem("isWalletSelectMenu","LIGHTER")),x[0]==="extended"&&(e("EXTENDED"),localStorage.setItem("isWalletSelectMenu","EXTENDED")),x[0]==="pacifica"&&(e("PACIFICA"),localStorage.setItem("isWalletSelectMenu","PACIFICA")))},[]);const d=f=>{u(!1),f==="HYPER"?(window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),e("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")):f==="LIGHTER"?(window.history.replaceState(null,"",`${window.location.pathname}#lighter`),e("LIGHTER"),localStorage.setItem("isWalletSelectMenu","LIGHTER")):f==="EXTENDED"?(window.history.replaceState(null,"",`${window.location.pathname}#extended`),e("EXTENDED"),localStorage.setItem("isWalletSelectMenu","EXTENDED")):f==="PACIFICA"&&(window.history.replaceState(null,"",`${window.location.pathname}#pacifica`),e("PACIFICA"),localStorage.setItem("isWalletSelectMenu","PACIFICA"))};return i.jsxs("div",{className:"flex justify-start items-center gap-10 pl-2 sm:pl-0",children:[i.jsxs("div",{className:"hidden lg:flex flex-col items-start justify-start gap-2 font-manrope min-w-max bg-[#161616] ",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px]",children:"Wallet Management"})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-2 sm:gap-10",children:[i.jsx(Ccn,{handleListRequest:r,handlePageChange:n,isGenWalletModal:c,setIsGenWalletModal:u}),i.jsxs("div",{className:"hidden lg:flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(eQ,{title:"HYPER",label:"HYPERLIQUID",walletLength:s,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(eQ,{title:"LIGHTER",label:"LIGHTER",walletLength:a,handleSelectMenuChange:d,isSelectMenu:t}),i.jsx(eQ,{title:"EXTENDED",label:"EXTENDED",walletLength:o,handleSelectMenuChange:d,isSelectMenu:t})]}),i.jsx("div",{className:"flex lg:hidden items-center justify-start",children:i.jsx(Scn,{value:t,onChange:d,allWallets:s,lighterWallet:a,extendedWallet:o,pacificaWallet:l})})]})]})},eQ=({title:t,label:e,handleSelectMenuChange:n,isSelectMenu:r,walletLength:s})=>i.jsxs("div",{onClick:()=>n(t),className:`${r==t?"bg-[#67ffbd]/20 text-[#67FFBD]":"bg-transparent text-[#9b9b9b]"} ${t==="HYPER"?"gap-1":t==="LIGHTER"?"gap-0.5":"gap-1"} text-[13px] font-medium font-manrope leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-[22px]`,children:[t==="HYPER"?i.jsx("img",{src:I1,alt:"hyper",className:"w-4 h-4 rounded-sm"}):t==="LIGHTER"?i.jsx(bf,{className:"w-4 h-4 text-[#fff]"}):t==="EXTENDED"?i.jsx("img",{src:"https://app.extended.exchange/assets/logo/extended.svg",alt:"Extended",className:"h-[20px] text-white -ml-0.5"}):t==="PACIFICA"?i.jsx("img",{src:"https://app.pacifica.fi/imgs/icon.svg",alt:"Extended",className:"h-[20px] text-white -ml-0.5"}):null,`${e} (${(s==null?void 0:s.length)>0?"⚡"+(s==null?void 0:s.length)+" wallet":"🔌 Not Connected"}) `]}),Acn="wss://api.hyperliquid.xyz/ws",jcn=()=>{const t=Kl(),{isConnected:e,address:n}=ns(),{setSignModalOpen:r,hyperToken:s,setTelegramChatId:a,setSubscriberRole:o,setSubsExpireDay:l,setMushboomerETH:c,setMushboomerSOL:u,setIsReferralCode:d,setIsReferralCodeName:f,setIsWhitelist:x,setHyperToken:g,setHyperAddress:y}=m.useContext(Qr),v=m.useRef(null),C=m.useRef(null),N=m.useRef(null),[P,T]=m.useState([]),[M,F]=m.useState(!1),[$,L]=m.useState(null),[z,X]=m.useState(!0),[ne,J]=m.useState("null");m.useEffect(()=>{const tt=t.hash;if(tt){const nt=tt.split("#").filter(Boolean);nt[0]==="hyperliquid"?(J("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")):nt[0]==="lighter"?(J("LIGHTER"),localStorage.setItem("isWalletSelectMenu","LIGHTER")):nt[0]==="extended"?(J("EXTENDED"),localStorage.setItem("isWalletSelectMenu","EXTENDED")):nt[0]==="pacifica"?(J("PACIFICA"),localStorage.setItem("isWalletSelectMenu","PACIFICA")):(window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),J("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER"))}else window.history.replaceState(null,"",`${window.location.pathname}#hyperliquid`),J("HYPER"),localStorage.setItem("isWalletSelectMenu","HYPER")},[t.hash]);const[K,te]=m.useState([]),[fe,q]=m.useState([]),[se,ae]=m.useState([]),[W,V]=m.useState([]),[ee,oe]=m.useState(()=>parseInt(localStorage.getItem("walletManagementPage"))||1),de=5,[Ce,me]=m.useState(!1);m.useEffect(()=>{window.localStorage.getItem("hyperToken")?(we(),xe(),be()):(r(!0),T([]),window.localStorage.setItem("walletManagementPage",1))},[e,s]);const we=async()=>{try{F(!0);const tt=window.localStorage.getItem("hyperToken");if(!tt){r(!0);return}const nt="https://dextrabothypev2.nftinit.io/api/wallet/list",Le=window.localStorage.getItem("hyperAddress"),ht=await(await fetch(nt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Le,token:tt,balance:"false"})})).json();if(ht.success){V(ht.data||[]),me(!0);const pt=parseInt(localStorage.getItem("walletManagementPage"))||1,Gt=Math.max(Math.ceil(((ht==null?void 0:ht.data)||[]).length/de),1),wt=Math.min(pt,Gt);oe(wt),localStorage.setItem("walletManagementPage",wt),Ke(wt,ht.data||[])}else console.log(ht.error_message),F(!1),L(ht.error_message)}catch(tt){console.error("Error fetching wallet list:",tt),F(!1),L(tt.message)}},xe=async()=>{try{F(!0);const tt=window.localStorage.getItem("hyperToken");if(!tt){r(!0);return}const nt="https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",Le=window.localStorage.getItem("hyperAddress"),ht=await(await fetch(nt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Le,token:tt})})).json();ht.success&&te(ht.data||[])}catch(tt){console.error("Error fetching wallet list:",tt)}},be=async()=>{try{F(!0);const tt=window.localStorage.getItem("hyperToken");if(!tt){r(!0);return}const nt="https://dextrabothypev2.nftinit.io/api/wallet/list-extended",Le=window.localStorage.getItem("hyperAddress"),ht=await(await fetch(nt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:n?n.toLowerCase():Le,token:tt})})).json();ht.success&&q(ht.data||[])}catch(tt){console.error("Error fetching wallet list:",tt)}},je=tt=>tt!=null&&tt.assetPositions?tt.assetPositions.filter(nt=>{if(!nt.position||!nt.position.szi)return!1;const Le=parseFloat(nt.position.szi);return!isNaN(Le)&&Le!==0}).map(nt=>{const Le=nt.position,Be=parseFloat(Le.szi),ht=parseFloat(Le.entryPx),pt=parseFloat(Le.positionValue),Gt=parseFloat(Le.unrealizedPnl),wt=parseFloat(Le.returnOnEquity)*100,nn=parseFloat(Le.marginUsed),cn=Le.leverage.value,Un=Le.leverage.type,Xt=parseFloat(Le.cumFunding.sinceOpen),an=Be>0?"Long":"Short";return{asset:Le.coin,type:an,size:Be,entryPrice:ht.toFixed(4),currentPrice:(pt/Math.abs(Be)).toFixed(4),leverage:cn,leverageType:Un,positionValue:pt.toFixed(2),marginUsed:nn.toFixed(2),unrealizedPnl:Gt.toFixed(2),roe:wt.toFixed(2),funding:Xt.toFixed(4),liquidationPrice:Le.liquidationPx?parseFloat(Le.liquidationPx).toFixed(2):"N/A"}}):[],Ie=()=>{v.current&&(console.log("Closing WebSocket connection..."),v.current.readyState===WebSocket.OPEN&&v.current.send(JSON.stringify({method:"unsubscribe",subscription:{type:"webData2"}})),v.current.close(),v.current=null),N.current&&(clearInterval(N.current),N.current=null),C.current&&(clearTimeout(C.current),C.current=null)},Re=tt=>{v.current=new WebSocket(Acn),v.current.onopen=()=>{console.log("WebSocket Connected"),tt.forEach(nt=>{let Le={method:"subscribe",subscription:{type:"webData2",user:nt==null?void 0:nt.wallet_address}};v.current.send(JSON.stringify(Le))}),N.current=setInterval(()=>{var nt;if(((nt=v.current)==null?void 0:nt.readyState)===WebSocket.OPEN){const Le={id:99,method:"ping"};v.current.send(JSON.stringify(Le))}},3e4)},v.current.onclose=nt=>{console.log("WebSocket Disconnected",nt.code,nt.reason),N.current&&(clearInterval(N.current),N.current=null),nt.code!==1e3&&(C.current||(C.current=setTimeout(()=>{C.current=null,Re(tt)},5e3)))},v.current.onerror=nt=>{console.error("WebSocket Error:",nt)},v.current.onmessage=nt=>{try{const Le=JSON.parse(nt.data);if(Le.method==="pong")return;if(Le.result==="success"){console.log("Successfully subscribed to channel");return}Le.channel==="webData2"&&Qe(Le)}catch(Le){console.error("Error processing WebSocket message:",Le),console.error("Raw message that caused error:",nt.data),X(!1)}}},Qe=tt=>{T(nt=>{let Le=!1;const Be=nt.map(ht=>{var pt,Gt,wt,nn,cn,Un,Xt,an,Jt,Ye,Je,It,hn;if((ht==null?void 0:ht.wallet_address.toLowerCase())===((pt=tt==null?void 0:tt.data)==null?void 0:pt.user.toLowerCase())){const Yt=(nn=(wt=(Gt=tt==null?void 0:tt.data)==null?void 0:Gt.clearinghouseState)==null?void 0:wt.assetPositions)==null?void 0:nn.reduce((De,At)=>{var ze;return De+(parseFloat((ze=At==null?void 0:At.position)==null?void 0:ze.unrealizedPnl)||0)},0),Rt=je((cn=tt==null?void 0:tt.data)==null?void 0:cn.clearinghouseState),ot={...ht,perpEquity:(an=(Xt=(Un=tt==null?void 0:tt.data)==null?void 0:Un.clearinghouseState)==null?void 0:Xt.marginSummary)==null?void 0:an.accountValue,unrealizedPnl:Yt,withdrawableUsdc:(Ye=(Jt=tt==null?void 0:tt.data)==null?void 0:Jt.clearinghouseState)==null?void 0:Ye.withdrawable,marginUsed:(hn=(It=(Je=tt==null?void 0:tt.data)==null?void 0:Je.clearinghouseState)==null?void 0:It.marginSummary)==null?void 0:hn.totalMarginUsed,positions:Rt};if(JSON.stringify(ht)!==JSON.stringify(ot))return Le=!0,ot}return ht});return Le?Be:nt}),setTimeout(()=>{F(!1),X(!1)},3e3)};m.useEffect(()=>{const tt=()=>{const nt=parseInt(localStorage.getItem("walletManagementPage"))||1;nt!==ee&&Ce&&(Ie(),oe(nt),Ke(nt,W))};return window.addEventListener("storage",tt),()=>{window.removeEventListener("storage",tt)}},[ee,W,Ce]);const Ke=(tt,nt)=>{if(!nt||nt.length===0){F(!1);return}F(!0);const Le=(tt-1)*de,Be=Le+de,ht=nt.slice(Le,Be);T(ht),Ie(),Re(ht)},dt=tt=>{tt<1||tt>Math.ceil(W.length/de)||(F(!0),oe(tt),localStorage.setItem("walletManagementPage",tt),Ke(tt,W))};return m.useEffect(()=>()=>{Ie()},[t.pathname]),m.useEffect(()=>{(async()=>{var Be,ht;const nt=window.localStorage.getItem("hyperToken"),Le=window.localStorage.getItem("hyperAddress");if(!(!nt||!Le))try{const pt=await ki(Le.toLowerCase(),nt);pt!=null&&pt.success?(a(pt==null?void 0:pt.telegram_chat_id),o(pt==null?void 0:pt.subscriber_role),l(pt==null?void 0:pt.subs_expire_day),c((Be=pt==null?void 0:pt.mushboomer_counts)==null?void 0:Be.eth),u((ht=pt==null?void 0:pt.mushboomer_counts)==null?void 0:ht.sol),d(pt==null?void 0:pt.referral_code),f(pt==null?void 0:pt.refcode),x(pt==null?void 0:pt.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""))}catch(pt){console.error("Token verification error:",pt),console.error(pt.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Wallet Management | Create & Fund Trading Wallets | Dextrabot"}),i.jsx("meta",{name:"description",content:"Create, fund, and manage your follower wallets on Dextrabot. Start copy trading today."}),i.jsx("meta",{name:"og:title",content:"Wallet Management | Create & Fund Trading Wallets | Dextrabot"}),i.jsx("meta",{name:"og:description",content:"Create, fund, and manage your follower wallets on Dextrabot. Start copy trading today."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/wallet-management"})]})}),i.jsx("div",{style:{height:"calc(100vh - 5rem)"},className:"flex justify-center items-center w-full h-auto px-1 pt-1 sm:px-6 sm:pt-2 bg-[#161616] overflow-scroll",children:i.jsxs("div",{className:"flex flex-col items-stretch justify-start h-full gap-[16px] w-full flex-grow xl:flex-grow-0",children:[i.jsx(Ncn,{handlePageChange:dt,handleListRequest:we,isSelectMenu:ne,setIsSelectMenu:J,allWallets:W,lighterWallet:K,extendedWallet:fe,pacificaWallet:se}),ne==="HYPER"?i.jsxs(i.Fragment,{children:[i.jsx(hcn,{data:P,loading:M,error:$,socketLoading:z,handlePageChange:dt,handleListRequest:we,currentPage:ee,allWallets:W}),i.jsx(pcn,{data:P,loading:M,error:$,socketLoading:z,handlePageChange:dt,currentPage:ee,allWallets:W})]}):ne==="LIGHTER"?i.jsx(i.Fragment,{children:i.jsx(vcn,{lighterWalletList:xe})}):ne==="EXTENDED"?i.jsx(i.Fragment,{children:i.jsx(dSe,{fetchAllWalletList:be})}):i.jsx(i.Fragment,{children:i.jsx(dSe,{fetchAllWalletList:be})})]})})]})};function Ecn({open:t,setOpen:e,copyTradeDelete:n,isDeleteWallet:r}){return i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:"w-80 text-center text-white text-2xl font-semibold font-manropeleading-7",children:"Confirm Delete"}),i.jsx("div",{className:"w-[348px] text-center text-white/60 text-[16px] font-medium font-manrope leading-5",children:"Are you sure you want to delete this copy trade task? This action cannot be undone."})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:()=>{n(r.followerWallet,r.sourceWallet,r.platform,r.id)},className:"h-8 px-2.5 bg-[#7445ff] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] justify-center items-center gap-1.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Delete"})})]})]})})})})})]})}const RVe=({open:t=!1,setOpen:e=()=>{},checkAccountCopy:n,roleType:r="farming"})=>{const{setSignModalOpen:s,setTelegramChatId:a,setSubscriberRole:o,setSubsExpireDay:l,setMushboomerETH:c,setMushboomerSOL:u,setIsReferralCode:d,setIsReferralCodeName:f,setIsWhitelist:x,setHyperToken:g,setHyperAddress:y}=m.useContext(Qr),{address:v}=ns(),[C,N]=m.useState(!1),[P,T]=m.useState(!1),[M,F]=m.useState(""),[$,L]=m.useState(""),[z,X]=m.useState(""),ne=async()=>{var se,ae;const fe=window.localStorage.getItem("hyperToken"),q=window.localStorage.getItem("hyperAddress");if(!(!fe||!q))try{setLoadingCheckAccount(!0);const W=await ki(q.toLowerCase(),fe);W!=null&&W.success?(a(W==null?void 0:W.telegram_chat_id),o(W==null?void 0:W.subscriber_role),l(W==null?void 0:W.subs_expire_day),c((se=W==null?void 0:W.mushboomer_counts)==null?void 0:se.eth),u((ae=W==null?void 0:W.mushboomer_counts)==null?void 0:ae.sol),d(W==null?void 0:W.referral_code),f(W==null?void 0:W.refcode),x(W==null?void 0:W.whitelist),g(fe),y(q),X(W==null?void 0:W.farming_tools),setLoadingCheckAccount(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""),setLoadingCheckAccount(!1))}catch(W){console.error("Token verification error:",W),console.error(W.message||"An unknown error occurred."),setLoadingCheckAccount(!1)}},J=async()=>new _l(window.ethereum).eth.getAccounts(q=>q),K=async(fe="farming",q=24,se=5e3)=>{q<=0||(await new Promise(ae=>setTimeout(ae,se)),await ne(),fe==="farming"&&!z?K(fe,q-1,se):n())},te=async()=>{L("");const fe=window.localStorage.getItem("hyperToken"),q=window.localStorage.getItem("hyperAddress");if(!fe||!v){s(!0);return}T(!0),N(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(W){console.error("Failed to switch network",W),N(!1);return}const se=new _l(window.ethereum);var ae=await J();if(ae.length>0?ae=ae[0]:ae=void 0,ae){const V={from:ae,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:"120000000000000000"};await se.eth.sendTransaction(V).then(ee=>{console.log("txHash :>> ",ee),N(!1),F(ee.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:v?v.toLowerCase():q,token:fe,payment_tx:ee.transactionHash,payment_role:r==="bots_extra_slot"?"bots_extra_slot":"farming_tools"})}),ne(),K(r)}).catch(ee=>{console.log(ee),ee.code===-32003||ee.message.includes("insufficient funds")?L("Insufficient funds."):ee.message==="MetaMask Tx Signature: User denied transaction signature."&&T(!1)})}else await se.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:P,setOpen:T,transactionHash:M,transactionLoading:C,paymentPresaleRole:z,errorFunds:$,activeMethod:2}),i.jsxs("div",{className:"fixed inset-0 z-[51] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px]",onClick:()=>e(!1)}),i.jsx("div",{className:"relative w-[380px] max-w-[92vw] rounded-3xl bg-[#1B1B1B] text-white shadow-xl border border-[#404040] max-h-[97dvh] overflow-y-auto p-5",children:i.jsxs("div",{className:"flex flex-col w-full gap-8 py-6",children:[i.jsx("div",{className:"mx-auto",children:i.jsx("img",{src:WA,alt:""})}),i.jsx("div",{className:"flex justify-center items-center",children:i.jsx("div",{className:"text-lg font-semibold",children:"Copy Trade"})}),i.jsx("div",{className:"text-center text-[#bdbdbd] text-sm px-6 leading-5 -mt-6",children:"You don't have an active subscription yet. Subscribe now to unlock trading bots, copy trading, and farming tools across multiple DEXs."}),i.jsx("div",{onClick:()=>{te()},className:"flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Subscribe / 0.12 ETH"})]})})]})]})},_cn=({loading:t,error:e,trackerData:n,isRequest:r,handleCopyDelete:s,deleteLoading:a,isDeleteModalOpen:o,setIsDeleteModalOpen:l,isDeleteWallet:c,setIsDeleteWallet:u,slotTotalCount:d,checkSlotAccount:f,slotCountWallets:x,subsRole:g,slotCount:y})=>{const{trackedWatchList:v,setSignModalOpen:C}=m.useContext(Qr),{isConnected:N,address:P}=ns(),[T,M]=m.useState(!1),[F,$]=m.useState(null),[L,z]=m.useState(""),[X,ne]=m.useState(""),[J,K]=m.useState([]),[te,fe]=m.useState(!1),[q,se]=m.useState({}),[ae,W]=m.useState({}),[V,ee]=m.useState([]),[oe,de]=m.useState([]),[Ce,me]=m.useState(null),[we,xe]=m.useState(!1),[be,je]=m.useState(!1),[Ie,Re]=m.useState(!1),[Qe,Ke]=m.useState([]),dt=m.useRef(null),[tt,nt]=m.useState([]),Le=m.useRef(!1);m.useEffect(()=>{const De={};n==null||n.forEach(At=>{const ze=`${At==null?void 0:At.wm_address}_${At==null?void 0:At.wallet_address}_${At==null?void 0:At.wallet_id}`;De[ze]=At==null?void 0:At.copy_trait_mode}),se(De),!Le.current&&(n==null?void 0:n.length)>0&&(ht(),Le.current=!0)},[n]),m.useEffect(()=>{if((n==null?void 0:n.length)>0){const De=[...n];(V==null?void 0:V.length)>0&&V.forEach(At=>{var ze;((ze=At.openPositionCoinList)==null?void 0:ze.length)>0&&At.generated_wallet_public&&!De.some(rt=>rt.wallet_address.toLowerCase()===At.generated_wallet_public.toLowerCase())&&De.push({wallet_address:At.generated_wallet_public})}),de(At=>{const ze=At.map(mt=>mt.wallet_address).sort().join(","),rt=De.map(mt=>mt.wallet_address).sort().join(",");return ze!==rt?De:At})}},[n,V]);const Be=async(De,At,ze,rt,mt)=>{const Lt=`${De}_${At}_${mt}`;try{const kt=window.localStorage.getItem("hyperToken"),dn="https://dextrabothypev2.nftinit.io/api/test_app/following/status/";kt||C(!0),W(kn=>({...kn,[Lt]:!0}));const rn=window.localStorage.getItem("hyperAddress"),An=await(await fetch(dn,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:P?P.toLowerCase():rn,token:kt,follow_address:At==null?void 0:At.toLowerCase(),copy_trait_mode:ze,target_platform:rt,wallet_id:mt})})).json();An.success?(se(kn=>({...kn,[Lt]:ze})),f()):(console.log(An.error_message),tn.error(An.error_message))}catch(kt){console.error("Error status mode:",kt),tn.error(kt.message||"Something went wrong!")}finally{W(kt=>({...kt,[Lt]:!1}))}},ht=async()=>{try{const De=window.localStorage.getItem("hyperToken"),At=window.localStorage.getItem("hyperAddress"),ze="https://dextrabothypev2.nftinit.io/api/wallet/generated_wallet_summary";De||C(!0);const rt=await fetch(ze,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:P?P.toLowerCase():At,token:De})});if(!rt.ok)throw new Vl(`Server responded with status ${rt.status}`);const mt=await rt.json();mt.success?ee(mt.data):(console.log(mt.error_message),tn.error(mt.error_message))}catch(De){console.error("Error in like function:",De),tn.error(De.message||"Something went wrong!")}},pt="tag",[Gt,wt]=m.useState(pt),nn=(De,At,ze,rt)=>De!=null&&De.length?[...De].sort((mt,Lt)=>{var tr,ar,hr,qt;if(!q||Object.keys(q).length===0)return 0;const kt=`${mt.wm_address}_${mt.wallet_address}_${mt.wallet_id}`,dn=`${Lt.wm_address}_${Lt.wallet_address}_${Lt.wallet_id}`;if(q!=null&&q[kt]&&!(q!=null&&q[dn]))return-1;if(!(q!=null&&q[kt])&&(q!=null&&q[dn]))return 1;const rn=ze.find(zn=>zn.wallet_address===mt.wallet_address)||{},gn=ze.find(zn=>zn.wallet_address===Lt.wallet_address)||{},An=ze.find(zn=>{var Zn,Ft;return((Zn=zn.wallet_address)==null?void 0:Zn.toLowerCase())===((Ft=mt==null?void 0:mt.wm_address)==null?void 0:Ft.toLowerCase())})||{},kn=ze.find(zn=>{var Zn,Ft;return((Zn=zn.wallet_address)==null?void 0:Zn.toLowerCase())===((Ft=Lt==null?void 0:Lt.wm_address)==null?void 0:Ft.toLowerCase())})||{},yn=rn.data?rn.data.reduce((zn,Zn)=>zn+parseFloat(Zn.unrealizedPnl||0),0):0,Vn=gn.data?gn.data.reduce((zn,Zn)=>zn+parseFloat(Zn.unrealizedPnl||0),0):0,Kn=rt==null?void 0:rt.find(zn=>{var Zn,Ft,En,Ee;return((Zn=zn==null?void 0:zn.generated_wallet_public)==null?void 0:Zn.toLowerCase())===((Ft=mt==null?void 0:mt.wm_address)==null?void 0:Ft.toLowerCase())&&((En=zn==null?void 0:zn.copy_trader_wallet)==null?void 0:En.toLowerCase())===((Ee=mt==null?void 0:mt.wallet_address)==null?void 0:Ee.toLowerCase())}),Dn=rt==null?void 0:rt.find(zn=>{var Zn,Ft,En,Ee;return((Zn=zn==null?void 0:zn.generated_wallet_public)==null?void 0:Zn.toLowerCase())===((Ft=Lt==null?void 0:Lt.wm_address)==null?void 0:Ft.toLowerCase())&&((En=zn==null?void 0:zn.copy_trader_wallet)==null?void 0:En.toLowerCase())===((Ee=Lt==null?void 0:Lt.wallet_address)==null?void 0:Ee.toLowerCase())}),Xn=Kn?Kn.total_pnl:0,Nn=Dn?Dn.total_pnl:0,on=Kn&&((tr=Kn.openPositionCoinList)==null?void 0:tr.length)>0&&((ar=An.data)==null?void 0:ar.length)>0?Kn.openPositionCoinList.reduce((zn,Zn)=>{const Ft=An.data.find(En=>En.asset===Zn);return Ft!=null&&Ft.unrealizedPnl?zn+parseFloat(Ft.unrealizedPnl):zn},0):0,Oe=Dn&&((hr=Dn.openPositionCoinList)==null?void 0:hr.length)>0&&((qt=kn.data)==null?void 0:qt.length)>0?Dn.openPositionCoinList.reduce((zn,Zn)=>{const Ft=kn.data.find(En=>En.asset===Zn);return Ft!=null&&Ft.unrealizedPnl?zn+parseFloat(Ft.unrealizedPnl):zn},0):0,Zt=mt.tag?mt.tag.toUpperCase():"",sn=Lt.tag?Lt.tag.toUpperCase():"",jt=mt.wm_name?mt.wm_name.toUpperCase():"",Qn=Lt.wm_name?Lt.wm_name.toUpperCase():"",bn=mt.wallet_address?mt.wallet_address.toLowerCase():"",Dt=Lt.wallet_address?Lt.wallet_address.toLowerCase():"",en=mt.wm_address?mt.wm_address.toLowerCase():"",Pn=Lt.wm_address?Lt.wm_address.toLowerCase():"";return At==="tag"?Zt<sn?-1:Zt>sn?1:0:At==="-tag"?Zt>sn?-1:Zt<sn?1:0:At==="-wallet_address"?bn<Dt?-1:bn>Dt?1:0:At==="wallet_address"?bn>Dt?-1:bn<Dt?1:0:At==="-wm_address"?en<Pn?-1:en>Pn?1:0:At==="wm_address"?en>Pn?-1:en<Pn?1:0:At==="perp_equity"?(rn.perp_equity||0)-(gn.perp_equity||0):At==="-perp_equity"?(gn.perp_equity||0)-(rn.perp_equity||0):At==="margin_usage"?(rn.margin_usage||0)-(gn.margin_usage||0):At==="-margin_usage"?(gn.margin_usage||0)-(rn.margin_usage||0):At==="unrealizedPnl"?yn-Vn:At==="-unrealizedPnl"?Vn-yn:At==="-wm_name"?jt<Qn?-1:jt>Qn?1:0:At==="wm_name"?jt>Qn?-1:jt<Qn?1:0:At==="total_pnl"?Xn-Nn:At==="-total_pnl"?Nn-Xn:At==="totalUnrealizedPnl"?on-Oe:At==="-totalUnrealizedPnl"?Oe-on:At==="-created_at"?new Date(Lt.created_at)-new Date(mt.created_at):At==="created_at"?new Date(mt.created_at)-new Date(Lt.created_at):0}):[];m.useEffect(()=>{if(!(n!=null&&n.length))return;const De=n.filter(At=>!!(!(Qe!=null&&Qe.length)||Qe.includes("HyperLiquid")&&At.target_platform==="hyper"||Qe.includes("Lighter")&&At.target_platform==="lighter"));nt(nn(De,Gt,J,V))},[Gt,n,Qe]);const cn=async(De,At)=>{try{z(De),ne(At);const ze=window.localStorage.getItem("hyperToken"),rt=window.localStorage.getItem("hyperAddress"),mt="https://dextrabothypev2.nftinit.io/api/test_app/following/info/";ze||C(!0);const Lt=await fetch(mt,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:P?P.toLowerCase():rt,token:ze,follow_address:De.toLowerCase()})});if(!Lt.ok)throw new Vl(`Server responded with status ${Lt.status}`);const kt=await Lt.json();kt.success?($(Array.isArray(kt==null?void 0:kt.data)?[...kt.data].sort((dn,rn)=>new Date(rn.created_at||0)-new Date(dn.created_at||0)):kt==null?void 0:kt.data),M(!0)):(console.log(kt.error_message),tn.error(kt.error_message))}catch(ze){console.error("Error in like function:",ze),tn.error(ze.message||"Something went wrong!")}},Un=De=>De!=null&&De.assetPositions?De.assetPositions.filter(At=>{if(!At.position||!At.position.szi)return!1;const ze=parseFloat(At.position.szi);return!isNaN(ze)&&ze!==0}).map(At=>{const ze=At.position,rt=parseFloat(ze.szi),mt=parseFloat(ze.entryPx),Lt=parseFloat(ze.positionValue),kt=parseFloat(ze.unrealizedPnl),dn=parseFloat(ze.returnOnEquity)*100,rn=parseFloat(ze.marginUsed),gn=ze.leverage.value,An=parseFloat(ze.cumFunding.sinceOpen),kn=rt>0?"Long":"Short";return{asset:ze.coin,type:kn,size:Math.abs(rt),entryPrice:mt.toFixed(2),currentPrice:(Lt/Math.abs(rt)).toFixed(2),leverage:gn,positionValue:Lt.toFixed(2),marginUsed:rn.toFixed(2),unrealizedPnl:kt.toFixed(2),roe:dn.toFixed(2),funding:An.toFixed(4),liquidationPrice:ze.liquidationPx?parseFloat(ze.liquidationPx).toFixed(2):"N/A"}}):[],Xt=async De=>{try{const ze=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"clearinghouseState",user:De});if(ze.data){const rt=Un(ze.data);K(mt=>{var Lt,kt,dn,rn;return[...mt,{wallet_address:De,perp_equity:(kt=(Lt=ze==null?void 0:ze.data)==null?void 0:Lt.marginSummary)==null?void 0:kt.accountValue,margin_usage:parseFloat((dn=ze==null?void 0:ze.data)==null?void 0:dn.marginSummary.totalMarginUsed)/parseFloat((rn=ze==null?void 0:ze.data)==null?void 0:rn.marginSummary.accountValue),data:rt}]})}}catch(At){console.error("Error fetching user state from HyperState:",At)}},an=async De=>{try{const At=window.localStorage.getItem("hyperToken"),ze=window.localStorage.getItem("hyperAddress"),mt=await fetch("https://dextrabothypev2.nftinit.io/api/hyper/trade/getclearinghousestate/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:P?P.toLowerCase():ze,token:At,follow_address:De.toLowerCase()})});if(mt.ok){const Lt=await mt.json();if(Lt.success){const kt=Un(Lt==null?void 0:Lt.data);K(dn=>{var rn;return[...dn,{wallet_address:De,perp_equity:(rn=Lt==null?void 0:Lt.data.marginSummary)==null?void 0:rn.accountValue,margin_usage:parseFloat(Lt==null?void 0:Lt.data.marginSummary.totalMarginUsed)/parseFloat(Lt==null?void 0:Lt.data.marginSummary.accountValue),data:kt}]})}}else if(mt.status===500)console.warn(`Received 500 error for ${De}, retrying with getUserHyperState`),await Xt(De);else throw new Vl(`Request failed with status ${mt.status}`)}catch(At){console.error("Error fetching user state:",At)}},Jt=m.useRef(new Set);m.useEffect(()=>{!t&&r&&(oe==null?void 0:oe.length)>0&&(async()=>{var ze;const At=new Set;for(let rt=0;rt<oe.length;rt++){const mt=oe[rt],Lt=(ze=mt==null?void 0:mt.wallet_address)==null?void 0:ze.toLowerCase();if(!(!Lt||Jt.current.has(Lt))){At.add(Lt),Jt.current.add(Lt);try{await an(Lt)}catch(kt){console.error(`Error fetching user state for wallet ${Lt}:`,kt)}await new Promise(kt=>setTimeout(kt,500))}}})()},[r,t,oe]),m.useEffect(()=>{T||f()},[T]);const Ye=m.useRef(null),Je=()=>{Ye.current&&(Ye.current.scrollLeft-=100)},It=()=>{Ye.current&&(Ye.current.scrollLeft+=100)},hn=()=>{Ye.current&&(Ye.current.scrollTop+=200)},Yt=()=>{Ye.current&&(Ye.current.scrollTop-=200)},Rt=["HyperLiquid","Lighter"],ot=De=>{Ke(At=>At.includes(De)?At.filter(ze=>ze!==De):[...At,De])};return m.useEffect(()=>{function De(At){dt.current&&!dt.current.contains(At.target)&&Re(!1)}return document.addEventListener("mousedown",De),()=>document.removeEventListener("mousedown",De)},[]),i.jsxs(i.Fragment,{children:[i.jsx($5,{open:T,setOpen:M,copyTradeData:F,copyTradeWallet:L,setCopyTradeWallet:z,setCopyTradeData:$,sourcePage:X}),i.jsx(Ecn,{open:o,setOpen:l,copyTradeDelete:s,isDeleteWallet:c}),we&&Aa.createPortal(i.jsx(nue,{open:we,setOpen:xe,oldSlotCount:Ce,checkAccountTrade:f,tradeMarket:"copyTrade"}),document.body),be&&Aa.createPortal(i.jsx(RVe,{open:be,setOpen:je,checkAccountCopy:f}),document.body),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white bg-[#161616] w-full h-full font-manrope",children:[i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2 font-manrope max-w-full w-full bg-[#161616] pl-2 sm:pl-0 pt-4",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px]",children:"Copy Trade"})})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute hidden -top-6 right-4 z-10 lg:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:Je,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:It,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:Yt,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:hn,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full h-full overflow-x-scroll relative overflow-y-scroll flex-grow",ref:Ye,children:i.jsxs("table",{className:"w-full relative mb-20",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[95px] sm:min-w-[95px] z-[8]",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max sticky left-0 h-8",children:i.jsx("div",{className:"flex items-center justify-start",children:"Status"})})}),i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] left-[95px] h-8 px-1 min-w-[130px] z-[8]",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max sticky left-0 h-8",children:i.jsx("div",{className:"flex items-center justify-start",children:"Actions"})})}),i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] left-[225px] h-8 px-1 min-w-[75px] z-[8]",children:i.jsxs("div",{className:"flex items-center justify-start w-full min-w-max sticky left-0 h-8",children:[i.jsx("div",{className:"flex items-center justify-start",children:"DEX"}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>{Re(!Ie)},className:`${Qe.length>0?"bg-gray-900":"bg-[#555555]"} ml-2 inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${Qe.length>0?"text-blue-500":"text-white"}`})}),Ie&&i.jsxs("div",{ref:dt,className:`absolute left-[58px] mt-32 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>Ke(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),Rt==null?void 0:Rt.map(De=>i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-6 relative rounded hover:bg-[#464646] cursor-pointer text-white text-[13px] font-semibold font-manrope leading-[8px] mt-2",children:[i.jsx("input",{type:"checkbox",checked:Qe.includes(De),onChange:()=>ot(De),className:"mr-2 bg-[#3b3b3b] hidden "}),i.jsx("div",{className:`w-4 h-4 max-w-4 max-h-4 flex items-center justify-center border ${Qe.includes(De)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:Qe.includes(De)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),De]},De))]})]})]})}),i.jsx("th",{scope:"col",className:"sm:sticky bg-[#161616] lg:left-[300px] h-10 px-1 min-w-[130px] z-[7]",children:i.jsx(mi,{title:"Follower Name",sortKey:"wm_name",sortOption:Gt,setSortOption:wt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[145px] z-[8]",children:i.jsx(mi,{title:"Follower Wallet",sortKey:"wm_address",sortOption:Gt,setSortOption:wt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[130px]",children:i.jsx(mi,{title:"Source Tag",sortKey:"tag",sortOption:Gt,setSortOption:wt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#161616] h-10 px-1 min-w-[140px] z-[8]",children:i.jsx(mi,{title:"Source Wallet",sortKey:"wallet_address",sortOption:Gt,setSortOption:wt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] pl-1",children:i.jsx(mi,{title:"Follower PnL",sortKey:"total_pnl",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] pl-1",children:i.jsx(mi,{title:"Follower uPnL",sortKey:"totalUnrealizedPnl",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[115px] sm:min-w-[115px] pl-1",children:i.jsx(mi,{title:"Perp Equity",sortKey:"perp_equity",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] sm:min-w-[130px] pl-1",children:i.jsx(mi,{title:"Margin Usage",sortKey:"margin_usage",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[114px] sm:min-w-[114px] pl-1",children:i.jsx(mi,{title:"uPnL",sortKey:"unrealizedPnl",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[124px] sm:min-w-[124px] pl-1",children:i.jsx(mi,{title:"Created Date",sortKey:"created_at",sortOption:Gt,setSortOption:wt,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[100px] pl-1 pr-4",children:i.jsx("div",{className:"flex items-center justify-center gap-1 min-w-max font-manrope",children:i.jsx("div",{className:"cursor-pointer flex items-center justify-end group"})})})]})}),i.jsx("tbody",{children:!n||t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:12,children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-16 ml-[45%] w-max",children:i.jsx($a,{})})})}):e&&!n?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:13,children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center ml-[33%] w-max",children:i.jsx(Vl,{})})})}):(n==null?void 0:n.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:13,children:i.jsx("div",{className:"flex min-h-[44vh] h-66 flex-col justify-center items-center ml-[33%] w-max",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You haven't added a wallet to your copied wallet list yet."}),i.jsxs("div",{className:"text-center -mt-2",children:[i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:["To start copy trading, please visit the"," "]}),i.jsx("span",{className:"text-white text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:"'Discover Wallets'"}),i.jsxs("span",{className:"text-[#979797] text-[13px] font-normal font-manrope leading-[14px] tracking-wide",children:[" ","page."]})]})]})]})})})})}):tt==null?void 0:tt.map((De,At)=>{var rn,gn,An,kn,yn;const ze=J.find(Vn=>Vn.wallet_address===De.wallet_address),rt=J.find(Vn=>Vn.wallet_address===(De==null?void 0:De.wm_address)),mt=V==null?void 0:V.find(Vn=>{var Kn,Dn,Xn,Nn;return((Kn=Vn==null?void 0:Vn.generated_wallet_public)==null?void 0:Kn.toLowerCase())===((Dn=De==null?void 0:De.wm_address)==null?void 0:Dn.toLowerCase())&&((Xn=Vn==null?void 0:Vn.copy_trader_wallet)==null?void 0:Xn.toLowerCase())===((Nn=De==null?void 0:De.wallet_address)==null?void 0:Nn.toLowerCase())}),Lt=mt?mt.total_pnl:null;let kt=0;mt&&((rn=mt==null?void 0:mt.openPositionCoinList)==null?void 0:rn.length)>0&&((gn=rt==null?void 0:rt.data)==null?void 0:gn.length)>0&&((An=mt==null?void 0:mt.openPositionCoinList)==null||An.forEach(Vn=>{var Dn;const Kn=(Dn=rt==null?void 0:rt.data)==null?void 0:Dn.find(Xn=>{var Nn;return((Nn=Xn==null?void 0:Xn.asset)==null?void 0:Nn.toLowerCase().trim())===(Vn==null?void 0:Vn.toLowerCase().trim())});Kn&&(Kn!=null&&Kn.unrealizedPnl)&&(kt+=parseFloat(Kn==null?void 0:Kn.unrealizedPnl))}));const dn=`${De.follower_wallet}_${De.wallet_address}_${De.wallet_id}`;return i.jsxs("tr",{className:`${At%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",className:`${At%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:(()=>{const Vn=x==null?void 0:x.includes(De.wallet_id),Kn=`${De==null?void 0:De.wm_address}_${De==null?void 0:De.wallet_address}_${De==null?void 0:De.wallet_id}`,Dn=d===0&&!q[Kn]&&!Vn,Xn=g;return i.jsxs("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2.5 pl-2 h-14 max-h-14 relative",children:[i.jsxs("div",{className:"relative group/switch",children:[i.jsx(Io,{checked:!!q[Kn],onChange:()=>{if(!Xn&&(De==null?void 0:De.target_platform)==="lighter"){je(!0);return}if(Dn&&(De==null?void 0:De.target_platform)==="lighter"){me(y),xe(!0);return}Be(De==null?void 0:De.wm_address,De.wallet_address,!q[Kn],De==null?void 0:De.target_platform,De==null?void 0:De.wallet_id)},disabled:ae[Kn],className:`${q[Kn]?"bg-[#1DE674]":"bg-[#353535]"} ${ae[Kn]?"cursor-not-allowed":"cursor-pointer"} flex h-[18px] w-[28px] rounded-[256px] p-1 transition-colors`,children:i.jsx("span",{"aria-hidden":"true",className:`${q[Kn]?"translate-x-1.5 bg-white":"-translate-x-[1px] bg-[#D5D5D5]"} inline-block size-[14px] -mt-[3px] rounded-full shadow-lg transition`})}),!Xn&&(De==null?void 0:De.target_platform)==="lighter"?i.jsx("div",{className:"absolute -left-1 translate-x-0 top-[-34px] px-2 py-1 text-xs rounded-md bg-[#353535] text-white whitespace-nowrap opacity-0 group-hover/switch:opacity-100 transition duration-200",children:"Subscribe"}):Dn&&(De==null?void 0:De.target_platform)==="lighter"&&i.jsx("div",{className:"absolute -left-1 translate-x-0 top-[-34px] px-2 py-1 text-xs rounded-md bg-[#353535] text-white whitespace-nowrap opacity-0 group-hover/switch:opacity-100 transition duration-200",children:"Get more slots"})]}),ae[Kn]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):q[Kn]?"On":"Off"]})})()}),i.jsx("td",{scope:"row",className:`${At%2==0,"bg-[#161616]"} sm:sticky left-[95px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-0.5 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{onClick:()=>{cn(De==null?void 0:De.wallet_address,De==null?void 0:De.wallet_id)},className:`${n!=null&&n.some(Vn=>Vn.wallet_address===(De==null?void 0:De.wallet_address))?"bg-[#67ffbd] text-[#161616] font-semibold":"border border-[#67ffbd] bg-[#161616] text-[#67ffbd] hover:bg-[#67ffbd] hover:text-[#161616] font-bold"} h-[22px] rounded-[256px] justify-center items-center gap-1 inline-flex cursor-pointer text-xs font-['Manrope'] leading-[8px] tracking-tight px-2 min-w-max`,children:"Copy Trade"}),i.jsx(B5,{walletAddress:De==null?void 0:De.wallet_address,children:i.jsx("div",{className:"w-[18px] h-[18px] justify-center items-center flex cursor-pointer",children:v.some(Vn=>Vn.wallet_address===(De==null?void 0:De.wallet_address))?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})})}),i.jsx("td",{scope:"row",className:`${At%2==0,"bg-[#161616]"} sm:sticky left-[225px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-5 h-14 max-h-14",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:(De==null?void 0:De.target_platform)==="lighter"?i.jsx(gi,{content:"Lighter",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(bf,{className:"w-4 h-4 text-[#fff]"})})}):(De==null?void 0:De.target_platform)==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(gi,{content:"Hyperliquid",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:I1,alt:"",className:"w-4 h-4 text-[#fff]"})})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(gi,{content:"Dextrabot",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx("img",{src:Yi,alt:"",className:"w-4 h-4 text-[#fff]"})})})})})})}),i.jsx("td",{scope:"row",className:`${At%2===0,"bg-[#161616]"} sm:sticky lg:left-[300px] z-[1] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5 has-tooltip relative",children:[i.jsx(ua,{info1:De!=null&&De.wm_name?(De==null?void 0:De.wm_name.length)>=13?(De==null?void 0:De.wm_name).slice(0,13)+"...":De==null?void 0:De.wm_name:"--",info1_Color:"text-white",rowTwo:!1}),(De==null?void 0:De.wm_name)&&(De==null?void 0:De.wm_name.length)>=13&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ma,{content:`${De==null?void 0:De.wm_name}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${At%2===0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${De==null?void 0:De.wm_address}`,"_blank")},className:"cursor-pointer group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(De==null?void 0:De.wm_address).slice(0,5)+"..."+(De==null?void 0:De.wm_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Vn=>{Vn.stopPropagation(),navigator.clipboard.writeText(De==null?void 0:De.wm_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{scope:"row",className:`${At%2===0,"bg-[#161616]"} group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5 has-tooltip relative",children:[i.jsx(ua,{info1:De!=null&&De.tag?(De==null?void 0:De.tag.length)>=10?(De==null?void 0:De.tag).slice(0,10)+"...":De==null?void 0:De.tag:"--",info1_Color:"text-white",rowTwo:!1}),(De==null?void 0:De.tag)&&(De==null?void 0:De.tag.length)>=10&&i.jsx("span",{className:"-ml-[9px]",children:i.jsx(Ma,{content:`${De==null?void 0:De.tag}`,positionTop:!0,alignRight:!1})})]})})})}),i.jsx("td",{scope:"row",className:`${At%2===0,"bg-[#161616]"} group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{onClick:()=>{window.open(`/wallet-details/${De==null?void 0:De.wallet_address}`,"_blank")},className:"cursor-pointer group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx(ua,{info1:`${(De==null?void 0:De.wallet_address).slice(0,5)+"..."+(De==null?void 0:De.wallet_address).slice(-4)}`,info1_Color:"text-white",rowTwo:!1}),i.jsx("img",{onClick:Vn=>{Vn.stopPropagation(),navigator.clipboard.writeText(De==null?void 0:De.wallet_address),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})})})}),i.jsx("td",{children:i.jsx(Fh,{info:Lt!==null?`$${_r(Math.abs(Lt))}`:"--",textColor:`${Lt>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:i.jsx(Fh,{info:mt?`$${_r(Math.abs(kt))}`:"--",textColor:`${kt>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`})}),i.jsx("td",{children:te?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):ze?i.jsx(Fh,{info:(ze==null?void 0:ze.perp_equity)!=0?`$${_r(ze==null?void 0:ze.perp_equity)}`:"$0",textColor:"text-white"}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:te?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):ze?i.jsx(Fh,{info:isNaN(ze==null?void 0:ze.margin_usage)?"0%":`${((ze==null?void 0:ze.margin_usage)*100).toFixed(2)}%`,textColor:"text-white"}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:te?i.jsx(Fh,{info:"Loading...",textColor:"text-white"}):ze?i.jsx(Fh,{info:(ze==null?void 0:ze.data)!=0?`$${_r(Math.abs((kn=ze==null?void 0:ze.data)==null?void 0:kn.reduce((Vn,Kn)=>Vn+parseFloat(Kn.unrealizedPnl||0),0)))}`:"$0",textColor:`${((yn=ze==null?void 0:ze.data)==null?void 0:yn.reduce((Vn,Kn)=>Vn+parseFloat(Kn.unrealizedPnl),0))>=0?"text-[#4ae3b5]":"text-[#ff6b6b]"}`}):i.jsx(Fh,{info:"Loading...",textColor:"text-white"})}),i.jsx("td",{children:i.jsx(Fh,{info:(De==null?void 0:De.created_at)&&O3(De==null?void 0:De.created_at),textColor:"text-white"})}),i.jsx("td",{className:"pr-4",children:i.jsx("div",{className:"pl-1 flex flex-col items-end gap-2 font-manrope",children:a[dn]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{u({followerWallet:De==null?void 0:De.wm_address,sourceWallet:De==null?void 0:De.wallet_address,platform:De==null?void 0:De.target_platform,id:De==null?void 0:De.wallet_id}),l(!0)},className:"h-5 px-2 py-1.5 rounded-md border border-white justify-start items-center gap-2 inline-flex",children:i.jsx("div",{className:"text-white text-[11px] font-semibold font-manrope leading-[8px] tracking-tight cursor-pointer",children:"Delete"})})})})]},At)})})]})})]})]})]})},Fh=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-sm font-semibold font-manrope leading-none flex items-center justify-start pl-1 gap-0.5`,children:t})}),kcn=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState(!1),{isConnected:s,address:a}=ns(),{copyTradeWatchList:o,getCopyTradeWatchList:l,trackedWatchList:c,getTrackedWatchList:u,copyWatchListLoading:d,copyWatchListError:f,setTelegramChatId:x,setSubscriberRole:g,setSubsExpireDay:y,setMushboomerETH:v,setIsWhitelist:C,setMushboomerSOL:N,setIsReferralCode:P,setIsReferralCodeName:T,setHyperToken:M,setHyperAddress:F,hyperToken:$}=m.useContext(Qr),[L,z]=m.useState({}),[X,ne]=m.useState(!1),[J,K]=m.useState({followerWallet:"",sourceWallet:"",platform:"",id:null}),[te,fe]=m.useState(0),[q,se]=m.useState([]),[ae,W]=m.useState(""),[V,ee]=m.useState(0);m.useEffect(()=>{$&&(l(),u(),e(!0),r(!0))},[$]);const oe=async()=>{var xe,be,je,Ie;const me=window.localStorage.getItem("hyperToken"),we=window.localStorage.getItem("hyperAddress");if(!(!me||!we))try{const Re=await ki(we.toLowerCase(),me);Re!=null&&Re.success?(x(Re==null?void 0:Re.telegram_chat_id),g(Re==null?void 0:Re.subscriber_role),y(Re==null?void 0:Re.subs_expire_day),v((xe=Re==null?void 0:Re.mushboomer_counts)==null?void 0:xe.eth),N((be=Re==null?void 0:Re.mushboomer_counts)==null?void 0:be.sol),P(Re==null?void 0:Re.referral_code),T(Re==null?void 0:Re.refcode),C(Re==null?void 0:Re.whitelist),fe((je=Re==null?void 0:Re.copy_trade_slots_info)==null?void 0:je.total_slot_count),se(Re==null?void 0:Re.copy_trade_slots_wallets),W(Re==null?void 0:Re.farming_tools),ee((Ie=Re==null?void 0:Re.copy_trade_slots_info)==null?void 0:Ie.extra_slot_count)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),M(""),F(""))}catch(Re){console.error("Token verification error:",Re)}};m.useEffect(()=>{oe()},[]);const de=async(me,we,xe,be)=>{const je=`${me}_${we}_${be}`;try{const Ie=window.localStorage.getItem("hyperToken"),Re="https://dextrabothypev2.nftinit.io/api/test_app/following/unfollow/";if(!Ie||!we||!xe||!be||!me)throw new Error("Required information is missing. Please log in or connect your wallet.");z(tt=>({...tt,[je]:!0}));const Qe=window.localStorage.getItem("hyperAddress"),Ke=await fetch(Re,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:a?a.toLowerCase():Qe,token:Ie,follow_address:we.toLowerCase(),target_platform:xe,wallet_id:be})});if(!Ke.ok)throw new Error(`Failed to unlike: ${Ke.status} ${Ke.statusText}`);const dt=await Ke.json();dt.success?(z(tt=>({...tt,[je]:!1})),l(),ne(!1),K({followerWallet:"",sourceWallet:"",platform:"",id:null}),oe(),tn.success(`${we==null?void 0:we.slice(0,5)}...${we==null?void 0:we.slice(-3)} removed from watchlist`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}})):(tn.error(dt.error_message),z(tt=>({...tt,[je]:!1})),ne(!1))}catch(Ie){tn.error(Ie.message||"Something went wrong!"),z(Re=>({...Re,[je]:!1})),ne(!1)}},Ce=!!window.localStorage.getItem("hyperToken");return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsx(xo,{children:Ce?i.jsxs(i.Fragment,{children:[i.jsx("title",{children:"Copy Trade on Hyperliquid | Mirror Top Traders with Dextrabot"}),i.jsx("meta",{name:"description",content:"Automatically copy trade top-performing Hyperliquid traders with customizable risk parameters. Set position sizing, stop-loss levels, and take-profit targets with Dextrabot's copy trade system."}),i.jsx("meta",{property:"og:title",content:"Copy Trade on Hyperliquid | Mirror Top Traders with Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Automatically copy trade top-performing Hyperliquid traders with customizable risk parameters. Set position sizing, stop-loss levels, and take-profit targets with Dextrabot's copy trade system."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/copy-trade"})]}):i.jsxs(i.Fragment,{children:[i.jsx("title",{children:"Dextrabot Copy Trading | Automate Hyperliquid Trading with Top Performers"}),i.jsx("meta",{name:"description",content:"Replicate top Hyperliquid traders automatically with Dextrabot's advanced copy trading system. Set custom risk parameters, position sizing, and selective token filtering for precise portfolio control."}),i.jsx("meta",{property:"og:title",content:"Dextrabot Copy Trading | Automate Hyperliquid Trading with Top Performers"}),i.jsx("meta",{property:"og:description",content:"Replicate top Hyperliquid traders automatically with Dextrabot's advanced copy trading system. Set custom risk parameters, position sizing, and selective token filtering for precise portfolio control."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/copy-trade"})]})})}),i.jsx("div",{style:{height:"calc(100vh - 5rem)"},className:"flex justify-center items-center w-full h-full px-1 pt-1 sm:px-6 sm:pt-6 bg-[#161616] overflow-hidden",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full flex-grow xl:flex-grow-0",children:Ce?i.jsx(_cn,{loading:d,error:f,trackerData:o,isRequest:t,handleCopyDelete:de,deleteLoading:L,isDeleteModalOpen:X,setIsDeleteModalOpen:ne,isDeleteWallet:J,setIsDeleteWallet:K,slotTotalCount:te,checkSlotAccount:oe,slotCountWallets:q,subsRole:ae,slotCount:V}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(fz,{})})})})]})},Tcn=({volumeLeaderboardData:t,userData:e,currentPage:n=1,rowsPerPage:r=25})=>{const[s,a]=m.useState([]),[o,l]=m.useState({key:null,direction:"asc"}),c=localStorage.getItem("hyperAddress");localStorage.getItem("hyperToken");const u=(e==null?void 0:e.refCode)||(e==null?void 0:e.refcode)||(typeof window<"u"?window.localStorage.getItem("refcode"):"")||"";m.useEffect(()=>{const x=c?c.toLowerCase():null,g=t.map(y=>{const v=y.out_subscriber_address?y.out_subscriber_address.toLowerCase():null,C=y.owner||x&&v===x;return{...y,owner:!!C,refCode:C&&u?u:y.refCode||y.refcode||null,referral_xp:y.referral_xp??y.calculated_xp??y.overall_point_result??0}});a(g)},[t,c,u]);const d=x=>{let y=["overall_point_result","referral_xp"].includes(x)?"desc":"asc";o.key===x&&(y=o.direction==="asc"?"desc":"asc");const v=[...s].sort((C,N)=>{const P=parseFloat(C[x])||0,T=parseFloat(N[x])||0;return P<T?y==="asc"?-1:1:P>T?y==="asc"?1:-1:0});a(v),l({key:x,direction:y})},f=x=>o.key!==x?i.jsx(a2,{className:"inline ml-2 text-white"}):o.direction==="asc"?i.jsx(i2,{className:"inline ml-2 text-white"}):i.jsx(s2,{className:"inline ml-2 text-white"});return i.jsx("div",{className:"overflow-x-auto mobile-scroll-indicator",children:i.jsxs("table",{className:"w-full text-white min-w-[900px]",children:[i.jsx("thead",{className:"text-left",children:i.jsxs("tr",{children:[i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer flex items-center text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("ranking"),children:["# ",f("ranking")]}),i.jsx("th",{className:"px-3 sm:px-6 py-3 sm:py-4 text-gray-300 font-semibold text-xs sm:text-sm",children:"Wallet"}),i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("overall_point_result"),children:[i.jsx("span",{className:"hidden sm:inline",children:"XP"}),i.jsx("span",{className:"sm:hidden",children:"Points"})," ",f("overall_point_result")]}),i.jsxs("th",{className:"px-3 sm:px-6 py-3 sm:py-4 cursor-pointer text-gray-300 font-semibold text-xs sm:text-sm",onClick:()=>d("referral_xp"),children:[i.jsx("span",{className:"hidden sm:inline",children:"Referral XP"}),i.jsx("span",{className:"sm:hidden",children:"Ref XP"})," ",f("referral_xp")]})]})}),i.jsx("tbody",{children:s.slice((n-1)*r,n*r).map((x,g)=>{const y=(n-1)*r+g,v=y%2===0?"bg-[#1b1b1b]":"bg-[#1f1f1f]",C=x.owner?"bg-[#162720] ring-1 ring-emerald-400/30":"";return i.jsxs("tr",{className:`${v} ${C} group text-white transition-colors hover:bg-[#222222]`,children:[i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsx("span",{className:"text-sm sm:text-lg font-bold",children:x.ranking||"Unranked"})}),i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx("span",{className:"font-mono text-xs sm:text-sm",children:KB(x.out_subscriber_address)}),x.owner&&i.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#67FFBD] bg-[#132822] border border-emerald-400/40 rounded-full px-2 py-0.5",children:"You"})]})}),i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsx("span",{className:"text-xs sm:text-sm",children:_r(x.calculated_xp||0)})}),i.jsx("td",{className:"px-3 sm:px-6 py-3 sm:py-4",children:i.jsx("span",{className:"text-xs sm:text-sm",children:_r(x.referral_xp??x.calculated_xp??0)})})]},y)})})]})})},Pcn=({pnlLeaderboardData:t,userData:e,currentPage:n=1,rowsPerPage:r=25})=>{var x,g,y,v;const[s,a]=m.useState([]),o=localStorage.getItem("hyperAddress"),l=localStorage.getItem("hyperToken"),[c,u]=m.useState({key:null,direction:"asc"});m.useEffect(()=>{a(t)},[t]);const d=C=>{let N="asc";c.key===C&&c.direction==="asc"&&(N="desc");const P=[...s].sort((T,M)=>{const F=parseFloat(T[C])||0,$=parseFloat(M[C])||0;return F<$?N==="asc"?-1:1:F>$?N==="asc"?1:-1:0});a(P),u({key:C,direction:N})},f=C=>c.key!==C?i.jsx(a2,{className:"inline ml-2 text-white"}):c.direction==="asc"?i.jsx(i2,{className:"inline ml-2 text-white"}):i.jsx(s2,{className:"inline ml-2 text-white"});return i.jsx("div",{className:"mx-auto w-full sm:w-4/6 overflow-x-auto shadow-lg mt-[24px] h-[100vh] overflow-auto rounded-xl bg-[#161616]",children:i.jsxs("table",{className:"table-fixed min-w-full text-white border-separate border-spacing-y-2 rounded-xl",children:[i.jsx("thead",{className:"text-left sticky -top-1 z-10",children:i.jsxs("tr",{className:"text-white font-manrope text-[14px] font-semibold leading-[13px] tracking-[0.26px] bg-[#161616]",children:[i.jsxs("th",{className:"px-4 py-3 cursor-pointer flex items-center",onClick:()=>d("ranked"),children:["# ",f("ranked")]}),i.jsx("th",{className:"px-4 py-3",children:"Wallet"}),i.jsxs("th",{className:"flex items-center px-4 py-3",children:[i.jsx("span",{className:"text-[#67FFBD] [text-shadow:0px_0px_8px_rgba(103,255,189,0.48)] font-manrope text-[14px] not-italic font-semibold leading-[32px] tracking-[0.56px]",children:"Booster"}),i.jsx("img",{src:Nlt,alt:"Dextrabot"})]}),i.jsxs("th",{className:"px-4 py-3 cursor-pointer relative",onClick:()=>d("daily_point_result"),children:["Points 24h",f("daily_point_result")]}),i.jsxs("th",{className:"flex justify-end items-center px-4 py-3 cursor-pointer relative",onClick:()=>d("total_pnl"),children:[i.jsx("span",{className:"text-[#D65AFF] [text-shadow:0px_0px_8px_rgba(214,90,255,0.48)] font-manrope text-[14px] not-italic font-semibold leading-[32px] tracking-[0.56px]",children:"Total Points"}),i.jsx("img",{src:Alt,alt:"Dextrabot"}),f("total_pnl")]})]})}),i.jsxs("tbody",{className:"text-left",children:[o&&l&&e&&Object.keys(e).length>0?i.jsxs("tr",{className:"text-white font-manrope text-[14px] font-bold leading-[13px] tracking-[0.28px] bg-[#2D2D2D]",children:[i.jsx("td",{className:"h-[inherit] rounded-l-2xl p-0",children:i.jsx("div",{className:`min-w-[48px] w-fit px-2 h-12 flex items-center justify-center text-black font-bold text-[18px] first:rounded-tl-2xl first:rounded-bl-2xl ${e.ranked===1?"bg-[#67FFBD]":e.ranked===2?"bg-[#D65AFF]":e.ranked===3?"bg-[#36C9FF]":"bg-[#525252] text-white"}`,children:e.ranked||"Unranked"})}),i.jsx("td",{className:"px-4 py-3 font-semibold",children:i.jsx("div",{className:"flex justify-left items-center gap-2 cursor-pointer",children:i.jsx("span",{className:"w-[75px] text-[#67FFBD]",children:"You"})})}),i.jsx("td",{className:"px-4 py-3 font-bold flex items-center gap-2",children:i.jsxs("div",{className:"flex items-center gap-2 min-h-[24px]",children:[((x=e.mushInfo)==null?void 0:x.eth)>0&&i.jsxs("a",{href:"https://blur.io/eth/collection/mushboomers",target:"_blank",rel:"noopener noreferrer",className:"relative",children:[i.jsx("img",{src:nme,className:"w-[24px] h-[24px] cursor-pointer",alt:"Mushboomers"}),i.jsx("span",{className:"absolute right-[-8px] top-[-8px] bg-[rgba(103,103,103,0.32)] backdrop-blur-[4px] text-white text-xs rounded-full px-1 flex items-center justify-center w-5 h-5 font-semibold font-manrope",children:e.mushInfo.eth})]}),((g=e.mushInfo)==null?void 0:g.sol)>0&&i.jsxs("a",{href:"https://www.tensor.trade/trade/mushboomers",target:"_blank",rel:"noopener noreferrer",className:"relative",children:[i.jsx("img",{src:rme,className:"w-[24px] h-[24px] cursor-pointer",alt:"Mushboomers"}),i.jsx("span",{className:"absolute right-[-8px] top-[-8px] bg-[rgba(103,103,103,0.32)] backdrop-blur-[4px] text-white text-xs rounded-full px-1 flex items-center justify-center w-5 h-5 font-semibold font-manrope",children:e.mushInfo.sol})]}),((y=e.mushInfo)==null?void 0:y.eth)===0&&((v=e.mushInfo)==null?void 0:v.sol)===0&&i.jsx("div",{className:"w-[24px] h-[24px]"})]})}),i.jsx("td",{className:"px-4 py-3 font-semibold",children:_r(e.daily_point_result)}),i.jsx("td",{className:"px-4 py-3 font-semibold rounded-br-2xl rounded-tr-2xl text-right",children:_r(e.total_pnl)})]}):(o||l)&&(!e||Object.keys(e).length===0)?i.jsxs("tr",{className:"text-white font-manrope text-[14px] font-bold leading-[13px] tracking-[0.28px] bg-[#2D2D2D]",children:[i.jsx("td",{className:"h-[inherit] rounded-l-2xl p-0",children:i.jsx("div",{className:"bg-[#525252] min-w-[48px] w-fit px-2 h-12 flex items-center justify-center text-white font-bold text-[18px] first:rounded-tl-2xl first:rounded-bl-2xl font-manrope",children:"Unranked"})}),i.jsx("td",{className:"px-4 py-3 font-bold text-[#67FFBD]",children:"You"}),i.jsx("td",{className:"px-4 py-3 text-[#FFF] font-semibold",children:"-"}),i.jsx("td",{className:"px-4 py-3 font-bold flex items-center gap-2",children:"-"}),i.jsx("td",{className:"px-4 py-3 font-semibold rounded-br-2xl rounded-tr-2xl text-right",children:"-"})]}):null,s.slice((n-1)*r,n*r).map((C,N)=>{const P=(n-1)*r+N,T=P%2===0?"bg-[#1b1b1b]":"bg-[#1f1f1f]",M=C.owner?"bg-[#162720] ring-1 ring-emerald-400/30":"";return i.jsxs("tr",{className:`text-white h-[50px] font-manrope text-[14px] font-bold leading-[13px] tracking-[0.28px] ${T} ${M} group hover:bg-[#222222]`,children:[i.jsx("td",{className:"h-[inherit] rounded-l-2xl p-0",children:i.jsx("div",{className:`min-w-[48px] w-fit px-2 h-full flex items-center justify-center text-black font-bold text-[18px] first:rounded-tl-2xl first:rounded-bl-2xl ${C.ranked===1?"bg-[#67FFBD]":C.ranked===2?"bg-[#D65AFF]":C.ranked===3?"bg-[#36C9FF]":"bg-[#2D2D2D] text-white"}`,children:C.ranked||"Unranked"})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("div",{className:"flex justify-left items-center gap-2 cursor-pointer",children:i.jsx("span",{className:"w-[75px]",children:KB(C.subscriber_address)})})}),i.jsx("td",{className:"px-4 py-3 font-bold flex items-center gap-2",children:i.jsxs("div",{className:"flex items-center gap-2 min-h-[24px] pl-1",children:[C.mushInfo.eth>0&&i.jsxs("a",{href:"https://blur.io/eth/collection/mushboomers",target:"_blank",rel:"noopener noreferrer",className:"relative",children:[i.jsx("img",{src:nme,className:"w-[24px] h-[24px] cursor-pointer",alt:"Mushboomers"}),i.jsx("span",{className:"absolute right-[-8px] top-[-8px] bg-[rgba(103,103,103,0.32)] backdrop-blur-[4px] text-white text-xs rounded-full px-1 flex items-center justify-center w-5 h-5 font-semibold font-manrope",children:C.mushInfo.eth})]}),C.mushInfo.sol>0&&i.jsxs("a",{href:"https://www.tensor.trade/trade/mushboomers",target:"_blank",rel:"noopener noreferrer",className:"relative",children:[i.jsx("img",{src:rme,className:"w-[24px] h-[24px] cursor-pointer",alt:"Mushboomers"}),i.jsx("span",{className:"absolute right-[-8px] top-[-8px] bg-[rgba(103,103,103,0.32)] backdrop-blur-[4px] text-white text-xs rounded-full px-1 flex items-center justify-center w-5 h-5 font-semibold font-manrope",children:C.mushInfo.sol})]}),C.mushInfo.eth===0&&C.mushInfo.sol===0&&i.jsx("div",{className:"w-[24px] h-[24px]"})]})}),i.jsx("td",{className:"px-4 py-3 font-semibold",children:_r(C.daily_point_result)}),i.jsx("td",{className:"px-4 py-3 font-semibold last:rounded-tr-xl last:rounded-br-xl text-right",children:_r(C.total_pnl)})]},P)})]})]})})},Icn="/assets/bg_-D6bvhHQD.png",Fcn=({className:t="w-4 h-4"})=>i.jsxs("svg",{className:t,viewBox:"0 0 9 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("g",{clipPath:"url(#paint0_angular_3845_132_clip_path)",children:i.jsx("g",{transform:"matrix(0 0.008 -0.0045 0 4.35268 6.96028)",children:i.jsx("foreignObject",{x:"-1189.48",y:"-1189.48",width:"2378.97",height:"2378.97",children:i.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",className:"h-full w-full opacity-100",style:{background:"conic-gradient(from 90deg,rgba(230, 159, 29, 1) 0deg,rgba(255, 225, 0, 1) 360deg)"}})})})}),i.jsx("path",{d:"M3.48108 0.509775C3.86338 -0.169925 4.84198 -0.169925 5.22428 0.509775L8.57688 6.46998C8.74818 6.77448 8.74818 7.14607 8.57688 7.45057L5.22428 13.4108C4.84198 14.0905 3.86338 14.0905 3.48108 13.4108L0.128475 7.45057C-0.042825 7.14607 -0.042825 6.77448 0.128475 6.46998L3.48108 0.509775Z",fill:"url(#gradient)"}),i.jsx("defs",{children:i.jsx("clipPath",{id:"paint0_angular_3845_132_clip_path",children:i.jsx("path",{d:"M3.48108 0.509775C3.86338 -0.169925 4.84198 -0.169925 5.22428 0.509775L8.57688 6.46998C8.74818 6.77448 8.74818 7.14607 8.57688 7.45057L5.22428 13.4108C4.84198 14.0905 3.86338 14.0905 3.48108 13.4108L0.128475 7.45057C-0.042825 7.14607 -0.042825 6.77448 0.128475 6.46998L3.48108 0.509775Z"})})})]}),Ocn=({className:t="w-4 h-4"})=>i.jsxs("svg",{className:t,viewBox:"0 0 9 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("g",{clipPath:"url(#paint0_angular_3845_127_clip_path)",children:i.jsx("g",{transform:"matrix(0 0.008 -0.0045 0 4.35268 6.96028)",children:i.jsx("foreignObject",{x:"-1189.48",y:"-1189.48",width:"2378.97",height:"2378.97",children:i.jsx("div",{xmlns:"http://www.w3.org/1999/xhtml",className:"h-full w-full opacity-100",style:{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(214, 214, 214, 1) 360deg)"}})})})}),i.jsx("path",{d:"M3.48108 0.509775C3.86338 -0.169925 4.84198 -0.169925 5.22428 0.509775L8.57688 6.46998C8.74818 6.77448 8.74818 7.14607 8.57688 7.45057L5.22428 13.4108C4.84198 14.0905 3.86338 14.0905 3.48108 13.4108L0.128475 7.45057C-0.042825 7.14607 -0.042825 6.77448 0.128475 6.46998L3.48108 0.509775Z",fill:"url(#gradient)"}),i.jsx("defs",{children:i.jsx("clipPath",{id:"paint0_angular_3845_127_clip_path",children:i.jsx("path",{d:"M3.48108 0.509775C3.86338 -0.169925 4.84198 -0.169925 5.22428 0.509775L8.57688 6.46998C8.74818 6.77448 8.74818 7.14607 8.57688 7.45057L5.22428 13.4108C4.84198 14.0905 3.86338 14.0905 3.48108 13.4108L0.128475 7.45057C-0.042825 7.14607 -0.042825 6.77448 0.128475 6.46998L3.48108 0.509775Z"})})})]}),Mcn=()=>{const[t,e]=m.useState([]),[n,r]=m.useState([]),[s,a]=m.useState(null),[o,l]=m.useState(null),[c,u]=m.useState("volume"),[d,f]=m.useState(!1),[x,g]=m.useState(!1),[y,v]=m.useState(!1),[C,N]=m.useState(1),P=25,T=m.useRef(null),M=m.useRef(null),{isConnected:F,address:$}=ns(),{openConnectModal:L}=D5(),{walletLogin:z,signIn:X,hyperToken:ne,hyperAddress:J,setSignInConnectButtonOpen:K,isReferralCodeName:te}=m.useContext(Qr),fe=()=>{F?window.localStorage.getItem("hyperToken")&&ne?z():X(1):(L(),K(!0))},q=te||window.localStorage.getItem("refcode")||"",se=q?`https://app.dextrabot.com/referral/${q}`:"",ae=()=>{if(!J||!ne){fe();return}f(!0)},W=()=>{if(!J||!ne){fe();return}g(!0)},V=Be=>{Be&&(navigator.clipboard.writeText(Be),tn.success("Copied to clipboard"))},ee=async()=>{var Be;if(T.current)try{(Be=document==null?void 0:document.fonts)!=null&&Be.ready&&await document.fonts.ready;const ht=await V1(T.current,{cacheBust:!0,backgroundColor:"#040707",pixelRatio:2}),pt=document.createElement("a");pt.href=ht,pt.download="dextrabot-leaderboard-rank.png",document.body.appendChild(pt),pt.click(),document.body.removeChild(pt),tn.success("Image downloaded")}catch(ht){console.error("Share card download error",ht),tn.error("Failed to download image")}};m.useCallback(()=>{ps.get("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/").then(ht=>{const pt=(ht.data.data||[]).map(Gt=>({ranking:Gt.rank_position,out_subscriber_address:Gt.address,overall_pos_value:Gt.total_volume,calculated_xp:Gt.total_xp,overall_point_result:Gt.total_xp,referral_xp:Gt.ref_bf_xp,refCode:Gt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Gt.owner}));e(pt)}).catch(ht=>{console.error("Error fetching volume data:",ht)})},[]),m.useEffect(()=>{const Be="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",ht=pt=>(pt||[]).map(Gt=>({ranking:Gt.rank_position,out_subscriber_address:Gt.address,overall_pos_value:Gt.total_volume,calculated_xp:Gt.total_xp,overall_point_result:Gt.total_xp,referral_xp:Gt.ref_bf_xp,refCode:Gt.refCode??null,daily_pos_value:null,generated_wallets:[],owner:!!Gt.owner}));ps.get(Be).then(pt=>{const Gt=ht(pt.data.data);e(Gt),r(Gt)}).catch(pt=>{console.error("Error fetching leaderboard data:",pt),e([]),r([])})},[]);const oe=m.useCallback(()=>{M.current&&M.current.abort();const Be=J||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),ht=ne||typeof window<"u"&&window.localStorage.getItem("hyperToken");if(Be&&ht){v(!0);const pt="https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",Gt=new AbortController;M.current=Gt,ps.post(pt,{address:Be,token:ht},{headers:{"Content-Type":"application/json"},signal:Gt.signal}).then(wt=>{if(!Gt.signal.aborted){if(wt.data.ownerRank)a(wt.data.ownerRank);else if(wt.data.data){const nn=wt.data.data.find(cn=>{var Un;return((Un=cn.address)==null?void 0:Un.toLowerCase())===(Be==null?void 0:Be.toLowerCase())});a(nn?{ranking:nn.rank_position,rank_position:nn.rank_position,overall_pos_value:nn.total_volume,total_volume:nn.total_volume,calculated_xp:nn.total_xp,total_xp:nn.total_xp,overall_point_result:nn.total_xp,referral_xp:nn.ref_bf_xp,refCode:nn.refCode}:null)}else a(null);v(!1)}}).catch(wt=>{wt.name!=="CanceledError"&&!Gt.signal.aborted&&(console.error("API Error (Volume):",wt),v(!1))})}else a(null),v(!1)},[J,ne]),de=m.useCallback(()=>{const Be=J||typeof window<"u"&&window.localStorage.getItem("hyperAddress"),ht=ne||typeof window<"u"&&window.localStorage.getItem("hyperToken");Be&&ht?ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/leaderboard/",{address:Be,token:ht},{headers:{"Content-Type":"application/json"}}).then(pt=>{if(pt.data.ownerRanks)l(pt.data.ownerRanks[0]);else if(pt.data.ownerRank)l(pt.data.ownerRank);else if(pt.data.data){const Gt=pt.data.data.find(wt=>{var nn;return((nn=wt.address)==null?void 0:nn.toLowerCase())===(Be==null?void 0:Be.toLowerCase())});l(Gt?{ranked:Gt.rank_position,rank_position:Gt.rank_position,subscriber_address:Gt.address,total_pnl:Gt.total_xp,daily_point_result:Gt.daily_point_result||0,mushInfo:Gt.mushInfo||{eth:0,sol:0}}:null)}else l(null)}).catch(pt=>console.error("API Error (PnL):",pt)):l(null)},[J,ne]);m.useEffect(()=>{oe(),c==="pnl"&&de();const Be=()=>{oe(),c==="pnl"&&de()};return window.addEventListener("localStorageUpdated",Be),()=>{window.removeEventListener("localStorageUpdated",Be),M.current&&M.current.abort()}},[J,ne,c,oe,de]);const Ce=m.useMemo(()=>c==="volume"?s:o,[c,s,o]),me=m.useMemo(()=>(Ce==null?void 0:Ce.ranking)??"--",[Ce==null?void 0:Ce.ranking]),we=m.useMemo(()=>(Ce==null?void 0:Ce.overall_pos_value)??(Ce==null?void 0:Ce.total_volume)??0,[Ce==null?void 0:Ce.overall_pos_value,Ce==null?void 0:Ce.total_volume]),xe=m.useMemo(()=>(Ce==null?void 0:Ce.calculated_xp)??(Ce==null?void 0:Ce.total_xp)??0,[Ce==null?void 0:Ce.calculated_xp,Ce==null?void 0:Ce.total_xp]),be=m.useMemo(()=>s?s.overall_point_result??s.total_xp??s.calculated_xp??(s.calculated_xp||0)+(s.referral_xp||0):0,[s]),je=m.useMemo(()=>s?s.overall_pos_value??s.total_volume??0:0,[s]),Ie=m.useMemo(()=>s?s.rank_position??s.ranking??"Unranked":"Unranked",[s]),Re=m.useMemo(()=>c==="volume"?t:n,[c,t,n]),Qe=m.useMemo(()=>Math.ceil(Re.length/P),[Re.length,P]),Ke=Re.length;m.useEffect(()=>{N(1)},[c]);const dt=m.useCallback(Be=>{Be>=1&&Be<=Qe&&(N(Be),window.scrollTo({top:0,behavior:"smooth"}))},[Qe]),tt=Ce?`Here’s my @Dextrabot rank #${me}. Volume (All Time): $${_r(we)} · XP: ${_r(xe)}. Farming points and stacking profit at the same time.`:"Here’s my @Dextrabot rank. Farming points and stacking profit at the same time.",nt=se||"https://app.dextrabot.com/leaderboard",Le=`https://x.com/intent/post?text=${encodeURIComponent(tt)}&url=${encodeURIComponent(nt)}`;return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("meta",{name:"description",content:"See the top traders on DextraBot ranked by trading volume. Track the best-performing users and find inspiration for your next trade."}),i.jsx("meta",{name:"og:title",content:"Top Traders Leaderboard – Track the Best Performers on DextraBot"}),i.jsx("meta",{name:"og:description",content:"See the top traders on DextraBot ranked by trading volume. Track the best-performing users and find inspiration for your next trade."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/leaderboard"})]})}),i.jsxs("div",{className:"min-h-screen bg-black relative overflow-hidden",children:[i.jsx("div",{className:"absolute top-0 right-0 w-[1200px] h-full pointer-events-none hidden lg:block bg-contain bg-right-top bg-no-repeat z-[1]",style:{backgroundImage:`url(${Icn})`}}),i.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-4 sm:px-6 py-8 sm:py-16",children:[i.jsx("div",{className:"mb-6 sm:mb-10 pl-0 pr-4 sm:pr-16 py-6 sm:py-12 leaderboard-card rounded-2xl",children:i.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center lg:justify-between gap-6 lg:gap-12",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6 sm:gap-8 lg:gap-32",children:[i.jsx("div",{className:"flex-shrink-0",children:J&&ne?i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"text-white text-xs sm:text-sm",children:"Connected"}),i.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"})]}),i.jsx("div",{className:"text-white font-mono text-sm sm:text-lg font-bold",children:KB(J)})]}):i.jsx("button",{onClick:fe,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-2xl font-semibold transition-colors text-sm h-10 w-full sm:w-auto",children:"Connect Wallet"})}),i.jsxs("div",{className:"grid grid-cols-3 sm:flex sm:items-center gap-4 sm:gap-8 lg:gap-32",children:[i.jsxs("div",{className:"flex-shrink-0",children:[i.jsx("div",{className:"text-gray-400 text-xs sm:text-sm mb-1",children:"XP"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-white font-bold text-sm sm:text-lg",children:y&&J&&ne?"...":J&&ne&&s?_r(be):"0"}),i.jsx(Fcn,{className:"w-4 h-4 sm:w-5 sm:h-5"})]})]}),i.jsxs("div",{className:"flex-shrink-0",children:[i.jsx("div",{className:"text-gray-400 text-xs sm:text-sm mb-1",children:"Volume"}),i.jsxs("div",{className:"text-white font-bold text-sm sm:text-lg",children:["$",y&&J&&ne?"...":J&&ne&&s?_r(je):"0"]})]}),i.jsxs("div",{className:"flex-shrink-0",children:[i.jsx("div",{className:"text-gray-400 text-xs sm:text-sm mb-1",children:"#"}),i.jsx("div",{className:"text-white font-bold text-sm sm:text-lg",children:y&&J&&ne?"...":J&&ne&&s?Ie:"Unranked"})]})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-4 sm:gap-6",children:[i.jsxs("button",{onClick:W,className:"flex items-center justify-center gap-2 bg-white hover:bg-gray-100 text-black px-3 py-2 rounded-2xl font-semibold transition-colors text-sm border border-gray-300 h-10 w-full sm:w-auto whitespace-nowrap",children:[i.jsx("span",{className:"text-black",children:"𝕏"}),i.jsx("span",{className:"hidden sm:inline",children:"Share your rank"}),i.jsx("span",{className:"sm:hidden",children:"Share"}),i.jsxs("span",{className:"bg-black text-white text-xs px-2 py-1 rounded-lg flex items-center gap-1",children:[i.jsx("span",{children:"200"}),i.jsx(Ocn,{className:"w-3 h-3"})]})]}),i.jsx("button",{onClick:ae,className:"flex items-center justify-center text-black px-4 py-2 rounded-2xl font-semibold transition-colors text-sm h-10 w-full sm:w-20 bg-[#1DE674]",children:"Invite"})]})]})}),i.jsxs("div",{className:"mb-8 sm:mb-12",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 sm:gap-6 mt-12 sm:mt-16 mb-0",children:[i.jsx("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold text-white",children:"Leaderboard"}),Re.length>0&&i.jsxs("div",{className:"flex flex-col sm:flex-row items-end sm:items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[12px] font-semibold",children:[i.jsx(ji,{className:"text-white hidden sm:block"}),i.jsx("span",{className:"text-white",children:Ke}),i.jsx("span",{className:"text-white",children:"wallets found"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>dt(C-1),disabled:C===1,className:`${C===1?"cursor-not-allowed text-white/30":"text-white hover:bg-white/40"} relative inline-flex items-center justify-center p-1.5 rounded-md bg-[#3d3d3d] w-7 h-7`,children:i.jsx(ld,{className:`w-3 h-3 rotate-90 ${C===1?"text-white/30":"text-white"}`})}),i.jsxs("div",{className:"px-3 py-1 rounded-md bg-[#3d3d3d]/60 text-sm font-medium text-white min-w-max h-7 flex items-center",children:[C," / ",Math.max(Qe,1)]}),i.jsx("button",{onClick:()=>dt(C+1),disabled:C===Qe||Qe===0,className:`${C===Qe||Qe===0?"cursor-not-allowed text-white/30":"text-white hover:bg-white/40"} relative inline-flex items-center justify-center p-1.5 rounded-md bg-[#3d3d3d] w-7 h-7`,children:i.jsx(ld,{className:`w-3 h-3 -rotate-90 ${C===Qe||Qe===0?"text-white/30":"text-white"}`})})]})]})]}),i.jsx("div",{className:"leaderboard-card rounded-2xl overflow-hidden mt-4 sm:mt-6",children:c==="volume"?i.jsx(Tcn,{volumeLeaderboardData:t,userData:s,currentPage:C,rowsPerPage:P}):c==="pnl"?i.jsx(Pcn,{pnlLeaderboardData:n,userData:o,currentPage:C,rowsPerPage:P}):i.jsx(i.Fragment,{})})]})]})]}),i.jsx(yp,{isOpen:d,onClose:()=>f(!1),blurBackground:!0,children:i.jsxs("div",{className:"w-[320px] sm:w-[420px] bg-[#1c1c1c] rounded-3xl p-6 text-white",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("p",{className:"text-sm uppercase tracking-widest text-green-300/80 mb-2",children:"Invite friends"}),i.jsx("h3",{className:"text-2xl font-semibold mb-2",children:"Share your referral"}),i.jsx("p",{className:"text-sm text-white/70",children:"You can send your code or unique link."})]}),q?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-[#262626] rounded-2xl p-4 flex items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-white/60 mb-1",children:"Your Referral Code"}),i.jsx("p",{className:"text-lg font-semibold",children:q})]}),i.jsx("button",{className:"p-2 rounded-xl border border-white/10 transition hover:bg-white/10",onClick:()=>V(q),children:i.jsx("img",{src:WM,alt:"Copy referral code",className:"w-4 h-4"})})]}),i.jsxs("div",{className:"bg-[#262626] rounded-2xl p-4 flex items-center justify-between gap-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xs text-white/60 mb-1",children:"Your Referral URL"}),i.jsx("p",{className:"text-sm text-green-300 truncate",children:se})]}),i.jsx("button",{className:"p-2 rounded-xl border border-white/10 transition hover:bg-white/10",onClick:()=>V(se),children:i.jsx("img",{src:WM,alt:"Copy referral url",className:"w-4 h-4"})})]})]}):null,!q&&i.jsxs("div",{className:"text-xs text-white/50 mt-4",children:["You can create your referral code on the"," ",i.jsx("a",{href:"/referral",className:"text-green-300 hover:text-green-200 underline",children:"Referral page"}),"."]})]})}),i.jsx(yp,{isOpen:x,onClose:()=>g(!1),blurBackground:!0,children:i.jsxs("div",{className:"w-[340px] sm:w-[460px] bg-[#101010] rounded-3xl p-6 text-white",children:[i.jsxs("div",{ref:T,className:"bg-gradient-to-b from-[#0c1414] via-[#040707] to-[#040505] rounded-[32px] border border-emerald-500/10 p-5 shadow-[0_0_60px_rgba(0,255,200,0.08)]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("div",{children:i.jsx("p",{className:"text-sm uppercase tracking-[0.3em] text-white/70",children:"Leaderboard"})}),i.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 rounded-full bg-white/5 border border-white/10",children:[i.jsx("img",{src:WA,alt:"Dextrabot",className:"w-5 h-5 rounded-full"}),i.jsx("span",{className:"text-xs font-semibold tracking-wide",children:"DEXTRABOT"})]})]}),i.jsxs("div",{className:"mt-5 bg-[#05090a] rounded-3xl p-5 text-center border border-white/5",children:[i.jsx("p",{className:"text-xs uppercase tracking-[0.4em] text-white/50",children:"Rank"}),i.jsx("p",{className:"text-4xl font-bold text-[#67FFBD] mt-2",children:(Ce==null?void 0:Ce.ranking)??"--"}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-6 text-left",children:[i.jsxs("div",{className:"bg-white/3 rounded-2xl p-3 border border-white/5",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-wide text-white/50",children:"Volume (All Time)"}),i.jsxs("p",{className:"text-lg font-semibold text-white mt-1",children:["$",_r((Ce==null?void 0:Ce.overall_pos_value)??(Ce==null?void 0:Ce.total_volume)??0)]})]}),i.jsxs("div",{className:"bg-white/3 rounded-2xl p-3 border border-white/5",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-wide text-white/50",children:"XP"}),i.jsx("p",{className:"text-lg font-semibold text-white mt-1",children:_r((Ce==null?void 0:Ce.calculated_xp)??(Ce==null?void 0:Ce.total_xp)??0)})]})]})]}),i.jsxs("div",{className:"mt-4 flex items-center justify-between text-[11px] text-white/50",children:[i.jsx("span",{children:"Generated by Dextrabot"}),i.jsx("span",{children:new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]}),!Ce&&i.jsx("p",{className:"text-xs text-white/60 mt-4",children:"Connect your wallet and climb the leaderboard to unlock personalized stats."}),i.jsxs("div",{className:"mt-6 space-y-3",children:[i.jsx("button",{onClick:ee,className:"w-full border border-emerald-400/60 rounded-2xl py-3 text-emerald-300 font-semibold hover:bg-emerald-400/10 transition disabled:opacity-40 disabled:cursor-not-allowed",disabled:!Ce,children:"Download image"}),i.jsx("a",{href:Le,target:"_blank",rel:"noopener noreferrer",className:"w-full block text-center bg-white text-black font-semibold rounded-2xl py-3 hover:bg-gray-100 transition",children:"Share on X"})]})]})})]})};function Rcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const Lcn=m.forwardRef(Rcn);function Dcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}const Bcn=m.forwardRef(Dcn);function $cn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"}))}const Ucn=m.forwardRef($cn);function zcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const H9=m.forwardRef(zcn);function Hcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const Vcn=m.forwardRef(Hcn);function Wcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const tQ=m.forwardRef(Wcn);function qcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Gcn=m.forwardRef(qcn);function Kcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const LVe=m.forwardRef(Kcn);function Ycn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const Xcn=m.forwardRef(Ycn);function Qcn({title:t,titleId:e,...n},r){return m.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?m.createElement("title",{id:e},t):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const bde=m.forwardRef(Qcn),fSe=[{name:"Blog",key:"blog",href:"https://blog.dextrabot.com/"},{name:"Features",key:"features",href:"/#features"},{name:"How it works?",key:"howItWorks",href:"/#howitworks"},{name:"FAQ",key:"faq",href:"/#faq"},{name:"Launch",key:"launchApp",href:"/hyperliquid-fee-calculator"}];function Zcn(...t){return t.filter(Boolean).join(" ")}const yde=({scrollToFeatures:t,scrollToHowItWorks:e,scrollToFAQ:n})=>i.jsxs(K7e,{as:"nav",className:"bg-transparent lg:pt-[24px]",children:[i.jsx("div",{className:"mx-auto max-w-7xl px-2 sm:px-0",children:i.jsxs("div",{className:"relative flex h-16 items-center justify-between",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-1 sm:pr-0",children:i.jsx(MB,{as:"div",className:"relative ml-1",children:i.jsxs("div",{onClick:()=>{window.location.href="/"},className:"flex justify-start items-center gap-4 cursor-pointer",children:[i.jsx("img",{src:Ult,alt:"Dextrabot",className:"w-12 h-12"}),i.jsx("div",{className:"justify-start text-white text-2xl font-semibold font-['Manrope'] leading-[21px]",children:"Dextrabot"})]})})}),i.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center sm:hidden",children:i.jsxs(Eie,{className:"group relative inline-flex items-center justify-center rounded-md p-2 text-gray-400 bg-[#1e1e1e] hover:bg-[#353535] hover:text-white focus:outline-none focus:ring-0 border-none",children:[i.jsx("span",{className:"absolute -inset-0.5"}),i.jsx("span",{className:"sr-only",children:"Open main menu"}),i.jsx(Ucn,{"aria-hidden":"true",className:"block size-6 group-data-[open]:hidden"}),i.jsx(bde,{"aria-hidden":"true",className:"hidden size-6 group-data-[open]:block"})]})}),i.jsx("div",{className:"flex flex-1 items-center justify-center sm:items-stretch sm:justify-end",children:i.jsx("div",{className:"hidden sm:ml-6 sm:block mr-2",children:i.jsx("div",{className:"flex items-center space-x-6",children:fSe.map(r=>i.jsx("a",{href:r.href||"#",onClick:s=>{r.href||s.preventDefault(),r.key==="features"&&(t==null||t()),r.key==="howItWorks"&&(e==null||e()),r.key==="faq"&&(n==null||n())},className:Zcn(r.current?"bg-transparent text-white":`${r.name==="Launch"?"text-[#121213] hover:text-[#121213] hover:scale-105 transition-transform duration-300":"text-white/50 hover:text-white"}`,"",r.name==="Launch"?"w-24 h-10 px-12 py-3 bg-white rounded-[256px] inline-flex justify-center items-center gap-2.5 text-[#121213] text-sm font-semibold font-manrope leading-8":"rounded-md text-sm font-semibold font-manrope leading-8 h-8"),children:r.name},r.name))})})})]})}),i.jsx(_ie,{className:"sm:hidden",children:i.jsx("div",{className:"space-y-1 px-2 pb-3 pt-2",children:fSe.map(r=>r.key==="launchApp"?i.jsx("a",{href:r.href,className:"block rounded-md px-3 py-2 text-base font-medium text-white hover:text-white bg-[#1a1a1a] hover:bg-[#353535]",children:r.name},r.name):i.jsx("button",{onClick:async()=>{r.key==="features"&&(t==null||t()),r.key==="howItWorks"&&(e==null||e()),r.key==="faq"&&(n==null||n())},className:"w-full text-left block rounded-md px-3 py-2 text-base font-medium text-white/50 bg-transparent hover:bg-[#353535] hover:text-white focus:outline-none focus:ring-0 border-none",children:r.name},r.name))})})]}),Jcn=()=>{const[t,e]=m.useState("");return i.jsx("section",{className:"px-1 py-5 sm:py-[64px] text-center",children:i.jsx("div",{className:"max-w-7xl mx-auto",children:i.jsx("div",{className:"flex flex-col items-center gap-[88px]",children:i.jsxs("div",{className:"flex flex-col lg:flex-row items-center lg:items-start gap-6",children:[i.jsx("div",{className:"w-full lg:flex-[0.45] flex justify-center lg:justify-start",children:i.jsx("div",{className:"bg-transparent p-1 rounded-xl h-full",children:i.jsxs("div",{className:"flex flex-col items-start gap-4",children:[i.jsx("h1",{className:"max-w-[553px] w-full lg:w-[553px] justify-start text-white text-[36px] sm:text-[56px] font-semibold font-['Manrope'] leading-[42px] sm:leading-[64px] text-left",children:"Dextrabot - Find and Copy Trade Top Hyperliquid Wallets"}),i.jsx("div",{className:"max-w-[512px] justify-start text-[#aaaaaa] text-base font-medium font-['Manrope'] leading-[21px] tracking-tight text-left",children:"Discover profitable traders, analyze their performance, and automatically copy their strategies with customizable risk settings."}),i.jsxs("div",{className:"flex flex-col sm:flex-row justify-start items-center gap-4 sm:gap-6 pt-[22px] w-full",children:[i.jsx("div",{onClick:()=>{window.location.href="/discover-wallets"},className:"w-full sm:w-auto sm:before:max-w-[200px] h-12 px-2 sm:px-6 py-1 sm:py-3 bg-[#67ffbd] rounded-[256px] flex justify-center items-center cursor-pointer hover:scale-105 transition-transform duration-300",children:i.jsx("span",{className:"text-[#103324] text-lg font-semibold font-['Manrope'] leading-6 min-w-max",children:"Start Copy Trade"})}),i.jsx("div",{onClick:()=>{window.location.href="/discover-wallets"},className:"w-full sm:w-auto sm:max-w-[200px] h-12 px-2 sm:px-6 py-1 sm:py-3 bg-[#1e1e1e] rounded-[256px] flex justify-center items-center cursor-pointer hover:scale-105 transition-transform duration-300",children:i.jsx("span",{className:"text-white text-lg font-semibold font-['Manrope'] leading-6 min-w-max ",children:"Discover Wallets"})})]}),i.jsx("div",{className:"w-full",children:i.jsxs("div",{className:"w-full sm:w-[424px] h-12 px-4 py-3 bg-[#1e1e1e] rounded-[256px] flex items-center gap-2.5 relative mt-2",children:[i.jsx(zy,{className:"text-white"}),i.jsx("input",{type:"text",value:t,onChange:n=>e(n.target.value),placeholder:"Track and Analyze Wallet",className:"flex bg-transparent outline-none border-none text-[#cfcfcf] placeholder-[#636363] text-lg font-normal font-['Manrope'] leading-[21px] pr-10 w-full sm:w-[424px]"}),i.jsx("div",{onClick:n=>{if(n.preventDefault(),!t)tn.error("Please enter a wallet address");else if(t.match(/^0x[a-fA-F0-9]{40}$/))window.open(`/wallet-details/${t}`,"_blank"),setTimeout(()=>{e("")},200);else{tn.error("Please enter a valid Ethereum address");return}},className:"w-10 h-10 bg-[#67ffbd]/20 rounded-[256px] inline-flex justify-center items-center absolute right-1 hover:scale-105 transition-transform duration-300 cursor-pointer",children:i.jsx("img",{src:$lt,alt:"search",className:"w-6 h-6 min-w-6 min-h-6"})})]})})]})})}),i.jsx("div",{className:"w-full lg:flex-[0.55]",children:i.jsx("div",{className:"bg-transparent rounded-xl shadow-lg h-full",children:i.jsx("div",{className:"w-full",children:i.jsx("img",{src:Plt,alt:"Copy trade Hyperliquid wallets with Dextrabot platform and customizable risk settings",className:"w-full h-auto max-w-[728px] mx-auto"})})})})]})})})})},eun=()=>i.jsx("section",{className:"py-16 bg-transparent",children:i.jsxs("div",{className:"max-w-7xl mx-auto",children:[i.jsx("h2",{className:"text-center justify-start text-white text-[40px] font-semibold font-['Manrope'] leading-[48px] mb-10",children:"Dextrabot Features"}),i.jsxs("div",{className:"flex flex-wrap xl:flex-nowrap justify-center gap-4",children:[i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-wrap md:flex-nowrap justify-center md:justify-start gap-4",children:[i.jsx(N7,{title:"Copy Trade",description:"Automatically copy trade perpetual positions with customizable risk parameters",altInfo:"Automated copy trading perpetual positions on Hyperliquid with customizable risk parameters",icon:Ilt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 left-0"}),i.jsx(N7,{title:"Discover Wallets",description:"Find overlooked high-performers on Hyperliquid with advanced filtering",altInfo:"Find high-performing wallets on Hyperliquid with advanced filtering and wallet discovery",icon:Olt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute -bottom-2"})]}),i.jsxs("div",{className:"flex flex-wrap md:flex-nowrap justify-center md:justify-start gap-4",children:[i.jsx(N7,{title:"Real-Time Alerts",description:"Get instant Telegram notifications for all trading activities",altInfo:"Real-time Telegram notifications for all Hyperliquid trading activities and copy trades",icon:Mlt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-[20px] w-[294px] h-[204px]"}),i.jsx(N7,{title:"Referrals",description:"Earn up to 65% reward through our multi-level program",altInfo:"Earn up to 65% rewards through Dextrabot's multi-level referral program for crypto traders",icon:Flt,cssInfo:"w-[348px] h-[348px]",imgCss:"absolute bottom-0 -left-1"})]})]}),i.jsx(N7,{title:"Analyze Wallet",description:"Track performance metrics, open positions, and trading patterns",icon:Rlt,altInfo:"Track performance metrics, open positions, and trading patterns of top Hyperliquid wallets",cssInfo:"max-w-full md:w-[720px] xl:w-[552px] h-[500px] md:h-[916px] xl:h-[716px] bg-[#161616] rounded-3xl p-6 text-white flex-shrink-0 relative overflow-hidden hover:scale-105 transition-transform duration-300",imgCss:"absolute bottom-0 left-6"})]})]})}),N7=({title:t,description:e,altInfo:n,icon:r,cssInfo:s,imgCss:a})=>i.jsxs("div",{className:`${s} bg-[#161616] rounded-3xl p-6 text-white relative overflow-hidden hover:scale-105 transition-transform duration-300`,children:[i.jsx("div",{className:"text-start justify-start text-white text-[21px] font-semibold font-['Manrope'] leading-normal mb-1",children:t}),i.jsx("div",{className:"w-[290px] justify-start text-[#979797] text-sm font-medium font-['Manrope'] leading-[21px]",children:e}),i.jsx("img",{src:r,alt:n,className:a})]}),tun=()=>i.jsx("section",{className:"py-16 bg-transparent",children:i.jsxs("div",{className:"max-w-7xl mx-auto",children:[i.jsx("h2",{className:"text-center justify-start text-white text-[40px] font-semibold font-['Manrope'] leading-[48px] mb-10",children:"Three Simple Steps to Start Copy Trade"}),i.jsxs("div",{className:"flex flex-wrap xl:flex-nowrap justify-center gap-4",children:[i.jsx(nQ,{title:"Discover",description:"Find profitable wallets using our advanced filters",icon:Llt,altInfo:"Discover profitable Hyperliquid wallets using Dextrabot's advanced filtering system"}),i.jsx(nQ,{title:"Analyze",description:"Examine detailed metrics and trading patterns",icon:Dlt,altInfo:"Examine detailed PnL metrics and win rate statistics for Hyperliquid trading strategies"}),i.jsx(nQ,{title:"Copy Trade",description:"Set your risk parameters and start automating",icon:Blt,altInfo:"Set custom take profit and stop loss parameters for automated copy trading on Hyperliquid"})]})]})}),nQ=({title:t,description:e,altInfo:n,icon:r,imgCss:s})=>i.jsxs("div",{className:"w-[348px] xl:w-[416px] h-[348px] bg-[#161616] rounded-3xl p-6 text-white relative overflow-hidden hover:scale-105 transition-transform duration-300",children:[i.jsx("div",{className:"text-start justify-start text-white text-[21px] font-semibold font-['Manrope'] leading-normal mb-1",children:t}),i.jsx("div",{className:"w-[290px] justify-start text-[#979797] text-sm font-medium font-['Manrope'] leading-[21px]",children:e}),i.jsx("img",{src:r,alt:n,className:"absolute bottom-[12px] left-1/2 transform -translate-x-1/2 w-[314px] xl:w-[382px]"})]}),hSe=({className:t})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:t,children:i.jsx("path",{d:"M16.6004 7.45831L11.1671 12.8916C10.5254 13.5333 9.47539 13.5333 8.83372 12.8916L3.40039 7.45831",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})}),nun=()=>{const t=[{question:"How does copy trade work on Dextrabot?",answer:"Dextrabot monitors wallet activity and automatically executes the same perpetual positions in your account based on your risk settings."},{question:"What fees does Dextrabot charge?",answer:"Dextrabot charges 0.055% on trade size for copy trade transactions. Use a referral code for a 4% discount."},{question:"How do I set up Telegram notifications?",answer:"Connect your Telegram account through the Tracker page to receive instant alerts about wallet activities and copy trades."},{question:"What risk management options are available?",answer:"Dextrabot offers customizable stop-loss and take-profit levels, position size limits, and margin increase controls for comprehensive risk management."},{question:" How does the referral program work?",answer:"You can earn up to 65% reward on the fees generated by traders you refer to Dextrabot, with multi-tier commissions coming soon."},{question:"Can I copy multiple wallets simultaneously?",answer:"Yes, you can copy trade multiple wallets at once, each with their own customized risk parameters and position sizing."}];return i.jsx("section",{className:"py-16 bg-transparent",children:i.jsxs("div",{className:"max-w-7xl mx-auto",children:[i.jsx("div",{className:"text-center justify-start text-white text-[40px] font-semibold font-['Manrope'] leading-[48px] mb-[18px]",children:"FAQ"}),i.jsx("h2",{className:"w-full text-center justify-center text-white/60 text-lg font-semibold font-['Manrope'] leading-normal",children:"Frequently Asked Questions"}),i.jsx("dl",{className:"mt-[41px] divide-y divide-gray-900/10 border-none outline-none w-full lg:w-[777px] mx-auto",children:t.map(e=>i.jsx(K7e,{as:"div",className:"my-4 first:pt-0 last:pb-0 rounded-2xl bg-[#161616]",children:i.jsxs("dt",{children:[i.jsxs(Eie,{className:"group flex w-full items-start justify-start text-left text-white gap-4 border-none bg-transparent focus:outline-none focus:ring-0 first:pt-4 last:pb-4",children:[i.jsxs("span",{className:"ml-1 flex h-7 items-center",children:[i.jsx(hSe,{"aria-hidden":"true",className:"size-6 group-data-[open]:hidden"}),i.jsx(hSe,{"aria-hidden":"true",className:"size-6 rotate-180 group-[&:not([data-open])]:hidden"})]}),i.jsx("span",{className:"text-start justify-start text-white text-base font-semibold font-['Manrope'] leading-normal",children:e.question})]}),i.jsx(_ie,{as:"dd",className:"pr-12 ml-[64px] pb-4 -mt-2",children:i.jsx("p",{className:"w-full lg:w-[683px] justify-start text-[#cfcfcf] text-sm font-medium font-['Manrope'] leading-normal",children:e.answer})})]})},e.question))})]})})},run=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:t,children:[i.jsx("g",{clipPath:"url(#clip0_235_3767)",children:i.jsx("path",{d:"M8.99969 0.180054C4.12852 0.180054 0.179688 4.12889 0.179688 9.00005C0.179688 13.8712 4.12852 17.8201 8.99969 17.8201C13.8709 17.8201 17.8197 13.8712 17.8197 9.00005C17.8197 4.12889 13.8709 0.180054 8.99969 0.180054ZM13.0879 6.17836C12.9552 7.57303 12.3808 10.9575 12.0885 12.5195C11.9649 13.1804 11.7214 13.4021 11.4858 13.4237C10.9737 13.4709 10.5847 13.0853 10.0886 12.7601C9.3123 12.2512 8.87375 11.9344 8.12021 11.4379C7.24942 10.8641 7.81393 10.5488 8.3102 10.0331C8.44008 9.8982 10.6968 7.84552 10.7405 7.65931C10.7459 7.63601 10.7512 7.54906 10.6995 7.50339C10.6477 7.45773 10.5718 7.4732 10.5168 7.48561C10.439 7.5033 9.19888 8.32296 6.7965 9.94461C6.44453 10.1863 6.12571 10.3041 5.84003 10.2979C5.52511 10.2911 4.91933 10.1199 4.46898 9.97345C3.91663 9.79393 3.47762 9.699 3.51585 9.39407C3.53577 9.23522 3.75449 9.07281 4.17202 8.90684C6.74324 7.7866 8.45778 7.04805 9.31564 6.69117C11.765 5.67235 12.274 5.49538 12.6058 5.48948C12.6787 5.48827 12.8419 5.50634 12.9475 5.59208C13.0178 5.65316 13.0626 5.7384 13.0731 5.83094C13.091 5.94583 13.0959 6.06236 13.0879 6.17836Z",fill:"currentColor"})}),i.jsx("defs",{children:i.jsx("clipPath",{id:"clip0_235_3767",children:i.jsx("rect",{width:"18",height:"18",fill:"currentColor"})})})]}),sun=({className:t})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:t,children:[i.jsx("g",{clipPath:"url(#clip0_235_3764)",children:i.jsx("path",{d:"M11.0256 0.672607H13.1722L8.48225 6.03344L14 13.3269H9.67983L6.2965 8.90286L2.42433 13.3269H0.2765L5.29317 7.59269L0 0.673191H4.42983L7.48825 4.71686L11.0256 0.672607ZM10.2725 12.0424H11.4619L3.7835 1.89002H2.50717L10.2725 12.0424Z",fill:"currentColor"})}),i.jsx("defs",{children:i.jsx("clipPath",{id:"clip0_235_3764",children:i.jsx("rect",{width:"14",height:"14",fill:"currentColor"})})})]}),iun=({className:t})=>i.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:i.jsx("path",{d:"M16.9419 3.52317C15.6473 2.91744 14.263 2.47723 12.8157 2.22656C12.638 2.5479 12.4304 2.98012 12.2872 3.32394C10.7487 3.09258 9.22445 3.09258 7.7143 3.32394C7.57116 2.98012 7.3588 2.5479 7.17947 2.22656C5.73067 2.47723 4.3448 2.91906 3.05016 3.52638C0.438869 7.47238 -0.269009 11.3204 0.0849305 15.1137C1.81688 16.4071 3.49534 17.1928 5.14548 17.7069C5.55291 17.1462 5.91628 16.5501 6.22931 15.9219C5.63313 15.6954 5.06211 15.4158 4.52256 15.0912C4.6657 14.9852 4.80571 14.8743 4.94098 14.7603C8.23183 16.2995 11.8074 16.2995 15.0589 14.7603C15.1958 14.8743 15.3358 14.9852 15.4774 15.0912C14.9362 15.4174 14.3637 15.6969 13.7675 15.9235C14.0805 16.5501 14.4423 17.1478 14.8513 17.7085C16.503 17.1944 18.183 16.4087 19.915 15.1137C20.3303 10.7163 19.2056 6.90361 16.9419 3.52317ZM6.67765 12.7809C5.68977 12.7809 4.87963 11.8586 4.87963 10.7355C4.87963 9.61247 5.67247 8.68864 6.67765 8.68864C7.68285 8.68864 8.49297 9.61086 8.47567 10.7355C8.47723 11.8586 7.68285 12.7809 6.67765 12.7809ZM13.3223 12.7809C12.3344 12.7809 11.5243 11.8586 11.5243 10.7355C11.5243 9.61247 12.3171 8.68864 13.3223 8.68864C14.3275 8.68864 15.1376 9.61086 15.1203 10.7355C15.1203 11.8586 14.3275 12.7809 13.3223 12.7809Z",fill:"currentColor"})}),vde=()=>i.jsxs("footer",{className:"bg-[#121213] pt-12 pb-28 sm:pt-6 sm:pb-6 text-center text-sm text-gray-400",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-center items-center gap-[32px] relative",children:[i.jsx("div",{onClick:()=>window.location.href="https://blog.dextrabot.com/",className:"text-center justify-start text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal cursor-pointer",children:"Blog"}),i.jsx("div",{onClick:()=>window.location.href="/sitemap",className:"text-center justify-start text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal cursor-pointer",children:"Sitemap"}),i.jsx("div",{onClick:()=>window.location.href="/videos",className:"text-center justify-start text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal cursor-pointer",children:"Videos"}),i.jsx("div",{onClick:()=>window.open("https://docs.dextrabot.com/","_blank"),className:"text-center justify-start text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal cursor-pointer",children:"Documentation"}),i.jsx("div",{onClick:()=>window.open("https://docs.dextrabot.com/faq-and-official-links/risk-disclaimer","_blank"),className:"text-center justify-start text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal cursor-pointer",children:"Risk Disclaimer"}),i.jsxs("div",{className:"flex justify-center sm:justify-start items-center gap-4",children:[i.jsx("div",{onClick:()=>{window.open("https://x.com/dextrabot","_blank")},className:"rounded-full cursor-pointer p-[1px]",children:i.jsx(sun,{className:"text-[#696969] hover:text-white"})}),i.jsx("div",{onClick:()=>{window.open("https://discord.gg/dextrabot","_blank")},className:"rounded-full cursor-pointer p-[1px]",children:i.jsx(iun,{className:"text-[#696969] hover:text-white"})}),i.jsx("div",{onClick:()=>{window.open("https://t.me/Dextrabot_Official","_blank")},className:"rounded-full cursor-pointer p-[1px]",children:i.jsx(run,{className:"text-[#696969] hover:text-white"})})]}),i.jsxs("div",{className:"hidden xl:flex absolute right-2 justify-end items-center text-center text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal",children:["© ",new Date().getFullYear()," Dextrabot. All rights reserved."]})]}),i.jsxs("div",{className:"block xl:hidden text-center text-[#696969] hover:text-white text-[13px] font-semibold font-['Manrope'] leading-normal mt-6",children:["© ",new Date().getFullYear()," Dextrabot. All rights reserved."]})]}),aun=()=>{const t=m.useRef(null),e=m.useRef(null),n=m.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("meta",{name:"description",content:"Find high-performing Hyperliquid wallets, analyze their trading patterns, and automatically copy their strategies with custom risk settings. Real-time alerts via Telegram."}),i.jsx("meta",{name:"og:title",content:"Dextrabot | Discover and Copy Trade Top Hyperliquid Wallets"}),i.jsx("meta",{name:"og:description",content:"Find high-performing Hyperliquid wallets, analyze their trading patterns, and automatically copy their strategies with custom risk settings. Real-time alerts via Telegram."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/"}),i.jsx("link",{rel:"canonical",href:"https://app.dextrabot.com/"}),i.jsx("meta",{name:"theme-color",content:"#121213"}),i.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://app.dextrabot.com/#organization",name:"Dextrabot",url:"https://app.dextrabot.com/",logo:{"@type":"ImageObject","@id":"https://app.dextrabot.com/#logo",url:"https://app.dextrabot.com/assets/dextrabotIcon-B5aLRkPC.png",width:192,height:192,caption:"Dextrabot - Copy Trade on Hyperliquid"},sameAs:["https://x.com/dextrabot","https://discord.gg/dextrabot"]},{"@type":"WebSite","@id":"https://app.dextrabot.com/#website",url:"https://app.dextrabot.com/",name:"Dextrabot",description:"Find profitable Hyperliquid traders, analyze their strategies, and automatically copy their trades. Real-time alerts and advanced analytics for Hyperliquid.",publisher:{"@id":"https://app.dextrabot.com/#organization"},potentialAction:{"@type":"SearchAction",target:"https://app.dextrabot.com/wallet-details/{search_term_string}","query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://app.dextrabot.com/#webpage",url:"https://app.dextrabot.com/",name:"Discover, Analyze & Copy Trade Top Traders on Hyperliquid | Dextrabot",isPartOf:{"@id":"https://app.dextrabot.com/#website"},about:{"@id":"https://app.dextrabot.com/#organization"},description:"Find profitable Hyperliquid traders, analyze their strategies, and automatically copy their trades with customizable risk parameters.",inLanguage:"en-US"},{"@type":"SoftwareApplication","@id":"https://app.dextrabot.com/#softwareapplication",name:"Dextrabot",operatingSystem:"Web",applicationCategory:"DeFiApplication",offers:{"@type":"Offer",price:"0.055",priceCurrency:"USDC",priceSpecification:{"@type":"UnitPriceSpecification",price:"0.055",priceCurrency:"USDC",unitCode:"PERCENT",description:"0.055% fee for every copy trade transaction"}},featureList:["Copy Trade","Wallet Discovery","Performance Analytics","Real-time Alerts","Telegram Notifications"]},{"@type":"FAQPage","@id":"https://app.dextrabot.com/#faqpage",mainEntity:[{"@type":"Question",name:"How does copy trade work on Dextrabot?",acceptedAnswer:{"@type":"Answer",text:"Dextrabot monitors wallet activity and automatically executes the same perpetual positions in your account based on your risk settings."}},{"@type":"Question",name:"What fees does Dextrabot charge?",acceptedAnswer:{"@type":"Answer",text:"Dextrabot charges 0.055% on trade size for copy trade transactions. Use a referral code for a 4% discount."}},{"@type":"Question",name:"How do I set up Telegram notifications?",acceptedAnswer:{"@type":"Answer",text:"Connect your Telegram account through the Tracker page to receive instant alerts about wallet activities and copy trades."}},{"@type":"Question",name:"What risk management options are available?",acceptedAnswer:{"@type":"Answer",text:"Dextrabot offers customizable stop-loss and take-profit levels, position size limits, and margin increase controls for comprehensive risk management."}},{"@type":"Question",name:"How does the referral program work?",acceptedAnswer:{"@type":"Answer",text:"You can earn up to 65% reward on the fees generated by traders you refer to Dextrabot, with multi-tier commissions coming soon."}},{"@type":"Question",name:"Can I copy multiple wallets simultaneously?",acceptedAnswer:{"@type":"Answer",text:"Yes, you can copy trade multiple wallets at once, each with their own customized risk parameters and position sizing."}}]}]})})]})}),i.jsxs("div",{className:"bg-[#121213] p-4 w-screen h-screen overflow-x-hidden overflow-y-auto relative z-50",children:[i.jsx("div",{className:"landing-green-background-landing h-full w-full absolute -z-10 top-0"}),i.jsx(yde,{scrollToFeatures:()=>{var r;return(r=t.current)==null?void 0:r.scrollIntoView({behavior:"smooth"})},scrollToHowItWorks:()=>{var r;return(r=e.current)==null?void 0:r.scrollIntoView({behavior:"smooth"})},scrollToFAQ:()=>{var r;return(r=n.current)==null?void 0:r.scrollIntoView({behavior:"smooth"})}}),i.jsx(Jcn,{}),i.jsx("div",{ref:t,children:i.jsx(eun,{})}),i.jsx("div",{ref:e,children:i.jsx(tun,{})}),i.jsx("div",{ref:n,children:i.jsx(nun,{})}),i.jsx(vde,{})]})]})};var sg={},pSe;function oun(){if(pSe)return sg;pSe=1;var t=sg.__assign||function(){return t=Object.assign||function(d){for(var f,x=1,g=arguments.length;x<g;x++){f=arguments[x];for(var y in f)Object.prototype.hasOwnProperty.call(f,y)&&(d[y]=f[y])}return d},t.apply(this,arguments)},e=sg.__createBinding||(Object.create?function(d,f,x,g){g===void 0&&(g=x);var y=Object.getOwnPropertyDescriptor(f,x);(!y||("get"in y?!f.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return f[x]}}),Object.defineProperty(d,g,y)}:function(d,f,x,g){g===void 0&&(g=x),d[g]=f[x]}),n=sg.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=sg.__importStar||function(){var d=function(f){return d=Object.getOwnPropertyNames||function(x){var g=[];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(g[g.length]=y);return g},d(f)};return function(f){if(f&&f.__esModule)return f;var x={};if(f!=null)for(var g=d(f),y=0;y<g.length;y++)g[y]!=="default"&&e(x,f,g[y]);return n(x,f),x}}(),s=sg.__rest||function(d,f){var x={};for(var g in d)Object.prototype.hasOwnProperty.call(d,g)&&f.indexOf(g)<0&&(x[g]=d[g]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var y=0,g=Object.getOwnPropertySymbols(d);y<g.length;y++)f.indexOf(g[y])<0&&Object.prototype.propertyIsEnumerable.call(d,g[y])&&(x[g[y]]=d[g[y]]);return x};Object.defineProperty(sg,"__esModule",{value:!0});var a=r(xx()),o=EVe(),l=_Ve(),c=[(0,l.createAnimation)("PacmanLoader","0% {transform: rotate(0deg)} 50% {transform: rotate(-44deg)}","pacman-1"),(0,l.createAnimation)("PacmanLoader","0% {transform: rotate(0deg)} 50% {transform: rotate(44deg)}","pacman-2")];function u(d){var f=d.loading,x=f===void 0?!0:f,g=d.color,y=g===void 0?"#000000":g,v=d.speedMultiplier,C=v===void 0?1:v,N=d.cssOverride,P=N===void 0?{}:N,T=d.size,M=T===void 0?25:T,F=d.margin,$=F===void 0?2:F,L=s(d,["loading","color","speedMultiplier","cssOverride","size","margin"]),z=(0,o.parseLengthAndUnit)(M),X=z.value,ne=z.unit,J=t({display:"inherit",position:"relative",fontSize:0,height:"".concat(X*2).concat(ne),width:"".concat(X*2).concat(ne)},P),K=(0,l.createAnimation)("PacmanLoader",`75% {opacity: 0.7}
100% {transform: translate(`.concat("".concat(-4*X).concat(ne),", ").concat("".concat(-X/4).concat(ne),")}"),"ball"),te=function(V){return{width:"".concat(X/3).concat(ne),height:"".concat(X/3).concat(ne),backgroundColor:y,margin:(0,o.cssValue)($),borderRadius:"100%",transform:"translate(0, ".concat("".concat(-X/4).concat(ne),")"),position:"absolute",top:"".concat(X).concat(ne),left:"".concat(X*4).concat(ne),animation:"".concat(K," ").concat(1/C,"s ").concat(V*.25,"s infinite linear"),animationFillMode:"both"}},fe="".concat((0,o.cssValue)(M)," solid transparent"),q="".concat((0,o.cssValue)(M)," solid ").concat(y),se=function(V){return{width:0,height:0,borderRight:fe,borderTop:V===0?fe:q,borderLeft:q,borderBottom:V===0?q:fe,borderRadius:(0,o.cssValue)(M),position:"absolute",animation:"".concat(c[V]," ").concat(.8/C,"s infinite ease-in-out"),animationFillMode:"both"}},ae=se(0),W=se(1);return x?a.createElement("span",t({style:J},L),a.createElement("span",{style:ae}),a.createElement("span",{style:W}),a.createElement("span",{style:te(2)}),a.createElement("span",{style:te(3)}),a.createElement("span",{style:te(4)}),a.createElement("span",{style:te(5)})):null}return sg.default=u,sg}var lun=oun();const cun=Ii(lun),uun=()=>{const{setHyperToken:t,setHyperAddress:e}=m.useContext(Qr),[n]=T8e(),r=jo(),s=n.get("temp_mobile_password");return m.useEffect(()=>{s?(async()=>{try{const o=await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/sign_mobile_complete/",{temp_mobile_password:s},{headers:{"Content-Type":"application/json"}}),{token:l,address:c}=o.data;setTimeout(()=>{window.localStorage.setItem("hyperToken",l),window.localStorage.setItem("hyperAddress",c),e(c),t(l),tn.success("Authentication successful.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),r("/discover-wallets")},1e3)}catch{tn.error("Invalid QR or request failed."),r("/")}})():r("/")},[s,t,e,r]),i.jsxs("div",{className:"w-screen text-white flex flex-col items-center justify-center min-h-screen gap-4 ",children:[i.jsx("img",{src:Yi,alt:"",className:"w-24 h-24"}),i.jsx("div",{className:"font-manrope font-bold text-lg",children:"Welcome to Dextrabot"}),i.jsx("div",{className:"font-manrope font-bold text-lg",children:"Authenticating..."}),i.jsx(cun,{color:"#46eda1",size:30})]})},dun=()=>i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("meta",{name:"description",content:"Navigate all sections of Dextrabot through our comprehensive sitemap. Find links to copy trading features, wallet management, leaderboards, and more in one convenient location."}),i.jsx("meta",{name:"og:title",content:"Complete Dextrabot Website Sitemap"}),i.jsx("meta",{name:"og:description",content:"Navigate all sections of Dextrabot through our comprehensive sitemap. Find links to copy trading features, wallet management, leaderboards, and more in one convenient location."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/sitemap"})]})}),i.jsxs("div",{className:"bg-[#121213] p-4 w-screen h-screen overflow-x-hidden overflow-y-auto relative z-50",children:[i.jsx("div",{className:"h-full w-full absolute -z-10 -mt-[138px]"}),i.jsx(yde,{scrollToFeatures:()=>{var t;return(t=featuresRef.current)==null?void 0:t.scrollIntoView({behavior:"smooth"})},scrollToHowItWorks:()=>{var t;return(t=howItWorksRef.current)==null?void 0:t.scrollIntoView({behavior:"smooth"})},scrollToFAQ:()=>{var t;return(t=faQRef.current)==null?void 0:t.scrollIntoView({behavior:"smooth"})}}),i.jsx("section",{className:"px-1 py-5 sm:py-[64px] text-center h-[calc(100vh-190px)]",children:i.jsx("div",{className:"max-w-7xl mx-auto h-full",children:i.jsx("div",{className:"flex flex-col items-start gap-[88px] h-full",children:i.jsxs("div",{className:"flex flex-col items-start justify-start gap-6 h-full",children:[i.jsx("h2",{className:"text-start justify-start text-white text-[40px] font-semibold font-['Manrope'] leading-[48px]",children:"Dextrabot Sitemap"}),i.jsx("div",{className:"flex flex-col items-start",children:i.jsx("nav",{"aria-label":"Sitemap",children:i.jsxs("ul",{className:"text-start text-[#c9c9c9] text-base font-semibold font-['Manrope']",children:[i.jsx("li",{children:i.jsx("a",{href:"/",className:"hover:text-white text-[#c9c9c9] underline",children:"Dextrabot Homepage"})}),i.jsx("li",{children:i.jsx("a",{href:"/discover-wallets",className:"hover:text-white text-[#c9c9c9] underline",children:"Discover Wallets"})}),i.jsx("li",{children:i.jsx("a",{href:"/copy-trade",className:"hover:text-white text-[#c9c9c9] underline",children:"Copy Trade"})}),i.jsx("li",{children:i.jsx("a",{href:"/wallet-management",className:"hover:text-white text-[#c9c9c9] underline",children:"Wallet Management"})}),i.jsx("li",{children:i.jsx("a",{href:"/tracked-wallets",className:"hover:text-white text-[#c9c9c9] underline",children:"Tracked Wallets"})}),i.jsx("li",{children:i.jsx("a",{href:"/tracker",className:"hover:text-white text-[#c9c9c9] underline",children:"My Activities"})}),i.jsx("li",{children:i.jsx("a",{href:"/referral",className:"hover:text-white text-[#c9c9c9] underline",children:"Referral"})}),i.jsx("li",{children:i.jsx("a",{href:"/leaderboard",className:"hover:text-white text-[#c9c9c9] underline",children:"Leaderboard"})})]})})})]})})})}),i.jsx(vde,{})]})]}),fun=()=>{const t=[{id:"JDdZ5yWmEXk",title:"The Best Vaults on Hyperliquid (Get your free Google Vault Analysis Sheet)"},{id:"bCJTNChKfFA",title:"Copy Trading Challenge: Day 7: Wallet Adjustments (Reduced the Number of Copy Traded Wallets to one)"},{id:"l6xkJugg1PY",title:"Copy Trading Vaults on Hyperliquid (with Dextrabot)"},{id:"Yu_V6YNw6oA",title:"Hottest Copy Traded Wallets (Hyperliquid Copy Trading)"},{id:"OwpWPDGBJUU",title:"Copy Trading Challenge: Day 6 (+1500 USD) - Hyperliquid Copy Trading"},{id:"gN11fXPPFvU",title:"Copy Trading Challenge: Day 2 (Analysing Current Situation & Some Tips / Info on Hyperliquid)"},{id:"LDEjjcR-FqE",title:"Copy Trading Challenge: Day 1 (Finding & Analysing Wallets - Starting Copy Trading on Hyperliquid)"},{id:"HVxt-rnXHfk",title:"Copy Trading Tips & Tricks - (Hyperliquid Automated Copy Trading)"},{id:"e6ePwfGaMRc",title:"Hyperliquid Copy Trading: Mirror Copy Trading (Trade At The Same Margin Usage As The Source Wallet)"},{id:"Z1QB190V9M0",title:"Hyperliquid Copy Trading: Copy Current Positions (Dextrabot)"},{id:"C_mqwSqT2mI",title:"Hyperliquid Copy Trading Software in Action!"},{id:"jJYxbdkq514",title:"Hyperliqud Free Wallet Tracker (Telegram and Webpage) - Copy Trading"},{id:"gpzB62yp-rY",title:"Hyperliqud Copy Trading & Wallet Analysis Tool (Dextra: First of its kind!)"}];return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Hyperliquid Copy Trade Video Tutorials & Guides"}),i.jsx("meta",{name:"description",content:"Watch step-by-step Dextrabot video tutorials on Hyperliquid copy trading. Learn how to set up copy trading and discover profitable wallets."}),i.jsx("meta",{name:"og:title",content:"Hyperliquid Copy Trade Video Tutorials & Guides"}),i.jsx("meta",{name:"og:description",content:"Watch step-by-step Dextrabot video tutorials on Hyperliquid copy trading. Learn how to set up copy trading and discover profitable wallets."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/videos"})]})}),i.jsxs("div",{className:"bg-[#121213] p-4 w-screen h-screen overflow-x-hidden overflow-y-auto relative z-50",children:[i.jsx("div",{className:"h-full w-full absolute -z-10 -mt-[138px]"}),i.jsx(yde,{scrollToFeatures:()=>{var e;return(e=featuresRef.current)==null?void 0:e.scrollIntoView({behavior:"smooth"})},scrollToHowItWorks:()=>{var e;return(e=howItWorksRef.current)==null?void 0:e.scrollIntoView({behavior:"smooth"})},scrollToFAQ:()=>{var e;return(e=faQRef.current)==null?void 0:e.scrollIntoView({behavior:"smooth"})}}),i.jsx("section",{className:"px-1 py-5 sm:py-[64px] text-center",children:i.jsx("div",{className:"max-w-7xl mx-auto h-full",children:i.jsx("div",{className:"flex flex-col items-start gap-[88px] h-full",children:i.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 h-full",children:[i.jsx("h2",{className:"text-center justify-start text-white text-[40px] font-semibold font-['Manrope'] leading-[48px]",children:"Hyperliquid Copy Trade Video Tutorials & Guides"}),i.jsx("div",{className:"flex justify-center flex-wrap gap-6",children:t.map(e=>i.jsxs("div",{className:"w-full sm:w-1/4 bg-[#1c1c1c] rounded-xl overflow-hidden shadow-md p-4",children:[i.jsx("div",{className:"text-white font-semibold text-base p-4 h-32",children:e.title}),i.jsx("div",{className:"aspect-w-16 aspect-h-9",children:i.jsx("iframe",{src:`https://www.youtube.com/embed/${e.id}`,title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-48 rounded-xl"})})]},e.id))})]})})})}),i.jsx(vde,{})]})]})},_F=(t,e=2)=>Number(t).toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:e}),rQ=(t,e=2)=>Number(t).toLocaleString("en-US",{maximumFractionDigits:e}),mSe=t=>`${(t*100).toFixed(2)}%`,sQ=t=>Math.floor((Date.now()-t)/864e5);function hun(){const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,a]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[C,N]=m.useState(""),[P,T]=m.useState("tvl"),[M,F]=m.useState("desc"),[$,L]=m.useState(20),[z,X]=m.useState(1),ne=ee=>(ee.summary.name||"").trim()==="Hyperliquidity Provider (HLP)",J=()=>{r(!0),ps.get("https://stats-data.hyperliquid.xyz/Mainnet/vaults").then(ee=>e(Array.isArray(ee.data)?ee.data:[])).finally(()=>r(!1))};m.useEffect(()=>J(),[]);const K=(ee,oe)=>{var Ce;const de=(Ce=ee.pnls)==null?void 0:Ce.find(([me])=>me===oe);return de?parseFloat(de[1].slice(-1)[0]||0):0},te=m.useMemo(()=>{if(!t.length)return null;const ee=t.reduce((de,Ce)=>de+ +Ce.summary.tvl,0),oe=t.reduce((de,Ce)=>de+(Ce.apr||0),0)/t.length;return{total:t.length,active:t.filter(de=>!de.summary.isClosed).length,tvl:ee,avgApr:oe,profitable:t.filter(de=>K(de,"allTime")>0).length}},[t]),fe=m.useMemo(()=>t.filter(ee=>{const oe=+ee.summary.tvl,de=ee.apr||0,Ce=K(ee,"month"),me=K(ee,"allTime"),we=sQ(ee.summary.createTimeMillis),xe=(ee.summary.name||"").toLowerCase()+(ee.summary.vaultAddress||"").toLowerCase();return!(s&&oe<+s||o&&de*100<+o||c&&Ce<+c||d&&me<+d||x&&we<+x||!y&&ee.summary.isClosed||C&&!xe.includes(C.toLowerCase()))}),[t,s,o,c,d,x,y,C]),q=(ee,oe)=>{var de;switch(oe){case"name":return((de=ee.summary.name)==null?void 0:de.toLowerCase())||"";case"apr":return ee.apr||0;case"tvl":return+ee.summary.tvl;case"p30":return K(ee,"month");case"pAll":return K(ee,"allTime");case"days":return sQ(ee.summary.createTimeMillis);default:return 0}},se=m.useMemo(()=>[...fe].sort((ee,oe)=>{const de=q(ee,P),Ce=q(oe,P);return de===Ce?0:M==="asc"?de>Ce?1:-1:de<Ce?1:-1}),[fe,P,M]),ae=Math.max(1,Math.ceil(se.length/$)),W=se.slice((z-1)*$,z*$),V=(ee,oe)=>i.jsx("th",{onClick:()=>T(ee)||F(P===ee?M==="asc"?"desc":"asc":"desc"),className:`px-3 py-2 cursor-pointer whitespace-nowrap ${P===ee?"text-[#67FFBD]":""}`,children:oe},ee);return n?i.jsx("div",{className:"flex justify-center items-center w-full py-10",children:i.jsx(OVe,{color:"#ffffff",size:40})}):i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Hyperliquid Vaults Dashboard | Track Performance Metrics | Dextrabot"}),i.jsx("meta",{name:"description",content:"Monitor real-time performance of 7,200+ Hyperliquid vaults with comprehensive metrics on TVL, APR, and PnL. Filter by performance criteria to find the most profitable vaults."}),i.jsx("meta",{name:"og:title",content:"Hyperliquid Vaults Dashboard | Track Performance Metrics | Dextrabot"}),i.jsx("meta",{name:"og:description",content:"Monitor real-time performance of 7,200+ Hyperliquid vaults with comprehensive metrics on TVL, APR, and PnL. Filter by performance criteria to find the most profitable vaults."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/hyperliquid-vaults"})]})}),i.jsxs("div",{className:"max-w-7xl mx-auto p-6 font-manrope font-bold w-full",children:[i.jsx("h1",{className:"text-3xl font-bold text-center mb-8 text-white",children:"Hyperliquid Vaults Dashboard"}),i.jsx("button",{onClick:()=>{J(),X(1)},disabled:n,className:"bg-[#1c1c1c] hover:bg-[#303030] text-white px-4 py-2 rounded disabled:opacity-40 text-sm font-bold mb-4 flex justify-end",children:n?"Refreshing…":"Refresh Data"}),te&&i.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-5 gap-4 mb-8 text-center",children:[["Total Vaults",rQ(te.total,0)],["Active Vaults",rQ(te.active,0)],["Total TVL",_F(te.tvl,0)],["Average APR",mSe(te.avgApr)],["Profitable Vaults",rQ(te.profitable,0)]].map(([ee,oe])=>i.jsxs("div",{className:"bg-[#1c1c1c] rounded-lg p-4",children:[i.jsx("p",{className:"text-sm text-gray-400 mb-1",children:ee}),i.jsx("p",{className:"text-xl font-semibold text-white",children:oe})]},ee))}),i.jsxs("div",{className:"bg-[#1c1c1c] rounded-lg p-4 mb-8",children:[i.jsx("h2",{className:"text-xl font-semibold mb-4 text-white",children:"Filters"}),i.jsxs("div",{className:"grid md:grid-cols-6 gap-4 mb-4",children:[[["Min TVL",s,a],["Min APR (%)",o,l],["Min 30d PNL",c,u],["Min All-Time PNL",d,f],["Min Days",x,g]].map(([ee,oe,de])=>i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-sm text-gray-300 mb-1",children:ee}),i.jsx("input",{type:"number",value:oe===0?"":oe,placeholder:"0",onChange:Ce=>de(Ce.target.value===""?"":+Ce.target.value),className:"bg-[#303030] text-white rounded px-3 py-2 outline-none"})]},ee)),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{className:"text-sm text-gray-300 mb-1",children:"Search"}),i.jsx("input",{value:C,onChange:ee=>N(ee.target.value),className:"bg-[#303030] text-white rounded px-3 py-2 outline-none"})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("label",{className:"flex items-center text-sm text-gray-300",children:[i.jsx("input",{type:"checkbox",checked:y,onChange:ee=>v(ee.target.checked),className:"mr-2"}),"Show Closed Vaults"]}),i.jsx("button",{onClick:()=>{a(""),l(""),u(""),f(""),g(""),v(!1),N("")},className:"bg-[#303030] text-white px-3 py-1 text-sm font-bold rounded",children:"Reset"})]})]}),i.jsx("div",{className:"rounded-lg overflow-auto border border-[#303030]",children:i.jsxs("table",{className:"min-w-full text-sm text-gray-200 border-separate border-spacing-y-1",children:[i.jsx("thead",{className:"bg-[#161616]",children:i.jsxs("tr",{children:[V("name","Vault"),V("tvl","TVL"),V("apr","APR"),V("p30","30d PNL"),V("pAll","All-Time PNL"),V("days","Days")]})}),i.jsx("tbody",{children:W.map((ee,oe)=>{const de=+ee.summary.tvl,Ce=ee.apr||0,me=K(ee,"month"),we=K(ee,"allTime"),xe=sQ(ee.summary.createTimeMillis),be=ee.summary.vaultAddress;return i.jsxs("tr",{className:"border-b border-[#1b1b1b] bg-[#1b1b1b] hover:bg-[#222222] text-center",children:[i.jsxs("td",{className:"px-3 py-2 whitespace-nowrap flex items-center gap-2",children:[i.jsx("a",{href:`https://app.hyperliquid.xyz/vaults/${be}`,target:"_blank",rel:"noopener noreferrer",className:"hover:text-[#67FFBD] font-bold text-white",children:ee.summary.name||"Unnamed"}),i.jsx("a",{href:`/wallet-details/${be}`,target:"_blank",rel:"noopener noreferrer",children:i.jsx("img",{src:Yi,className:"w-4 h-4"})}),ne(ee)&&i.jsx("span",{className:"text-[#FF7173] ml-1",children:"(Protocol Vault)"})]}),i.jsx("td",{className:"px-3 py-2",children:_F(de)}),i.jsx("td",{className:"px-3 py-2",children:mSe(Ce)}),i.jsx("td",{className:`px-3 py-2 ${me>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:_F(me)}),i.jsx("td",{className:`px-3 py-2 ${we>=0?"text-[#67FFBD]":"text-[#FF7173]"}`,children:_F(we)}),i.jsx("td",{className:"px-3 py-2",children:xe})]},be)})})]})}),i.jsxs("div",{className:"flex items-center justify-between mt-4 text-gray-200",children:[i.jsxs("div",{className:"text-sm",children:["Rows:",i.jsx("select",{value:$,onChange:ee=>{L(+ee.target.value),X(1)},className:"bg-[#303030] ml-2 px-2 py-1 rounded text-sm font-bold",children:[10,20,30,40,50,100].map(ee=>i.jsx("option",{children:ee},ee))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>X(ee=>Math.max(1,ee-1)),disabled:z===1,className:"px-2 py-1 bg-[#1c1c1c] rounded disabled:opacity-40",children:"‹"}),i.jsxs("span",{className:"text-sm",children:[z,"/",ae]}),i.jsx("button",{onClick:()=>X(ee=>Math.min(ae,ee+1)),disabled:z===ae,className:"px-2 py-1 bg-[#1c1c1c] rounded disabled:opacity-40",children:"›"})]})]})]})]})}const Oh=({title:t,sortKey:e,sortOption:n,setSortOption:r,isFilterIcon:s})=>{const a=()=>{r(n===`-${e}`?e:`-${e}`)};return i.jsx(i.Fragment,{children:i.jsxs("div",{onClick:()=>a(),className:`${t==="Wallet"?"sm:sticky left-0 h-8":s?"justify-end":"justify-start"} flex items-center gap-1 min-w-max font-manrope cursor-pointer`,children:[i.jsx("div",{className:`${n.includes(e)?"text-white":""} cursor-pointer flex items-center justify-end group`,children:t}),i.jsx(uz,{sortKey:e,state:n,className:""})]})})},pun=({data:t,period:e})=>i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 lg:gap-4 px-2 sm:px-0 min-w-max",children:t?t==null?void 0:t.map((n,r)=>i.jsxs(m.Fragment,{children:[i.jsx(kb,{title:"Total Notional",value:n!=null&&n.total_notional?n==null?void 0:n.total_notional:"--",info:`${n!=null&&n.ticker_count?n==null?void 0:n.ticker_count:"--"} tickers`,icon:ime,period:e}),i.jsx(kb,{title:"Long Positions",value:n!=null&&n.long_exposure?n==null?void 0:n.long_exposure:"--",info:"Long exposure",icon:bJ,period:e}),i.jsx(kb,{title:"Short Positions",value:n!=null&&n.short_exposure?n==null?void 0:n.short_exposure:"--",info:"Short exposure",icon:yJ,period:e}),i.jsx(kb,{title:"Global Bias",value:n!=null&&n.global_bias?n==null?void 0:n.global_bias:"--",info:`L/S: ${n!=null&&n.long_ratio_percent?n==null?void 0:n.long_ratio_percent:"--"}%`,icon:4,period:e})]},r)):i.jsxs(i.Fragment,{children:[i.jsx(kb,{title:"Total Notional",value:"--",info:"--",icon:ime,period:e}),i.jsx(kb,{title:"Long Positions",value:"--",info:"Long exposure",icon:bJ,period:e}),i.jsx(kb,{title:"Short Positions",value:"--",info:"Short exposure",icon:yJ,period:e}),i.jsx(kb,{title:"Global Bias",value:"--",info:"L/S: --",icon:4,period:e})]})}),kb=({title:t,value:e,info:n,icon:r,period:s})=>i.jsxs("div",{style:{background:"linear-gradient(180deg, #000000 0%, #1C1C1C 100%)"},className:"h-20 lg:h-28 bg-[#1c1c1c] rounded-2xl p-2 lg:p-6 min-w-max relative overflow-hidden",children:[i.jsxs("div",{className:"flex justify-start items-start w-full h-full gap-2",children:[i.jsx("div",{className:"w-8 h-11 lg:w-12 lg:h-11 bg-[#1e1e1e] rounded-md border-[0.50px] border-[#313131] flex justify-center items-center",children:r===4?i.jsx(LBt,{className:`${e=="LONG"?"text-[#34D399]":(e=="SHORT","text-[#F87171]")} w-4 h-4 lg:w-5 lg:h-5`}):i.jsx("img",{src:r,alt:"",className:"w-4 h-4 lg:w-5 lg:h-5"})}),i.jsxs("div",{className:"flex flex-col items-start justify-start gap-2",children:[i.jsx("div",{className:"justify-start text-[#9b9b9b] text-[13px] lg:text-[14px] font-semibold font-['Manrope'] leading-[13px] tracking-tight mt-[3px]",children:`${t}`}),i.jsx("div",{className:"justify-start text-white text-[15px] lg:text-[17px] font-semibold font-['Manrope'] leading-[13px] tracking-tight",children:t==="Global Bias"?e:`$${eht(e)}`}),i.jsx("div",{className:"justify-start text-[#7e7e7e] text-[11px] lg:text-[12px] font-medium font-['Inter'] leading-[8px] tracking-tight mt-2",children:n})]})]}),r===4&&i.jsx("div",{className:`${e=="LONG"?"bg-[#67ffbd]/20":e=="SHORT"?"bg-[#ff797c]/20":""} h-2 lg:h-4 w-full absolute bottom-0 right-0 rounded-t-2xl`})]}),tse=({data_1:t,data_2:e,margin:n})=>i.jsxs("div",{className:`${n=="true"?"mt-3":""} flex flex-col items-start justify-start gap-2 w-full px-1`,children:[i.jsx("div",{className:"text-white bg-transparent text-xs font-medium font-inter leading-[8px] tracking-[0.18px] w-full",children:i.jsxs("span",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-[#67ffbd]",children:t?`${t}%`:"--"}),i.jsx("span",{className:"text-[#ff787b]",children:e?`${e}%`:"--"})]})}),i.jsxs("div",{className:"h-1 w-full bg-[#333333] rounded-[256px] flex gap-[2px] overflow-hidden",children:[i.jsx("div",{style:t?isNaN(t)?{width:"0%"}:{width:`${t}%`}:{width:"0%"},className:"flex justify-center items-center h-1 bg-[#67FFBD] rounded-[256px] text-[#67ffbd] text-[11px] font-bold font-inter leading-[8px] tracking-[0.18px]"}),i.jsx("div",{style:e?isNaN(e)?{width:"0%"}:{width:`${e}%`}:{width:"0%"},className:"bg-[#FF797C] h-1 rounded-[256px] flex justify-center items-center text-[#67ffbd] text-[11px] font-bold font-inter leading-[8px] tracking-[0.18px]"})]}),i.jsx("div",{className:"text-white bg-transparent text-[11px] font-medium font-inter leading-[8px] tracking-[0.18px] w-full",children:i.jsxs("span",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-[#67ffbd]",children:"Long"}),i.jsx("span",{className:"text-[#ff787b]",children:"Short"})]})})]}),mun=({data:t,loading:e,error:n,period:r,periods:s,handlePeriodChange:a})=>{var ne,J;const o="-total_notional",[l,c]=m.useState(o),[u,d]=m.useState("All"),f=m.useRef({}),[x,g]=m.useState(""),y=m.useRef(null),v=K=>{var fe;const te=(fe=t.data)==null?void 0:fe.filter(q=>{var ae,W,V,ee,oe;if(u!=="All"&&q.majority_side!==u)return!1;const se=(ae=x==null?void 0:x.trim())==null?void 0:ae.toLowerCase();return!(se!==""&&!((V=(W=q==null?void 0:q.asset)==null?void 0:W.toLowerCase())!=null&&V.includes(se)||(oe=(ee=q==null?void 0:q.coin_name)==null?void 0:ee.toLowerCase())!=null&&oe.includes(se)))});return te==null?void 0:te.sort((q,se)=>{const ae=q.asset?q.asset.toUpperCase():"",W=se.asset?se.asset.toUpperCase():"",V=q.majority_side==="LONG"?1:0,ee=se.majority_side==="LONG"?1:0,oe=q.majority_side==="SHORT"?1:0,de=se.majority_side==="SHORT"?1:0,Ce=q.maj_side_pnl==="Profit"?1:0,me=se.maj_side_pnl==="Profit"?1:0,we=q.maj_side_pnl==="Loss"?1:0,xe=se.maj_side_pnl==="Loss"?1:0,be=Ke=>{if(!Ke||typeof Ke!="string"||!Ke.includes("/"))return 0;const[dt,tt]=Ke.split("/").map(nt=>Number(nt.trim()));return tt!==0?dt/tt:0},je=be(q.traders_l_s),Ie=be(se.traders_l_s),Re=Ke=>{var nt,Le;const dt=parseFloat((nt=Ke==null?void 0:Ke.asset_change24h)==null?void 0:nt.markPx),tt=parseFloat((Le=Ke==null?void 0:Ke.asset_change24h)==null?void 0:Le.prevDayPx);return!dt||!tt||isNaN(dt)||isNaN(tt)||tt===0?-1/0:(dt-tt)/tt*100},Qe=Ke=>{var tt;const dt=parseFloat((tt=Ke==null?void 0:Ke.asset_change24h)==null?void 0:tt.markPx);return isNaN(dt)?0:dt};return K==="asset"?ae<W?-1:ae>W?1:0:K==="-asset"?ae>W?-1:ae<W?1:0:K==="-total_notional"?se.total_notional-q.total_notional:K==="total_notional"?q.total_notional-se.total_notional:K==="-price"?Qe(se)-Qe(q):K==="price"?Qe(q)-Qe(se):K==="-long_notional"?se.long_notional-q.long_notional:K==="long_notional"?q.long_notional-se.long_notional:K==="-short_notional"?se.short_notional-q.short_notional:K==="short_notional"?q.short_notional-se.short_notional:K==="-total_long_pnl"?se.total_long_pnl-q.total_long_pnl:K==="total_long_pnl"?q.total_long_pnl-se.total_long_pnl:K==="-total_short_pnl"?se.total_short_pnl-q.total_short_pnl:K==="total_short_pnl"?q.total_short_pnl-se.total_short_pnl:K==="-majority_side"?ee-V:K==="majority_side"?de-oe:K==="-l_s_ratio"?se.l_s_ratio-q.l_s_ratio:K==="l_s_ratio"?q.l_s_ratio-se.l_s_ratio:K==="-long_ratio"?se.long_ratio-q.long_ratio:K==="long_ratio"?q.long_ratio-se.long_ratio:K==="-short_ratio"?se.short_ratio-q.short_ratio:K==="short_ratio"?q.short_ratio-se.short_ratio:K==="-maj_side_notional"?se.maj_side_notional-q.maj_side_notional:K==="maj_side_notional"?q.maj_side_notional-se.maj_side_notional:K==="-maj_side_pnl"?me-Ce:K==="maj_side_pnl"?xe-we:K==="-traders_l_s"?Ie-je:K==="traders_l_s"?je-Ie:K==="-open_interest"?se.open_interest-q.open_interest:K==="open_interest"?q.open_interest-se.open_interest:K==="-change_24h"?Re(se)-Re(q):K==="change_24h"?Re(q)-Re(se):0})},C=m.useRef(null),N=()=>{C.current&&(C.current.scrollLeft-=100)},P=()=>{C.current&&(C.current.scrollLeft+=100)},T=()=>{C.current&&(C.current.scrollTop+=200)},M=()=>{C.current&&(C.current.scrollTop-=200)},F=K=>{var te;K.key==="Escape"&&(g(""),(te=y.current)==null||te.blur())},$=({coin:K,price:te,prevPricesRef:fe})=>{const[q,se]=m.useState("text-white");return m.useEffect(()=>{if(!K||te==null||isNaN(te))return;const ae=parseFloat(te),W=fe.current[K]??0;ae>W?se("text-[#1DE6A3]"):ae<W&&se("text-[#FF7173]"),fe.current[K]=ae;const V=setTimeout(()=>{se("text-white")},800);return()=>clearTimeout(V)},[te,K]),i.jsx(ig,{info:te==null||isNaN(te)?i.jsx("div",{className:"flex items-center justify-end w-[96px]",children:i.jsx("div",{className:"w-[96px] max-w-[96px] h-[20px] rounded skeleton-ticker-text short"})}):`$${te>=1e3?u3(te):te}`,textColor:q})},L={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},z=()=>i.jsx("div",{className:"flex items-center justify-end w-[96px]",children:i.jsx("div",{className:"w-[96px] max-w-[96px] h-[20px] rounded skeleton-ticker-text short"})}),X=K=>K>=376&&K<500?4:K>=500&&K<640?5:K>=640&&K<768?6:K>=768&&K<1024?7:K>=1024&&K<1280?9:K>=1280&&K<1540?11:K>=1540&&K<1700||K>=1700?12:3;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[10px] sm:gap-[13px] text-white bg-[#161616] w-full h-full font-manrope",children:[i.jsx("div",{className:"flex justify-between sm:justify-start items-center gap-6 w-full sm:w-max",children:i.jsxs("div",{className:"flex flex-row sm:flex-col justify-between items-center sm:items-start sm:justify-start gap-2 font-manrope max-w-full w-max sm:w-full bg-[#161616] pl-2 sm:pl-0 pt-1 pr-2 sm:pr-0",children:[i.jsx("div",{className:"text-[#7e7e7e] text-[11px] font-medium font-inter leading-[8px]",children:"Hype / Explore"}),i.jsx("div",{className:"flex items-center justify-start gap-4",children:i.jsx("div",{className:"text-white text-sm sm:text-lg font-medium font-manrope leading-[21px]",children:"Ticker"})})]})}),i.jsx(pun,{data:t.topbox,period:r}),i.jsxs("div",{className:"flex justify-start items-center gap-2 w-full h-max px-2 sm:px-0",children:[i.jsxs("div",{className:"flex justify-start items-center gap-0.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx("input",{ref:y,type:"text",value:x,onChange:K=>g(K.target.value),onKeyDown:F,className:"bg-[#222222] rounded text-white py-1 pl-2 pr-4 w-40 text-sm outline-none placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Search Coin"}),i.jsx("div",{onClick:()=>g(""),className:"text-[#aaa] hover:text-white outline-none focus:outline-none focus:ring-0 border-none w-4 h-[26px] bg-[#222222] hover:bg-[#333333] rounded flex justify-center items-center cursor-pointer",children:i.jsx("img",{src:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]}),i.jsxs("div",{className:"flex justify-start items-center gap-1.5 w-max h-max rounded-lg border border-[#333333] p-1",children:[i.jsx(iQ,{title:"All",set_click:()=>d("All"),tableSortButton:u}),i.jsx(iQ,{title:"LONG",set_click:()=>d("LONG"),tableSortButton:u}),i.jsx(iQ,{title:"SHORT",set_click:()=>d("SHORT"),tableSortButton:u})]})]}),i.jsxs("div",{className:"relative w-full h-full",children:[i.jsxs("div",{className:"absolute -top-6 right-4 z-10 hidden sm:flex justify-start items-center gap-2",children:[i.jsx("button",{onClick:N,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 rotate-90"})})}),i.jsx("button",{onClick:P,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none block lg:hidden",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-90"})})}),i.jsx("button",{onClick:M,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 -rotate-180"})})}),i.jsx("button",{onClick:T,className:"bg-[#353535] hover:bg-gray-600 text-white p-1 rounded-lg focus:outline-none focus:ring-0 border-none",children:i.jsx("span",{className:"w-6 h-6",children:i.jsx(Ja,{className:"text-gray-300 w-4 h-4 "})})})]}),i.jsx("div",{className:"w-full h-[calc(100vh-330px)] sm:h-[calc(100vh-390px)] md:h-[calc(100vh-305px)] lg:h-[calc(100vh-340px)] overflow-x-scroll relative overflow-y-scroll flex-grow",ref:C,children:i.jsxs("table",{className:"w-full relative mb-20",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#161616] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#161616] sm:left-0 h-8 pl-3 min-w-[160px] z-[8]",children:i.jsx(Oh,{title:"Coin",sortKey:"asset",sortOption:l,setSortOption:c,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[120px] px-1",children:i.jsx(Oh,{title:"Majority Side",sortKey:"majority_side",sortOption:l,setSortOption:c,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"min-w-[110px] ",children:i.jsxs("div",{className:"flex justify-end items-center gap-1.5 min-w-[110px] px-1",children:[i.jsx("span",{className:"w-1.5 h-1.5 min-w-1.5 min-h-1.5 bg-[#67FFBD] inline-block rounded-full live-dot"}),i.jsx(Oh,{title:"Mark Price",sortKey:"price",sortOption:l,setSortOption:c,isFilterIcon:!0})]})}),i.jsx("th",{scope:"col",className:"min-w-[170px] ",children:i.jsxs("div",{className:"flex justify-end items-center gap-1.5 min-w-[110px] px-1",children:[i.jsx("span",{className:"w-1.5 h-1.5 min-w-1.5 min-h-1.5 bg-[#67FFBD] inline-block rounded-full live-dot"}),i.jsx(Oh,{title:"24h Change",sortKey:"change_24h",sortOption:l,setSortOption:c,isFilterIcon:!0})]})}),i.jsx("th",{scope:"col",className:"min-w-[120px] px-1",children:i.jsx(Oh,{title:"Long PnL",sortKey:"total_long_pnl",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[110px] px-1",children:i.jsx(Oh,{title:"Short PnL",sortKey:"total_short_pnl",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] px-1",children:i.jsx(Oh,{title:"Long Notional",sortKey:"long_notional",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[135px] px-1",children:i.jsx(Oh,{title:"Short Notional",sortKey:"short_notional",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[135px] px-1",children:i.jsx(Oh,{title:"Total Notional",sortKey:"total_notional",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[190px] px-1",children:i.jsx(Oh,{title:"Long/Short Ratio",sortKey:"long_ratio",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[130px] px-1",children:i.jsx(Oh,{title:"Traders (L/S)",sortKey:"traders_l_s",sortOption:l,setSortOption:c,isFilterIcon:!0})}),i.jsx("th",{scope:"col",className:"min-w-[140px] pl-1 pr-4",children:i.jsx(Oh,{title:"Open Interest",sortKey:"open_interest",sortOption:l,setSortOption:c,isFilterIcon:!0})})]})}),i.jsx("tbody",{children:!t.data||e?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:X(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-16 ml-[45%] w-max",children:i.jsx($a,{})})})}):n&&!t.data?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:X(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[26vh] sm:min-h-[50vh] flex-col justify-center items-center ml-[18%] sm:ml-[25%] md:ml-[39%] w-max",children:i.jsx(Vl,{})})})}):((ne=t.data)==null?void 0:ne.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:X(window.innerWidth),children:i.jsx("div",{className:"flex min-h-[26vh] sm:min-h-[50vh] flex-col justify-center items-center ml-[18%] sm:ml-[25%] md:ml-[39%] w-max",children:i.jsx(cVe,{})})})}):(J=v(l))==null?void 0:J.map((K,te)=>{var fe,q,se,ae,W,V,ee,oe,de,Ce,me,we,xe,be,je,Ie,Re,Qe;return i.jsx(Ne.Fragment,{children:i.jsxs("tr",{className:`${te%2===0,"bg-[#161616]"} relative group hover:bg-[#222222] h-[56px] border-b border-[#232323] text-white`,children:[i.jsx("td",{scope:"row",onClick:()=>{window.open(`/terminal/${K==null?void 0:K.asset}`,"_blank")},className:`${te%2==0,"bg-[#161616]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222] cursor-pointer`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2.5 pl-2 h-14 max-h-14",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${L[K==null?void 0:K.asset]||((fe=K==null?void 0:K.asset)==null?void 0:fe.split("/")[0])}.svg`||dummyImage,alt:K==null?void 0:K.asset,className:"rounded-full w-5 h-5 min-w-5 min-h-5 bg-gray-700",loading:"lazy",onError:Ke=>wm(Ke)}),i.jsx(ig,{info:K!=null&&K.asset?K==null?void 0:K.asset:"--",textColor:"text-white"}),i.jsx("div",{className:"flex justify-center items-center rounded",children:i.jsx("img",{src:Am,alt:"",className:"w-[12px] h-[12px] min-w-[12px] min-h-[12px]"})})]})})}),i.jsx("td",{children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-8 max-h-8",children:i.jsxs("div",{className:`${K.majority_side=="LONG"?"text-[#67ffbd] bg-[#67ffbd]/20":K.majority_side=="SHORT"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md justify-start items-center gap-0.5 inline-flex`,children:[i.jsx("div",{className:"w-3 h-3 justify-center items-center flex",children:i.jsx("div",{className:"w-3 h-3 relative",children:K.majority_side=="LONG"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):K.majority_side=="SHORT"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})})}),i.jsx("div",{className:" text-[11px] font-semibold font-manrope leading-[8px] tracking-wide",children:K.majority_side?K.majority_side:"--"})]})})}),i.jsx("td",{className:"px-1",children:i.jsx($,{coin:K==null?void 0:K.asset,price:(q=K==null?void 0:K.asset_change24h)==null?void 0:q.markPx,prevPricesRef:f})}),i.jsx("td",{className:"px-1",children:i.jsx(xun,{info:((se=K==null?void 0:K.asset_change24h)==null?void 0:se.markPx)-((ae=K==null?void 0:K.asset_change24h)==null?void 0:ae.prevDayPx)?((W=K==null?void 0:K.asset_change24h)==null?void 0:W.markPx)-((V=K==null?void 0:K.asset_change24h)==null?void 0:V.prevDayPx)>0?"+"+Math.abs(parseFloat(((ee=K==null?void 0:K.asset_change24h)==null?void 0:ee.markPx)-((oe=K==null?void 0:K.asset_change24h)==null?void 0:oe.prevDayPx)).toFixed(5)):"-"+Math.abs(parseFloat(((de=K==null?void 0:K.asset_change24h)==null?void 0:de.markPx)-((Ce=K==null?void 0:K.asset_change24h)==null?void 0:Ce.prevDayPx)).toFixed(5)):z(),info_2:(((me=K==null?void 0:K.asset_change24h)==null?void 0:me.markPx)-((we=K==null?void 0:K.asset_change24h)==null?void 0:we.prevDayPx))/((xe=K==null?void 0:K.asset_change24h)==null?void 0:xe.prevDayPx)*100,color_1:`${((be=K==null?void 0:K.asset_change24h)==null?void 0:be.markPx)-((je=K==null?void 0:K.asset_change24h)==null?void 0:je.prevDayPx)>=0?"text-[#1DE6A3]":"text-[#FF7173]"}`,color_2:`${(((Ie=K==null?void 0:K.asset_change24h)==null?void 0:Ie.markPx)-((Re=K==null?void 0:K.asset_change24h)==null?void 0:Re.prevDayPx))/((Qe=K==null?void 0:K.asset_change24h)==null?void 0:Qe.prevDayPx)*100>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_long_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_long_pnl))?"--":`$${ad(Math.abs(K==null?void 0:K.total_long_pnl))}`,textColor:`${(K==null?void 0:K.total_long_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_long_pnl))||(K==null?void 0:K.total_long_pnl)==0?"text-white":(K==null?void 0:K.total_long_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_short_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_short_pnl))?"--":`$${ad(Math.abs(K==null?void 0:K.total_short_pnl))}`,textColor:`${(K==null?void 0:K.total_short_pnl)==null||isNaN(parseFloat(K==null?void 0:K.total_short_pnl))||(K==null?void 0:K.total_short_pnl)==0?"text-white":(K==null?void 0:K.total_short_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.long_notional)==null||isNaN(parseFloat(K==null?void 0:K.long_notional))?"--":`$${ad(K==null?void 0:K.long_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.short_notional)==null||isNaN(parseFloat(K==null?void 0:K.short_notional))?"--":`$${ad(K==null?void 0:K.short_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:(K==null?void 0:K.total_notional)==null||isNaN(parseFloat(K==null?void 0:K.total_notional))?"--":`$${ad(K==null?void 0:K.total_notional)}`,textColor:"text-white"})}),i.jsx("td",{className:"",children:i.jsx("div",{className:"flex justify-end w-full",children:i.jsx("div",{className:"flex justify-end w-full max-w-[150px]",children:i.jsx(tse,{data_1:K!=null&&K.long_ratio?parseFloat(K==null?void 0:K.long_ratio).toFixed(2):0,data_2:K!=null&&K.short_ratio?parseFloat(K==null?void 0:K.short_ratio).toFixed(2):0,margin:"false"})})})}),i.jsx("td",{className:"px-1",children:i.jsx(ig,{info:K!=null&&K.traders_l_s?K==null?void 0:K.traders_l_s:"--",textColor:"text-white"})}),i.jsx("td",{className:"pr-4",children:i.jsx(ig,{info:(K==null?void 0:K.open_interest)==null||isNaN(parseFloat(K==null?void 0:K.open_interest))?"--":`$${ad(K==null?void 0:K.open_interest)}`,textColor:"text-white"})})]})},te)})})]})})]})]})})},ig=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-sm font-semibold font-manrope leading-none flex items-center justify-start px-1 gap-0.5`,children:t})}),xun=({info:t,info_2:e,color_1:n,color_2:r})=>i.jsx("div",{className:"flex justify-end items-center gap-0.5",children:e?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:`${n} text-sm font-semibold font-manrope leading-none flex items-center justify-start px-1 gap-0.5`,children:t}),i.jsx("div",{className:`${n} flex justify-center items-center max-h-2`,children:t?"/":""}),i.jsx("div",{className:`${r} text-sm font-semibold font-manrope leading-none flex items-center justify-start px-1 gap-0.5`,children:`${e>0?"+":"-"}${parseFloat(e).toFixed(2)}%`})]}):i.jsx("div",{className:`${n} text-sm font-semibold font-manrope leading-none flex items-center justify-start px-1 gap-0.5`,children:t})}),iQ=({title:t,set_click:e,tableSortButton:n})=>i.jsx("div",{onClick:e,className:`${n==t?"bg-[#3d3d3d] text-white":"bg-[#161616] text-[#9b9b9b]"} text-[13px] font-medium font-manrope leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-7`,children:t}),gun=()=>{ns();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u,hyperToken:d}=m.useContext(Qr),[f,x]=m.useState([]),[g,y]=m.useState(!1),[v,C]=m.useState(null),N=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90}],P=parseInt(localStorage.getItem("ticker_period")),T=!isNaN(P)&&N[P]?N[P].value:N[1].value,[M,F]=m.useState(T),$=z=>{F(Number(z)),localStorage.setItem("ticker_period",N.findIndex(X=>X.value===Number(z)).toFixed(0))},L=async()=>{try{y(!0);const X=await fetch("https://dextradata.nftinit.io/api/hyper/analytics_v2/",{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!X.ok)throw new Error("Network response was not ok");const ne=await X.json();ne!=null&&ne.success?(x(ne),y(!1)):(y(!1),C(ne==null?void 0:ne.error_message),console.error("Error fetching analytics data:",ne==null?void 0:ne.error_message))}catch(z){setError(z.message),y(!1),console.error("Error fetching analytics data:",z)}finally{y(!1)}};return m.useEffect(()=>{L()},[]),m.useEffect(()=>{const z=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");z.onopen=()=>{z.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}}))},z.onmessage=J=>{var te;const K=JSON.parse(J==null?void 0:J.data);if(K.channel==="webData2"){const fe=K.data,q=fe.assetCtxs,se=(te=fe.meta)==null?void 0:te.universe;if(Array.isArray(q)&&Array.isArray(se)){const ae=q.map((W,V)=>{var ee;return{...W,name:((ee=se[V])==null?void 0:ee.name)??null}});x(W=>{if(!W||!Array.isArray(W.data))return W;const V=W.data.map(ee=>{const oe=ae.find(de=>de.name===ee.asset);return oe?{...ee,asset_change24h:oe}:ee});return{...W,data:V}})}else console.error("missing assetCtxs or universe:",{assetCtxs:q,universe:se})}};const X=()=>{z.readyState===WebSocket.OPEN&&z.send(JSON.stringify({method:"unsubscribe",subscription:{type:"webData2",user:"0x0000000000000000000000000000000000000000"}})),z.close()},ne=()=>{X(),window.removeEventListener("beforeunload",X)};return window.addEventListener("beforeunload",X),ne},[]),m.useEffect(()=>{(async()=>{var J,K;const X=window.localStorage.getItem("hyperToken"),ne=window.localStorage.getItem("hyperAddress");if(!(!X||!ne))try{const te=await ki(ne.toLowerCase(),X);te!=null&&te.success?(t(te==null?void 0:te.telegram_chat_id),e(te==null?void 0:te.subscriber_role),n(te==null?void 0:te.subs_expire_day),r((J=te==null?void 0:te.mushboomer_counts)==null?void 0:J.eth),a((K=te==null?void 0:te.mushboomer_counts)==null?void 0:K.sol),o(te==null?void 0:te.referral_code),l(te==null?void 0:te.refcode),s(te==null?void 0:te.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(te){console.error("Token verification error:",te)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsx(xo,{children:i.jsxs(i.Fragment,{children:[i.jsx("title",{children:"Real-time Crypto Positions Tracker | Top Hyperliquid Traders | Dextrabot"}),i.jsx("meta",{name:"description",content:"Track real-time positions of top-performing Hyperliquid traders by cryptocurrency. View live long/short exposure, trading volumes, and performance metrics for BTC, ETH, SOL and more. Copy profitable strategies instantly."}),i.jsx("meta",{property:"og:title",content:"Real-time Crypto Positions Tracker | Top Hyperliquid Traders | Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Track real-time positions of top-performing Hyperliquid traders by cryptocurrency. View live long/short exposure, trading volumes, and performance metrics for BTC, ETH, SOL and more. Copy profitable strategies instantly."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/ticker"})]})})}),i.jsx("div",{className:"flex justify-center items-center w-full h-[calc(100vh-65px)] sm:h-[calc(100vh-80px)] px-1 pt-1 sm:px-6 sm:pt-3 bg-[#161616] overflow-hidden",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full flex-grow xl:flex-grow-0",children:i.jsx(mun,{data:f,loading:g,error:v,period:M,periods:N,handlePeriodChange:$})})})]})},wde=m.createContext({});function Cde(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const Sde=typeof window<"u",DVe=Sde?m.useLayoutEffect:m.useEffect,hz=m.createContext(null),kF=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function bun(t,e){let n=new Set,r=new Set,s=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),t()),d(l)}const u={schedule:(d,f=!1,x=!1)=>{const y=x&&s?n:r;return f&&o.add(d),y.has(d)||y.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(l=d,s){a=!0;return}s=!0,[n,r]=[r,n],n.forEach(c),n.clear(),s=!1,a&&(a=!1,u.process(d))}};return u}const yun=40;function BVe(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=kF.reduce((T,M)=>(T[M]=bun(a),T),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:x,render:g,postRender:y}=o,v=()=>{const T=Dc.useManualTiming?s.timestamp:performance.now();n=!1,Dc.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(T-s.timestamp,yun),1)),s.timestamp=T,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),d.process(s),f.process(s),x.process(s),g.process(s),y.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(v))},C=()=>{n=!0,r=!0,s.isProcessing||t(v)};return{schedule:kF.reduce((T,M)=>{const F=o[M];return T[M]=($,L=!1,z=!1)=>(n||C(),F.schedule($,L,z)),T},{}),cancel:T=>{for(let M=0;M<kF.length;M++)o[kF[M]].cancel(T)},state:s,steps:o}}const{schedule:Bo,cancel:h2,state:Jc,steps:aQ}=BVe(typeof requestAnimationFrame<"u"?requestAnimationFrame:dl,!0);let gM;function vun(){gM=void 0}const lf={now:()=>(gM===void 0&&lf.set(Jc.isProcessing||Dc.useManualTiming?Jc.timestamp:performance.now()),gM),set:t=>{gM=t,queueMicrotask(vun)}},$Ve=t=>e=>typeof e=="string"&&e.startsWith(t),Nde=$Ve("--"),wun=$Ve("var(--"),Ade=t=>wun(t)?Cun.test(t.split("/*")[0].trim()):!1,Cun=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Oj={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ck={...Oj,transform:t=>Lc(0,1,t)},TF={...Oj,default:1},V9=t=>Math.round(t*1e5)/1e5,jde=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Sun(t){return t==null}const Nun=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ede=(t,e)=>n=>!!(typeof n=="string"&&Nun.test(n)&&n.startsWith(t)||e&&!Sun(n)&&Object.prototype.hasOwnProperty.call(n,e)),UVe=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,a,o,l]=r.match(jde);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},Aun=t=>Lc(0,255,t),oQ={...Oj,transform:t=>Math.round(Aun(t))},_w={test:Ede("rgb","red"),parse:UVe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+oQ.transform(t)+", "+oQ.transform(e)+", "+oQ.transform(n)+", "+V9(Ck.transform(r))+")"};function jun(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const nse={test:Ede("#"),parse:jun,transform:_w.transform},tP=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),$b=tP("deg"),ex=tP("%"),ui=tP("px"),Eun=tP("vh"),_un=tP("vw"),xSe={...ex,parse:t=>ex.parse(t)/100,transform:t=>ex.transform(t*100)},u4={test:Ede("hsl","hue"),parse:UVe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ex.transform(V9(e))+", "+ex.transform(V9(n))+", "+V9(Ck.transform(r))+")"},$l={test:t=>_w.test(t)||nse.test(t)||u4.test(t),parse:t=>_w.test(t)?_w.parse(t):u4.test(t)?u4.parse(t):nse.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?_w.transform(t):u4.transform(t),getAnimatableNone:t=>{const e=$l.parse(t);return e.alpha=0,$l.transform(e)}},kun=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Tun(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(jde))==null?void 0:e.length)||0)+(((n=t.match(kun))==null?void 0:n.length)||0)>0}const zVe="number",HVe="color",Pun="var",Iun="var(",gSe="${}",Fun=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sk(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let a=0;const l=e.replace(Fun,c=>($l.test(c)?(r.color.push(a),s.push(HVe),n.push($l.parse(c))):c.startsWith(Iun)?(r.var.push(a),s.push(Pun),n.push(c)):(r.number.push(a),s.push(zVe),n.push(parseFloat(c))),++a,gSe)).split(gSe);return{values:n,split:l,indexes:r,types:s}}function VVe(t){return Sk(t).values}function WVe(t){const{split:e,types:n}=Sk(t),r=e.length;return s=>{let a="";for(let o=0;o<r;o++)if(a+=e[o],s[o]!==void 0){const l=n[o];l===zVe?a+=V9(s[o]):l===HVe?a+=$l.transform(s[o]):a+=s[o]}return a}}const Oun=t=>typeof t=="number"?0:$l.test(t)?$l.getAnimatableNone(t):t;function Mun(t){const e=VVe(t);return WVe(t)(e.map(Oun))}const p2={test:Tun,parse:VVe,createTransformer:WVe,getAnimatableNone:Mun};function lQ(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Run({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,a=0,o=0;if(!e)s=a=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=lQ(c,l,t+1/3),a=lQ(c,l,t),o=lQ(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function HD(t,e){return n=>n>0?e:t}const Go=(t,e,n)=>t+(e-t)*n,cQ=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},Lun=[nse,_w,u4],Dun=t=>Lun.find(e=>e.test(t));function bSe(t){const e=Dun(t);if(!e)return!1;let n=e.parse(t);return e===u4&&(n=Run(n)),n}const ySe=(t,e)=>{const n=bSe(t),r=bSe(e);if(!n||!r)return HD(t,e);const s={...n};return a=>(s.red=cQ(n.red,r.red,a),s.green=cQ(n.green,r.green,a),s.blue=cQ(n.blue,r.blue,a),s.alpha=Go(n.alpha,r.alpha,a),_w.transform(s))},rse=new Set(["none","hidden"]);function Bun(t,e){return rse.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function $un(t,e){return n=>Go(t,e,n)}function _de(t){return typeof t=="number"?$un:typeof t=="string"?Ade(t)?HD:$l.test(t)?ySe:Hun:Array.isArray(t)?qVe:typeof t=="object"?$l.test(t)?ySe:Uun:HD}function qVe(t,e){const n=[...t],r=n.length,s=t.map((a,o)=>_de(a)(a,e[o]));return a=>{for(let o=0;o<r;o++)n[o]=s[o](a);return n}}function Uun(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=_de(t[s])(t[s],e[s]));return s=>{for(const a in r)n[a]=r[a](s);return n}}function zun(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],o=t.indexes[a][r[a]],l=t.values[o]??0;n[s]=l,r[a]++}return n}const Hun=(t,e)=>{const n=p2.createTransformer(e),r=Sk(t),s=Sk(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?rse.has(t)&&!s.values.length||rse.has(e)&&!r.values.length?Bun(t,e):vx(qVe(zun(r,s),s.values),n):HD(t,e)};function GVe(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Go(t,e,n):_de(t)(t,e)}const Vun=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Bo.update(e,n),stop:()=>h2(e),now:()=>Jc.isProcessing?Jc.timestamp:lf.now()}},KVe=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let a=0;a<s;a++)r+=Math.round(t(a/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},VD=2e4;function kde(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<VD;)e+=n,r=t.next(e);return e>=VD?1/0:e}function Wun(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(kde(r),VD);return{type:"keyframes",ease:a=>r.next(s*a).value/e,duration:ll(s)}}const qun=5;function YVe(t,e,n){const r=Math.max(e-qun,0);return BB(n-t(r),e-r)}const il={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},vSe=.001;function Gun({duration:t=il.duration,bounce:e=il.bounce,velocity:n=il.velocity,mass:r=il.mass}){let s,a,o=1-e;o=Lc(il.minDamping,il.maxDamping,o),t=Lc(il.minDuration,il.maxDuration,ll(t)),o<1?(s=u=>{const d=u*o,f=d*t,x=d-n,g=sse(u,o),y=Math.exp(-f);return vSe-x/g*y},a=u=>{const f=u*o*t,x=f*n+n,g=Math.pow(o,2)*Math.pow(u,2)*t,y=Math.exp(-f),v=sse(Math.pow(u,2),o);return(-s(u)+vSe>0?-1:1)*((x-g)*y)/v}):(s=u=>{const d=Math.exp(-u*t),f=(u-n)*t+1;return-.001+d*f},a=u=>{const d=Math.exp(-u*t),f=(n-u)*(t*t);return d*f});const l=5/t,c=Yun(s,a,l);if(t=Wl(t),isNaN(c))return{stiffness:il.stiffness,damping:il.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const Kun=12;function Yun(t,e,n){let r=n;for(let s=1;s<Kun;s++)r=r-t(r)/e(r);return r}function sse(t,e){return t*Math.sqrt(1-e*e)}const Xun=["duration","bounce"],Qun=["stiffness","damping","mass"];function wSe(t,e){return e.some(n=>t[n]!==void 0)}function Zun(t){let e={velocity:il.velocity,stiffness:il.stiffness,damping:il.damping,mass:il.mass,isResolvedFromDuration:!1,...t};if(!wSe(t,Qun)&&wSe(t,Xun))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,a=2*Lc(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:il.mass,stiffness:s,damping:a}}else{const n=Gun(t);e={...e,...n,mass:il.mass},e.isResolvedFromDuration=!0}return e}function WD(t=il.visualDuration,e=il.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:f,velocity:x,isResolvedFromDuration:g}=Zun({...n,velocity:-ll(n.velocity||0)}),y=x||0,v=u/(2*Math.sqrt(c*d)),C=o-a,N=ll(Math.sqrt(c/d)),P=Math.abs(C)<5;r||(r=P?il.restSpeed.granular:il.restSpeed.default),s||(s=P?il.restDelta.granular:il.restDelta.default);let T;if(v<1){const F=sse(N,v);T=$=>{const L=Math.exp(-v*N*$);return o-L*((y+v*N*C)/F*Math.sin(F*$)+C*Math.cos(F*$))}}else if(v===1)T=F=>o-Math.exp(-N*F)*(C+(y+N*C)*F);else{const F=N*Math.sqrt(v*v-1);T=$=>{const L=Math.exp(-v*N*$),z=Math.min(F*$,300);return o-L*((y+v*N*C)*Math.sinh(z)+F*C*Math.cosh(z))/F}}const M={calculatedDuration:g&&f||null,next:F=>{const $=T(F);if(g)l.done=F>=f;else{let L=F===0?y:0;v<1&&(L=F===0?Wl(y):YVe(T,F,$));const z=Math.abs(L)<=r,X=Math.abs(o-$)<=s;l.done=z&&X}return l.value=l.done?o:$,l},toString:()=>{const F=Math.min(kde(M),VD),$=KVe(L=>M.next(F*L).value,F,30);return F+"ms "+$},toTransition:()=>{}};return M}WD.applyToOptions=t=>{const e=Wun(t,100,WD);return t.ease=e.ease,t.duration=Wl(e.duration),t.type="keyframes",t};function ise({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=t[0],x={done:!1,value:f},g=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let v=n*e;const C=f+v,N=o===void 0?C:o(C);N!==C&&(v=N-f);const P=z=>-v*Math.exp(-z/r),T=z=>N+P(z),M=z=>{const X=P(z),ne=T(z);x.done=Math.abs(X)<=u,x.value=x.done?N:ne};let F,$;const L=z=>{g(x.value)&&(F=z,$=WD({keyframes:[x.value,y(x.value)],velocity:YVe(T,z,x.value),damping:s,stiffness:a,restDelta:u,restSpeed:d}))};return L(0),{calculatedDuration:null,next:z=>{let X=!1;return!$&&F===void 0&&(X=!0,M(z),L(z)),F!==void 0&&z>=F?$.next(z-F):(!X&&M(z),x)}}}function Jun(t,e,n){const r=[],s=n||Dc.mix||GVe,a=t.length-1;for(let o=0;o<a;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||dl:e;l=vx(c,l)}r.push(l)}return r}function edn(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const a=t.length;if(QS(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=Jun(e,r,s),c=l.length,u=d=>{if(o&&d<t[0])return e[0];let f=0;if(c>1)for(;f<t.length-2&&!(d<t[f+1]);f++);const x=sx(t[f],t[f+1],d);return l[f](x)};return n?d=>u(Lc(t[0],t[a-1],d)):u}function tdn(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=sx(0,e,r);t.push(Go(n,1,s))}}function ndn(t){const e=[0];return tdn(e,t.length-1),e}function rdn(t,e){return t.map(n=>n*e)}function sdn(t,e){return t.map(()=>e||Uie).splice(0,t.length-1)}function W9({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=r9e(r)?r.map(BM):BM(r),a={done:!1,value:e[0]},o=rdn(n&&n.length===e.length?n:ndn(e),t),l=edn(o,e,{ease:Array.isArray(s)?s:sdn(e,s)});return{calculatedDuration:t,next:c=>(a.value=l(c),a.done=c>=t,a)}}const idn=t=>t!==null;function Tde(t,{repeat:e,repeatType:n="loop"},r,s=1){const a=t.filter(idn),l=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!l||r===void 0?a[l]:r}const adn={decay:ise,inertia:ise,tween:W9,keyframes:W9,spring:WD};function XVe(t){typeof t.type=="string"&&(t.type=adn[t.type])}class Pde{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const odn=t=>t/100;class Ide extends Pde{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==lf.now()&&this.tick(lf.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;XVe(e);const{type:n=W9,repeat:r=0,repeatDelay:s=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=n||W9;c!==W9&&typeof l[0]!="number"&&(this.mixKeyframes=vx(odn,GVe(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=kde(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:f,repeatType:x,repeatDelay:g,type:y,onUpdate:v,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const N=this.currentTime-u*(this.playbackSpeed>=0?1:-1),P=this.playbackSpeed>=0?N<0:N>s;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,M=r;if(f){const z=Math.min(this.currentTime,s)/l;let X=Math.floor(z),ne=z%1;!ne&&z>=1&&(ne=1),ne===1&&X--,X=Math.min(X,f+1),!!(X%2)&&(x==="reverse"?(ne=1-ne,g&&(ne-=g/l)):x==="mirror"&&(M=o)),T=Lc(0,1,ne)*l}const F=P?{done:!1,value:d[0]}:M.next(T);a&&(F.value=a(F.value));let{done:$}=F;!P&&c!==null&&($=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return L&&y!==ise&&(F.value=Tde(d,this.options,C,this.speed)),v&&v(F.value),L&&this.finish(),F}then(e,n){return this.finished.then(e,n)}get duration(){return ll(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ll(e)}get time(){return ll(this.currentTime)}set time(e){var n;e=Wl(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(lf.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ll(this.currentTime))}play(){var s,a;if(this.isStopped)return;const{driver:e=Vun,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(a=(s=this.options).onPlay)==null||a.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(lf.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function ldn(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const kw=t=>t*180/Math.PI,ase=t=>{const e=kw(Math.atan2(t[1],t[0]));return ose(e)},cdn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:ase,rotateZ:ase,skewX:t=>kw(Math.atan(t[1])),skewY:t=>kw(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},ose=t=>(t=t%360,t<0&&(t+=360),t),CSe=ase,SSe=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),NSe=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),udn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:SSe,scaleY:NSe,scale:t=>(SSe(t)+NSe(t))/2,rotateX:t=>ose(kw(Math.atan2(t[6],t[5]))),rotateY:t=>ose(kw(Math.atan2(-t[2],t[0]))),rotateZ:CSe,rotate:CSe,skewX:t=>kw(Math.atan(t[4])),skewY:t=>kw(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function lse(t){return t.includes("scale")?1:0}function cse(t,e){if(!t||t==="none")return lse(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=udn,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=cdn,s=l}if(!s)return lse(e);const a=r[e],o=s[1].split(",").map(fdn);return typeof a=="function"?a(o):o[a]}const ddn=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return cse(n,e)};function fdn(t){return parseFloat(t.trim())}const Mj=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Rj=new Set(Mj),ASe=t=>t===Oj||t===ui,hdn=new Set(["x","y","z"]),pdn=Mj.filter(t=>!hdn.has(t));function mdn(t){const e=[];return pdn.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const _3={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>cse(e,"x"),y:(t,{transform:e})=>cse(e,"y")};_3.translateX=_3.x;_3.translateY=_3.y;const k3=new Set;let use=!1,dse=!1,fse=!1;function QVe(){if(dse){const t=Array.from(k3).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=mdn(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([a,o])=>{var l;(l=r.getValue(a))==null||l.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}dse=!1,use=!1,k3.forEach(t=>t.complete(fse)),k3.clear()}function ZVe(){k3.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(dse=!0)})}function xdn(){fse=!0,ZVe(),QVe(),fse=!1}class Fde{constructor(e,n,r,s,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(k3.add(this),use||(use=!0,Bo.read(ZVe),Bo.resolveKeyframes(QVe))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const a=s==null?void 0:s.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const l=r.readValue(n,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&a===void 0&&s.set(e[0])}ldn(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),k3.delete(this)}cancel(){this.state==="scheduled"&&(k3.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const gdn=t=>t.startsWith("--");function bdn(t,e,n){gdn(e)?t.style.setProperty(e,n):t.style[e]=n}const ydn=MA(()=>window.ScrollTimeline!==void 0),vdn={};function wdn(t,e){const n=MA(t);return()=>vdn[e]??n()}const JVe=wdn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),c9=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,jSe={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:c9([0,.65,.55,1]),circOut:c9([.55,0,1,.45]),backIn:c9([.31,.01,.66,-.59]),backOut:c9([.33,1.53,.69,.99])};function eWe(t,e){if(t)return typeof t=="function"?JVe()?KVe(t,e):"ease-out":zie(t)?c9(t):Array.isArray(t)?t.map(n=>eWe(n,e)||jSe.easeOut):jSe[t]}function Cdn(t,e,n,{delay:r=0,duration:s=300,repeat:a=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:n};c&&(d.offset=c);const f=eWe(l,s);Array.isArray(f)&&(d.easing=f);const x={delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"};return u&&(x.pseudoElement=u),t.animate(d,x)}function tWe(t){return typeof t=="function"&&"applyToOptions"in t}function Sdn({type:t,...e}){return tWe(t)&&JVe()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Ndn extends Pde{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,QS(typeof e.type!="string");const u=Sdn(e);this.animation=Cdn(n,r,s,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const d=Tde(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):bdn(n,r,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return ll(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ll(e)}get time(){return ll(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Wl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&ydn()?(this.animation.timeline=e,dl):n(this)}}const nWe={anticipate:Lie,backInOut:Rie,circInOut:$ie};function Adn(t){return t in nWe}function jdn(t){typeof t.ease=="string"&&Adn(t.ease)&&(t.ease=nWe[t.ease])}const ESe=10;class Edn extends Ndn{constructor(e){jdn(e),XVe(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:a,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const l=new Ide({...o,autoplay:!1}),c=Wl(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-ESe).value,l.sample(c).value,ESe),l.stop()}}const _Se=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(p2.test(t)||t==="0")&&!t.startsWith("url("));function _dn(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function kdn(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],o=_Se(s,e),l=_Se(a,e);return!o||!l?!1:_dn(t)||(n==="spring"||tWe(n))&&r}function hse(t){t.duration=0,t.type="keyframes"}const Tdn=new Set(["opacity","clipPath","filter","transform"]),Pdn=MA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Idn(t){var d;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:a,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return Pdn()&&n&&Tdn.has(n)&&(n!=="transform"||!u)&&!c&&!r&&s!=="mirror"&&a!==0&&o!=="inertia"}const Fdn=40;class Odn extends Pde{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...f}){var y;super(),this.stop=()=>{var v,C;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=lf.now();const x={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:a,repeatType:o,name:c,motionValue:u,element:d,...f},g=(d==null?void 0:d.KeyframeResolver)||Fde;this.keyframeResolver=new g(l,(v,C,N)=>this.onKeyframesResolved(v,C,x,!N),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=r;this.resolvedAt=lf.now(),kdn(e,a,o,l)||((Dc.instantAnimations||!c)&&(d==null||d(Tde(e,r,n))),e[0]=e[e.length-1],hse(r),r.repeat=0);const x={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Fdn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=!u&&Idn(x)?new Edn({...x,element:x.motionValue.owner.current}):new Ide(x);g.finished.then(()=>this.notifyFinished()).catch(dl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),xdn()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const Mdn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Rdn(t){const e=Mdn.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function rWe(t,e,n=1){const[r,s]=Rdn(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const o=a.trim();return RB(o)?parseFloat(o):o}return Ade(s)?rWe(s,e,n+1):s}function Ode(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const sWe=new Set(["width","height","top","left","right","bottom",...Mj]),Ldn={test:t=>t==="auto",parse:t=>t},iWe=t=>e=>e.test(t),aWe=[Oj,ui,ex,$b,_un,Eun,Ldn],kSe=t=>aWe.find(iWe(t));function Ddn(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||DB(t):!0}const Bdn=new Set(["brightness","contrast","saturate","opacity"]);function $dn(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(jde)||[];if(!r)return t;const s=n.replace(r,"");let a=Bdn.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+s+")"}const Udn=/\b([a-z-]*)\(.*?\)/gu,pse={...p2,getAnimatableNone:t=>{const e=t.match(Udn);return e?e.map($dn).join(" "):t}},TSe={...Oj,transform:Math.round},zdn={rotate:$b,rotateX:$b,rotateY:$b,rotateZ:$b,scale:TF,scaleX:TF,scaleY:TF,scaleZ:TF,skew:$b,skewX:$b,skewY:$b,distance:ui,translateX:ui,translateY:ui,translateZ:ui,x:ui,y:ui,z:ui,perspective:ui,transformPerspective:ui,opacity:Ck,originX:xSe,originY:xSe,originZ:ui},Mde={borderWidth:ui,borderTopWidth:ui,borderRightWidth:ui,borderBottomWidth:ui,borderLeftWidth:ui,borderRadius:ui,radius:ui,borderTopLeftRadius:ui,borderTopRightRadius:ui,borderBottomRightRadius:ui,borderBottomLeftRadius:ui,width:ui,maxWidth:ui,height:ui,maxHeight:ui,top:ui,right:ui,bottom:ui,left:ui,padding:ui,paddingTop:ui,paddingRight:ui,paddingBottom:ui,paddingLeft:ui,margin:ui,marginTop:ui,marginRight:ui,marginBottom:ui,marginLeft:ui,backgroundPositionX:ui,backgroundPositionY:ui,...zdn,zIndex:TSe,fillOpacity:Ck,strokeOpacity:Ck,numOctaves:TSe},Hdn={...Mde,color:$l,backgroundColor:$l,outlineColor:$l,fill:$l,stroke:$l,borderColor:$l,borderTopColor:$l,borderRightColor:$l,borderBottomColor:$l,borderLeftColor:$l,filter:pse,WebkitFilter:pse},oWe=t=>Hdn[t];function lWe(t,e){let n=oWe(t);return n!==pse&&(n=p2),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Vdn=new Set(["auto","none","0"]);function Wdn(t,e,n){let r=0,s;for(;r<t.length&&!s;){const a=t[r];typeof a=="string"&&!Vdn.has(a)&&Sk(a).values.length&&(s=t[r]),r++}if(s&&n)for(const a of e)t[a]=lWe(n,s)}class qdn extends Fde{constructor(e,n,r,s,a){super(e,n,r,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let u=e[c];if(typeof u=="string"&&(u=u.trim(),Ade(u))){const d=rWe(u,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!sWe.has(r)||e.length!==2)return;const[s,a]=e,o=kSe(s),l=kSe(a);if(o!==l)if(ASe(o)&&ASe(l))for(let c=0;c<e.length;c++){const u=e[c];typeof u=="string"&&(e[c]=parseFloat(u))}else _3[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||Ddn(e[s]))&&r.push(s);r.length&&Wdn(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_3[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=r.length-1,o=r[a];r[a]=_3[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function Gdn(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const cWe=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function uWe(t){return LB(t)&&"offsetHeight"in t}const PSe=30,Kdn=t=>!isNaN(parseFloat(t));class Ydn{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var a;const s=lf.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((a=this.events.change)==null||a.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=lf.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Kdn(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new RA);const r=this.events[e].add(n);return e==="change"?()=>{r(),Bo.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=lf.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>PSe)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,PSe);return BB(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function gA(t,e){return new Ydn(t,e)}const{schedule:Rde,cancel:KCn}=BVe(queueMicrotask,!1),Vp={x:!1,y:!1};function dWe(){return Vp.x||Vp.y}function Xdn(t){return t==="x"||t==="y"?Vp[t]?null:(Vp[t]=!0,()=>{Vp[t]=!1}):Vp.x||Vp.y?null:(Vp.x=Vp.y=!0,()=>{Vp.x=Vp.y=!1})}function fWe(t,e){const n=Gdn(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function ISe(t){return!(t.pointerType==="touch"||dWe())}function Qdn(t,e,n={}){const[r,s,a]=fWe(t,n),o=l=>{if(!ISe(l))return;const{target:c}=l,u=e(c,l);if(typeof u!="function"||!c)return;const d=f=>{ISe(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),a}const hWe=(t,e)=>e?t===e?!0:hWe(t,e.parentElement):!1,Lde=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Zdn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Jdn(t){return Zdn.has(t.tagName)||t.tabIndex!==-1}const bM=new WeakSet;function FSe(t){return e=>{e.key==="Enter"&&t(e)}}function uQ(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const efn=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=FSe(()=>{if(bM.has(n))return;uQ(n,"down");const s=FSe(()=>{uQ(n,"up")}),a=()=>uQ(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function OSe(t){return Lde(t)&&!dWe()}function tfn(t,e,n={}){const[r,s,a]=fWe(t,n),o=l=>{const c=l.currentTarget;if(!OSe(l))return;bM.add(c);const u=e(c,l),d=(g,y)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",x),bM.has(c)&&bM.delete(c),OSe(g)&&typeof u=="function"&&u(g,{success:y})},f=g=>{d(g,c===window||c===document||n.useGlobalTarget||hWe(c,g.target))},x=g=>{d(g,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",x,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),uWe(l)&&(l.addEventListener("focus",u=>efn(u,s)),!Jdn(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),a}function pWe(t){return LB(t)&&"ownerSVGElement"in t}function nfn(t){return pWe(t)&&t.tagName==="svg"}const $u=t=>!!(t&&t.getVelocity),rfn=[...aWe,$l,p2],sfn=t=>rfn.find(iWe(t)),Dde=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function MSe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ifn(...t){return e=>{let n=!1;const r=t.map(s=>{const a=MSe(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():MSe(t[s],null)}}}}function afn(...t){return m.useCallback(ifn(...t),t)}class ofn extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=uWe(r)&&r.offsetWidth||0,a=this.props.sizeRef.current;a.height=n.offsetHeight||0,a.width=n.offsetWidth||0,a.top=n.offsetTop,a.left=n.offsetLeft,a.right=s-a.width-a.left}return null}componentDidUpdate(){}render(){return this.props.children}}function lfn({children:t,isPresent:e,anchorX:n,root:r}){const s=m.useId(),a=m.useRef(null),o=m.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=m.useContext(Dde),c=afn(a,t==null?void 0:t.ref);return m.useInsertionEffect(()=>{const{width:u,height:d,top:f,left:x,right:g}=o.current;if(e||!a.current||!u||!d)return;const y=n==="left"?`left: ${x}`:`right: ${g}`;a.current.dataset.motionPopId=s;const v=document.createElement("style");l&&(v.nonce=l);const C=r??document.head;return C.appendChild(v),v.sheet&&v.sheet.insertRule(`
[data-motion-pop-id="${s}"] {
position: absolute !important;
width: ${u}px !important;
height: ${d}px !important;
${y}px !important;
top: ${f}px !important;
}
`),()=>{C.contains(v)&&C.removeChild(v)}},[e]),i.jsx(ofn,{isPresent:e,childRef:a,sizeRef:o,children:m.cloneElement(t,{ref:c})})}const cfn=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:a,mode:o,anchorX:l,root:c})=>{const u=Cde(ufn),d=m.useId();let f=!0,x=m.useMemo(()=>(f=!1,{id:d,initial:e,isPresent:n,custom:s,onExitComplete:g=>{u.set(g,!0);for(const y of u.values())if(!y)return;r&&r()},register:g=>(u.set(g,!1),()=>u.delete(g))}),[n,u,r]);return a&&f&&(x={...x}),m.useMemo(()=>{u.forEach((g,y)=>u.set(y,!1))},[n]),m.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),o==="popLayout"&&(t=i.jsx(lfn,{isPresent:n,anchorX:l,root:c,children:t})),i.jsx(hz.Provider,{value:x,children:t})};function ufn(){return new Map}function mWe(t=!0){const e=m.useContext(hz);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,a=m.useId();m.useEffect(()=>{if(t)return s(a)},[t]);const o=m.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,o]:[!0]}const PF=t=>t.key||"";function RSe(t){const e=[];return m.Children.forEach(t,n=>{m.isValidElement(n)&&e.push(n)}),e}const nP=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:a="sync",propagate:o=!1,anchorX:l="left",root:c})=>{const[u,d]=mWe(o),f=m.useMemo(()=>RSe(t),[t]),x=o&&!u?[]:f.map(PF),g=m.useRef(!0),y=m.useRef(f),v=Cde(()=>new Map),[C,N]=m.useState(f),[P,T]=m.useState(f);DVe(()=>{g.current=!1,y.current=f;for(let $=0;$<P.length;$++){const L=PF(P[$]);x.includes(L)?v.delete(L):v.get(L)!==!0&&v.set(L,!1)}},[P,x.length,x.join("-")]);const M=[];if(f!==C){let $=[...f];for(let L=0;L<P.length;L++){const z=P[L],X=PF(z);x.includes(X)||($.splice(L,0,z),M.push(z))}return a==="wait"&&M.length&&($=M),T(RSe($)),N(f),null}const{forceRender:F}=m.useContext(wde);return i.jsx(i.Fragment,{children:P.map($=>{const L=PF($),z=o&&!u?!1:f===P||x.includes(L),X=()=>{if(v.has(L))v.set(L,!0);else return;let ne=!0;v.forEach(J=>{J||(ne=!1)}),ne&&(F==null||F(),T(y.current),o&&(d==null||d()),r&&r())};return i.jsx(cfn,{isPresent:z,initial:!g.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:c,onExitComplete:z?void 0:X,anchorX:l,children:$},L)})})},xWe=m.createContext({strict:!1}),LSe={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},bA={};for(const t in LSe)bA[t]={isEnabled:e=>LSe[t].some(n=>!!e[n])};function dfn(t){for(const e in t)bA[e]={...bA[e],...t[e]}}const ffn=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function qD(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||ffn.has(t)}let gWe=t=>!qD(t);function hfn(t){typeof t=="function"&&(gWe=e=>e.startsWith("on")?!qD(e):t(e))}try{hfn(require("@emotion/is-prop-valid").default)}catch{}function pfn(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(gWe(s)||n===!0&&qD(s)||!e&&!qD(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const pz=m.createContext({});function mz(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Nk(t){return typeof t=="string"||Array.isArray(t)}const Bde=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$de=["initial",...Bde];function xz(t){return mz(t.animate)||$de.some(e=>Nk(t[e]))}function bWe(t){return!!(xz(t)||t.variants)}function mfn(t,e){if(xz(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Nk(n)?n:void 0,animate:Nk(r)?r:void 0}}return t.inherit!==!1?e:{}}function xfn(t){const{initial:e,animate:n}=mfn(t,m.useContext(pz));return m.useMemo(()=>({initial:e,animate:n}),[DSe(e),DSe(n)])}function DSe(t){return Array.isArray(t)?t.join(" "):t}const Ak={};function gfn(t){for(const e in t)Ak[e]=t[e],Nde(e)&&(Ak[e].isCSSVariable=!0)}function yWe(t,{layout:e,layoutId:n}){return Rj.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Ak[t]||t==="opacity")}const bfn={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yfn=Mj.length;function vfn(t,e,n){let r="",s=!0;for(let a=0;a<yfn;a++){const o=Mj[a],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=cWe(l,Mde[o]);if(!c){s=!1;const d=bfn[o]||o;r+=`${d}(${u}) `}n&&(e[o]=u)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function Ude(t,e,n){const{style:r,vars:s,transformOrigin:a}=t;let o=!1,l=!1;for(const c in e){const u=e[c];if(Rj.has(c)){o=!0;continue}else if(Nde(c)){s[c]=u;continue}else{const d=cWe(u,Mde[c]);c.startsWith("origin")?(l=!0,a[c]=d):r[c]=d}}if(e.transform||(o||n?r.transform=vfn(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=a;r.transformOrigin=`${c} ${u} ${d}`}}const zde=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function vWe(t,e,n){for(const r in e)!$u(e[r])&&!yWe(r,n)&&(t[r]=e[r])}function wfn({transformTemplate:t},e){return m.useMemo(()=>{const n=zde();return Ude(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Cfn(t,e){const n=t.style||{},r={};return vWe(r,n,t),Object.assign(r,wfn(t,e)),r}function Sfn(t,e){const n={},r=Cfn(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Nfn={offset:"stroke-dashoffset",array:"stroke-dasharray"},Afn={offset:"strokeDashoffset",array:"strokeDasharray"};function jfn(t,e,n=1,r=0,s=!0){t.pathLength=1;const a=s?Nfn:Afn;t[a.offset]=ui.transform(-r);const o=ui.transform(e),l=ui.transform(n);t[a.array]=`${o} ${l}`}function wWe(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:a=1,pathOffset:o=0,...l},c,u,d){if(Ude(t,l,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:x}=t;f.transform&&(x.transform=f.transform,delete f.transform),(x.transform||f.transformOrigin)&&(x.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),x.transform&&(x.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox),e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),s!==void 0&&jfn(f,s,a,o,!1)}const CWe=()=>({...zde(),attrs:{}}),SWe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Efn(t,e,n,r){const s=m.useMemo(()=>{const a=CWe();return wWe(a,e,SWe(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};vWe(a,t.style,t),s.style={...a,...s.style}}return s}const _fn=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Hde(t){return typeof t!="string"||t.includes("-")?!1:!!(_fn.indexOf(t)>-1||/[A-Z]/u.test(t))}function kfn(t,e,n,{latestValues:r},s,a=!1){const l=(Hde(t)?Efn:Sfn)(e,r,s,t),c=pfn(e,typeof t=="string",a),u=t!==m.Fragment?{...c,...l,ref:n}:{},{children:d}=e,f=m.useMemo(()=>$u(d)?d.get():d,[d]);return m.createElement(t,{...u,children:f})}function BSe(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Vde(t,e,n,r){if(typeof e=="function"){const[s,a]=BSe(r);e=e(n!==void 0?n:t.custom,s,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,a]=BSe(r);e=e(n!==void 0?n:t.custom,s,a)}return e}function yM(t){return $u(t)?t.get():t}function Tfn({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:Pfn(n,r,s,t),renderState:e()}}function Pfn(t,e,n,r){const s={},a=r(t,{});for(const x in a)s[x]=yM(a[x]);let{initial:o,animate:l}=t;const c=xz(t),u=bWe(t);e&&u&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const f=d?l:o;if(f&&typeof f!="boolean"&&!mz(f)){const x=Array.isArray(f)?f:[f];for(let g=0;g<x.length;g++){const y=Vde(t,x[g]);if(y){const{transitionEnd:v,transition:C,...N}=y;for(const P in N){let T=N[P];if(Array.isArray(T)){const M=d?T.length-1:0;T=T[M]}T!==null&&(s[P]=T)}for(const P in v)s[P]=v[P]}}}return s}const NWe=t=>(e,n)=>{const r=m.useContext(pz),s=m.useContext(hz),a=()=>Tfn(t,e,r,s);return n?a():Cde(a)};function Wde(t,e,n){var a;const{style:r}=t,s={};for(const o in r)($u(r[o])||e.style&&$u(e.style[o])||yWe(o,t)||((a=n==null?void 0:n.getValue(o))==null?void 0:a.liveStyle)!==void 0)&&(s[o]=r[o]);return s}const Ifn=NWe({scrapeMotionValuesFromProps:Wde,createRenderState:zde});function AWe(t,e,n){const r=Wde(t,e,n);for(const s in t)if($u(t[s])||$u(e[s])){const a=Mj.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[a]=t[s]}return r}const Ffn=NWe({scrapeMotionValuesFromProps:AWe,createRenderState:CWe}),Ofn=Symbol.for("motionComponentSymbol");function d4(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Mfn(t,e,n){return m.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):d4(n)&&(n.current=r))},[e])}const qde=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Rfn="framerAppearId",jWe="data-"+qde(Rfn),EWe=m.createContext({});function Lfn(t,e,n,r,s){var v,C;const{visualElement:a}=m.useContext(pz),o=m.useContext(xWe),l=m.useContext(hz),c=m.useContext(Dde).reducedMotion,u=m.useRef(null);r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:a,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,f=m.useContext(EWe);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&Dfn(u.current,n,s,f);const x=m.useRef(!1);m.useInsertionEffect(()=>{d&&x.current&&d.update(n,l)});const g=n[jWe],y=m.useRef(!!g&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return DVe(()=>{d&&(x.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),y.current&&d.animationState&&d.animationState.animateChanges())}),m.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var N;(N=window.MotionHandoffMarkAsComplete)==null||N.call(window,g)}),y.current=!1),d.enteringChildren=void 0)}),d}function Dfn(t,e,n,r){const{layoutId:s,layout:a,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:_We(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!o||l&&d4(l),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:u})}function _We(t){if(t)return t.options.allowProjection!==!1?t.projection:_We(t.parent)}function dQ(t,{forwardMotionProps:e=!1}={},n,r){n&&dfn(n);const s=Hde(t)?Ffn:Ifn;function a(l,c){let u;const d={...m.useContext(Dde),...l,layoutId:Bfn(l)},{isStatic:f}=d,x=xfn(l),g=s(l,f);if(!f&&Sde){$fn();const y=Ufn(d);u=y.MeasureLayout,x.visualElement=Lfn(t,g,d,r,y.ProjectionNode)}return i.jsxs(pz.Provider,{value:x,children:[u&&x.visualElement?i.jsx(u,{visualElement:x.visualElement,...d}):null,kfn(t,l,Mfn(g,x.visualElement,c),g,f,e)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=m.forwardRef(a);return o[Ofn]=t,o}function Bfn({layoutId:t}){const e=m.useContext(wde).id;return e&&t!==void 0?e+"-"+t:t}function $fn(t,e){m.useContext(xWe).strict}function Ufn(t){const{drag:e,layout:n}=bA;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function zfn(t,e){if(typeof Proxy>"u")return dQ;const n=new Map,r=(a,o)=>dQ(a,o,t,e),s=(a,o)=>r(a,o);return new Proxy(s,{get:(a,o)=>o==="create"?r:(n.has(o)||n.set(o,dQ(o,void 0,t,e)),n.get(o))})}function kWe({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Hfn({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Vfn(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function fQ(t){return t===void 0||t===1}function mse({scale:t,scaleX:e,scaleY:n}){return!fQ(t)||!fQ(e)||!fQ(n)}function Xv(t){return mse(t)||TWe(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function TWe(t){return $Se(t.x)||$Se(t.y)}function $Se(t){return t&&t!=="0%"}function GD(t,e,n){const r=t-n,s=e*r;return n+s}function USe(t,e,n,r,s){return s!==void 0&&(t=GD(t,s,r)),GD(t,n,r)+e}function xse(t,e=0,n=1,r,s){t.min=USe(t.min,e,n,r,s),t.max=USe(t.max,e,n,r,s)}function PWe(t,{x:e,y:n}){xse(t.x,e.translate,e.scale,e.originPoint),xse(t.y,n.translate,n.scale,n.originPoint)}const zSe=.999999999999,HSe=1.0000000000001;function Wfn(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let a,o;for(let l=0;l<s;l++){a=n[l],o=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&h4(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,PWe(t,o)),r&&Xv(a.latestValues)&&h4(t,a.latestValues))}e.x<HSe&&e.x>zSe&&(e.x=1),e.y<HSe&&e.y>zSe&&(e.y=1)}function f4(t,e){t.min=t.min+e,t.max=t.max+e}function VSe(t,e,n,r,s=.5){const a=Go(t.min,t.max,s);xse(t,e,n,a,r)}function h4(t,e){VSe(t.x,e.x,e.scaleX,e.scale,e.originX),VSe(t.y,e.y,e.scaleY,e.scale,e.originY)}function IWe(t,e){return kWe(Vfn(t.getBoundingClientRect(),e))}function qfn(t,e,n){const r=IWe(t,n),{scroll:s}=e;return s&&(f4(r.x,s.offset.x),f4(r.y,s.offset.y)),r}const WSe=()=>({translate:0,scale:1,origin:0,originPoint:0}),p4=()=>({x:WSe(),y:WSe()}),qSe=()=>({min:0,max:0}),yl=()=>({x:qSe(),y:qSe()}),gse={current:null},FWe={current:!1};function Gfn(){if(FWe.current=!0,!!Sde)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>gse.current=t.matches;t.addEventListener("change",e),e()}else gse.current=!1}const Kfn=new WeakMap;function Yfn(t,e,n){for(const r in e){const s=e[r],a=n[r];if($u(s))t.addValue(r,s);else if($u(a))t.addValue(r,gA(s,{owner:t}));else if(a!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,gA(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const GSe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Xfn{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:a,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Fde,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=lf.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Bo.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!a,this.isControllingVariants=xz(n),this.isVariantNode=bWe(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const x in f){const g=f[x];c[x]!==void 0&&$u(g)&&g.set(c[x])}}mount(e){var n;this.current=e,Kfn.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,s)=>this.bindToMotionValue(s,r)),FWe.current||Gfn(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:gse.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),h2(this.notifyUpdate),h2(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Rj.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Bo.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in bA){const n=bA[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):yl()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<GSe.length;r++){const s=GSe[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,o=e[a];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=Yfn(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=gA(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(RB(r)||DB(r))?r=parseFloat(r):!sfn(r)&&p2.test(n)&&(r=lWe(e,n)),this.setBaseTarget(e,$u(r)?r.get():r)),$u(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var a;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=Vde(this.props,n,(a=this.presenceContext)==null?void 0:a.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!$u(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new RA),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Rde.render(this.render)}}class OWe extends Xfn{constructor(){super(...arguments),this.KeyframeResolver=qdn}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$u(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function MWe(t,{style:e,vars:n},r,s){const a=t.style;let o;for(o in e)a[o]=e[o];s==null||s.applyProjectionStyles(a,r);for(o in n)a.setProperty(o,n[o])}function Qfn(t){return window.getComputedStyle(t)}class Zfn extends OWe{constructor(){super(...arguments),this.type="html",this.renderInstance=MWe}readValueFromInstance(e,n){var r;if(Rj.has(n))return(r=this.projection)!=null&&r.isProjecting?lse(n):ddn(e,n);{const s=Qfn(e),a=(Nde(n)?s.getPropertyValue(n):s[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return IWe(e,n)}build(e,n,r){Ude(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Wde(e,n,r)}}const RWe=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Jfn(t,e,n,r){MWe(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(RWe.has(s)?s:qde(s),e.attrs[s])}class ehn extends OWe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yl}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Rj.has(n)){const r=oWe(n);return r&&r.default||0}return n=RWe.has(n)?n:qde(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return AWe(e,n,r)}build(e,n,r){wWe(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){Jfn(e,n,r,s)}mount(e){this.isSVGTag=SWe(e.tagName),super.mount(e)}}const thn=(t,e)=>Hde(t)?new ehn(e):new Zfn(e,{allowProjection:t!==m.Fragment});function U4(t,e,n){const r=t.getProps();return Vde(r,e,n!==void 0?n:r.custom,t)}const bse=t=>Array.isArray(t);function nhn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,gA(n))}function rhn(t){return bse(t)?t[t.length-1]||0:t}function shn(t,e){const n=U4(t,e);let{transitionEnd:r={},transition:s={},...a}=n||{};a={...a,...r};for(const o in a){const l=rhn(a[o]);nhn(t,o,l)}}function ihn(t){return!!($u(t)&&t.add)}function yse(t,e){const n=t.getValue("willChange");if(ihn(n))return n.add(e);if(!n&&Dc.WillChange){const r=new Dc.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function LWe(t){return t.props[jWe]}const ahn=t=>t!==null;function ohn(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(ahn),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}const lhn={type:"spring",stiffness:500,damping:25,restSpeed:10},chn=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),uhn={type:"keyframes",duration:.8},dhn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},fhn=(t,{keyframes:e})=>e.length>2?uhn:Rj.has(t)?t.startsWith("scale")?chn(e[1]):lhn:dhn;function hhn({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:a,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Gde=(t,e,n,r={},s,a)=>o=>{const l=Ode(r,t)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Wl(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:x=>{e.set(x),l.onUpdate&&l.onUpdate(x)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:a?void 0:s};hhn(l)||Object.assign(d,fhn(t,d)),d.duration&&(d.duration=Wl(d.duration)),d.repeatDelay&&(d.repeatDelay=Wl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(hse(d),d.delay===0&&(f=!0)),(Dc.instantAnimations||Dc.skipAnimations)&&(f=!0,hse(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!a&&e.get()!==void 0){const x=ohn(d.keyframes,l);if(x!==void 0){Bo.update(()=>{d.onUpdate(x),d.onComplete()});return}}return l.isSync?new Ide(d):new Odn(d)};function phn({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function DWe(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:a=t.getDefaultTransition(),transitionEnd:o,...l}=e;r&&(a=r);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const f=t.getValue(d,t.latestValues[d]??null),x=l[d];if(x===void 0||u&&phn(u,d))continue;const g={delay:n,...Ode(a||{},d)},y=f.get();if(y!==void 0&&!f.isAnimating&&!Array.isArray(x)&&x===y&&!g.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const N=LWe(t);if(N){const P=window.MotionHandoffAnimation(N,d,Bo);P!==null&&(g.startTime=P,v=!0)}}yse(t,d),f.start(Gde(d,f,x,t.shouldReduceMotion&&sWe.has(d)?{type:!1}:g,t,v));const C=f.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{Bo.update(()=>{o&&shn(t,o)})}),c}function BWe(t,e,n,r=0,s=1){const a=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,l=(o-1)*r;return typeof n=="function"?n(a,o):s===1?a*r:l-a*r}function vse(t,e,n={}){var c;const r=U4(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const a=r?()=>Promise.all(DWe(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:x}=s;return mhn(t,e,u,d,f,x,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function mhn(t,e,n=0,r=0,s=0,a=1,o){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(vse(c,e,{...o,delay:n+(typeof r=="function"?0:r)+BWe(t.variantChildren,c,r,s,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function xhn(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(a=>vse(t,a,n));r=Promise.all(s)}else if(typeof e=="string")r=vse(t,e,n);else{const s=typeof e=="function"?U4(t,e,n.custom):e;r=Promise.all(DWe(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function $We(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const ghn=$de.length;function UWe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?UWe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<ghn;n++){const r=$de[n],s=t.props[r];(Nk(s)||s===!1)&&(e[r]=s)}return e}const bhn=[...Bde].reverse(),yhn=Bde.length;function vhn(t){return e=>Promise.all(e.map(({animation:n,options:r})=>xhn(t,n,r)))}function whn(t){let e=vhn(t),n=KSe(),r=!0;const s=c=>(u,d)=>{var x;const f=U4(t,d,c==="exit"?(x=t.presenceContext)==null?void 0:x.custom:void 0);if(f){const{transition:g,transitionEnd:y,...v}=f;u={...u,...v,...y}}return u};function a(c){e=c(t)}function o(c){const{props:u}=t,d=UWe(t.parent)||{},f=[],x=new Set;let g={},y=1/0;for(let C=0;C<yhn;C++){const N=bhn[C],P=n[N],T=u[N]!==void 0?u[N]:d[N],M=Nk(T),F=N===c?P.isActive:null;F===!1&&(y=C);let $=T===d[N]&&T!==u[N]&&M;if($&&r&&t.manuallyAnimateOnMount&&($=!1),P.protectedKeys={...g},!P.isActive&&F===null||!T&&!P.prevProp||mz(T)||typeof T=="boolean")continue;const L=Chn(P.prevProp,T);let z=L||N===c&&P.isActive&&!$&&M||C>y&&M,X=!1;const ne=Array.isArray(T)?T:[T];let J=ne.reduce(s(N),{});F===!1&&(J={});const{prevResolvedValues:K={}}=P,te={...K,...J},fe=ae=>{z=!0,x.has(ae)&&(X=!0,x.delete(ae)),P.needsAnimating[ae]=!0;const W=t.getValue(ae);W&&(W.liveStyle=!1)};for(const ae in te){const W=J[ae],V=K[ae];if(g.hasOwnProperty(ae))continue;let ee=!1;bse(W)&&bse(V)?ee=!$We(W,V):ee=W!==V,ee?W!=null?fe(ae):x.add(ae):W!==void 0&&x.has(ae)?fe(ae):P.protectedKeys[ae]=!0}P.prevProp=T,P.prevResolvedValues=J,P.isActive&&(g={...g,...J}),r&&t.blockInitialAnimation&&(z=!1);const q=$&&L;z&&(!q||X)&&f.push(...ne.map(ae=>{const W={type:N};if(typeof ae=="string"&&r&&!q&&t.manuallyAnimateOnMount&&t.parent){const{parent:V}=t,ee=U4(V,ae);if(V.enteringChildren&&ee){const{delayChildren:oe}=ee.transition||{};W.delay=BWe(V.enteringChildren,t,oe)}}return{animation:ae,options:W}}))}if(x.size){const C={};if(typeof u.initial!="boolean"){const N=U4(t,Array.isArray(u.initial)?u.initial[0]:u.initial);N&&N.transition&&(C.transition=N.transition)}x.forEach(N=>{const P=t.getBaseTarget(N),T=t.getValue(N);T&&(T.liveStyle=!0),C[N]=P??null}),f.push({animation:C})}let v=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(v=!1),r=!1,v?e(f):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=t.variantChildren)==null||f.forEach(x=>{var g;return(g=x.animationState)==null?void 0:g.setActive(c,u)}),n[c].isActive=u;const d=o(c);for(const x in n)n[x].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:a,getState:()=>n,reset:()=>{n=KSe()}}}function Chn(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$We(e,t):!1}function Iv(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function KSe(){return{animate:Iv(!0),whileInView:Iv(),whileHover:Iv(),whileTap:Iv(),whileDrag:Iv(),whileFocus:Iv(),exit:Iv()}}class D2{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Shn extends D2{constructor(e){super(e),e.animationState||(e.animationState=whn(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();mz(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let Nhn=0;class Ahn extends D2{constructor(){super(...arguments),this.id=Nhn++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const jhn={animation:{Feature:Shn},exit:{Feature:Ahn}};function jk(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function rP(t){return{point:{x:t.pageX,y:t.pageY}}}const Ehn=t=>e=>Lde(e)&&t(e,rP(e));function q9(t,e,n,r){return jk(t,e,Ehn(n),r)}const zWe=1e-4,_hn=1-zWe,khn=1+zWe,HWe=.01,Thn=0-HWe,Phn=0+HWe;function xd(t){return t.max-t.min}function Ihn(t,e,n){return Math.abs(t-e)<=n}function YSe(t,e,n,r=.5){t.origin=r,t.originPoint=Go(e.min,e.max,t.origin),t.scale=xd(n)/xd(e),t.translate=Go(n.min,n.max,t.origin)-t.originPoint,(t.scale>=_hn&&t.scale<=khn||isNaN(t.scale))&&(t.scale=1),(t.translate>=Thn&&t.translate<=Phn||isNaN(t.translate))&&(t.translate=0)}function G9(t,e,n,r){YSe(t.x,e.x,n.x,r?r.originX:void 0),YSe(t.y,e.y,n.y,r?r.originY:void 0)}function XSe(t,e,n){t.min=n.min+e.min,t.max=t.min+xd(e)}function Fhn(t,e,n){XSe(t.x,e.x,n.x),XSe(t.y,e.y,n.y)}function QSe(t,e,n){t.min=e.min-n.min,t.max=t.min+xd(e)}function K9(t,e,n){QSe(t.x,e.x,n.x),QSe(t.y,e.y,n.y)}function $h(t){return[t("x"),t("y")]}const VWe=({current:t})=>t?t.ownerDocument.defaultView:null,ZSe=(t,e)=>Math.abs(t-e);function Ohn(t,e){const n=ZSe(t.x,e.x),r=ZSe(t.y,e.y);return Math.sqrt(n**2+r**2)}class WWe{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=pQ(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=Ohn(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!y)return;const{point:v}=x,{timestamp:C}=Jc;this.history.push({...v,timestamp:C});const{onStart:N,onMove:P}=this.handlers;g||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),P&&P(this.lastMoveEvent,x)},this.handlePointerMove=(x,g)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=hQ(g,this.transformPagePoint),Bo.update(this.updatePoint,!0)},this.handlePointerUp=(x,g)=>{this.end();const{onEnd:y,onSessionEnd:v,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=pQ(x.type==="pointercancel"?this.lastMoveEventInfo:hQ(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(x,N),v&&v(x,N)},!Lde(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=rP(e),c=hQ(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Jc;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(e,pQ(c,this.history)),this.removeListeners=vx(q9(this.contextWindow,"pointermove",this.handlePointerMove),q9(this.contextWindow,"pointerup",this.handlePointerUp),q9(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),h2(this.updatePoint)}}function hQ(t,e){return e?{point:e(t.point)}:t}function JSe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pQ({point:t},e){return{point:t,delta:JSe(t,qWe(e)),offset:JSe(t,Mhn(e)),velocity:Rhn(e,.1)}}function Mhn(t){return t[0]}function qWe(t){return t[t.length-1]}function Rhn(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=qWe(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Wl(e)));)n--;if(!r)return{x:0,y:0};const a=ll(s.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(s.x-r.x)/a,y:(s.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Lhn(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Go(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Go(n,t,r.max):Math.min(t,n)),t}function eNe(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Dhn(t,{top:e,left:n,bottom:r,right:s}){return{x:eNe(t.x,n,s),y:eNe(t.y,e,r)}}function tNe(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Bhn(t,e){return{x:tNe(t.x,e.x),y:tNe(t.y,e.y)}}function $hn(t,e){let n=.5;const r=xd(t),s=xd(e);return s>r?n=sx(e.min,e.max-r,t.min):r>s&&(n=sx(t.min,t.max-s,e.min)),Lc(0,1,n)}function Uhn(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const wse=.35;function zhn(t=wse){return t===!1?t=0:t===!0&&(t=wse),{x:nNe(t,"left","right"),y:nNe(t,"top","bottom")}}function nNe(t,e,n){return{min:rNe(t,e),max:rNe(t,n)}}function rNe(t,e){return typeof t=="number"?t:t[e]||0}const Hhn=new WeakMap;class Vhn{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=yl(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=f=>{const{dragSnapToOrigin:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(rP(f).point)},o=(f,x)=>{const{drag:g,dragPropagation:y,onDragStart:v}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Xdn(g),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),$h(N=>{let P=this.getAxisMotionValue(N).get()||0;if(ex.test(P)){const{projection:T}=this.visualElement;if(T&&T.layout){const M=T.layout.layoutBox[N];M&&(P=xd(M)*(parseFloat(P)/100))}}this.originPoint[N]=P}),v&&Bo.postRender(()=>v(f,x)),yse(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},l=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x;const{dragPropagation:g,dragDirectionLock:y,onDirectionLock:v,onDrag:C}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:N}=x;if(y&&this.currentDirection===null){this.currentDirection=Whn(N),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),C&&C(f,x)},c=(f,x)=>{this.latestPointerEvent=f,this.latestPanInfo=x,this.stop(f,x),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>$h(f=>{var x;return this.getAnimationState(f)==="paused"&&((x=this.getAxisMotionValue(f).animation)==null?void 0:x.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new WWe(e,{onSessionStart:a,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:VWe(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Bo.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!IF(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Lhn(o,this.constraints[e],this.elastic[e])),a.set(o)}resolveConstraints(){var a;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(a=this.visualElement.projection)==null?void 0:a.layout,s=this.constraints;e&&d4(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Dhn(r.layoutBox,e):this.constraints=!1,this.elastic=zhn(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&$h(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Uhn(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!d4(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=qfn(r,s.root,this.visualElement.getTransformPagePoint());let o=Bhn(s.layout.layoutBox,a);if(n){const l=n(Hfn(o));this.hasMutatedConstraints=!!l,l&&(o=kWe(l))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=$h(d=>{if(!IF(d,n,this.currentDirection))return;let f=c[d]||{};o&&(f={min:0,max:0});const x=s?200:1e6,g=s?40:1e7,y={type:"inertia",velocity:r?e[d]:0,bounceStiffness:x,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...a,...f};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return yse(this.visualElement,e),r.start(Gde(e,r,0,n,this.visualElement,!1))}stopAnimation(){$h(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){$h(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){$h(n=>{const{drag:r}=this.getProps();if(!IF(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];a.set(e[n]-Go(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!d4(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};$h(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=$hn({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),$h(o=>{if(!IF(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(Go(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;Hhn.set(this.visualElement,this);const e=this.visualElement.current,n=q9(e,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();d4(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,a=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Bo.read(r);const o=jk(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&($h(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{o(),n(),a(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:o=wse,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:a,dragElastic:o,dragMomentum:l}}}function IF(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Whn(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class qhn extends D2{constructor(e){super(e),this.removeGroupControls=dl,this.removeListeners=dl,this.controls=new Vhn(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dl}unmount(){this.removeGroupControls(),this.removeListeners()}}const sNe=t=>(e,n)=>{t&&Bo.postRender(()=>t(e,n))};class Ghn extends D2{constructor(){super(...arguments),this.removePointerDownListener=dl}onPointerDown(e){this.session=new WWe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:VWe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:sNe(e),onStart:sNe(n),onMove:r,onEnd:(a,o)=>{delete this.session,s&&Bo.postRender(()=>s(a,o))}}}mount(){this.removePointerDownListener=q9(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vM={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function iNe(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const A7={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ui.test(t))t=parseFloat(t);else return t;const n=iNe(t,e.target.x),r=iNe(t,e.target.y);return`${n}% ${r}%`}},Khn={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=p2.parse(t);if(s.length>5)return r;const a=p2.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const u=Go(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),a(s)}};let mQ=!1;class Yhn extends m.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:a}=e;gfn(Xhn),a&&(n.group&&n.group.add(a),r&&r.register&&s&&r.register(a),mQ&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),vM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,mQ=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||Bo.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Rde.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;mQ=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function GWe(t){const[e,n]=mWe(),r=m.useContext(wde);return i.jsx(Yhn,{...t,layoutGroup:r,switchLayoutGroup:m.useContext(EWe),isPresent:e,safeToRemove:n})}const Xhn={borderRadius:{...A7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:A7,borderTopRightRadius:A7,borderBottomLeftRadius:A7,borderBottomRightRadius:A7,boxShadow:Khn};function Qhn(t,e,n){const r=$u(t)?t:gA(t);return r.start(Gde("",r,e,n)),r.animation}const Zhn=(t,e)=>t.depth-e.depth;class Jhn{constructor(){this.children=[],this.isDirty=!1}add(e){rT(this.children,e),this.isDirty=!0}remove(e){sT(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Zhn),this.isDirty=!1,this.children.forEach(e)}}function epn(t,e){const n=lf.now(),r=({timestamp:s})=>{const a=s-n;a>=e&&(h2(r),t(a-e))};return Bo.setup(r,!0),()=>h2(r)}const KWe=["TopLeft","TopRight","BottomLeft","BottomRight"],tpn=KWe.length,aNe=t=>typeof t=="string"?parseFloat(t):t,oNe=t=>typeof t=="number"||ui.test(t);function npn(t,e,n,r,s,a){s?(t.opacity=Go(0,n.opacity??1,rpn(r)),t.opacityExit=Go(e.opacity??1,0,spn(r))):a&&(t.opacity=Go(e.opacity??1,n.opacity??1,r));for(let o=0;o<tpn;o++){const l=`border${KWe[o]}Radius`;let c=lNe(e,l),u=lNe(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||oNe(c)===oNe(u)?(t[l]=Math.max(Go(aNe(c),aNe(u),r),0),(ex.test(u)||ex.test(c))&&(t[l]+="%")):t[l]=u}(e.rotate||n.rotate)&&(t.rotate=Go(e.rotate||0,n.rotate||0,r))}function lNe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const rpn=YWe(0,.5,Bie),spn=YWe(.5,.95,dl);function YWe(t,e,n){return r=>r<t?0:r>e?1:n(sx(t,e,r))}function cNe(t,e){t.min=e.min,t.max=e.max}function Mh(t,e){cNe(t.x,e.x),cNe(t.y,e.y)}function uNe(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function dNe(t,e,n,r,s){return t-=e,t=GD(t,1/n,r),s!==void 0&&(t=GD(t,1/s,r)),t}function ipn(t,e=0,n=1,r=.5,s,a=t,o=t){if(ex.test(e)&&(e=parseFloat(e),e=Go(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=Go(a.min,a.max,r);t===a&&(l-=e),t.min=dNe(t.min,e,n,l,s),t.max=dNe(t.max,e,n,l,s)}function fNe(t,e,[n,r,s],a,o){ipn(t,e[n],e[r],e[s],e.scale,a,o)}const apn=["x","scaleX","originX"],opn=["y","scaleY","originY"];function hNe(t,e,n,r){fNe(t.x,e,apn,n?n.x:void 0,r?r.x:void 0),fNe(t.y,e,opn,n?n.y:void 0,r?r.y:void 0)}function pNe(t){return t.translate===0&&t.scale===1}function XWe(t){return pNe(t.x)&&pNe(t.y)}function mNe(t,e){return t.min===e.min&&t.max===e.max}function lpn(t,e){return mNe(t.x,e.x)&&mNe(t.y,e.y)}function xNe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function QWe(t,e){return xNe(t.x,e.x)&&xNe(t.y,e.y)}function gNe(t){return xd(t.x)/xd(t.y)}function bNe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class cpn{constructor(){this.members=[]}add(e){rT(this.members,e),e.scheduleRender()}remove(e){if(sT(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const a=this.members[s];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function upn(t,e,n){let r="";const s=t.x.translate/e.x,a=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||a||o)&&(r=`translate3d(${s}px, ${a}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:x,skewX:g,skewY:y}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),x&&(r+=`rotateY(${x}deg) `),g&&(r+=`skewX(${g}deg) `),y&&(r+=`skewY(${y}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const xQ=["","X","Y","Z"],dpn=1e3;let fpn=0;function gQ(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function ZWe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=LWe(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Bo,!(s||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&ZWe(r)}function JWe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=fpn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(mpn),this.nodes.forEach(ypn),this.nodes.forEach(vpn),this.nodes.forEach(xpn)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Jhn)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new RA),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=pWe(o)&&!nfn(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let d,f=0;const x=()=>this.root.updateBlockedByResize=!1;Bo.read(()=>{f=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==f&&(f=g,this.root.updateBlockedByResize=!0,d&&d(),d=epn(x,250),vM.hasAnimatedSinceResize&&(vM.hasAnimatedSinceResize=!1,this.nodes.forEach(wNe)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:x,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||Apn,{onLayoutAnimationStart:v,onLayoutAnimationComplete:C}=u.getProps(),N=!this.targetLayout||!QWe(this.targetLayout,g),P=!f&&x;if(this.options.layoutRoot||this.resumeFrom||P||f&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Ode(y,"layout"),onPlay:v,onComplete:C};(u.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(d,P)}else f||wNe(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),h2(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(wpn),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZWe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(yNe);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(vNe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(bpn),this.nodes.forEach(hpn),this.nodes.forEach(ppn)):this.nodes.forEach(vNe),this.clearAllSnapshots();const l=lf.now();Jc.delta=Lc(0,1e3/60,l-Jc.timestamp),Jc.timestamp=l,Jc.isProcessing=!0,aQ.update.process(Jc),aQ.preRender.process(Jc),aQ.render.process(Jc),Jc.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Rde.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gpn),this.sharedNodes.forEach(Cpn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Bo.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Bo.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xd(this.snapshot.measuredBox.x)&&!xd(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=yl(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!XWe(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||Xv(this.latestValues)||d)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),jpn(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return yl();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Epn))){const{scroll:d}=this.root;d&&(f4(l.x,d.offset.x),f4(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=yl();if(Mh(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:x}=d;d!==this.root&&f&&x.layoutScroll&&(f.wasRoot&&Mh(l,o),f4(l.x,f.offset.x),f4(l.y,f.offset.y))}return l}applyTransform(o,l=!1){const c=yl();Mh(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&h4(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Xv(d.latestValues)&&h4(c,d.latestValues)}return Xv(this.latestValues)&&h4(c,this.latestValues),c}removeTransform(o){const l=yl();Mh(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Xv(u.latestValues))continue;mse(u.latestValues)&&u.updateSnapshot();const d=yl(),f=u.measurePageBox();Mh(d,f),hNe(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return Xv(this.latestValues)&&hNe(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Jc.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var x;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(x=this.parent)!=null&&x.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!(!this.layout||!(d||f))){if(this.resolvedRelativeTargetAt=Jc.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=yl(),this.relativeTargetOrigin=yl(),K9(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Mh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=yl(),this.targetWithTransforms=yl()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Fhn(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Mh(this.target,this.layout.layoutBox),PWe(this.target,this.targetDelta)):Mh(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=yl(),this.relativeTargetOrigin=yl(),K9(this.relativeTargetOrigin,this.target,g.target),Mh(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||mse(this.parent.latestValues)||TWe(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var y;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Jc.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Mh(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,x=this.treeScale.y;Wfn(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=yl());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(uNe(this.prevProjectionDelta.x,this.projectionDelta.x),uNe(this.prevProjectionDelta.y,this.projectionDelta.y)),G9(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==x||!bNe(this.projectionDelta.x,this.prevProjectionDelta.x)||!bNe(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=p4(),this.projectionDelta=p4(),this.projectionDeltaWithTransform=p4()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=p4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const x=yl(),g=c?c.source:void 0,y=this.layout?this.layout.source:void 0,v=g!==y,C=this.getStack(),N=!C||C.members.length<=1,P=!!(v&&!N&&this.options.crossfade===!0&&!this.path.some(Npn));this.animationProgress=0;let T;this.mixTargetDelta=M=>{const F=M/1e3;CNe(f.x,o.x,F),CNe(f.y,o.y,F),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(K9(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Spn(this.relativeTarget,this.relativeTargetOrigin,x,F),T&&lpn(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=yl()),Mh(T,this.relativeTarget)),v&&(this.animationValues=d,npn(d,u,this.latestValues,F,P,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(h2(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Bo.update(()=>{vM.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=gA(0)),this.currentAnimation=Qhn(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(dpn),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&eqe(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||yl();const f=xd(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const x=xd(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+x}Mh(l,c),h4(l,d),G9(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new cpn),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&gQ("z",o,u,this.animationValues);for(let d=0;d<xQ.length;d++)gQ(`rotate${xQ[d]}`,o,u,this.animationValues),gQ(`skew${xQ[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=yM(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=yM(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Xv(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=upn(this.projectionDeltaWithTransform,this.treeScale,d);c&&(f=c(d,f)),o.transform=f;const{x,y:g}=this.projectionDelta;o.transformOrigin=`${x.origin*100}% ${g.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const y in Ak){if(d[y]===void 0)continue;const{correct:v,applyTo:C,isCSSVariable:N}=Ak[y],P=f==="none"?d[y]:v(d[y],u);if(C){const T=C.length;for(let M=0;M<T;M++)o[C[M]]=P}else N?this.options.visualElement.renderState.vars[y]=P:o[y]=P}this.options.layoutId&&(o.pointerEvents=u===this?yM(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(yNe),this.root.sharedNodes.clear()}}}function hpn(t){t.updateLayout()}function ppn(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:a}=t.options,o=e.source!==t.layout.source;a==="size"?$h(f=>{const x=o?e.measuredBox[f]:e.layoutBox[f],g=xd(x);x.min=r[f].min,x.max=x.min+g}):eqe(a,e.layoutBox,r)&&$h(f=>{const x=o?e.measuredBox[f]:e.layoutBox[f],g=xd(r[f]);x.max=x.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+g)});const l=p4();G9(l,r,e.layoutBox);const c=p4();o?G9(c,t.applyTransform(s,!0),e.measuredBox):G9(c,r,e.layoutBox);const u=!XWe(l);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:x,layout:g}=f;if(x&&g){const y=yl();K9(y,e.layoutBox,x.layoutBox);const v=yl();K9(v,r,g.layoutBox),QWe(y,v)||(d=!0),f.options.layoutRoot&&(t.relativeTarget=v,t.relativeTargetOrigin=y,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function mpn(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function xpn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function gpn(t){t.clearSnapshot()}function yNe(t){t.clearMeasurements()}function vNe(t){t.isLayoutDirty=!1}function bpn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function wNe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ypn(t){t.resolveTargetDelta()}function vpn(t){t.calcProjection()}function wpn(t){t.resetSkewAndRotation()}function Cpn(t){t.removeLeadSnapshot()}function CNe(t,e,n){t.translate=Go(e.translate,0,n),t.scale=Go(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function SNe(t,e,n,r){t.min=Go(e.min,n.min,r),t.max=Go(e.max,n.max,r)}function Spn(t,e,n,r){SNe(t.x,e.x,n.x,r),SNe(t.y,e.y,n.y,r)}function Npn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Apn={duration:.45,ease:[.4,0,.1,1]},NNe=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ANe=NNe("applewebkit/")&&!NNe("chrome/")?Math.round:dl;function jNe(t){t.min=ANe(t.min),t.max=ANe(t.max)}function jpn(t){jNe(t.x),jNe(t.y)}function eqe(t,e,n){return t==="position"||t==="preserve-aspect"&&!Ihn(gNe(e),gNe(n),.2)}function Epn(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const _pn=JWe({attachResizeListener:(t,e)=>jk(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bQ={current:void 0},tqe=JWe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!bQ.current){const t=new _pn({});t.mount(window),t.setOptions({layoutScroll:!0}),bQ.current=t}return bQ.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),kpn={pan:{Feature:Ghn},drag:{Feature:qhn,ProjectionNode:tqe,MeasureLayout:GWe}};function ENe(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,a=r[s];a&&Bo.postRender(()=>a(e,rP(e)))}class Tpn extends D2{mount(){const{current:e}=this.node;e&&(this.unmount=Qdn(e,(n,r)=>(ENe(this.node,r,"Start"),s=>ENe(this.node,s,"End"))))}unmount(){}}class Ppn extends D2{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vx(jk(this.node.current,"focus",()=>this.onFocus()),jk(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function _Ne(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),a=r[s];a&&Bo.postRender(()=>a(e,rP(e)))}class Ipn extends D2{mount(){const{current:e}=this.node;e&&(this.unmount=tfn(e,(n,r)=>(_Ne(this.node,r,"Start"),(s,{success:a})=>_Ne(this.node,s,a?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Cse=new WeakMap,yQ=new WeakMap,Fpn=t=>{const e=Cse.get(t.target);e&&e(t)},Opn=t=>{t.forEach(Fpn)};function Mpn({root:t,...e}){const n=t||document;yQ.has(n)||yQ.set(n,{});const r=yQ.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Opn,{root:t,...e})),r[s]}function Rpn(t,e,n){const r=Mpn(e);return Cse.set(t,n),r.observe(t),()=>{Cse.delete(t),r.unobserve(t)}}const Lpn={some:0,all:1};class Dpn extends D2{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:a}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Lpn[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),x=u?d:f;x&&x(c)};return Rpn(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Bpn(e,n))&&this.startObserver()}unmount(){}}function Bpn({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const $pn={inView:{Feature:Dpn},tap:{Feature:Ipn},focus:{Feature:Ppn},hover:{Feature:Tpn}},Upn={layout:{ProjectionNode:tqe,MeasureLayout:GWe}},zpn={...jhn,...$pn,...kpn,...Upn},Ao=zfn(zpn,thn);function Kde({markets:t=[],value:e="",onChange:n=()=>{},loading:r=!1,iconsBaseUrl:s="https://app.hyperliquid.xyz/coins",mode:a="single",pairWhitelist:o=null,pairBase:l=[],showIcon:c=!0}){const[u,d]=m.useState(!1),[f,x]=m.useState(!1),[g,y]=m.useState(""),[v,C]=m.useState(0),[N,P]=m.useState(0),[T,M]=m.useState(320),[F,$]=m.useState("vol"),[L,z]=m.useState("desc"),[X,ne]=m.useState("all"),[J,K]=m.useState(()=>{try{const nt=localStorage.getItem("favCoins");return nt?new Set(JSON.parse(nt)):new Set}catch{return new Set}}),te=m.useRef(null),fe=m.useRef(null),q=150,se={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},ae=nt=>{var Be;const Le=(Be=nt==null?void 0:nt.split("/")[0])==null?void 0:Be.replace("-USD","").replace("/USD","");return se[Le]||Le},W=nt=>nt==null||isNaN(nt)?"--":Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:2}).format(Number(nt)),V=(nt,Le=6)=>nt==null||isNaN(nt)?"--":Number(nt).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:Le}),ee=nt=>{const Le=new Set(J);Le.has(nt)?Le.delete(nt):Le.add(nt),K(Le),localStorage.setItem("favCoins",JSON.stringify([...Le]))},oe=nt=>{F===nt?z(Le=>Le==="asc"?"desc":"asc"):($(nt),z("desc"))},de=m.useMemo(()=>((t==null?void 0:t.map(Le=>{const Be=Le.rawSymbol||Le.symbol||Le.coin||Le.ticker||"";let ht=Le.symbol||Le.coin||Le.ticker||Be,pt=Le.builder||Le.dex||"";if(Le.kind==="hip3"){const Je=Be.indexOf(":");!pt&&Je>=0&&(pt=Be.slice(0,Je),ht=Be.slice(Je+1))}const Gt=Le.lastPrice??Le.last??Le.markPrice??null,wt=Le.change24hPct??Le.chg24??null,nn=Le.volume??Le.vol??Le.dayNtlVlm??null,cn=Le.fundingRate??Le.funding??null,Un=Le.openInterest??Le.oi??null,Xt=Le.openInterestUsd??Le.oiUsd??(Un!=null&&Gt!=null?Number(Un)*Number(Gt):null),an=Le.leverage!=null?Le.leverage:Le.lev!=null?Le.lev:null,Jt=Le.kind||(pt?"hip3":"perp"),Ye=Le.coin||ht.replace(/-USDH$/,"").replace(/-USDC$/,"").replace(/-USD$/,"").replace(/\/USD$/,"");return{kind:Jt,builder:pt,dex:Le.dex||"",symbol:ht,rawSymbol:Be,last:Gt,chg24:wt,vol:nn,funding:cn,openInterest:Xt,leverage:an!=null&&isFinite(an)?Math.floor(an):null,coinForChange:Ye}}))??[]).filter(Le=>Le.symbol),[t]),Ce=m.useMemo(()=>{const nt=new Map;for(const Le of de){const Be=Le.symbol.replace("-USD","").replace("/USD","");nt.set(Be,Le)}return nt},[de]),me=m.useMemo(()=>{if(a!=="pair")return[];const nt=de.filter(nn=>nn.kind!=="hip3"),Le=nt.map(nn=>nn.symbol.replace("-USD","").replace("/USD","")),Be=Array.from(new Set(Le)),ht=Array.isArray(o)?new Set(o):null;let pt=Array.isArray(l)&&l.length?l:nt.slice().sort((nn,cn)=>Number(cn.vol||0)-Number(nn.vol||0)).slice(0,30).map(nn=>nn.symbol.replace("-USD","").replace("/USD",""));pt=pt.filter(nn=>Be.includes(nn));const Gt=[],wt=new Set;for(let nn=0;nn<pt.length;nn++){const cn=pt[nn];for(let Un=0;Un<Be.length;Un++){const Xt=Be[Un];if(!cn||!Xt||cn===Xt)continue;const an=`${cn}/${Xt}`;if(wt.has(an)||ht&&!ht.has(an))continue;wt.add(an);const Jt=Ce.get(cn),Ye=Ce.get(Xt),Je=Jt&&Ye&&Number(Jt.last)>0&&Number(Ye.last)>0?Number(Jt.last)/Number(Ye.last):null,It=Jt&&Ye?Math.min(Number(Jt.vol||0),Number(Ye.vol||0)):null;if(Gt.push({kind:"pair",builder:"",dex:"",symbol:an,rawSymbol:an,last:Je,chg24:null,vol:It,funding:null,openInterest:null,leverage:null,coinForChange:an}),Gt.length>=300)return Gt}}return Gt},[a,de,o,l,Ce]),we=m.useMemo(()=>de.some(nt=>nt.kind==="hip3"),[de]);m.useEffect(()=>{a==="pair"&&($("vol"),z("desc"),ne("perps"))},[a]),m.useEffect(()=>{!we&&X==="hip3"&&ne("all")},[we,X]),m.useEffect(()=>{a==="pair"&&($("vol"),z("desc"),ne("perps"))},[a]);const xe=m.useMemo(()=>{const nt=g.trim().toLowerCase();let Be=a==="pair"?me.slice():de.slice();a!=="pair"&&(X==="perps"?Be=Be.filter(pt=>pt.kind!=="hip3"):X==="hip3"&&(Be=Be.filter(pt=>pt.kind==="hip3"))),nt&&(Be=Be.filter(pt=>pt.symbol.toLowerCase().includes(nt)));const ht=pt=>pt==null||isNaN(Number(pt))?NaN:Number(pt);return Be.sort((pt,Gt)=>{const wt=J.has(pt.symbol)?1:0,nn=J.has(Gt.symbol)?1:0;if(wt!==nn)return nn-wt;const cn=ht(pt[F]),Un=ht(Gt[F]),Xt=isNaN(cn),an=isNaN(Un);return Xt&&an?pt.symbol.localeCompare(Gt.symbol):Xt?1:an?-1:cn===Un?pt.symbol.localeCompare(Gt.symbol):L==="asc"?cn-Un:Un-cn}),Be},[a,de,me,g,J,F,L,X]),be=()=>{const nt=fe.current;if(!nt)return;const Le=nt.getBoundingClientRect(),Be=getComputedStyle(nt),ht=parseFloat(Be.paddingLeft)||0,pt=document.documentElement.clientWidth,Gt=16,nn=Math.min(740,pt-Gt*2);let cn=Le.left+ht;cn+nn>pt-Gt&&(cn=pt-Gt-nn),cn<Gt&&(cn=Gt),M(nn),P(cn),C(Le.bottom+8)},je=()=>{be(),d(!0),requestAnimationFrame(()=>x(!0))},Ie=()=>{x(!1),setTimeout(()=>d(!1),q)};m.useEffect(()=>{const nt=Be=>Be.key==="Escape"&&u&&Ie(),Le=Be=>{var ht;return u&&!((ht=te.current)!=null&&ht.contains(Be.target))&&Ie()};return document.addEventListener("keydown",nt),document.addEventListener("mousedown",Le),document.addEventListener("touchstart",Le,{passive:!0}),()=>{document.removeEventListener("keydown",nt),document.removeEventListener("mousedown",Le),document.removeEventListener("touchstart",Le)}},[u]),m.useLayoutEffect(()=>{if(!u)return;be();const nt=()=>be(),Le=()=>be();return window.addEventListener("scroll",nt,!0),window.addEventListener("resize",Le),()=>{window.removeEventListener("scroll",nt,!0),window.removeEventListener("resize",Le)}},[u]);const Re=e&&e.length>8?"min-w-[120px]":e&&e.length>6?"min-w-[108px]":"min-w-[96px]",Qe=nt=>{nt.currentTarget.src="data:image/svg+xml;utf8,"+encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><rect width='100%' height='100%' fill='#2a2a2a'/></svg>")},Ke=({active:nt,dir:Le})=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:`w-3 h-3 ml-1 ${nt?"text-white":"text-[#6a6a6a]"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Le==="asc"?i.jsx("path",{d:"M7 14l5-5 5 5"}):i.jsx("path",{d:"M7 10l5 5 5-5"})}),dt=m.useMemo(()=>a!=="pair"?e||"Select":e||"Select Pair",[a,e]),tt=({children:nt})=>i.jsx("span",{className:"tabular-nums whitespace-nowrap",children:nt});return i.jsxs("div",{className:`relative ${Re} z-[30]`,ref:te,children:[i.jsx("div",{ref:fe,className:" text-white px-1 py-2 rounded cursor-pointer text-[14px] font-medium font-['Inter'] select-none leading-none",onClick:()=>u?Ie():je(),children:i.jsxs("div",{className:"flex items-center justify-start gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"truncate text-white font-inter text-[14px] not-italic font-medium leading-4 tracking-[-0.28px]",children:dt}),i.jsx("span",{className:"inline-flex px-1 py-[2px] justify-center items-center gap-[10px] rounded-[6px] bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-inter text-[11px] not-italic font-medium leading-4 w-12",children:(()=>{const nt=de.find(Le=>a==="pair"?Le.symbol===e:Le.rawSymbol===e||Le.symbol===e||Le.coinForChange===e);return nt&&nt.kind==="hip3"?"HIP-3":"PERP"})()})]}),i.jsx("span",{className:"text-[#929292] ml-auto",children:"▾"})," "]})}),u&&i.jsx("div",{className:`fixed inset-0 z-[55] bg-black/50 transition-opacity duration-[${q}ms] ${f?"opacity-100":"opacity-0"}`,"aria-hidden":!0,onClick:Ie}),u&&i.jsx("div",{className:`fixed z-[60] transition-all duration-[${q}ms] ease-out ${f?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-1 scale-[0.99]"}`,style:{top:v,left:N,width:T,willChange:"transform, opacity"},children:i.jsxs("div",{className:"bg-[#121212] border border-[#2a2a2a] shadow-xl rounded-md overflow-hidden",children:[i.jsxs("div",{className:"p-2",children:[a!=="pair"&&we&&i.jsx("div",{className:"mb-2 inline-flex text-[11px] bg-[#1b1b1b] rounded-lg p-0.5",children:[["all","All Coins"],["perps","Perps"],["hip3","HIP-3"]].map(([nt,Le])=>i.jsx("button",{className:`px-2 py-1 rounded-md font-bold ${X===nt?"bg-[#262626] text-white":"text-[#8a8a8a]"}`,onClick:()=>ne(nt),children:Le},nt))}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:g,onChange:nt=>y(nt.target.value),placeholder:a==="pair"?"Search pairs (e.g., BTC/ETH)":"Search markets...",className:"w-full pr-8 py-1.5 pl-2.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-[12px] font-medium placeholder:text-[#535353] focus:outline-none leading-none",autoFocus:!0}),i.jsx("div",{className:"absolute right-2 top-1 pointer-events-none",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-5 h-5 text-[#646464]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7",strokeWidth:"1.5"}),i.jsx("path",{d:"M20 20L17 17",strokeWidth:"1.5"})]})})]})]}),i.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:i.jsxs("table",{className:"w-full text-[12px] font-inter table-fixed",children:[i.jsxs("colgroup",{children:[i.jsx("col",{className:"w-[44px]"}),i.jsx("col",{className:"w-[220px]"}),i.jsx("col",{className:"w-[80px]"}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("col",{className:"w-[160px]"}),i.jsx("col",{}),i.jsx("col",{}),i.jsx("col",{})]})]}),i.jsx("thead",{className:"sticky top-0 bg-[#141414] border-b border-[#1f1f1f] text-[#9B9B9B]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left align-middle"}),i.jsx("th",{className:"text-left align-middle",children:a==="pair"?"Pair":"Symbol"}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("last"),children:["Last Price",i.jsx("span",{className:"ml-1",children:i.jsx(Ke,{active:F==="last",dir:F==="last"?L:"desc"})})]})}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("chg24"),children:["24h Change",i.jsx("span",{className:"ml-1",children:i.jsx(Ke,{active:F==="chg24",dir:F==="chg24"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("vol"),children:["Vol",i.jsx("span",{className:"ml-1",children:i.jsx(Ke,{active:F==="vol",dir:F==="vol"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("funding"),children:["Funding",i.jsx("span",{className:"ml-1",children:i.jsx(Ke,{active:F==="funding",dir:F==="funding"?L:"desc"})})]})}),i.jsx("th",{className:"text-right align-middle",children:i.jsxs("span",{className:"inline-flex items-center cursor-pointer select-none",onClick:()=>oe("openInterest"),children:["Open Int.",i.jsx("span",{className:"ml-1",children:i.jsx(Ke,{active:F==="openInterest",dir:F==="openInterest"?L:"desc"})})]})})]})]})}),i.jsx("tbody",{className:"divide-y divide-[#1f1f1f]",children:r?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-4 text-[#888888]",colSpan:a==="pair"?3:7,children:"Loading..."})}):xe.length===0?i.jsx("tr",{children:i.jsx("td",{className:"px-3 py-4 text-[#888888]",colSpan:a==="pair"?3:7,children:"No matches found"})}):xe.map(nt=>{const Le=J.has(nt.symbol),Be=a==="pair"&&nt.symbol.includes("/"),[ht,pt]=Be?nt.symbol.split("/"):[null,null],Gt=`${nt.kind||"perp"}:${nt.builder||""}:${nt.rawSymbol||nt.symbol}`;return i.jsxs("tr",{className:"hover:bg-[#1b1b1b]/70 cursor-pointer",onClick:()=>{const wt=a==="pair"?nt.symbol:nt.kind==="hip3"&&nt.rawSymbol?nt.rawSymbol:nt.coinForChange;n(wt),Ie()},children:[i.jsx("td",{className:"align-middle",children:i.jsx("button",{onClick:wt=>{wt.stopPropagation(),ee(nt.symbol)},className:`shrink-0 bg-transparent ${Le?"text-yellow-400":"text-[#9b9b9b]"} hover:text-yellow-400`,title:Le?"Unfavorite":"Favorite",children:Le?i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M12 .587l3.668 7.568L24 9.75l-6 5.85 1.42 8.41L12 19.77 4.58 24l1.42-8.4L0 9.75l8.332-1.595z"})}):i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M12 17.77l-6.18 3.73 1.42-6.82L2 9.75l6.91-1.32L12 2l3.09 6.43L22 9.75l-5.24 4.93 1.42 6.82z",strokeWidth:"1.2"})})})}),i.jsx("td",{className:"align-middle",children:i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c&&i.jsx(i.Fragment,{children:Be?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:`${s}/${ht}.svg`,alt:ht,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Qe}),i.jsx("span",{className:"text-[#8a8a8a] text-xs",children:"/"}),i.jsx("img",{src:`${s}/${pt}.svg`,alt:pt,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Qe})]}):i.jsx("img",{src:nt.kind==="hip3"?`${s}/${nt.builder}:${nt.symbol.replace(/-USDC$/,"").replace(/-USDH$/,"")}.svg`:`${s}/${ae(nt.symbol)}.svg`,alt:nt.symbol,className:"rounded-full w-4 h-4 bg-gray-700",loading:"lazy",onError:Qe})}),i.jsx("span",{className:"font-semibold text-white",children:a==="pair"||nt.kind==="hip3"?nt.symbol:nt.symbol.replace(/-USD$/,"").replace(/\/USD$/,"")}),a!=="pair"&&i.jsxs("span",{className:"ml-1 inline-flex items-center gap-1",children:[nt.leverage&&i.jsxs("span",{className:"px-1.5 py-[2px] rounded-[6px] bg-[rgba(103,255,189,0.16)] text-[#67FFBD] text-[11px] font-semibold",children:[nt.leverage,"x"]}),nt.kind==="hip3"&&nt.builder&&i.jsx("span",{className:"px-1.5 py-[2px] rounded-[6px] bg-[rgba(103,255,189,0.16)] text-[#67FFBD] text-[11px] font-semibold uppercase",children:nt.builder})]})]})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(tt,{children:nt.last==null||nt.last===0?"--":V(nt.last)})}),a!=="pair"&&i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"text-right font-medium align-middle",children:i.jsx(tt,{children:nt.chg24==null||isNaN(Number(nt.chg24))||nt.last==null||nt.last===0?"--":(()=>{const wt=Number(nt.chg24),nn=Number(nt.last),cn=nn/(1+wt/100||1),Un=nn-cn,Xt=Math.abs(Un);let an;Xt>=1e3?an=0:Xt>=100?an=2:an=4;const Jt=Un>=0?"+":"-",Ye=Xt.toLocaleString(void 0,{minimumFractionDigits:an,maximumFractionDigits:an}),Je=`${wt>0?"+":""}${wt.toFixed(2)}%`,It=wt>0?"#67FFBD":"#FF7173";return i.jsx("span",{style:{color:It},children:`${Jt}${Ye} / ${Je}`})})()})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(tt,{children:W(nt.vol)})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(tt,{children:nt.funding==null||isNaN(Number(nt.funding))?"--":(Number(nt.funding)*100).toFixed(4)+"%"})}),i.jsx("td",{className:"text-right text-white font-medium align-middle",children:i.jsx(tt,{children:nt.openInterest==null||isNaN(Number(nt.openInterest))?"--":"$"+W(nt.openInterest)})})]})]},Gt)})})]})})]})})]})}let FF=null;function Hpn(){return typeof window>"u"?null:(FF||(FF=new Audio("/success.mp3"),FF.volume=.9),FF)}function Vpn(){const t=Hpn();if(t)try{t.currentTime=0;const e=t.play();e&&typeof e.then=="function"&&e.catch(function(){})}catch{}}function Wpn(){const t=typeof window<"u"?window.ethereum:null;if(!t)return null;if(Array.isArray(t.providers)&&t.providers.length){const e=t.providers.find(r=>r&&r.isMetaMask);if(e)return e;const n=t.providers.find(r=>r&&r.isCoinbaseWallet);return n||t.providers[0]}return t}let Sse=null;function qpn(t){typeof t=="object"&&!Array.isArray(t)?Sse=t:Sse=null}async function Gpn(t,e){let n=await t.request({method:"eth_chainId"});if((n==null?void 0:n.toLowerCase())!==e.toLowerCase()){try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch(r){if(r&&r.code===4902)await t.request({method:"wallet_addEthereumChain",params:[{chainId:e,chainName:"Arbitrum One",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:["https://arb1.arbitrum.io/rpc"],blockExplorerUrls:["https://arbiscan.io/"]}]});else throw r}if(n=await t.request({method:"eth_chainId"}),(n==null?void 0:n.toLowerCase())!==e.toLowerCase())throw new Error(`Wrong network after switch: active ${parseInt(n,16)} expected ${parseInt(e,16)}.`)}}function kNe(t,e){return fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e||{})}).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status} on ${t}`);return n.json()})}function TNe(t){if(typeof t=="function")return t();const e=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,n=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;return{address:e,token:n}}function vQ(t){if(typeof window>"u")return null;for(const e of t){const n=window.localStorage.getItem(e);if(n!=null&&n!=="")return n}return null}function Yde(t){const e=t&&t.response&&t.response.data&&t.response.data.statuses,n=t&&t.statuses;return Array.isArray(e)?e:Array.isArray(n)?n:[]}function Kpn(t){return Yde(t).some(e=>{const n=String(e.status||e.s||"").toLowerCase();return n.includes("placed")||n.includes("resting")})}function Ypn(t){return Yde(t).some(n=>{const r=String(n.status||n.s||"").toLowerCase();return r.includes("filled")||r.includes("success")||!!n.filled})}function OF(t){const e=new Set;function n(r){if(!r||typeof r!="object"||e.has(r))return null;if(e.add(r),r.oid!=null&&!Number.isNaN(Number(r.oid)))return Number(r.oid);if(r.o!=null&&!Number.isNaN(Number(r.o)))return Number(r.o);for(const s in r){const a=n(r[s]);if(a!=null)return a}return null}return n(t)}function yA({baseUrl:t="https://api.hyperliquid.xyz",address:e,signer:n,vaultAddress:r=null,dex:s="",defaultSlippage:a=.08,isMainnet:o=!0,signatureChainIdHex:l="0xa4b1",getPK:c=()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,dextraApiBase:u="https://dextrabothypev2.nftinit.io",builderAddress:d="0x49ae63056b3a0be0b166813ee687309ab653c07c",getAuth:f,defaultFromStart:x="website",defaultAppType:g="terminal",defaultLeverage:y=null,getLeverage:v,feeTtlMs:C=12e4}={}){if(!e)throw new Error("address is required for info calls");if(!n||typeof n.sign!="function")throw new Error("signer with sign(action, nonce) is required for exchange actions");let N=null;const P={"Content-Type":"application/json"},T=6,M=o?"Mainnet":"Testnet",F=async(ze,rt)=>{const mt=t+ze,Lt=await fetch(mt,{method:"POST",headers:P,body:JSON.stringify(rt)});if(!Lt.ok)throw new Error(`HTTP ${Lt.status} on ${ze}`);return Lt.json()},$=(ze,rt)=>{if(!ze||typeof ze!="object")return NaN;const mt=String(rt||"").trim();if(!mt)return NaN;const Lt=mt.toUpperCase();if(ze[mt]!=null){const rn=Number(ze[mt]);if(Number.isFinite(rn))return rn}if(ze[Lt]!=null){const rn=Number(ze[Lt]);if(Number.isFinite(rn))return rn}const kt=Lt.indexOf("-");if(kt>0){const rn=Lt.slice(0,kt);if(Lt.slice(kt+1)==="PERP"&&ze[rn]!=null){const An=Number(ze[rn]);if(Number.isFinite(An))return An}}const dn=Object.keys(ze).find(rn=>String(rn).toUpperCase()===Lt);if(dn){const rn=Number(ze[dn]);if(Number.isFinite(rn))return rn}return NaN},L={allMids:async()=>F("/info",{type:"allMids",dex:s}),openOrders:async(ze=e)=>F("/info",{type:"openOrders",user:ze,dex:s}),frontendOpenOrders:async(ze=e)=>F("/info",{type:"frontendOpenOrders",user:ze,dex:s}),clearinghouseState:async(ze=e)=>F("/info",{type:"clearinghouseState",user:ze,dex:s}),meta:async()=>{if(N)return N;const ze=await F("/info",{type:"allPerpMetas"});return N=ze,ze},metaAndAssetCtxs:async()=>F("/info",{type:"metaAndAssetCtxs",dex:s}),twapHistory:async(ze=e)=>F("/info",{type:"twapHistory",user:ze,dex:s}),userTwapSliceFills:async(ze=e)=>F("/info",{type:"userTwapSliceFills",user:ze,dex:s}),userTwapSliceFillsByTime:async({user:ze=e,startTime:rt,endTime:mt,aggregateByTime:Lt}={})=>{const kt={type:"userTwapSliceFillsByTime",user:ze,startTime:rt,dex:s};return mt!=null&&(kt.endTime=mt),Lt!=null&&(kt.aggregateByTime=!!Lt),F("/info",kt)}};async function z(ze){const rt=await X(),mt=String(ze).toUpperCase();for(let Lt=0;Lt<rt.length;Lt++){const kt=rt[Lt];if(Array.isArray(kt.universe)){const dn=kt.universe.findIndex(rn=>rn.name.toUpperCase()===mt);if(dn!==-1){let rn;return Lt===0?rn=dn:rn=1e5+Lt*1e4+dn,{entry:kt.universe[dn],index:rn,block:kt}}}}throw new Error(`Unknown perp symbol: ${ze}`)}const X=async()=>{if(N)return N;const ze=await L.meta();return N=ze,ze},ne=async ze=>(await z(ze)).index,J=async ze=>(await z(ze)).entry.szDecimals,K=ze=>{const[rt,mt=""]=String(ze).split(".");if(!mt)return rt;const Lt=mt.replace(/0+$/,"");return Lt.length?`${rt}.${Lt}`:rt},te=async(ze,rt)=>{const mt=await J(ze),Lt=Math.max(0,T-Number(mt)),kt=Math.abs(Number(rt));if(!(kt>0)||!Number.isFinite(kt))return Lt;const dn=kt>=1?Math.floor(Math.log10(kt))+1:0,rn=Math.max(0,5-dn);return Math.min(Lt,rn)},fe=async(ze,rt)=>{const mt=await te(ze,rt);return Number((1/10**mt).toFixed(mt))},q=async(ze,rt,mt)=>{const Lt=await te(ze,rt),kt=10**-Lt,dn=Number(rt),rn=mt?Math.floor(dn/kt)*kt:Math.ceil(dn/kt)*kt;return K(Number(rn).toFixed(Lt))},se=async(ze,rt)=>{if(rt==null||!Number.isFinite(Number(rt)))throw new Error("price required");const mt=await te(ze,rt),Lt=Number(rt),kt=mt===0?Math.round(Lt):Math.round(Lt*10**mt)/10**mt;return K(kt.toFixed(mt))},ae=async(ze,rt)=>{if(rt==null||!Number.isFinite(Number(rt)))throw new Error("size required");const mt=await J(ze);return K(Number(rt).toFixed(Number(mt)))},W=async(ze,rt,mt,Lt=a)=>{let kt=mt;if(kt==null){let rn=$(Sse,ze);if(!Number.isFinite(rn)){const gn=await L.allMids();rn=$(gn,ze)}if(kt=rn,!Number.isFinite(kt))throw new Error(`Mid price not available for ${ze}`)}const dn=rt?kt*(1+Lt):kt*(1-Lt);return q(ze,dn,rt)},V=new Set(["usdSend","spotSend","usdClassTransfer","withdraw3","cDeposit","cWithdraw","approveBuilderFee"]),ee=()=>({name:"HyperliquidSignTransaction",version:"1",chainId:parseInt(l,16),verifyingContract:"0x0000000000000000000000000000000000000000"}),oe=(ze,rt)=>{switch(ze.type){case"usdSend":return{primaryType:"HyperliquidTransaction:UsdSend",types:{"HyperliquidTransaction:UsdSend":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},message:{hyperliquidChain:M,destination:String(ze.destination).toLowerCase(),amount:String(ze.amount),time:rt}};case"spotSend":return{primaryType:"HyperliquidTransaction:SpotSend",types:{"HyperliquidTransaction:SpotSend":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"token",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},message:{hyperliquidChain:M,destination:String(ze.destination).toLowerCase(),token:ze.token,amount:String(ze.amount),time:rt}};case"usdClassTransfer":return{primaryType:"HyperliquidTransaction:UsdClassTransfer",types:{"HyperliquidTransaction:UsdClassTransfer":[{name:"hyperliquidChain",type:"string"},{name:"amount",type:"string"},{name:"toPerp",type:"bool"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:M,amount:String(ze.amount),toPerp:!!ze.toPerp,nonce:rt}};case"withdraw3":return{primaryType:"HyperliquidTransaction:Withdraw",types:{"HyperliquidTransaction:Withdraw":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},message:{hyperliquidChain:M,destination:String(ze.destination).toLowerCase(),amount:String(ze.amount),time:rt}};case"cDeposit":return{primaryType:"HyperliquidTransaction:CDeposit",types:{"HyperliquidTransaction:CDeposit":[{name:"hyperliquidChain",type:"string"},{name:"wei",type:"string"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:M,wei:String(ze.wei),nonce:rt}};case"cWithdraw":return{primaryType:"HyperliquidTransaction:CWithdraw",types:{"HyperliquidTransaction:CWithdraw":[{name:"hyperliquidChain",type:"string"},{name:"wei",type:"string"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:M,wei:String(ze.wei),nonce:rt}};case"approveBuilderFee":return{primaryType:"HyperliquidTransaction:ApproveBuilderFee",types:{"HyperliquidTransaction:ApproveBuilderFee":[{name:"hyperliquidChain",type:"string"},{name:"maxFeeRate",type:"string"},{name:"builder",type:"address"},{name:"nonce",type:"uint64"}]},message:{hyperliquidChain:M,maxFeeRate:ze.maxFeeRate.endsWith("%")?ze.maxFeeRate:`${ze.maxFeeRate}%`,builder:ze.builder.toLowerCase(),nonce:rt}};default:return null}},de=ze=>{const rt=ou.from(ze),mt=rt.v>=27?rt.v:rt.v+27;return{r:rt.r,s:rt.s,v:mt}},Ce=async(ze,rt)=>{const mt=oe(ze,rt);if(!mt)throw new Error("Unsupported typed action");const Lt=ee(),kt=Object.assign({},mt.types,{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}]}),dn=(c()||"").trim();if(dn){const An=await new ile(dn).signTypedData(Lt,mt.types,mt.message);return de(An)}const rn=Wpn();if(rn){await Gpn(rn,l);let gn=await rn.request({method:"eth_accounts"});(!gn||!gn.length)&&(gn=await rn.request({method:"eth_requestAccounts"}));const An=gn[0];if(!An)throw new Error("No connected account in wallet");if(String(An).toLowerCase()!==String(e).toLowerCase())throw new Error(`Connected wallet ${An} does not match HL address ${e}.`);const kn={domain:Lt,types:kt,primaryType:mt.primaryType,message:mt.message},yn=await rn.request({method:"eth_signTypedData_v4",params:[An,JSON.stringify(kn)]});return de(yn)}throw new Error("No signer for typed action")};let me={ts:0,fee:null};async function we(ze=!1){const rt=Date.now();if(!ze&&me.fee!=null&&rt-me.ts<C)return{builder_fee:me.fee};const{address:mt,token:Lt}=TNe(f);if(!mt||!Lt)return{builder_fee:null};const kt=u+"/api/subscriber/check_account/",dn=await kNe(kt,{address:mt,token:Lt}),rn=(dn==null?void 0:dn.builder_fee)!=null?Number(dn.builder_fee):null;return me={ts:rt,fee:rn},{builder_fee:rn}}async function xe(ze){if(ze.type!=="order")return ze;const{builder_fee:rt}=await we();return rt==null?ze:{...ze,builder:{b:d,f:Number(rt)}}}function be(ze){return ze!=null&&ze.fromStart?ze.fromStart:vQ(["dextra_from_start","from_start"])||x||null}function je(ze){return ze!=null&&ze.appType?ze.appType:vQ(["dextra_app_type","app_type"])||g||null}async function Ie(ze,rt){if((rt==null?void 0:rt.leverage)!=null)return Number(rt.leverage);if(typeof v=="function"){const Lt=await v(ze);if(Lt!=null)return Number(Lt)}const mt=vQ([`leverage:${ze}`,`${ze}_leverage`,"dextra_leverage","hl_leverage","leverage"])||y;return mt!=null?Number(mt):null}async function Re(ze){const rt=await L.clearinghouseState(e),mt=((rt==null?void 0:rt.assetPositions)||[]).find(kt=>{var dn,rn;return((rn=(dn=kt==null?void 0:kt.position)==null?void 0:dn.coin)==null?void 0:rn.toUpperCase())===String(ze).toUpperCase()});if(!mt)return null;const Lt=Number(mt.position.szi||0);return{side:Lt>=0?"long":"short",size:Math.abs(Lt)}}async function Qe({symbol:ze,isBuy:rt,usePosSide:mt,size:Lt,price:kt,telemetry:dn,oid:rn}){var Nn;if(!rn&&rn!==0)return;const{address:gn,token:An}=TNe(f);if(!gn||!An)return;const kn=typeof window<"u"?window.localStorage.getItem("hl:wallet_id"):null,yn=ze?await Ie(ze,dn):null,Vn=mt&&((Nn=await Re(ze))==null?void 0:Nn.side)||(rt?"long":"short"),{builder_fee:Kn}=await we(),Dn={address:gn,token:An,order_params:{coin:String(ze),wallet_id:kn!=null?Number(kn):null,leverage:yn!=null?Number(yn):null,size:Lt!=null?Number(Lt):null,from_start:be(dn),app_type:je(dn),price:kt!=null?Number(kt):null,fee_amount:Kn!=null?Number(Kn):null,side:String(Vn),oid:Number(rn)}},Xn=u+"/api/hyper/order_save/";try{await kNe(Xn,Dn)}catch{}}async function Ke(ze,rt){const mt=rt??Date.now(),Lt=ze.type==="order"?await xe(ze):ze,kt=V.has(Lt.type)?await Ce(Lt,mt):await n.sign(Lt,mt),dn={action:Lt,nonce:mt,signature:kt,...r?{vaultAddress:r}:{}};return F("/exchange",dn)}async function dt(ze,rt){var rn;const mt=await Ke(ze),Lt=Yde(mt),kt=Ypn(mt)||Kpn(mt)||(mt==null?void 0:mt.status)==="ok"||((rn=mt==null?void 0:mt.response)==null?void 0:rn.status)==="ok";let dn=null;return kt&&(Vpn(),dn=OF(mt),dn==null&&Lt&&Lt.length&&(dn=OF(Lt))),await Qe({symbol:rt.symbol,isBuy:rt.isBuy,usePosSide:!!rt.usePosSide,size:rt.size,price:rt.price,telemetry:rt.telemetry,oid:dn}),mt}const tt=async({symbol:ze,isBuy:rt,size:mt,price:Lt,tif:kt="Gtc",reduceOnly:dn=!1,cloid:rn,builder:gn,telemetry:An}={})=>{const kn=await ne(ze),yn=await ae(ze,mt),Vn=await q(ze,Lt,!!rt),Dn={type:"order",orders:[{a:kn,b:!!rt,p:Vn,s:yn,r:!!dn,t:{limit:{tif:kt}},...rn?{c:rn}:{}}],grouping:"na",...gn?{builder:gn}:{}};return dt(Dn,{symbol:ze,isBuy:rt,size:yn,price:Vn,telemetry:An,usePosSide:!1})},nt=async({symbol:ze,isBuy:rt,size:mt,price:Lt,tif:kt="Gtc",reduceOnly:dn=!1,tpPrice:rn=null,slPrice:gn=null,triggerSlippage:An=.08,cloid:kn,builder:yn,telemetry:Vn}={})=>{const Kn=await ne(ze),Dn=await ae(ze,mt),Xn=[],Nn=await q(ze,Lt,!!rt);Xn.push({a:Kn,b:!!rt,p:Nn,s:Dn,r:!!dn,t:{limit:{tif:kt}},...kn?{c:kn}:{}});const on=!rt;if(gn!=null&&gn!==""&&Number(gn)>0){const Zt=await se(ze,gn),sn=await W(ze,on,Number(Zt),An);Xn.push({a:Kn,b:on,p:sn,s:Dn,r:!0,t:{trigger:{isMarket:!0,triggerPx:Zt,tpsl:"sl"}}})}if(rn!=null&&rn!==""&&Number(rn)>0){const Zt=await se(ze,rn),sn=await W(ze,on,Number(Zt),An);Xn.push({a:Kn,b:on,p:sn,s:Dn,r:!0,t:{trigger:{isMarket:!0,triggerPx:Zt,tpsl:"tp"}}})}const Oe={type:"order",orders:Xn,grouping:Xn.length>1?"normalTpsl":"na",...yn?{builder:yn}:{}};return dt(Oe,{symbol:ze,isBuy:rt,size:Dn,price:Nn,telemetry:Vn,usePosSide:!1})},Le=async({symbol:ze,tpPrice:rt=null,slPrice:mt=null,size:Lt=null,useLimitPx:kt=!1,triggerSlippage:dn=.1,telemetry:rn}={})=>{const gn=await Re(ze);if(!gn)throw new Error(`No open position for ${ze}`);const An=await ne(ze),kn=await ae(ze,Lt??gn.size),yn=gn.side==="short",Vn=[];let Kn=null;if(mt!=null&&Number(mt)>0){const Xn=await se(ze,mt),Nn=kt?Xn:await W(ze,yn,Number(Xn),dn);Vn.push({a:An,b:yn,p:Nn,s:kn,r:!0,t:{trigger:{isMarket:!kt,triggerPx:Xn,tpsl:"sl"}}}),Kn=Kn??Xn}if(rt!=null&&Number(rt)>0){const Xn=await se(ze,rt),Nn=kt?Xn:await W(ze,yn,Number(Xn),dn);Vn.push({a:An,b:yn,p:Nn,s:kn,r:!0,t:{trigger:{isMarket:!kt,triggerPx:Xn,tpsl:"tp"}}}),Kn=Kn??Xn}if(!Vn.length)throw new Error("TP/SL price required");return dt({type:"order",orders:Vn,grouping:"normalTpsl"},{symbol:ze,isBuy:yn,size:kn,price:Kn??0,telemetry:rn,usePosSide:!0})},Be=async(ze={})=>(await Xt({filter:"tpsl",symbol:ze.symbol}),Le(ze)),ht=async(ze,rt,mt,{price:Lt,slippage:kt=a,cloid:dn,tif:rn="Ioc",reduceOnly:gn=!1,builder:An,telemetry:kn}={})=>{const yn=await W(ze,rt,Lt,kt);return tt({symbol:ze,isBuy:rt,size:mt,price:yn,tif:"FrontendMarket",reduceOnly:gn,cloid:dn,builder:An,telemetry:kn})},pt=async(ze,rt,{price:mt,slippage:Lt=a,cloid:kt,tif:dn="Ioc",reduceOnly:rn=!0,builder:gn,telemetry:An}={})=>{let kn,yn=rt;if(yn==null){const on=await L.clearinghouseState(e),Oe=((on==null?void 0:on.assetPositions)||[]).find(sn=>{var jt,Qn;return((Qn=(jt=sn==null?void 0:sn.position)==null?void 0:jt.coin)==null?void 0:Qn.toUpperCase())===String(ze).toUpperCase()});if(!Oe)throw new Error(`No position found for ${ze}`);const Zt=parseFloat(Oe.position.szi);if(!Zt)throw new Error(`No open size on ${ze}`);yn=Math.abs(Zt),kn=Zt<0}else try{const on=await L.clearinghouseState(e),Oe=((on==null?void 0:on.assetPositions)||[]).find(sn=>{var jt,Qn;return((Qn=(jt=sn==null?void 0:sn.position)==null?void 0:jt.coin)==null?void 0:Qn.toUpperCase())===String(ze).toUpperCase()});kn=(Oe?parseFloat(Oe.position.szi):0)<0}catch{kn=!1}const Vn=await W(ze,kn,mt,Lt),Kn=await ne(ze),Dn=await ae(ze,yn),Nn={type:"order",orders:[{a:Kn,b:kn,p:Vn,s:Dn,r:!0,t:{limit:{tif:"FrontendMarket"}},...kt?{c:kt}:{}}],grouping:"na",...gn?{builder:gn}:{}};return dt(Nn,{symbol:ze,isBuy:kn,size:Dn,price:Vn,telemetry:An,usePosSide:!0})},Gt=async ze=>{const rt=await L.openOrders(e),mt=ze?rt.filter(rn=>rn.coin.toUpperCase()===String(ze).toUpperCase()):rt;if(!mt.length)return{status:"ok",response:{type:"cancel",data:{count:0}}};const Lt=new Map;for(const rn of mt)Lt.has(rn.coin)||Lt.set(rn.coin,await ne(rn.coin));const dn={type:"cancel",cancels:mt.map(rn=>({a:Lt.get(rn.coin),o:Number(rn.oid)}))};return Ke(dn)},wt=async ze=>{const rt=ze==null?{type:"scheduleCancel"}:{type:"scheduleCancel",time:Date.now()+Math.max(5e3,Number(ze))};return Ke(rt)},nn=async({symbol:ze,isBuy:rt,size:mt,minutes:Lt,randomize:kt=!1,reduceOnly:dn=!1}={})=>{var Kn,Dn,Xn,Nn,on,Oe,Zt,sn;const rn=await ne(ze),gn=await ae(ze,mt),kn={type:"twapOrder",twap:{a:rn,b:!!rt,s:gn,r:!!dn,m:Number(Lt),t:!!kt}},yn=await Ke(kn),Vn=((Xn=(Dn=(Kn=yn==null?void 0:yn.response)==null?void 0:Kn.data)==null?void 0:Dn.status)==null?void 0:Xn.error)||((on=(Nn=yn==null?void 0:yn.response)==null?void 0:Nn.data)==null?void 0:on.error)||((Zt=(Oe=yn==null?void 0:yn.data)==null?void 0:Oe.status)==null?void 0:Zt.error)||((sn=yn==null?void 0:yn.data)==null?void 0:sn.error);if(Vn)throw new Error(Vn);return yn},cn=async({symbol:ze,twapId:rt}={})=>{const Lt={type:"twapCancel",a:await ne(ze),t:Number(rt)};return Ke(Lt)},Un=async({symbol:ze,oid:rt,cloid:mt}={})=>{const Lt=await ne(ze);if(rt!=null&&/^\d+$/.test(String(rt)))return Ke({type:"cancel",cancels:[{a:Lt,o:Number(rt)}]});if(mt)return Ke({type:"cancelByCloid",cancels:[{asset:Lt,cloid:String(mt)}]});throw new Error("cancelOrder requires a numeric oid or a cloid")},Xt=async({filter:ze="all",symbol:rt=null}={})=>{const mt=await L.openOrders(e),Lt=Array.isArray(mt)?mt:[],kt=kn=>{const yn=String(kn.orderType||kn.type||"").toLowerCase();return ze==="all"?!0:ze==="limit"?yn==="limit":ze==="tpsl"?yn.includes("take profit")||yn.includes("stop"):ze==="reduceOnly"?!!kn.reduceOnly:ze==="nonReduce"?!kn.reduceOnly:!1},dn=Lt.filter(kn=>(!rt||String(kn.coin).toUpperCase()===String(rt).toUpperCase())&&kt(kn));if(!dn.length)return{ok:!0,count:0};const rn=new Map,gn=[];for(const kn of dn){let yn=rn.get(kn.coin);yn||(yn=await ne(kn.coin),rn.set(kn.coin,yn)),gn.push({a:yn,o:Number(kn.oid)})}return Ke({type:"cancel",cancels:gn})},an=async()=>{const ze=await L.clearinghouseState(e),mt=(Array.isArray(ze==null?void 0:ze.assetPositions)?ze.assetPositions:[]).map(Lt=>Lt==null?void 0:Lt.position).filter(Lt=>Math.abs(Number((Lt==null?void 0:Lt.szi)||0))>0);for(const Lt of mt){const kt=Lt.coin,dn=Math.abs(Number(Lt.szi));await pt(kt,dn,{tif:"FrontendMarket",reduceOnly:!0})}return!0},Jt={usdTransfer:async(ze,rt)=>{const mt=Date.now(),Lt={type:"usdSend",hyperliquidChain:M,signatureChainId:l,destination:String(ze).toLowerCase(),amount:String(rt),time:mt};return Ke(Lt)},spotTransfer:async(ze,rt,mt)=>{const Lt=Date.now(),kt={type:"spotSend",hyperliquidChain:M,signatureChainId:l,destination:String(ze).toLowerCase(),token:rt,amount:String(mt),time:Lt};return Ke(kt)},usdClassTransfer:async(ze,rt)=>{const mt=Date.now(),Lt={type:"usdClassTransfer",hyperliquidChain:M,signatureChainId:l,amount:String(ze),toPerp:!!rt,nonce:mt};return Ke(Lt,mt)},withdraw:async(ze,rt)=>{const mt=Date.now(),Lt={type:"withdraw3",hyperliquidChain:M,signatureChainId:l,destination:String(ze).toLowerCase(),amount:String(rt),time:mt};return Ke(Lt,mt)},cDeposit:async ze=>{const rt=Date.now(),mt={type:"cDeposit",hyperliquidChain:M,signatureChainId:l,wei:String(ze),nonce:rt};return Ke(mt,rt)},cWithdraw:async ze=>{const rt=Date.now(),mt={type:"cWithdraw",hyperliquidChain:M,signatureChainId:l,wei:String(ze),nonce:rt};return Ke(mt,rt)},approveBuilderFee:async({builder:ze,maxFeeRate:rt})=>{const mt=Date.now(),Lt={type:"approveBuilderFee",hyperliquidChain:M,signatureChainId:l,builder:String(ze).toLowerCase(),maxFeeRate:String(rt),nonce:mt};return Ke(Lt,mt)}},Ye=(()=>{const ze="hl:pairs",rt=()=>{try{return JSON.parse(localStorage.getItem(ze)||"[]")}catch{return[]}},mt=gn=>{try{localStorage.setItem(ze,JSON.stringify(gn))}catch{}};return{read:rt,write:mt,get:gn=>rt().find(An=>An.id===gn)||null,add:gn=>{const An=rt();An.push(gn),mt(An)},upsert:gn=>{const An=rt().filter(kn=>kn.id!==gn.id);An.push(gn),mt(An)},remove:gn=>mt(rt().filter(An=>An.id!==gn))}})(),Je=(ze="PAIR")=>`${ze}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;async function It(ze,rt,mt,Lt,kt){const dn=[{symbol:rt.symbol,side:"long",size:Number(rt.size),oid:OF(Lt)??null},{symbol:mt.symbol,side:"short",size:Number(mt.size),oid:OF(kt)??null}];return Ye.add({id:ze,createdAt:Date.now(),legs:dn}),{pairId:ze,long:{oid:dn[0].oid},short:{oid:dn[1].oid}}}const hn=async({long:ze,short:rt,entrySlippage:mt=a,triggerSlippage:Lt=.1,telemetry:kt,pairId:dn}={})=>{if(!(ze!=null&&ze.symbol)||!(rt!=null&&rt.symbol))throw new Error("pair requires long.symbol and short.symbol");if(!(Number(ze.size)>0)||!(Number(rt.size)>0))throw new Error("pair sizes must be > 0");const rn=dn||Je(),[gn,An]=await Promise.all([placeMarketWithTPSL({symbol:ze.symbol,isBuy:!0,size:Number(ze.size),entrySlippage:mt,tpPrice:ze.tpPrice??null,slPrice:ze.slPrice??null,triggerSlippage:Lt,telemetry:kt,cloid:`${rn}:L`}),placeMarketWithTPSL({symbol:rt.symbol,isBuy:!1,size:Number(rt.size),entrySlippage:mt,tpPrice:rt.tpPrice??null,slPrice:rt.slPrice??null,triggerSlippage:Lt,telemetry:kt,cloid:`${rn}:S`})]);return It(rn,ze,rt,gn,An)},Yt=async({long:ze,short:rt,triggerSlippage:mt=a,telemetry:Lt,pairId:kt}={})=>{if(!(ze!=null&&ze.symbol)||!(rt!=null&&rt.symbol))throw new Error("pair requires long.symbol and short.symbol");const dn=kt||Je(),[rn,gn]=await Promise.all([ze.tpPrice||ze.slPrice?nt({symbol:ze.symbol,isBuy:!0,size:Number(ze.size),price:Number(ze.price),tif:String(ze.tif||"Gtc"),reduceOnly:!!ze.reduceOnly,tpPrice:ze.tpPrice??null,slPrice:ze.slPrice??null,triggerSlippage:mt,telemetry:Lt,cloid:`${dn}:L`}):tt({symbol:ze.symbol,isBuy:!0,size:Number(ze.size),price:Number(ze.price),tif:String(ze.tif||"Gtc"),reduceOnly:!!ze.reduceOnly,telemetry:Lt,cloid:`${dn}:L`}),rt.tpPrice||rt.slPrice?nt({symbol:rt.symbol,isBuy:!1,size:Number(rt.size),price:Number(rt.price),tif:String(rt.tif||"Gtc"),reduceOnly:!!rt.reduceOnly,tpPrice:rt.tpPrice??null,slPrice:rt.slPrice??null,triggerSlippage:mt,telemetry:Lt,cloid:`${dn}:S`}):tt({symbol:rt.symbol,isBuy:!1,size:Number(rt.size),price:Number(rt.price),tif:String(rt.tif||"Gtc"),reduceOnly:!!rt.reduceOnly,telemetry:Lt,cloid:`${dn}:S`})]);return It(dn,ze,rt,rn,gn)},Rt=async({long:ze,short:rt,telemetry:mt,pairId:Lt}={})=>{if(!(ze!=null&&ze.symbol)||!(rt!=null&&rt.symbol))throw new Error("pair requires long.symbol and short.symbol");const kt=Lt||Je(),[dn,rn]=await Promise.all([nn({symbol:ze.symbol,isBuy:!0,size:Number(ze.size),minutes:Number(ze.minutes),randomize:!!ze.randomize,reduceOnly:!!ze.reduceOnly}),nn({symbol:rt.symbol,isBuy:!1,size:Number(rt.size),minutes:Number(rt.minutes),randomize:!!rt.randomize,reduceOnly:!!rt.reduceOnly})]);return It(kt,ze,rt,dn,rn)};async function ot(ze){var kt;const rt=await L.clearinghouseState(e),mt=((rt==null?void 0:rt.assetPositions)||[]).find(dn=>{var rn,gn;return((gn=(rn=dn==null?void 0:dn.position)==null?void 0:rn.coin)==null?void 0:gn.toUpperCase())===String(ze).toUpperCase()}),Lt=Number(((kt=mt==null?void 0:mt.position)==null?void 0:kt.szi)||0);return{size:Math.abs(Lt),side:Lt>=0?"long":"short"}}return{updateLeverage:async(ze,rt,mt)=>{var gn,An,kn,yn,Vn,Kn,Dn,Xn;const kt={type:"updateLeverage",asset:await ne(ze),isCross:String(rt||"").toLowerCase()==="cross",leverage:Number(mt)},dn=await Ke(kt),rn=((kn=(An=(gn=dn==null?void 0:dn.response)==null?void 0:gn.data)==null?void 0:An.status)==null?void 0:kn.error)||((Vn=(yn=dn==null?void 0:dn.response)==null?void 0:yn.data)==null?void 0:Vn.error)||((Dn=(Kn=dn==null?void 0:dn.data)==null?void 0:Kn.status)==null?void 0:Dn.error)||((Xn=dn==null?void 0:dn.data)==null?void 0:Xn.error)||((dn==null?void 0:dn.status)==="err"?dn==null?void 0:dn.response:null);if(rn)throw new Error(String(rn));return dn},placeOrder:tt,placeLimitWithTPSL:nt,placeTPSLForPosition:Le,replaceTPSLForPosition:Be,cancelAllOrders:Gt,scheduleCancel:wt,marketOpen:ht,marketClose:pt,placeMarketWithTPSL:async ze=>{const rt=await W(ze.symbol,ze.isBuy,null,ze.entrySlippage??a);return nt({...ze,price:Number(rt),tif:"FrontendMarket"})},placeTwapOrder:nn,cancelTwapOrder:cn,cancelOrder:Un,cancelOrdersFiltered:Xt,closeAllPositions:an,marketOpenPair:hn,limitOpenPair:Yt,twapOpenPair:Rt,marketClosePair:async({pairId:ze,slippage:rt=a,fraction:mt=1,telemetry:Lt}={})=>{const kt=Ye.get(ze);if(!kt)throw new Error("Unknown pairId");const[dn]=kt.legs.filter(Nn=>Nn.side==="long"),[rn]=kt.legs.filter(Nn=>Nn.side==="short");if(!dn||!rn)throw new Error("Pair legs corrupted");const[gn,An]=await Promise.all([ot(dn.symbol),ot(rn.symbol)]),kn=Math.max(0,Math.min(gn.size,dn.size)*Number(mt||1)),yn=Math.max(0,Math.min(An.size,rn.size)*Number(mt||1)),Vn=[];if(kn>0&&Vn.push(pt(dn.symbol,kn,{slippage:rt,reduceOnly:!0,telemetry:Lt,cloid:`${ze}:L:CLOSE`})),yn>0&&Vn.push(pt(rn.symbol,yn,{slippage:rt,reduceOnly:!0,telemetry:Lt,cloid:`${ze}:S:CLOSE`})),!Vn.length)return{pairId:ze,message:"Nothing to close"};const Kn=await Promise.all(Vn),[Dn,Xn]=await Promise.all([ot(dn.symbol),ot(rn.symbol)]);return Dn.size===0&&Xn.size===0&&Ye.remove(ze),{pairId:ze,results:Kn}},pairs:{list:()=>Ye.read(),get:ze=>Ye.get(ze),remove:ze=>Ye.remove(ze)},info:L,transfers:Jt,utils:{getPerpAssetId:ne,getSzDecimals:J,toPxString:se,toSzString:ae,withSlippagePx:W,trimZeros:K,getPxDecimalsAt:te,getTickSize:fe,quantizePx:q}}}const Nse="https://api.hyperliquid.xyz/info",Xpn="wss://api.hyperliquid.xyz/ws";function Qpn(t){const e=String(t||""),n=e.indexOf(":");if(n>=0){const r=e.slice(0,n),s=e.slice(n+1);return{builder:r,symbol:s+(r==="xyz"?"-USDC":"-USDH")}}return{builder:null,symbol:e}}const Zd={rows:[],subs:new Set,started:!1,ws:null,timer:null};function nqe(){for(const t of Zd.subs)try{t(Zd.rows)}catch{}}async function Zpn(){const e=await(await fetch(Nse,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:"metaAndAssetCtxs"})})).json(),n=Array.isArray(e)?e[0]:e.meta||e||{},r=Array.isArray(e)?e[1]:e.assetCtxs||[];return(n&&n.universe?n.universe:[]).map((o,l)=>{const c=r&&r[l]||{},u=o.name,d=Number(c.markPx??c.midPx??0),f=Number(c.prevDayPx??0);return{kind:"perp",dex:"",builder:"",rawSymbol:u,coin:u,symbol:`${u}-USD`,last:d,prevDayPx:f,chg24:f?(d-f)/f*100:0,vol:Number(c.dayNtlVlm??0),funding:Number(c.funding??0),leverage:o.maxLeverage??null,openInterest:Number(c.openInterest??0)}})}async function Jpn(){try{const e=await(await fetch(Nse,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:"perpDexs"})})).json();let n=[];Array.isArray(e)?n=e:Array.isArray(e.dexs)&&(n=e.dexs);const r=n.map(a=>a?typeof a=="string"?a:typeof a=="object"&&a.name?a.name:null:null).filter(a=>{if(!a)return!1;const o=String(a),l=o.toLowerCase();return!(o==="HL"||l==="vntl"||l==="flx")}),s=[];for(const a of r)try{const l=await(await fetch(Nse,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({type:"metaAndAssetCtxs",dex:a})})).json(),c=Array.isArray(l)?l[0]:l.meta||l||{},u=Array.isArray(l)?l[1]:l.assetCtxs||[],d=c&&c.universe?c.universe:[];for(let f=0;f<d.length;f++){const x=d[f],g=u[f]||{},y=Qpn(x.name),v=Number(g.markPx??g.midPx??0),C=Number(g.prevDayPx??0);s.push({kind:"hip3",dex:a,builder:y.builder||a,rawSymbol:x.name,coin:y.symbol,symbol:y.symbol,last:v,prevDayPx:C,chg24:C?(v-C)/C*100:0,vol:Number(g.dayNtlVlm??0),funding:Number(g.funding??0),leverage:x.maxLeverage??null,openInterest:Number(g.openInterest??0)})}}catch{}return s}catch{return[]}}async function PNe(){try{const[t,e]=await Promise.all([Zpn(),Jpn()]);Zd.rows=[...t,...e],nqe()}catch{}}function emn(){if(!Zd.started){Zd.started=!0,PNe(),Zd.timer=setInterval(PNe,6e4);try{const t=new WebSocket(Xpn);Zd.ws=t,t.onopen=()=>{try{t.send(JSON.stringify({method:"subscribe",subscription:{type:"allMids",dex:"ALL_DEXS"}}))}catch{}},t.onmessage=e=>{let n;try{n=JSON.parse(e.data||"{}")}catch{return}if(n.channel!=="allMids")return;const r=n.data&&n.data.mids||{};qpn(r);const s=Zd.rows.map(a=>{const o=a.rawSymbol||a.symbol||a.coin,c=String(o).replace(/^[a-z0-9]+:/i,""),u=a.coin,d=a.symbol,f=o,x=r[c]??r[u]??r[d]??r[f]??null;if(x==null)return a;const g=Number(x),y=a.prevDayPx?(g-a.prevDayPx)/a.prevDayPx*100:a.chg24||0;return{...a,last:g,chg24:y}});Zd.rows=s,nqe()},t.onclose=()=>{Zd.ws=null}}catch{}}}function gz(){const[t,e]=m.useState(Zd.rows);return m.useEffect(()=>{emn(),e(Zd.rows);const n=r=>{e(r)};return Zd.subs.add(n),()=>{Zd.subs.delete(n)}},[]),t}const wQ=({children:t,text:e})=>{const[n,r]=m.useState({x:0,y:0}),[s,a]=m.useState(!1);return i.jsxs("div",{className:"relative inline-block",onMouseMove:o=>{const l=o.currentTarget.getBoundingClientRect();r({x:o.clientX-l.left,y:o.clientY-l.top})},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[i.jsx("span",{className:"underline decoration-dotted underline-offset-2 cursor-help",children:t}),i.jsx(nP,{children:s&&i.jsx(Ao.div,{className:"absolute z-50 px-3 py-2 text-xs text-white bg-black rounded-md pointer-events-none shadow-lg w-72",style:{top:n.y+18,left:n.x+18},initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{type:"spring",stiffness:300,damping:25},children:e})})]})},tmn=({coin:t,onCoinChange:e,headerData:n,setIsDigits:r,mode:s="single",pairKey:a="BTC/ETH",onPairChange:o=()=>{},markets:l=[],market:c="hyperliquid"})=>{const u=(n==null?void 0:n.nextFundingTime)??(n==null?void 0:n.nextFundingRate),[d,f]=m.useState(L(u)),[x,g]=m.useState((n==null?void 0:n.markPx)||0),[y,v]=m.useState("text-white"),[C,N]=m.useState({last:null,mark:null,oracle:null}),P=m.useRef((n==null?void 0:n.markPx)||0),T=gz(),M=l.length?l:T,F=c==="hyperliquid"&&s==="pair",$={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};m.useEffect(()=>{if(!F&&(n==null?void 0:n.markPx)!=null){const de=n.markPx.toString(),Ce=de.includes(".")?de.split(".")[1].length:0;r(Ce)}},[F,n==null?void 0:n.markPx]),m.useEffect(()=>{if(!F)return;let de=!1;const Ce=async()=>{var me;try{const xe=await(await fetch("https://api-ui.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allMids"})})).json(),be=((me=xe==null?void 0:xe.data)==null?void 0:me.universe)||[],[je,Ie]=String(a).split("/"),Re=be.find(Le=>(Le==null?void 0:Le.name)===je),Qe=be.find(Le=>(Le==null?void 0:Le.name)===Ie),Ke=Number((Re==null?void 0:Re.markPx)||0),dt=Number((Qe==null?void 0:Qe.markPx)||0),tt=Number((Re==null?void 0:Re.oraclePx)||0),nt=Number((Qe==null?void 0:Qe.oraclePx)||0);if(Ke>0&&dt>0){const Le=Ke/dt,Be=tt>0&&nt>0?tt/nt:null;N({last:Le,mark:Le,oracle:Be});const ht=Le.toString().includes(".")?Le.toString().split(".")[1].length:0;r(ht)}}catch{}de||setTimeout(Ce,1500)};return Ce(),()=>{de=!0}},[F,a]);function L(de){const Ce=new Date,me=Ce.getTime(),we=Number(de);if(Number.isFinite(we)&&we>me){const dt=Math.max(0,Math.floor((we-me)/1e3)),tt=String(Math.floor(dt/3600)).padStart(2,"0"),nt=String(Math.floor(dt%3600/60)).padStart(2,"0"),Le=String(dt%60).padStart(2,"0");return`${tt}:${nt}:${Le}`}Ce.setSeconds(Ce.getSeconds()+1);const xe=Date.UTC(Ce.getUTCFullYear(),Ce.getUTCMonth(),Ce.getUTCDate(),Ce.getUTCHours(),Ce.getUTCMinutes(),Ce.getUTCSeconds()),je=new Date(Date.UTC(Ce.getUTCFullYear(),Ce.getUTCMonth(),Ce.getUTCDate(),Ce.getUTCHours()+1,0,0,0)).getTime()-xe,Ie=Math.floor(je/1e3),Re=String(Math.floor(Ie/3600)).padStart(2,"0"),Qe=String(Math.floor(Ie%3600/60)).padStart(2,"0"),Ke=String(Ie%60).padStart(2,"0");return`${Re}:${Qe}:${Ke}`}m.useEffect(()=>{f(L(u));const de=setInterval(()=>f(L(u)),1e3);return()=>clearInterval(de)},[u]),m.useEffect(()=>{if(F){const de=C.mark;if(!de)return;const Ce=P.current;de>Ce?v("text-[#1DE6A3]"):de<Ce&&v("text-[#FF7173]"),g(de);const me=setTimeout(()=>v("text-white"),800);return P.current=de,()=>clearTimeout(me)}else{if(!(n!=null&&n.markPx))return;const de=n.markPx,Ce=P.current;de>Ce?v("text-[#1DE6A3]"):de<Ce&&v("text-[#FF7173]"),g(de);const me=setTimeout(()=>v("text-white"),800);return P.current=de,()=>clearTimeout(me)}},[F,C.mark,n==null?void 0:n.markPx]);const z=()=>i.jsx("div",{className:"flex items-center justify-start w-[76px]",children:i.jsx("div",{className:"w-[76px] max-w-[76px] h-[16px] rounded skeleton-ticker-text short ml-4 mt-1"})}),X=(n==null?void 0:n.source)==="extended",ne=de=>{const Ce=Number(de);if(!Number.isFinite(Ce))return z();const me=Math.abs(Ce);let we=1;return me>=1e3?we=1:me>=100?we=2:me>=1?we=3:me>=.1?we=4:we=6,Ce.toLocaleString(void 0,{maximumFractionDigits:we})},J=de=>de==null||isNaN(de)?z():de>=1e3?u3(de):de,K=de=>{const Ce=Number(de);if(!Number.isFinite(Ce))return z();const me=Math.abs(Ce),we=Ce>=0?"+":"-";if(!X)return`${we}${me.toFixed(5)}`;let xe=0;me<.1?xe=6:me<1?xe=4:me<10?xe=2:me<100&&(xe=1);const be=me.toFixed(xe),je=xe>0?be.replace(/\.?0+$/,""):be;return`${we}${je}`},te=Number.isFinite(n==null?void 0:n.markPx)&&Number.isFinite(n==null?void 0:n.prevDayPx)?n.markPx-n.prevDayPx:null,fe=te!=null&&(n!=null&&n.prevDayPx)?te/n.prevDayPx*100:null,q=te!=null?K(te):null,se=te==null?"text-white":te>=0?"text-[#1DE6A3]":"text-[#FF7173]",ae=fe==null?"text-white":fe>=0?"text-[#1DE6A3]":"text-[#FF7173]",W=()=>{const[de,Ce]=String(a).split("/");return i.jsxs("div",{className:"flex -space-x-2 items-center",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${de||""}.svg`||qa,alt:"pair_a",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a]",loading:"lazy",onError:me=>wm(me)}),i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Ce||""}.svg`||qa,alt:"pair_b",className:"w-8 h-8 min-w-8 min-h-8 rounded-full bg-[#2a2a2a] border border-[#0f0f0f]",loading:"lazy",onError:me=>wm(me)})]})},V=F?"pair":"single",ee=F?a:t,oe=F?o:e;return i.jsx("div",{className:"flex justify-between items-center gap-2 md:gap-4 w-full relative",children:i.jsxs("div",{className:"flex justify-between xl:justify-start items-center gap-2 sm:gap-4 w-full sm:w-max",children:[i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"flex justify-center items-center",children:F?i.jsx(W,{}):i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${$[t]||(t==null?void 0:t.split("/")[0])}.svg`||qa,alt:"token_image",className:"w-8 h-8 min-w-8 min-h-8 rounded-full",loading:"lazy",onError:de=>wm(de)})}),i.jsx(Kde,{markets:M,value:ee,onChange:oe,loading:!M.length,showIcon:!0,mode:V})]}),i.jsx("div",{className:"hidden lg:flex bg-[#101010]",children:F?i.jsx(i.Fragment,{}):i.jsxs(i.Fragment,{children:[i.jsx(PC,{title:i.jsx(wQ,{text:"Used for margining, computing unrealized PnL, liquidations and triggering TP/SL orders.",children:"Mark"}),widthValue:"70px",info:X?ne(x):J(x),color_1:y}),i.jsx(PC,{title:i.jsx(wQ,{text:"Median price from external sources reported by validators; used to calculate funding rates.",children:"Oracle"}),widthValue:"80px",info:X?ne(n==null?void 0:n.oraclePx):J(n==null?void 0:n.oraclePx),color_1:"text-white"}),i.jsx(PC,{title:"24h Change",widthValue:"120px",info:q??z(),info_2:fe,color_1:se,color_2:ae}),i.jsx(PC,{title:"24h Volume",widthValue:"130px",info:n!=null&&n.dayNtlVlm?`$${_r(parseFloat(n==null?void 0:n.dayNtlVlm))}`:z(),color_1:"text-white"}),i.jsx(PC,{title:"Open Interest",widthValue:"130px",info:n!=null&&n.oraclePx?`$${_r(parseFloat((n==null?void 0:n.oraclePx)*(n==null?void 0:n.openInterest)))}`:z(),color_1:"text-white"}),i.jsx(PC,{title:i.jsx(wQ,{text:"If the funding rate is positive, longs pay shorts. If negative, shorts pay longs.",children:"Funding"}),title_2:"Countdown",widthValue:"145px",info:(n==null?void 0:n.funding)!=null?((n==null?void 0:n.funding)*100).toFixed(4)+"%":z(),info_2:(n==null?void 0:n.funding)!=null?d:z(),color_1:"text-[#1DE6A3]",color_2:"text-white",isLast:!0})]})}),i.jsx("div",{className:"flex lg:hidden justify-start items-center gap-4",children:"All Positions"})]})})},PC=({title:t,title_2:e,widthValue:n,info:r,info_2:s,color_1:a,color_2:o,isLast:l})=>i.jsxs("div",{className:"flex items-center",children:[i.jsxs("div",{style:{minWidth:n},className:"flex flex-col items-center justify-center",children:[i.jsx("div",{className:"flex flex-col items-start",children:e?i.jsxs("div",{className:`text-[#B7B7B7] text-[12px] font-medium font-inter leading
-snug`,children:[t," / ",e]}):i.jsx("div",{className:"text-[#B7B7B7] text-[12px] font-medium font-inter leading-snug",children:t})}),s?i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("div",{className:`${a} text-[12px] font-semibold font-inter leading-[16px]`,children:r}),i.jsx("div",{className:`${a} flex justify-center items-center max-h-2`,children:r?"/":""}),i.jsx("div",{className:`${o} text-[12px] font-semibold font-inter leading-[16px]`,children:e=="Countdown"?s:`${s>0?"+":""}${parseFloat(s).toFixed(2)}%`})]}):i.jsx("div",{className:`${a} text-[12px] font-semibold font-inter leading-[16px]`,children:r})]}),!l&&i.jsx("div",{className:"border-l border-[#3E3E3E]",style:{height:24}})]}),nmn="wss://api.hyperliquid.xyz/ws",CQ=new Map;function INe(t){const e=(t||"").toLowerCase();return e?(CQ.has(e)||CQ.set(e,{key:e,ws:null,ping:null,subs:new Set,connected:!1,connecting:!1}),CQ.get(e)):null}function rqe(t){if(!t||t.connecting||t.connected)return;t.connecting=!0;const e=new WebSocket(nmn);t.ws=e,e.onopen=()=>{t.connected=!0,t.connecting=!1;try{e.send(JSON.stringify({method:"subscribe",subscription:{type:"user",user:t.key}})),e.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:t.key}})),e.send(JSON.stringify({method:"subscribe",subscription:{type:"webData3",user:t.key}}))}catch{}t.ping=setInterval(()=>{try{e.send(JSON.stringify({id:99,method:"ping"}))}catch{}},3e4)},e.onmessage=r=>{let s;try{s=JSON.parse(r.data)}catch{return}(s==null?void 0:s.method)!=="pong"&&t.subs.forEach(a=>{try{a(s)}catch{}})};const n=()=>{t.connected=!1,t.connecting=!1;try{e.close()}catch{}t.ping&&(clearInterval(t.ping),t.ping=null),t.ws=null,t.subs.size&&setTimeout(()=>rqe(t),1500)};e.onclose=n,e.onerror=n}function sqe(t,e){const n=INe(t);return n?(n.subs.add(e),rqe(n),()=>{const r=INe(t);if(r&&(r.subs.delete(e),!r.subs.size&&r.ws))try{r.ws.close()}catch{}}):()=>{}}const rmn="https://api.hyperliquid.xyz/info",SQ=new Map,smn=["xyz"];function imn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(SQ.has(e)||SQ.set(e,{key:e,rows:[],count:void 0,loading:!0,emptyTimer:null,tpslByCoin:{},viewOrdersOnly:new Set,subs:new Set}),SQ.get(e)):null}function iqe(t){t.subs.forEach(e=>{try{e({rows:t.rows,count:t.count,loading:t.loading,tpslByCoin:t.tpslByCoin,viewOrdersOnly:t.viewOrdersOnly})}catch{}})}function amn(t){return(Array.isArray(t)?t:[]).filter(n=>{var r;return((r=n==null?void 0:n.position)==null?void 0:r.szi)&&Number(n.position.szi)!==0}).map(n=>{var y,v,C;const r=n.position,s=Number(r.szi||0),a=Number(r.positionValue||0),o=Number(r.entryPx||0),l=Math.abs(s)>0?a/Math.abs(s):0,c=Number(r.unrealizedPnl||0),u=Number(r.returnOnEquity||0)*100,d=r.liquidationPx?Number(r.liquidationPx):null,f=Number(r.marginUsed||0),x=Number(((y=r.leverage)==null?void 0:y.value)||0),g=((v=r.leverage)==null?void 0:v.type)||null;return{id:`${r.coin}:${r.entryPx}:${r.szi}`,coin:r.coin,type:s>0?"Long":"Short",size:s,positionValue:a,entryPrice:o,markPrice:l,pnl:c,roe:u,liquidationPx:d,marginUsed:f,leverage:{value:x,type:g},funding:Number(((C=r.cumFunding)==null?void 0:C.sinceOpen)||0)}})}function FNe(t,e){const n=amn(e);t.rows=n,t.count=n.length,t.loading=!1,iqe(t)}function MF(t,e){if(Array.isArray(e)&&e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),FNe(t,e);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,FNe(t,[])},1e3))}function RF(t,e){const n=Array.isArray(e)?e:[],r={},s=new Set,a=new Set;for(const o of n)if(o!=null&&o.coin&&(s.add(o.coin),o.isPositionTpsl)){a.add(o.coin);const l=r[o.coin]||{tp:null,sl:null},c=Number(o.triggerPx||o.limitPx||0),u=String(o.orderType||"").toLowerCase();u.includes("take profit")&&(l.tp=Number.isFinite(c)?c:l.tp),u.includes("stop")&&(l.sl=Number.isFinite(c)?c:l.sl),r[o.coin]=l}for(const o of s)a.has(o)||(r[o]={tp:null,sl:null});t.tpslByCoin=r,iqe(t)}function aqe(t){const e=[],n=new Set;function r(s){if(Array.isArray(s))for(const a of s){if(!a)continue;const o=a.oid!=null?String(a.oid):a.cloid!=null?String(a.cloid):`${a.coin||""}-${a.timestamp||""}-${a.limitPx||""}-${a.side||""}`;n.has(o)||(n.add(o),e.push(a))}}if(!t)return e;if(Array.isArray(t))return r(t),e;if(typeof t!="object")return e;if(Array.isArray(t.orders)&&r(t.orders),r(t.openOrders),t.clearinghouseState&&typeof t.clearinghouseState=="object"&&r(t.clearinghouseState.openOrders),Array.isArray(t.perpDexStates))for(const s of t.perpDexStates)!s||typeof s!="object"||(Array.isArray(s.orders)&&r(s.orders),r(s.openOrders),s.clearinghouseState&&typeof s.clearinghouseState=="object"&&r(s.clearinghouseState.openOrders));return e}function oqe(t){let e=[],n=!1;if(t&&typeof t=="object"){const a=t.clearinghouseState;if(Array.isArray(a&&a.assetPositions)?(e.push(...a.assetPositions),n=!0):Array.isArray(t.assetPositions)&&(e.push(...t.assetPositions),n=!0),Array.isArray(t.perpDexStates)){let o=!1;for(const l of t.perpDexStates){if(!l||!l.clearinghouseState)continue;const c=l.clearinghouseState.assetPositions;Array.isArray(c)&&c.length>0&&(o=!0,e.push(...c))}o&&(n=!0)}}const r=aqe(t),s=r.length>0;return{hasAssetPositions:n,assetPositions:e,hasOpenOrders:s,openOrders:r}}function omn(t){if(!t||typeof t!="object")return{assetPositions:[],openOrders:[]};const{hasAssetPositions:e,assetPositions:n,hasOpenOrders:r,openOrders:s}=oqe(t);return{assetPositions:e?n:[],openOrders:r?s:[]}}function Xde(t){const[e,n]=m.useState({rows:[],count:void 0,loading:!0,tpslByCoin:{},viewOrdersOnly:new Set});return m.useEffect(()=>{const r=t==null?void 0:t.toLowerCase();if(!r)return;const s=imn(r),a=l=>n(l);s.subs.add(a),n({rows:s.rows,count:s.count,loading:s.loading,tpslByCoin:s.tpslByCoin,viewOrdersOnly:s.viewOrdersOnly});const o=sqe(r,l=>{if(!l)return;const c=l.channel;if(c==="user"){const u=l.data&&l.data.state;if(!u)return;Array.isArray(u.assetPositions)&&MF(s,u.assetPositions);const d=aqe(u);d.length&&RF(s,d);return}if(c==="webData2"||c==="webData3"){const u=l.data||{},{hasAssetPositions:d,assetPositions:f,hasOpenOrders:x,openOrders:g}=oqe(u);d&&MF(s,f),x&&RF(s,g)}});return(async()=>{try{const l=smn.map(f=>{const x={type:"clearinghouseState",user:r};return f&&(x.dex=f),x}),c=await Promise.all(l.map(f=>fetch(rmn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(x=>x.json()).catch(()=>null))),u=[],d=[];for(const f of c){if(!f)continue;const{assetPositions:x,openOrders:g}=omn(f);Array.isArray(x)&&x.length&&u.push(...x),Array.isArray(g)&&g.length&&d.push(...g)}MF(s,u),RF(s,d)}catch{MF(s,[]),RF(s,[])}})(),()=>{s.subs.delete(a),o()}},[t]),e}function lqe(t){const{count:e}=Xde(t);return e}const NQ=new Map;function lmn(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(NQ.has(e)||NQ.set(e,{key:e,rows:[],count:void 0,loading:!0,subs:new Set,emptyTimer:null}),NQ.get(e)):null}function cmn(t){t.subs.forEach(e=>{try{e({rows:t.rows,count:t.count,loading:t.loading})}catch{}})}function umn(t){return(Array.isArray(t)?t:[]).map(n=>({id:`${n.oid}-${n.timestamp}`,coin:n.coin,side:n.side==="B"?"Buy":"Sell",sideRaw:n.side,type:n.orderType,size:Number(n.sz)>0?Number(n.sz):"--",originalSize:Number(n.origSz)>0?Number(n.origSz):"--",price:Number(n.triggerPx)>0?"Market":Number(n.limitPx),limitPx:Number(n.limitPx||0),triggerPx:Number(n.triggerPx)||"N/A",isTrigger:!!n.isTrigger,reduceOnly:!!n.reduceOnly,tif:n.tif||null,orderValue:Number(n.limitPx||0)>0&&Number(n.sz||0)!==0?Number(n.limitPx)*Math.abs(Number(n.sz)):0,timestamp:Number(n.timestamp||0),children:Array.isArray(n.children)?n.children:[],isPositionTpsl:!!n.isPositionTpsl,cloid:n.cloid||null,oid:n.oid})).sort((n,r)=>r.timestamp-n.timestamp)}function AQ(t){const e=[],n=new Set;function r(s){if(Array.isArray(s))for(const a of s){if(!a)continue;const o=a.oid!=null?String(a.oid):a.cloid!=null?String(a.cloid):`${a.coin||""}-${a.timestamp||""}-${a.limitPx||""}-${a.side||""}`;n.has(o)||(n.add(o),e.push(a))}}if(!t)return e;if(Array.isArray(t)){for(const s of t)!s||typeof s!="object"||(Array.isArray(s.orders)&&r(s.orders),Array.isArray(s.openOrders)&&r(s.openOrders));return e}if(typeof t!="object")return e;if(Array.isArray(t.orders)&&r(t.orders),Array.isArray(t.openOrders)&&r(t.openOrders),t.clearinghouseState&&typeof t.clearinghouseState=="object"&&Array.isArray(t.clearinghouseState.openOrders)&&r(t.clearinghouseState.openOrders),Array.isArray(t.perpDexStates))for(const s of t.perpDexStates)!s||typeof s!="object"||(Array.isArray(s.orders)&&r(s.orders),Array.isArray(s.openOrders)&&r(s.openOrders),s.clearinghouseState&&typeof s.clearinghouseState=="object"&&Array.isArray(s.clearinghouseState.openOrders)&&r(s.clearinghouseState.openOrders));return e}function ONe(t){if(!t||typeof t!="object")return!1;if(Array.isArray(t.orders)||Array.isArray(t.openOrders)||t.clearinghouseState&&typeof t.clearinghouseState=="object"&&Array.isArray(t.clearinghouseState.openOrders))return!0;if(Array.isArray(t.perpDexStates)){for(const e of t.perpDexStates)if(!(!e||typeof e!="object")&&(Array.isArray(e.orders)||Array.isArray(e.openOrders)||e.clearinghouseState&&typeof e.clearinghouseState=="object"&&Array.isArray(e.clearinghouseState.openOrders)))return!0}return!1}function jQ(t,e){const n=umn(e);t.rows=n,t.count=n.length,t.loading=!1,cmn(t)}function EQ(t,e,n){if(e.length>0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),jQ(t,e);return}if(n===0){t.emptyTimer&&(clearTimeout(t.emptyTimer),t.emptyTimer=null),jQ(t,[]);return}t.emptyTimer||(t.emptyTimer=setTimeout(()=>{t.emptyTimer=null,!(n>0)&&jQ(t,[])},2e3))}function Qde(t){const e=(t==null?void 0:t.toLowerCase())||"",n=lqe(t),[r,s]=m.useState({rows:[],count:void 0,loading:!0});return m.useEffect(()=>{if(!e){s({rows:[],count:0,loading:!1});return}const a=lmn(e);if(!a){s({rows:[],count:0,loading:!1});return}const o=c=>s(c);a.subs.add(o),s({rows:a.rows,count:a.count,loading:a.loading});const l=sqe(e,c=>{if(!c)return;const u=c.channel,d=c.data||{};if(u==="openOrders"){const f=AQ(d);EQ(a,f,n);return}if(u==="user"){const f=d.state;if(!f||!ONe(f))return;const x=AQ(f);EQ(a,x,n);return}if(u==="webData2"||u==="webData3"){if(!ONe(d))return;const f=AQ(d);EQ(a,f,n);return}});return()=>{a.subs.delete(o),l()}},[e,n]),r}function dmn(t){const{count:e}=Qde(t);return e}const Fv={"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","12h":"720","1d":"1D","1w":"1W","1M":"1M"},u9={"1m":60,"5m":300,"15m":900,"30m":1800,"1h":3600,"4h":14400,"12h":43200,"1d":86400,"1w":604800,"1M":2592e3},LF={1:"1m",5:"5m",15:"15m",30:"30m",60:"1h",240:"4h",720:"12h","1D":"1d",D:"1d","1W":"1w",W:"1w","1M":"1M",M:"1M"},fmn="wss://api.starknet.extended.exchange",_Q="https://api.starknet.extended.exchange/api/v1",kQ="https://express-proxy-delta.vercel.app/proxy?url=",hmn={"1m":"PT1M","5m":"PT5M","15m":"PT15M","30m":"PT30M","1h":"PT1H","4h":"PT4H","12h":"PT12H","1d":"PT24H","1w":"P7D","1M":"P30D"},pmn="https://mainnet.zklighter.elliot.ai/api/v1/candles",mmn="https://mainnet.zklighter.elliot.ai/api/v1/candlesticks",xmn=["tv.js","charting_library.standalone.js","charting_library.js"];let DF=null;function gmn(t="/charting_library/"){return typeof window>"u"?Promise.resolve(null):window.TradingView&&window.TradingView.widget?Promise.resolve(window.TradingView):DF||(DF=(async()=>{for(const e of xmn){const n=t.replace(/\/?$/,"/")+e;if(!document.querySelector(`script[data-tv-lib="${n}"]`)){const s=document.createElement("script");s.src=n,s.async=!0,s.dataset.tvLib=n,document.body.appendChild(s),await new Promise(a=>{s.onload=a,s.onerror=a})}if(window.TradingView&&window.TradingView.widget)return window.TradingView;let r=0;for(;(!window.TradingView||!window.TradingView.widget)&&r<40;)await new Promise(s=>setTimeout(s,25)),r++;if(window.TradingView&&window.TradingView.widget)return window.TradingView}return window.TradingView||null})(),DF)}const bmn="#133024",cqe="#67FFBD",ymn="#311621",uqe="#FF79AD",vmn={background:bmn,border:cqe},wmn={background:ymn,border:uqe},Cmn="#67FFBD",Smn="rgba(103,255,189,0.12)",Nmn="#67FFBD",Amn="#FF797C",jmn="rgba(255,121,124,0.12)",Emn="#FF79AD",_mn="#67FFBD",kmn="rgba(103,255,189,0.08)",Tmn="#67FFBD",MNe="#FF79AD",RNe="rgba(255,121,173,0.08)",LNe="#FF79AD",Y9=t=>{const e=String(t||"").trim().toUpperCase();return e==="SELL"||e==="SHORT"||e==="S"?"S":e==="BUY"||e==="LONG"||e==="B"?"B":""},wM="",DNe="tv_chart_layout_v3",Tb=t=>typeof t=="string"&&t.includes("/");function Pmn(t){const e=[t.isBuy,t.b,t.buy,t.side,t.dir,t.takerSide,t.action];for(const n of e){if(n===!0||n===1)return!0;if(n===!1||n===0)return!1;if(typeof n=="string"){const r=n.toLowerCase();if(r==="buy"||r==="b"||r==="long")return!0;if(r==="sell"||r==="s"||r==="short")return!1}}return!1}function dqe(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function Imn(t){const e=new Date(t),n=dqe(t),r=e.getUTCDay();return n-r*864e5}function Fmn(t){const e=new Date(t);return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)}function Ov(t,e){if(e==="1d")return dqe(t);if(e==="1w")return Imn(t);if(e==="1M")return Fmn(t);const n=u9[e]||60;return Math.floor(t/1e3/n)*n*1e3}function Zde(t){return/limit/i.test(String(t.type||""))?Number(t.limitPx)||0:Number(t.triggerPx)||0}function fqe(t){return Number(t.sz??t.size??t.sizeCoin??t.coinSize??t.baseSize??t.qty??t.quantity??0)||0}function Omn(t,e){const n=Y9(t.sideRaw||t.side),r=/take\s*profit/i.test(String(t.type||"")),s=/stop/i.test(String(t.type||"")),a=Zde(t),o=fqe(t),l=t.coin||e||"",c=o>0?` (${o.toLocaleString(void 0,{maximumFractionDigits:6})}${l?" "+l:""})`:"";return r?wM+`TP ${n==="S"?">":"<"} ${a}${c}`:s?wM+`SL ${n==="S"?"<":">"} ${a}${c}`:wM+`Limit ${a}${c}`}function Mmn(t){const e=/take\s*profit/i.test(String(t.type||"")),n=/stop/i.test(String(t.type||"")),r=Y9(t.sideRaw||t.side),s=r==="S"||r==="A";return n?{txt:Amn,bg:jmn,br:Emn}:e?s?{txt:MNe,bg:RNe,br:LNe}:{txt:Cmn,bg:Smn,br:Nmn}:s?{txt:MNe,bg:RNe,br:LNe}:{txt:_mn,bg:kmn,br:Tmn}}function BNe(t){return!t||typeof t!="object"||!Array.isArray(t.charts)?t:{...t,charts:t.charts.map(n=>!n||!Array.isArray(n.panes)?n:{...n,panes:n.panes.map(r=>{if(!r||!Array.isArray(r.sources))return r;const s=r.sources.filter(a=>{if(!a||typeof a!="object")return!0;const o=a.state||{},l=o.text||o.title||"";return!(typeof l=="string"&&l[0]===wM)});return{...r,sources:s}})})}}function Rmn(t,e){const n=t.oid??t.cloid??t.clientOrderId??t.hash??t.orderId??t.id??null,r=t.sideRaw??t.side??"";return String(n??`${t.coin||e}|${r}|${Zde(t)}`)}function $Ne(t,e,n){var r,s,a,o;if(n!=null){try{(r=t==null?void 0:t.removeEntity)==null||r.call(t,n)}catch{}try{(s=e==null?void 0:e.removeEntity)==null||s.call(e,n)}catch{}try{const l=(a=e==null?void 0:e.getShapeById)==null?void 0:a.call(e,n);(o=l==null?void 0:l.remove)==null||o.call(l)}catch{}}}function BF(t,e,n){t.forEach(r=>{r&&(typeof r.then=="function"?r.then(s=>{s!=null&&$Ne(e,n,s)}).catch(()=>{}):$Ne(e,n,r))})}const Lmn=(()=>{if(typeof Intl<"u"&&Intl.DateTimeFormat)try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone;if(t&&typeof t=="string")return t}catch{}return"Etc/UTC"})();function TQ({coin:t="BTC",interval:e="1h",domId:n,libPath:r="/charting_library/",walletAddress:s,gridLines:a=[],market:o="hyperliquid",lighterMarketId:l=null,extendedMarket:c=null,extendedLastPrice:u=null,extendedApiKey:d=null}){const f=m.useRef(null),x=m.useRef(null),g=m.useRef(null),y=m.useRef(new Map),[v,C]=m.useState(!1),N=m.useRef([]),P=m.useRef([]),T=Qde(s||"").rows,M=m.useRef(null),F=m.useRef(e),$=m.useRef(new Map),L=m.useRef(0),[z,X]=m.useState([]);m.useEffect(()=>{T.length>0&&(N.current=T)},[T]);let ne;T.length===0?(L.current+=1,L.current<=1?ne=N.current:ne=T):(L.current=0,ne=T);const J=m.useMemo(()=>o!=="hyperliquid"?[]:ne.filter(W=>W&&W.coin===t),[ne,t,o]);m.useEffect(()=>{if(o!=="extended"||!d){X([]);return}let W=!1;const V=async()=>{try{const oe=`${_Q}/user/orders`,de=`${kQ}${encodeURIComponent(oe)}`,me=await(await fetch(de,{headers:{"X-Api-Key":d}})).json().catch(()=>null);if(W)return;const xe=((me==null?void 0:me.data)&&Array.isArray(me.data)&&me.data||(Array.isArray(me)?me:[])).map((be,je)=>{var Ie;return{id:be.id??je,market:(be.market||"").toUpperCase(),type:(be.type||"").toUpperCase(),side:Y9(be.side)||(be.side||"").toUpperCase(),sideRaw:Y9(be.side)||"B",status:(be.status||"").toUpperCase(),limitPx:Number(be.price)||null,triggerPx:((Ie=be.trigger)==null?void 0:Ie.triggerPrice)!=null?Number(be.trigger.triggerPrice):null,qty:Number(be.qty)||null,takeProfit:be.takeProfit||null,stopLoss:be.stopLoss||null,reduceOnly:!!be.reduceOnly,createdTime:be.createdTime||null,updatedTime:be.updatedTime||null}}).filter(be=>be.status==="NEW"||be.status==="PARTIALLY_FILLED");X(xe)}catch{W||X([])}};V();const ee=setInterval(V,1e4);return()=>{W=!0,clearInterval(ee)}},[o,d]);const K=m.useMemo(()=>{if(o==="hyperliquid")return J;if(o==="extended"){const W=String(c||t||"").toUpperCase();return z.filter(V=>String(V.market||"").toUpperCase()===W)}return[]},[o,J,z,c,t]);let te=Lmn;try{const W=typeof window<"u"?JSON.parse(window.localStorage.getItem("tradingview.chartproperties")||"null"):null;W&&W.timezone&&(te=W.timezone)}catch{}const fe=typeof window<"u"?window.localStorage.getItem("tranding_chart_interval_time"):null,q=fe&&Fv[fe]?fe:e,se=Fv[q]||"60";m.useEffect(()=>{T.length>0&&(P.current=T)},[T]),m.useEffect(()=>{if(!v)return;const W=x.current,V=W&&W.activeChart&&W.activeChart();if(!V)return;const ee=Fv[e]?Fv[e]:Object.values(Fv).includes(e)?e:se,oe=M.current!==t,de=F.current!==e;if(oe){M.current=t,F.current=e;const Ce=g.current;if(Ce&&typeof Ce.clearMarksCache=="function")try{Ce.clearMarksCache()}catch{}try{V.setSymbol(t,ee,()=>{var me;try{V.requestMarksRefresh&&V.requestMarksRefresh(),(me=V.autoScaleAllSeries)==null||me.call(V)}catch{}})}catch{}}else if(de){F.current=e;try{V.setResolution(ee,()=>{var Ce;try{V.requestMarksRefresh&&V.requestMarksRefresh(),(Ce=V.autoScaleAllSeries)==null||Ce.call(V)}catch{}})}catch{}}},[t,e,v,se]),m.useEffect(()=>{let W=!0;return(async()=>{const V=await gmn(r);if(!W||!V||!V.widget||!f.current)return;f.current.innerHTML="";let ee=5;function oe(xe,be,je,Ie,Re,Qe,Ke){let dt=xe||null,tt=Ke||null,nt=null,Le=null,Be=null,ht=null,pt=null,Gt=null;const wt={},nn={},cn={},Un={};let Xt=!0,an=Qe,Jt=null,Ye=0;const Je=on=>+String(on).slice(0,13);let It="1h",hn="",Yt=[],Rt=null,ot=null,De=null;const At=on=>hmn[on]||"PT1M",ze=on=>{if(Re)return Re;const Oe=String(on||"");return!Oe||Oe.includes("/")?"":Oe.includes("-")?Oe:`${Oe}-USD`},rt=(on,Oe)=>{if(!Oe)return;const Zt=Un[Oe]||[],sn=Zt[Zt.length-1];sn&&sn.time===on.time?Zt[Zt.length-1]=on:Zt.push(on),Zt.length>2e3&&Zt.splice(0,Zt.length-2e3),Un[Oe]=Zt},mt=(on,Oe,Zt)=>{const sn=Un[on]||[];return sn.length?sn.filter(jt=>Number.isFinite(jt.time)&&jt.time/1e3>=Oe&&jt.time/1e3<=Zt):[]},Lt=(on,Oe,Zt)=>{const sn=Number(an);if(!Number.isFinite(sn)||sn<=0)return[];const jt=Ov(Zt*1e3,on);return Math.floor(jt/1e3)<Oe?[]:[{time:jt,open:sn,high:sn,low:sn,close:sn,volume:0}]};function kt(){je==="hyperliquid"&&(nt||(nt=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),nt.onopen=()=>{pt&&nt&&nt.send(JSON.stringify({method:"subscribe",subscription:pt}))},nt.onmessage=on=>{var sn;const Oe=(sn=JSON.parse(on.data))==null?void 0:sn.data;if(!Oe||!Oe.c)return;const Zt={time:Je(Oe.t),open:+Oe.o,high:+Oe.h,low:+Oe.l,close:+Oe.c,volume:Oe.v??0};Object.values(wt).forEach(jt=>jt(Zt))},nt.onclose=()=>{nt=null}))}function dn(){je==="extended"&&(!Gt||Le||(Le=new WebSocket(Gt),Le.onmessage=on=>{let Oe;try{Oe=JSON.parse(on.data)}catch{return}const Zt=Array.isArray(Oe==null?void 0:Oe.data)?Oe.data:[];Zt.length&&Zt.forEach(sn=>{const jt={time:Je(sn.T),open:+sn.o,high:+sn.h,low:+sn.l,close:+sn.c,volume:sn.v!=null?Number(sn.v):0};!Number.isFinite(jt.time)||!Number.isFinite(jt.open)||(rt(jt,It),Object.values(wt).forEach(Qn=>Qn(jt)))})},Le.onclose=()=>{Le=null}))}function rn(on,Oe,Zt){if(je!=="hyperliquid")return;if(Be)try{Be.close()}catch{}if(ht)try{ht.close()}catch{}ot=null,De=null,Be=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),ht=new WebSocket("wss://api-ui.hyperliquid.xyz/ws"),Be.onopen=()=>{Be&&Be.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:on,interval:Zt}}))},ht.onopen=()=>{ht&&ht.send(JSON.stringify({method:"subscribe",subscription:{type:"candle",coin:Oe,interval:Zt}}))};const sn=jt=>Qn=>{var ar;const bn=(ar=JSON.parse(Qn.data))==null?void 0:ar.data;if(!bn||!bn.c)return;const Dt={time:Je(bn.t),open:+bn.o,high:+bn.h,low:+bn.l,close:+bn.c,volume:bn.v??0};if(jt==="A"?ot=Dt:De=Dt,!ot||!De)return;const en=Ov(ot.time,It),Pn=Ov(De.time,It);if(en!==Pn)return;const tr={time:Math.max(ot.time,De.time),open:ot.open/De.open,high:ot.high/De.high,low:ot.low/De.low,close:ot.close/De.close,volume:0};Object.values(wt).forEach(hr=>hr(tr))};Be.onmessage=sn("A"),ht.onmessage=sn("B"),Be.onclose=()=>{Be=null},ht.onclose=()=>{ht=null}}function gn(on){const Oe=String(on||"");return Oe==="BTC"||Oe==="ETH"?2:Oe.startsWith("1000")||Oe.includes("/")?4:3}async function An(on,Oe,Zt,sn){const bn=(u9[Oe]||60)*1e4,Dt=Math.max(Zt*1e3,sn*1e3-bn*1e3),{data:en}=await ps.post("https://api-ui.hyperliquid.xyz/info",{type:"candleSnapshot",req:{coin:on,interval:Oe,startTime:Dt,endTime:sn*1e3}});return(Array.isArray(en)?en:en&&en.data?en.data:[]).map(tr=>({time:Je(tr.t),open:+tr.o,high:+tr.h,low:+tr.l,close:+tr.c,volume:tr.v??0})).sort((tr,ar)=>tr.time-ar.time)}async function kn(on,Oe,Zt,sn,jt){const[Qn,bn]=await Promise.all([An(on,Zt,sn,jt),An(Oe,Zt,sn,jt)]),Dt=[];let en=0,Pn=0;for(;en<Qn.length&&Pn<bn.length;){const tr=Ov(Qn[en].time,It),ar=Ov(bn[Pn].time,It);tr===ar?(Dt.push({time:Math.max(Qn[en].time,bn[Pn].time),open:Qn[en].open/bn[Pn].open,high:Qn[en].high/bn[Pn].high,low:Qn[en].low/bn[Pn].low,close:Qn[en].close/bn[Pn].close,volume:0}),en++,Pn++):tr<ar?en++:Pn++}return Dt}async function yn(on,Oe,Zt,sn){if(on==null)return[];const jt=u9[Oe]||60,Qn=Math.max(jt,sn-Zt),bn=Math.max(1,Math.ceil(Qn/jt)),Dt={market_id:on,resolution:Oe,r:Oe,start_timestamp:Zt*1e3,end_timestamp:sn*1e3,start:Zt*1e3,end:sn*1e3,count_back:bn,limit:bn,set_timestamp_to_end:!0},en=hr=>{if(!hr)return null;if(Array.isArray(hr)){const[h,p,S,_,k,I]=hr;return{time:Je(h),open:+p,high:+S,low:+_,close:+k,volume:Number(I??0)||0}}const qt=hr.t??hr.time??hr.timestamp??hr.start_timestamp??hr.startTime??hr.start_time??0,zn=hr.o??hr.open,Zn=hr.h??hr.high,Ft=hr.l??hr.low,En=hr.c??hr.close,Ee=hr.v??hr.volume??hr.V??0;return{time:Je(qt),open:+zn,high:+Zn,low:+Ft,close:+En,volume:Number(Ee??0)||0}},Pn=hr=>hr.map(qt=>en(qt)).filter(qt=>qt&&Number.isFinite(qt.time)&&Number.isFinite(qt.open)&&qt.time/1e3>=Zt&&qt.time/1e3<=sn).sort((qt,zn)=>qt.time-zn.time),tr=async hr=>{const{data:qt}=await ps.get(hr,{params:Dt});return qt?Array.isArray(qt.c)?qt.c:Array.isArray(qt.data)?qt.data:Array.isArray(qt.candlesticks)?qt.candlesticks:Array.isArray(qt.candles)?qt.candles:Array.isArray(qt)?qt:[]:[]};let ar=[];try{ar=await tr(pmn)}catch{}if(!ar.length)try{ar=await tr(mmn)}catch{}return Pn(ar)}async function Vn(on,Oe,Zt,sn){if(!on)return[];const jt=u9[Oe]||60,Qn=Math.max(jt,sn-Zt),bn=Math.min(1e4,Math.max(1,Math.ceil(Qn/jt))),Dt=At(Oe),en=`${_Q}/info/candles/${on}/trades?interval=${Dt}&limit=${bn}&endTime=${sn*1e3}`,Pn=`${kQ}${encodeURIComponent(en)}`,{data:tr}=await ps.get(Pn);return(Array.isArray(tr==null?void 0:tr.data)?tr.data:[]).map(hr=>({time:Je(hr.T),open:+hr.o,high:+hr.h,low:+hr.l,close:+hr.c,volume:hr.v!=null?Number(hr.v):0})).filter(hr=>Number.isFinite(hr.time)&&Number.isFinite(hr.open)&&hr.time/1e3>=Zt&&hr.time/1e3<=sn).sort((hr,qt)=>hr.time-qt.time)}async function Kn(on,Oe,Zt){if(!dt)return[];if(Tb(on))return[];const{data:sn}=await ps.post("https://api.hyperliquid.xyz/info",{type:"userFills",user:dt,coin:on,startTime:Oe*1e3,endTime:Zt*1e3});return(Array.isArray(sn)?sn:sn&&sn.data?sn.data:[]).filter(bn=>{const Dt=bn.coin||bn.asset||bn.symbol;return Dt?String(Dt).toUpperCase()===String(on).toUpperCase():!0}).map(bn=>({t:+String(bn.time).slice(0,13),b:Pmn(bn),px:Number(bn.px||bn.price),sz:Number(bn.sz||bn.size)})).filter(bn=>bn.t/1e3>=Oe&&bn.t/1e3<=Zt&&Number.isFinite(bn.px)&&bn.px>0)}async function Dn(on,Oe,Zt){if(!tt)return[];if(!on)return[];const sn=`${_Q}/user/trades`,jt=`${kQ}${encodeURIComponent(sn)}`,{data:Qn}=await ps.get(jt,{headers:{"X-Api-Key":tt}}),bn=Array.isArray(Qn==null?void 0:Qn.data)?Qn.data:Array.isArray(Qn)?Qn:[],Dt=String(on||"").toUpperCase();return bn.filter(en=>String(en.market||"").toUpperCase()===Dt).map(en=>({t:+String(en.createdTime||en.time||en.paidTime||0).slice(0,13),b:Y9(en.side)!=="S"})).filter(en=>en.t/1e3>=Oe&&en.t/1e3<=Zt&&Number.isFinite(en.t))}function Xn(on){nn[on]&&(clearInterval(nn[on]),delete nn[on])}function Nn(){Object.keys(nn).forEach(on=>{Xn(on)})}return{setWallet:on=>{dt=on||null,hn="",Yt=[],Rt=null},setExtendedApiKey:on=>{tt=on||null,hn="",Yt=[],Rt=null},setExtendedFallbackPrice:on=>{an=on},clearMarksCache:()=>{hn="",Yt=[],Rt=null},onReady:on=>on({supported_resolutions:Object.values(Fv),supports_group_request:!1,supports_marks:!0,supports_timescale_marks:!1,supports_time:!0}),resolveSymbol:(on,Oe)=>{Jt=on;const Zt=cn[on]??gn(on);cn[on]=Zt,typeof be=="function"&&be(Zt),Oe({name:on,ticker:on,full_name:on,description:Tb(on)?on:on+"/USD",type:"crypto",session:"24x7",timezone:te,exchange:je==="lighter"?"Lighter":je==="extended"?"Extended":"Hyperliquid",pricescale:Math.pow(10,Zt),minmov:1,has_intraday:!0,supported_resolutions:Object.values(Fv),data_status:"streaming"})},getServerTime:on=>on(Math.floor(Date.now()/1e3)),getBars:async(on,Oe,{from:Zt,to:sn},jt,Qn)=>{const bn=on.ticker||on.name,Dt=++Ye;try{const en=LF[Oe]||"1m";en&&(It=en);let Pn=[];if(je==="lighter")Tb(bn)||(Pn=await yn(Ie,en,Zt,sn));else if(je==="extended"){if(!Tb(bn)){const tr=ze(bn);if(tr&&Xt)try{Pn=await Vn(tr,en,Zt,sn)}catch{Xt=!1}Pn.length||(Pn=mt(en,Zt,sn)),Pn.length||(Pn=Lt(en,Zt,sn))}}else if(Tb(bn)){const tr=String(bn).split("/"),ar=tr[0],hr=tr[1];Pn=await kn(ar,hr,en,Zt,sn)}else Pn=await An(bn,en,Zt,sn);if(bn!==Jt||Dt!==Ye)return;jt(Pn,{noData:Pn.length===0})}catch(en){const Pn=en&&en.response&&en.response.status;if(je==="lighter"&&Pn===400){bn===Jt&&Dt===Ye&&jt([],{noData:!0});return}try{Qn(en&&en.message?en.message:"Datafeed error")}catch{}}},getMarks:async(on,Oe,Zt,sn,jt)=>{const Qn=on.ticker||on.name;if(Tb(Qn))return sn([]);const bn=LF[jt]||null;bn&&(It=bn);let Dt=Number(Oe),en=Number(Zt);const Pn=Math.floor(Date.now()/1e3);(!Number.isFinite(Dt)||!Number.isFinite(en)||en<=Dt||Dt<=0||en<=0)&&(en=Pn,Dt=en-30*24*3600);const tr=je==="extended"?ze(Qn):Qn;if(je==="extended"&&!tt)return sn([]);const ar=[je,tr||Qn,Dt,en,It];je==="extended"&&ar.push(tt||"no-key");const hr=ar.join("|");if(hr===hn&&Yt.length)return sn(Yt);if(Rt&&Rt.key===hr){const zn=await Rt.promise;return sn(zn)}Rt={key:hr,promise:(async()=>{try{let zn=new Map;if(je==="hyperliquid"){const Ft=await Kn(Qn,Dt,en);zn=new Map;for(const En of Ft){const Ee=Ov(En.t,It),h=Math.floor(Ee/1e3),p=En.b?"B":"S",S=h+"-"+p;zn.has(S)||zn.set(S,{time:h,isBuy:En.b})}}else if(je==="extended"){const Ft=await Dn(tr,Dt,en);zn=new Map;for(const En of Ft){const Ee=Ov(En.t,It),h=Math.floor(Ee/1e3),p=En.b?"B":"S",S=h+"-"+p;zn.has(S)||zn.set(S,{time:h,isBuy:En.b})}}const Zn=Array.from(zn.values()).map((Ft,En)=>({id:Ft.time+"-"+(Ft.isBuy?"B":"S")+"-"+En,time:Ft.time,color:Ft.isBuy?vmn:wmn,label:Ft.isBuy?"B":"S",labelFontColor:Ft.isBuy?cqe:uqe,text:Ft.isBuy?"Buy":"Sell",minSize:16,borderWidth:1,hoveredBorderWidth:2})).sort((Ft,En)=>Ft.time-En.time);return hn=hr,Yt=Zn,Rt=null,Zn}catch{return Rt=null,[]}})()};const qt=await Rt.promise;sn(qt)},getTimescaleMarks:(on,Oe,Zt,sn)=>sn([]),subscribeBars:(on,Oe,Zt,sn)=>{const jt=on.ticker||on.name,Qn=LF[Oe]||"1m";if(wt[sn]=Zt,It=Qn,je==="lighter"){Xn(sn);const bn=u9[It]||60,Dt=Math.max(2e3,Math.min(15e3,Math.floor(bn*1e3/3)));let en=0;const Pn=async()=>{try{const tr=Math.floor(Date.now()/1e3),ar=tr-bn*500,hr=await yn(Ie,It,ar,tr);if(!Array.isArray(hr)||!hr.length)return;const qt=hr[hr.length-1];if(!Number.isFinite(qt.time))return;if(qt.time>en){en=qt.time;const zn=wt[sn];zn&&zn(qt)}}catch{}};Pn(),nn[sn]=setInterval(Pn,Dt);return}if(je==="extended"){if(Tb(jt))return;const bn=ze(jt);if(!bn)return;const Dt=At(Qn);if(Gt=`${fmn}/stream.extended.exchange/v1/candles/${encodeURIComponent(bn)}/trades?interval=${encodeURIComponent(Dt)}`,Le){try{Le.close()}catch{}Le=null}dn();return}if(je==="hyperliquid")if(Tb(jt)){const bn=String(jt).split("/"),Dt=bn[0],en=bn[1];rn(Dt,en,Qn)}else{if(pt={type:"candle",coin:jt,interval:Qn},nt){try{nt.close()}catch{}nt=null}kt()}},unsubscribeBars:on=>{delete wt[on],Xn(on)},cleanup:()=>{try{nt&&nt.close()}catch{}try{Le&&Le.close()}catch{}try{Be&&Be.close()}catch{}try{ht&&ht.close()}catch{}Nn(),hn="",Yt=[],Rt=null,ot=null,De=null,Gt=null}}}const de=oe(s||null,xe=>{ee=xe},o,l,c,u,o==="extended"?d:null);g.current=de;let Ce=null;if(typeof window<"u"){const xe=window.localStorage.getItem(DNe);if(xe)try{Ce=BNe(JSON.parse(xe))}catch{}}const me={container:f.current.id,library_path:r,datafeed:de,autosize:!0,theme:"dark",locale:"en",timezone:te,loading_screen:{backgroundColor:"#101010"},enabled_features:["timeframes_toolbar","two_character_bar_marks_labels"],disabled_features:["header_symbol_search","symbol_search_hot_key","header_interval_dialog_button","header_settings","header_fullscreen_button","header_compare","header_undo_redo"],auto_save_delay:5,custom_formatters:{price:xe=>Number(xe).toLocaleString("en-US",{minimumFractionDigits:ee,maximumFractionDigits:ee})},custom_css_url:"/tv-custom.css",overrides:{"paneProperties.background":"#101010","paneProperties.backgroundGradientStartColor":"#101010","paneProperties.backgroundGradientEndColor":"#101010","paneProperties.vertGridProperties.color":"#202020","paneProperties.horzGridProperties.color":"#202020","scalesProperties.textColor":"#dcdada","scalesProperties.abbreviateLabel":!1,"mainSeriesProperties.candleStyle.upColor":"#67FFBD","mainSeriesProperties.candleStyle.downColor":"#FF7272","mainSeriesProperties.candleStyle.borderUpColor":"#67FFBD","mainSeriesProperties.candleStyle.borderDownColor":"#FF7272","mainSeriesProperties.candleStyle.wickUpColor":"#67FFBD","mainSeriesProperties.candleStyle.wickDownColor":"#FF7272","timeScale.rightOffset":100,"scalesProperties.allowSymbolChange":!0,"scalesProperties.backgroundColor":"#101010","scalesProperties.showLeftScale":!1,"scalesProperties.showRightScale":!0,"scalesProperties.vertTouchDrag":!0,"scalesProperties.vertScrollZoom":!0}};Ce?me.saved_data=Ce:(me.symbol=t,me.interval=se);const we=new window.TradingView.widget(me);x.current=we,we.onChartReady(()=>{const xe=we.activeChart(),be=()=>{var Ie;try{(Ie=xe.autoScaleAllSeries)==null||Ie.call(xe)}catch{}},je=()=>{!we||!we.save||typeof window>"u"||we.save(Ie=>{try{const Re=BNe(Ie||{});window.localStorage.setItem(DNe,JSON.stringify(Re||{}))}catch{}})};if(!Ce)try{const Ie=Math.floor(Date.now()/1e3);xe.setVisibleRange({from:Ie-30*24*3600,to:Ie},{percentRightMargin:.2}),be()}catch{}try{xe.setEntityMarksVisible(!0)}catch{}xe.onIntervalChanged().subscribe(null,Ie=>{try{const Re=LF[Ie]||Ie||se;Re&&typeof window<"u"&&window.localStorage.setItem("tranding_chart_interval_time",Re)}catch{}try{xe.requestMarksRefresh()}catch{}je()}),we.subscribe("onAutoSaveNeeded",()=>{je()}),je(),C(!0)})})(),()=>{W=!1;const V=x.current,ee=g.current;try{const oe=V&&V.activeChart&&V.activeChart();oe&&(BF(y.current,V,oe),y.current.clear(),BF($.current,V,oe),$.current.clear())}catch{}try{ee&&ee.cleanup&&ee.cleanup()}catch{}try{V&&V.remove&&V.remove()}catch{}x.current=null,g.current=null,C(!1)}},[r,o,l,c,t,e,s]),m.useEffect(()=>{if(!g.current)return;g.current.setWallet(s||null);const W=x.current;if(!W||!v)return;const V=W.activeChart&&W.activeChart();if(V)try{V.requestMarksRefresh&&V.requestMarksRefresh()}catch{}},[s,v]),m.useEffect(()=>{g.current&&typeof g.current.setExtendedApiKey=="function"&&g.current.setExtendedApiKey(o==="extended"&&d||null)},[d,o]),m.useEffect(()=>{if(!g.current||o!=="extended")return;const W=g.current.setExtendedFallbackPrice;typeof W=="function"&&W(u)},[u,o]),m.useEffect(()=>{if(!v||o!=="hyperliquid"&&o!=="extended")return;const W=x.current,V=W&&W.activeChart&&W.activeChart();if(!V||!V.createMultipointShape)return;const ee=y.current;BF(ee,W,V),ee.clear();const oe=Array.isArray(K)?K:[];if(!oe.length)return;const de=V.getVisibleRange&&V.getVisibleRange(),Ce=Math.floor(Date.now()/1e3),me=de&&de.to||Ce,we=new Map;for(const xe of oe){const be=Zde(xe);if(!Number.isFinite(be)||be<=0)continue;const je=xe.sideRaw==="S"?"S":"B",Ie=/take\s*profit/i.test(String(xe.type||"")),Re=/stop/i.test(String(xe.type||"")),Ke=`${be}|${je}|${Ie?"TP":Re?"SL":"L"}`,dt=fqe(xe);if(!we.has(Ke))we.set(Ke,{base:xe,px:be,sz:dt});else{const tt=we.get(Ke);tt.sz+=dt}}we.forEach(({base:xe,px:be,sz:je})=>{const Ie=Mmn(xe),Re={...xe,sz:je},Qe=Omn(Re,t),Ke={time:me,price:be};try{const dt=V.createMultipointShape([Ke],{shape:"horizontal_line",text:Qe,lock:!0,disableSelection:!0,disableSave:!0,overrides:{linecolor:Ie.br,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!0,textcolor:Ie.txt,fillBackground:!0,backgroundColor:Ie.bg,bold:!1,fontsize:11}}),tt=Rmn(Re,t);y.current.set(tt,dt)}catch{}})},[K,v,t,o]),m.useEffect(()=>{if(!v||K.length>0)return;const W=x.current,V=W&&W.activeChart&&W.activeChart();if(!V)return;let ee=null;try{const we=V.getPanes&&V.getPanes();if(Array.isArray(we)&&we[0]){const xe=we[0].getRightPriceScales&&we[0].getRightPriceScales();Array.isArray(xe)&&xe[0]?ee=xe[0]:we[0].getMainSourcePriceScale&&(ee=we[0].getMainSourcePriceScale())}}catch{}const oe=$.current;if(BF(oe,W,V),oe.clear(),!Array.isArray(a)){try{ee&&ee.setAutoScale(!0)}catch{}return}const de=V.getVisibleRange&&V.getVisibleRange(),Ce=Math.floor(Date.now()/1e3),me=de&&de.to||Ce;if(a.forEach((we,xe)=>{const be=Number(typeof we=="number"?we:we&&we.price);if(!Number.isFinite(be)||be<=0)return;const je=typeof we=="object"&&we?we.side:null,Ie=je==="buy"?"#1EC98A":je==="sell"?"#FF5C7A":"#444CFF";try{const Re=V.createMultipointShape([{time:me,price:be}],{shape:"horizontal_line",lock:!0,disableSelection:!0,disableSave:!0,text:"",overrides:{linecolor:Ie,linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0,showLabel:!1,fillBackground:!1}});oe.set(`grid-${t}-${xe}-${be}`,Re)}catch{}}),ee)try{ee.setAutoScale(!0)}catch{}},[a,v,t,K.length]);const ae=n||`tv_${t}_container`;return i.jsx("div",{id:ae,ref:f,className:"relative h-full min-h-[320px] w-full bg-[#101010]"})}const Dmn=({headerData:t,setIsDigits:e,markets:n=[],coin:r="",onCoinChange:s=()=>{},marketsLoading:a=!1})=>{const o=(t==null?void 0:t.source)==="extended",l=(t==null?void 0:t.nextFundingTime)??(t==null?void 0:t.nextFundingRate),[c,u]=m.useState(PQ(l)),[d,f]=m.useState((t==null?void 0:t.markPx)||0),[x,g]=m.useState("text-white"),y=m.useRef((t==null?void 0:t.markPx)||0);m.useEffect(()=>{var ne;if((t==null?void 0:t.markPx)!=null){const J=((ne=t.markPx.toString().split(".")[1])==null?void 0:ne.length)||0;e(J)}},[t==null?void 0:t.markPx,e]),m.useEffect(()=>{u(PQ(l));const ne=setInterval(()=>u(PQ(l)),1e3);return()=>clearInterval(ne)},[l]),m.useEffect(()=>{if((t==null?void 0:t.markPx)==null)return;const ne=t.markPx,J=y.current;ne>J?g("text-[#1DE6A3]"):ne<J&&g("text-[#FF7173]"),f(ne);const K=setTimeout(()=>g("text-white"),700);return y.current=ne,()=>clearTimeout(K)},[t==null?void 0:t.markPx]);const v=(t==null?void 0:t.markPx)!=null&&(t==null?void 0:t.prevDayPx)!=null?t.markPx-t.prevDayPx:null,C=v!=null?v/t.prevDayPx*100:null,N=C!=null?C>=0?"text-[#1DE6A3]":"text-[#FF7173]":"text-white",P=ne=>{const J=Number(ne);if(!Number.isFinite(J))return null;const K=Math.abs(J);let te=1;return K>=1e3?te=1:K>=100?te=2:K>=1?te=3:K>=.1?te=4:te=6,J.toLocaleString(void 0,{maximumFractionDigits:te})},T=ne=>ne==null||isNaN(ne)?null:ne>=1e3?u3(ne):ne,M=ne=>{const J=Number(ne);if(!Number.isFinite(J))return null;const K=Math.abs(J),te=J>=0?"+":"-";if(!o)return`${te}${K.toFixed(5)}`;let fe=0;K<.1?fe=6:K<1?fe=4:K<10?fe=2:K<100&&(fe=1);const q=K.toFixed(fe),se=fe>0?q.replace(/\.?0+$/,""):q;return`${te}${se}`},F=v!=null?M(v):null,$=d!=null?o?P(d):T(d):null,L=(t==null?void 0:t.dayNtlVlm)!=null?`$${u3(Number(t.dayNtlVlm))}`:null,z=(t==null?void 0:t.oraclePx)!=null&&(t==null?void 0:t.openInterest)!=null?`$${u3(Number(t.oraclePx*t.openInterest))}`:null,X=(t==null?void 0:t.funding)!=null?`${(t.funding*100).toFixed(4)}%`:null;return i.jsxs("div",{className:"flex items-center w-full gap-2",children:[i.jsx("div",{className:"flex-none",children:i.jsx(Kde,{markets:n,value:r,onChange:s,loading:a,showIcon:!0})}),i.jsx("div",{className:"flex-1 overflow-x-auto whitespace-nowrap [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:i.jsxs("div",{className:"flex items-center px-1",children:[i.jsx(j7,{label:"Mid Price",value:$,tone:x}),i.jsx(j7,{label:"24h Change",value:F,sub:C!=null?`${C>=0?"+":"-"}${Math.abs(C).toFixed(2)}%`:null,tone:N}),i.jsx(j7,{label:"Vol 24h",value:L}),i.jsx(j7,{label:"Open Interest",value:z}),i.jsx(j7,{label:"Funding",value:X,sub:t!=null&&t.funding?c:null,tone:"text-[#50D2C1]"})]})})]})};function PQ(t){const e=new Date,n=e.getTime(),r=Number(t);if(Number.isFinite(r)&&r>n){const d=Math.max(0,Math.floor((r-n)/1e3)),f=String(Math.floor(d/3600)).padStart(2,"0"),x=String(Math.floor(d%3600/60)).padStart(2,"0"),g=String(d%60).padStart(2,"0");return`${f}:${x}:${g}`}e.setSeconds(e.getSeconds()+1);const s=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds()),a=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()+1,0,0,0),o=Math.floor((a-s)/1e3),l=String(Math.floor(o/3600)).padStart(2,"0"),c=String(Math.floor(o%3600/60)).padStart(2,"0"),u=String(o%60).padStart(2,"0");return`${l}:${c}:${u}`}const j7=({label:t,value:e,sub:n=null,tone:r="text-white"})=>i.jsxs("div",{className:"shrink-0 inline-flex items-baseline gap-1 pr-3 mr-3 border-r border-white/5 last:mr-0 last:pr-0 last:border-r-0",children:[i.jsx("span",{className:"text-[11px] leading-none text-[#909090]",children:t}),i.jsx("span",{className:`text-xs leading-none font-semibold font-inter tabular-nums ${r}`,children:e??i.jsx(Bmn,{w:"90px"})}),n!=null&&i.jsx("span",{className:`text-[11px] leading-none ${r}`,children:n})]}),Bmn=({w:t="90px"})=>i.jsx("span",{className:"inline-block align-middle h-[12px] rounded skeleton-ticker-text short",style:{width:t}}),$mn=({coin:t,data:e,loading:n,period:r,periods:s,handlePeriodChange:a})=>i.jsx("div",{className:"flex justify-start items-start p-4 w-full",children:i.jsxs("div",{className:"flex flex-col items-start justify-center gap-4 w-full",children:[i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[12px] w-full",children:[i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsxs("div",{className:"flex justify-start items-center gap-0.5 xl:gap-2 w-full",children:[i.jsx("div",{className:"text-[#dcdada] text-[11px] xl:text-sm font-semibold font-inter leading-4 tracking-wider uppercase",children:"Positioning"}),n&&i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[32px] xl:w-[54px] px-0.5 xl:px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]})]}),i.jsx("div",{className:"flex xl:hidden",children:i.jsx(ade,{periods:s,selectedPeriod:r,handlePeriod:a,borderColor:"ticker"})})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-1.5 w-full min-w-full border border-[#333333] rounded-lg p-1.5",children:[i.jsx(zp,{name:"Total Positions",info:e!=null&&e.total_notional?`$${ad(e==null?void 0:e.total_notional)}`:"--",color:1}),i.jsx(zp,{name:"Traders",info:e!=null&&e.total_traders?`${ad(e==null?void 0:e.total_traders)}`:"--",color:1,info_1:"true"}),i.jsx(tse,{data_1:e!=null&&e.long_percentage?e==null?void 0:e.long_percentage:0,data_2:e!=null&&e.long_percentage?parseFloat(100-(e==null?void 0:e.long_percentage)).toFixed(2):0,margin:"true"})]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[12px] w-full",children:[i.jsx("div",{className:"text-[#dcdada] text-[11px] xl:text-sm font-semibold font-inter leading-4 tracking-wider uppercase",children:"Breakdown"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-1.5 w-full min-w-full border border-[#333333] rounded-lg p-1.5",children:[i.jsx(zp,{name:"Long",info:e!=null&&e.long_qty?`${_r(e==null?void 0:e.long_qty)} ${t}`:"--",color:2}),i.jsx(zp,{name:"Total",info:e!=null&&e.total_qty?`${_r(e==null?void 0:e.total_qty)} ${t}`:"--",color:1}),i.jsx(zp,{name:"Short",info:e!=null&&e.short_qty?`${_r(e==null?void 0:e.short_qty)} ${t}`:"--",color:3,info_1:"true"}),i.jsx(tse,{data_1:e!=null&&e.long_pct?e==null?void 0:e.long_pct:0,data_2:e!=null&&e.short_pct?e==null?void 0:e.short_pct:0})]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-[12px] w-full",children:[i.jsx("div",{className:"text-[#dcdada] text-[11px] xl:text-sm font-semibold font-inter leading-4 tracking-wider uppercase",children:"Position Stats"}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-1.5 w-full min-w-full border border-[#67FFBD] rounded-lg p-3",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 pb-2.5",children:[i.jsx("div",{className:"text-[#67FFBD] text-[10px] font-semibold font-inter leading-[10px] tracking-wide uppercase",children:"Long"}),i.jsx("img",{src:bJ,alt:""})]}),i.jsx(zp,{name:"Total Notional",info:e!=null&&e.total_long_notional?`$${ad(e==null?void 0:e.total_long_notional)}`:"--",color:1}),i.jsx(zp,{name:"Avg Entry",info:e!=null&&e.avg_long_entry?`$${_r(e==null?void 0:e.avg_long_entry)}`:"--",color:1}),i.jsx(zp,{name:"Total PnL",info:e!=null&&e.total_long_pnl?`$${ad(Math.abs(e==null?void 0:e.total_long_pnl))}`:"--",color:(e==null?void 0:e.total_long_pnl)==null||isNaN(parseFloat(e==null?void 0:e.total_long_pnl))||(e==null?void 0:e.total_long_pnl)==0?1:(e==null?void 0:e.total_long_pnl)>0?2:3,info_1:"true"}),i.jsxs("div",{className:"flex justify-start items-center gap-2 w-full mt-3",children:[i.jsx(UNe,{data_1:e!=null&&e.long_profit_ratio?e==null?void 0:e.long_profit_ratio:0,color:"Long"}),i.jsxs("div",{className:"text-[#7b7b7b] text-[11px] font-normal font-['Inter'] leading-none min-w-max flex justify-start items-center",children:[e!=null&&e.long_profit_ratio?e==null?void 0:e.long_profit_ratio:"--","% in profit"]})]})]}),i.jsxs("div",{className:"flex flex-col items-start justify-center gap-1.5 w-full min-w-full border border-[#FF797C] rounded-lg p-3",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 pb-2.5",children:[i.jsx("div",{className:"text-[#FF797C] text-[10px] font-semibold font-inter leading-[10px] tracking-wide uppercase",children:"Short"}),i.jsx("img",{src:yJ,alt:""})]}),i.jsx(zp,{name:"Total Notional",info:e!=null&&e.total_short_notional?`$${ad(e==null?void 0:e.total_short_notional)}`:"--",color:1}),i.jsx(zp,{name:"Avg Entry",info:e!=null&&e.avg_short_entry?`$${_r(e==null?void 0:e.avg_short_entry)}`:"--",color:1}),i.jsx(zp,{name:"Total PnL",info:e!=null&&e.total_short_pnl?`$${ad(Math.abs(e==null?void 0:e.total_short_pnl))}`:"--",info_1:"true",color:(e==null?void 0:e.total_short_pnl)==null||isNaN(parseFloat(e==null?void 0:e.total_short_pnl))||(e==null?void 0:e.total_short_pnl)==0?1:(e==null?void 0:e.total_short_pnl)>0?2:3}),i.jsxs("div",{className:"flex justify-start items-center gap-2 w-full mt-3",children:[i.jsx(UNe,{data_1:e!=null&&e.short_profit_ratio?e==null?void 0:e.short_profit_ratio:0,color:"Short"}),i.jsxs("div",{className:"text-[#7b7b7b] text-[11px] font-normal font-['Inter'] leading-none min-w-max flex justify-start items-center",children:[e!=null&&e.short_profit_ratio?e==null?void 0:e.short_profit_ratio:"--","% in profit"]})]})]})]})]})}),zp=({name:t,info:e,info_1:n,color:r})=>i.jsxs("div",{className:"flex flex-col items-start w-full gap-1.5",children:[i.jsxs("div",{className:"flex justify-between items-center w-full",children:[i.jsx("div",{className:"text-[#b0b0b0] text-xs font-semibold font-inter leading-none",children:t}),i.jsx("div",{className:`${r==1?"bg-[#313137] text-white":r==2?"bg-[#1de6a3]/20 text-[#67ffbd]":r==3?"bg-[#ff797c]/20 text-[#ff787b]":""} h-6 p-2 rounded-[256px] justify-start items-center gap-2 inline-flex`,children:i.jsx("div",{className:"text-[11px] font-semibold font-inter leading-none",children:e})})]}),i.jsx("div",{className:`${n==="true"?"hidden":""} w-full h-px bg-[#282d33]`})]}),UNe=({data_1:t,color:e})=>i.jsx("div",{className:"h-1 w-full bg-[#333333] rounded-[256px] flex gap-[2px] overflow-hidden",children:i.jsx("div",{style:t?isNaN(t)?{width:"0%"}:{width:`${t}%`}:{width:"0%"},className:`${e=="Long"?"bg-[#67FFBD]":e=="Short"?"bg-[#FF797C]":"bg-[#67FFBD]"} flex justify-center items-center h-1 rounded-[256px] text-[11px] font-bold font-inter leading-[8px] tracking-[0.18px]`})}),Umn="wss://api.hyperliquid.xyz/ws",zmn="https://api.hyperliquid.xyz/info",KD=t=>t==null?0:Number(t),YD=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),Hmn=(t,e)=>{if(isNaN(t))return"--";const n=Number(e);let r=0;return n>0&&n<1&&(r=Math.min(8,Math.max(0,-Math.floor(Math.log10(n))))),t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:r})},Vmn=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},hqe={BTC:{1:{value:1,nSigFigs:null,mantissa:null},10:{value:2,nSigFigs:5,mantissa:null},20:{value:5,nSigFigs:5,mantissa:2},50:{value:10,nSigFigs:5,mantissa:5},100:{value:100,nSigFigs:3,mantissa:null},1e3:{value:1e3,nSigFigs:2,mantissa:null}},ETH:{.1:{value:.1,nSigFigs:null,mantissa:null},.2:{value:.2,nSigFigs:5,mantissa:2},.5:{value:.5,nSigFigs:5,mantissa:5},1:{value:1,nSigFigs:4,mantissa:null},10:{value:10,nSigFigs:3,mantissa:null},100:{value:100,nSigFigs:2,mantissa:null}}},Wmn=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=hqe[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null},qmn=(t,e)=>{if(!t)return null;const n=String(t).toUpperCase(),r=hqe[n];if(!r)return null;const s=Number(e)||0;return Object.values(r).find(l=>l.value===s)||null};function zNe(t,e,n){const r=new Map;for(const s of t||[]){const a=KD(s.px),o=KD(s.sz);if(!a||!o||!e)continue;const l=n==="bid"?Math.floor(a/e)*e:Math.ceil(a/e)*e,c=Number(l.toFixed(12));r.set(c,(r.get(c)||0)+o)}return[...r.entries()].map(([s,a])=>({price:s,size:a}))}async function Gmn(t){var o;const n=await fetch(zmn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"l2Book",coin:t})});if(!n.ok)throw new Error("info request failed");const r=await n.json(),s=(r==null?void 0:r.levels)||((o=r==null?void 0:r.data)==null?void 0:o.levels),a=Array.isArray(s==null?void 0:s[0])&&s[0]||(s==null?void 0:s.bs)||(s==null?void 0:s.bids)||[];if(!Array.isArray(a)||!a.length)throw new Error("orderbook empty or bad format");return a}function Kmn(t){const e=t.slice(0,10).map(o=>Number(o.px??(Array.isArray(o)?o[0]:void 0))).filter(o=>Number.isFinite(o)),n=[];for(let o=0;o<e.length-1;o++){const l=e[o]-e[o+1];l>0&&n.push(l)}if(!n.length)return 0;const s=Math.min(...n).toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),a=Number(s);return Number.isFinite(a)?a:0}function Ymn(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function Xmn(t,e){if(!t||t<=0)return[];const n=Math.floor(Math.log10(t)),r=[];e>0&&r.push(e);const s=n-4,a=Math.pow(10,s);[1,2,5].forEach(g=>r.push(g*a));const o=n-3;r.push(Math.pow(10,o));const l=n-2;r.push(Math.pow(10,l));const c=n-1;r.push(Math.pow(10,c));const u=r.filter(g=>g>0&&Number.isFinite(g)).map(Ymn),d=Array.from(new Set(u)).sort((g,y)=>g-y),f=e>0?e:0;return d.filter(g=>g>=f&&g>0)}function HNe(t){const n=(t||"").toUpperCase()==="BTC"?[1,10,20,50,100,1e3,1e4]:[.001,.01,.1,10,100];return Array.from(new Set(n)).sort((r,s)=>r-s)}async function Qmn(t){if(!t)return[];const e=String(t).trim(),n=Wmn(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await Gmn(e),a=s[0],o=Number((a==null?void 0:a.px)??(Array.isArray(a)?a[0]:void 0));if(!Number.isFinite(o)||o<=0)throw new Error("bad bestBid");const l=Kmn(s);let c=Xmn(o,l);return r!=="BTC"?c=c.filter(u=>u!==1):c.includes(1)||c.push(1),c=Array.from(new Set(c.filter(u=>Number.isFinite(u)&&u>0))).sort((u,d)=>u-d),c.length?c:HNe(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),HNe(e)}}function Zmn(t,e){const n=qmn(e,t);if(n)return{nSigFigs:n.nSigFigs,mantissa:n.mantissa};const r=Number(t)||0;let s=null;r>=1e4?s=2:r>=1e3?s=3:r>=100?s=4:r>=10&&(s=5);let a;if(s===5&&r>=10){const o=Math.pow(10,Math.floor(Math.log10(r))),l=Math.floor(r/o);l<2?a=1:l<5?a=2:a=5}return{nSigFigs:s,mantissa:a}}function Jmn(t,e){return!t&&!e?!0:!t||!e?!1:t.type===e.type&&t.coin===e.coin&&(t.nSigFigs??null)===(e.nSigFigs??null)&&(t.mantissa??null)===(e.mantissa??null)}function e0n({coin:t,rows:e=10,onSelectPrice:n,onBest:r}){const s=m.useRef(null),a=m.useRef([]),o=m.useRef(null),l=m.useRef(0),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState({bids:[],asks:[]}),[x,g]=m.useState("COIN"),[y,v]=m.useState(null),[C,N]=m.useState([]),P=(W,V)=>x==="USD"?W*V:W,T=x==="USD"?"USD":t,M=W=>{const V=s.current;V&&V.readyState===WebSocket.OPEN?V.send(JSON.stringify(W)):(a.current.push(W),F())},F=()=>{const W=s.current;if(W&&(W.readyState===WebSocket.OPEN||W.readyState===WebSocket.CONNECTING)||o.current)return;const V=new WebSocket(Umn);s.current=V,V.onopen=()=>{l.current=0,a.current.splice(0,a.current.length).forEach(oe=>V.send(JSON.stringify(oe)))},V.onmessage=ee=>{var Re;const oe=JSON.parse(ee.data||"{}");if((oe==null?void 0:oe.channel)!=="l2Book")return;const de=(oe==null?void 0:oe.data)??oe,Ce=(de==null?void 0:de.coin)??(oe==null?void 0:oe.coin);if(!Ce||Ce!==c.current)return;const me=(de==null?void 0:de.levels)??((Re=de==null?void 0:de.data)==null?void 0:Re.levels)??(oe==null?void 0:oe.levels);let we,xe;if(Array.isArray(me))we=me[0]||[],xe=me[1]||[];else if(me)we=me.bs||me.bids||[],xe=me.as||me.asks||[];else return;const be=Qe=>(Qe||[]).map(Ke=>{const dt=Number(Array.isArray(Ke)?Ke[0]:Ke.px),tt=Number(Array.isArray(Ke)?Ke[1]:Ke.sz);return{px:dt,sz:tt}}).filter(Ke=>Number.isFinite(Ke.px)&&Ke.px>0&&Number.isFinite(Ke.sz)&&Ke.sz>0),je=be(we),Ie=be(xe);f({bids:je,asks:Ie})},V.onclose=()=>{l.current=Math.min(l.current+1,6),o.current=setTimeout(()=>{o.current=null,F()},500*Math.pow(2,l.current))},V.onerror=()=>{try{V.close()}catch{}}},$=W=>{W&&(Jmn(u.current,W)||(u.current&&M({method:"unsubscribe",subscription:u.current}),u.current=W,M({method:"subscribe",subscription:W})))},L=()=>{f({bids:[],asks:[]})};m.useEffect(()=>{let W=!1;try{s.current&&s.current.readyState<=1&&(s.current.onmessage=null,s.current.onopen=null,s.current.onclose=null,s.current.onerror=null,s.current.close())}catch{}if(s.current=null,u.current=null,a.current=[],l.current=0,o.current=null,L(),N([]),v(null),c.current=t||null,!!t)return F(),(async()=>{const V=await Qmn(t);W||(N(V),v(V[0]??null))})(),()=>{W=!0}},[t]),m.useEffect(()=>{if(!t)return;const W=y||1,{nSigFigs:V,mantissa:ee}=Zmn(W,t),oe={type:"l2Book",coin:t};V!=null&&(oe.nSigFigs=V),ee!=null&&(oe.mantissa=ee),$(oe)},[t,y]);const z=m.useMemo(()=>(d.bids||[]).map(W=>KD(W.px)).filter(W=>Number.isFinite(W)&&W>0),[d]),X=m.useMemo(()=>(d.asks||[]).map(W=>KD(W.px)).filter(W=>Number.isFinite(W)&&W>0),[d]),ne=z.length?Math.max(...z):null,J=X.length?Math.min(...X):null;m.useEffect(()=>{ne!=null&&J!=null&&(r==null||r({bestBid:ne,bestAsk:J,mid:(ne+J)/2}))},[ne,J,r]);const K=m.useMemo(()=>{const W=Number(y)||1,V=zNe(d.bids,W,"bid").sort((oe,de)=>de.price-oe.price),ee=zNe(d.asks,W,"ask").sort((oe,de)=>oe.price-de.price);return{bids:V,asksAsc:ee}},[d,y]),te=m.useMemo(()=>{const W=K.asksAsc.slice(0,e);let V=0;return W.map(oe=>(V+=P(oe.size,oe.price),{...oe,total:V})).reverse()},[K,e,x]),fe=m.useMemo(()=>{const W=K.bids.slice(0,e);let V=0;return W.map(ee=>(V+=P(ee.size,ee.price),{...ee,total:V}))},[K,e,x]),q=m.useMemo(()=>{if(ne==null||J==null)return null;const W=Math.abs(J-ne),V=(J+ne)/2;return{diff:W,pct:V?W/V*100:0}},[ne,J]),se=Math.max(te.reduce((W,V)=>Math.max(W,V.total||0),0),1e-9),ae=Math.max(fe.reduce((W,V)=>Math.max(W,V.total||0),0),1e-9);return i.jsxs("div",{className:"flex flex-col h-full w-full font-semibold font-inter",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#292929]",children:[i.jsx(WNe,{value:String(y??""),onChange:W=>v(Number(W)),items:(C||[]).map(W=>({key:String(W),label:Vmn(W)}))}),i.jsx(WNe,{value:x,onChange:g,items:[{key:"USD",label:"USD"},{key:"COIN",label:t}],align:"right"})]}),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] w-full",children:[i.jsx("span",{className:"uppercase",children:"Price"}),i.jsxs("span",{className:"uppercase text-center",children:["Size (",T,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",T,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[te.map((W,V)=>i.jsx(VNe,{side:"ask",step:Number(y)||1,price:W.price,size:W.size!=null?P(W.size,W.price):null,total:W.total,widthPct:W.total?Math.min(100,W.total/se*100):0,onClick:()=>W.price!=null&&(n==null?void 0:n(W.price)),unit:x},`ask-${V}`)),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] border-y border-[#292929] my-1 w-full",children:[i.jsx("span",{className:"uppercase",children:"Spread"}),i.jsx("span",{className:"text-right",children:q?YD(q.diff,4):"--"}),i.jsx("span",{className:"text-right",children:q?`${YD(q.pct,4)}%`:"--"})]}),fe.map((W,V)=>i.jsx(VNe,{side:"bid",step:Number(y)||1,price:W.price,size:W.size!=null?P(W.size,W.price):null,total:W.total,widthPct:W.total?Math.min(100,W.total/ae*100):0,onClick:()=>W.price!=null&&(n==null?void 0:n(W.price)),unit:x},`bid-${V}`))]})})]})}function VNe({side:t,price:e,size:n,total:r,widthPct:s,onClick:a,step:o,unit:l}){const c=e==null,u=t==="bid"?"from-transparent to-[#67ffbd]/30":"from-transparent to-[#FF7272]/30",d=t==="bid"?"text-[#67FFBD]":"text-[#FF797C]",f=l==="USD";return i.jsxs("div",{className:"relative w-full font-semibold",children:[!c&&i.jsx("div",{className:`absolute left-0 top-px bottom-px bg-gradient-to-r ${u} transition-all duration-300 ease-[cubic-bezier(0.42,0,0.58,1)]`,style:{width:`${Math.max(0,s-2)}%`}}),i.jsxs("div",{className:`grid grid-cols-[84px_1fr_1fr] px-3 py-1 text-xs relative w-full ${c?"":"cursor-pointer"}`,onClick:c?void 0:a,children:[i.jsx("span",{className:`${c?"text-[#555]":d} hover:text-white`,children:c?"—":Hmn(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":YD(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":YD(r,f?0:6)})]})]})}function WNe({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=m.useState(!1),o=m.useRef(null);return m.useEffect(()=>{if(!s)return;const u=d=>{o.current&&(o.current.contains(d.target)||a(!1))};return window.addEventListener("mousedown",u),window.addEventListener("touchstart",u),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("touchstart",u)}},[s]),i.jsxs("div",{className:"relative",ref:o,children:[i.jsxs("button",{className:"h-7 px-2 text-xs rounded-md border border-[#292929] bg-[#101010] text-[#dcdada] flex items-center gap-1",onClick:()=>a(u=>!u),children:[((l=n.find(u=>u.key===t))==null?void 0:l.label)??((c=n.find(u=>String(u.key)===String(t)))==null?void 0:c.label)??t,i.jsx("span",{className:"text-[#8b8b8b]",children:"▾"})]}),s&&i.jsx("div",{className:`absolute z-10 mt-1 min-w-[80px] rounded-md border border-[#292929] bg-[#101010] p-1 ${r==="right"?"right-0":"left-0"}`,children:n.map(u=>i.jsx("div",{className:`px-2 py-1 text-xs rounded cursor-pointer ${String(u.key)===String(t)?"bg-[#262626] text-white":"text-[#dcdada] hover:bg-[#262626]"}`,onClick:()=>{e(u.key),a(!1)},children:u.label},u.key))})]})}const t0n="wss://api.hyperliquid.xyz/ws",n0n=t=>`https://app.hyperliquid.xyz/explorer/tx/${t}`,qNe=t=>t==null?0:Number(t),r0n=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),s0n=t=>isNaN(t)?"--":t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:4}),i0n=t=>new Date(t).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});function a0n({coin:t,maxRows:e=300}){const n=m.useRef(null),r=m.useRef(null),s=m.useRef([]),a=m.useRef(null),[o,l]=m.useState([]);m.useEffect(()=>{var g,y;const u=v=>({method:"subscribe",subscription:{type:"trades",coin:v}}),d=v=>({method:"unsubscribe",subscription:{type:"trades",coin:v}});if(!n.current)n.current=new WebSocket(t0n),n.current.onopen=()=>{var v;(v=n.current)==null||v.send(JSON.stringify(u(t))),a.current=setInterval(()=>{var C;try{(C=n.current)==null||C.send(JSON.stringify({method:"ping"}))}catch{}},3e4)};else{if(r.current&&r.current!==t)try{(g=n.current)==null||g.send(JSON.stringify(d(r.current)))}catch{}try{(y=n.current)==null||y.send(JSON.stringify(u(t)))}catch{}}const f=v=>{const C=JSON.parse(v.data||"{}");if((C==null?void 0:C.channel)==="trades"&&(C!=null&&C.data)){const N=Array.isArray(C.data)?C.data:[C.data];s.current.push(...N)}};n.current.addEventListener("message",f);const x=setInterval(()=>{if(!s.current.length)return;const v=s.current.splice(0,s.current.length);l(C=>{const N=[...v,...C],P=[],T=new Set;for(const M of N){const F=M.tid??`${M.hash??""}-${M.time??""}`;if(!T.has(F)&&(T.add(F),P.push(M),P.length>=e))break}return P.sort((M,F)=>(F.time||0)-(M.time||0)),P})},150);return r.current=t,()=>{var v;(v=n.current)==null||v.removeEventListener("message",f),clearInterval(x)}},[t,e]),m.useEffect(()=>()=>{var u;a.current&&clearInterval(a.current);try{(u=n.current)==null||u.close()}catch{}},[]);const c=m.useMemo(()=>o,[o]);return i.jsxs("div",{className:"flex flex-col h-full w-full font-semibold",children:[i.jsxs("div",{className:"grid grid-cols-[100px_1fr_90px_28px] px-3 py-2 text-[11px] text-[#9b9b9b]",children:[i.jsx("span",{className:"uppercase whitespace-nowrap",children:"PRICE"}),i.jsxs("span",{className:"uppercase text-center whitespace-nowrap",children:["SIZE (",String(t).toUpperCase(),")"]}),i.jsx("span",{className:"uppercase text-right whitespace-nowrap",children:"TIME"}),i.jsx("span",{})]}),i.jsx("div",{className:"flex-1 overflow-auto",children:c.map(u=>{const d=qNe(u.px),f=qNe(u.sz),y=String(u.side||"").toLowerCase().startsWith("b")?"text-[#67FFBD]":"text-[#FF797C]";return i.jsxs("div",{className:"grid grid-cols-[100px_1fr_90px_28px] px-3 py-1.5 text-xs items-center font-inter",children:[i.jsx("div",{className:y,children:s0n(d)}),i.jsx("div",{className:"text-right text-[#dcdada]",children:r0n(f)}),i.jsx("div",{className:"text-right text-[#a8a8a8]",children:u.time?i0n(u.time):"--:--:--"}),i.jsx("div",{className:"flex justify-end",children:u.hash?i.jsx("a",{href:n0n(u.hash),target:"_blank",rel:"noreferrer",className:"text-white hover:text-white opacity-70 hover:opacity-100",children:i.jsx(yrt,{className:"w-4 h-4 shrink-0"})}):null})]},(u.tid??u.hash)+String(u.time))})})]})}function o0n({coin:t,data:e,loading:n,period:r,periods:s,handlePeriodChange:a,onBookPrice:o,onBest:l,className:c=""}){const[u,d]=m.useState("orderbook"),[f,x]=m.useState("orderbook"),g=[{k:"orderbook",t:"Order Book"},{k:"trades",t:"Trades"}],y=N=>{x(u),d(N)},v=g.findIndex(N=>N.k===u)>g.findIndex(N=>N.k===f)?"right":"left",C={enter:N=>({x:N==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:N=>({x:N==="right"?-24:24,opacity:0})};return i.jsx("div",{className:`flex h-full min-h-0 flex-col gap-2 ${c}`,children:i.jsxs("div",{className:"bg-[#101010] flex-1 min-h-0 overflow-hidden relative rounded-[16px] pt-2",children:[i.jsx("div",{className:"relative flex w-full px-2 gap-2",children:g.map(N=>{const P=u===N.k;return i.jsxs("button",{onClick:()=>y(N.k),className:`relative flex-1 flex items-center justify-center py-[6px] cursor-pointer font-semibold text-xs rounded-[12px] bg-transparent ${P?"text-white":"text-[#a8a8a8] hover:text-white"}`,children:[P&&i.jsx(Ao.span,{layoutId:"side-pill",className:"absolute inset-0 bg-[#262626] rounded-[12px]",transition:{type:"spring",stiffness:380,damping:30}}),i.jsx("span",{className:"relative z-10",children:N.t})]},N.k)})}),i.jsx("div",{className:"relative w-full h-[calc(100%-40px)] min-h-0",children:i.jsx(nP,{mode:"wait",custom:v,children:i.jsxs(Ao.div,{custom:v,variants:C,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:320,damping:28},className:"absolute inset-0",children:[u==="position"&&i.jsx("div",{className:"h-full overflow-auto",children:i.jsx($mn,{coin:t,data:e,loading:n,period:r,periods:s,handlePeriodChange:a})}),u==="orderbook"&&i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(e0n,{coin:t,rows:9,onSelectPrice:o,onBest:l})}),u==="trades"&&i.jsx("div",{className:"h-full overflow-auto",children:i.jsx(a0n,{coin:t})})]},u)})})]})})}const pqe="#101010",Ro="#101010",Ra="#2b3640",Bi="#929292",wi="#929292",Hg="#67FFBD",d9="#FF7272",l0n="https://dextrabothypev2.nftinit.io",c0n=[{key:"market",label:"Market"},{key:"limit",label:"Limit"},{key:"twap",label:"Twap"}];function u0n({mode:t,onModeChange:e,className:n=""}){const r=m.useMemo(()=>c0n,[]),s=m.useRef(null),a=m.useRef({}),[o,l]=m.useState({w:0,x:0}),c=()=>{const u=a.current[t],d=s.current;if(!u||!d)return;const f=u.getBoundingClientRect(),x=d.getBoundingClientRect();l({w:f.width,x:f.left-x.left})};return m.useEffect(()=>{c()},[t]),m.useEffect(()=>{const u=()=>c();return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[t]),i.jsxs("div",{ref:s,className:`relative flex items-center justify-evenly gap-8 ${n}`,style:{borderBottom:`1px solid ${Ra}`},children:[r.map(u=>{const d=t===u.key;return i.jsx("button",{ref:f=>a.current[u.key]=f,onClick:()=>e(u.key),className:"relative font-semibold bg-transparent",style:{color:d?"#FFFFFF":wi,opacity:d?1:.85,letterSpacing:"-0.01em"},children:u.label},u.key)}),i.jsx("div",{className:"absolute bottom-[-1px] left-0 h-[2px] rounded-full transition-all duration-200",style:{width:o.w,transform:`translateX(${o.x}px)`,background:"#67FFBD"}})]})}function z4({children:t,onClick:e}){return i.jsx("button",{onClick:e,className:"w-full px-[16px] py-[6px] bg-[#262626] grid place-items-center rounded-[8px] text-white font-semibold",style:{border:`1px solid ${Ra}`},children:t})}function Pb({label:t,value:e,onChange:n,right:r,clearZeroOnFocus:s=!0,restoreZeroOnBlur:a=!0}){const o=r?Ne.cloneElement(r,{onClick:c=>{Number(e)===0&&n(""),typeof r.props.onClick=="function"&&r.props.onClick(c)}}):null,l=c=>{let u=c.target.value;if(u===""||u==="."){n(u);return}if(u.includes(".")){const[d,f=""]=u.split(".");u=f?`${d}.${f.slice(0,2)}`:d}n(u)};return i.jsxs("div",{className:"mb-3",children:[i.jsx("div",{className:"mb-1",style:{color:wi},children:t}),i.jsxs("div",{className:"flex items-center gap-2 h-[30px] px-2 rounded-lg",style:{background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none font-inter text-white placeholder:text-gray-500",inputMode:"decimal",type:"number",value:e,onChange:l,onFocus:()=>{s&&String(e)!==""&&Number(e)===0&&n("")},onBlur:c=>{a&&(c.target.value===""||c.target.value===".")&&n("0")},placeholder:"0.00",style:{fontFeatureSettings:'"tnum"'}}),i.jsx("div",{className:"shrink-0",children:o})]})]})}function $F({value:t,onChange:e,items:n}){var o;const[r,s]=m.useState(!1),a=((o=n.find(l=>l.key===t))==null?void 0:o.label)??t;return i.jsxs("div",{className:"relative",children:[i.jsxs("div",{onClick:()=>s(l=>!l),className:"h-[26px] px-2 rounded-md flex justify-center items-center cursor-pointer",style:{background:Ro,color:Bi},children:[a," ▾"]}),r&&i.jsx("div",{className:"absolute right-0 z-40 mt-1 min-w-[140px] rounded-md p-1",style:{background:Ro,border:`1px solid ${Ra}`},children:n.map(l=>i.jsx("div",{className:"px-2 py-1 rounded cursor-pointer",style:{background:l.key===t?"#26313b":"transparent",color:l.key===t?"#ffffff":Bi},onClick:()=>{e(l.key),s(!1)},children:l.label},l.key))})]})}function Mv({k:t,v:e,strong:n=!1,link:r=!1}){return i.jsxs("div",{className:"flex items-center justify-between text-[#929292] font-inter text-[13px] font-normal leading-4 space-y-2",children:[i.jsx("span",{children:t}),i.jsx("span",{style:{color:Bi},children:e})]})}function GNe({children:t,onClick:e,className:n=""}){return i.jsx("button",{onClick:e,className:`flex justify-center items-center h-[30px] px-4 py-2 shrink-0 rounded-lg border border-[rgba(80,80,80,0.32)] text-white font-inter text-[13px] not-italic font-normal leading-[16px] bg-transparent ${n}`,children:t})}function ym({title:t,children:e}){return i.jsxs("div",{className:"w-[520px] max-w-[92vw]",style:{background:pqe,border:`1px solid ${Ra}`,borderRadius:16,padding:16},children:[t&&i.jsx("div",{className:"mb-3 text-sm font-semibold",style:{color:Bi},children:t}),e]})}function z0({children:t,onClick:e}){return i.jsx("button",{onClick:e,className:"w-full h-[38px] rounded-xl font-semibold text-sm",style:{background:Hg,color:"#0f151a"},children:t})}function IQ({active:t,onClick:e,title:n,desc:r}){return i.jsxs("button",{onClick:e,className:"w-full text-left rounded-xl p-3 mb-2",style:{background:t?"rgba(103,255,189,0.12)":Ro,border:`1px solid ${t?"#67FFBD":Ra}`,color:Bi},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t?"#67FFBD":"#555"}}),i.jsx("div",{className:"font-semibold",children:n})]}),i.jsx("div",{className:"text-[12px] leading-5",style:{color:wi},children:r})]})}function lp({open:t,onClose:e,children:n}){const[r,s]=m.useState(!1),[a,o]=m.useState(!1);return m.useEffect(()=>{if(t)s(!0),requestAnimationFrame(()=>o(!0)),document.body.style.overflow="hidden";else{o(!1),document.body.style.overflow="";const l=setTimeout(()=>s(!1),200);return()=>clearTimeout(l)}},[t]),m.useEffect(()=>{const l=c=>{c.key==="Escape"&&e()};return t&&window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t,e]),r?Aa.createPortal(i.jsx("div",{className:`fixed inset-0 z-[9999] flex items-center justify-center transition-opacity ${a?"opacity-100":"opacity-0"}`,style:{background:"rgba(0,0,0,0.45)",backdropFilter:"blur(6px)"},onMouseDown:e,children:i.jsx("div",{className:`transform transition-all ${a?"translate-y-0 scale-100":"translate-y-2 scale-[0.98]"} relative`,onMouseDown:l=>l.stopPropagation(),children:n})}),document.body):null}function om({onClick:t}){return i.jsx("button",{onClick:t,className:"w-full h-[36px] rounded-xl font-bold text-[12px] transition-opacity mb-2 flex items-center justify-center bg-[#67FFBD] text-black",children:"Connect"})}function Ase(t=""){return t?`${t.slice(0,6)}...${t.slice(-4)}`:""}const FQ="https://api.hyperliquid.xyz/info",d0n="wss://api.hyperliquid.xyz/ws",OQ={accountValue:0,withdrawable:0,totalNtlPos:0,totalRawUsd:0,totalMarginUsed:0,crossMaintenanceMarginUsed:0,unrealizedPnl:0,crossAccountValue:0};function sP(t){const[e,n]=m.useState(OQ),[r,s]=m.useState([]),[a,o]=m.useState({}),[l,c]=m.useState({}),[u,d]=m.useState({}),[f,x]=m.useState(!1),g=m.useRef(null),y=m.useRef(null);m.useEffect(()=>{let P=!0;return n(OQ),s([]),o({}),c({}),d({}),x(!1),t?((async()=>{try{const[T,M,F]=await Promise.all([fetch(FQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:t})}),fetch(FQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotClearinghouseState",user:t})}),fetch(FQ,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"spotMeta"})})]);if(!P)return;const $=await T.json(),L=await M.json(),z=await F.json(),X=($==null?void 0:$.marginSummary)||{},ne=($==null?void 0:$.crossMarginSummary)||{},J=Array.isArray($==null?void 0:$.assetPositions)?$.assetPositions.reduce((ae,W)=>{var V;return ae+Number(((V=W==null?void 0:W.position)==null?void 0:V.unrealizedPnl)||0)},0):0,K={accountValue:Number((X==null?void 0:X.accountValue)||0),totalNtlPos:Number((X==null?void 0:X.totalNtlPos)||0),totalRawUsd:Number((X==null?void 0:X.totalRawUsd)||0),withdrawable:Number(($==null?void 0:$.withdrawable)||0),totalMarginUsed:Number((X==null?void 0:X.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number(($==null?void 0:$.crossMaintenanceMarginUsed)||0),unrealizedPnl:J,crossAccountValue:Number((ne==null?void 0:ne.accountValue)||0)},te=Array.isArray(L==null?void 0:L.balances)?L.balances.map(ae=>({coin:String(ae.coin),total:Number(ae.total||0),hold:Number(ae.hold||0)})):[],fe={},q={};if((Array.isArray(z==null?void 0:z.tokens)?z.tokens:[]).forEach(ae=>{const W=ae==null?void 0:ae.name;W&&(ae.tokenId&&(fe[W]=ae.tokenId),q[W]={tokenId:ae.tokenId||null,evmContract:ae.evmContract||null})}),!P)return;n(K),s(te),o(fe),c(q)}catch{if(!P)return;n(OQ),s([]),o({}),c({})}finally{P&&x(!0)}})(),()=>{P=!1}):(P&&x(!0),()=>{P=!1})},[t]),m.useEffect(()=>{if(!t)return;const P=new WebSocket(d0n);return g.current=P,P.onopen=()=>{[{method:"subscribe",subscription:{type:"user",user:t}},{method:"subscribe",subscription:{type:"webData2",user:t}}].forEach(T=>P.send(JSON.stringify(T))),y.current=setInterval(()=>{P.readyState===WebSocket.OPEN&&P.send(JSON.stringify({id:99,method:"ping"}))},3e4)},P.onmessage=T=>{var M,F,$,L,z,X;try{const ne=JSON.parse(T.data);if((ne==null?void 0:ne.channel)==="webData2"&&((M=ne==null?void 0:ne.data)!=null&&M.clearinghouseState)){const K=ne.data.clearinghouseState,te=(K==null?void 0:K.marginSummary)||{},fe=(K==null?void 0:K.crossMarginSummary)||{},q=Array.isArray(K==null?void 0:K.assetPositions)?K.assetPositions.reduce((se,ae)=>{var W;return se+Number(((W=ae==null?void 0:ae.position)==null?void 0:W.unrealizedPnl)||0)},0):0;n(se=>({...se,accountValue:Number((te==null?void 0:te.accountValue)||0),totalNtlPos:Number((te==null?void 0:te.totalNtlPos)||0),totalRawUsd:Number((te==null?void 0:te.totalRawUsd)||0),withdrawable:(K==null?void 0:K.withdrawable)!=null?Number(K.withdrawable):se.withdrawable,totalMarginUsed:Number((te==null?void 0:te.totalMarginUsed)||0),crossMaintenanceMarginUsed:Number((K==null?void 0:K.crossMaintenanceMarginUsed)||0),crossAccountValue:Number((fe==null?void 0:fe.accountValue)||0),unrealizedPnl:q}))}if((ne==null?void 0:ne.channel)==="webData2"&&Array.isArray((F=ne==null?void 0:ne.data)==null?void 0:F.assetCtxs)){const K={};for(const te of ne.data.assetCtxs){const fe=te==null?void 0:te.coin,q=Number((te==null?void 0:te.midPx)??(te==null?void 0:te.markPx)??(te==null?void 0:te.px));fe&&Number.isFinite(q)&&(K[fe]=q)}Object.keys(K).length&&d(te=>({...te,...K}))}if((ne==null?void 0:ne.channel)==="user"&&(($=ne==null?void 0:ne.data)!=null&&$.state)){const K=ne.data.state,te=(K==null?void 0:K.marginSummary)||{},fe=Array.isArray(K==null?void 0:K.assetPositions)?K.assetPositions.reduce((q,se)=>{var ae;return q+Number(((ae=se==null?void 0:se.position)==null?void 0:ae.unrealizedPnl)||0)},0):void 0;n(q=>({...q,accountValue:Number((te==null?void 0:te.accountValue)||0),totalNtlPos:Number((te==null?void 0:te.totalNtlPos)||0),totalRawUsd:Number((te==null?void 0:te.totalRawUsd)||0),totalMarginUsed:Number((te==null?void 0:te.totalMarginUsed)||0),...fe!=null?{unrealizedPnl:fe}:{}}))}const J=Array.isArray((z=(L=ne==null?void 0:ne.data)==null?void 0:L.spotState)==null?void 0:z.balances)?ne.data.spotState.balances:Array.isArray((X=ne==null?void 0:ne.data)==null?void 0:X.balances)?ne.data.balances:null;if(Array.isArray(J)){const K=J.filter(te=>te&&te.coin).map(te=>({coin:String(te.coin),total:Number(te.total||0),hold:Number(te.hold||0)}));s(K)}}catch{}},P.onclose=()=>{y.current&&clearInterval(y.current)},P.onerror=()=>{},()=>{y.current&&clearInterval(y.current);try{P.close()}catch{}}},[t]);const v=m.useMemo(()=>({spot:r.reduce((T,M)=>{if(M.coin==="USDC")return T+Number(M.total||0);const F=u[M.coin];return T+(F?Number(M.total||0)*Number(F):0)},0),perps:e.accountValue}),[r,u,e.accountValue]),C=m.useMemo(()=>{const P=e.accountValue,T=e.unrealizedPnl,M=Number(e.crossAccountValue||0)>0?Number(e.crossAccountValue||0):Number(P||0),F=M>0?Number(e.crossMaintenanceMarginUsed||0)/M:0,$=Number(e.crossMaintenanceMarginUsed||0),L=P>0?e.totalNtlPos/P:0;return{balance:P,uPnl:T,cmr:F,maintenanceMargin:$,crossLeverage:L}},[e]);return{rows:m.useMemo(()=>{const P=[];return P.push({id:"perps",kind:"perps",coin:"USDC",unit:"USDC",totalDisplay:e.accountValue,totalSort:e.accountValue,availableDisplay:e.withdrawable,availableSort:e.withdrawable,usdcValue:e.accountValue}),r.forEach(T=>{const M=Math.max(0,Number(T.total||0)-Number(T.hold||0)),F=u[T.coin],$=T.coin==="USDC"?Number(T.total||0):Number(F)?Number(T.total||0)*Number(F):null;P.push({id:`spot-${T.coin}`,kind:"spot",coin:T.coin,unit:T.coin,totalDisplay:T.total,totalSort:T.total,availableDisplay:M,availableSort:M,usdcValue:$})}),P},[e,r,u]),perps:e,spotBalances:r,tokenIdMap:a,tokenMetaMap:l,priceMap:u,accountEquity:v,perpsOverview:C,initialLoaded:f}}const f0n="https://dextrabothypev2.nftinit.io/api/wallet/request-agent",h0n="https://express-proxy-delta.vercel.app/proxy?url=",p0n="https://api.starknet.extended.exchange/api/v1",mqe=t=>`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})} USDC`;function m0n({w:t,active:e,onSelect:n,open:r,mode:s,balances:a}){const[o,l]=m.useState(!1),[c,u]=m.useState(!1);m.useEffect(()=>{try{l(!!localStorage.getItem("hyperToken"))}catch{}},[]);const d=(t.wallet_address||"").toLowerCase(),{perpsOverview:f}=sP(d),x=f==null?void 0:f.balance,g=a&&a[t.wallet_id!=null?String(t.wallet_id):""],y=t.available_balance??t.availableForTrade??t.available_for_trade??t.balance??t.available??null;let v=null;s==="lighter"||s==="extended"?v=g!=null?Number(g):y!=null?Number(y):NaN:v=x;const C=Number.isFinite(v);return m.useEffect(()=>{if(!r||!o)return;u(!0);const N=setTimeout(()=>u(!1),2e3);return()=>clearTimeout(N)},[r,o,d]),m.useEffect(()=>{C&&u(!1)},[C]),i.jsxs("div",{className:"px-3 py-2 rounded cursor-pointer",style:{background:e?"#26313b":"transparent",color:e?"#ffffff":Bi},onClick:n,children:[i.jsxs("div",{className:"text-xs font-semibold flex items-center gap-2",children:[i.jsx("span",{children:t.wallet_name}),c?i.jsx(FVe,{size:3,color:"#ffffff"}):C?i.jsxs("span",{className:"text-[11px]",children:["— ",mqe(v)]}):""]}),i.jsx("div",{className:"text-[11px]",style:{color:wi},children:Ase(t.wallet_address)})]})}function iP({wallets:t=[],value:e,onChange:n,selectedBalance:r,mode:s="hyper"}){const[a,o]=m.useState(!1),[l,c]=m.useState(!1),[u,d]=m.useState(0),[f,x]=m.useState(!1),[g,y]=m.useState({}),v=m.useRef(new Set),C=m.useRef(null),N=m.useRef(null),{address:P}=ns();m.useEffect(()=>{const X=()=>{try{c(!!localStorage.getItem("hyperToken")),d(ne=>ne+1)}catch{}};return X(),window.addEventListener("localStorageUpdated",X),window.addEventListener("storage",X),()=>{window.removeEventListener("localStorageUpdated",X),window.removeEventListener("storage",X)}},[]),m.useEffect(()=>{if(!l||!e)return;x(!0);const X=setTimeout(()=>x(!1),2e3);return()=>clearTimeout(X)},[e,l]),m.useEffect(()=>{var ne;Number.isFinite(Number(r))&&x(!1);const X=t&&t.length?String(((ne=t.find(J=>String(J.wallet_id)===String(e))||t[0])==null?void 0:ne.wallet_id)??""):null;X&&Number.isFinite(Number(r))&&Number(r)>=0&&(C.current=X,y(J=>J[X]===Number(r)?J:{...J,[X]:Number(r)}))},[r,t,e]),m.useEffect(()=>{const X=J=>{N.current&&(N.current.contains(J.target)||o(!1))},ne=J=>{J.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",X,!0),document.addEventListener("keydown",ne),()=>{document.removeEventListener("pointerdown",X,!0),document.removeEventListener("keydown",ne)}},[]);const T=t&&t.length>0,M=T?t.find(X=>String(X.wallet_id)===String(e))||(e?null:t[0]):null,F=M&&M.wallet_address?`${M.wallet_name||`Wallet ${M.wallet_id}`} — ${Ase(M.wallet_address)}`:M?M.wallet_name||`Wallet ${M.wallet_id}`:P?`MetaMask — ${Ase(P)}`:"Select Wallet";let $=null;if(Number.isFinite(Number(r)))$=Number(r);else if(M){const ne=(g&&g[M.wallet_id!=null?String(M.wallet_id):""])??M.available_balance??M.availableForTrade??M.available_for_trade??M.balance??M.available??null,J=Number(ne);Number.isFinite(J)&&($=J)}const L=M&&!f&&$!=null?`${F} — ${mqe($)}`:F,z=m.useCallback(async X=>{var W;if(s!=="hyper")return{data:{agent_pk:null,from_cache:!1}};const ne=localStorage.getItem("hyperTradeToken")||"",J=localStorage.getItem("hyperToken")||"",K=localStorage.getItem("hyperAddress")||"",te=`hl_pk:${X}`,fe=localStorage.getItem(te);if(fe)return localStorage.setItem("hl_pk",fe),{data:{agent_pk:fe,from_cache:!0}};const se=await(await fetch(f0n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:K,trade_token:ne,token:J,wallet_id:String(X)})})).json().catch(()=>({})),ae=(W=se==null?void 0:se.data)==null?void 0:W.agent_pk;return ae&&(localStorage.setItem(te,ae),localStorage.setItem("hl_pk",ae)),se},[s]);return m.useEffect(()=>{if(!M||s!=="hyper"||!l)return;const ne=`hl_pk:${String(M.wallet_id)}`,J=localStorage.getItem("hyperTradeToken")||"",K=localStorage.getItem("hyperToken")||"",te=localStorage.getItem("hyperAddress")||"";if(!(!J||!K||!te)){try{const fe=localStorage.getItem(ne);if(fe){localStorage.setItem("hl_pk",fe);return}}catch{}z(M.wallet_id).catch(()=>{})}},[l,s,M,z,u]),m.useEffect(()=>{if(typeof window>"u")return;const X=s==="lighter"?"lighter":"hl";if(t&&t.length){const ne=t.find(te=>String(te.wallet_id)===String(e))||t[0];if(!ne)return;const J=String(ne.wallet_id),K=String(ne.wallet_address||"").toLowerCase();try{window.localStorage.setItem(`${X}_selected_wallet_id`,J),window.localStorage.setItem(`${X}_selected_wallet_address`,K),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:J,address:K,mode:s}})),s==="hyper"&&l&&z(ne.wallet_id).catch(()=>{})}catch{}}else if(P){const ne="",J=String(P||"").toLowerCase();try{window.localStorage.setItem(`${X}_selected_wallet_id`,ne),window.localStorage.setItem(`${X}_selected_wallet_address`,J),window.dispatchEvent(new Event("localStorageUpdated")),window.dispatchEvent(new CustomEvent("hl_selected_wallet_changed",{detail:{id:ne,address:J,mode:s}}))}catch{}}},[t,e,s,P,l,z]),m.useEffect(()=>{if(s!=="extended")return;let X=!1;const ne=async J=>{var se,ae,W;const K=J.wallet_id!=null?String(J.wallet_id):"";if(!K||v.current.has(K))return;const te=g[K];if(Number.isFinite(te)&&te>0)return;const fe=J.available_balance??J.availableForTrade??J.available_for_trade??J.balance??J.available??null,q=Number(fe);if(Number.isFinite(q)&&q>0){y(V=>V[K]===q?V:{...V,[K]:q});return}if(J.wallet_api_key){v.current.add(K);try{const V=`${h0n}${encodeURIComponent(`${p0n}/user/balance`)}`,oe=await(await fetch(V,{headers:{"X-Api-Key":J.wallet_api_key}})).json().catch(()=>({}));if(X)return;const de=((se=oe==null?void 0:oe.data)==null?void 0:se.availableForTrade)??(oe==null?void 0:oe.availableForTrade)??((ae=oe==null?void 0:oe.data)==null?void 0:ae.available_balance)??(oe==null?void 0:oe.available_balance)??((W=oe==null?void 0:oe.data)==null?void 0:W.available)??(oe==null?void 0:oe.available)??null,Ce=Number(de);Number.isFinite(Ce)&&y(me=>me[K]===Ce?me:{...me,[K]:Ce})}catch{}finally{v.current.delete(K)}}};return t.forEach(J=>ne(J)),()=>{X=!0}},[t,s,g]),i.jsxs("div",{className:"relative",ref:N,children:[i.jsxs("div",{onClick:()=>o(X=>!X),className:"h-[32px] px-3 rounded-md flex justify-between items-center cursor-pointer",style:{background:Ro,border:`1px solid ${Ra}`,color:Bi},children:[i.jsxs("span",{className:"truncate text-xs flex items-center gap-1",children:[L,f&&i.jsx(FVe,{size:3,color:"#ffffff"})]}),i.jsx("span",{className:"ml-2",children:"▾"})]}),a&&i.jsxs("div",{className:"absolute z-50 mt-1 w-full max-h-[240px] overflow-auto rounded-md p-1",style:{background:Ro,border:`1px solid ${Ra}`},children:[i.jsxs("div",{onClick:()=>{o(!1);const X=s==="hyper"?"hyperliquid":s==="lighter"?"lighter":"extended";window.open(`/wallet-management#${X}#add-account#${X}`,"_blank")},className:"px-3 py-2 text-[#1de674] font-semibold text-sm cursor-pointer flex justify-start items-center gap-1.5 border border-[#8860ff] rounded-md mb-1 bg-[#7445ff]",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Add Account"})]}),T&&t.map(X=>{const ne=String(X.wallet_id)===String(e);return i.jsx(m0n,{w:X,active:ne,open:a,mode:s,balances:g,onSelect:async()=>{n(String(X.wallet_id)),o(!1);try{await z(X.wallet_id)}catch{}}},X.wallet_id)}),!T&&i.jsx("div",{className:"px-3 py-2 text-xs",style:{color:wi},children:"No wallets"})]})]})}const MQ=new Map;function x0n(t,e){const n=MQ.get(t);if(n)return n;const r=Promise.resolve().then(e).finally(()=>MQ.delete(t));return MQ.set(t,r),r}const g0n=15e3,KNe=new Map;function xqe(t,e,n=!0,{pollMs:r=0,refreshOnFocus:s=!1}={}){const[a,o]=m.useState([]),[l,c]=m.useState(!1),u=m.useCallback(async()=>{if(!t||!e){o([]);return}const d=`wallets:${t}:${n?1:0}`,f=Date.now(),x=KNe.get(d);if(x&&f-x.ts<g0n)return o(x.data),c(!1),x.data;c(!0);const g=await x0n(d,async()=>{const v=await(await fetch(`${l0n}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:t,token:e})})).json();let C=Array.isArray(v==null?void 0:v.data)?v.data:Array.isArray(v)?v:v!=null&&v.wallet_id?[v]:[];return C=C.map(N=>{var P,T,M;return{...N,balances:{eth:((P=N==null?void 0:N.balances)==null?void 0:P.eth)??0,usdc:((T=N==null?void 0:N.balances)==null?void 0:T.usdc)??0,hyper_usdc:((M=N==null?void 0:N.balances)==null?void 0:M.hyper_usdc)??0}}}),C});return o(g),KNe.set(d,{ts:Date.now(),data:g}),c(!1),g},[t,e,n]);return m.useEffect(()=>{(async()=>await u())()},[u]),m.useEffect(()=>{if(!s)return;const d=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[u,s]),m.useEffect(()=>{if(!r)return;const d=setInterval(u,r);return()=>clearInterval(d)},[u,r]),{wallets:a,loading:l,refresh:u}}function vA({value:t,onChange:e,accent:n="#67FFBD",trackBg:r="rgba(255,255,255,0.12)",marks:s=[0,25,33,50,66,75,100],className:a="",snap:o=!1}){const[l,c]=m.useState(!1),u=(C,N,P)=>Math.max(N,Math.min(P,C)),d=Math.max(2,s.length)-1,f=C=>{const N=u(Number(C)||0,s[0],s[s.length-1]);if(N<=s[0])return 0;if(N>=s[s.length-1])return 100;let P=0;for(;P<d&&N>s[P+1];)P++;const T=s[P+1]-s[P]||1,M=(N-s[P])/T;return(P+M)/d*100},x=C=>{const P=u(Number(C)||0,0,100)/100*d,T=Math.min(d-1,Math.floor(P)),M=P-T,F=s[T]+(s[T+1]-s[T])*M;if(!o)return F;let $=s[0],L=1/0;for(const z of s){const X=Math.abs(z-F);X<L&&(L=X,$=z)}return $},g=f(t),y=Math.round(u(t,0,100)),v={type:"spring",stiffness:420,damping:32,mass:.2};return i.jsxs("div",{className:`relative w-full pt-4 pb-5 ${a}`,children:[i.jsx("div",{className:"absolute inset-x-0 top-5 h-2 rounded-full",style:{background:r},children:i.jsx(pm.div,{className:"h-2 rounded-full",animate:{width:`${g}%`},transition:v,style:{background:n}})}),i.jsx("div",{className:"absolute inset-x-0 top-6",children:s.map((C,N)=>{const P=N/d*100,T=g/100*d;return N<=T?null:i.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 top-1/2",style:{left:`${P}%`},children:i.jsx("div",{className:"h-[10px] w-[10px] rounded-full",style:{background:n,boxShadow:"0 0 0 2px rgba(0,0,0,0.35) inset"}})},N)})}),i.jsx(pm.div,{className:`${g>34?"-ml-2.5":"ml-2.5"} absolute top-5 -translate-y-full -translate-x-1/2 pointer-events-none z-10`,animate:{left:`${g}%`},transition:v,children:i.jsx("div",{className:"h-[18px] min-w-[24px] px-2 rounded-[6px] flex items-center justify-center text-[12px] leading-none",style:{background:n,color:"#0d0d0d",border:`1px solid ${Ra}`},children:y})}),i.jsx(pm.div,{className:"absolute top-[17px] -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none",animate:{left:`${g-2}%`,scale:l?1.12:1},transition:v,children:i.jsx("div",{className:"h-4 w-4 rounded-full",style:{background:"#0f151a",border:`2px solid ${n}`}})}),i.jsx("div",{className:"absolute inset-x-0 bottom-0",children:s.map((C,N)=>{if(N===0)return null;const P=N/d*100;return i.jsxs("div",{className:"absolute -translate-x-1/2 text-[12px] text-[#CFCFCF]",style:{left:`${P}%`},children:[C,"%"]},N)})}),i.jsx("input",{type:"range",min:0,max:100,step:.1,value:g,onMouseDown:()=>c(!0),onMouseUp:()=>c(!1),onTouchStart:()=>c(!0),onTouchEnd:()=>c(!1),onChange:C=>e(Math.round(x(C.target.value))),className:"absolute -left-2 -right-2 top-0 h-8 opacity-0 cursor-pointer z-30"})]})}const IC=42161,UF=10,RQ=[{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{type:"address"},{type:"uint256"}],outputs:[{type:"bool"}]}],c0={BTC:"bc1plaavkq4u7wj8cc8nhrm6rxkhz9ylurw2u6l42ne7gw4493hvacks8wct4q",ETH:"0xa1D7ad9f7065BeE7b0b3E2AC30C9ddAaD9A70C71",SOL:"HWzcDXaTB2mPXvQYQy2g6PCNaj4mhTPVNoJP8zVupHJs",XPL:"0xa1D7ad9f7065BeE7b0b3E2AC30C9ddAaD9A70C71",USDC_BRIDGE_2:"0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7"},Rv={USDC:{kind:"usdc",chains:[{key:"Arbitrum",label:"Arbitrum"}],icon:"USDC",bridge:c0.USDC_BRIDGE_2},BTC:{kind:"address",chains:[{key:"Bitcoin",label:"Bitcoin"}],icon:"BTC",address:c0.BTC,eta:"~21 minutes",fee:"~$2.29",min:"0.002 BTC",networkNote:"This address can only receive BTC on the Bitcoin network. Deposits below 0.002 BTC and deposits from other networks will result in a loss of funds."},ETH:{kind:"address",chains:[{key:"Ethereum",label:"Ethereum"}],icon:"ETH",address:c0.ETH,eta:"~3 minutes",fee:"~$1.22",min:"0.05 ETH",networkNote:"This address can only receive ETH on the Ethereum network. ETH sent from L2s (e.g. Arbitrum, Base, Optimism) will be lost. Any other asset (e.g., USDC, USDT) sent from Ethereum will be lost. Deposits below 0.05 ETH will result in a loss of funds."},SOL:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"SOL",address:c0.SOL,eta:"~1 minute",fee:"~1.40",min:"0.2 SOL",networkNote:"This address can only receive SOL on the Solana network. Any other asset (e.g., USDC, USDT) sent from Solana will be lost. Deposits below 0.2 SOL will result in a loss of funds."},"2Z":{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"2Z",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"150 2Z",networkNote:"This address can only receive 2Z on the Solana network. Deposits below 150 2Z will result in a loss of funds."},BONK:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"BONK",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"1000000 BONK",networkNote:"This address can only receive BONK on the Solana network. Deposits below 1000000 BONK will result in a loss of funds."},FARTCOIN:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"FARTCOIN",address:c0.SOL,eta:"~1 minute",fee:"~1.21",min:"20 FARTCOIN",networkNote:"This address can only receive FARTCOIN on the Solana network. Deposits below 20 FARTCOIN will result in a loss of funds."},PUMP:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"PUMP",address:c0.SOL,eta:"~1 minute",fee:"~1.21",networkNote:"This address can only receive PUMP on the Solana network."},SPX:{kind:"address",chains:[{key:"Solana",label:"Solana"}],icon:"SPX",address:c0.SOL,eta:"~1 minute",fee:"~1.21",networkNote:"This address can only receive SPX on the Solana network."},XPL:{kind:"address",chains:[{key:"Plasma",label:"Plasma"}],icon:"XPL",address:c0.XPL,eta:"~1 minute",fee:"~1.20",min:"15 XPL",networkNote:"This address can only receive XPL on the Plasma network. Deposits below 15 XPL will result in a loss of funds."}};function b0n({open:t,onClose:e,initialAsset:n="USDC",initialChain:r,toWalletAddress:s,usdcTokenAddress:a="0xaf88d065e77c8cC2239327C5EDb3A432268e5831"}){const[o,l]=m.useState(n),[c,u]=m.useState(r||Rv[n].chains[0].key),d=Rv[o],[f,x]=m.useState(""),[g,y]=m.useState(!1),[v,C]=m.useState(null),[N,P]=m.useState(!1);m.useEffect(()=>{t&&(l(n),u(r||Rv[n].chains[0].key),x(""),y(!1),C(null),P(!1))},[t,n,r]);const T=m.useMemo(()=>`https://app.hyperliquid.xyz/coins/${(d.icon||o).toUpperCase()}.svg`,[o,d.icon]);d.kind==="usdc"?`${c}`:`${o}${c}`;const{address:M,isConnected:F}=ns(),$=ej(),{switchChainAsync:L}=Noe(),z=cPe(),{writeContractAsync:X}=u2t(),ne=o==="USDC",J=ne&&c==="Arbitrum",K=ne&&c!=="Arbitrum",te=J&&$!==IC,{data:fe}=cxe({address:a,abi:RQ,functionName:"decimals",chainId:IC,query:{enabled:J}}),q=Number(fe??6),{data:se,refetch:ae}=cxe({address:a,abi:RQ,functionName:"balanceOf",args:[M??"0x0000000000000000000000000000000000000000"],chainId:IC,query:{enabled:J&&!!M}}),W=m.useMemo(()=>{try{return se?hT(se,q):"0.00"}catch{return"0.00"}},[se,q]),V=J&&Number(f||0)<UF;function ee(xe,be="error"){C({text:xe,type:be})}function oe(xe){const be=String((xe==null?void 0:xe.shortMessage)||(xe==null?void 0:xe.message)||xe||"");return be.toLowerCase().includes("does not match the connection's chain")||be.toLowerCase().includes("chain mismatch")||be.toLowerCase().includes("connector chain")?"You're not on Arbitrum. Please switch to Arbitrum.":be}async function de(){try{if(!F)return ee("Wallet is not connected");if(K)return ee("The deposit bridge supports Arbitrum only");te&&await L({chainId:IC});const xe=String(f||"").trim();if(!xe||Number(xe)<=0)return ee("Enter a valid amount");if(Number(xe)<UF)return ee(`Minimum is ${UF} USDC`);const be=i1t(xe,q);y(!0),C({type:"info",text:"Submitting transaction..."});const je=await X({address:a,abi:RQ,functionName:"transfer",args:[Rv.USDC.bridge,be],chainId:IC});C({type:"info",text:"Waiting for confirmation..."}),await z.waitForTransactionReceipt({hash:je}),C({type:"success",text:"Deposit completed"}),x(""),ae==null||ae()}catch(xe){ee(oe(xe),"error")}finally{y(!1)}}function Ce(xe){var be;xe&&((be=navigator.clipboard)==null||be.writeText(xe),P(!0),setTimeout(()=>P(!1),1500))}const me=K?"Arbitrum Required":J?te?"Deposit":g?"Depositing...":"Deposit":"Done",we=g||K||J&&V;return i.jsx(lp,{open:t,onClose:e,children:i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:e,className:"absolute -top-1 right-1 w-8 h-8 rounded-full grid place-items-center text-white/90 bg-transparent",children:"×"}),i.jsxs("div",{className:"w-[560px] max-w-[92vw] rounded-2xl shadow-xl border border-[#2a2a2a] bg-[#101010] p-5",children:[i.jsx("div",{className:"w-12 h-12 rounded-full mx-auto -mt-10 mb-2 overflow-hidden flex justify-center items-center bg-[#1B1B1B]",children:i.jsx("img",{src:T,alt:o,className:"w-10 h-10",onError:xe=>{xe.currentTarget.style.display="none"}})}),i.jsx("div",{className:"text-center text-[18px] font-semibold mb-4 text-white",children:d.kind==="usdc"?`Deposit USDC from ${c}`:`Deposit ${o} from ${c}`}),v&&i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{background:v.type==="error"?"#3b1f1f":v.type==="success"?"#1f3b2b":"#1b2a3b",color:v.type==="error"?"#ffb4b4":v.type==="success"?"#b7ffd8":"#c9e1ff",border:"1px solid #2a2a2a"},children:v.text}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] px-3 flex items-center justify-between",children:[i.jsx("span",{className:"text-[13px] text-[#b7b7b7]",children:"Asset"}),i.jsxs("div",{className:"relative",children:[i.jsx("select",{className:"appearance-none bg-transparent text-[13px] text-white outline-none",value:o,onChange:xe=>{var je;const be=xe.target.value;l(be),u((je=Rv[be].chains[0])==null?void 0:je.key),C(null)},children:Object.keys(Rv).map(xe=>i.jsx("option",{value:xe,children:xe},xe))}),i.jsx("svg",{className:"pointer-events-none absolute right-0 top-1/2 -translate-y-1/2 w-4 h-4 text-[#8c8c8c]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M6 9l6 6 6-6"})})]})]}),i.jsxs("div",{className:"h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] px-3 flex items-center justify-between",children:[i.jsx("span",{className:"text-[13px] text-[#b7b7b7]",children:"Deposit Chain"}),i.jsxs("div",{className:"relative",children:[i.jsx("select",{className:"appearance-none bg-transparent pr-6 text-[13px] text-white outline-none",value:c,onChange:xe=>{u(xe.target.value),C(null)},children:Rv[o].chains.map(xe=>i.jsx("option",{value:xe.key,children:xe.label},xe.key))}),i.jsx("svg",{className:"pointer-events-none absolute right-0 top-1/2 -translate-y-1/2 w-4 h-4 text-[#8c8c8c]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M6 9l6 6 6-6"})})]})]}),s&&d.kind!=="usdc"&&i.jsxs("div",{className:"h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] px-3 flex items-center justify-between",children:[i.jsx("span",{className:"text-[13px] text-[#b7b7b7]",children:"To"}),i.jsxs("span",{className:"text-xs text-white",children:[s.slice(0,6),"...",s.slice(-4)]})]}),J&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] flex items-center justify-between px-3",children:[i.jsx("input",{type:"text",className:"w-full bg-transparent outline-none text-[13px] text-white placeholder:text-[#6a6a6a] font-mono pr-[55px]",placeholder:"0.00",value:f,onChange:xe=>x(xe.target.value.replace(",",".").replace(/[^\d.]/g,"")),inputMode:"decimal"}),i.jsxs("button",{type:"button",onClick:()=>x(String(W)),className:"absolute right-3 text-[12px] text-[#67FFBD] font-semibold",children:["MAX: ",Number(W||0).toFixed(2)]})]}),i.jsxs("div",{className:"text-[11px]",style:{color:V?"#ffb4b4":"#9BA3A7"},children:["Minimum: ",UF," USDC"]})]}),ne&&i.jsx(i.Fragment,{children:K&&i.jsxs("div",{className:"p-2 rounded-lg text-[12px] mt-1 border border-[#2a2a2a] bg-[#3b1f1f] text-[#ffb4b4]",children:["The deposit bridge supports ",i.jsx("b",{children:"Arbitrum"})," only. Please select Arbitrum as the deposit chain."]})}),d.kind==="address"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"text-[12px] leading-5 text-[#9BA3A7]",children:["Deposits should arrive after ",d.eta,". This service is provided by Unit Protocol. Estimated fee ",d.fee," depending on the ",c," network."]}),i.jsxs("div",{className:"h-[42px] rounded-lg border border-[#2a2a2a] bg-[#262626] px-3 flex items-center justify-between",children:[i.jsx("span",{className:"text-[13px] text-[#b7b7b7]",children:"Address"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-white truncate max-w-[240px]",children:d.address}),i.jsx("button",{onClick:()=>Ce(d.address),className:"text-[12px] text-[#67FFBD]",children:"Copy"})]})]}),N&&i.jsx("div",{className:"text-[11px] text-[#67FFBD]",children:"Copied ✓"}),d.networkNote&&i.jsxs("div",{className:"p-2 rounded-lg text-[12px] mt-1 border border-[#2a2a2a] bg-[#3b1f1f] text-[#ffb4b4]",children:["IMPORTANT: ",d.min?`Minimum ${d.min}. `:"",d.networkNote]})]}),i.jsx("button",{onClick:ne?K?void 0:te?async()=>{try{C(null),await L({chainId:IC}),C({type:"success",text:"Switched to Arbitrum"})}catch(xe){C({type:"error",text:oe(xe)})}}:de:e,disabled:we,className:"w-full h-[44px] mt-2 rounded-xl font-semibold text-sm disabled:opacity-60 bg[rgba(103,255,189,0.16)] text-[#67FFBD] ",children:me})]})]})]})})}function y0n(t){const e=t.length;let n=0,r=0;for(;r<e;){let s=t.charCodeAt(r++);if(s&4294967168)if(!(s&4294965248))n+=2;else{if(s>=55296&&s<=56319&&r<e){const a=t.charCodeAt(r);(a&64512)===56320&&(++r,s=((s&1023)<<10)+(a&1023)+65536)}s&4294901760?n+=4:n+=3}else{n++;continue}}return n}function v0n(t,e,n){const r=t.length;let s=n,a=0;for(;a<r;){let o=t.charCodeAt(a++);if(o&4294967168)if(!(o&4294965248))e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&a<r){const l=t.charCodeAt(a);(l&64512)===56320&&(++a,o=((o&1023)<<10)+(l&1023)+65536)}o&4294901760?(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128):(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128)}else{e[s++]=o;continue}e[s++]=o&63|128}}const w0n=new TextEncoder,C0n=50;function S0n(t,e,n){w0n.encodeInto(t,e.subarray(n))}function N0n(t,e,n){t.length>C0n?S0n(t,e,n):v0n(t,e,n)}new TextDecoder;class zF{constructor(e,n){this.type=e,this.data=n}}class XD extends Error{constructor(e){super(e);const n=Object.create(XD.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:XD.name})}}function A0n(t,e,n){const r=n/4294967296,s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function gqe(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function j0n(t,e){const n=t.getInt32(e),r=t.getUint32(e+4);return n*4294967296+r}const E0n=-1,_0n=4294967296-1,k0n=17179869184-1;function T0n({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=k0n)if(e===0&&t<=_0n){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,r=t&4294967295,s=new Uint8Array(8),a=new DataView(s.buffer);return a.setUint32(0,e<<2|n&3),a.setUint32(4,r),s}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),gqe(r,4,t),n}}function P0n(t){const e=t.getTime(),n=Math.floor(e/1e3),r=(e-n*1e3)*1e6,s=Math.floor(r/1e9);return{sec:n+s,nsec:r-s*1e9}}function I0n(t){if(t instanceof Date){const e=P0n(t);return T0n(e)}else return null}function F0n(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),r=e.getUint32(4),s=(n&3)*4294967296+r,a=n>>>2;return{sec:s,nsec:a}}case 12:{const n=j0n(e,4),r=e.getUint32(0);return{sec:n,nsec:r}}default:throw new XD(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function O0n(t){const e=F0n(t);return new Date(e.sec*1e3+e.nsec/1e6)}const M0n={type:E0n,encode:I0n,decode:O0n};class jse{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(M0n)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const s=-1-e;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(s!=null){const a=s(e,n);if(a!=null){const o=-1-r;return new zF(o,a)}}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(s!=null){const a=s(e,n);if(a!=null){const o=r;return new zF(o,a)}}}return e instanceof zF?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new zF(n,e)}}jse.defaultCodec=new jse;function R0n(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function L0n(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):R0n(t)?new Uint8Array(t):Uint8Array.from(t)}const D0n=100,B0n=2048;class Jde{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??jse.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??D0n,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??B0n,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Jde({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const r=y0n(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),N0n(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=L0n(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const s of e)this.doEncode(s,n+1)}countWithoutUndefined(e,n){let r=0;for(const s of n)e[s]!==void 0&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const a of r){const o=e[a];this.ignoreUndefined&&o===void 0||(this.encodeString(a),this.doEncode(o,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const r=e.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(r);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),A0n(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),gqe(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function bqe(t,e){return new Jde(e).encodeSharedRef(t)}const $0n={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},U0n={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function z0n(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function Ese(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ese);const e={...t};for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];r&&typeof r=="object"?e[n]=Ese(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=z0n(r))}return e}function H0n(t){return ms(t)}function V0n(t,e,n){const r=Ese(t),s=bqe(r),a=e==null?9:29,o=new Uint8Array(s.length+a);o.set(s);const l=new DataView(o.buffer);return l.setBigUint64(s.length,BigInt(n),!1),e==null?l.setUint8(s.length+8,0):(l.setUint8(s.length+8,1),o.set(H0n(e),s.length+9)),ho(o)}function W0n(t,e){return{source:e?"a":"b",connectionId:t}}async function q0n(t,e){const n=await t.signTypedData(e.domain,e.types,e.message),{r,s,v:a}=ou.from(n);return{r,s,v:a}}async function G0n(t,e,n,r,s){const a=V0n(e,n,r),o=W0n(a,s);return q0n(t,{domain:$0n,types:U0n,primaryType:"Agent",message:o})}function aP({getPK:t=()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:e=!0,vaultAddress:n=null}={}){return{sign:async(r,s)=>{const a=t();if(!a)throw new Error("Please sign in to perform this action.");const o=new ile(a);return G0n(o,r,n,s,e)}}}function K0n(t){return new ile(t).address}function Y0n({open:t,onClose:e,children:n,title:r}){return t?i.jsxs("div",{className:"fixed inset-0 z-[999] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[1px]",onClick:e}),i.jsxs("div",{className:"relative w-[560px] max-w-[92vw] rounded-2xl border border-[#2A2A2A] bg-[#161616] shadow-2xl",children:[i.jsxs("div",{className:"px-5 pt-4 pb-2 flex items-center justify-between",children:[i.jsx("div",{className:"font-inter text-[18px] leading-6 text-white",children:r}),i.jsx("button",{onClick:e,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-[#222] text-[#BDBDBD]",children:"✕"})]}),i.jsx("div",{className:"px-5 pb-5",children:n})]})]}):null}const X0n=({children:t})=>i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1 font-semibold",children:t}),Q0n=({value:t,onChange:e,placeholder:n})=>i.jsx("input",{value:t,onChange:r=>e(r.target.value),placeholder:n,inputMode:"decimal",className:"flex-1 min-w-0 h-10 px-3 rounded-lg bg-[#101010] border border-[#2A2A2A] text-white outline-none"});function YNe(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}const LQ=t=>t==="perps"?"Perps":"Spot";function yqe({open:t,onClose:e,perpsAvailable:n=0,spotUsdcAvailable:r=0,onSubmit:s,loading:a=!1,initialToPerp:o=!1}){const[l,c]=m.useState(o?"spot":"perps"),[u,d]=m.useState("");m.useEffect(()=>{t&&(c(o?"spot":"perps"),d(""))},[o,t]);const f=l==="perps"?"spot":"perps",x=Number(l==="perps"?n||0:r||0),g=()=>c(N=>N==="perps"?"spot":"perps"),y=()=>d(String(x)),v=()=>s==null?void 0:s({toPerp:l==="spot",amount:u,available:x}),C=!Number(u)||Number(u)<=0||Number(u)>x||a;return i.jsxs(Y0n,{open:t,onClose:e,title:"Transfer USDC",children:[i.jsx("p",{className:"text-[13px] text-[#9B9B9B] mb-3",children:"Transfer USDC between your Perps and Spot balances."}),i.jsx("div",{className:"flex justify-center mb-3 text-xs",children:i.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 px-3 py-1 rounded-lg border border-[#2A2A2A] bg-transparent hover:bg-[#101010] text-sm",children:[i.jsx("span",{className:`${l==="perps"?"text-[#67FFBD] font-medium":"text-[#bdbdbd]"}`,children:LQ(l)}),i.jsx(ale,{className:"text-[#67FFBD]"}),i.jsx("span",{className:`${f==="perps"?"text-[#67FFBD] font-medium":"text-[#bdbdbd]"}`,children:LQ(f)})]})}),i.jsxs("div",{className:"space-y-2 text-xs",children:[i.jsx(X0n,{children:"Amount (USDC)"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Q0n,{value:u,onChange:d,placeholder:"0.0"}),i.jsxs("button",{onClick:y,className:"shrink-0 w-28 h-10 px-2 py-0 rounded-lg bg-[#1F2A23] border border-[#2F3B33] text-[#67FFBD] hover:opacity-95 flex flex-col items-end justify-center leading-tight text-right",title:"Use maximum available",children:[i.jsx("span",{className:"text-[10px] opacity-80",children:"MAX"}),i.jsx("span",{className:"text-[12px] font-medium truncate",children:YNe(x,6)})]})]}),i.jsxs("div",{className:"text-[12px] text-[#9B9B9B]",children:["Available (",LQ(l),"): ",YNe(x,6)," USDC"]})]}),i.jsx("button",{onClick:v,disabled:C,className:`w-full h-11 rounded-xl mt-5 font-medium ${C?"bg-[#2C2C2C] text-[#8A8A8A] cursor-not-allowed":"bg-[rgba(103,255,189,0.16)] text-[#67FFBD] hover:opacity-95"}`,children:a?"Processing...":"Confirm"})]})}function XNe({label:t,children:e}){return i.jsxs("div",{className:"mb-3",children:[i.jsx("div",{className:"mb-1 text-[12px]",style:{color:wi},children:t}),i.jsx("div",{className:"flex items-center gap-2",children:e})]})}const DQ=42161,Z0n="0xa4b1",QNe="Mainnet";function J0n(t){const e=t.startsWith("0x")?t.slice(2):t,n="0x"+e.slice(0,64),r="0x"+e.slice(64,128);let s=parseInt(e.slice(128,130),16);return s<27&&(s+=27),{r:n,s:r,v:s}}function exn({open:t,onClose:e,perpsBalance:n=0,defaultDest:r=""}){const{address:s}=ns(),a=ej(),{switchChainAsync:o}=Noe(),{signTypedDataAsync:l}=c2t(),[c,u]=m.useState(""),[d,f]=m.useState(r||s||""),[x,g]=m.useState(!1),[y,v]=m.useState(null);m.useEffect(()=>{t&&(u(""),f(r||s||""),g(!1),v(null))},[t,r,s]);const C=m.useMemo(()=>{const M=Math.max(0,Number(n||0)-1);return M>0?Number(M.toFixed(6)):0},[n]),N="Withdraw USDC to Arbitrum";async function P(){var M;try{const F=Number(c||0);if(!F||F<=1){v({type:"error",text:"Enter an amount greater than $1 (fee)."});return}if(F>C){v({type:"error",text:"Amount exceeds available balance (after $1 fee)."});return}const $=(d||"").trim().toLowerCase();if(!/^0x[a-f0-9]{40}$/.test($)){v({type:"error",text:"Invalid destination address."});return}if(a!==DQ)try{await o({chainId:DQ})}catch{v({type:"error",text:"Switch to Arbitrum to withdraw."});return}g(!0),v({type:"info",text:"Signing request..."});const L=Date.now(),z={name:"HyperliquidSignTransaction",version:"1",chainId:DQ,verifyingContract:"0x0000000000000000000000000000000000000000"},X={"HyperliquidTransaction:Withdraw":[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}]},ne={hyperliquidChain:QNe,destination:$,amount:String(F),time:L},J=await l({domain:z,types:X,primaryType:"HyperliquidTransaction:Withdraw",message:ne});v({type:"info",text:"Submitting..."});const K={action:{type:"withdraw3",signatureChainId:Z0n,hyperliquidChain:QNe,destination:$,amount:String(F),time:L},nonce:L,signature:J0n(J)},te=await fetch("https://api.hyperliquid.xyz/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}).then(fe=>fe.json());if((te==null?void 0:te.status)==="ok")v({type:"success",text:"Withdraw submitted. Funds will arrive shortly."}),setTimeout(()=>{u(""),e==null||e()},700),(M=window==null?void 0:window.dispatchEvent)==null||M.call(window,new Event("balances:refresh"));else{const fe=typeof(te==null?void 0:te.response)=="string"?te.response:JSON.stringify(te);v({type:"error",text:fe||"Withdraw failed."})}}catch(F){v({type:"error",text:String((F==null?void 0:F.message)||F)})}finally{g(!1)}}const T=y&&i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{border:`1px solid ${Ra}`,background:y.type==="error"?"#3b1f1f":y.type==="success"?"#1f3b2b":"#1b2a3b",color:y.type==="error"?"#ffb4b4":y.type==="success"?"#b7ffd8":"#c9e1ff"},children:y.text});return i.jsx(lp,{open:t,onClose:e,children:i.jsxs(ym,{title:N,children:[T,i.jsxs(XNe,{label:"Amount",children:[i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Ro,border:`1px solid ${Ra}`,width:"100%"},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none text-right text-sm",inputMode:"decimal",placeholder:"0.0",style:{color:Bi,fontFeatureSettings:'"tnum"'},value:c,onChange:M=>u(M.target.value)}),i.jsx("button",{className:"text-xs text-[#67FFBD] h-6 flex items-center justify-center",onClick:()=>u(C?String(C):"0"),children:"MAX"})]}),i.jsxs("div",{className:"text-[11px]",style:{color:wi},children:["MAX: ",C.toFixed(6)," USDC"]})]}),i.jsx(XNe,{label:"Destination Address",children:i.jsxs("div",{className:"flex items-center gap-2 h-[36px] px-2 rounded-lg",style:{background:Ro,border:`1px solid ${Ra}`,width:"100%"},children:[i.jsx("input",{className:"min-w-0 flex-1 bg-transparent outline-none text-sm",placeholder:"0x...",style:{color:Bi},value:d,onChange:M=>f(M.target.value)}),i.jsx("button",{className:"text-xs h-6 flex items-center justify-center text-[#67FFBD]",onClick:async()=>{const M=await navigator.clipboard.readText().catch(()=>"");M&&f(M.trim())},children:"Paste"})]})}),i.jsx("div",{className:"p-2 rounded-lg text-[12px] mb-3",style:{background:"#3b1f1f",color:"#ffb4b4",border:`1px solid ${Ra}`},children:"IMPORTANT: A $1 fee is deducted from each withdrawal."}),i.jsx("button",{onClick:P,disabled:x,className:"w-full h-[42px] mt-1 rounded-xl font-semibold text-sm disabled:opacity-60",style:{background:Hg,color:"#0f151a"},children:x?"Submitting...":"Withdraw"})]})})}function txn({value:t,onChange:e,leftLabel:n,rightLabel:r,leftUsd:s=0,rightUsd:a=0}){const o=m.useRef(null),l=m.useRef(!1),c=g=>Math.max(0,Math.min(100,g)),u=g=>{const y=o.current;if(!y)return t;const v=y.getBoundingClientRect(),C=(g-v.left)/v.width*100;return Math.round(c(C))},d=g=>{l.current&&e(u(g.clientX))},f=()=>{l.current=!1,window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f)},x=g=>{l.current=!0,e(u(g.clientX)),window.addEventListener("pointermove",d,{passive:!0}),window.addEventListener("pointerup",f,{passive:!0}),window.addEventListener("pointercancel",f,{passive:!0})};return m.useEffect(()=>f,[]),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-[12px] mb-1",children:[i.jsxs("span",{className:"font-semibold",style:{color:Hg},children:[n,": ",t,"%"]}),i.jsxs("span",{className:"font-semibold",style:{color:d9},children:[r,": ",100-t,"%"]})]}),i.jsxs("div",{ref:o,onPointerDown:x,className:"relative h-[10px] select-none",style:{cursor:"pointer",touchAction:"none"},children:[i.jsx("div",{className:"absolute inset-0 rounded-full",style:{background:`linear-gradient(90deg, ${Hg}80 0%, ${Hg}80 ${t}%, ${d9}80 ${t}%, ${d9}80 100%)`,border:`1px solid ${Ra}`}}),i.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 rounded-md w-4 h-4",style:{left:`${t}%`,top:"50%",background:Hg,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",pointerEvents:"none"}})]}),i.jsxs("div",{className:"flex justify-between text-[12px] mt-1",children:[i.jsx("span",{style:{color:Hg},children:s?`${s.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""}),i.jsx("span",{style:{color:d9},children:a?`${a.toLocaleString(void 0,{maximumFractionDigits:2})} USDC`:""})]})]})}function nxn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(t)}function rxn({skipConfirm:t,setSkipConfirm:e}){const[n,r]=m.useState(!1),s=m.useRef(null);return m.useEffect(()=>{const a=o=>{!s.current||s.current.contains(o.target)||r(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),i.jsxs("div",{className:"relative",ref:s,children:[i.jsx("button",{onClick:()=>r(a=>!a),className:"ml-2 text-[#9B9B9B] hover:text-white p-1 rounded-md",children:i.jsx(nxn,{size:14})}),n&&i.jsx("div",{className:"absolute right-0 top-6 w-[24 0px] rounded-lg bg-[#101010] border border-[#2A2A2A] shadow-xl p-3 z-50",children:i.jsxs("label",{className:"flex items-center gap-2 text-[12px] text-white cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:t,onChange:a=>e(a.target.checked)}),"Skip Close Position Confirmation"]})})]})}const BQ="wss://api.hyperliquid.xyz/ws";function E7(t,e=2){const n=Number(t||0),r={maximumFractionDigits:e,minimumFractionDigits:n===0?2:0};return n.toLocaleString(void 0,r)}function ZNe(t){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}const JNe=t=>{const e=String(t||"").toUpperCase();return e==="GTC"?"Gtc":e==="IOC"?"Ioc":e==="ALO"?"Alo":"Gtc"};function sxn(t,e,n){if(!t||!n||n<=0)return null;const r=e==="buy"?t.asks:t.bids;if(!(r!=null&&r.length))return null;let s=n,a=0;for(const{px:o,sz:l}of r){const c=Math.min(s,l);if(a+=c*o,s-=c,s<=0)break}return s>1e-12?null:a/n}function ixn({book:t,side:e,sizeCoin:n,mid:r}){const s=sxn(t,e,n);if(!s||!r)return 0;const a=s/r,o=e==="buy"?a-1:1-a;return Math.max(0,o*100)}const vqe={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},axn="dextra-global-toast";function Ha(t,e){return tn.promise(t,e,{id:axn,...vqe})}const _7=t=>Number(t||0);function oxn(t){var r,s,a;const e=[],n=((s=(r=t==null?void 0:t.response)==null?void 0:r.data)==null?void 0:s.statuses)||((a=t==null?void 0:t.data)==null?void 0:a.statuses)||[];for(const o of n){const l=o==null?void 0:o.filled;(l==null?void 0:l.oid)!=null&&e.push(Number(l.oid));const c=o==null?void 0:o.resting;(c==null?void 0:c.oid)!=null&&e.push(Number(c.oid)),(o==null?void 0:o.oid)!=null&&e.push(Number(o.oid))}return[...new Set(e)]}async function lxn(t,e){const n=String(t||"").toLowerCase(),r=[];for(const s of e)try{const o=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"orderStatus",user:n,oid:s})})).json();r.push({oid:s,data:o})}catch(a){r.push({oid:s,error:String((a==null?void 0:a.message)||a)})}return r}function cxn({longSymbol:t,shortSymbol:e,longSize:n,shortSize:r,orderType:s,reduceOnlyFlag:a,maxSlipVal:o,tpOnFlag:l,tpVal:c,slVal:u,userAddr:d,lev:f,coinSym:x,isPairMode:g,isBuySide:y,sizeCoinVal:v}){return{userAddress:String(d||"").toLowerCase(),order:{actionType:a?"CLOSE":"OPEN",orderType:String(s||"MARKET").toUpperCase(),long:t||(g?"":y?x:""),short:e||(g||y?"":x),leverage:_7(f)||1,longSize:_7(n??(g?0:y?v:0)),shortSize:_7(r??(g||y?0:v)),slippage:Number(o||0),takeProfit:l&&_7(c)>0?String(c):"",stopLoss:l&&_7(u)>0?String(u):""}}}async function $Q({draft:t,responses:e,user:n}){const r=[];for(const o of Array.isArray(e)?e:[e])r.push(...oxn(o));const s=r.length?await lxn(n,r):[];return{...t,exchangeOids:r,orderStatus:s}}function FC(t){return t.then(e=>{var r,s,a;const n=(a=(s=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:s.statuses)==null?void 0:a[0];if(n!=null&&n.error)throw new Error(n.error);if(n!=null&&n.filled){const o=n.filled;return`Filled ${o.totalSz} @ ${o.avgPx}`}return n!=null&&n.resting?`Placing order (oid ${n.resting.oid})`:typeof(e==null?void 0:e.response)=="string"?e.response:"Order placed"})}function eAe({coin:t="ETH",midPrice:e,selectedPrice:n,onSubmit:r,maxLeverage:s=25,wallet:a,onWalletChange:o,uiMode:l="single",pairKey:c="BTC/ETH"}){const[u,d]=m.useState("market"),[f,x]=m.useState("buy"),[g,y]=m.useState(""),[v,C]=m.useState(""),[N,P]=m.useState("USD"),[T,M]=m.useState(0),[F,$]=m.useState(!1),[L,z]=m.useState("GTC"),[X,ne]=m.useState(!1),[J,K]=m.useState(""),[te,fe]=m.useState(""),[q,se]=m.useState(""),[ae,W]=m.useState(""),[V,ee]=m.useState(!1),[oe,de]=m.useState(!1),[Ce,me]=m.useState(!1),[we,xe]=m.useState("Cross"),[be,je]=m.useState("Cross"),[Ie,Re]=m.useState(s),[Qe,Ke]=m.useState(!1),[dt,tt]=m.useState(!1),[nt,Le]=m.useState(!1),[Be,ht]=m.useState("One-Way"),[pt,Gt]=m.useState(""),[wt,nn]=m.useState("USDC"),[cn,Un]=m.useState(0),[Xt,an]=m.useState(5),[Jt,Ye]=m.useState(!1),[Je,It]=m.useState(0),[hn,Yt]=m.useState(!1),[Rt,ot]=m.useState(null),[De,At]=m.useState(null),[ze,rt]=m.useState(null),[mt,Lt]=m.useState(s),[kt,dn]=m.useState(null),[rn,gn]=m.useState({address:null,token:null}),[An,kn]=m.useState(null),[yn,Vn]=m.useState(null),[Kn,Dn]=m.useState(null),[Xn,Nn]=m.useState(50),[on,Oe]=m.useState(!1),[Zt,sn]=m.useState({bids:[],asks:[]}),[jt,Qn]=m.useState(!1),[bn,Dt]=m.useState(String(t)),[en,Pn]=m.useState(()=>{if(typeof window>"u")return"8";const wn=localStorage.getItem("hl_max_slip_pct");if(wn==null||wn==="")return"8";const On=Number(wn);return Number.isFinite(On)&&On>0?String(On):"8"}),[tr,ar]=m.useState(""),[hr,qt]=m.useState({}),[zn,Zn]=m.useState([]),[Ft,En]=m.useState(!1),Ee=m.useRef(null),h=m.useRef(null),[p,S]=m.useState(()=>localStorage.getItem("skipCloseConfirm")==="true"),[_,k]=m.useState([0,0]),[I,B]=m.useState({takerPct:null,makerPct:null});m.useEffect(()=>{localStorage.setItem("skipCloseConfirm",p?"true":"false")},[p]);const G=m.useMemo(()=>Math.max(0,Number(en||0))/100,[en]),re=wn=>String(wn||"").trim().toUpperCase(),ce="dextrabot.last_used_leverage",ue=()=>{try{return JSON.parse(localStorage.getItem(ce)||"{}")}catch{return{}}},ge=wn=>{const On=`leverage:${re(wn)}`,lt=Number(localStorage.getItem(On));return Number.isFinite(lt)&<>0?lt:null},Ae=wn=>{const On=re(wn),lt=ue(),Bt=Number(lt==null?void 0:lt[On]);return Number.isFinite(Bt)&&Bt>0?Bt:ge(On)},ke=(wn,On)=>{var Wn;const lt=re(wn),Bt=Math.max(1,Number(On)||1),nr=ue();nr[lt]=Bt,localStorage.setItem(ce,JSON.stringify(nr)),localStorage.setItem(`leverage:${lt}`,String(Bt)),(Wn=window.dispatchEvent)==null||Wn.call(window,new Event("localStorageUpdated"))},{isConnected:Me}=ns(),{openConnectModal:qe}=D5(),{setSignInConnectButtonOpen:Fe}=m.useContext(Qr),{address:at}=ns(),ie=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,$e=!!(typeof window<"u"&&localStorage.getItem("hyperToken")&&(Me||ie)),Ue=m.useRef(null);m.useEffect(()=>{const wn=at?at.toLowerCase():null;if(Ue.current&&Ue.current!==wn&&typeof window<"u"){const On=window.localStorage;On.removeItem("hyperToken"),On.removeItem("hyperAddress"),On.removeItem("hyperTradeToken"),On.removeItem("hl_pk"),On.removeItem("hl:wallet_id"),Object.keys(On).forEach(lt=>{lt.startsWith("hl_pk:")&&On.removeItem(lt)}),window.dispatchEvent(new Event("localStorageUpdated"))}Ue.current=wn,ot(null)},[at]),m.useEffect(()=>{const wn=(a==null?void 0:a.id)!=null?String(a.id):null;if(wn==null){ot(null);return}ot(On=>On!=null&&String(On)===wn?On:wn)},[a==null?void 0:a.id]),m.useEffect(()=>{Rt!=null&&localStorage.setItem("hl:wallet_id",String(Rt))},[Rt]);const _e=m.useRef(null);m.useEffect(()=>{l!=="pair"&&bn&&_e.current===bn&&ke(bn,Ie)},[Ie,bn,l]),m.useEffect(()=>{let wn,On=!0;function lt(){wn=new WebSocket(BQ),wn.onopen=()=>{const Bt={method:"subscribe",subscription:{type:"l2Book",coin:String(t).toUpperCase()}};wn.send(JSON.stringify(Bt))},wn.onmessage=Bt=>{var Ls;if(!On)return;const nr=JSON.parse(Bt.data),Wn=((Ls=nr==null?void 0:nr.data)==null?void 0:Ls.levels)||(nr==null?void 0:nr.levels),Or=(Wn==null?void 0:Wn.bs)||(Wn==null?void 0:Wn.bids)||[],Pr=(Wn==null?void 0:Wn.as)||(Wn==null?void 0:Wn.asks)||[],ts=Et=>Et.map(or=>Array.isArray(or)?{px:Number(or[0]),sz:Number(or[1])}:{px:Number(or.px),sz:Number(or.sz)}).filter(or=>or.px>0&&or.sz>0);(Or.length||Pr.length)&&sn({bids:ts(Or),asks:ts(Pr)})}}return lt(),()=>{On=!1;try{wn&&wn.close()}catch{}}},[t]),m.useEffect(()=>{const wn=()=>{const On=typeof window<"u"?localStorage.getItem("hyperAddress"):null,lt=typeof window<"u"?localStorage.getItem("hyperToken"):null;gn({address:On,token:lt})};return wn(),window.addEventListener("localStorageUpdated",wn),window.addEventListener("storage",wn),()=>{window.removeEventListener("localStorageUpdated",wn),window.removeEventListener("storage",wn)}},[]);const st=()=>{const wn=parseFloat(String(en).replace(",",".")),lt=Math.max(.01,Math.min(50,Number.isFinite(wn)?wn:8)).toString();Pn(lt),localStorage.setItem("hl_max_slip_pct",lt),Qn(!1)},{wallets:ut}=xqe(rn.address,rn.token,!0,{pollMs:5e3});m.useEffect(()=>{if(!ut||!ut.length||Rt&&ut.some(lt=>String(lt.wallet_id)===String(Rt)))return;const wn=ut.find(lt=>lt.confirmed)||ut[0];if(!wn)return;const On=String(wn.wallet_id);String(Rt)!==On&&(ot(On),o==null||o({id:On,address:wn.wallet_address}))},[ut,Rt,o]);const yt=m.useMemo(()=>(ut||[]).find(wn=>String(wn.wallet_id)===String(Rt))||null,[ut,Rt]);m.useEffect(()=>{n!=null&&n!==""&&(d("limit"),y(Number(n)))},[n]),m.useEffect(()=>{let wn=!0;En(!1);async function On(){try{const Bt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"metaAndAssetCtxs"})})).json(),nr=Array.isArray(Bt)?Bt[0]:Bt,Wn=(nr==null?void 0:nr.universe)||[],Or=new Map(Wn.map(Ls=>{const Et=typeof Ls=="string"?Ls:(Ls==null?void 0:Ls.name)??(Ls==null?void 0:Ls[0])??"";return[re(Et),typeof Ls=="string"?{name:Et}:Ls]}));if(l==="pair"){const[Ls,Et]=String(c||"").split("/").map(Vr=>Vr.trim()),or=Or.get(re(Ls)),Hn=Or.get(re(Et));if(wn){const Vr=(or==null?void 0:or.maxLeverage)??s,us=(Hn==null?void 0:Hn.maxLeverage)??s,as=Math.max(1,Math.min(Vr,us));Lt(as),Re(xs=>Math.min(xs||1,as)),At(null),rt(null),dn(null),Dt(null),En(!0)}return}const Pr=Or.get(re(t));if(!Pr){wn&&(At(null),rt(null),Lt(s),Re(Ls=>Math.min(Ls||1,s)),dn(null),Dt(String(t)),En(!0));return}const ts=(Pr==null?void 0:Pr.name)||String(t);if(wn){At(0),rt((Pr==null?void 0:Pr.szDecimals)??0),Lt((Pr==null?void 0:Pr.maxLeverage)??s),dn((Pr==null?void 0:Pr.maintenanceMarginFraction)??(Pr==null?void 0:Pr.mmr)??null),Dt(ts);const Ls=Ae(ts),Et=Ls!=null?Math.min((Pr==null?void 0:Pr.maxLeverage)??s,Math.max(1,Ls)):Math.min((Pr==null?void 0:Pr.maxLeverage)??s,Math.max(1,Ie||1));Re(Et),_e.current=ts,En(!0)}}catch{wn&&(At(null),rt(null),Lt(s),Re(lt=>Math.min(lt||1,s)),dn(null),Dt(String(t)),En(!0))}}return On(),()=>{wn=!1}},[t,s,l,c]);const Mt=f==="buy",Kt=Mt?Hg:d9,un=m.useMemo(()=>{var lt,Bt,nr,Wn;const wn=(Bt=(lt=Zt==null?void 0:Zt.bids)==null?void 0:lt[0])==null?void 0:Bt.px,On=(Wn=(nr=Zt==null?void 0:Zt.asks)==null?void 0:nr[0])==null?void 0:Wn.px;return Number.isFinite(wn)&&Number.isFinite(On)&&wn>0&&On>0?(On+wn)/2:null},[Zt]),Xe=m.useMemo(()=>{if(u==="limit"&&g!=="")return Number(g);const wn=Number(e||0);if(wn>0)return wn;if(Number(un||0)>0)return Number(un);const On=Number((hr||{})[t]||0);return On>0?On:0},[u,g,e,un,hr,t]),Pt=yt==null?void 0:yt.wallet_address,{accountEquity:Wt,perpsOverview:ct,spotBalances:Ge,perps:Tt}=sP(Pt),{rows:fn}=Xde(Pt);m.useEffect(()=>{let wn=!1;async function On(){var Bt,nr,Wn,Or;if(!Pt){wn||B({takerPct:null,makerPct:null});return}try{const ts=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFees",user:Pt.toLowerCase()})})).json();if(wn)return;const Ls=Number(ts.userCrossRate??((Bt=ts.feeSchedule)==null?void 0:Bt.cross)??NaN),Et=Number(ts.userAddRate??((nr=ts.feeSchedule)==null?void 0:nr.add)??NaN);if(!Number.isFinite(Ls)||!Number.isFinite(Et)){B({takerPct:null,makerPct:null});return}const or=Number(ts.activeReferralDiscount??((Wn=ts.feeSchedule)==null?void 0:Wn.referralDiscount)??0)||0,Hn=Number(((Or=ts.activeStakingDiscount)==null?void 0:Or.discount)??0)||0,Vr=Math.max(0,1-or-Hn),us=Ls*Vr,as=Et*Vr;B({takerPct:us*100,makerPct:as*100})}catch{wn||B({takerPct:null,makerPct:null})}}On();const lt=setInterval(On,5*60*1e3);return()=>{wn=!0,clearInterval(lt)}},[Pt]);const Yn=m.useMemo(()=>{const{takerPct:wn,makerPct:On}=I;if(wn==null||On==null)return"—";const lt=Bt=>Number(Bt).toLocaleString(void 0,{minimumFractionDigits:4,maximumFractionDigits:4});return`${lt(wn)}% / ${lt(On)}%`},[I]);m.useEffect(()=>{let wn=!1;async function On(){if(!(!Pt||l==="pair"))try{const Bt=await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"activeAssetData",user:Pt.toLowerCase(),coin:String(bn||t)})})).json();if(wn)return;const nr=Bt==null?void 0:Bt.leverage;if(!nr)return;const Wn=String(nr.type||"").toLowerCase()==="cross"?"Cross":"Isolated",Pr=Math.max(1,Math.min(mt||s,Number(nr.value||nr.leverage)||1));xe(Wn),je(Wn),Re(Pr)}catch{}}return On(),()=>{wn=!0}},[Pt,t,l,mt,s]),m.useEffect(()=>{if(!Pt)return;const wn=new WebSocket(BQ);return Ee.current=wn,wn.onopen=()=>{wn.send(JSON.stringify({method:"subscribe",subscription:{type:"user",user:Pt}})),wn.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:Pt}})),h.current=setInterval(()=>{wn.readyState===WebSocket.OPEN&&wn.send(JSON.stringify({id:99,method:"ping"}))},3e4)},wn.onmessage=On=>{var lt,Bt,nr,Wn;try{const Or=JSON.parse(On.data),Pr=(Or==null?void 0:Or.data)||{},ts=(lt=Pr==null?void 0:Pr.meta)==null?void 0:lt.universe,Ls=Pr==null?void 0:Pr.allMids;if(Array.isArray(ts)&&Array.isArray(Ls)&&ts.length===Ls.length){const or={};for(let Hn=0;Hn<ts.length;Hn++){const Vr=typeof ts[Hn]=="string"?ts[Hn]:((Bt=ts[Hn])==null?void 0:Bt.name)||((nr=ts[Hn])==null?void 0:nr[0]),us=Number(Ls[Hn]);Vr&&Number.isFinite(us)&&(or[Vr]=us)}qt(Hn=>({...Hn,...or}))}const Et=Array.isArray((Wn=Pr==null?void 0:Pr.spotState)==null?void 0:Wn.balances)?Pr.spotState.balances:Array.isArray(Pr==null?void 0:Pr.balances)?Pr.balances:null;Array.isArray(Et)&&Zn(Et.filter(or=>or&&or.coin).map(or=>({coin:String(or.coin),total:Number(or.total||0),hold:Number(or.hold||0)})))}catch{}},wn.onclose=()=>{h.current&&clearInterval(h.current)},()=>{h.current&&clearInterval(h.current);try{wn.close()}catch{}}},[Pt]),m.useEffect(()=>{if(!Pt){k([0,0]);return}k([0,0]);let wn=!0;const On=new WebSocket(BQ);return On.onopen=()=>{On.send(JSON.stringify({method:"subscribe",subscription:{type:"activeAssetData",user:Pt.toLowerCase(),coin:String(t)}}))},On.onmessage=lt=>{if(wn)try{const Bt=JSON.parse(lt.data);if(Bt.channel==="activeAssetData"&&Bt.data){const nr=Bt.data.availableToTrade||[];k([Number(nr[0]||0),Number(nr[1]||0)])}}catch{}},On.onclose=()=>{wn&&k([0,0])},()=>{wn=!1;try{On.close()}catch{}}},[Pt,t]);const Fn=m.useMemo(()=>{const wn=(Ge||[]).find(On=>On.coin==="USDC");return wn?Math.max(0,Number(wn.total||0)-Number(wn.hold||0)):0},[Ge]),Gn=m.useMemo(()=>{if(!zn.length)return null;let wn=0;for(const On of zn){const lt=Number(On.total||0);if(lt>0)if(On.coin==="USDC")wn+=lt;else{const Bt=hr[On.coin];Number.isFinite(Bt)&&Bt>0&&(wn+=lt*Bt)}}return wn},[zn,hr]),Sr=Number((Tt==null?void 0:Tt.accountValue)??0),ur=Number((Tt==null?void 0:Tt.totalMarginUsed)??0),kr=Math.max(0,Sr-ur),Bn=kr,Sn=kr<1;async function Mn({toPerp:wn,amount:On,available:lt}){var Bt;try{if(Oe(!0),!An){await Ha(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message});return}if(!Number(On)){await Ha(Promise.reject(new Error("Amount is invalid")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message});return}if(Number(On)>Number(lt||0)){await Ha(Promise.reject(new Error("Amount exceeds available")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message});return}const nr=An.transfers.usdClassTransfer(String(On),!!wn).then(Wn=>{if((Wn==null?void 0:Wn.status)==="ok")return"Transfer successful.";const Or=typeof(Wn==null?void 0:Wn.response)=="string"?Wn.response:"Transfer failed";throw new Error(Or)});await Ha(nr,{loading:`Transferring ${On} USDC ${wn?"Spot → Perps":"Perps → Spot"}...`,success:Wn=>Wn,error:Wn=>(Wn==null?void 0:Wn.message)||"Transfer failed"}),(Bt=window==null?void 0:window.dispatchEvent)==null||Bt.call(window,new Event("balances:refresh")),Ke(!1)}catch{}finally{Oe(!1)}}const rr=(()=>{const wn=Number(v)||0;return N==="COIN"?wn:Xe?wn/Xe:0})(),ls=rr*(Xe||0),cs=Ie?ls/Ie:0;function et(wn){const On=Math.max(1,Number(Ie)||1),lt=Math.max(0,Number(kt)||0),Bt=wn/On+wn*lt,nr=Bn>0?Bt/Bn*100:0;M(Math.max(0,Math.min(100,Math.round(nr))))}function gt(wn){M(wn);const On=Math.max(1,Number(Ie)||1),lt=Math.max(0,Number(kt)||0),Bt=wn/100*Bn,nr=1/On+lt,Wn=nr>0?Bt/nr:0;if(l==="pair"){ar(Wn?String(Wn.toFixed(2)):"");return}if(N==="USD")C(Wn?String(Wn.toFixed(2)):"");else{const Or=Xe?Wn/Xe:0,Pr=ze??4;C(Or?String(Or.toFixed(Pr)):""),et(Or*Xe)}}function Tn(wn){const On=Math.max(1,Number(Ie)||1),lt=Math.max(0,Number(kt)||0),Bt=wn/On+wn*lt,nr=Bn>0?Bt/Bn*100:0;It(Math.max(0,Math.min(100,Math.round(nr))))}function sr(wn){const On=Math.max(0,Math.min(100,Number(wn)||0));It(On);const lt=Math.max(1,Number(Ie)||1),Bt=Math.max(0,Number(kt)||0),nr=On/100*Bn,Wn=1/lt+Bt,Or=Wn>0?nr/Wn:0;if(wt==="COIN"){const Pr=Xe?Or/Xe:0,ts=ze??4;Gt(Pr?String(Pr.toFixed(ts)):"")}else Gt(Or?String(Or.toFixed(2)):"")}function Tr(wn){Gt(wn);const On=Number(wn)||0,Bt=(wt==="COIN"?On:Xe?On/Xe:0)*(Xe||0);Tn(Bt)}function Lr(wn){if(wn===wt)return;const On=Number(pt)||0;let lt="";if(wn==="USDC")lt=String(((On||0)*(Xe||0)).toFixed(2)),nn("USDC"),Gt(lt),Tn(Number(lt)||0);else if(!Xe)nn("COIN"),Gt(""),Tn(0);else{const Bt=ze??4;lt=String(((On||0)/Xe).toFixed(Bt)),nn("COIN"),Gt(lt),Tn((Number(lt)||0)*Xe)}}function $r(wn){C(wn);const On=Number(wn)||0,Bt=(N==="COIN"?On:Xe?On/Xe:0)*(Xe||0);et(Bt)}function lr(wn){const On=wn==="USDC"?"USD":wn;if(On===N)return;const lt=Number(v)||0;let Bt="";if(On==="USD")Bt=String(((lt||0)*(Xe||0)).toFixed(2)),P("USD"),C(Bt),et(Number(Bt)||0);else if(!Xe)P("COIN"),C(""),et(0);else{const nr=ze??4;Bt=String(((lt||0)/Xe).toFixed(nr)),P("COIN"),C(Bt),et((Number(Bt)||0)*Xe)}}function wr({entry:wn,side:On,notionalUSD:lt,maintenanceFrac:Bt,marginMode:nr,accountValueUSD:Wn,isolatedMarginUSD:Or}){const Pr=Number(wn)||0,ts=Math.abs(Number(lt)||0);if(!Pr||!ts)return null;const Ls=On==="buy"?1:-1,Et=Math.max(0,Number(Bt)||0),or=ts/Pr,Hn=ts*Et;let Vr;nr==="Cross"?Vr=Wn-Hn:Vr=Or-Hn;const us=1-Et*Ls;if(!or||!isFinite(us))return null;const as=Pr-Ls*(Vr/or)/us;return Math.max(0,as)}const ss=Number((ct==null?void 0:ct.balance)??0),mr=typeof kt=="number"?kt:.01,es=rr>0&&Xe?wr({entry:Xe,side:f,notionalUSD:ls,maintenanceFrac:mr,marginMode:we,accountValueUSD:ss}):null;m.useEffect(()=>{$r(v)},[N,Xe,Ie,Bn]),m.useEffect(()=>{u==="twap"&&Tr(pt)},[u,wt,pt,Xe,Ie,Bn]);const Ys=m.useMemo(()=>ixn({book:Zt,side:f,sizeCoin:rr,mid:e}),[Zt,f,rr,e]);m.useEffect(()=>{let wn=!1;async function On(){if(!(yt!=null&&yt.wallet_address)||!Rt){kn(null);return}const lt=aP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null}),Bt=yA({address:yt.wallet_address,signer:lt,dex:"",defaultSlippage:G});wn||kn(Bt)}return On(),()=>{wn=!0}},[Rt,yt==null?void 0:yt.wallet_address,G]);const _s=wn=>wn||wn===0?String(Math.trunc(Number(wn))):"",br=Number(Xe||0),zt=wn=>{se(wn),Vn("pct");const On=Number(wn),lt=Math.max(1,Number(Ie)||1);if(!br||!isFinite(On)){K("");return}const Bt=On/(lt*100),nr=Mt?br*(1+Bt):br*(1-Bt);K(_s(nr))};m.useEffect(()=>{X&&(K(""),fe(""),se(""),W(""),Vn(null),Dn(null))},[f]);const he=wn=>{K(wn),Vn("price");const On=Number(wn),lt=Math.max(1,Number(Ie)||1);if(!br||!On){se("");return}const Bt=On/br,nr=Mt?(Bt-1)*lt*100:(1-Bt)*lt*100;se(String(Number(nr).toFixed(2)))},it=wn=>{W(wn),Dn("pct");const On=Number(wn),lt=Math.max(1,Number(Ie)||1);if(!br||!isFinite(On)){fe("");return}const Bt=On/(lt*100),nr=Mt?br*(1-Bt):br*(1+Bt);fe(_s(nr))},Ct=wn=>{fe(wn),Dn("price");const On=Number(wn),lt=Math.max(1,Number(Ie)||1);if(!br||!On){W("");return}const Bt=On/br,nr=Mt?(1-Bt)*lt*100:(Bt-1)*lt*100;W(String(Number(nr).toFixed(2)))};m.useEffect(()=>{br&&(X&&(yn==="pct"?zt(q):yn==="price"&&he(J)),Kn==="pct"?it(ae):Kn==="price"&&Ct(te))},[br,Ie]);function vt(){var wn;(wn=window==null?void 0:window.dispatchEvent)==null||wn.call(window,new Event("balances:refresh"))}async function ln(wn){const On=()=>{typeof wn=="function"&&wn()};if(!Rt){await Ha(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message}),On();return}if(!An){await Ha(Promise.reject(new Error("Please sign in to perform this action.")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message}),On();return}const lt=String(we||"").toLowerCase().startsWith("iso")?"isolated":"cross",nr=Math.max(1,Math.min(mt||s,Number(Ie)||1));if(!Ir&&Math.abs(Yr||0)>0){const Wn=String(be||"").toLowerCase().startsWith("iso")?"isolated":"cross";if(lt!==Wn){await Ha(new Promise(Or=>Or()),{loading:"Validating...",success:()=>{throw new Error("Cannot switch leverage type with open position.")},error:Or=>Or.message}),xe(be),On();return}}try{if(l==="pair"){const[Wn,Or]=String(c||"").split("/").map(ts=>ts.trim().toUpperCase()),Pr=Promise.all([An.updateLeverage(Wn,lt,nr),An.updateLeverage(Or,lt,nr)]);await Ha(Pr,{loading:`Updating for ${Wn}/${Or}...`,success:()=>"Updated",error:ts=>(ts==null?void 0:ts.message)||"Failed to update leverage for pair"})}else{const Wn=bn||String(t).toUpperCase(),Or=An.updateLeverage(Wn,lt,nr);await Ha(Or,{loading:`Updating for ${Wn}...`,success:()=>"Updated",error:Pr=>(Pr==null?void 0:Pr.message)||"Failed to update leverage"}),je(we)}On()}catch{xe(be),On()}}async function xn(){const[wn,On]=String(c||"").split("/").map(lt=>lt.trim().toUpperCase());try{if(!Rt){await Ha(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}if(!An){await Ha(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const lt=await An.info.allMids(),Bt=Number(lt[wn]||0),nr=Number(lt[On]||0);if(!(Bt>0&&nr>0)){await Ha(Promise.reject(new Error("Mid price not available for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const Wn=Math.max(1,Math.min(Number(Ie)||1,Number(mt)||1));Wn!==Ie&&(Re(Wn),tn.success(`Leverage adjusted to ${Wn}x`,vqe));let Or=Number(tr)>0?Number(tr):T/100*Bn*Wn;if(!(Or>0)){await Ha(Promise.reject(new Error("Enter a valid total notional for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message});return}const Pr=Math.max(0,Math.min(100,Number(Xn)||0))/100,ts=Or*Pr,Ls=Or-ts,Et=ts/Bt,or=Ls/nr,Hn=cxn({longSymbol:wn,shortSymbol:On,longSize:Et,shortSize:or,orderType:u,reduceOnlyFlag:!!F,maxSlipVal:G,tpOnFlag:!1,tpVal:"",slVal:"",userAddr:(yt==null?void 0:yt.wallet_address)||at,lev:Wn,coinSym:"",isPairMode:!0,isBuySide:!0,sizeCoinVal:0});if(u==="market"){const Vr=F?An.marketClose(wn,void 0,{tif:"Ioc",reduceOnly:!0,slippage:G}):An.marketOpen(wn,!0,Number(Et),{tif:"Ioc",reduceOnly:!1,slippage:G}),us=F?An.marketClose(On,void 0,{tif:"Ioc",reduceOnly:!0,slippage:G}):An.marketOpen(On,!1,Number(or),{tif:"Ioc",reduceOnly:!1,slippage:G}),as=(async()=>{const[xs,bs]=await Promise.all([Vr,us]);return await $Q({draft:Hn,responses:[xs,bs],user:Hn.userAddress}),"Pair market placed"})();await Ha(as,{loading:`Opening ${wn} long / ${On} short...`,success:xs=>xs,error:xs=>(xs==null?void 0:xs.message)||"Pair order failed"}),vt(),M(0),ar("");return}if(u==="limit"){const Vr=JNe(L),us=An.placeOrder({symbol:wn,isBuy:!0,size:Number(Et),price:Bt,tif:Vr,reduceOnly:!1}),as=An.placeOrder({symbol:On,isBuy:!1,size:Number(or),price:nr,tif:Vr,reduceOnly:!1}),xs=(async()=>{const[bs,zi]=await Promise.all([us,as]);return await $Q({draft:Hn,responses:[bs,zi],user:Hn.userAddress}),"Pair limit placed"})();await Ha(xs,{loading:`Placing ${wn} long / ${On} short limits...`,success:bs=>bs,error:bs=>(bs==null?void 0:bs.message)||"Pair limit failed"}),vt(),M(0),ar("");return}if(u==="twap"){const Vr=Math.max(5,Math.min(1440,Number(cn||0)*60+Number(Xt||0))),us=An.placeTwapOrder({symbol:wn,isBuy:!0,size:Number(Et),minutes:Vr,randomize:!!Jt,reduceOnly:!!F}),as=An.placeTwapOrder({symbol:On,isBuy:!1,size:Number(or),minutes:Vr,randomize:!!Jt,reduceOnly:!!F}),xs=(async()=>{const[bs,zi]=await Promise.all([us,as]);return await $Q({draft:Hn,responses:[bs,zi],user:Hn.userAddress}),"Pair TWAP started"})();await Ha(xs,{loading:"Starting pair TWAP...",success:bs=>bs,error:bs=>(bs==null?void 0:bs.message)||"Pair TWAP failed"}),vt(),M(0),ar("");return}await Ha(Promise.reject(new Error("Unsupported mode for pair")),{loading:"Validating...",success:"OK",error:Vr=>Vr.message})}catch{}}const dr=m.useMemo(()=>{const wn=Number(cn||0)*60+Number(Xt||0);return wn?Math.max(5,Math.min(1440,wn)):0},[cn,Xt]),Er=m.useMemo(()=>{if(!dr)return 0;const wn=Math.floor(dr*60/30);return Math.max(1,wn+1)},[dr]),pr=m.useMemo(()=>{const wn=Number(pt)||0;return wn>0?wt==="COIN"?wn:Xe?wn/Xe:0:0},[pt,wt,Xe]),fr=m.useMemo(()=>!Er||!(pr>0)?0:pr/Er,[pr,Er]),Yr=m.useMemo(()=>{const wn=String(t||"").toUpperCase();if(!fn||!fn.length)return 0;const On=fn.find(lt=>String(lt.coin||"").toUpperCase()===wn);return On?Number(On.size||0):0},[fn,t]);async function is(){try{if(!Rt){await Ha(Promise.reject(new Error("Select a wallet")),{loading:"Validating...",success:"OK",error:On=>On.message});return}if(!An){await Ha(Promise.reject(new Error("Trading is not ready (HL not initialized)")),{loading:"Validating...",success:"OK",error:On=>On.message});return}if(l==="pair"){Yt(!0),await xn(),Yt(!1);return}const wn=Number(v)||0;if((u==="market"||u==="limit")&&wn<=0&&!(u==="market"&&F)){await Ha(Promise.reject(new Error("Enter a valid amount")),{loading:"Validating...",success:"OK",error:On=>On.message});return}if(Yt(!0),u==="market")if(F){const On=wn>0?FC(An.marketClose(t,Number(rr),{tif:"Ioc",reduceOnly:!0,slippage:G})):FC(An.marketClose(t,void 0,{tif:"Ioc",reduceOnly:!0,slippage:G}));await Ha(On,{loading:`Closing ${t} position...`,success:lt=>lt,error:lt=>(lt==null?void 0:lt.message)||"Close failed"}),vt()}else{const On=X&&J!==""&&Number(J)>0,lt=X&&te!==""&&Number(te)>0,Bt=FC(On||lt?An.placeMarketWithTPSL({symbol:t,isBuy:Mt,size:Number(rr),entrySlippage:G,tpPrice:On?Number(J):null,slPrice:lt?Number(te):null,triggerSlippage:.1}):An.marketOpen(t,Mt,Number(rr),{tif:"Ioc",reduceOnly:!1,slippage:G}));await Ha(Bt,{loading:`Placing ${Mt?"Buy":"Sell"} market order...`,success:nr=>nr,error:nr=>(nr==null?void 0:nr.message)||"Order failed"}),vt(),M(0),C("")}else if(u==="limit"){const On=JNe(L),lt=X&&J!==""&&Number(J)>0,Bt=X&&te!==""&&Number(te)>0,nr=FC(lt||Bt?An.placeLimitWithTPSL({symbol:t,isBuy:Mt,size:Number(rr),price:Number(g),tif:On,reduceOnly:F,tpPrice:lt?Number(J):null,slPrice:Bt?Number(te):null,triggerSlippage:G}):An.placeOrder({symbol:t,isBuy:Mt,size:Number(rr),price:Number(g),tif:On,reduceOnly:F}));await Ha(nr,{loading:`Placing ${Mt?"Buy":"Sell"} limit order...`,success:Wn=>Wn,error:Wn=>(Wn==null?void 0:Wn.message)||"Order failed"}),vt(),M(0),C("")}else if(u==="twap"){const On=dr;if(!On){await Ha(Promise.reject(new Error("Enter a valid running time (min 5 minutes)")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message}),Yt(!1);return}let lt=0;const Bt=Number(pt)||0;if(wt==="COIN")lt=Bt;else{if(!Xe){await Ha(Promise.reject(new Error("Price required to convert USD to size")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message}),Yt(!1);return}lt=Bt/Xe}if(!(lt>0)){await Ha(Promise.reject(new Error("Enter a valid TWAP size")),{loading:"Validating...",success:"OK",error:Wn=>Wn.message}),Yt(!1);return}const nr=An.placeTwapOrder({symbol:t,isBuy:Mt,size:Number(lt),minutes:On,randomize:!!Jt,reduceOnly:!!F});await Ha(nr,{loading:`Starting TWAP for ${t}...`,success:()=>`TWAP started: ${Number(lt).toLocaleString(void 0,{maximumFractionDigits:ze??4})} ${t} over ${On}m`,error:Wn=>(Wn==null?void 0:Wn.message)||"TWAP failed"}),vt()}else{await Ha(Promise.reject(new Error("This mode is not wired to HyperSDK yet")),{loading:"Validating...",success:"OK",error:On=>On.message}),Yt(!1);return}}catch{}finally{Yt(!1)}}const Ir=l==="pair",[yr,Jn]=String(c||"").split("/").map(wn=>wn.trim().toUpperCase()),gs=m.useMemo(()=>Ir?0:Number((Mt?_[0]:_[1])||0),[Ir,Mt,_]),Zs=Number(Ir?tr||0:ls||0),oi=u!=="twap"&&Zs<10,Fr=oi?"Order must have minimum value of $10.":Sn?"Not Enough Margin":hn?"Placing...":u==="twap"?l==="pair"?"Start Pair TWAP":"Start TWAP":u==="scale"?"Place Scale Orders":l==="pair"?"Place Pair Order":"Place Order";return i.jsxs("div",{className:"w-full text-[12px]",style:{background:pqe,borderRadius:16,padding:12},children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsxs("div",{className:"flex flex-1 gap-2",children:[i.jsx(z4,{onClick:()=>ee(!0),children:we}),i.jsx(z4,{onClick:Ft?()=>de(!0):void 0,children:Ft?`${Ie}x`:i.jsx("span",{className:"flex items-center justify-center gap-1",children:i.jsx("span",{className:"inline-block w-3 h-3 border-2 border-[#67FFBD] border-t-transparent rounded-full animate-spin"})})}),i.jsx(z4,{onClick:()=>me(!0),children:Be})]}),i.jsx(rxn,{skipConfirm:p,setSkipConfirm:S})]}),$e&&i.jsx("div",{className:"mb-3",children:i.jsx(iP,{wallets:ut,value:Rt,selectedBalance:ct==null?void 0:ct.balance,onChange:wn=>{if(String(Rt)===String(wn))return;ot(wn);const On=(ut||[]).find(lt=>String(lt.wallet_id)===String(wn));o==null||o({id:String(wn),address:(On==null?void 0:On.wallet_address)||null})}})}),i.jsx(u0n,{mode:u,onModeChange:d,moreItems:[{key:"twap",label:"TWAP"}],className:"mb-3"}),!Ir&&i.jsx("div",{className:"mb-1",children:i.jsxs("div",{className:"mb-3 grid grid-cols-2 gap-2",children:[i.jsx("button",{type:"button",onClick:()=>x("buy"),className:"h-[34px] rounded-lg font-bold transition-colors flex justify-center items-center",style:{background:f==="buy"?"rgb(103, 255, 189)":Ro,color:f==="buy"?"rgb(15, 21, 26)":Bi},children:"Buy / Long"}),i.jsx("button",{type:"button",onClick:()=>x("sell"),className:"h-[34px] rounded-lg font-bold transition-colors flex justify-center items-center",style:{background:f==="sell"?"rgb(255,121,124)":Ro,color:f==="sell"?"rgb(15, 21, 26)":Bi},children:"Sell / Short"})]})}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:wi},children:"Available to Trade"}),i.jsxs("div",{className:"text-white font-semibold",children:[gs.toLocaleString(void 0,{maximumFractionDigits:2})," ","USDC"]})]}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("div",{style:{color:wi},children:"Current Position"}),i.jsx("div",{className:"text-white font-semibold",children:Yr?`${Math.abs(Yr).toLocaleString(void 0,{maximumFractionDigits:ze??5})} ${t}`:`0.00000 ${t}`})]}),!Ir&&u==="limit"&&i.jsx("div",{className:"mb-3",children:i.jsx(Pb,{label:"Price (USDC)",value:g,onChange:y,right:i.jsx("div",{className:"h-[22px] px-2 rounded-md flex justify-center items-center cursor-pointer",style:{background:"#1b242c",color:"#67FFBD",border:`1px solid ${Ra}`},onClick:()=>y(e??""),children:"Mid"})})}),!Ir&&(u==="market"||u==="limit")&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"mb-3",children:i.jsx(Pb,{label:"Size",value:v,onChange:$r,right:i.jsx($F,{value:N,onChange:lr,items:[{key:"USD",label:"USDC"},{key:"COIN",label:t}]})})}),i.jsxs("div",{className:"flex items-center gap-3 mb-6 ",children:[i.jsx(vA,{value:T,onChange:gt,accent:Kt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:T,onChange:wn=>gt(Math.max(0,Math.min(100,Number(wn.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]})]}),i.jsxs("div",{className:`${u==="market"?"flex-col space-y-2":"flex"} items-center justify-between mb-2`,children:[i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:F,onChange:wn=>$(wn.target.checked)}),"Reduce Only"]}),u==="limit"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(gi,{align:"left",content:"Time In Force <br><br>GTC (Good Til Cancel): Order will rest until filled or canceled.<br><br>IOC (Immediate Or Cancel): Any portion that is not immediately filled will be canceled.<br><br>ALO (Add Liquidity Only): Order will exist only as a limit order on the book. Also known as post-only.",children:i.jsx("span",{style:{color:wi},children:"TIF"})}),i.jsx($F,{value:L,onChange:z,items:[{key:"GTC",label:"GTC"},{key:"IOC",label:"IOC"},{key:"ALO",label:"ALO"}]})]}),u==="market"&&i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:X,onChange:wn=>ne(wn.target.checked)}),"TP/SL"]})]}),u==="limit"&&i.jsxs("label",{className:"flex items-center gap-2 mb-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:X,onChange:wn=>ne(wn.target.checked)}),"TP/SL"]}),X&&i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsx(Pb,{label:"TP",value:J,onChange:he}),i.jsx(Pb,{label:"Gain %",value:q,onChange:zt,right:i.jsx("span",{style:{color:wi},children:"%"})}),i.jsx(Pb,{label:"SL",value:te,onChange:Ct}),i.jsx(Pb,{label:"Loss %",value:ae,onChange:it,right:i.jsx("span",{style:{color:wi},children:"%"})})]})]}),Ir&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-2 w-full flex justify-between gap-2",children:[i.jsxs("span",{className:"h-[34px] rounded-lg font-semibold bg-[rgba(103,255,189,0.16)] text-[#67FFBD] flex justify-center items-center w-1/2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${yr}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),yr," Long"]}),i.jsxs("span",{className:"h-[34px] rounded-lg font-semibold bg-[rgba(255,121,124,0.12)] text-[#FF7272] flex justify-center items-center w-1/2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${Jn}.svg`,alt:"Dextrabot - Terminal",className:"w-4 h-4 mr-2"}),Jn," Short"]})]}),i.jsx("div",{className:"mb-3",children:i.jsx(txn,{value:Xn,onChange:Nn,leftLabel:yr,rightLabel:Jn,leftUsd:Number(tr||0)>0?Number(tr)*Xn/100:0,rightUsd:Number(tr||0)>0?Number(tr)*(100-Xn)/100:0})}),i.jsx("div",{className:"mb-3",children:i.jsx(Pb,{label:"Size (USD)",value:tr,onChange:wn=>{ar(wn)},right:i.jsx("div",{className:"h-[22px] px-2 rounded-md flex justify-center items-center cursor-pointer",style:{background:"#1b242c",color:"#67FFBD",border:`1px solid ${Ra}`},onClick:()=>{const wn=Bn*(Number(Ie)||1);ar(String(wn.toFixed(2)))},children:"Max"})})}),i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:F,onChange:wn=>$(wn.target.checked)}),"Reduce Only"]}),u==="limit"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{style:{color:wi},children:"TIF"}),i.jsx($F,{value:L,onChange:z,items:[{key:"GTC",label:"GTC"},{key:"IOC",label:"IOC"},{key:"ALO",label:"ALO"}]})]})]})]}),u==="twap"&&!Ir&&i.jsxs(i.Fragment,{children:[i.jsx(Pb,{label:"Total Size",value:pt,onChange:Tr,right:i.jsx($F,{value:wt,onChange:Lr,items:[{key:"USDC",label:"USDC"},{key:"COIN",label:t}]})}),i.jsxs("div",{className:"flex items-center gap-3 mb-8 mt-3",children:[i.jsx(vA,{value:Je,onChange:sr,accent:Kt}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:Je,onChange:wn=>sr(Math.max(0,Math.min(100,Number(wn.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]})]}),i.jsx("div",{className:"mb-2 mt-3",style:{color:wi},children:"Running Time (5m - 24h)"}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsx("div",{className:"h-[30px] px-2 rounded-lg flex items-center",style:{background:Ro,border:`1px solid ${Ra}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Hour(s)",value:cn===0?"":cn,onChange:wn=>{const On=wn.target.value.replace(/[^\d]/g,""),lt=Math.max(0,Math.min(24,Number(On)||0));Un(lt)},style:{color:cn?"#FFFFFF":wi,fontFeatureSettings:'"tnum"'}})}),i.jsx("div",{className:"h-[30px] px-2 rounded-lg flex items-center",style:{background:Ro,border:`1px solid ${Ra}`},children:i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",placeholder:"Minute(s)",value:Xt===0?"":Xt,onFocus:()=>{Xt===5&&an(0)},onChange:wn=>{const On=wn.target.value.replace(/[^\d]/g,""),lt=Math.max(0,Math.min(59,Number(On)||0));an(lt)},style:{color:Xt?"#FFFFFF":wi,fontFeatureSettings:'"tnum"'}})})]}),i.jsxs("div",{className:"flex-col space-y-2 items-center gap-6 mb-3",children:[i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:Jt,onChange:wn=>Ye(wn.target.checked)}),"Randomize"]}),i.jsxs("label",{className:"flex items-center gap-2",style:{color:"#c9d1d9"},children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:F,onChange:wn=>$(wn.target.checked)}),"Reduce Only"]})]})]}),$e?i.jsx("button",{onClick:is,disabled:hn||!Rt||Sn||oi,className:"w-full h-[32px] rounded-xl font-bold transition-opacity mb-2 flex items-center justify-center disabled:opacity-60",style:{background:Kt,color:"#0f151a"},children:Fr}):i.jsx(om,{onClick:()=>{qe==null||qe(),Fe(!0)}}),u==="twap"&&!Ir?i.jsxs("div",{className:"mt-4 border-t border-b border-dashed border-[#2F2F2F]",children:[i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Frequency"}),i.jsx("span",{className:"text-white",children:"30 seconds"})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Runtime"}),i.jsxs("span",{className:"text-white",children:[dr.toLocaleString(void 0,{maximumFractionDigits:0})," ","minutes"]})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Number of Orders"}),i.jsx("span",{className:"text-white",children:Er.toLocaleString(void 0,{maximumFractionDigits:0})})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Size per Suborder"}),i.jsx("span",{className:"text-white",children:fr>0?`${fr.toLocaleString(void 0,{maximumFractionDigits:ze??5})} ${t}`:`0.00000 ${t}`})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Fees"}),i.jsx("span",{className:"text-[#67FFBD]",children:Yn})]})]}):i.jsxs("div",{className:"mt-4 border-t border-b border-dashed border-[#2F2F2F]",children:[i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Liquidation Price"}),i.jsx("span",{className:"text-white",children:Ir?"-":es?`$${es.toLocaleString(void 0,{maximumFractionDigits:2})}`:"$0.00"})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Order Value"}),i.jsx("span",{className:"text-white",children:Ir?`$${Number(tr||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(ls||0).toLocaleString(void 0,{maximumFractionDigits:2})}`})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Margin Required"}),i.jsx("span",{className:"text-white",children:Ir?`$${(Number(tr||0)/(Number(Ie)||1)||0).toLocaleString(void 0,{maximumFractionDigits:2})}`:`$${(cs||0).toLocaleString(void 0,{maximumFractionDigits:2})}`})]}),i.jsxs("div",{className:"flex items-center justify-between px-0 py-2 text-[13px] font-inter leading-4 border-t border-dashed border-[#2F2F2F] first:border-t-0",children:[i.jsx("span",{className:"text-[#929292]",children:"Slippage"}),i.jsxs("button",{type:"button",onClick:()=>Qn(!0),className:"text-[#67FFBD] hover:opacity-80 h-5 text-xs flex justify-center items-center",children:[`Est: ${Ys}% / `,`Max: ${Number(en||0).toFixed(2)}%`]})]})]}),$e&&yt&&i.jsx("button",{onClick:()=>Le(!0),className:"flex w-full h-[32px] px-4 py-2 justify-center items-center gap-[10px] shrink-0 rounded-lg bg[rgba(103,255,189,0.16)] text-[#67FFBD] font-inter text-[13px] not-italic font-medium leading-[16px] mt-3 transition-opacity",children:"Deposit"}),$e&&yt&&i.jsxs("div",{className:"flex w-full gap-2 mt-2",children:[i.jsxs(GNe,{onClick:()=>Ke(!0),className:"flex-1",children:["Perps ",i.jsx(ale,{className:"mx-1 text-xs"})," Spot"]}),i.jsx(GNe,{onClick:()=>tt(!0),className:"flex-1",children:"Withdraw"})]}),i.jsxs("div",{className:"mt-3 pt-2",children:[i.jsx("div",{className:"mb-2 text-white font-inter text-[13px] font-normal leading-4",children:"Account Equity"}),i.jsx(Mv,{k:"Spot",v:`$${ZNe(Gn??Number(Wt.spot||0))}`}),i.jsx(Mv,{k:"Perps",v:`$${ZNe(ct.balance)}`})]}),i.jsxs("div",{className:"mt-3 pt-2",children:[i.jsx("div",{className:"mb-2 text-white font-inter text-[13px] font-normal leading-4",children:"Perps Overview"}),i.jsx(Mv,{k:"Balance",v:`$${E7(ct.balance,2)}`}),i.jsx(Mv,{k:"Unrealized PNL",v:i.jsxs("span",{style:{color:ct.uPnl<0?"#FF7173":"#67FFBD"},children:["$",E7(ct.uPnl,2)]})}),i.jsx(Mv,{k:"Cross Margin Ratio",v:i.jsxs("span",{style:{color:ct.cmr>=.5?"#FF7173":"#67FFBD"},children:[E7(ct.cmr*100,2),"%"]}),link:!0}),i.jsx(Mv,{k:"Maintenance Margin",v:`$${E7(ct.maintenanceMargin,2)}`}),i.jsx(Mv,{k:"Cross Account Leverage",v:`${E7(ct.crossLeverage,2)}x`})]}),i.jsx(b0n,{open:nt,onClose:()=>Le(!1),initialAsset:"USDC",initialChain:"Arbitrum",toWalletAddress:(yt==null?void 0:yt.wallet_address)||""}),i.jsx(yqe,{open:Qe,onClose:()=>Ke(!1),perpsAvailable:kr,spotUsdcAvailable:Fn,onSubmit:Mn,loading:on,initialToPerp:!1}),i.jsx(exn,{open:dt,onClose:()=>tt(!1),perpsBalance:Number((ct==null?void 0:ct.balance)??0),defaultDest:at||""}),i.jsx(lp,{open:oe,onClose:()=>de(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:wi},children:["Control the leverage used for ",Ir?`${yr}/${Jn}`:t," ","positions. The maximum leverage is ",mt,"x. Max position size decreases the higher your leverage."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:mt,step:1,value:Ie,onChange:wn=>Re(Number(wn.target.value)),className:"flex-1",style:{accentColor:Hg}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",inputMode:"numeric",value:Ie,onChange:wn=>Re(Math.max(1,Math.min(mt,Number(wn.target.value)||1))),style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>ln(()=>de(!1)),children:"Confirm"}),i.jsxs("div",{className:"mt-3 flex items-start gap-2 text-[12px]",style:{color:"#ffd27a"},children:[i.jsx("span",{children:"⚠️"}),i.jsx("span",{children:"Higher leverage increases the risk of liquidation."})]})]})}),i.jsx(lp,{open:jt,onClose:()=>Qn(!1),children:i.jsxs(ym,{title:"Adjust Max Slippage",children:[i.jsx("div",{className:"text-[12px] leading-5 mb-3",style:{color:wi},children:"Max slippage only affects market orders placed from the order form. Closing positions will use max slippage of 8% and market TP/SL orders will use max slippage of 10%."}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2 mb-3",style:{width:120,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right",type:"text",inputMode:"decimal",value:en,onChange:wn=>{const On=wn.target.value.replace(",",".");if(On===""){Pn("");return}/^\d*\.?\d*$/.test(On)&&Pn(On)},style:{color:Bi,fontFeatureSettings:'"tnum"'}}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]}),i.jsx(z0,{onClick:st,children:"Confirm"})]})}),i.jsx(lp,{open:V,onClose:()=>ee(!1),children:i.jsxs(ym,{title:`${Ir?`${yr}/${Jn}`:t} Margin Mode`,children:[i.jsx(IQ,{active:we==="Cross",onClick:()=>xe("Cross"),title:"Cross",desc:"All cross positions share the same cross margin as collateral. In the event of liquidation, your cross margin balance and any remaining open positions under assets in this mode may be forfeited."}),i.jsx(IQ,{active:we==="Isolated",onClick:()=>xe("Isolated"),title:"Isolated",desc:"Manage your risk on individual positions by restricting the amount of margin allocated to each. If the margin ratio of an isolated position reaches 100%, the position will be liquidated. Margin can be added or removed to individual positions in this mode."}),i.jsx("div",{className:"mt-3",children:i.jsx(z0,{onClick:()=>ln(()=>ee(!1)),children:"Confirm"})})]})}),i.jsx(lp,{open:Ce,onClose:()=>me(!1),children:i.jsxs(ym,{title:"Position Mode",children:[i.jsx(IQ,{active:Be==="One-Way",onClick:()=>ht("One-Way"),title:"One-Way",desc:"Open orders in the same direction merge into a single position for each market."}),i.jsx("div",{className:"mt-3",children:i.jsx(z0,{onClick:()=>me(!1),children:"Confirm"})})]})})]})}const Ib=({name:t,minFilterType:e,maxFilterType:n,handleChange:r,minInputName:s,maxInputName:a,isTooltip:o})=>{const l=f=>{f.preventDefault()},c=f=>{f.target.addEventListener("wheel",l,{passive:!1})},u=f=>{f.target.removeEventListener("wheel",l)},d=f=>{["-","+","e"].includes(f.key)&&f.preventDefault()};return i.jsxs("div",{className:`${t=="Account Value"?"mb-20":""} col-span-1 flex flex-col justify-start max-w-full z-3 font-manrope gap-[13px] mx-4`,children:[i.jsxs("p",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px] flex justify-start items-center gap-1",children:[t,o&&i.jsxs("span",{className:"flex justify-start items-center has-tooltip relative",children:[i.jsx(ji,{className:"text-[#c9c9c9] w-4 min-w-4 min-h-4 h-4"}),i.jsx("span",{className:"",children:i.jsx(Ma,{content:"Snapshot data per hour",positionTop:!1,alignRight:!0})})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{value:e,onChange:r,type:"number",name:s,onFocus:c,onBlur:u,autoComplete:"off",onKeyDown:["Unrealized PnL","Funding Paid"].includes(t)?void 0:d,placeholder:"Min",className:`py-0.5 bg-[#1b1b1b] rounded-md border border-[#303030] h-8 block text-white text-sm font-medium font-inter leading-[8px] w-1/2 px-2 ${e!=null&&e!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`}),i.jsx("input",{value:n,onChange:r,type:"number",name:a,autoComplete:"off",onFocus:c,onBlur:u,onKeyDown:["Unrealized PnL","Funding Paid"].includes(t)?void 0:d,placeholder:"Max",className:`bg-[#1b1b1b] rounded-md border border-[#303030] py-0.5 h-8 block sm:text-sm font-semibold font-manrope leading-none w-1/2 px-2 ${n!=null&&n!==""?"border border-[#8d67ff]":""} focus:ring-1 focus:ring-[#8d67ff] focus:outline-none placeholder:text-[#535353] placeholder:text-sm placeholder:font-medium placeholder:font-inter placeholder:leading-[8px]`})]})]})},uxn=({walletFilter:t,setWalletFilter:e,filterTerminal:n,setFilterTerminal:r,resetFilters:s})=>{const a=m.useRef(null),o=c=>{const{name:u,value:d}=c.target;r(f=>({...f,[u]:d}))},l=c=>{var u;c.key==="Escape"&&(e(""),(u=a.current)==null||u.blur())};return i.jsxs("div",{className:"flex flex-col items-center gap-4 w-full h-full p-1 sm:p-2 mt-4 sm:px-0 overflow-y-scroll",children:[i.jsxs("div",{className:"flex flex-col items-center gap-2.5 w-[90%] sm:w-[90%]",children:[i.jsx("div",{className:"text-[#c9c9c9] text-[13px] font-semibold font-manrope leading-[8px] flex justify-start items-center gap-1 w-full pl-1",children:"Search Wallet"}),i.jsxs("div",{className:"flex justify-center items-center gap-0.5 h-max rounded-lg border border-[#333333] w-full overflow-hidden p-0.5",children:[i.jsx("input",{ref:a,type:"text",value:t,name:"walletFilter",onChange:c=>e(c.target.value),onKeyDown:l,className:"bg-[#353535] rounded text-white py-1 pl-2 pr-3 w-full text-sm outline-none placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c] font-manrope",placeholder:"Search Wallet"}),i.jsx("div",{onClick:()=>e(""),className:"text-[#aaa] hover:text-white outline-none focus:outline-none focus:ring-0 border-none w-4 h-[26px] bg-[#353535] hover:bg-[#333333] rounded-l rounded-r-lg flex justify-center items-center cursor-pointer",children:i.jsx("img",{src:Ua,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})]}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_notional,maxFilterType:n==null?void 0:n.max_notional,handleChange:o,minInputName:"min_notional",maxInputName:"max_notional",name:"Notional",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_size,maxFilterType:n==null?void 0:n.max_size,handleChange:o,minInputName:"min_size",maxInputName:"max_size",name:"Size",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_entry,maxFilterType:n==null?void 0:n.max_entry,handleChange:o,minInputName:"min_entry",maxInputName:"max_entry",name:"Entry",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_liq_price,maxFilterType:n==null?void 0:n.max_liq_price,handleChange:o,minInputName:"min_liq_price",maxInputName:"max_liq_price",name:"Liq. Price",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_unrealized_pnL,maxFilterType:n==null?void 0:n.max_unrealized_pnL,handleChange:o,minInputName:"min_unrealized_pnL",maxInputName:"max_unrealized_pnL",name:"Unrealized PnL",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_funding_paid,maxFilterType:n==null?void 0:n.max_funding_paid,handleChange:o,minInputName:"min_funding_paid",maxInputName:"max_funding_paid",name:"Funding Paid",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_account_value,maxFilterType:n==null?void 0:n.max_account_value,handleChange:o,minInputName:"min_account_value",maxInputName:"max_account_value",name:"Margin",isTooltip:!1}),i.jsx(Ib,{minFilterType:n==null?void 0:n.min_perp_equity,maxFilterType:n==null?void 0:n.max_perp_equity,handleChange:o,minInputName:"min_perp_equity",maxInputName:"max_perp_equity",name:"Account Value",isTooltip:!1})]})},wqe=m.createContext({key:"All",setKey:()=>{}});function dxn({children:t}){const e=typeof window<"u"&&localStorage.getItem("terminal_side_filter")||"All",[n,r]=m.useState(e);m.useEffect(()=>{typeof window<"u"&&localStorage.setItem("terminal_side_filter",n)},[n]);const s=m.useMemo(()=>({key:n,setKey:r}),[n]);return i.jsx(wqe.Provider,{value:s,children:t})}function B2(){return m.useContext(wqe)}function fxn({className:t=""}){const{key:e,setKey:n}=B2(),r=["All","Active","Long","Short"];return i.jsxs("label",{className:`inline-flex items-center gap-2 ${t}`,children:[i.jsx("span",{className:"text-[#9B9B9B] text-[12px]",children:"Filter"}),i.jsx("select",{value:e,onChange:s=>n(s.target.value),className:"h-7 bg-[#262626] text-white text-[12px] rounded-md px-2 border border-[#2F2F2F] outline-none",children:r.map(s=>i.jsx("option",{value:s,children:s},s))})]})}function hxn(t){var a;const e=((t==null?void 0:t.direction)||(t==null?void 0:t.posSide)||(t==null?void 0:t.position_side)||"").toString().toLowerCase();if(e==="long")return"Long";if(e==="short")return"Short";const n=((t==null?void 0:t.dir)||(t==null?void 0:t.sideText)||"").toString().toLowerCase();if(n.includes("open long")||n.includes("close short")||n.includes("short > long")||n.endsWith(" long"))return"Long";if(n.includes("open short")||n.includes("close long")||n.includes("long > short")||n.endsWith(" short"))return"Short";const r=((t==null?void 0:t.side)||"").toString();if(r==="B"||r==="Buy")return"Long";if(r==="A"||r==="Sell")return"Short";if((t==null?void 0:t.isBuy)===!0||(t==null?void 0:t.b)===!0)return"Long";if((t==null?void 0:t.isBuy)===!1||(t==null?void 0:t.b)===!1)return"Short";const s=Number((t==null?void 0:t.szi)??(t==null?void 0:t.size)??((a=t==null?void 0:t.position)==null?void 0:a.szi)??0);return s>0?"Long":s<0?"Short":(t==null?void 0:t.side)==="Long"||(t==null?void 0:t.type)==="Long"?"Long":(t==null?void 0:t.side)==="Short"||(t==null?void 0:t.type)==="Short"?"Short":null}function pxn(t,e){var n;if(e==="positions"){const r=Number((t==null?void 0:t.szi)??(t==null?void 0:t.size)??((n=t==null?void 0:t.position)==null?void 0:n.szi)??0);return Math.abs(r)>0}return!0}function u1(t,e="generic",n="All"){if(!Array.isArray(t)||t.length===0)return t||[];if(n==="All")return t;if(n==="Active")return t.filter(s=>pxn(s,e));const r=n;return t.filter(s=>{const a=hxn(s);return a?a===r:!1})}const mxn=({data:t,loading:e,error:n,isDigits:r,period:s,periods:a,handlePeriodChange:o})=>{const[l,c]=m.useState("All"),[u,d]=m.useState(!1),{key:f}=B2(),{copyTradeWatchList:x,trackedWatchList:g,setSignModalOpen:y}=m.useContext(Qr),{address:v}=ns(),[C,N]=m.useState(!1),[P,T]=m.useState(null),[M,F]=m.useState(null),[$,L]=m.useState(""),[z,X]=m.useState(""),[ne,J]=m.useState({min_notional:"",max_notional:"",min_size:"",max_size:"",min_entry:"",max_entry:"",min_mark_price:"",max_mark_price:"",min_liq_price:"",max_liq_price:"",min_unrealized_pnL:"",max_unrealized_pnL:"",min_funding_paid:"",max_funding_paid:"",min_account_value:"",max_account_value:"",min_perp_equity:"",max_perp_equity:""}),K=()=>{c("All"),X(""),J({min_notional:"",max_notional:"",min_size:"",max_size:"",min_entry:"",max_entry:"",min_mark_price:"",max_mark_price:"",min_liq_price:"",max_liq_price:"",min_unrealized_pnL:"",max_unrealized_pnL:"",min_funding_paid:"",max_funding_paid:"",min_account_value:"",max_account_value:"",min_perp_equity:"",max_perp_equity:""})},fe=((W,V)=>V.reduce((ee,oe)=>{const de=W[oe];return de!==void 0&&de!==""&&de!==null&&ee++,ee},0))({...ne,walletFilter:z},[...Object.keys(ne),"walletFilter"]),q=m.useMemo(()=>u1(t,"positions",f),[t,f]),se=async({walletAddress:W,isFollow:V,isScalper:ee})=>{try{L(W);const oe=window.localStorage.getItem("hyperToken"),de=window.localStorage.getItem("hyperAddress");if(!oe){y(!0);return}const Ce=V?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",me=V?{address:v?v.toLowerCase():de,token:oe,follow_address:W.toLowerCase()}:{address:v?v.toLowerCase():de,token:oe},we=await fetch(Ce,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(me)});if(!we.ok)throw new Vl(`Server responded with status ${we.status}`);const xe=await we.json();xe.success?(T(Array.isArray(xe==null?void 0:xe.data)?[...xe.data].sort((be,je)=>new Date(je.created_at||0)-new Date(be.created_at||0)):xe==null?void 0:xe.data),F(ee),N(!0)):tn.error(xe.error_message)}catch(oe){tn.error(oe.message||"Something went wrong!")}},ae=[{key:"action",label:"Action",sortable:!1,width:"125px",render:(W,V)=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{onClick:ee=>{ee.preventDefault();const oe=x==null?void 0:x.some(de=>de.wallet_address===(V==null?void 0:V.address));se({walletAddress:V==null?void 0:V.address,isFollow:oe,isScalper:V==null?void 0:V.is_scalper})},className:`${x.some(ee=>ee.wallet_address===(V==null?void 0:V.address))?"bg-[#67ffbd] text-[#161616] font-semibold":"border border-[#67ffbd] bg-[#161616] text-[#67ffbd] hover:bg-[#67ffbd] hover:text-[#161616] font-bold"} h-[22px] rounded-[256px] inline-flex items-center px-2 text-[12px] leading-[8px] tracking-tight cursor-pointer`,children:"Copy Trade"}),i.jsx(B5,{walletAddress:V==null?void 0:V.address,children:i.jsx("div",{className:"w-[18px] h-[18px] flex items-center justify-center cursor-pointer",children:g.some(ee=>ee.wallet_address===(V==null?void 0:V.address))?i.jsx("img",{src:N5,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"}):i.jsx("img",{src:UA,alt:"",className:"w-3.5 h-3.5 min-w-3.5 min-h-3.5"})})})]})},{key:"address",label:"Wallet",sortable:!0,sortValue:W=>(W.address||"").toLowerCase(),render:(W,V)=>i.jsx("div",{onClick:()=>window.open(`/wallet-details/${V==null?void 0:V.address}`,"_blank"),className:"flex items-center gap-2.5 cursor-pointer",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(ag,{info:V!=null&&V.address?`${V.address.slice(0,5)}...${V.address.slice(-4)}`:"--",textColor:"text-white"}),i.jsx("img",{onClick:ee=>{ee.stopPropagation(),navigator.clipboard.writeText((V==null?void 0:V.address)||""),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},src:Eo,alt:"",className:"cursor-pointer"})]})})},{key:"direction",label:"Direction",sortable:!0,sortValue:W=>W.direction==="long"?1:W.direction==="short"?0:-1,render:(W,V)=>i.jsx("div",{className:"flex items-center gap-2 h-8",children:i.jsxs("div",{className:`${V.direction==="long"?"text-[#67ffbd] bg-[#67ffbd]/20":V.direction==="short"?"text-[#ff787b] bg-[#ff797c]/20":"text-[#67ffbd] bg-[#67ffbd]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5`,children:[i.jsx("div",{className:"w-3 h-3 flex items-center justify-center",children:V.direction==="long"?i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"}):V.direction==="short"?i.jsx(Os,{className:"text-[#FF797C] w-3 h-3"}):i.jsx(Os,{className:"text-[#67FFBD] rotate-180 w-3 h-3"})}),i.jsxs("div",{className:"text-[11px] font-semibold leading-[8px] tracking-wide uppercase",children:[V.direction," - ",V.leverage_value,"x"]})]})})},{key:"notional",label:"Notional",sortable:!0,sortValue:W=>Number(W.notional)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.notional)==null||isNaN(parseFloat(V==null?void 0:V.notional))?"--":`$${ad(V==null?void 0:V.notional)}`,textColor:"text-white"})},{key:"szi",label:"Size",sortable:!0,sortValue:W=>Number(W.szi)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.szi)==null||isNaN(parseFloat(V==null?void 0:V.szi))?"--":`${_r(V==null?void 0:V.szi)}`,textColor:"text-white"})},{key:"entry_price",label:"Entry Price",sortable:!0,sortValue:W=>Number(W.entry_price)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.entry_price)==null||isNaN(parseFloat(V==null?void 0:V.entry_price))?"--":`$${u3(parseFloat(V==null?void 0:V.entry_price).toFixed((V==null?void 0:V.entry_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:W=>Number(W.liq_price)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.liq_price)==null||isNaN(parseFloat(V==null?void 0:V.liq_price))?"--":`$${u3(parseFloat(V==null?void 0:V.liq_price).toFixed((V==null?void 0:V.liq_price)>=1e4?0:r))}`,textColor:"text-white"})},{key:"unrealized_pnl",label:"Unrealized PnL",sortable:!0,sortValue:W=>Number(W.unrealized_pnl)||0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.unrealized_pnl)==null||isNaN(parseFloat(V==null?void 0:V.unrealized_pnl))?"--":`$${_r(Math.abs(V==null?void 0:V.unrealized_pnl))}`,textColor:`${(V==null?void 0:V.unrealized_pnl)==null||isNaN(parseFloat(V==null?void 0:V.unrealized_pnl))||(V==null?void 0:V.unrealized_pnl)===0?"text-white":(V==null?void 0:V.unrealized_pnl)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"funding_paid",label:"Funding Paid",sortable:!0,sortValue:W=>Number(W.funding_paid)||0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.funding_paid)==null||isNaN(parseFloat(V==null?void 0:V.funding_paid))?"--":`$${_r(Math.abs(V==null?void 0:V.funding_paid))}`,textColor:`${(V==null?void 0:V.funding_paid)==null||isNaN(parseFloat(V==null?void 0:V.funding_paid))||(V==null?void 0:V.funding_paid)===0?"text-white":(V==null?void 0:V.funding_paid)>0?"text-[#1DE6A3]":"text-[#FF7173]"}`})},{key:"account_value",label:"Margin",sortable:!0,sortValue:W=>Number(W.account_value)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.account_value)==null||isNaN(parseFloat(V==null?void 0:V.account_value))?"--":`$${ad(V==null?void 0:V.account_value)}`,textColor:"text-white"})},{key:"perp_equity",label:"Account Value",sortable:!0,sortValue:W=>Number(W.perp_equity)||-1/0,render:(W,V)=>i.jsx(ag,{info:(V==null?void 0:V.perp_equity)==null||isNaN(parseFloat(V==null?void 0:V.perp_equity))?"--":`$${ad(V==null?void 0:V.perp_equity)}`,textColor:"text-white"})}];return i.jsxs(i.Fragment,{children:[i.jsx($5,{open:C,setOpen:N,copyTradeData:P,copyTradeWallet:$,setCopyTradeWallet:L,isScalper:M,setCopyTradeData:T}),i.jsxs("div",{className:"flex flex-col w-full h-full mt-4",children:[i.jsx("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-2 md:gap-0 pl-3 pr-5",children:i.jsxs("div",{className:"flex flex-row justify-start items-center gap-2 sm:gap-4 md:gap-2 lg:gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex justify-start items-center gap-2 sm:gap-4 md:gap-2 lg:gap-4",children:[i.jsxs("button",{onClick:()=>d(!u),className:`${fe>0?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none border-none relative`,children:[i.jsx(Xf,{className:`w-4 h-4 ${fe>0?"text-blue-500":"text-white"}`}),fe>0&&i.jsx("div",{className:"absolute -top-2 -right-2 rounded-full w-4 h-4 text-[11px] bg-[#8D67FF] text-white flex justify-center items-center",children:fe})]}),fe>0&&i.jsx(xxn,{title:"Reset Filter",set_click:()=>K(),tableSortButton:"Reset"})]}),i.jsx("div",{className:"flex",children:i.jsx(ade,{periods:a,selectedPeriod:s,handlePeriod:o,borderColor:"ticker"})}),e&&i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]})]})}),i.jsxs("div",{className:"flex flex-col sm:flex-row w-full h-full",children:[i.jsxs("div",{className:`${u?"":"hidden"} w-[95%] sm:w-72 sm:min-w-72 h-[calc(100%-70px)] bg-[#232323] border border-[#292929] rounded-2xl m-2 overflow-hidden`,children:[i.jsxs("div",{className:"w-full sticky top-0 bg-[#232323] flex justify-between items-center pt-[2px] pl-3 pr-1 mt-3",children:[i.jsx("div",{className:"text-white text-base font-semibold font-inter leading-[8px]",children:"Filters"}),i.jsx("div",{onClick:()=>K(),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md inline-flex items-center mr-3 cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-inter leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx(uxn,{walletFilter:z,setWalletFilter:X,filterTerminal:ne,setFilterTerminal:J,resetFilters:K})]}),i.jsx("div",{className:"w-full h-[calc(100%-60px)] relative flex-grow",children:e?i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-10",children:i.jsx($a,{})}):n&&!t?i.jsx("div",{className:"flex min-h-[26vh] sm:min-h-[66vh] flex-col justify-center items-center",children:i.jsx(Vl,{})}):(q==null?void 0:q.length)===0?i.jsx("div",{className:"flex w-full justify-center items-center",children:i.jsx("div",{className:"flex min-h-[36vh] w-[100%] sm:w-[75%] max-w-[300px] sm:max-w-[700px] justify-center items-center text-center",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3",children:[i.jsx("img",{src:cc,alt:""}),i.jsxs("div",{className:"flex flex-col items-center h-max gap-3",children:[i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-inter leading-[8px] pt-3",children:"No data matched the selected filter range."}),i.jsx("div",{className:"text-center -mt-2",children:i.jsx("span",{className:"text-[#979797] text-[13px] font-normal font-inter leading-[14px] tracking-wide",children:"Please adjust your filters and try again."})})]})]})})}):i.jsx(zu,{data:q,columns:ae,rowHeight:30,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal"})})]})]})]})},ag=({info:t,textColor:e})=>i.jsx("div",{className:"flex flex-col items-end gap-0.5",children:i.jsx("div",{className:`${e} text-[12px] font-semibold font-inter leading-none flex items-center justify-start px-1 gap-0.5`,children:t})}),xxn=({title:t,set_click:e,tableSortButton:n})=>i.jsx("div",{onClick:e,className:`${n==t?"bg-[#3d3d3d] text-white":n=="Reset"?"bg-[#3d3d3d] text-white hover:bg-[#4d4d4d]":"bg-[#161616] text-[#9b9b9b]"} text-[12px] font-medium font-inter leading-[8px] cursor-pointer flex justify-center items-center min-w-max rounded-md px-[6px] sm:px-[10px] h-7`,children:t});function Qv(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function tAe(t){return new Promise(e=>setTimeout(e,t))}function nAe(t){if(!t)return"";const e=String(t);return e.slice(0,6)+"..."+e.slice(-4)}function gxn({open:t,onClose:e,children:n,title:r}){return t?i.jsxs("div",{className:"fixed inset-0 z-[999] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[1px]",onClick:e}),i.jsxs("div",{className:"relative w-[560px] max-w-[92vw] rounded-2xl border border-[#2A2A2A] bg-[#161616] shadow-2xl",children:[i.jsxs("div",{className:"px-5 pt-4 pb-2 flex items-center justify-between",children:[i.jsx("div",{className:"font-inter text-[18px] leading-6 text-white",children:r}),i.jsx("button",{onClick:e,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-[#222] text-[#BDBDBD]",children:"✕"})]}),i.jsx("div",{className:"px-5 pb-5",children:n})]})]}):null}function HF({children:t}){return i.jsx("div",{className:"text-[12px] text-[#9B9B9B] font-inter mb-1",children:t})}function rAe({value:t,onChange:e,placeholder:n,invalid:r=!1}){return i.jsx("input",{value:t,onChange:s=>e(s.target.value),placeholder:n,className:`w-full h-10 px-3 rounded-lg bg-[#101010] outline-none text:white ${r?"border border-[#FF7173]":"border border-[#2A2A2A]"}`})}function sAe({value:t,onChange:e,options:n,disabled:r=!1}){return i.jsx("select",{disabled:r,value:t,onChange:s=>e(s.target.value),className:`w-full h-10 px-3 rounded-lg bg-[#101010] border text-white outline-none ${r?"border-[#2A2A2A] opacity-60 cursor-not-allowed":"border-[#2A2A2A]"}`,children:n.map(s=>i.jsx("option",{value:s.value,className:"bg-[#101010]",children:s.label},s.value))})}function bxn({children:t}){return i.jsx("div",{className:"grid grid-cols-2 gap-4",children:t})}function yxn({onMax:t}){return i.jsx("button",{onClick:t,className:"px-2 h-8 rounded-md bg-[#1F2A23] text-[#67FFBD] text-[12px] font-medium ml-2",children:"MAX"})}function vxn({children:t,onClick:e,disabled:n,loading:r}){return i.jsx("button",{onClick:e,disabled:n||r,className:`${n||r?"bg-[#2C2C2C] text-[#8A8A8A] cursor-not-allowed":"bg[rgba(103,255,189,0.16)] text-[#67FFBD] hover:opacity-95"} w-full h-9 rounded-xl mt-5 font-medium`,children:r?"Processing...":t})}function wxn(){const t=typeof window<"u"?window.ethereum:null;if(!t)return null;if(Array.isArray(t.providers)&&t.providers.length){const e=t.providers.find(r=>r&&r.isMetaMask);if(e)return e;const n=t.providers.find(r=>r&&r.isCoinbaseWallet);return n||t.providers[0]}return t}async function Cxn(t,e){let n=await t.request({method:"eth_chainId"});if((n==null?void 0:n.toLowerCase())!==e.toLowerCase())try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch(r){if(r&&r.code===4902)await t.request({method:"wallet_addEthereumChain",params:[{chainId:e,chainName:"Arbitrum One",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:["https://arb1.arbitrum.io/rpc"],blockExplorerUrls:["https://arbiscan.io/"]}]});else throw r}}const Sxn=t=>typeof t=="string"&&/^0x[0-9a-fA-F]{40}$/.test(t.trim());function Nxn({open:t,onClose:e,perpsAvailable:n,spotBalances:r,onSubmit:s,loading:a}){const o=[{value:"USDC",label:"USDC"},...r.filter($=>$.coin!=="USDC").map($=>({value:$.coin,label:$.coin}))],[l,c]=m.useState(""),[u,d]=m.useState("perps"),[f,x]=m.useState("USDC"),[g,y]=m.useState("");m.useEffect(()=>{u==="perps"&&x("USDC")},[u]);const v=u==="perps"?Number(n||0):r.find(L=>L.coin===f)?Math.max(0,Number(b.total||0)-Number(b.hold||0)):0,C=()=>y(String(v)),N=()=>s({kind:"send",from:u,token:f,destination:l,amount:g,available:v}),P=Sxn(l),T=Number(g)>0&&Number(g)<=Number(v||0),M=!P||!T,F=l.length>0&&!P;return i.jsx(gxn,{open:t,onClose:e,title:"Send Tokens",children:i.jsxs("div",{className:"space-y-4 text-xs",children:[i.jsxs("div",{children:[i.jsx(HF,{children:"Destination"}),i.jsx(rAe,{value:l,onChange:c,placeholder:"Enter Hyperliquid account address (0x…)",invalid:F})]}),i.jsxs(bxn,{children:[i.jsxs("div",{children:[i.jsx(HF,{children:"From Account"}),i.jsx(sAe,{value:u,onChange:$=>d($),options:[{value:"perps",label:"Perps Account"},{value:"spot",label:"Spot Account"}]})]}),i.jsxs("div",{children:[i.jsx(HF,{children:"Token"}),i.jsx(sAe,{value:f,onChange:x,options:o,disabled:u==="perps"})]})]}),i.jsxs("div",{children:[i.jsx(HF,{children:"Amount"}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(rAe,{value:g,onChange:y,placeholder:"0.0"}),i.jsx(yxn,{onMax:C})]}),i.jsxs("div",{className:"mt-1 text-[12px] text-[#9B9B9B]",children:["Available: ",Qv(v,6)," ",f]})]}),i.jsx(vxn,{onClick:N,disabled:M,loading:a,children:"Send"})]})})}const Axn={name:"Exchange",version:"1",chainId:1337,verifyingContract:"0x0000000000000000000000000000000000000000"},jxn={Agent:[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}]};function Exn(t){if(typeof t!="string"||!t.includes("."))return String(t);const e=t.replace(/\.?0+$/,"");return e==="-0"?"0":e}function _se(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(_se);const e={...t};for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];r&&typeof r=="object"?e[n]=_se(r):(n==="p"||n==="s")&&typeof r=="string"&&(e[n]=Exn(r))}return e}function _xn(t,e,n){const r=_se(t),s=bqe(r),a=e==null?9:29,o=new Uint8Array(s.length+a);o.set(s);const l=new DataView(o.buffer);return l.setBigUint64(s.length,BigInt(n),!1),e==null?l.setUint8(s.length+8,0):(l.setUint8(s.length+8,1),o.set(ms(e),s.length+9)),ho(o)}function kxn(t,e){return{source:e?"a":"b",connectionId:t}}function Txn(t){const e=t.startsWith("0x")?t.slice(2):t,n="0x"+e.slice(0,64),r="0x"+e.slice(64,128);let s=parseInt(e.slice(128,130),16);return s<27&&(s+=27),{r:n,s:r,v:s}}async function Pxn(t,e){const n=wxn();if(!n)throw new Error("No injected provider");return await Cxn(n,"0xa4b1"),await n.request({method:"eth_signTypedData_v4",params:[t,JSON.stringify(e)]})}function Ixn({addr:t,isMainnet:e=!0,vaultAddress:n=null}){return{sign:async(r,s)=>{const a=_xn(r,n,s),o={domain:Axn,types:jxn,primaryType:"Agent",message:kxn(a,e)},l=await Pxn(t,o);return Txn(l)}}}const iAe=t=>t?`${t.slice(0,6)}...${t.slice(-4)}`:"-";function Fxn({walletAddress:t,listHeight:e=560}){const{address:n}=ns(),{latestPnL:r}=m.useContext(Qr),[s,a]=m.useState(()=>typeof window>"u"?t||null:window.localStorage.getItem("hl_selected_wallet_address")||null||t||null);m.useEffect(()=>{const se=()=>{if(typeof window>"u")return;const ae=window.localStorage.getItem("hl_selected_wallet_address")||null;a(ae||t||null)};return se(),window.addEventListener("hl_selected_wallet_changed",se),window.addEventListener("storage",se),()=>{window.removeEventListener("hl_selected_wallet_changed",se),window.removeEventListener("storage",se)}},[t]);const o=sP(s?s.toLowerCase():null),{perps:l={},spotBalances:c=[],tokenIdMap:u={},tokenMetaMap:d={},priceMap:f={},initialLoaded:x=!1}=o,[g,y]=m.useState({send:!1,transfer:!1,transferInitToPerp:!1}),[v,C]=m.useState(!1),N=m.useMemo(()=>{const se=typeof window<"u"?localStorage.getItem("hl_pk"):null,ae=se?K0n(se).toLowerCase():null,W=n?n.toLowerCase():null,V=s?s.toLowerCase():null,ee=se&&ae&&V&&ae===V;return{mode:ee?"local":!ee&&W?"metamask":"none",localAddr:ae,mmAddr:W,targetAddr:V}},[n,s]);m.useEffect(()=>{const se=ae=>{var V;const W=!!((V=ae==null?void 0:ae.detail)!=null&&V.toPerp);y(ee=>({...ee,transfer:!0,transferInitToPerp:W}))};return window.addEventListener("balances:open-transfer",se),()=>window.removeEventListener("balances:open-transfer",se)},[]);const P=m.useMemo(()=>{try{if(!s)return null;if(N.mode==="local"){const se=aP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return yA({address:s,signer:se,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null})}if(N.mode==="metamask"&&N.mmAddr){const se=Ixn({addr:N.mmAddr,isMainnet:!0,vaultAddress:null});return yA({address:s,signer:se,isMainnet:!0,signatureChainIdHex:"0xa4b1",getPK:()=>null})}return null}catch{return null}},[s,N]);m.useEffect(()=>{const se=()=>{(async()=>{try{await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:s})}).then(ae=>ae.json()),window.dispatchEvent(new CustomEvent("noop"))}catch{}})()};return window.addEventListener("balances:refresh",se),()=>window.removeEventListener("balances:refresh",se)},[s]);const T=m.useMemo(()=>c||[],[c]),M=m.useMemo(()=>{const se=T.find(ae=>ae.coin==="USDC");return se?Math.max(0,Number(se.total||0)-Number(se.hold||0)):0},[T]),F=()=>{const se=N.mode==="local"?N.localAddr:N.mode==="metamask"?N.mmAddr:null;return se?N.targetAddr?se!==N.targetAddr?(tn.error(`Connected wallet ${nAe(se)} does not match selected account ${nAe(N.targetAddr)}. Switch wallet or change the selected account.`,{id:"addr-mismatch",duration:6e3}),!1):!0:(tn.error("Target account is missing.",{id:"target-missing"}),!1):(tn.error("Wallet not connected or signer unavailable.",{id:"signer-missing"}),!1)},$=()=>{tn.error("No deposit found for this account. Please deposit USDC (Arbitrum) to Hyperliquid before performing this action.",{id:"err-deposit"})},L=async({from:se,token:ae,destination:W,amount:V,available:ee})=>{var oe;try{if(C(!0),!P)throw new Error("SDK not ready");if(!F())return;const de=(W||"").trim().toLowerCase();if(!de||!de.startsWith("0x")||de.length!==42)throw new Error("Destination address is invalid");if(!Number(V))throw new Error("Amount is invalid");if(Number(V)>Number(ee||0))throw new Error("Amount exceeds available balance");let Ce;if(se==="perps")Ce=await P.transfers.usdTransfer(de,V);else{const me=u[ae];if(!me)throw new Error(`TokenId not found for ${ae}`);const we=`${ae}:${me}`;Ce=await P.transfers.spotTransfer(de,we,String(V))}if((Ce==null?void 0:Ce.status)==="ok")tn.success("Send successful.",{id:"send-success"}),await tAe(600),(oe=window==null?void 0:window.dispatchEvent)==null||oe.call(window,new Event("balances:refresh"));else{const me=typeof(Ce==null?void 0:Ce.response)=="string"?Ce.response:JSON.stringify(Ce);me&&me.toLowerCase().includes("must deposit")?$():tn.error(`Send failed: ${me||"Unknown error"}`,{id:"send-error"})}}catch(de){const Ce=(de==null?void 0:de.message)||"Send failed";Ce.toLowerCase().includes("must deposit")?$():tn.error(Ce,{id:"send-error"})}finally{C(!1),y(de=>({...de,send:!1}))}},z=async({toPerp:se,amount:ae,available:W})=>{var V;try{if(C(!0),!P)throw new Error("SDK not ready");if(!F())return;if(!Number(ae))throw new Error("Amount is invalid");if(Number(ae)>Number(W||0))throw new Error("Amount exceeds available balance");const ee=await P.transfers.usdClassTransfer(String(ae),!!se);if((ee==null?void 0:ee.status)==="ok")tn.success("Transfer successful.",{id:"transfer-success"}),await tAe(600),(V=window==null?void 0:window.dispatchEvent)==null||V.call(window,new Event("balances:refresh"));else{const oe=typeof(ee==null?void 0:ee.response)=="string"?ee.response:JSON.stringify(ee);oe&&oe.toLowerCase().includes("must deposit")?$():tn.error(`Transfer failed: ${oe||"Unknown error"}`,{id:"transfer-error"})}}catch(ee){const oe=(ee==null?void 0:ee.message)||"Transfer failed";oe.toLowerCase().includes("must deposit")?$():tn.error(oe,{id:"transfer-error"})}finally{C(!1),y(ee=>({...ee,transfer:!1}))}},X=1,[ne,J]=m.useState(()=>typeof window>"u"?!1:localStorage.getItem("hide_small_balances")==="1");m.useEffect(()=>{const se=ae=>{var W;typeof((W=ae==null?void 0:ae.detail)==null?void 0:W.value)=="boolean"?J(ae.detail.value):J(typeof window<"u"&&localStorage.getItem("hide_small_balances")==="1")};return window.addEventListener("balances:hide-small-changed",se),()=>window.removeEventListener("balances:hide-small-changed",se)},[]);const K=m.useMemo(()=>se=>{if(Number.isFinite(Number(se.usdcValue)))return Number(se.usdcValue);const ae=f[se.coin],W=Number(se.totalDisplay??0);return Number.isFinite(ae)&&Number.isFinite(W)?ae*W:null},[f]),te=m.useMemo(()=>{const se=[],ae=Number((l==null?void 0:l.accountValue)??0),W=Number((l==null?void 0:l.totalMarginUsed)??0),V=Math.max(0,ae-W);return se.push({id:"USDC_PERPS",kind:"perps",coin:"USDC",unit:"USDC",usdcValue:ae,totalDisplay:ae,availableDisplay:V,totalSort:ae,availableSort:V}),T.forEach(ee=>{const oe=String(ee.coin),de=Number(ee.total||0),Ce=Number(ee.hold||0),me=Math.max(0,de-Ce);let we=null;oe==="USDC"&&(we=de);const xe=f[oe];we==null&&Number.isFinite(xe)&&(we=xe*de),se.push({id:`SPOT_${oe}`,kind:"spot",coin:oe,unit:oe,usdcValue:we,totalDisplay:de,availableDisplay:me,totalSort:de,availableSort:me})}),se},[l,T,f]),fe=m.useMemo(()=>ne?te.filter(se=>{if(se.kind==="perps")return!0;const ae=K(se);return ae!=null?ae>=X:Number(se.totalDisplay??0)>=1e-6}):te,[te,ne,K]),q=m.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:se=>se.coin,render:(se,ae)=>i.jsxs("span",{className:"text-white",children:[ae.coin," ",ae.kind==="perps"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Perps)"}):ae.coin==="USDC"&&ae.kind==="spot"?i.jsx("span",{className:"text-[#9B9B9B]",children:"(Spot)"}):null]})},{key:"total",label:"Total Balance",sortable:!0,sortValue:se=>se.totalSort,render:(se,ae)=>i.jsxs("span",{className:"text-white",children:[Qv(ae.totalDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ae.unit})]})},{key:"available",label:"Available Balance",sortable:!0,sortValue:se=>se.availableSort,render:(se,ae)=>{const W=ae.kind==="perps"&&ae.coin==="USDC",V=Number((l==null?void 0:l.withdrawable)||0),ee=W?`Available balance to open positions ignoring open orders. ${Qv(V,2)} USDC is availableto withdraw.`:void 0;return i.jsxs("span",{className:"text-white underline-offset-2",title:ee,children:[Qv(ae.availableDisplay)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ae.unit})]})}},{key:"usdcValue",label:"USDC Value",sortable:!0,sortValue:se=>{const ae=K(se);return ae??-1},render:(se,ae)=>{const W=K(ae);return i.jsxs("span",{className:"text-white",children:[W!=null?Qv(W):"-"," ",W!=null?i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"}):null]})}},{key:"pnlRoe",label:"PnL (ROE %)",sortable:!1,render:(se,ae)=>{if(ae.kind!=="perps")return i.jsx("span",{className:"text-white",children:"-"});const W=r==null?void 0:r.all,V=Number((l==null?void 0:l.accountValue)||0),ee=V>0&&typeof W=="number"?W/V*100:null,oe=typeof W!="number"?"text-white":W>0?"text-[#67FFBD]":W<0?"text-[#FF7173]":"text-white";return i.jsxs("span",{className:oe,children:[typeof W!="number"?"-":`$${Qv(Math.abs(W),2)}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:ee==null?"":`(${Qv(Math.abs(ee),2)}%)`})]})}},{key:"send",label:"Send",sortable:!1,render:(se,ae)=>ae.kind==="perps"||ae.coin==="USDC"?i.jsxs("button",{onClick:()=>y(W=>({...W,send:!0})),className:"p-0 inline-flex items-center gap-1 h-5 text-white bg-transparent hover:opacity-90 -ml-1",title:"Send",children:[i.jsx(PSt,{}),i.jsx("span",{children:"Send"})]}):null},{key:"transfer",label:"Transfer",sortable:!1,render:(se,ae)=>ae.coin==="USDC"?i.jsxs("button",{onClick:()=>y(W=>({...W,transfer:!0,transferInitToPerp:ae.kind==="spot"})),className:"p-0 inline-flex items-center gap-1 h-5 text-white bg-transparent hover:opacity-90 -ml-1",title:ae.kind==="perps"?"Transfer to Spot":"Transfer to Perpetual",children:[i.jsx(ale,{}),i.jsx("span",{children:ae.kind==="perps"?"Transfer to Spot":"Transfer to Perps"})]}):null},{key:"contract",label:"Contract",sortable:!1,render:(se,ae)=>{const W=d[ae.coin],V=(W==null?void 0:W.tokenId)||null,ee=(W==null?void 0:W.evmContract)||null;if(V){const oe=`https://app.hyperliquid.xyz/explorer/token/${V}`;return i.jsx("a",{href:oe,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent hover:text-white/80 -ml-2",children:iAe(V)})}if(ee){const oe=`https://arbiscan.io/token/${ee}`;return i.jsx("a",{href:oe,target:"_blank",rel:"noreferrer",className:"text-white bg-transparent -ml-2",children:iAe(ee)})}return i.jsx("span",{className:"text-[#9B9B9B] -ml-2",children:"-"})}}],[r==null?void 0:r.all,l,K,d]);return x?i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:fe,columns:q,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-semibold",rowKey:se=>se.id}),i.jsx(Nxn,{open:g.send,onClose:()=>y(se=>({...se,send:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotBalances:T,onSubmit:L,loading:v}),i.jsx(yqe,{open:g.transfer,onClose:()=>y(se=>({...se,transfer:!1})),perpsAvailable:l==null?void 0:l.withdrawable,spotUsdcAvailable:M,onSubmit:z,loading:v,initialToPerp:!!g.transferInitToPerp})]}):i.jsx("div",{className:"mt-2 flex pt-12 justify-center text-[12px] text-[#9B9B9B]",style:{height:e},children:"Loading..."})}const Oxn={position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12,border:"1px solid #2A2A2A"}},Mxn="dextra-global-toast";function UQ(t,e){return tn.promise(t,e,{id:Mxn,...Oxn})}async function zQ(t){const e=aP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return yA({address:t,signer:e,dex:""})}function vo(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function Rxn(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}function efe({open:t,onClose:e,title:n,width:r=720,children:s}){return t?Aa.createPortal(i.jsxs("div",{className:"fixed inset-0 z-[99999] font-inter",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:e}),i.jsxs("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 max-w[95vw] rounded-2xl border border-[#2A2A2A] bg-[#161616] shadow-2xl",style:{width:r},children:[i.jsxs("div",{className:"px-5 pt-4 pb-2 flex items-center justify-between",children:[i.jsx("div",{className:"text-white text-[16px]",children:n}),i.jsx("button",{onClick:e,className:"flex justify-center items-center w-8 h-8 rounded-lg bg-[#222] text-[#BDBDBD]",title:"Close",children:"✕"})]}),i.jsx("div",{className:"px-5 pb-5",children:s})]})]}),document.body):null}const Vg=({children:t})=>i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mb-1",children:t}),kse=({value:t,onChange:e,placeholder:n})=>i.jsx("input",{value:t,onChange:r=>e(r.target.value),placeholder:n,className:"w-full h-9 px-3 rounded-lg bg-[#101010] border border-[#2A2A2A] text-white outline-none font-inter text-[11px]"}),HQ=({children:t,right:e})=>i.jsxs("div",{className:"h-9 rounded-lg bg-[#0E0E0E] border border-[#2A2A2A] px-3 flex items-center justify-between text-[#CFCFCF]",children:[i.jsx("span",{className:"text-[11px]",children:t}),e?i.jsx("span",{className:"text-[#9B9B9B] text-[11px]",children:e}):null]}),Cqe=({children:t,onClick:e,disabled:n,loading:r})=>i.jsxs("button",{onClick:e,disabled:n||r,className:`w-full h-8 rounded-xl !mt-10 font-medium font-inter text-[12px] flex items-center justify-center gap-2 ${n||r?"bg-[#2C2C2C] text-[#8A8A8A] cursor-not-allowed":"bg-[#67FFBD] text-[#101010] hover:opacity-95"}`,children:[r?i.jsx(f2,{size:14,color:"#FFF"}):null,i.jsx("span",{children:t})]});function Lxn({open:t,onClose:e,row:n,onConfirm:r,initialTab:s="limit",busy:a=!1}){const[o,l]=Ne.useState(s),[c,u]=Ne.useState(n!=null&&n.markPrice?String(n.markPrice):""),[d,f]=Ne.useState(100),x=Ne.useRef(!1),g=Math.abs(Number((n==null?void 0:n.size)||0));Number((n==null?void 0:n.entryPrice)||0);const y=Number((n==null?void 0:n.markPrice)??(n==null?void 0:n.midPrice)??0),v=g*d/100,C=Number(c||0);Ne.useEffect(()=>{t&&!x.current&&(l(s),f(100),u(n!=null&&n.markPrice?String(n.markPrice):""),x.current=!0),!t&&x.current&&(x.current=!1)},[t,s,n==null?void 0:n.markPrice]);const N=()=>{a||(o==="market"?r==null||r({mode:"market",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,side:n==null?void 0:n.type,size:v}):r==null||r({mode:"limit",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,side:n==null?void 0:n.type,price:C,size:v}))},P=o==="market"?"Market Close":"Limit Close",T=o==="market"?"This will attempt to immediately close the position.":"This will send an order to close your position at the limit price.";return i.jsx(efe,{open:t,onClose:a?()=>{}:e,title:P,width:500,children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"text-[12px] text-[#9B9B9B]",children:T}),i.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[i.jsx(Vg,{children:"Size"}),i.jsxs("div",{className:"text-[#CFCFCF]",children:[vo(g)," ",n==null?void 0:n.coin]})]}),o==="market"?i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{children:[i.jsx(Vg,{children:"Price"}),i.jsx(HQ,{right:"",children:i.jsx("span",{className:"text-white",children:"Market"})})]}),i.jsxs("div",{children:[i.jsx(Vg,{children:"Size"}),i.jsx(HQ,{right:"USDC",children:vo(v*y,2)})]})]}):i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(Vg,{children:"Price (USD)"}),i.jsx("button",{className:"text-[11px] text-[#67FFBD] px-2 py-0.5 rounded-md hover:opacity-90",onClick:()=>u(String(y)),children:"Mid"})]}),i.jsx(kse,{value:c,onChange:u,placeholder:"0.0"})]}),i.jsxs("div",{children:[i.jsx(Vg,{children:"Size"}),i.jsx(HQ,{right:"USDC",children:vo(v*(C||y),2)})]})]}),i.jsx(vA,{value:d,onChange:f,accent:"#67FFBD",trackBg:"rgba(255,255,255,0.12)",marks:[0,25,50,75,100],snap:!0}),i.jsx(Cqe,{onClick:N,disabled:o==="limit"&&!c,loading:a,children:o==="market"?"Market Close":"Confirm"})]})})}function Dxn({open:t,onClose:e,row:n,onConfirm:r,busy:s=!1}){const a=Math.abs(Number((n==null?void 0:n.size)||0)),o=(n==null?void 0:n.type)==="Long"?"Short":"Long";return i.jsx(efe,{open:t,onClose:s?()=>{}:e,width:640,title:`Reverse ${n==null?void 0:n.coin} Position`,children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"rounded-xl border border-[#8d6a2a] bg-[#2a2212] text-[#f1c76c] p-3 text-[12px]",children:"This will close your existing positions and open reversed positions with the same size. This action cannot be undone."}),i.jsx("div",{className:"rounded-xl border border-[#2A2A2A] bg-[#101010] p-4 text-[12px]",children:i.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr] gap-2",children:[i.jsx("div",{className:"text-[#9B9B9B]",children:"Asset"}),i.jsx("div",{className:"text-[#9B9B9B]",children:"Current Side"}),i.jsx("div",{className:"text-[#9B9B9B]",children:"New Side"}),i.jsx("div",{className:"text-white",children:n==null?void 0:n.coin}),i.jsxs("div",{className:"text-[#67FFBD]",children:[n==null?void 0:n.type," ",vo(a)]}),i.jsxs("div",{className:"text-[#FF797C]",children:[o," ",vo(a)]})]})}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx("button",{onClick:e,disabled:s,className:`flex-1 h-10 rounded-xl border border-[#2A2A2A] bg-transparent text-white hover:bg-white/5 ${s?"opacity-60 cursor-not-allowed":""}`,children:"Cancel"}),i.jsx("button",{onClick:()=>r==null?void 0:r({mode:"reverse",id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,from:n==null?void 0:n.type,to:o,size:a}),disabled:s,className:`flex-1 h-10 rounded-xl bg-[#67FFBD] text-[#101010] hover:opacity-95 ${s?"opacity-60 cursor-not-allowed":""}`,children:s?i.jsx(f2,{size:14,color:"#FFF"}):"Reverse"})]})]})})}const aAe=({value:t,onChange:e,placeholder:n="0"})=>i.jsxs("div",{className:"relative",children:[i.jsx("input",{value:t,onChange:r=>e(r.target.value),placeholder:n,className:"w-full h-9 px-3 pr-8 rounded-lg bg-[#101010] border border-[#2A2A2A] text-white outline-none font-inter text-[11px] text-right",inputMode:"decimal"}),i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[#9B9B9B] text-[11px]",children:"%"})]});function Bxn({open:t,onClose:e,row:n,initialTp:r,initialSl:s,onSubmit:a}){var se;const[o,l]=m.useState(r?String(r):""),[c,u]=m.useState(s?String(s):""),[d,f]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(!1),[C,N]=m.useState(!1),P=Number((n==null?void 0:n.entryPrice)||0),T=Number((n==null?void 0:n.markPrice)??0),M=Math.abs(Number((n==null?void 0:n.size)||0)),F=n==null?void 0:n.type,$=(((se=n==null?void 0:n.leverage)==null?void 0:se.type)||(n==null?void 0:n.marginType)||"").toString(),L=ae=>Number.isFinite(ae)?Math.max(0,ae):0,z=(ae,W=4)=>Number.isFinite(ae)?String(Number(ae.toFixed(W))):"",X=ae=>{var oe;if(!P)return"";const W=Number(ae);if(!Number.isFinite(W))return"";const V=Number(((oe=n==null?void 0:n.leverage)==null?void 0:oe.value)||1),ee=(F==="Long"?W/P-1:1-W/P)*100*V;return z(L(ee),2)},ne=ae=>{var oe;if(!P)return"";const W=Number(ae);if(!Number.isFinite(W))return"";const V=Number(((oe=n==null?void 0:n.leverage)==null?void 0:oe.value)||1),ee=(F==="Long"?1-W/P:W/P-1)*100*V;return z(L(ee),2)},J=ae=>{var de;const W=Number(ae);if(!Number.isFinite(W)||!P)return"";const V=Number(((de=n==null?void 0:n.leverage)==null?void 0:de.value)||1),ee=W/(V*100),oe=F==="Long"?P*(1+ee):P*(1-ee);return z(oe,4)},K=ae=>{var de;const W=Number(ae);if(!Number.isFinite(W)||!P)return"";const V=Number(((de=n==null?void 0:n.leverage)==null?void 0:de.value)||1),ee=W/(V*100),oe=F==="Long"?P*(1-ee):P*(1+ee);return z(oe,4)};m.useEffect(()=>{if(t){const ae=r?String(r):"",W=s?String(s):"";l(ae),u(W),f(ae?X(ae):""),g(W?ne(W):""),v(!1),N(!1)}},[t,r,s]);const te=o&&M?Math.max(0,(F==="Long"?Number(o)-T:T-Number(o))*M):0,fe=c&&M?Math.max(0,(F==="Long"?T-Number(c):Number(c)-T)*M):0,q=()=>{a==null||a({id:n==null?void 0:n.id,coin:n==null?void 0:n.coin,side:F,tpPrice:o?Number(o):null,slPrice:c?Number(c):null,configureAmount:y,useLimitPx:C}),e()};return i.jsx(efe,{open:t,onClose:e,title:`TP/SL for Position - ${(n==null?void 0:n.coin)||"--"} - ${$||F||"--"}`,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"rounded-xl border border-[#2A2A2A] bg-[#101010] p-4 text-[12px] space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Position"}),i.jsxs("span",{className:"text-[#1DE6A3]",children:[vo(M)," ",i.jsx("span",{className:"text-[#67FFBD]",children:n==null?void 0:n.coin})]})]}),i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Entry Price"}),i.jsx("span",{className:"text-white",children:vo(P,4)})]}),i.jsxs("div",{className:"flex justify-between text-[#9B9B9B]",children:[i.jsx("span",{children:"Mark Price"}),i.jsx("span",{className:"text-white",children:vo(T,4)})]})]}),i.jsxs("div",{className:"rounded-xl border border-[#2A2A2A] bg-[#101010] p-4 space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_220px] gap-6 items-start",children:[i.jsxs("div",{children:[i.jsx(Vg,{children:"TP Price"}),i.jsx(kse,{value:o,onChange:ae=>{l(ae),f(ae?X(ae):"")},placeholder:"0.0"}),i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mt-1",children:"Est Gain:"}),i.jsxs("div",{className:"text-[11px] text-[#67FFBD]",children:["+$",vo(te,2)]})]}),i.jsxs("div",{children:[i.jsx(Vg,{children:"Gain"}),i.jsx(aAe,{value:d,onChange:ae=>{f(ae),l(ae?J(ae):"")}})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1fr_220px] gap-6 items-start",children:[i.jsxs("div",{children:[i.jsx(Vg,{children:"SL Price"}),i.jsx(kse,{value:c,onChange:ae=>{u(ae),g(ae?ne(ae):"")},placeholder:"0.0"}),i.jsx("div",{className:"text-[11px] text-[#9B9B9B] mt-1",children:"Est Loss:"}),i.jsxs("div",{className:"text-[11px] text-[#FF7173]",children:["-$",vo(fe,2)]})]}),i.jsxs("div",{children:[i.jsx(Vg,{children:"Loss"}),i.jsx(aAe,{value:x,onChange:ae=>{g(ae),u(ae?K(ae):"")}})]})]}),i.jsxs("div",{className:"flex items-center gap-6 text-[12px] text-white",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:y,onChange:ae=>v(ae.target.checked)}),i.jsx("span",{children:"Configure Amount"})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD]",checked:C,onChange:ae=>N(ae.target.checked)}),i.jsx("span",{children:"Limit Price"})]})]}),i.jsx(Cqe,{onClick:q,disabled:!o&&!c,children:"Confirm"})]})]})})}function $xn({selectedRow:t,onOpenCloseModal:e,onOpenReverse:n,onCloseAll:r,busyCloseAll:s}){const[a,o]=m.useState(!1),l=m.useRef(null),[c,u]=m.useState({x:0,y:0});return m.useEffect(()=>{var f;if(!a)return;const d=(f=l.current)==null?void 0:f.getBoundingClientRect();d&&u({x:d.left,y:d.bottom+6})},[a]),m.useEffect(()=>{if(!a)return;const d=()=>o(!1),f=x=>{l.current&&l.current.contains(x.target)||d()};return window.addEventListener("resize",d),window.addEventListener("scroll",d),document.addEventListener("pointerdown",f),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d),document.removeEventListener("pointerdown",f)}},[a]),i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:l,className:"w-[100px] min-w-0 h-8 px-2 rounded-lg border border-[#2A2A2A] bg-[#161616] text-[#CFCFCF] text-xs flex items-center justify-between overflow-hidden",onClick:d=>{d.stopPropagation(),o(f=>!f)},title:"Close menu",children:[i.jsx("span",{className:"truncate",children:"Close"}),i.jsx("span",{className:"opacity-70 ml-2",children:"▾"})]}),a&&Aa.createPortal(i.jsx("div",{className:"fixed z-[99998] w-[300px] rounded-xl border border-[#2A2A2A] bg-[#0F0F0F] shadow-2xl p-3",style:{top:c.y,left:c.x},onPointerDown:d=>d.stopPropagation(),children:i.jsxs("div",{className:"mt-2 text-[13px] text-white/90",children:[i.jsx("div",{className:`${t?"hover:bg-white/5":"opacity-40 pointer-events-none"} px-2 py-1.5 rounded cursor-pointer`,onClick:()=>t&&(e==null?void 0:e("limit")),children:"Limit Close"}),i.jsx("div",{className:`${t?"hover:bg-white/5":"opacity-40 pointer-events-none"} px-2 py-1.5 rounded cursor-pointer`,onClick:()=>t&&(e==null?void 0:e("market")),children:"Market Close"}),i.jsxs("div",{className:`px-2 py-1.5 rounded cursor-pointer ${s?"opacity-60 pointer-events-none":"hover:bg-white/5"}`,onClick:()=>!s&&(r==null?void 0:r()),children:["Close All (Market)",s?i.jsx("span",{className:"inline-flex ml-2 align-middle",children:i.jsx(f2,{size:12,color:"#FFF"})}):null]})]})}),document.body)]})}function Uxn({walletAddress:t,listHeight:e=560}){var me,we,xe,be;const{isReferralCodeName:n}=m.useContext(Qr),{rows:r,tpslByCoin:s={},viewOrdersOnly:a}=Xde(t),[o,l]=m.useState(t||"");m.useEffect(()=>{l(t||"")},[r]);const c=(o||"")===(t||""),u=m.useMemo(()=>c?r.map(je=>({...je,id:je.id})):[],[c,r]),{key:d}=B2(),[f,x]=m.useState({}),[g,y]=m.useState(null),[v,C]=m.useState(!1),[N,P]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),[T,M]=m.useState(null),F=m.useMemo(()=>u.find(je=>je.id===T)||null,[u,T]),[$,L]=m.useState(!1),[z,X]=m.useState("limit"),[ne,J]=m.useState(!1),[K,te]=m.useState(!1),[fe,q]=m.useState(!1),se=()=>typeof window<"u"&&window.localStorage.getItem("skipCloseConfirm")==="true",ae={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},W=je=>ae[je]||je,V=m.useCallback(async({id:je,coin:Ie,tpPrice:Re,slPrice:Qe,configureAmount:Ke,useLimitPx:dt})=>{var tt;try{const nt=await zQ(t);await UQ(nt.replaceTPSLForPosition({symbol:Ie,tpPrice:Re??null,slPrice:Qe??null,useLimitPx:!!dt,triggerSlippage:.1}),{loading:`Placing TP/SL for ${Ie}...`,success:`TP/SL placed for ${Ie}`,error:Le=>`TP/SL failed: ${(Le==null?void 0:Le.message)||Le}`}),x(Le=>({...Le,[je]:{tp:Re||null,sl:Qe||null}})),(tt=window.dispatchEvent)==null||tt.call(window,new Event("orders:refresh"))}catch{}finally{y(null)}},[t]);m.useEffect(()=>{if(v&&!N.referral){const je=n||window.localStorage.getItem("refcode")||"";je&&P(Ie=>({...Ie,referral:je}))}},[v,n,N.referral]);const ee=m.useCallback(async je=>{te(!0);try{const Ie=await zQ(t),Re=je.mode==="market"?Ie.marketClose(je.coin,je.size,{tif:"Ioc",reduceOnly:!0}):Ie.placeOrder({symbol:je.coin,isBuy:je.side==="Short",size:je.size,price:je.price,tif:"Gtc",reduceOnly:!0});await UQ(Re,{loading:`Closing ${je.coin} ${je.mode}...`,success:`Closed ${je.coin} (${vo(je.size)} ${je.mode})`,error:Qe=>`Close failed: ${je.coin} • ${(Qe==null?void 0:Qe.message)||Qe}`}),L(!1)}finally{te(!1)}},[t]),oe=m.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:Ie=>Ie.coin||"",render:(Ie,Re)=>{var dt;const Qe=jo(),Ke=()=>Qe(`/terminal/hyperliquid/${Re.coin}`);return i.jsxs("div",{onPointerDown:Ke,className:"flex gap-1 items-center text-white font-medium min-w-[120px] cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${W(Re.coin)}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:Re.coin}),i.jsx("span",{children:Ie.replace("xyz:","")||"--"}),i.jsx("div",{className:"flex justify-start items-center gap-2 h-8 ml-1",children:i.jsx("div",{className:`${Re.type==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":"text-[#ff787b] bg-[#ff797c]/20"} h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-1`,children:i.jsxs("div",{className:"text-[11px] font-semibold tracking-wide uppercase",children:[vo(((dt=Re.leverage)==null?void 0:dt.value)??0,0),"x"]})})})]})}},{key:"size",label:"Size",sortable:!0,sortValue:Ie=>Math.abs(Ie.size),render:(Ie,Re)=>i.jsxs("span",{className:`font-medium ${Re.type==="Long"?"text-[#67ffbd]":"text-[#ff787b]"}`,children:[vo(Math.abs(Ie))," ",Re.coin.replace("xyz:","")]})},{key:"positionValue",label:"Pos. Val.",sortable:!0,sortValue:Ie=>Ie.positionValue,render:Ie=>i.jsxs("span",{className:"text-white font-semibold",children:["$",vo(Ie,2)]})},{key:"entryPrice",label:"Entry Price",sortable:!0,sortValue:Ie=>Ie.entryPrice,render:Ie=>i.jsxs("span",{className:"text-white font-semibold",children:["$",vo(Ie,4)]})},{key:"markPrice",label:"Mark Price",sortable:!0,sortValue:Ie=>Ie.markPrice,render:Ie=>i.jsxs("span",{className:"text-white font-semibold",children:["$",vo(Ie,4)]})},{key:"pnl",label:"PnL (ROE%)",headerTooltip:"Mark price is used to estimate unrealized PNL. Only trade prices are used for realized PNL.",sortable:!0,sortValue:Ie=>Ie.pnl,render:(Ie,Re)=>i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsxs("span",{className:Re.pnl>=0?"text-[#67FFBD]":"text-[#FF797C]",children:["$",vo(Math.abs(Re.pnl),2)," ",i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",vo(Math.abs(Re.roe),1),"%)"]})]}),i.jsx("button",{onClick:Qe=>{var dt;Qe.stopPropagation();const Ke=n||window.localStorage.getItem("refcode")||"";P({coin:Re.coin,type:Re.type.toUpperCase(),leverage:((dt=Re.leverage)==null?void 0:dt.value)||0,roe:Re.roe||0,entryPrice:Number(Re.entryPrice||0),markPrice:Number(Re.markPrice||0),referral:Ke,positionDistribution:0,pnl:Number(Re.pnl||0),closePx:0}),C(!0)},className:"flex items-center h-6 text-[#67FFBD] text-[11px] font-semibold bg-transparent -ml-3",title:"Share",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})},{key:"liquidationPx",label:"Liq. Price",sortable:!0,sortValue:Ie=>Ie.liquidationPx??-1,render:Ie=>Ie==null?i.jsx("span",{className:"text-[#979797]",children:"--"}):i.jsx("span",{className:"text-white font-semibold",children:vo(Ie,0)})},{key:"marginUsed",label:"Margin",headerTooltip:"For isolated positions margin includes unrealized pnl.",sortable:!0,sortValue:Ie=>Ie.marginUsed,render:(Ie,Re)=>{var dt;const Qe=Re.marginUsed,Ke=(dt=Re.leverage)!=null&&dt.type?Rxn(Re.leverage.type):null;return i.jsxs("span",{className:"text-white font-semibold",children:["$",vo(Qe,2)," ",Ke?i.jsxs("span",{className:"text-[#9B9B9B]",children:["(",Ke,")"]}):null]})}},{key:"funding",label:"Funding",headerTooltip:"Net funding payments since the position was opened. Hover for all-time and since changed.",sortable:!0,sortValue:Ie=>Ie.funding,render:Ie=>i.jsxs("span",{className:Number(Ie)<=0?"text-[#67FFBD] font-semibold":"text-[#FF797C] font-semibold",children:["$",vo(Math.abs(Ie),4)]})},{key:"close",label:i.jsx($xn,{selectedRow:F,onOpenCloseModal:async Ie=>{if(F){if(X(Ie),Ie==="market"&&se()){await ee({mode:"market",id:F==null?void 0:F.id,coin:F==null?void 0:F.coin,side:F==null?void 0:F.type,size:Math.abs(Number((F==null?void 0:F.size)||0))});return}L(!0)}},onOpenReverse:()=>F&&J(!0),onCloseAll:async()=>{q(!0);try{const Ie=await zQ(t);await UQ(Ie.closeAllPositions(),{loading:"Closing all positions...",success:"Closed all positions",error:Re=>`Close all failed: ${(Re==null?void 0:Re.message)||Re}`})}finally{q(!1)}},busyCloseAll:fe}),sortable:!1,align:"start",render:(Ie,Re)=>i.jsxs("div",{className:"w-full flex items-center gap-1",children:[i.jsx("button",{onClick:()=>{M(Re.id),X("limit"),L(!0)},className:"flex justify-center items-center h-5 px-2 rounded-md text-[11px] font-semibold text-[#0f151a] bg-[rgb(103,255,189)] -ml-2",children:"Limit"}),i.jsx("button",{onClick:async()=>{M(Re.id),X("market"),se()?await ee({mode:"market",id:Re.id,coin:Re.coin,side:Re.type,size:Math.abs(Number(Re.size||0))}):L(!0)},className:"flex justify-center items-center h-5 px-2 rounded-md text-[11px] font-semibold text-[#0f151a] bg-[rgb(103,255,189)]",children:"Market"})]})},{key:"tpSl",label:"TP/SL",sortable:!1,render:(Ie,Re)=>{const Qe=s==null?void 0:s[Re.coin],Ke=Qe&&(Qe.tp||Qe.sl),dt=a instanceof Set?a.has(Re.coin):!1,tt=f[Re.id];return Ke?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[Qe.tp?vo(Qe.tp,0):"--"," /"," ",Qe.sl?vo(Qe.sl,0):"--"]}),i.jsx("button",{onClick:()=>y(Re),className:"opacity-80 hover:opacity-100 bg-transparent p-0",children:"✎"})]}):dt?i.jsx("div",{className:"flex items-center justify-end",children:i.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("terminal:setTab",{detail:{tab:"open"}})),className:"h-6 px-2 rounded-md text-[11px] font-semibold text-[#67ffbd] bg[rgba(103,255,189,0.16)] flex justify-center items-center",children:"View Orders"})}):tt&&(tt.tp||tt.sl)?i.jsxs("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:[i.jsxs("span",{className:"text-[#CFCFCF]",children:[tt.tp?vo(tt.tp,0):"--"," /"," ",tt.sl?vo(tt.sl,0):"--"]}),i.jsx("button",{onClick:()=>y(Re),className:"opacity-80 hover:opacity-100 bg-transparent",children:"✎"})]}):i.jsx("div",{className:"flex items-center justify-end gap-2 text-[#CFCFCF]",children:i.jsx("button",{onClick:()=>y(Re),className:"text-[#CFCFCF] underline underline-offset-4 decoration-dotted hover:text-white p-0 bg-transparent",children:"-- / -- ✎"})})}}],[F,n,f,s,a,t,fe,ee]),de=g?((me=s==null?void 0:s[g.coin])==null?void 0:me.tp)??((we=f[g.id])==null?void 0:we.tp)??null:null,Ce=g?((xe=s==null?void 0:s[g.coin])==null?void 0:xe.sl)??((be=f[g.id])==null?void 0:be.sl)??null:null;return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:u1(u,"positions",d),columns:oe,rowHeight:30,listHeight:e,tableClassName:"mt-2 font-inter",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:je=>`border-b border-[#1E1E1E] bg-transparent !rounded-none ${T===je.id?"bg-[#0d0d0d]":""}`,cellClassName:()=>"py-1 flex min-w-0 !text-[11px] font-normal",rowKey:je=>je.id,onRowClick:je=>M(je.id),emptyRenderer:()=>i.jsx("div",{className:"flex items-center justify-center h-[200px] text-[#9B9B9B] text-sm",children:"No open positions"})}),i.jsx(Bxn,{open:!!g,onClose:()=>y(null),row:g,initialTp:de,initialSl:Ce,onSubmit:V}),i.jsx(Lxn,{open:$&&!!F,onClose:()=>L(!1),row:F,initialTab:z,onConfirm:ee,busy:K}),i.jsx(Dxn,{open:ne&&!!F,onClose:()=>J(!1),row:F,onConfirm:je=>{J(!1),console.log("REVERSE CONFIRM",je)}}),i.jsx(eP,{open:v,setOpen:C,data:N,setTradeInfo:P})]})}async function oAe(t){const e=aP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return yA({address:t,signer:e,dex:""})}function Tse(t,e=2,n=!0){return Number(t||0).toLocaleString(void 0,{minimumFractionDigits:n?0:e,maximumFractionDigits:e})}function zxn(t,e=2){return`${Number(t||0).toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})} USDC`}function Hxn(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${s} - ${a}:${o}:${l}`}function Vxn(t){const e=t.side==="Buy"?"B":t.side==="Sell"?"A":t.side;return e==="B"?t.reduceOnly?"Close Short":"Open Long":e==="A"?t.reduceOnly?"Close Long":"Open Short":"-"}function Wxn({open:t,onClose:e,children:n,title:r}){return t?i.jsxs("div",{className:"fixed inset-0 z-[999] flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[1px]",onClick:e}),i.jsxs("div",{className:"relative z-[1000] w-[760px] max-w-[95vw] rounded-2xl border border-[#262626] bg-[#141414] p-6 shadow-2xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("div",{className:"text-white font-semibold",children:r}),i.jsx("button",{onClick:e,className:"rounded-md px-2 py-1 text-[#9B9B9B] hover:bg-[#1F1F1F] hover:text-white",children:"×"})]}),n]})]}):null}function qxn(t){return typeof(t==null?void 0:t.type)=="string"&&t.type.toLowerCase()==="limit"}function Gxn(t){return typeof t=="string"&&t.toLowerCase().includes("stop")}function Kxn(t){return typeof t=="string"&&t.toLowerCase().includes("take profit")}function Yxn(t){return t==="B"?"Long":"Short"}function Xxn(t){return t==="B"?"Short":"Long"}function k7({k:t,v:e,strong:n}){return i.jsxs("div",{className:"flex items-center justify-between text-[13px] leading-5",children:[i.jsx("span",{className:"text-[#9B9B9B]",children:t}),i.jsx("span",{className:n?"text-white font-semibold":"text-white",children:e})]})}function VF({title:t,order:e,parentRawSide:n}){const r=!!e,s=r?e.side?Yxn(e.side):Xxn(n):"--",a=r&&typeof e.orderType=="string"&&e.orderType.toLowerCase()==="limit";return i.jsxs("div",{className:"rounded-xl border border-[#2a2a2a] bg-[#161616] px-4 py-3",children:[t?i.jsx("div",{className:"mb-2 text-[13px] text-[#9B9B9B]",children:t}):null,r?i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(k7,{k:"Order Type",v:e.orderType||"--"}),i.jsx(k7,{k:"Side",v:s}),i.jsx(k7,{k:"Amount",v:`${e.sz}`}),i.jsx(k7,{k:"Trigger",v:e.triggerCondition&&e.triggerCondition!=="N/A"?e.triggerCondition:"N/A"}),i.jsx(k7,{k:"Price",v:a?`$${Tse(e.limitPx,3)}`:"Market"})]}):i.jsx("div",{className:"text-[#9B9B9B]",children:"—"})]})}function Qxn({onBulkCancel:t,busy:e}){const[n,r]=m.useState(!1),s=m.useRef(null),[a,o]=m.useState({x:0,y:0});m.useEffect(()=>{var u;if(!n)return;const c=(u=s.current)==null?void 0:u.getBoundingClientRect();c&&o({x:c.left,y:c.bottom+6})},[n]),m.useEffect(()=>{if(!n)return;const c=()=>r(!1),u=d=>{s.current&&s.current.contains(d.target)||c()};return window.addEventListener("resize",c),window.addEventListener("scroll",c),document.addEventListener("pointerdown",u),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c),document.removeEventListener("pointerdown",u)}},[n]);const l=({label:c,val:u,showSpinner:d})=>i.jsx("div",{className:`px-2 py-1.5 rounded cursor-pointer ${e?"opacity-60 pointer-events-none":"hover:bg-white/5"}`,onClick:()=>{e||(t==null||t(u),r(!1))},children:i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{children:c}),d&&e?i.jsx("span",{className:"inline-flex ml-2 align-middle",children:i.jsx(f2,{size:12,color:"#FFF"})}):null]})});return i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:s,className:"w-[120px] min-w-0 h-8 px-2 rounded-lg border border-[#2A2A2A] bg-[#161616] text-[#CFCFCF] text-xs flex items-center justify-between overflow-hidden",onClick:c=>{c.stopPropagation(),r(u=>!u)},title:"Cancel menu",children:[i.jsx("span",{className:"truncate",children:"Cancel"}),i.jsx("span",{className:"opacity-70 ml-2",children:"▾"})]}),n&&Aa.createPortal(i.jsx("div",{className:"fixed z-[99998] w-[260px] rounded-xl border border-[#2A2A2A] bg-[#0F0F0F] shadow-2xl p-3",style:{top:a.y,left:a.x},onPointerDown:c=>c.stopPropagation(),children:i.jsxs("div",{className:"mt-2 text-[13px] text-white/90",children:[i.jsx(l,{label:"Cancel All",val:"all",showSpinner:!0}),i.jsx(l,{label:"Cancel Limit",val:"limit"}),i.jsx(l,{label:"Cancel TP/SL",val:"tpsl"}),i.jsx(l,{label:"Cancel ReduceOnly",val:"reduceOnly"}),i.jsx(l,{label:"Cancel Non-Reduce",val:"nonReduce"})]})}),document.body)]})}function Zxn({walletAddress:t,listHeight:e=560,onCancelOrder:n,onBulkCancel:r}){const{rows:s,loading:a}=Qde(t),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState(null),[x,g]=m.useState(null),{key:y}=B2(),[v,C]=m.useState(new Set),[N,P]=m.useState(!1),T=V=>v.has(V),M=V=>C(ee=>new Set([...ee,V])),F=V=>C(ee=>{const oe=new Set(ee);return oe.delete(V),oe}),$=m.useCallback(async V=>{await(await oAe(t)).cancelOrder({symbol:V.coin,oid:V.oid})},[t]),L=m.useCallback(async V=>{await(await oAe(t)).cancelOrdersFiltered({filter:V})},[t]),z={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},X=V=>z[V]||V,ne=n??$,J=r??L,K=m.useCallback(async V=>{const ee=V.oid;if(!T(ee)){M(ee);try{await tn.promise(Promise.resolve(ne(V)),{loading:`Cancelling: ${V.coin} #${ee}...`,success:`Cancelled: ${V.coin} #${ee}`,error:oe=>`Cancel failed: ${V.coin} #${ee} • ${(oe==null?void 0:oe.message)||oe}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{F(ee)}}},[ne,v]),te=V=>V==="all"?"All orders":V==="limit"?"Limit orders":V==="tpsl"?"TP/SL orders":V==="reduceOnly"?"ReduceOnly orders":V==="nonReduce"?"Non-Reduce orders":V,fe=m.useCallback(async V=>{if(V){P(!0);try{await tn.promise(Promise.resolve(J(V)),{loading:`Bulk cancelling: ${te(V)}...`,success:`Bulk cancelled: ${te(V)}`,error:ee=>`Bulk cancel failed: ${te(V)} • ${(ee==null?void 0:ee.message)||ee}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}})}finally{P(!1)}}},[J]),q=m.useCallback(V=>{const ee=Array.isArray(V==null?void 0:V.children)?V.children:[],oe=ee.find(Ce=>Kxn(Ce.orderType))||null,de=ee.find(Ce=>Gxn(Ce.orderType))||null;u({orderType:V.type,coin:V.coin,side:V.sideRaw,sz:V.size,limitPx:V.limitPx,triggerCondition:V.triggerCondition,timestamp:V.timestamp}),f(de||oe||null),g(oe&&de?oe:null),l(!0)},[]),se=m.useMemo(()=>[{key:"timestamp",label:"Time",sortable:!0,width:"140px",sortValue:V=>V.timestamp,render:V=>i.jsx("span",{className:"text-white",children:Hxn(V)})},{key:"type",label:"Type",sortable:!0,width:"120px",sortValue:V=>V.type||"",render:(V,ee)=>i.jsx("span",{className:"text-white",children:ee.type||"--"})},{key:"coin",label:"Coin",sortable:!0,sortValue:V=>V.coin||"",render:(V,ee)=>{const oe=(ee.side==="B",ee.reduceOnly?"text-[#FF797C]":"text-[#67FFBD]"),de=jo(),Ce=()=>de(`/terminal/hyperliquid/${ee.coin}`);return i.jsxs("div",{onPointerDown:Ce,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${X(ee.coin)}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:ee.coin}),i.jsx("span",{className:oe,children:ee.coin.replace("xyz:","")||"--"})]})}},{key:"side",label:"Direction",sortable:!0,sortValue:V=>V.side==="B"?1:0,render:(V,ee)=>{const oe=Vxn(ee),de=ee.side==="Sell";return i.jsx("span",{className:`h-5 px-1.5 py-1 rounded-md text-[11px] font-semibold flex justify-center items-center ${de?"text-[#FF797C] bg-[#FF797C]/20":"text-[#67FFBD] bg-[#67FFBD]/20"}`,children:oe})}},{key:"size",label:"Size",sortable:!0,sortValue:V=>V.size,render:V=>i.jsx("span",{className:"text-white font-semibold",children:V})},{key:"originalSize",label:"Original Size",sortable:!0,sortValue:V=>Math.abs(V.originalSize),render:V=>i.jsx("span",{className:"text-white font-semibold",children:V})},{key:"orderValue",label:"Order value",sortable:!0,sortValue:V=>Math.abs(V.orderValue),render:V=>i.jsx("span",{className:"text-white font-semibold",children:zxn(V,2)})},{key:"price",label:"Price",sortable:!0,sortValue:V=>V.limitPx,render:(V,ee)=>{if(ee.price==="Market")return i.jsx("span",{className:"text-white font-semibold",children:"Market"});const oe=typeof ee.pxDecimals=="number"?ee.pxDecimals:3;return i.jsx("span",{className:"text-white font-semibold",children:Tse(ee.limitPx,oe)})}},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:V=>V.reduceOnly?1:0,render:V=>i.jsx("span",{className:"text-white font-semibold",children:V?"Yes":"No"})},{key:"triggerCondition",label:"Trigger",sortable:!0,sortValue:V=>V.triggerPx||0,width:"140px",render:(V,ee)=>ee.triggerPx&&ee.triggerPx!=="N/A"?i.jsx("span",{className:"text-white font-semibold",children:ee.type==="Stop Market"?`Price Below ${ee.triggerPx}`:ee.type==="Take Profit Market"?`Price Above ${ee.triggerPx}`:ee.triggerPx}):i.jsx("span",{children:"N/A"})},{key:"tp_sl",label:"TP/SL",sortable:!1,render:(V,ee)=>{const oe=Array.isArray(ee.children)&&ee.children.length>0;return qxn(ee)&&oe?i.jsx("button",{onClick:de=>{de.stopPropagation(),q(ee)},className:"text-[#67FFBD] hover:opacity-80 underline underline-offset-4 p-0 -ml-2 w-full bg-transparent",children:i.jsx("span",{className:"flex justify-start",children:"View"})}):i.jsx("span",{className:"text-[#9B9B9B]",children:"--"})}},{key:"cancel",label:i.jsx(Qxn,{onBulkCancel:fe,busy:N}),sortable:!1,render:(V,ee)=>{const oe=T(ee.oid);return i.jsx("button",{onClick:de=>{de.stopPropagation(),oe||K(ee)},disabled:oe,className:`h-6 w-6 flex items-center justify-center rounded-md border text-[#FF797C] transition-all duration-200 p-1 text-[11px] ${oe?"opacity-60 cursor-not-allowed border-red-500/30 bg-red-500/10":"border-[#2A2A2A] bg-red-500/20 hover:bg-red-500/30 border-red-500/50 hover:bg-[#2A0F12]"}`,title:oe?"Cancelling...":"Cancel order",children:oe?i.jsx(f2,{size:12,color:"#FF797C"}):"×"})}}],[q,K,fe,N,v]),ae=(d?1:0)+(x?1:0),W=c?`${c.coin} • TP/SL for Limit @ ${Tse(c.limitPx,3)}`:"Take Profit / Stop Loss";return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:u1(s,"openOrders",y),loading:a,columns:se,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:V=>V.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No open orders"})}),i.jsxs(Wxn,{open:o,onClose:()=>l(!1),title:W,children:[i.jsx("div",{className:"text-center text-[14px] text-[#9B9B9B] mb-4",children:ae===2?"If order A is filled, orders B and C will be placed":"If order A is filled, order B will be placed"}),i.jsxs("div",{className:"flex flex-col items-stretch gap-6",children:[i.jsxs("div",{className:"mx-auto",children:[i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"Order A"}),i.jsx("div",{className:"w-[360px]",children:i.jsx(VF,{title:"",order:c,parentRawSide:c==null?void 0:c.side})})]}),i.jsx("div",{className:"relative mx-auto h-10 w-px bg-[#2a2a2a]"}),ae===2?i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"If order B filled, cancel order C"}),i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"If order C filled, cancel order B"}),i.jsx(VF,{title:"Order B",order:d,parentRawSide:c==null?void 0:c.side}),i.jsx(VF,{title:"Order C",order:x,parentRawSide:c==null?void 0:c.side})]}):i.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[i.jsx("div",{className:"text-center text-[#9B9B9B] mb-2",children:"Order B"}),i.jsx(VF,{title:"",order:d,parentRawSide:c==null?void 0:c.side})]})]})]})]})}async function Jxn(t){const e=aP({getPK:()=>typeof window<"u"?localStorage.getItem("hl_pk"):null,isMainnet:!0,vaultAddress:null});return yA({address:t,signer:e,dex:""})}const egn="wss://api.hyperliquid.xyz/ws",Sqe="https://api.hyperliquid.xyz/info";function Lv(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function T7(t,e=2){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function VQ(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${s} - ${a}:${o}:${l}`}function WQ(t){return t?"Yes":"No"}function Nqe(t,e){const n=Number(e||0);return n?Number(t||0)/n:null}const qQ=new Map;function Aqe(t){const e=(t==null?void 0:t.toLowerCase())||"";return e?(qQ.has(e)||qQ.set(e,{key:e,subs:new Set,ping:null,ws:null,connected:!1,booting:!1,activeRows:[],historyRows:[],fillRows:[],loadingActive:!0,loadingHistory:!0,loadingFills:!0,hydratedActive:!1}),qQ.get(e)):null}function m5(t){const e={activeRows:t.activeRows,historyRows:t.historyRows,fillRows:t.fillRows,loadingActive:t.loadingActive,loadingHistory:t.loadingHistory,loadingFills:t.loadingFills,hydratedActive:t.hydratedActive};t.subs.forEach(n=>n(e))}function CM(t){var e;try{(e=t.ws)==null||e.close()}catch{}t.ws=null,t.ping&&(clearInterval(t.ping),t.ping=null),t.connected=!1}function tgn(t){var s;const e=((s=t==null?void 0:t.data)==null?void 0:s.clearingHouseState)??(t==null?void 0:t.data)??t;if(!e||!Object.prototype.hasOwnProperty.call(e,"twapStates"))return{has:!1,pairs:[]};const n=e.twapStates;let r=[];return Array.isArray(n)&&(n.length===1&&Array.isArray(n[0])&&Array.isArray(n[0][0])?r=n[0]:n.length&&Array.isArray(n[0])?r=n:r=[]),{has:!0,pairs:r}}function jqe(t){if(t.booting||t.connected)return;t.booting=!0,CM(t);const e=new WebSocket(egn);t.ws=e,e.onopen=()=>{t.connected=!0,!t.hydratedActive&&t.activeRows.length===0&&(t.loadingActive=!0,m5(t)),e.send(JSON.stringify({method:"subscribe",subscription:{type:"webData2",user:t.key}})),t.ping=setInterval(()=>{try{e.send(JSON.stringify({id:1,method:"ping"}))}catch{}},3e4)},e.onmessage=n=>{try{const r=JSON.parse(n.data);if((r==null?void 0:r.method)==="pong")return;const{has:s,pairs:a}=tgn(r);if(s){const o=[];for(const l of a){if(!Array.isArray(l)||l.length<2)continue;const[c,u]=l;if(!u||((u==null?void 0:u.user)||"").toLowerCase()!==t.key)continue;const d=Nqe(u.executedNtl,u.executedSz);o.push({id:String(c),twapId:Number(c),coin:u.coin,sz:Number(u.sz||0),executedSz:Number(u.executedSz||0),avgPx:d,minutes:Number(u.minutes||0),reduceOnly:!!u.reduceOnly,randomize:!!u.randomize,timestamp:Number(u.timestamp||0),side:u.side,errors:"--"})}o.sort((l,c)=>c.timestamp-l.timestamp),t.activeRows=o,t.hydratedActive=!0,t.loadingActive=!1,m5(t)}}catch{}},e.onclose=()=>{CM(t),setTimeout(()=>jqe(t),1500)},e.onerror=()=>{CM(t)},t.booting=!1}async function Eqe(t){try{t.loadingHistory=!0,m5(t);const n=await(await fetch(Sqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"twapHistory",user:t.key})})).json(),s=(Array.isArray(n)?n:[]).map((a,o)=>{var u,d;const l=(a==null?void 0:a.state)||{},c=Nqe(l.executedNtl,l.executedSz);return{id:`${a.time}-${o}`,time:Number(a.time)*1e3,coin:l.coin,totalSz:Number(l.sz||0),executedSz:Number(l.executedSz||0),avgPx:c,totalMinutes:Number(l.minutes||0),reduceOnly:!!l.reduceOnly,randomize:!!l.randomize,status:(((u=a==null?void 0:a.status)==null?void 0:u.status)||"").charAt(0).toUpperCase()+(((d=a==null?void 0:a.status)==null?void 0:d.status)||"").slice(1)}});s.sort((a,o)=>o.time-a.time),t.historyRows=s}catch{t.historyRows=[]}finally{t.loadingHistory=!1,m5(t)}}function ngn(t){const n=(Array.isArray(t)?t:[]).map(s=>{const a=(s==null?void 0:s.fill)||s,o=(s==null?void 0:s.twapId)??null;return{id:`${a==null?void 0:a.oid}-${a==null?void 0:a.time}`,coin:a==null?void 0:a.coin,dir:a==null?void 0:a.dir,px:Number((a==null?void 0:a.px)||0),sz:Number((a==null?void 0:a.sz)||0),fee:Number((a==null?void 0:a.fee)||0),closedPnl:Number((a==null?void 0:a.closedPnl)||0),oid:Number((a==null?void 0:a.oid)||0),time:Number((a==null?void 0:a.time)||0),twapId:o}}),r=new Map;return n.forEach(s=>{r.has(s.id)||r.set(s.id,s)}),[...r.values()].sort((s,a)=>a.time-s.time)}async function _qe(t){try{t.loadingFills=!0,m5(t);const n=await(await fetch(Sqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userTwapSliceFills",user:t.key})})).json();t.fillRows=ngn(n||[])}catch{t.fillRows=[]}finally{t.loadingFills=!1,m5(t)}}function rgn(t){const e=(t==null?void 0:t.toLowerCase())||"",[n,r]=m.useState({activeRows:[],historyRows:[],fillRows:[],loadingActive:!0,loadingHistory:!0,loadingFills:!0,hydratedActive:!1});return m.useEffect(()=>{const s=Aqe(e);if(!s){r({activeRows:[],historyRows:[],fillRows:[],loadingActive:!0,loadingHistory:!1,loadingFills:!1,hydratedActive:!1});return}const a=o=>r(o);return s.subs.add(a),r({activeRows:s.activeRows,historyRows:s.historyRows,fillRows:s.fillRows,loadingActive:s.loadingActive,loadingHistory:s.loadingHistory,loadingFills:s.loadingFills,hydratedActive:s.hydratedActive}),jqe(s),Eqe(s),_qe(s),()=>{s.subs.delete(a),s.subs.size===0&&CM(s)}},[e]),n}function sgn(t){const e=Math.max(0,Math.floor(t/1e3)),n=String(Math.floor(e/3600)).padStart(2,"0"),r=String(Math.floor(e%3600/60)).padStart(2,"0"),s=String(e%60).padStart(2,"0");return`${n}:${r}:${s}`}function ign(t=1e3){const[e,n]=m.useState(Date.now());return m.useEffect(()=>{const r=setInterval(()=>n(Date.now()),t);return()=>clearInterval(r)},[t]),e}function SM(t=""){const e=t.toLowerCase();return e.includes("long")||e==="buy"}function NM(t=""){const e=t.toLowerCase();return e.includes("short")||e==="sell"}function agn(t=""){return SM(t)&&!NM(t)?3:SM(t)&&NM(t)?2:NM(t)&&!SM(t)?1:0}function ogn({walletAddress:t}){const{activeRows:e,historyRows:n,fillRows:r,loadingActive:s,loadingHistory:a,loadingFills:o,hydratedActive:l}=rgn(t),c=ign(1e3),u=m.useMemo(()=>e.map(te=>({...te,runtimeMs:Math.max(0,c-Number(te.timestamp||0))})),[e,c]),{key:d}=B2(),[f,x]=m.useState(new Set),g=te=>f.has(te),y=te=>x(fe=>new Set([...fe,te])),v=te=>x(fe=>{const q=new Set(fe);return q.delete(te),q}),C=async te=>{const fe=te.twapId??Number(te.id);if(!g(fe)){y(fe);try{const q=await Jxn(t);await tn.promise(q.cancelTwapOrder({symbol:te.coin,twapId:fe}),{loading:`Terminating: ${te.coin} #${fe}...`,success:`Terminated: ${te.coin} #${fe}`,error:ae=>`Terminate failed: ${te.coin} #${fe} • ${(ae==null?void 0:ae.message)||ae}`},{position:"bottom-right",style:{background:"#1e1e1e",color:"#fff",fontSize:12}});const se=Aqe(t);if(se){const ae=String(fe);se.activeRows=se.activeRows.filter(W=>String(W.twapId??W.id)!==ae),se.hydratedActive=!0,m5(se),Eqe(se),_qe(se)}}finally{v(fe)}}},[N,P]=m.useState("active"),[T,M]=m.useState("active"),F=["active","history","fills"],$=F.indexOf(N)>F.indexOf(T)?"right":"left",L={enter:te=>({x:te==="right"?24:-24,opacity:0}),center:{x:0,opacity:1},exit:te=>({x:te==="right"?-24:24,opacity:0})};m.useEffect(()=>{const te=setInterval(()=>{},3e4);return()=>clearInterval(te)},[]);const z=(te,fe,q)=>te?i.jsxs("div",{className:"px-3 py-6 flex items-center gap-2 text-[#9B9B9B]",children:[i.jsx(f2,{size:14,color:"#9B9B9B"}),i.jsx("span",{children:q})]}):i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:fe}),X=m.useMemo(()=>[{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const q=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",se=jo(),ae=()=>se(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${fe.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${q}`,children:te||"--"})]})}},{key:"sz",label:"Size",sortable:!0,sortValue:te=>te.sz,render:(te,fe)=>{const q=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return i.jsxs("span",{className:q,children:[Lv(te)," ",fe.coin]})}},{key:"executedSz",label:"Executed Size",sortable:!0,sortValue:te=>te.executedSz,render:(te,fe)=>{const q=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]";return te&&Number(te)!==0?i.jsxs("span",{className:q,children:[Lv(te)," ",fe.coin]}):i.jsx("span",{className:"text-[#9B9B9B]",children:"--"})}},{key:"avgPx",label:"Average Price",sortable:!0,sortValue:te=>te.avgPx||0,render:te=>te?i.jsx("span",{className:"text-white font-semibold",children:T7(te,0)}):"--"},{key:"runtime",label:"Running Time / Total",sortable:!0,sortValue:te=>te.runtimeMs??0,render:(te,fe)=>(Math.max(0,Math.floor((Date.now()-fe.timestamp)/6e4)),i.jsxs("span",{className:"text-white font-semibold",children:[sgn(fe.runtimeMs??0)," / ",fe.minutes," minutes"]}))},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:te=>te.reduceOnly?1:0,render:te=>i.jsx("span",{className:"text-white font-semibold",children:WQ(te)})},{key:"timestamp",label:"Creation Time",sortable:!0,sortValue:te=>te.timestamp,render:te=>i.jsx("span",{className:"text-white font-semibold",children:VQ(te)})},{key:"errors",label:"Errors",sortable:!1,render:te=>i.jsx("span",{className:"text-[#9B9B9B] font-semibold",children:te||"--"})},{key:"terminate",label:"Terminate",sortable:!1,render:(te,fe)=>{const q=fe.twapId??Number(fe.id),se=g(q);return i.jsx("button",{onClick:ae=>{ae.stopPropagation(),se||C(fe)},disabled:se,className:`h-6 w-6 flex items-center justify-center rounded-md border text-[#FF797C]
transition-colors duration-150 p-1 text-[11px]
border-red-500/50 mb-[1px] ${se?"opacity-60 cursor-not-allowed bg-red-500/10":"bg-red-500/20"}`,title:se?"Terminating...":"Terminate",children:se?i.jsx(f2,{size:12,color:"#FF797C"}):"×"})}}],[f,t]),ne=m.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:te=>te.time,render:te=>i.jsx("span",{className:"text-white font-semibold",children:VQ(te)})},{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const q=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",se=jo(),ae=()=>se(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${fe.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${q}`,children:te||"--"})]})}},{key:"totalSz",label:"Total Size",sortable:!0,sortValue:te=>te.totalSz,render:(te,fe)=>i.jsxs("span",{className:fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",children:[Lv(te)," ",fe.coin]})},{key:"executedSz",label:"Executed Size",sortable:!0,sortValue:te=>te.executedSz,render:(te,fe)=>i.jsxs("span",{className:fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",children:[Lv(te)," ",fe.coin]})},{key:"avgPx",label:"Average Price",sortable:!0,sortValue:te=>te.avgPx||0,render:te=>te?i.jsx("span",{className:"text-white font-semibold",children:T7(te,0)}):"--"},{key:"totalMinutes",label:"Total Runtime",sortable:!0,sortValue:te=>te.totalMinutes,render:te=>i.jsxs("span",{className:"text-white font-semibold",children:[Lv(te,0)," minutes"]})},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:te=>te.reduceOnly?1:0,render:te=>i.jsx("span",{className:"text-white font-semibold",children:WQ(te)})},{key:"randomize",label:"Randomize",sortable:!0,sortValue:te=>te.randomize?1:0,render:te=>i.jsx("span",{className:"text-white font-semibold",children:WQ(te)})},{key:"status",label:"Status",sortable:!0,sortValue:te=>te.status||"",render:te=>i.jsx("span",{className:"text-white font-semibold",children:te||"--"})}],[]),J=m.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:te=>te.time,render:(te,fe)=>i.jsx("span",{className:"text-white font-semibold",children:VQ(fe.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:te=>te.coin||"",render:(te,fe)=>{const q=fe.side==="A"||fe.side==="Buy"?"text-[#FF797C]":"text-[#67FFBD]",se=jo(),ae=()=>se(`/terminal/hyperliquid/${fe.coin}`);return i.jsxs("div",{onPointerDown:ae,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${fe.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:fe.coin}),i.jsx("span",{className:`font-bold ${q}`,children:te||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:te=>agn(te.dir),render:te=>i.jsx("span",{className:`${NM(te)?"text-[#FF6B6B]":SM(te)?"text-[#67FFBD]":"text-white"}`,children:te||"--"})},{key:"px",label:"Price",sortable:!0,sortValue:te=>te.px,render:te=>te!=null?i.jsxs("span",{className:"text-white font-semibold",children:["$",T7(te,0)]}):"--"},{key:"sz",label:"Size",sortable:!0,sortValue:te=>te.sz,render:te=>i.jsx("span",{className:"text-white font-semibold",children:Lv(te)})},{key:"tradeValue",label:"Trade Value",sortable:!0,sortValue:te=>te.px*te.sz,render:(te,fe)=>fe.px&&fe.sz?i.jsxs("span",{className:"text-white font-semibold",children:["$",T7(fe.px*fe.sz)]}):"--"},{key:"fee",label:"Fee",sortable:!0,sortValue:te=>te.fee,render:te=>i.jsx("span",{className:"text-white font-semibold",children:Lv(te)})},{key:"closedPnl",label:"Closed PnL",sortable:!0,sortValue:te=>te.closedPnl-te.fee,render:(te,fe)=>{const q=Number(fe.closedPnl||0)-Number(fe.fee||0),se=q>0,ae=q<0;return i.jsxs("span",{className:`${se?"text-[#67FFBD] font-semibold":ae?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:["$",T7(Math.abs(q))]})}},{key:"oid",label:"Order ID",sortable:!0,sortValue:te=>te.oid,render:te=>i.jsx("span",{className:"text-[#979797] font-semibold",children:te||"--"})}],[]),K=i.jsx("div",{className:"px-3",children:i.jsx("div",{className:"relative flex gap-2 overflow-x-auto whitespace-nowrap py-2",children:[{k:"active",t:"Active"},{k:"history",t:"History"},{k:"fills",t:"Fill History"}].map(te=>{const fe=N===te.k;return i.jsxs("button",{onClick:()=>{M(N),P(te.k)},className:`relative cursor-pointer font-inter text-[12px] leading-[15px] px-4 py-[6px] flex items-center justify-center gap-[10px] rounded-lg bg-transparent ${fe?"text-white":"text-[#929292] hover:text-white"}`,children:[fe&&i.jsx(Ao.span,{layoutId:"twap-pill",className:"absolute inset-0 rounded-lg bg-[#262626]",transition:{type:"spring",stiffness:380,damping:30}}),i.jsx("span",{className:"relative z-10",children:te.t})]},te.k)})})});return i.jsxs("div",{className:"flex flex-col h-full",children:[K,i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx(nP,{mode:"wait",custom:$,children:i.jsx(Ao.div,{custom:$,variants:L,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:320,damping:28},className:"absolute inset-0",children:N==="active"?i.jsx(zu,{data:u1(u,"twap",d),loading:s||!l,columns:X,rowHeight:28,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[12px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:te=>te.id,emptyState:z(s||!l,"No Active TWAP","Loading Active TWAP…")}):N==="history"?i.jsx(zu,{data:u1(n,"twap",d),loading:a,columns:ne,rowHeight:28,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[12px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:te=>te.id,emptyState:z(a,"No TWAP History","Loading TWAP History…")}):i.jsx(zu,{data:u1(r,"twap",d),loading:o,columns:J,rowHeight:28,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[12px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:te=>te.id,emptyState:z(o,"No TWAP fills available","Loading TWAP fills…")})},N)})})]})}const lgn="wss://api.hyperliquid.xyz/ws",cgn="https://api-ui.hyperliquid.xyz/info",ugn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},dgn=t=>ugn[t]||t;function fgn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function P7(t,e=2){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function Pse(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Ise(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function hgn(t){return Pse(t)?1:Ise(t)?0:-1}function pgn(t){const e=Date.now(),n=Math.max(0,e-Number(t||0)),r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);return a<24?`${a}h ${s%60}m ago`:`${Math.floor(a/24)}d ${a%24}h ago`}function mgn(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${s} - ${a}:${o}:${l}`}const GQ=new Map;function xgn(t,e=!0){const n=(t==null?void 0:t.toLowerCase())||"";if(!n)return null;GQ.has(n)||GQ.set(n,{key:n,rows:[],loading:!0,ws:null,ping:null,subs:new Set,booting:!1,connected:!1,hydrated:!1,aggregateByTime:e});const r=GQ.get(n);return r.aggregateByTime=e,r}function Fse(t){t.subs.forEach(e=>e({rows:t.rows,loading:t.loading}))}function AM(t){var e;try{(e=t.ws)==null||e.close()}catch{}t.ws=null,t.ping&&(clearInterval(t.ping),t.ping=null),t.connected=!1}function kqe(t){const n=(Array.isArray(t)?t:[]).map(s=>({id:`${(s==null?void 0:s.hash)||""}`,oid:s==null?void 0:s.oid,coin:s==null?void 0:s.coin,dir:(s==null?void 0:s.dir)||((s==null?void 0:s.side)==="B"?"Buy":(s==null?void 0:s.side)==="S"?"Sell":""),px:Number((s==null?void 0:s.px)||0),sz:Number((s==null?void 0:s.sz)||0),fee:Number((s==null?void 0:s.fee)||0),feeToken:(s==null?void 0:s.feeToken)||"USDC",closedPnl:Number((s==null?void 0:s.closedPnl)||0),time:Number((s==null?void 0:s.time)||0)})),r=new Map;return n.forEach(s=>{s.id&&!r.has(s.id)&&r.set(s.id,s)}),[...r.values()].sort((s,a)=>a.time-s.time)}async function ggn(t){try{t.loading=!0,Fse(t);const n=await(await fetch(cgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({aggregateByTime:!!t.aggregateByTime,type:"userFills",user:t.key})})).json();t.rows=kqe(n||[]),t.hydrated=!0}catch{t.rows=[]}finally{t.loading=!1,Fse(t)}}function lAe(t,e){const n=(e==null?void 0:e.fills)||e||[];if(!Array.isArray(n)||!n.length)return;const r=kqe(n),s=[...t.rows],a=new Set(s.map(o=>o.id));r.forEach(o=>{a.has(o.id)||(s.unshift(o),a.add(o.id))}),s.sort((o,l)=>l.time-o.time),t.rows=s,Fse(t)}async function Tqe(t){if(t.booting||t.connected)return;t.booting=!0,AM(t);const e=new WebSocket(lgn);t.ws=e,e.onopen=()=>{t.connected=!0,e.send(JSON.stringify({method:"subscribe",subscription:{aggregateByTime:!!t.aggregateByTime,type:"userFills",user:t.key}})),t.ping=setInterval(()=>{try{e.send(JSON.stringify({id:99,method:"ping"}))}catch{}},3e4)},e.onmessage=n=>{var r,s;try{const a=JSON.parse(n.data);if((a==null?void 0:a.method)==="pong"||(a==null?void 0:a.result)==="success")return;(a==null?void 0:a.channel)==="userFills"&&lAe(t,a==null?void 0:a.data),(a==null?void 0:a.channel)==="user"&&((r=a==null?void 0:a.data)!=null&&r.fills)&&lAe(t,(s=a==null?void 0:a.data)==null?void 0:s.fills)}catch{}},e.onclose=()=>{AM(t),setTimeout(()=>Tqe(t),1500)},e.onerror=()=>{AM(t)},t.booting=!1}function bgn(t,e){const n=(t==null?void 0:t.toLowerCase())||"",[r,s]=m.useState({rows:[],loading:!0});return m.useEffect(()=>{const a=xgn(n,e);if(!a){s({rows:[],loading:!1});return}const o=l=>s(l);return a.subs.add(o),s({rows:a.rows,loading:a.loading}),ggn(a),Tqe(a),()=>{a.subs.delete(o),a.subs.size===0&&AM(a)}},[n,e]),r}function ygn({walletAddress:t,listHeight:e=560}){const[n,r]=m.useState(()=>typeof window>"u"?!0:window.localStorage.getItem("tradeHistoryAggregate")!=="false");m.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem("tradeHistoryAggregate",n?"true":"false")},[n]);const{rows:s,loading:a}=bgn(t,n),[o,l]=m.useState(typeof window<"u"&&localStorage.getItem("isDateTradeHistoryFormat")||"date"),c=m.useRef(o);m.useEffect(()=>{typeof window<"u"&&localStorage.setItem("isDateTradeHistoryFormat",o),c.current=o},[o]);const{key:u}=B2(),{isReferralCodeName:d}=m.useContext(Qr),[f,x]=m.useState(!1),[g,y]=m.useState({coin:"",type:"",leverage:0,roe:0,entryPrice:0,markPrice:0,referral:"",positionDistribution:0,pnl:0,closePx:0}),[v,C]=m.useState(()=>new Map),N=m.useCallback(async M=>{const F=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,$=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;if(!F||!$||!M||M.length===0)return null;try{const{data:L}=await ps.post("https://dextrabothypev2.nftinit.io/api/hyper/order/get_leverage_with_oids/",{address:F,token:$,position_oids:M},{headers:{"Content-Type":"application/json"}});if(L&&L.success){const z=parseFloat(L.leverage);return C(X=>{const ne=new Map(X);return M.forEach(J=>ne.set(String(J),z)),ne}),z}}catch(L){console.error("leverage fetch error:",L)}return null},[]);m.useEffect(()=>{if(f&&!g.referral){const M=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";M&&y(F=>({...F,referral:M}))}},[f,d,g.referral]);const P=m.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:M=>M.time,render:(M,F)=>i.jsx("button",{onClick:()=>l($=>$==="date"?"relative":"date"),className:"text-left text-white bg-transparent font-semibold",children:c.current==="date"?mgn(F.time):pgn(F.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:M=>M.coin||"",render:(M,F)=>{const $=jo(),L=()=>$(`/terminal/hyperliquid/${F.coin}`);return i.jsxs("div",{onPointerDown:L,className:"flex items-center text-white font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${dgn(F.coin)}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:F.coin}),i.jsx("span",{className:`font-bold ${Ise(F.dir)?"text-[#FF6B6B]":Pse(F.dir)?"text-[#67FFBD]":"text-white"}`,children:M||"--"})]})}},{key:"dir",label:"Direction",sortable:!0,sortValue:M=>hgn(M.dir),render:M=>i.jsx("span",{className:`font-semibold ${Ise(M)?"text-[#FF6B6B]":Pse(M)?"text-[#67FFBD]":"text-white"}`,children:M||"--"})},{key:"px",label:"Price",sortable:!0,sortValue:M=>M.px,render:M=>i.jsx("span",{className:"text-white font-semibold",children:P7(M)})},{key:"sz",label:"Size",sortable:!0,sortValue:M=>M.sz,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[fgn(M)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.coin})]})},{key:"tradeValue",label:"Trade Value",sortable:!0,sortValue:M=>M.px*M.sz,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[P7(F.px*F.sz)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]})},{key:"fee",label:"Fee",sortable:!0,sortValue:M=>M.fee,render:(M,F)=>i.jsxs("span",{className:"text-white font-semibold",children:[P7(M)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:F.feeToken||"USDC"})]})},{key:"netPnl",label:"Closed PnL",sortable:!0,sortValue:M=>M.closedPnl-M.fee,render:(M,F)=>{const $=Number(F.closedPnl||0),L=Number(F.fee||0),z=$-L,X=z>0,ne=z<0,J=!!$,K=Number(F.px||0)*Number(F.sz||0),te=K>0?z/K*100:0;return i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("span",{className:`${X?"text-[#67FFBD] font-semibold":ne?"text-[#FF797C] font-semibold":"text-white font-semibold"}`,children:[z===0?P7(0):`${z<0?"-":""}${P7(Math.abs(z))}`," ",i.jsx("span",{className:"text-[#9B9B9B]",children:"USDC"})]}),J&&i.jsx("button",{onClick:async()=>{const fe=d||typeof window<"u"&&window.localStorage.getItem("refcode")||"";let q=0;const se=F.oid;if(se){const ae=v.get(String(se));if(ae!=null)q=ae;else{const W=await N([se]);typeof W=="number"&&!Number.isNaN(W)&&(q=W)}}y({coin:F.coin||"",type:(F.dir||"").toUpperCase(),leverage:q,roe:te,entryPrice:Number(F.px||0),markPrice:Number(F.px||0),referral:fe,positionDistribution:0,pnl:Number(z||0),closePx:Number(F.px||0)}),x(!0)},className:"flex items-center h-6 text-[#67FFBD] text-[11px] font-semibold bg-transparent p-0",title:"Share",children:i.jsx("img",{src:Am,alt:"",className:"w-[14px] h-[14px] min-w-[14px] min-h-[14px]"})})]})}}],[o,d,N,v]),T=m.useMemo(()=>u1(s,"trades",u),[s,u]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center justify-end mt-2 px-1 mr-5",children:i.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-[#9B9B9B]",children:[i.jsx("span",{children:"Aggregate"}),i.jsx("input",{type:"checkbox",checked:n,onChange:M=>r(M.target.checked),className:"w-3 h-3 accent-[#67FFBD]"})]})}),i.jsx(zu,{data:T,loading:a,columns:P,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:M=>M.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No trades"})}),i.jsx(eP,{open:f,setOpen:x,data:g,setTradeInfo:y,pnlTitle:""})]})}const vgn="https://api.hyperliquid.xyz/info";function wgn(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function cAe(t,e=4){return`$${Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}`}function Cgn(t){return`${(Number(t||0)*100).toLocaleString(void 0,{maximumFractionDigits:6})}%`}function Sgn(t){const e=Date.now(),n=Math.max(0,e-Number(t||0)),r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);return a<24?`${a}h ${s%60}m ago`:`${Math.floor(a/24)}d ${a%24}h ago`}function Ngn(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${s} - ${a}:${o}:${l}`}function Agn({walletAddress:t,listHeight:e=560,days:n=30}){const[r,s]=m.useState([]),[a,o]=m.useState(!0),[l,c]=m.useState(typeof window<"u"&&localStorage.getItem("isDateFundingHistoryFormat")||"date"),{key:u}=B2(),d=m.useRef(l);m.useEffect(()=>{typeof window<"u"&&localStorage.setItem("isDateFundingHistoryFormat",l),d.current=l},[l]),m.useEffect(()=>{let x=!0;async function g(){if(!t){x&&(s([]),o(!1));return}try{o(!0);const y=Date.now()-n*24*60*60*1e3,C=await(await fetch(vgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"userFunding",user:t,startTime:y})})).json(),P=(Array.isArray(C)?C:Array.isArray(C==null?void 0:C.data)?C.data:[]).map((T,M)=>{const F=(T==null?void 0:T.delta)||{},$=Number((F==null?void 0:F.szi)||0),L=Number((F==null?void 0:F.fundingRate)||0),z=Number((F==null?void 0:F.usdc)||0);let X=$>0?"Long":$<0?"Short":null;return!X&&L!==0&&z!==0&&(X=L>0?z<0?"Long":"Short":z<0?"Short":"Long"),X||(X="Flat"),{id:`${T.time||M}-${F.coin||""}-${M}`,time:Number((T==null?void 0:T.time)||0),coin:(F==null?void 0:F.coin)||"",rate:Number((F==null?void 0:F.fundingRate)||0),size:$,amount:z,token:"USDC",side:X}}).sort((T,M)=>M.time-T.time);x&&s(P)}catch{x&&s([])}finally{x&&o(!1)}}return g(),()=>{x=!1}},[t,n]);const f=m.useMemo(()=>[{key:"time",label:"Time",sortable:!0,sortValue:x=>x.time,render:(x,g)=>i.jsx("button",{onClick:()=>c(y=>y==="date"?"relative":"date"),className:"text-left text-white bg-transparent font-semibold",children:d.current==="date"?Ngn(g.time):Sgn(g.time)})},{key:"coin",label:"Coin",sortable:!0,sortValue:x=>x.coin||"",render:(x,g)=>{const y=g.side==="Long"?"text-[#67FFBD]":g.side==="Short"?"text-[#FF6B6B]":"text-white",v=jo(),C=()=>v(`/terminal/hyperliquid/${g.coin}`);return i.jsxs("div",{onPointerDown:C,className:`flex items-center font-medium cursor-pointer hover:opacity-80 ${y}`,children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${g.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:g.coin}),i.jsx("span",{children:x||"--"})]})}},{key:"size",label:"Size",sortable:!0,sortValue:x=>x.size,render:(x,g)=>i.jsxs("span",{className:"text-white font-semibold",children:[wgn(x)," ",i.jsx("span",{className:"text-[#9B9B9B]",children:g.coin})]})},{key:"side",label:"Position Side",sortable:!0,sortValue:x=>x.side,render:x=>{const g=x==="Long"?"text-[#67ffbd] bg-[#67ffbd]/20":x==="Short"?"text-[#ff797c] bg-[#ff797c]/20":"text-[#9B9B9B] bg-[#9B9B9B]/10";return i.jsx("span",{className:`flex justify-center items-center h-5 px-2 py-1 rounded-md text-[11px] font-semibold uppercase ${g}`,children:x})}},{key:"amount",label:"Payment",sortable:!0,sortValue:x=>x.amount,render:x=>{const g=x>0?"text-[#67FFBD]":x<0?"text-[#FF6B6B]":"text-white";return i.jsx("span",{className:g,children:x===0?cAe(0):`${x<0?"-":""}${cAe(Math.abs(x))}`})}},{key:"rate",label:"Rate",sortable:!0,sortValue:x=>x.rate,render:x=>i.jsx("span",{className:"text-white font-semibold",children:Cgn(x)})}],[]);return i.jsx(zu,{data:u1(r,"funding",u),loading:a,columns:f,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:x=>x.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No funding records"})})}function WF(t,e=6){return Number(t||0).toLocaleString(void 0,{maximumFractionDigits:e})}function jgn(t){if(!t)return"--";const e=new Date(Number(t)),n=String(e.getDate()).padStart(2,"0"),r=String(e.getMonth()+1).padStart(2,"0"),s=e.getFullYear(),a=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${s} - ${a}:${o}:${l}`}function Egn(t){return t.side==="B"?t.reduceOnly?"Close Short":"Open Long":t.side==="A"?t.reduceOnly?"Close Long":"Open Short":t.side||"-"}function Ose(t){return t==="Open Long"||t==="Close Short"||t==="Short > Long"}function Mse(t){return t==="Open Short"||t==="Close Long"||t==="Long > Short"}function _gn(t){return Ose(t)?1:Mse(t)?0:-1}function kgn({walletAddress:t,listHeight:e=560}){const[n,r]=m.useState([]),[s,a]=m.useState(!1),{key:o}=B2();m.useEffect(()=>{let c=!0;async function u(){if(!t){c&&r([]);return}try{a(!0);const x=(await(await fetch("https://api.hyperliquid.xyz/info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"historicalOrders",user:t})})).json()||[]).map(g=>{var C;const y=g.order||{},v=Math.max(0,Number(y.origSz||0)-Number(y.sz||0));return{id:`${y.oid}-${g.status}`,time:Number(g.statusTimestamp||y.timestamp||0),type:y.orderType||"-",coin:y.coin||"-",sideText:Egn(y),size:Number(y.sz||0),filled:v,orderValue:(C=y.orderType)!=null&&C.toLowerCase().includes("market")?"Market":`${(Number(y.limitPx)/1e3).toFixed(2)} USDC`,priceLabel:y.orderType==="Market"?"Market":`${WF(Number(y.limitPx||0),2)} USD`,reduceOnly:!!y.reduceOnly,trigger:y.triggerCondition&&y.triggerCondition!=="N/A"?`${y.triggerCondition} @ ${WF(Number(y.triggerPx||0),4)}`:"N/A",status:g.status?g.status[0].toUpperCase()+g.status.slice(1):"-",orderId:y.oid}});x.sort((g,y)=>y.time-g.time),c&&r(x)}catch{c&&r([])}finally{c&&a(!1)}}return u(),()=>{c=!1}},[t]);const l=m.useMemo(()=>[{key:"time",label:"Time",width:"140px",sortable:!0,sortValue:c=>c.time,render:c=>i.jsx("span",{className:"text-white font-semibold",children:jgn(c)})},{key:"type",label:"Type",sortable:!0,sortValue:c=>c.type||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"coin",label:"Coin",sortable:!0,sortValue:c=>c.coin||"",render:(c,u)=>{const d=jo(),f=()=>d(`/terminal/hyperliquid/${u.coin}`);return i.jsxs("div",{onPointerDown:f,className:"flex items-center font-medium cursor-pointer hover:opacity-80",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${u.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2",alt:u.coin}),i.jsx("span",{className:`font-bold ${Mse(u.sideText)?"text-[#FF6B6B]":Ose(u.sideText)?"text-[#67FFBD]":"text-white"}`,children:c})]})}},{key:"sideText",label:"Side",sortable:!0,sortValue:c=>_gn(c.sideText),render:c=>i.jsx("span",{className:`font-semibold ${Mse(c)?"text-[#FF6B6B]":Ose(c)?"text-[#67FFBD]":"text-white"}`,children:c})},{key:"size",label:"Size",sortable:!0,sortValue:c=>c.size,render:c=>Number(c)>0?i.jsx("span",{className:"text-white font-semibold",children:WF(c)}):i.jsx("span",{className:"text-white font-semibold",children:"--"})},{key:"filled",label:"Filled",sortable:!0,sortValue:c=>c.filled,render:c=>Number(c)>0?i.jsx("span",{className:"text-white font-semibold",children:WF(c)}):i.jsx("span",{className:"text-white font-semibold",children:"--"})},{key:"orderValue",label:"Order Value",sortable:!0,sortValue:c=>c.orderValue,render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"priceLabel",label:"Price",sortable:!0,sortValue:c=>c.priceLabel==="Market"?-1:Number(String(c.priceLabel).replace(/[^0-9.]/g,"")),render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"reduceOnly",label:"Reduce",sortable:!0,sortValue:c=>c.reduceOnly?1:0,render:c=>i.jsx("span",{className:"text-whitefont-semibold",children:c?"✓":"–"})},{key:"trigger",label:"Trigger",sortable:!0,sortValue:c=>c.trigger||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c||"N/A"})},{key:"status",label:"Status",sortable:!0,sortValue:c=>c.status||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})},{key:"orderId",label:"Order ID",sortable:!0,sortValue:c=>c.trigger||"",render:c=>i.jsx("span",{className:"text-white font-semibold",children:c})}],[]);return i.jsx(zu,{data:u1(n,"orderHistory",o),columns:l,loading:s,skeletonRowCount:12,rowHeight:30,listHeight:e,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent !rounded-none",cellClassName:()=>"py-1 flex !text-[11px] font-normal",rowKey:c=>c.id})}const Tgn="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/list/",Pgn="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",Ign="https://dextrabothypev2.nftinit.io/api/hyper/gridbot/update/",Fgn="https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/update/";function uAe(t,e=4){const n=Number(t||0);return Number.isFinite(n)?n.toLocaleString(void 0,{maximumFractionDigits:e}):"--"}function Ogn(t,e=2){const n=Number(t||0);return Number.isFinite(n)?`$${n.toLocaleString(void 0,{maximumFractionDigits:e})}`:"--"}const Mgn={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"},I7=t=>{if(typeof t=="string"){const e=t.match(/^([A-Za-z]+:)(.*)$/);if(e){const n=e[1].toLowerCase(),r=e[2];return n+r}}return Mgn[t]||t},Rgn=t=>t&&t.length>10?`${t.slice(0,6)}...${t.slice(-4)}`:t||"--";function jM({walletAddress:t,sourceMarket:e="hyper"}){var $,L;const{botSlotsInfo:n,refreshBotSlots:r}=m.useContext(Qr)||{},[s,a]=m.useState([]),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState(0),[x,g]=m.useState(null),y=jo();m.useEffect(()=>{let z=!0;async function X(){if(typeof window>"u")return;const ne=window.localStorage.getItem("hyperAddress"),J=window.localStorage.getItem("hyperToken");if(!ne||!J){z&&(a([]),l(!1));return}try{l(!0);const te=await(await fetch(Tgn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ne,token:J})})).json(),q=(Array.isArray(te==null?void 0:te.data)?te.data:Array.isArray(te)?te:[]).filter(se=>e?se.source_market===e:!0);z&&a(q)}catch{z&&(a([]),tn.error("Failed to load bots"))}finally{z&&l(!1)}}return X(),()=>{z=!1}},[t,e,d]),m.useEffect(()=>{const z=X=>{const ne=X&&X.detail&&X.detail.sourceMarket;ne&&ne!==e||f(J=>J+1)};return window.addEventListener("gridbotUpdated",z),()=>{window.removeEventListener("gridbotUpdated",z)}},[e]);const v=m.useMemo(()=>{const z=s.map(X=>{const ne=X.bot_params||{},J=ne.investment||{},K=ne.priceRange||{},te=ne.liquidationPrices||{},fe=ne.direction==="long"?"Long":ne.direction==="short"?"Short":"--";return{id:X.id,coin:X.coin||ne.symbol||"--",market:X.source_market||"",status:X.is_deleted?"Stopped":"Active",side:fe,gridType:ne.gridType||"--",gridCount:ne.gridCount??"--",lower:K.lower??null,upper:K.upper??null,currentPrice:ne.currentPrice??null,leverage:J.leverage??null,collateral:J.collateral??null,totalInvestment:J.totalInvestment??null,liqLong:te.long??null,liqShort:te.short??null,trailingUp:ne.trailing_up??null,trailingDown:ne.trailing_down??null,slUp:ne.sl_up??null,slDown:ne.sl_down??null,timestamp:ne.timestamp||null,walletName:X.wm_name||null,walletAddress:X.wm_address||null,walletId:X.wallet_id??null,raw:X}});return z.sort((X,ne)=>{const J=X.status==="Active",K=ne.status==="Active";if(J!==K)return J?-1:1;const te=X.timestamp?new Date(X.timestamp).getTime():0;return(ne.timestamp?new Date(ne.timestamp).getTime():0)-te}),z},[s]),C=async(z,X)=>{var K,te,fe;if(!z||!z.raw||typeof window>"u")return;const ne=window.localStorage.getItem("hyperAddress"),J=window.localStorage.getItem("hyperToken");if(!ne||!J){tn.error("Please sign in to manage bots");return}try{u(z.id);const q={is_deleted:X,bot_params:z.raw.bot_params||{}},se=String(((K=z.raw)==null?void 0:K.source_market)||"").toLowerCase().includes("lighter")?Ign:String(((te=z.raw)==null?void 0:te.source_market)||"").toLowerCase().includes("extended")?Fgn:Pgn,W=await(await fetch(se,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ne,token:J,bot_id:z.id,update_params:q})})).json().catch(()=>null);if(!(W!=null&&W.success)){const V=(W==null?void 0:W.error_message)||(W==null?void 0:W.message)||(W==null?void 0:W.detail)||"Failed to update bot";throw new Error(V)}tn.success(X?"Bot stopped":"Bot started"),a(V=>V.map(ee=>ee.id===z.id?{...ee,is_deleted:X}:ee)),r==null||r(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:((fe=z.raw)==null?void 0:fe.source_market)||e}})),f(V=>V+1)}catch(q){tn.error(q.message||"Failed to update bot")}finally{u(null)}},N=z=>{if(!z||!z.raw||typeof window>"u")return;const X=z.status==="Active",ne=(J,K)=>{var ae,W,V,ee;const te=((ae=J==null?void 0:J.raw)==null?void 0:ae.wallet_id)??(J==null?void 0:J.walletId),fe=((W=K==null?void 0:K.raw)==null?void 0:W.wallet_id)??(K==null?void 0:K.walletId);if(te&&fe&&String(te)===String(fe))return!0;const q=((J==null?void 0:J.walletAddress)||((V=J==null?void 0:J.raw)==null?void 0:V.wm_address)||"").toLowerCase(),se=((K==null?void 0:K.walletAddress)||((ee=K==null?void 0:K.raw)==null?void 0:ee.wm_address)||"").toLowerCase();return!!(q&&se&&q===se)};if(!X){if(v.some(K=>{var te,fe;return K.id!==z.id&&K.status==="Active"&&((te=K.raw)==null?void 0:te.source_market)===((fe=z.raw)==null?void 0:fe.source_market)&&ne(K,z)})){tn.error("You already have an active bot on this wallet. Please add an account.");return}g(z);return}C(z,X)},P=()=>g(null),T=()=>{x&&(C(x,!1),g(null))},M=z=>{var te,fe,q;if(!z)return;const X=z.coin;if(!X)return;const ne=((te=z.raw)==null?void 0:te.source_market)||z.market||e,J=z.status==="Active",K={sourceMarket:ne,coin:X,botParams:((fe=z.raw)==null?void 0:fe.bot_params)||{},walletId:(q=z.raw)==null?void 0:q.wallet_id,isActive:J};if(typeof window<"u"){try{window.localStorage.setItem("gridbot:pending_selection",JSON.stringify(K))}catch{}window.dispatchEvent(new CustomEvent("gridbotSelectFromTasks",{detail:K}))}y(ne==="hyper"?`/terminal/hyperliquid/${I7(X)}#gridbot`:ne==="lighter"?`/terminal/lighter/${I7(X)}#gridbot`:`/terminal/extended/${I7(X)}#gridbot`)},F=m.useMemo(()=>[{key:"status",label:"Status",sortable:!0,sortValue:z=>z.status==="Active"?1:0,render:z=>{const X=z==="Active"?"text-[#67ffbd] bg-[#67ffbd]/15":"text-[#9B9B9B] bg-[#9B9B9B]/10";return i.jsx("span",{className:`inline-flex h-6 items-center justify-center px-2 py-[2px] rounded-md text-[11px] font-semibold ${X}`,children:z})}},{key:"coin",label:"Coin",sortable:!0,sortValue:z=>z.coin||"",render:(z,X)=>{var te;const ne=jo(),J=String(((te=X.raw)==null?void 0:te.source_market)||X.market||e||"").toLowerCase();J.includes("lighter")||J.includes("extended");const K=()=>ne(`/terminal/${J}/${I7(X.coin)}${X.status==="Active"||X.status==="Stopped"?"#gridbot":""}`);return i.jsxs("div",{onPointerDown:K,className:"flex items-center gap-2 text-white font-medium hover:opacity-80 cursor-pointer",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${I7(z)}.svg`,onError:oa,className:"w-4 h-4",alt:z}),i.jsx("span",{children:z.replace("XYZ:","")||"--"})]})}},{key:"wallet",label:"Wallet",sortable:!0,sortValue:z=>z.walletName||z.walletAddress||"",render:(z,X)=>{const ne=X.walletName||"Wallet",J=X.walletAddress?Rgn(X.walletAddress):"--";return i.jsxs("div",{className:"flex flex-col leading-[14px]",children:[i.jsx("span",{className:"text-white font-medium",children:ne}),i.jsx("span",{className:"text-[10px] text-white/60",children:J})]})}},{key:"gridCount",label:"Grids",sortable:!0},{key:"lower",label:"Lower",sortable:!0,render:z=>z==null?"--":i.jsx("span",{className:"text-[#67FFBD] font-semibold",children:uAe(z)})},{key:"upper",label:"Upper",sortable:!0,render:z=>z==null?"--":i.jsx("span",{className:"text-[#FF797C] font-semibold",children:uAe(z)})},{key:"investment",label:"Investment",sortable:!0,sortValue:z=>z.totalInvestment??z.collateral??0,render:(z,X)=>i.jsx("div",{className:"flex flex-col leading-[14px]",children:i.jsx("span",{className:"text-white font-semibold",children:X.collateral!=null?Ogn(X.collateral):"--"})})},{key:"leverage",label:"Lev",sortable:!0,render:z=>z==null?"--":`${z}x`},{key:"gridType",label:"Grid Type",sortable:!0},{key:"actions",label:"Actions",render:(z,X)=>{const ne=X.status==="Active",J=c===X.id;return i.jsxs("div",{className:"relative z-10 flex items-center justify-start gap-2",onClick:K=>K.stopPropagation(),onMouseDown:K=>K.stopPropagation(),children:[i.jsx("button",{type:"button",onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),M(X)},className:"h-6 flex justify-center items-center px-2 rounded-md text-[11px] font-semibold bg-[#161616] text-[#E5E7EB] hover:bg-[#1F2933]",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4Z"})]})}),i.jsx("button",{type:"button",disabled:J,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),N(X)},className:`h-6 flex justify-center items-center px-3 rounded-md text-[11px] font-semibold ${ne?"bg-[#2a1616] text-[#ff797c] hover:bg-[#3a1c1c]":"bg-[#101613] text-[#67ffbd] hover:bg-[#19201b]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:J?"Saving...":ne?"Stop":"Start"})]})}}],[c]);return i.jsxs(i.Fragment,{children:[i.jsx(zu,{data:v,loading:o,columns:F,rowHeight:32,listHeight:560,tableClassName:"mt-2",theadClassName:"sticky top-0 z-10 whitespace-nowrap rounded-2xl px-2 py-2 flex !rounded-none bg-transparent !text-[#9B9B9B] font-inter !text-[11px] not-italic font-semibold leading-[13px] tracking-[-0.13px]",tbodyClassName:"px-1",rowClassName:"border-b border-[#1E1E1E] bg-transparent",cellClassName:()=>"py-1 text-[11px] font-normal",rowKey:z=>z.id,emptyState:i.jsx("div",{className:"px-3 py-6 text-[#9B9B9B]",children:"No bots for this market"})}),i.jsx(yp,{isOpen:!!x,onClose:P,children:i.jsxs("div",{className:"w-[320px] sm:w-[380px] rounded-2xl bg-[#050505] px-6 py-5 text-[#E5E7EB]",onClick:z=>z.stopPropagation(),children:[i.jsxs("div",{className:"text-sm font-semibold text-white",children:["Start"," ",String((($=x==null?void 0:x.raw)==null?void 0:$.source_market)||"").toLowerCase().includes("lighter")?"Lighter":String(((L=x==null?void 0:x.raw)==null?void 0:L.source_market)||"").toLowerCase().includes("extended")?"Extended":"Hyperliquid"," ","Grid Bot?"]}),i.jsxs("p",{className:"mt-3 text-[13px] text-[#9B9B9B]",children:["You are starting the"," ",i.jsx("span",{className:"text-white font-bold",children:x==null?void 0:x.coin})," ","grid bot. Make sure your parameters are correct."]}),i.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[i.jsx("button",{type:"button",onClick:P,className:"h-9 rounded-xl border border-[#2c2c2c] px-4 text-[12px] font-semibold text-[#9B9B9B] transition hover:border-[#3f3f3f] hover:text-white",children:"Cancel"}),i.jsx("button",{type:"button",onClick:T,className:"h-9 rounded-xl bg-[#67FFBD] px-4 text-[12px] font-semibold text-black transition hover:brightness-105",children:"Start Bot"})]})]})})]})}function Lgn(){const[t,e]=m.useState(()=>typeof window>"u"?!1:localStorage.getItem("hide_small_balances")==="1");return m.useEffect(()=>{typeof window<"u"&&(localStorage.setItem("hide_small_balances",t?"1":"0"),window.dispatchEvent(new CustomEvent("balances:hide-small-changed",{detail:{value:t}})))},[t]),i.jsxs("label",{className:"inline-flex items-center gap-2 text-[12px] text-white mr-3 mt-1.5",children:[i.jsx("input",{type:"checkbox",className:"accent-[#67FFBD] w-[14px] h-[14px]",checked:t,onChange:n=>e(n.target.checked)}),"Hide Small Balances"]})}function Dgn(t){const{data:e,loading:n,error:r,isDigits:s,period:a,periods:o,handlePeriodChange:l,className:c="",minHeight:u="min-h-[560px]",walletAddress:d,coin:f,sourceMarket:x="hyper"}=t,{setSignInConnectButtonOpen:g}=m.useContext(Qr),[y,v]=m.useState(()=>typeof window>"u"?d||null:window.localStorage.getItem("hl_selected_wallet_address")||d||null);m.useEffect(()=>{const de=()=>{if(typeof window>"u"){v(d||null);return}const Ce=window.localStorage.getItem("hl_selected_wallet_address");v(Ce||d||null)};return de(),window.addEventListener("hl_selected_wallet_changed",de),window.addEventListener("storage",de),()=>{window.removeEventListener("hl_selected_wallet_changed",de),window.removeEventListener("storage",de)}},[d]);const C=y||d||null,[N,P]=m.useState(()=>C);m.useEffect(()=>{C&&P(C)},[C]);const T=C||N||null,[M,F]=m.useState({address:null,token:null}),[$,L]=m.useState(!1);m.useEffect(()=>{const de=()=>{const Ce=typeof window<"u"?localStorage.getItem("hyperAddress"):null,me=typeof window<"u"?localStorage.getItem("hyperToken"):null;F({address:Ce,token:me}),L(!0)};return de(),window.addEventListener("localStorageUpdated",de),window.addEventListener("storage",de),()=>{window.removeEventListener("localStorageUpdated",de),window.removeEventListener("storage",de)}},[]);const z=!!(M.address&&M.token),X=de=>de==="balances"?"Connect your wallet to see your balances":de==="positions"?"Connect your wallet to see your positions":de==="open"?"Connect your wallet to see your open orders":de==="twap"?"Connect your wallet to see your TWAP orders":de==="trades"?"Connect your wallet to see your trade history":de==="funding"?"Connect your wallet to see your funding history":de==="orders"?"Connect your wallet to see your order history":"Connect your wallet to continue",ne=(de,Ce)=>$?z?de:i.jsxs("div",{className:"w-full h-full flex flex-col items-center py-10 gap-3",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6]",children:X(Ce)}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>g(!0)})})]}):de,K=`terminalTabs:${typeof window<"u"?window.location.pathname:"tt"}`,[te,fe]=m.useState(()=>typeof window>"u"?"balances":localStorage.getItem(K)||"balances"),q=lqe(T),se=dmn(T),ae=[{k:"balances",t:"Balances"},{k:"positions",t:`Positions${z&&Number.isFinite(q)?` (${q})`:""}`},{k:"open",t:`Open Orders${z&&Number.isFinite(se)?` (${se})`:""}`},{k:"twap",t:"TWAP"},{k:"trades",t:"Trade History"},{k:"funding",t:"Funding History"},{k:"orders",t:"Order History"},{k:"all",t:"Top Traders"},{k:"bots",t:"Bot Tasks"}];m.useEffect(()=>{ae.map(Ce=>Ce.k).includes(te)||fe("balances")},[ae,te]),m.useEffect(()=>{typeof window<"u"&&localStorage.setItem(K,te)},[te,K]),m.useEffect(()=>{const de=Ce=>{var xe;const me=(xe=Ce==null?void 0:Ce.detail)==null?void 0:xe.tab,we=ae.map(be=>be.k);me&&we.includes(me)&&fe(me)};return window.addEventListener("terminal:setTab",de),()=>window.removeEventListener("terminal:setTab",de)},[ae]);const W=de=>{fe(de)},V=(T||"no-wallet").toLowerCase();let ee;te==="balances"?ee=i.jsx(Fxn,{walletAddress:T}):te==="positions"?ee=i.jsx(Uxn,{walletAddress:T,coin:f}):te==="open"?ee=i.jsx(Zxn,{walletAddress:T}):te==="twap"?ee=i.jsx(ogn,{walletAddress:T}):te==="trades"?ee=i.jsx(ygn,{walletAddress:T}):te==="funding"?ee=i.jsx(Agn,{walletAddress:T}):te==="orders"?ee=i.jsx(kgn,{walletAddress:T}):te==="bots"?ee=i.jsx(jM,{walletAddress:T,sourceMarket:x}):te==="all"?ee=i.jsx(mxn,{data:e,loading:n,error:r,isDigits:s,period:a,periods:o,handlePeriodChange:l}):ee=i.jsx("div",{className:"h-full"});const oe=te==="all"?ee:ne(ee,te);return i.jsx(dxn,{children:i.jsxs("div",{className:`bg-[#101010] rounded-2xl flex flex-col h-full ${u} overflow-hidden ${c}`,children:[i.jsx("div",{className:"px-3",children:i.jsxs("div",{className:"relative flex overflow-x-auto whitespace-nowrap pt-2 -mb-3",children:[ae.map(de=>{const Ce=te===de.k;return i.jsxs("button",{onClick:()=>W(de.k),className:`relative cursor-pointer font-inter text-[13px] font-normal leading-[16px] px-2 py-[6px] flex items-center justify-center gap-[10px] text-xs rounded-lg bg-transparent ${Ce?"text-white":"text-[#929292] hover:text-white"}`,children:[Ce&&i.jsx("span",{className:"absolute inset-0 rounded-lg bg-[#262626]"}),i.jsx("span",{className:"relative z-10",children:de.t})]},de.k)}),i.jsx("div",{className:"absolute right-3 top-2 hidden md:flex items-center gap-3",children:te==="balances"?i.jsx(Lgn,{}):i.jsx(fxn,{})})]})}),i.jsx("div",{className:"flex-1 min-h-0 relative",children:i.jsx("div",{className:"absolute inset-0",children:oe})})]})},V)}function tfe(){const[t,e]=m.useState([]),n=["XAG","XAU","USDKRW","USDJPY","USDCAD","USDCHF","NZDUSD","AUDUSD","GBPUSD","EURUSD","HOOD"];return m.useEffect(()=>{let r=!1,s=!1;async function a(){if(!s){s=!0;try{const c=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/orderBookDetails")).json(),u=((c==null?void 0:c.order_book_details)||[]).filter(d=>!n.includes(d.symbol)).map(d=>{const f=Number(d.last_trade_price??0),x=Number(d.daily_price_low??0),g=Number(d.daily_price_high??0),y=Number(d.daily_price_change??0),v=Number(d.daily_quote_token_volume??0),C=Number(d.open_interest??0),N=f>0?C*f:null;return{symbol:d.symbol,last:f,chg24:y,vol:v,funding:null,openInterest:N,marketId:d.market_id,priceDecimals:d.supported_price_decimals??d.price_decimals??6,sizeDecimals:d.supported_size_decimals??d.size_decimals??0,minBaseAmount:Number(d.min_base_amount??0),minQuoteAmount:Number(d.min_quote_amount??0),raw:d}});r||e(u)}catch{r||e([])}s=!1}}a();const o=setInterval(a,5e3);return()=>{r=!0,clearInterval(o),s=!1}},[]),t}const Bgn="https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=extended",$gn="https://dextrabothypesocketv2.nftinit.io/",Ugn='J5a5j28NeLpQbf"=h',zgn=6e4,Hgn=t=>{if(t==null||t==="")return null;const e=Number(t);return Number.isFinite(e)?e:null},og=(...t)=>{for(const e of t){const n=Hgn(e);if(n!=null)return n}return null},Pqe=t=>String(t||"").trim().toUpperCase(),Vgn=t=>Pqe(t).replace(/-USD$/,"").replace(/\/USD$/,"");function Wgn(t,e){var N;if(!t||typeof t!="object")return null;const n=Pqe(t.value||t.symbol||t.market||t.coin||t.label),r=Vgn(t.label||t.assetName||t.uiName||n);if(!n&&!r)return null;const s=t.marketStats||{},a=og(s.lastPrice,s.markPrice,s.indexPrice,t.lastPrice,t.markPrice,t.last),o=og(s.markPrice,t.markPrice,s.lastPrice,t.lastPrice,a),l=og(t.volume,s.dailyVolume,t.vol),c=og(s.fundingRate,t.fundingRate,t.funding),u=og(s.openInterestBase,t.openInterestBase),d=og(s.openInterest,t.openInterestUsd,t.openInterest),f=og((N=t==null?void 0:t.tradingConfig)==null?void 0:N.maxLeverage,t.maxLeverage,t.leverage,t.max_leverage);let x=null;const g=og(s.dailyPriceChange,t.dailyPriceChange);if(g!=null&&a!=null){const P=a-g;P&&(x=g/P*100)}if(x==null){const P=og(s.dailyPriceChangePercentage,t.dailyPriceChangePercentage,t.change24hPct,t.chg24);P!=null&&(x=Math.abs(P)<=1?P*100:P)}const y=r||n,v=Number.isFinite(x)?x:null,C=t.market_index??t.marketIndex??t.marketId??t.market_id??t.idx??t.id??e??null;return{...t,symbol:y,coin:y,rawSymbol:n||y,last:a,lastPrice:a,markPrice:o,change24hPct:v,chg24:v,volume:l,vol:l,fundingRate:c,funding:c,openInterest:u??d,openInterestUsd:d??(u!=null&&a!=null?u*a:null),leverage:f,maxLeverage:f??t.maxLeverage,marketStats:s,source:"extended",market_index:C,marketIndex:C,marketId:C,market_id:C,_idx:e}}const tf={rows:[],subs:new Set,started:!1,socket:null,timer:null};function qgn(){for(const t of tf.subs)try{t(tf.rows)}catch{}}function Iqe(t){var e,n,r;return t?Array.isArray(t)?t:Array.isArray(t==null?void 0:t.data)?t.data:Array.isArray((e=t==null?void 0:t.data)==null?void 0:e.data)?t.data.data:Array.isArray(t==null?void 0:t.coins)?t.coins:Array.isArray((n=t==null?void 0:t.data)==null?void 0:n.coins)?t.data.coins:Array.isArray(t==null?void 0:t.markets)?t.markets:Array.isArray((r=t==null?void 0:t.data)==null?void 0:r.markets)?t.data.markets:t!=null&&t.marketStats||t!=null&&t.tradingConfig||t!=null&&t.value||t!=null&&t.symbol||t!=null&&t.label?[t]:[]:[]}function Fqe(t){const e=t.map((n,r)=>Wgn(n,r)).filter(n=>n&&n.symbol);return e.length?(tf.rows=e,qgn(),!0):!1}function dAe(t){const e=Iqe(t);return e.length?Fqe(e):!1}async function fAe(){try{const e=await(await fetch(Bgn)).json(),n=Iqe(e);if(!n.length)return;Fqe(n)}catch{}}function Ggn(){if(!tf.started){tf.started=!0,fAe(),tf.timer=setInterval(()=>{tf.socket&&tf.socket.connected||fAe()},zgn);try{const t=Dy($gn);tf.socket=t;const e=()=>{try{t.emit("extended_feed_subscribe",{password:Ugn},r=>dAe(r))}catch{}};t.on("connect",e),t.io.on("reconnect",e);const n=new Set(["connect","disconnect","connect_error","reconnect_attempt","reconnect_error"]);t.onAny((r,...s)=>{if(!(!s.length||n.has(r))){for(const a of s)if(dAe(a))return}})}catch{}}}function nfe(){const[t,e]=m.useState(tf.rows);return m.useEffect(()=>{Ggn();const n=r=>e(r);return tf.subs.add(n),tf.rows.length&&e(tf.rows),()=>{tf.subs.delete(n)}},[]),t}const Kgn=["arithmetic","geometric"];function Ygn(t,e,n,r){const s=Number(t),a=Number(e),o=Number(n);if(!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(o))return[];if(o<2||a<=s)return[];if(r==="geometric"){const c=Math.pow(a/s,1/(o-1));return Array.from({length:o},(u,d)=>s*Math.pow(c,d))}const l=(a-s)/(o-1);return Array.from({length:o},(c,u)=>s+l*u)}function hAe({entry:t,side:e,notionalUSD:n,maintenanceFrac:r,marginMode:s,accountValueUSD:a,isolatedMarginUSD:o}){const l=Number(t)||0,c=Math.abs(Number(n)||0);if(!l||!c)return null;const u=e==="buy"?1:-1,d=Math.max(0,Number(r)||0),f=c/l,x=c*d;let g;s==="Cross"?g=a-x:g=o-x;const y=1-d*u;if(!f||!isFinite(y))return null;const v=l-u*(g/f)/y;return Math.max(0,v)}function pAe({coin:t,midPrice:e,selectedPrice:n,wallet:r,onLevelsChange:s}){const a=tfe(),[o]=m.useState("short"),[l,c]=m.useState(""),[u,d]=m.useState(""),[f,x]=m.useState(2),[g,y]=m.useState("2"),[v,C]=m.useState(""),[N,P]=m.useState("arithmetic"),[T,M]=m.useState(""),[F,$]=m.useState(0),[L,z]=m.useState(10),[X,ne]=m.useState(!1),[J,K]=m.useState(!1),[te,fe]=m.useState(!1),[q,se]=m.useState(50),[ae,W]=m.useState([]),[V,ee]=m.useState(!1),[oe,de]=m.useState(0),[Ce,me]=m.useState(!1),[we,xe]=m.useState(!1),[be,je]=m.useState(0),[Ie,Re]=m.useState(!1),[Qe,Ke]=m.useState(0),[dt,tt]=m.useState(!1),[nt,Le]=m.useState(!0),[Be,ht]=m.useState(!1),[pt,Gt]=m.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),wt=m.useRef(!1),{refreshBotSlots:nn,botSlotsInfo:cn}=m.useContext(Qr),Un=m.useCallback(async()=>{try{const k=window.localStorage.getItem("hyperToken"),I=window.localStorage.getItem("hyperAddress");if(!k||!I){Le(!1),ht(!0);return}const B=await ki(I.toLowerCase(),k);Le(!!(B!=null&&B.farming_tools))}catch{Le(!1)}finally{ht(!0)}},[]);m.useEffect(()=>{nn==null||nn(),Un()},[nn,Un]);const Xt=m.useMemo(()=>{const k=Array.isArray(cn)?cn:[],I=k.find(B=>String((B==null?void 0:B.bot_type)||"").toLowerCase()==="grid_bot"&&String((B==null?void 0:B.source_market)||"").toLowerCase()==="lighter");return I||k.find(B=>String((B==null?void 0:B.bot_type)||"").toLowerCase()==="grid_bot")},[cn]),an=Number((Xt==null?void 0:Xt.total_slot_count)||0),Jt=Number((Xt==null?void 0:Xt.using_extra_slot_count)||0)+Number((Xt==null?void 0:Xt.using_subs_slot_count)||0),Ye=an+Jt,Je=Xt?an<=0:!1,It=Je;m.useEffect(()=>{r&&r.id&&r.address&&Gt(k=>k.id===r.id&&k.address&&k.address.toLowerCase()===r.address.toLowerCase()?k:{id:r.id,address:r.address})},[r==null?void 0:r.id,r==null?void 0:r.address]);const hn=m.useMemo(()=>a.find(k=>k.symbol===t),[a,t]),Yt=hn&&hn.raw&&hn.raw.last_trade_price!=null&&Number(hn.raw.last_trade_price)||0;m.useEffect(()=>{let k=!1;async function I(){try{const G=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=lighter_fr")).json().catch(()=>null);if(!G||k)return;const re=Array.isArray(G)&&G||Array.isArray(G.data)&&G.data||Array.isArray(G.coins)&&G.coins||[],ce=String(t||"").toUpperCase(),ue=re.find(Ae=>String(Ae.value||Ae.label||Ae.symbol||Ae.coin||"").toUpperCase()===ce),ge=ue&&ue.maxLeverage!=null?Number(ue.maxLeverage):null;!k&&ge!=null&&Number.isFinite(ge)&&ge>0&&(se(ge),z(Ae=>{const ke=Number(Ae)||1;return Math.min(ge,Math.max(1,ke))}))}catch{if(k)return}}return t&&I(),()=>{k=!0}},[t]),m.useEffect(()=>{let k=!1;async function I(){if(typeof window>"u")return;const B=window.localStorage.getItem("hyperAddress"),G=window.localStorage.getItem("hyperToken");if(!B||!G){k||W([]);return}ee(!0);try{const ce=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:B,token:G})})).json().catch(()=>null);if(!ce||k)return;let ue=[];Array.isArray(ce)?ue=ce:Array.isArray(ce.data)?ue=ce.data:ce&&ce.wallet_id!=null&&(ue=[ce]);const ge=await Promise.all(ue.map(async Ae=>{let ke=null;if(Ae.available_balance!=null){const Me=Number(Ae.available_balance);Number.isFinite(Me)&&(ke=Me)}else if(Ae.balance!=null){const Me=Number(Ae.balance);Number.isFinite(Me)&&(ke=Me)}try{if(Ae.wallet_address){const qe=await(await fetch(`https://mainnet.zklighter.elliot.ai/api/v1/account?by=l1_address&value=${encodeURIComponent(Tc(Ae.wallet_address))}`)).json().catch(()=>null),Fe=qe&&Array.isArray(qe.accounts)&&qe.accounts.length>0&&qe.accounts[0];if(Fe&&Fe.available_balance!=null){const at=Number(Fe.available_balance);Number.isFinite(at)&&(ke=at)}}}catch{}return{wallet_id:Ae.wallet_id,wallet_address:Ae.wallet_address,wallet_name:Ae.wallet_name||`Wallet ${Ae.wallet_id}`,available_balance:ke}}));if(k)return;W(ge),Gt(Ae=>{if(Ae&&Ae.id)return Ae;const ke=ge[0];return ke?{id:ke.wallet_id,address:ke.wallet_address}:Ae})}catch{k||W([])}finally{k||ee(!1)}}return I(),()=>{k=!0}},[]);const Rt=m.useMemo(()=>{if(!pt||!pt.id)return null;const k=ae.find(B=>String(B.wallet_id)===String(pt.id));if(!k||k.available_balance==null)return null;const I=Number(k.available_balance);return Number.isFinite(I)?I:null},[ae,pt]),ot=(k,I,B)=>{const G=typeof B=="boolean"?B:!0;if(k.priceRange&&k.priceRange.lower!=null&&k.priceRange.upper!=null&&Number.isFinite(Number(k.priceRange.lower))&&Number.isFinite(Number(k.priceRange.upper))&&(c(String(k.priceRange.lower)),d(String(k.priceRange.upper))),k.gridCount&&Number.isFinite(Number(k.gridCount))){const re=Number(k.gridCount);x(re),y(String(re))}if((k.gridType==="geometric"||k.gridType==="arithmetic")&&P(k.gridType),k.investment&&k.investment.leverage!=null&&Number.isFinite(Number(k.investment.leverage))){const re=Number(k.investment.leverage);z(re)}if(k.investment&&k.investment.collateral!=null&&Number.isFinite(Number(k.investment.collateral))){const re=Number(k.investment.collateral);if(M(String(re)),I&&I>0&&re>0){const ce=re/I*100;$(Math.max(0,Math.min(100,ce)))}else $(0)}else M(""),$(0);ne(G)};m.useEffect(()=>{if(typeof window>"u")return;if(!t||!(pt!=null&&pt.id)||!(pt!=null&&pt.address)){ne(!1);return}let k=!1;function I(){c(""),d(""),x(2),y("2"),P("arithmetic"),M(""),$(0),z(10),C("")}async function B(){K(!0);try{const G=window.localStorage.getItem("hyperToken");if(!G){k||(ne(!1),I(),K(!1));return}const re={address:localStorage.getItem("hyperAddress"),token:G,wallet_id:Number(pt.id),source_market:"lighter",coin:String(t||"").toUpperCase()},ue=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)})).json().catch(()=>null);if(k)return;if(wt.current){wt.current=!1,K(!1);return}const ge=ue&&ue.data?ue.data:ue;ge&&typeof ge=="object"&&ge.is_deleted===!1&&ge.bot_params&&ge.bot_params?ot(ge.bot_params,Rt,!0):(ne(!1),I())}catch{if(k)return;ne(!1),c(""),d(""),x(2),y("2"),P("arithmetic"),M(""),$(0),z(10),C("")}finally{k||K(!1)}}return B(),()=>{k=!0}},[t,pt==null?void 0:pt.id,pt==null?void 0:pt.address,be]);const De=m.useMemo(()=>Ygn(l,u,f,N),[l,u,f,N]),At=m.useMemo(()=>{if(!De.length)return[];const k=Number(l),I=Number(u),B=Number.isFinite(k)&&Number.isFinite(I)?(k+I)/2:null;return De.map(G=>({price:G,side:B==null?null:G>=B?"sell":"buy"}))},[De,l,u]);m.useEffect(()=>{typeof s=="function"&&s(At)},[At,s]);const ze=k=>{const I=Number(k);if(!(I>0))return;const G=I*.01;c((I-G).toFixed(2)),d((I+G).toFixed(2))};m.useEffect(()=>{const k=I=>{const B=I&&I.detail&&I.detail.sourceMarket;B&&B!=="lighter"||je(G=>G+1)};return window.addEventListener("gridbotUpdated",k),()=>{window.removeEventListener("gridbotUpdated",k)}},[]),m.useEffect(()=>{const k=I=>{const B=I&&I.detail;if(!B)return;const G=B.sourceMarket||B.source_market;if(G&&G!=="lighter"||String(B.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const ce=B.botParams||{};if(wt.current=!0,ot(ce,Rt,B.isActive),B.isActive===!0?ne(!0):B.isActive===!1&&ne(!1),B.walletId&&ae&&ae.length){const ue=ae.find(ge=>String(ge.wallet_id)===String(B.walletId));ue&&Gt({id:ue.wallet_id,address:ue.wallet_address})}};return window.addEventListener("gridbotSelectFromTasks",k),()=>{window.removeEventListener("gridbotSelectFromTasks",k)}},[t,ae]),m.useEffect(()=>{if(typeof window>"u")return;const k=window.localStorage.getItem("gridbot:pending_selection");if(!k)return;let I=null;try{I=JSON.parse(k)}catch{I=null}if(!(!I||I.sourceMarket&&I.sourceMarket!=="lighter"||String(I.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(wt.current=!0,ot(I.botParams||{},Rt,I.isActive),I.isActive===!0?ne(!0):I.isActive===!1&&ne(!1),I.walletId&&ae&&ae.length){const B=ae.find(G=>String(G.wallet_id)===String(I.walletId));B&&Gt({id:B.wallet_id,address:B.wallet_address})}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,ae,Rt]),m.useEffect(()=>{if(l||u)return;const k=Yt>0?Yt:Number(e||n||0);!Number.isFinite(k)||k<=0||ze(k)},[Yt,e,n,l,u]);const rt=m.useMemo(()=>{if(Yt>0)return Yt;const k=Number(e||0);if(k>0)return k;const I=Number(n||0);if(I>0)return I;const B=Number(l),G=Number(u);return Number.isFinite(B)&&Number.isFinite(G)&&G>B?(B+G)/2:0},[Yt,e,n,l,u]),mt=rt,Lt=m.useMemo(()=>{const k=Math.max(1,Number(L)||1);return Math.min(q,k)},[L,q]),kt=Number(T)||0,dn=kt*Lt,rn=De.length,gn=rt>0?rt:Yt,An=gn>0&&rn>0&&dn>0?Number((dn/rn/gn).toFixed(5)):0,kn=Number.isFinite(hn==null?void 0:hn.sizeDecimals)?hn.sizeDecimals:4,yn=Number.isFinite(hn==null?void 0:hn.priceDecimals)?hn.priceDecimals:4,Vn=yn,Kn=(hn==null?void 0:hn.minBaseAmount)??0,Dn=(hn==null?void 0:hn.minQuoteAmount)??0,Xn=An>0?Number(An.toFixed(kn)):0,Nn=Xn>0&&Kn>0&&Xn<Kn,on=Xn>0&&Dn>0&&De.length>0&&De.some(k=>k*Xn<Dn),Oe=rt>0&&dn>0&&kt>0?hAe({entry:rt,side:"buy",notionalUSD:dn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:kt,isolatedMarginUSD:kt}):null,Zt=rt>0&&dn>0&&kt>0?hAe({entry:rt,side:"sell",notionalUSD:dn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:kt,isolatedMarginUSD:kt}):null,sn=m.useMemo(()=>{if(!l&&!u)return"";const k=Number(l),I=Number(u);if(!Number.isFinite(k)||!Number.isFinite(I))return"";if(!(I>k))return"Upper price must be greater than lower price.";if(mt>0){if(k>mt)return`Lower price cannot be above mark price (${mt.toFixed(yn)}).`;if(I<mt)return`Upper price cannot be below mark price (${mt.toFixed(yn)}).`}return""},[l,u,mt,yn]),jt=m.useMemo(()=>{const k=Number(l),I=Number(u);return!(!Number.isFinite(k)||!Number.isFinite(I)||!(I>k)||mt>0&&(k>mt||I<mt))},[l,u,mt]),Qn=rn>1&&jt&&kt>0&&Lt>0&&(pt==null?void 0:pt.id)&&(pt==null?void 0:pt.address),bn=oe>0,Dt=!!v,en=Nn||on,Pn=Be&&!nt,tr=Qn&&!J&&!te&&!V&&!bn&&!Dt&&!en&&!Je&&!Pn,ar=te||J||V||Dt?!1:X||Pn?!0:en||bn||Je?!1:Qn,hr=te||J||V?!0:X||Pn?!1:en||bn||Je||Dt?!0:!Qn,qt=X||te||J,zn=q&&q>0;m.useEffect(()=>{if(!oe)return;const k=setInterval(()=>{de(I=>I>1?I-1:0)},1e3);return()=>clearInterval(k)},[oe]);const Zn=()=>{if(qt)return;const k=Yt>0?Yt:rt>0?rt:Number(e||n||0);!Number.isFinite(k)||k<=0||ze(k)},Ft=k=>{if(qt)return;const I=Math.max(0,Math.min(100,Number(k)||0));if($(I),!Rt||Rt<=0){I===0&&M("");return}const B=Rt*I/100;M(B&&Number.isFinite(B)?String(B.toFixed(2)):"")},En=k=>{if(qt)return;M(k);const I=Number(k);if(!Rt||!Number.isFinite(I)||I<=0||Rt<=0){$(0);return}const B=I/Rt*100;$(Math.max(0,Math.min(100,B)))},Ee=async()=>{if(!tr||typeof window>"u"||!(pt!=null&&pt.address)||!(pt!=null&&pt.id))return;const k=De.filter(ke=>Number.isFinite(ke));if(k.length<2)return;const I=k[0],B=k[k.length-1],G=(I+B)/2,re=k.length,ce=window.localStorage.getItem("hyperToken");if(!ce)return;const ue=Xn,ge={symbol:String(t||"").toUpperCase(),gridType:N==="geometric"?"geometric":"arithmetic",direction:o,priceRange:{lower:Number(I.toFixed(Vn)),upper:Number(B.toFixed(Vn)),middle:Number(G.toFixed(Vn))},gridCount:re,gridPrices:k.map(ke=>Number(ke.toFixed(Vn))),investment:{collateral:kt,leverage:Lt,totalInvestment:dn,qtyPerOrder:ue},liquidationPrices:{long:Oe?Number(Oe.toFixed(2)):null,short:Zt?Number(Zt.toFixed(2)):null},marginMode:"Cross",currentPrice:rt||null,timestamp:new Date().toISOString()},Ae={address:localStorage.getItem("hyperAddress"),token:ce,wallet_id:Number(pt.id),source_market:"lighter",bot_params:ge,coin:String(t||"").toUpperCase()};fe(!0);try{const Me=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ae)})).json().catch(()=>null);if(!(Me&&(Me.success===!0||Me.status==="ok"||Me.status==="success"))){const Fe=Me&&(Me.error_message||Me.message||Me.detail)||"Grid bot failed to start.";tn.error(Fe);return}ne(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),nn==null||nn(),tn.success("Grid bot started.")}catch{tn.error("An error occurred while starting the grid bot.")}finally{fe(!1)}},h=async()=>{if(typeof window>"u"||!(pt!=null&&pt.address)||!(pt!=null&&pt.id))return;const k=window.localStorage.getItem("hyperToken");if(!k)return;const I={address:localStorage.getItem("hyperAddress"),token:k,wallet_id:Number(pt.id),source_market:"lighter",coin:String(t||"").toUpperCase()};fe(!0);try{const G=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)})).json().catch(()=>null);if(!(G&&(G.success===!0||G.status==="ok"||G.status==="success"))){const ce=G&&(G.error_message||G.message||G.detail)||"Grid bot could not be stopped.";tn.error(ce);return}ne(!1),de(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"lighter"}})),nn==null||nn(),tn.success("Grid bot has been stopped.")}catch{tn.error("An error occurred while stopping the grid bot.")}finally{fe(!1)}},p=()=>{if(Pn){tt(!0);return}ar&&(X?h():xe(!0))},S=async()=>{tr&&(xe(!1),await Ee())},_=Pn?"Subscribe / 0.12 ETH":te?X?"Stopping...":"Starting...":X?"Stop":bn?`Stopping ${oe}s`:"Start";return i.jsxs(i.Fragment,{children:[dt&&i.jsx(RVe,{open:dt,setOpen:tt,checkAccountCopy:Un,roleType:"farming"}),Ie&&i.jsx(O5,{open:Ie,setOpen:Re,oldSlotCount:Qe,checkAccountLighter:nn,product:"grid_bot"}),i.jsxs("div",{className:"h-full w-full flex flex-col text-[13px]",children:[i.jsx("div",{className:"px-3 pb-2 flex items-center justify-between border-b border-[#292929]"}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pb-3 space-y-4 mt-2",children:[i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Lighter Wallet"}),i.jsx(iP,{wallets:ae,value:pt&&pt.id?String(pt.id):"",onChange:k=>{const I=ae.find(B=>String(B.wallet_id)===String(k));I&&Gt({id:I.wallet_id,address:I.wallet_address})},selectedBalance:Rt,mode:"lighter"})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[#7C7C7C] font-semibold",children:[i.jsx(S5,{className:"w-4 h-4 text-[#67FFBD]"}),i.jsx("span",{children:"Slot"})]}),i.jsx("div",{className:"flex items-center gap-1 text-[#67FFBD] text-[12px] font-semibold",children:i.jsx("span",{children:Ye?`${Jt}/${Ye}`:Xt?"0/0":"--"})})]}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[11px] text-[#7C7C7C]",children:Je?"No slots left. Get more to start new grid bots.":""}),It&&i.jsx("button",{type:"button",onClick:()=>{Ke(an),Re(!0)},className:"flex items-center justify-center h-8 px-3 sm:px-5 rounded-[10px] text-[11px] sm:text-[13px] border bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer min-w-max font-semibold",children:"Get more slots"})]})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between mt-2",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Price Range"}),i.jsx("button",{type:"button",onClick:Zn,disabled:qt,className:"text-[11px] px-2 py-0.5 rounded-md bg-[#161616] border border-[#292929] text-white/60 hover:text-white disabled:opacity-60 disabled:cursor-not-allowed",children:"Autofill"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text:white/40 text-white/40",children:"Lower"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:l,onChange:k=>{qt||c(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:qt})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Upper"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:u,onChange:k=>{qt||d(k.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:qt})})]})]}),mt>0&&i.jsxs("div",{className:"text-[11px] text:white/40 text-white/40",children:["Mark Price: ",mt.toFixed(yn)]}),sn&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:sn})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("span",{className:"text-xs text-white/70",children:"Number of Grids (max 36, even only)"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:i.jsx("input",{value:g,onChange:k=>{if(qt)return;const I=k.target.value.replace(/[^\d]/g,"");if(y(I),C(""),I==="")return;const B=Number(I);if(Number.isFinite(B)){if(B<2){C("The minimum number of grids must be 2.");return}if(B>36){C("The maximum number of grids can be 36.");return}if(B%2!==0){C("The number of grids must be even.");return}x(B)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:qt})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:N,onChange:k=>{qt||P(k.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:qt,children:Kgn.map(k=>i.jsx("option",{value:k,className:"bg-[#101010]",children:k[0].toUpperCase()+k.slice(1)},k))})})]}),i.jsxs("div",{className:"text-[11px] text-white/40",children:[v&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:v}),"Step:"," ",De.length>1?(De[1]-De[0]).toFixed(Vn):"--"]})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Investment"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:[i.jsx("input",{value:T,onChange:k=>En(k.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:qt}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"USDC"})]}),i.jsx("div",{className:"flex flex-col gap-1 w-[120px]",children:i.jsx(z4,{onClick:zn&&!qt?()=>me(!0):void 0,children:zn?`${Lt}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-3 pb-6",children:[i.jsx(vA,{value:F,onChange:k=>Ft(k),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:F,onChange:k=>Ft(Math.max(0,Math.min(100,Number(k.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:qt}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between mt-2 border-t border-[#292929] pt-4 font-semibold",children:[i.jsxs("span",{children:["Max ",t,": ",`${q}x`]}),i.jsxs("span",{children:["Total:"," ",dn>0?`${dn.toFixed(2)} USDC`:"--"]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between font-semibold",children:[i.jsxs("span",{children:["Qty per order:"," ",Xn>0?`${Xn} ${t}`:"--"]}),i.jsx("span",{children:"Margin Mode: Cross"})]})]}),i.jsxs("section",{className:"pt-2 border-t border-[#292929]",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-2",children:[i.jsx("span",{children:"Est. Liq Long"}),i.jsx("span",{children:Oe?`$${Oe.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-3",children:[i.jsx("span",{children:"Est. Liq Short"}),i.jsx("span",{children:Zt?`$${Zt.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:p,disabled:hr,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${hr?"bg-[#303030] text-white/40 cursor-not-allowed opacity-70":Pn?"bg-[#7446FF] text-white hover:bg-[#5834C3]":X?"bg-[#FF7173] text:black text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90"}`,children:_}),Nn&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",Kn," ",t,")."]}),on&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",Dn.toFixed(2),"."]})]})]})]}),i.jsx(lp,{open:Ce,onClose:()=>me(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:wi},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",q,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:q||1,step:1,value:L,onChange:k=>z(Math.max(1,Math.min(q||1,Number(k.target.value)))),className:"flex-1",style:{accentColor:"#67FFBD"}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:L,onChange:k=>{const I=Number(k.target.value)||1,B=Math.max(1,Math.min(q||1,I));z(B)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>me(!1),children:"Confirm"})]})}),i.jsx(lp,{open:we,onClose:()=>xe(!1),children:i.jsxs(ym,{title:`${t} Lighter Grid Bot`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4 text-[10px]",children:[i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[#151b23] text-[#9CA3AF]",children:"Cross"}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-[#FF71731a] text-[#FF7173]",children:["Leverage ",Lt,"x"]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-y-2 gap-x-6 text-[12px] mb-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Number.isFinite(Number(l))&&Number.isFinite(Number(u))?`${Number(l).toFixed(Vn)} - ${Number(u).toFixed(Vn)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:rn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:N==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Xn>0?`${Xn} ${t}`:"--"})]})]}),i.jsx("div",{className:"mt-2 pt-3 border-t border-[#292929]",children:i.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[i.jsx("span",{className:"font-medium",style:{color:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:dn>0?`${dn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:S,disabled:te,children:te?"Starting...":"Confirm"})})]})})]})}const Xgn=["arithmetic","geometric"],Qgn=6,Oqe="https://api.hyperliquid.xyz/info",Zgn=10,Jgn=10*60*1e3;let Fb={data:null,ts:0,promise:null};async function e1n(){const t=Date.now();if(Fb.data&&t-Fb.ts<Jgn)return Fb.data;if(Fb.promise)return Fb.promise;const e=fetch(Oqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allPerpMetas"})}).then(n=>n.json()).then(n=>{const r=Array.isArray(n)?n:[];return Fb={data:r,ts:Date.now(),promise:null},r}).catch(n=>{throw Fb.promise=null,n});return Fb.promise=e,e}function t1n(t,e,n,r){const s=Number(t),a=Number(e),o=Number(n);if(!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(o))return[];if(o<2||a<=s)return[];if(r==="geometric"){const c=Math.pow(a/s,1/(o-1));return Array.from({length:o},(u,d)=>s*Math.pow(c,d))}const l=(a-s)/(o-1);return Array.from({length:o},(c,u)=>s+l*u)}function mAe({entry:t,side:e,notionalUSD:n,maintenanceFrac:r,marginMode:s,accountValueUSD:a,isolatedMarginUSD:o}){const l=Number(t)||0,c=Math.abs(Number(n)||0);if(!l||!c)return null;const u=e==="buy"?1:-1,d=Math.max(0,Number(r)||0),f=c/l,x=c*d;let g;s==="Cross"?g=a-x:g=o-x;const y=1-d*u;if(!f||!isFinite(y))return null;const v=l-u*(g/f)/y;return Math.max(0,v)}function KQ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function n1n(t){let e=String(t||"").toUpperCase();if(!e)return"";e.endsWith("-PERP")&&(e=e.slice(0,-5));const n=e.indexOf("-USD");return n>0&&(e=e.slice(0,n)),e}function r1n(t,e,n=6){if(!Number.isFinite(t)||t<=0)return n-(e||0);const r=5,s=Math.max(0,n-(e||0)),a=Math.floor(Math.log10(t))+1,o=Math.max(0,r-a);return Math.min(s,o)}function xAe({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){const o=gz(),[l]=m.useState("short"),[c,u]=m.useState(""),[d,f]=m.useState(""),[x,g]=m.useState(2),[y,v]=m.useState("2"),[C,N]=m.useState(""),[P,T]=m.useState("arithmetic"),[M,F]=m.useState(""),[$,L]=m.useState(0),[z,X]=m.useState(10),[ne,J]=m.useState(!1),[K,te]=m.useState(!1),[fe,q]=m.useState(!1),[se,ae]=m.useState(50),[W,V]=m.useState(0),[ee,oe]=m.useState(!1),[de,Ce]=m.useState(!1),[me,we]=m.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address}:{id:null,address:null}),[xe,be]=m.useState({address:null,token:null}),[je,Ie]=m.useState(null),[Re,Qe]=m.useState(null),[Ke,dt]=m.useState(""),[tt,nt]=m.useState(""),[Le,Be]=m.useState(""),[ht,pt]=m.useState(""),[Gt,wt]=m.useState(!1),[nn,cn]=m.useState(!1),[Un,Xt]=m.useState(!1),[an,Jt]=m.useState(!1),[Ye,Je]=m.useState(0),It=()=>{u(""),f(""),g(2),v("2"),T("arithmetic"),F(""),L(0),X(10),N(""),dt(""),nt(""),Be(""),pt(""),wt(!1),cn(!1),Xt(!1),Jt(!1)},{address:hn,isConnected:Yt}=ns();Yt&&(typeof window<"u"&&window.localStorage.getItem("hyperToken"));const{wallets:Rt,loading:ot}=xqe(xe.address,xe.token,!0,{pollMs:5e3}),De=m.useRef(!1),At=ot&&(!Rt||Rt.length===0);m.useEffect(()=>{r&&r.id&&r.address&&we(ut=>ut.id===r.id&&ut.address&&ut.address.toLowerCase()===r.address.toLowerCase()?ut:{id:r.id,address:r.address})},[r==null?void 0:r.id,r==null?void 0:r.address]),m.useEffect(()=>{const ut=()=>{const yt=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,Mt=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;be({address:yt,token:Mt})};return ut(),window.addEventListener("localStorageUpdated",ut),window.addEventListener("storage",ut),()=>{window.removeEventListener("localStorageUpdated",ut),window.removeEventListener("storage",ut)}},[]),m.useEffect(()=>{if(me.id||!Rt||!Rt.length)return;const ut=Rt.find(Mt=>Mt.confirmed)||Rt[0];if(!ut)return;const yt={id:ut.wallet_id,address:ut.wallet_address};we(yt),typeof s=="function"&&s({id:String(yt.id),address:yt.address})},[Rt,me.id,s]),m.useEffect(()=>{t&&(It(),J(!1))},[t]);const ze=m.useMemo(()=>o.find(ut=>ut.symbol===t),[o,t]),rt=ze&&ze.raw&&ze.raw.last_trade_price!=null&&Number(ze.raw.last_trade_price)||0;m.useEffect(()=>{let ut=!1;async function yt(){if(t)try{const Kt=await(await fetch(Oqe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"allPerpMetas"})})).json().catch(()=>null);if(!Kt||ut)return;let un=null;for(const Pt of Kt)if(Array.isArray(Pt==null?void 0:Pt.universe)){for(const Wt of Pt.universe)if(String(Wt.name||"").toUpperCase()===String(t||"").toUpperCase()){un=Wt;break}}if(!un||!Number.isFinite(un.maxLeverage))return;const Xe=Number(un.maxLeverage);ae(Xe),X(Pt=>Math.min(Xe,Math.max(1,Pt)))}catch{}}return yt(),()=>{ut=!0}},[t]),m.useEffect(()=>{let ut=!1;async function yt(){try{const Kt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper_fr")).json().catch(()=>null);if(!Kt||ut)return;const un=Array.isArray(Kt)&&Kt||Array.isArray(Kt.data)&&Kt.data||Array.isArray(Kt.coins)&&Kt.coins||[],Xe=String(t||"").toUpperCase(),Pt=un.find(ct=>String(ct.value||ct.label||ct.symbol||ct.coin||"").toUpperCase()===Xe),Wt=Pt&&Pt.maxLeverage!=null?Number(Pt.maxLeverage):null;!ut&&Wt!=null&&Number.isFinite(Wt)&&Wt>0&&(ae(Wt),X(ct=>Math.min(Wt,Math.max(1,Number(ct)||1))))}catch{}}return t&&yt(),()=>{ut=!0}},[t]);const mt=(me==null?void 0:me.address)||(hn?hn.toLowerCase():null),{perpsOverview:Lt}=sP(mt),kt=m.useMemo(()=>{if(!Lt||Lt.balance==null)return null;const ut=Number(Lt.balance);return Number.isFinite(ut)?ut:null},[Lt]),dn=(ut,yt)=>{var Fn,Gn,Sr,ur;const Mt=ut.priceRange||{},Kt=Array.isArray(ut.gridPrices)?ut.gridPrices:[];let un=Mt.lower,Xe=Mt.upper;(!Number.isFinite(un)||!Number.isFinite(Xe))&&Kt.length>=2&&(un=Kt[0],Xe=Kt[Kt.length-1]),Number.isFinite(un)?u(String(un)):u(""),Number.isFinite(Xe)?f(String(Xe)):f("");let Pt=ut.gridCount;Number.isFinite(Pt)||Kt.length>=2&&(Pt=Kt.length),Number.isFinite(Pt)?(g(Pt),v(String(Pt))):(g(2),v("2"));let Wt=ut.gridType;Wt!=="geometric"&&Wt!=="arithmetic"&&(Wt="arithmetic"),T(Wt);const ct=ut.investment||{};if(ct&&ct.leverage!=null&&Number.isFinite(Number(ct.leverage))&&X(Number(ct.leverage)),ct&&ct.collateral!=null&&Number.isFinite(Number(ct.collateral))){const kr=Number(ct.collateral);if(F(String(kr)),yt&&yt>0&&kr>0){const Bn=kr/yt*100;L(Math.max(0,Math.min(100,Bn)))}else L(0)}else F(""),L(0);const Ge=ut.trailing_up??((Fn=ut==null?void 0:ut.trailing)==null?void 0:Fn.up),Tt=ut.trailing_down??((Gn=ut==null?void 0:ut.trailing)==null?void 0:Gn.down),fn=ut.sl_up??((Sr=ut==null?void 0:ut.sl)==null?void 0:Sr.up),Yn=ut.sl_down??((ur=ut==null?void 0:ut.sl)==null?void 0:ur.down);dt(Ge!=null&&Number.isFinite(Number(Ge))?String(Ge):""),nt(Tt!=null&&Number.isFinite(Number(Tt))?String(Tt):""),Be(fn!=null&&Number.isFinite(Number(fn))?String(fn):""),pt(Yn!=null&&Number.isFinite(Number(Yn))?String(Yn):""),wt(Ge!=null&&Number.isFinite(Number(Ge))),cn(Tt!=null&&Number.isFinite(Number(Tt))),Xt(fn!=null&&Number.isFinite(Number(fn))),Jt(Yn!=null&&Number.isFinite(Number(Yn)))};m.useEffect(()=>{if(typeof window>"u")return;if(!t||!(me!=null&&me.id)||!(me!=null&&me.address)){J(!1),It();return}let ut=!1;async function yt(){te(!0);try{const Mt=window.localStorage.getItem("hyperToken");if(!Mt){ut||(J(!1),It(),te(!1));return}const Kt={address:window.localStorage.getItem("hyperAddress"),token:Mt,wallet_id:Number(me.id),source_market:"hyper",coin:String(t||"").toUpperCase()},Xe=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kt)})).json().catch(()=>null);if(ut)return;if(De.current){De.current=!1,te(!1);return}const Pt=Xe&&Xe.data?Xe.data:Xe;Pt&&typeof Pt=="object"&&Pt.is_deleted===!1&&Pt.bot_params&&Pt.bot_params?(dn(Pt.bot_params,kt),J(!0)):(J(!1),It(),u(""),f(""))}catch{J(!1),It(),u(""),f("")}finally{ut||te(!1)}}return yt(),()=>{ut=!0}},[t,me==null?void 0:me.id,me==null?void 0:me.address,Ye]),m.useEffect(()=>{if(typeof window>"u")return;const ut=window.localStorage.getItem("gridbot:pending_selection");if(!ut)return;let yt=null;try{yt=JSON.parse(ut)}catch{yt=null}if(!(!yt||yt.sourceMarket&&yt.sourceMarket!=="hyper"||String(yt.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(De.current=!0,dn(yt.botParams||{},kt),yt.isActive===!0?J(!0):yt.isActive===!1&&J(!1),yt.walletId&&Rt&&Rt.length){const Mt=Rt.find(Kt=>String(Kt.wallet_id)===String(yt.walletId));if(Mt){const Kt={id:Mt.wallet_id,address:Mt.wallet_address};we(Kt),typeof s=="function"&&s({id:String(Kt.id),address:Kt.address})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,Rt,s,kt]),m.useEffect(()=>{const ut=yt=>{const Mt=yt&&yt.detail&&yt.detail.sourceMarket;Mt&&Mt!=="hyper"||Je(Kt=>Kt+1)};return window.addEventListener("gridbotUpdated",ut),()=>{window.removeEventListener("gridbotUpdated",ut)}},[]),m.useEffect(()=>{const ut=yt=>{const Mt=yt&&yt.detail;if(!Mt)return;const Kt=Mt.sourceMarket||Mt.source_market;if(Kt&&Kt!=="hyper"||String(Mt.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const Xe=Mt.botParams||{};if(dn(Xe,kt),De.current=!0,Mt.isActive===!0?J(!0):Mt.isActive===!1&&J(!1),Mt.walletId&&Rt&&Rt.length){const Pt=Rt.find(Wt=>String(Wt.wallet_id)===String(Mt.walletId));if(Pt){const Wt={id:Pt.wallet_id,address:Pt.wallet_address};we(Wt),typeof s=="function"&&s({id:String(Wt.id),address:Wt.address})}}};return window.addEventListener("gridbotSelectFromTasks",ut),()=>{window.removeEventListener("gridbotSelectFromTasks",ut)}},[t,Rt,s]);const rn=m.useMemo(()=>t1n(c,d,x,P),[c,d,x,P]),gn=m.useMemo(()=>{if(!rn.length)return[];const ut=Number(c),yt=Number(d),Mt=Number.isFinite(ut)&&Number.isFinite(yt)?(ut+yt)/2:null;return rn.map(Kt=>({price:Kt,side:Mt==null?null:Kt>=Mt?"sell":"buy"}))},[rn,c,d]);m.useEffect(()=>{typeof a=="function"&&a(gn)},[gn,a]);const An=ut=>{const yt=Number(ut);if(!(yt>0))return;const Mt=yt*.01;u((yt-Mt).toFixed(2)),f((yt+Mt).toFixed(2))},kn=m.useMemo(()=>{if(rt>0)return rt;const ut=Number(e||0);if(ut>0)return ut;const yt=Number(n||0);if(yt>0)return yt;const Mt=Number(c),Kt=Number(d);return Number.isFinite(Mt)&&Number.isFinite(Kt)&&Kt>Mt?(Mt+Kt)/2:0},[rt,e,n,c,d]);m.useEffect(()=>{let ut=!1;async function yt(){const Mt=n1n(t);if(!Mt){Ie(null),Qe(null);return}try{const Kt=await e1n();let un=null;e:for(const Xe of Kt)if(Array.isArray(Xe==null?void 0:Xe.universe)){for(const Pt of Xe.universe)if(String((Pt==null?void 0:Pt.name)||"").toUpperCase()===Mt){const ct=Number(Pt.szDecimals);Number.isFinite(ct)&&(un=ct);break e}}if(ut)return;un!=null?Ie(un):(Ie(null),Qe(null))}catch{Ie(null),Qe(null)}}return t?yt():(Ie(null),Qe(null)),()=>{ut=!0}},[t]),m.useEffect(()=>{if(!Number.isFinite(je)){Qe(null);return}const ut=r1n(kn,je);Qe(ut)},[kn,je]);const yn=kn,Vn=m.useMemo(()=>Math.min(se,Math.max(1,Number(z)||1)),[z,se]),Kn=Number(M)||0,Dn=Kn*Vn,Xn=rn.length,Nn=kn>0?kn:rt,on=Nn>0&&Xn>0&&Dn>0?Number((Dn/Xn/Nn).toFixed(5)):0,Oe=Number.isFinite(je)?je:Number.isFinite(ze==null?void 0:ze.sizeDecimals)?ze.sizeDecimals:4,Zt=m.useMemo(()=>{if(Number.isFinite(Re))return Re;const ut=Number.isFinite(Oe)?Number(Oe):4,yt=Math.max(0,Qgn-ut),Mt=Math.abs(Number(kn||0));if(!(Mt>0)||!Number.isFinite(Mt))return yt;const Kt=Mt>=1?Math.floor(Math.log10(Mt))+1:0,un=Math.max(0,5-Kt);return Math.min(yt,un)},[Re,Oe,kn]),sn=Zt,jt=(ze==null?void 0:ze.minBaseAmount)??0,Qn=(ze==null?void 0:ze.minQuoteAmount)??0,bn=on>0?Number(on.toFixed(Oe)):0,Dt=bn>0&&jt>0&&bn<jt,en=bn>0&&Qn>0&&rn.length>0&&rn.some(ut=>ut*bn<Qn),Pn=m.useMemo(()=>{if(bn<=0||rn.length===0)return 0;let ut=1/0;for(const yt of rn){if(!(yt>0))continue;const Mt=yt*bn;Mt<ut&&(ut=Mt)}return ut===1/0?0:ut},[bn,rn]),tr=bn<=0||Pn<Zgn,ar=kn>0&&Dn>0&&Kn>0?mAe({entry:kn,side:"buy",notionalUSD:Dn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Kn,isolatedMarginUSD:Kn}):null,hr=kn>0&&Dn>0&&Kn>0?mAe({entry:kn,side:"sell",notionalUSD:Dn,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Kn,isolatedMarginUSD:Kn}):null,qt=m.useMemo(()=>{if(!c&&!d)return"";const ut=Number(c),yt=Number(d);if(!Number.isFinite(ut)||!Number.isFinite(yt))return"";if(!(yt>ut))return"Upper price must be greater than lower price.";if(yn>0){if(ut>yn)return`Lower price cannot be above mark price (${yn.toFixed(Zt)}).`;if(yt<yn)return`Upper price cannot be below mark price (${yn.toFixed(Zt)}).`}return""},[c,d,yn,Zt]),zn=m.useMemo(()=>{const ut=Number(c),yt=Number(d);return!(!Number.isFinite(ut)||!Number.isFinite(yt)||!(yt>ut)||yn>0&&(ut>yn||yt<yn))},[c,d,yn]),Zn=Number(c),Ft=Number(d),En=Number(Ke),Ee=Number(tt),h=Number(Le),p=Number(ht),S=Gt&&(Ke===""||!Number.isFinite(En)||!(En>Ft)),_=nn&&(tt===""||!Number.isFinite(Ee)||!(Ee<Zn));m.useEffect(()=>{Gt||dt(""),nn||nt("")},[Gt,nn]),m.useEffect(()=>{Un||Be(""),an||pt("")},[Un,an]);const k=Un&&(Le===""||!Number.isFinite(h)||!Gt&&Number.isFinite(Ft)&&!(h>Ft)||Gt&&Number.isFinite(En)&&!(h>En)),I=an&&(ht===""||!Number.isFinite(p)||!nn&&Number.isFinite(Zn)&&!(p<Zn)||nn&&Number.isFinite(Ee)&&!(p<Ee)),B=Xn>1&&zn&&Kn>0&&Vn>0&&(me==null?void 0:me.id)&&(me==null?void 0:me.address),G=W>0,re=!!C,ce=Dt||en,ue=S||_||k||I,ge=B&&!K&&!fe&&!At&&!G&&!re&&!ce&&!tr&&!ue,Ae=fe||K||At||re||ce||tr||G||ue?!1:ne?!0:B,ke=ne||fe||K||At;m.useEffect(()=>{if(!W)return;const ut=setInterval(()=>V(yt=>yt>1?yt-1:0),1e3);return()=>clearInterval(ut)},[W]);const Me=()=>{if(ke)return;const ut=rt>0?rt:kn>0?kn:Number(e||n||0);!Number.isFinite(ut)||ut<=0||An(ut)},qe=ut=>{if(ke)return;const yt=Math.max(0,Math.min(100,Number(ut)||0));if(L(yt),!kt||kt<=0){yt===0&&F("");return}const Mt=kt*yt/100;F(Mt&&Number.isFinite(Mt)?String(Mt.toFixed(2)):"")},Fe=ut=>{if(ke)return;F(ut);const yt=Number(ut);if(!kt||!Number.isFinite(yt)||yt<=0||kt<=0){L(0);return}const Mt=yt/kt*100;L(Math.max(0,Math.min(100,Mt)))},at=async()=>{if(!ge||typeof window>"u"||!(me!=null&&me.address)||!(me!=null&&me.id))return;const ut=rn.filter(Tt=>Number.isFinite(Tt));if(ut.length<2)return;const yt=ut[0],Mt=ut[ut.length-1],Kt=(yt+Mt)/2,un=ut.length,Xe=window.localStorage.getItem("hyperToken");if(!Xe)return;if(Gt&&S){tn.error("Trailing Up is invalid.");return}if(nn&&_){tn.error("Trailing Down is invalid.");return}if(Un&&k){const Tt=Gt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";tn.error(Tt);return}if(an&&I){const Tt=nn?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";tn.error(Tt);return}const Pt=bn,Wt=KQ(t),ct={symbol:String(t||"").toUpperCase(),dex:Wt,gridType:P==="geometric"?"geometric":"arithmetic",direction:l,priceRange:{lower:Number(yt.toFixed(sn)),upper:Number(Mt.toFixed(sn)),middle:Number(Kt.toFixed(sn))},gridCount:un,gridPrices:ut.map(Tt=>Number(Tt.toFixed(sn))),investment:{collateral:Kn,leverage:Vn,totalInvestment:Dn,qtyPerOrder:Pt},liquidationPrices:{long:ar?Number(ar.toFixed(2)):null,short:hr?Number(hr.toFixed(2)):null},trailing_up:Gt&&!S?Number(En.toFixed(sn)):null,trailing_down:nn&&!_?Number(Ee.toFixed(sn)):null,sl_up:Un&&!k?Number(h.toFixed(sn)):null,sl_down:an&&!I?Number(p.toFixed(sn)):null,marginMode:"Cross",currentPrice:kn||null,timestamp:new Date().toISOString()},Ge={address:window.localStorage.getItem("hyperAddress"),token:Xe,wallet_id:Number(me.id),source_market:"hyper",...Wt?{dex:Wt}:{},bot_params:ct,coin:String(t||"").toUpperCase()};q(!0);try{const fn=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ge)})).json().catch(()=>null);if(!(fn&&(fn.success===!0||fn.status==="ok"||fn.status==="success"))){const Fn=fn&&(fn.error_message||fn.message||fn.detail)||"Grid bot failed to start.";tn.error(Fn);return}J(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),tn.success("Grid bot started.")}catch{tn.error("An error occurred while starting the grid bot.")}finally{q(!1)}},ie=async()=>{if(typeof window>"u"||!(me!=null&&me.address)||!(me!=null&&me.id))return;const ut=window.localStorage.getItem("hyperToken");if(!ut)return;const yt=KQ(t),Mt={address:window.localStorage.getItem("hyperAddress"),token:ut,wallet_id:Number(me.id),source_market:"hyper",...yt?{dex:yt}:{},coin:String(t||"").toUpperCase()};q(!0);try{const un=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/gridbot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Mt)})).json().catch(()=>null);if(!(un&&(un.success===!0||un.status==="ok"||un.status==="success"))){const Pt=un&&(un.error_message||un.message||un.detail)||"Grid bot could not be stopped.";tn.error(Pt);return}J(!1),V(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"hyper"}})),tn.success("Grid bot has been stopped.")}catch{tn.error("An error occurred while stopping the grid bot.")}finally{q(!1)}},Se=()=>{Ae&&(ne?ie():Ce(!0))},$e=async()=>{ge&&(Ce(!1),await at())},Ue=fe?ne?"Stopping...":"Starting...":ne?"Stop":G?`Stopping ${W}s`:"Start",_e=["xyz","vntl","flx"].includes(KQ(t))?"Isolated":"Cross",st=!1;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"h-full w-full flex flex-col text-[13px]",children:[i.jsx("div",{className:"px-3 pb-2 flex items-center justify-between border-b border-[#292929]"}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pb-3 space-y-4 mt-2",children:[i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Perps Wallet"}),i.jsx(iP,{wallets:Rt,value:me&&me.id?String(me.id):"",onChange:ut=>{const yt=(Rt||[]).find(Mt=>String(Mt.wallet_id)===String(ut))||null;if(yt){const Mt={id:yt.wallet_id,address:yt.wallet_address};we(Mt),typeof s=="function"&&s({id:String(Mt.id),address:Mt.address})}},selectedBalance:kt})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between mt-2",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Price Range"}),i.jsx("button",{type:"button",onClick:Me,disabled:ke,className:"text-[11px] px-2 py-0.5 rounded-md bg-[#161616] border border-[#292929] text-white/60 hover:text-white disabled:opacity-60 disabled:cursor-not-allowed",children:"Autofill"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Lower"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:c,onChange:ut=>{ke||u(ut.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:ke})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Upper"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:d,onChange:ut=>{ke||f(ut.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:ke})})]})]}),yn>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",yn.toFixed(Zt)]}),qt&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:qt})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("span",{className:"text-xs text-white/70",children:"Number of Grids (Even only)"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:i.jsx("input",{value:y,onChange:ut=>{if(ke)return;const yt=ut.target.value.replace(/[^\d]/g,"");if(v(yt),N(""),yt==="")return;const Mt=Number(yt);if(Number.isFinite(Mt)){if(Mt<2){N("The minimum number of grids must be 2.");return}if(Mt>120){N("The maximum number of grids is 120.");return}if(Mt%2!==0){N("The number of grids must be even.");return}g(Mt)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:ke})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:P,onChange:ut=>{ke||T(ut.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:ke,children:Xgn.map(ut=>i.jsx("option",{value:ut,className:"bg-[#101010]",children:ut[0].toUpperCase()+ut.slice(1)},ut))})})]}),i.jsx("div",{className:"text-[11px] text-white/40",children:C&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:C})})]}),st,i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Investment"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:[i.jsx("input",{value:M,onChange:ut=>Fe(ut.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:ke}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"USDC"})]}),i.jsx("div",{className:"flex flex-col gap-1 w-[120px]",children:i.jsx(z4,{onClick:se&&se>0&&!ke?()=>oe(!0):void 0,children:se&&se>0?`${Vn}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 !mt-4 pb-6",children:[i.jsx(vA,{value:$,onChange:ut=>qe(ut),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:$,onChange:ut=>qe(Math.max(0,Math.min(100,Number(ut.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:ke}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between mt-2 border-t border-[#292929] pt-4 font-semibold",children:[i.jsxs("span",{children:["Max ",t,": ",`${se}x`]}),i.jsxs("span",{children:["Total:"," ",Dn>0?`${Dn.toFixed(2)} USDC`:"--"]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between font-semibold",children:[i.jsxs("span",{children:["Qty per order:"," ",bn>0?`${bn} ${t}`:"--"]}),i.jsxs("span",{children:["Margin Mode: ",_e]})]})]}),i.jsxs("section",{className:"pt-2 border-t border-[#292929]",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-2",children:[i.jsx("span",{children:"Est. Liq Long"}),i.jsx("span",{children:ar?`$${ar.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-3",children:[i.jsx("span",{children:"Est. Liq Short"}),i.jsx("span",{children:hr?`$${hr.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsx("button",{type:"button",onClick:Se,disabled:!Ae,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${Ae?ne?"bg-[#FF7173] text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90":"bg-[#303030] text-white/40 cursor-not-allowed opacity-70"}`,children:Ue}),Dt&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",jt," ",t,")."]}),en&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Your order size is below minimum order size of $",Qn.toFixed(2),"."]}),tr&&i.jsx("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:"Each grid order must be at least $10 notional. Increase your investment, reduce the number of grids, or lower leverage."}),st]})]})]}),i.jsx(lp,{open:ee,onClose:()=>oe(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:wi},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",se,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:se||1,step:1,value:z,onChange:ut=>X(Math.max(1,Math.min(se||1,Number(ut.target.value)))),className:"flex-1",style:{accentColor:"#67FFBD"}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:z,onChange:ut=>{const yt=Number(ut.target.value)||1,Mt=Math.max(1,Math.min(se||1,yt));X(Mt)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>oe(!1),children:"Confirm"})]})}),i.jsx(lp,{open:de,onClose:()=>Ce(!1),children:i.jsxs(ym,{title:`${t} Grid Bot`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4 text-[10px]",children:[i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[#151b23] text-[#9CA3AF]",children:_e}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-[#FF71731a] text-[#FF7173]",children:["Leverage ",Vn,"x"]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-y-2 gap-x-6 text-[12px] mb-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Number.isFinite(Number(c))&&Number.isFinite(Number(d))?`${Number(c).toFixed(sn)} - ${Number(d).toFixed(sn)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Xn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:P==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:bn>0?`${bn} ${t}`:"--"})]}),st,st,st,st]}),i.jsx("div",{className:"mt-2 pt-3 border-t border-[#292929]",children:i.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[i.jsx("span",{className:"font-medium",style:{color:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:Dn>0?`${Dn.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:$e,disabled:fe,children:fe?"Starting...":"Confirm"})})]})})]})}const s1n=["arithmetic","geometric"],i1n=10,a1n="https://express-proxy-delta.vercel.app/proxy?url=",o1n="https://api.starknet.extended.exchange/api/v1";function l1n(t,e,n,r,s,a=1){const o=Number(t),l=Number(e),c=Number(n);if(!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(c))return[];if(c<2||l<=o)return[];const u=Number.isFinite(Number(r))?Number(r):0,d=Math.max(1,Number(a)||1),f=Math.max(0,u)*d,x=c>0?f/c:0;if(s==="geometric"){if(!(o>0)||!(l>0))return[];const C=Math.pow(l/o,1/(c-1));return Array.from({length:c},(N,P)=>{const T=o*Math.pow(C,P),M=T>0?x/T:0;return{index:P,price:T,qty:M,order_size_usd:x}})}const g=(l-o)/(c-1),y=(o+l)/2,v=y>0?x/y:0;return Array.from({length:c},(C,N)=>{const P=o+g*N;return{index:N,price:P,qty:v,order_size_usd:x}})}function gAe({entry:t,side:e,notionalUSD:n,maintenanceFrac:r,marginMode:s,accountValueUSD:a,isolatedMarginUSD:o}){const l=Number(t)||0,c=Math.abs(Number(n)||0);if(!l||!c)return null;const u=e==="buy"?1:-1,d=Math.max(0,Number(r)||0),f=c/l,x=c*d;let g;s==="Cross"?g=a-x:g=o-x;const y=1-d*u;if(!f||!isFinite(y))return null;const v=l-u*(g/f)/y;return Math.max(0,v)}function YQ(t){const e=String(t||""),n=e.indexOf(":");return n>0?e.slice(0,n).toLowerCase():"hl"}function c1n(t,e,n=6){if(!Number.isFinite(t)||t<=0)return n-0;const r=5,s=Math.max(0,n-0),a=Math.floor(Math.log10(t))+1,o=Math.max(0,r-a);return Math.min(s,o)}function bAe({coin:t,midPrice:e,selectedPrice:n,wallet:r,onWalletChange:s,onLevelsChange:a}){var rr,ls,cs;const{setSignInConnectButtonOpen:o}=m.useContext(Qr),l=nfe();m.useState("short");const[c,u]=m.useState("neutral"),[d,f]=m.useState(""),[x,g]=m.useState(""),[y,v]=m.useState(2),[C,N]=m.useState("2"),[P,T]=m.useState(""),[M,F]=m.useState("arithmetic"),[$,L]=m.useState(""),[z,X]=m.useState(0),[ne,J]=m.useState(10),[K,te]=m.useState(!1),[fe,q]=m.useState(!1),[se,ae]=m.useState(!1),[W,V]=m.useState(50),[ee,oe]=m.useState(0),[de,Ce]=m.useState(!1),[me,we]=m.useState(!1),[xe,be]=m.useState(()=>r&&r.id&&r.address?{id:r.id,address:r.address,apiKey:r.apiKey}:{id:null,address:null,apiKey:null}),[je,Ie]=m.useState({address:null,token:null}),[Re,Qe]=m.useState(null),[Ke,dt]=m.useState(""),[tt,nt]=m.useState(""),[Le,Be]=m.useState(""),[ht,pt]=m.useState(""),[Gt,wt]=m.useState(!1),[nn,cn]=m.useState(!1),[Un,Xt]=m.useState(!1),[an,Jt]=m.useState(!1),[Ye,Je]=m.useState(0),It=m.useRef(null),hn=m.useRef(!1),Yt=et=>{const gt=Number(et);if(!Number.isFinite(gt)||gt<=0)return{num:null,str:""};const Tn=gt>=3?gt*.99:gt,sr=Number(Tn.toFixed(2));return{num:Number.isFinite(sr)?sr:null,str:Number.isFinite(sr)?String(gt.toFixed(2)):""}},Rt=()=>{f(""),g(""),v(2),N("2"),F("arithmetic"),L(""),X(0),J(10),T(""),u("neutral"),dt(""),nt(""),Be(""),pt(""),wt(!1),cn(!1),Xt(!1),Jt(!1),It.current=null,hn.current=!1},{address:ot,isConnected:De}=ns(),ze=!(De&&!!(typeof window<"u"&&window.localStorage.getItem("hyperToken"))),[rt,mt]=m.useState([]),[Lt,kt]=m.useState(!1),dn=m.useRef(!1),rn=Lt&&(!rt||rt.length===0);m.useEffect(()=>{r&&r.id&&r.address&&be(et=>et.id===r.id&&et.address&&et.address.toLowerCase()===r.address.toLowerCase()?et:{id:r.id,address:r.address,apiKey:r.apiKey})},[r==null?void 0:r.id,r==null?void 0:r.address,r==null?void 0:r.apiKey]),m.useEffect(()=>{const et=()=>{const gt=typeof window<"u"?window.localStorage.getItem("hyperAddress"):null,Tn=typeof window<"u"?window.localStorage.getItem("hyperToken"):null;Ie({address:gt,token:Tn})};return et(),window.addEventListener("localStorageUpdated",et),window.addEventListener("storage",et),()=>{window.removeEventListener("localStorageUpdated",et),window.removeEventListener("storage",et)}},[]),m.useEffect(()=>{if(!je.address||!je.token){mt([]);return}let et=!1;return(async()=>{try{kt(!0);const sr=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:je.address.toLowerCase(),token:je.token,balance:"true"})})).json().catch(()=>({}));if(et)return;if(sr!=null&&sr.success&&Array.isArray(sr.data)){const Tr=sr.data.map((Lr,$r)=>({...Lr,wallet_id:Lr.wallet_id??Lr.id??$r,wallet_address:Lr.wallet_address||"",wallet_name:Lr.wallet_name||Lr.name||`Extended Wallet ${$r+1}`,wallet_api_key:Lr.wallet_api_key||Lr.api_key||null}));mt(Tr)}else mt([])}catch(Tn){et||(console.error("Extended wallet list error",Tn),mt([]))}finally{et||kt(!1)}})(),()=>{et=!0}},[je.address,je.token]),m.useEffect(()=>{if(xe.id||!rt||!rt.length)return;const et=rt.find(Tn=>Tn.confirmed)||rt[0];if(!et)return;const gt={id:et.wallet_id,address:et.wallet_address,apiKey:et.wallet_api_key};be(gt),typeof s=="function"&&s({id:String(gt.id),address:gt.address,apiKey:gt.apiKey})},[rt,xe.id,s]),m.useEffect(()=>{if(!(xe!=null&&xe.id)||!(rt!=null&&rt.length))return;const et=rt.find(sr=>String(sr.wallet_id)===String(xe.id));if(!et||!(xe.apiKey!==et.wallet_api_key||!xe.address&&et.wallet_address))return;const Tn={id:et.wallet_id,address:et.wallet_address,apiKey:et.wallet_api_key};be(Tn),typeof s=="function"&&s({id:String(Tn.id),address:Tn.address,apiKey:Tn.apiKey})},[xe==null?void 0:xe.id,xe==null?void 0:xe.apiKey,xe==null?void 0:xe.address,rt,s]),m.useEffect(()=>{t&&(Rt(),te(!1))},[t]);const gn=m.useMemo(()=>{if(!t)return null;const et=String(t).toUpperCase(),gt=et.replace(/-USD$/,"");return l.find(Tn=>{const sr=String((Tn==null?void 0:Tn.symbol)||"").toUpperCase(),Tr=String((Tn==null?void 0:Tn.rawSymbol)||"").toUpperCase();return sr===et||Tr===et||sr===gt||Tr===gt})||null},[l,t]),An=m.useMemo(()=>{const et=gn==null?void 0:gn.marketStats,gt=(et==null?void 0:et.markPrice)??(et==null?void 0:et.lastPrice)??(et==null?void 0:et.indexPrice)??(gn==null?void 0:gn.markPrice)??(gn==null?void 0:gn.lastPrice)??(gn==null?void 0:gn.last)??null,Tn=Number(gt);return Number.isFinite(Tn)?Tn:0},[gn]);m.useEffect(()=>{var Tn;const et=((Tn=gn==null?void 0:gn.tradingConfig)==null?void 0:Tn.maxLeverage)??(gn==null?void 0:gn.maxLeverage)??(gn==null?void 0:gn.leverage),gt=Number(et);!Number.isFinite(gt)||gt<=0||(V(gt),J(sr=>Math.min(gt,Math.max(1,Number(sr)||1))))},[gn]);const kn=(xe==null?void 0:xe.address)||(ot?ot.toLowerCase():null),{perpsOverview:yn}=sP(kn),Vn=m.useMemo(()=>{const et=rt.find(Lr=>String(Lr.wallet_id)===String(xe==null?void 0:xe.id)),gt=(et==null?void 0:et.available_balance)??(et==null?void 0:et.balance)??null,Tn=Number(gt);if(!(xe!=null&&xe.apiKey))return Number.isFinite(Tn)?Tn:null;const sr=Number(Re==null?void 0:Re.availableForTrade);if(Number.isFinite(sr))return sr;if(Number.isFinite(Tn))return Tn;if(!yn||yn.balance==null)return null;const Tr=Number(yn.balance);return Number.isFinite(Tr)?Tr:null},[Re,yn,xe==null?void 0:xe.apiKey,xe==null?void 0:xe.id,rt]);m.useEffect(()=>{if(!(xe!=null&&xe.apiKey)){Qe(null);return}let et=!1;const gt=async()=>{var sr,Tr,Lr;try{const $r=`${a1n}${encodeURIComponent(`${o1n}/user/balance`)}`,wr=await(await fetch($r,{headers:{"X-Api-Key":xe.apiKey}})).json().catch(()=>null);if(!et){const ss=((sr=wr==null?void 0:wr.data)==null?void 0:sr.availableForTrade)??(wr==null?void 0:wr.availableForTrade)??((Tr=wr==null?void 0:wr.data)==null?void 0:Tr.available_balance)??(wr==null?void 0:wr.available_balance)??((Lr=wr==null?void 0:wr.data)==null?void 0:Lr.available)??(wr==null?void 0:wr.available),mr=Number(ss);Qe({availableForTrade:Number.isFinite(mr)&&mr>=0?mr:null,raw:wr})}}catch{et||Qe(null)}};gt();const Tn=setInterval(gt,2e4);return()=>{et=!0,clearInterval(Tn)}},[xe==null?void 0:xe.apiKey]);const Kn=(et,gt)=>{var dr,Er,pr,fr;const Tn=et.priceRange||{},Tr=(Array.isArray(et.gridPrices)?et.gridPrices:[]).map(Yr=>Yr&&typeof Yr=="object"&&Yr.price!=null?Number(Yr.price):Number(Yr)).filter(Yr=>Number.isFinite(Yr));let Lr=Tn.lower,$r=Tn.upper;(!Number.isFinite(Lr)||!Number.isFinite($r))&&Tr.length>=2&&(Lr=Tr[0],$r=Tr[Tr.length-1]),Number.isFinite(Lr)?f(String(Lr)):f(""),Number.isFinite($r)?g(String($r)):g("");let lr=et.gridType;lr!=="geometric"&&lr!=="arithmetic"&&(lr="arithmetic"),F(lr);const wr=et.grid_side_mode??et.gridSideMode??et.gridSide??et.sideMode??null,ss=String(wr||"").toLowerCase(),mr=et.grid_count_base??et.gridCountBase??et.grid_count_input??et.gridCountInput??null,es=Number(mr);let Ys=et.gridCount;Number.isFinite(Ys)||Tr.length>=2&&(Ys=Tr.length);const _s=ss&&ss!=="neutral"&&Number.isFinite(es)?es:Ys;Number.isFinite(_s)?(v(_s),N(String(_s))):(v(2),N("2")),u(ss==="short"||ss==="short_only"?"short":ss==="long"||ss==="long_only"?"long":"neutral");const br=et.investment||{};br&&br.leverage!=null&&Number.isFinite(Number(br.leverage))&&J(Number(br.leverage));const zt=br.wallet_balance??br.walletBalance??br.balance??br.available_balance??br.availableBalance??null,he=(br==null?void 0:br.collateral_input)??(br==null?void 0:br.collateralInput)??(br==null?void 0:br.collateral)??(br==null?void 0:br.collateral_used)??(br==null?void 0:br.collateralUsed)??(br==null?void 0:br.collateralEffective)??null,it=Number(he);if(br&&Number.isFinite(it)){const{num:Yr,str:is}=Yt(it);L(is),It.current=Yr;const Ir=br.percentChosen!=null?Number(br.percentChosen):br.percent!=null?Number(br.percent):null,yr=Ir!=null&&Number.isFinite(Ir),Jn=Number(zt);if(yr)X(Math.max(0,Math.min(100,Ir))),hn.current=!1;else{const gs=Number.isFinite(Jn)&&Jn>0?Jn:gt;if(gs&&gs>0&&Yr>0){const Zs=Yr/gs*100;X(Math.max(0,Math.min(100,Zs))),hn.current=!1}else X(0),hn.current=Yr>0}}else L(""),X(0),It.current=null,hn.current=!1;const Ct=et.trailing_up??((dr=et==null?void 0:et.trailing)==null?void 0:dr.up),vt=et.trailing_down??((Er=et==null?void 0:et.trailing)==null?void 0:Er.down),ln=et.sl_up??((pr=et==null?void 0:et.sl)==null?void 0:pr.up),xn=et.sl_down??((fr=et==null?void 0:et.sl)==null?void 0:fr.down);dt(Ct!=null&&Number.isFinite(Number(Ct))?String(Ct):""),nt(vt!=null&&Number.isFinite(Number(vt))?String(vt):""),Be(ln!=null&&Number.isFinite(Number(ln))?String(ln):""),pt(xn!=null&&Number.isFinite(Number(xn))?String(xn):""),wt(Ct!=null&&Number.isFinite(Number(Ct))),cn(vt!=null&&Number.isFinite(Number(vt))),Xt(ln!=null&&Number.isFinite(Number(ln))),Jt(xn!=null&&Number.isFinite(Number(xn)))};m.useEffect(()=>{if(!hn.current)return;const et=Number(It.current),gt=Number(Vn);if(!Number.isFinite(et)||et<=0||!Number.isFinite(gt)||gt<=0)return;const Tn=et/gt*100;X(Math.max(0,Math.min(100,Tn))),hn.current=!1},[Vn]),m.useEffect(()=>{if(typeof window>"u")return;if(!t||!(xe!=null&&xe.id)||!(xe!=null&&xe.address)){te(!1),Rt();return}let et=!1;async function gt(){q(!0);try{const Tn=window.localStorage.getItem("hyperToken");if(!Tn){et||(te(!1),Rt(),q(!1));return}const sr={address:window.localStorage.getItem("hyperAddress"),token:Tn,wallet_id:Number(xe.id),source_market:"extended",coin:String(t||"").toUpperCase()},Lr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/info/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(sr)})).json().catch(()=>null);if(et)return;if(dn.current){dn.current=!1,q(!1);return}const $r=Lr&&Lr.data?Lr.data:Lr,wr=(Array.isArray($r)?$r:[$r]).filter(Boolean).filter(mr=>mr&&typeof mr=="object"&&String(mr.coin||"").toUpperCase()===String(t||"").toUpperCase()&&String(mr.wallet_id||"")===String(xe.id||"")),ss=wr.find(mr=>mr&&typeof mr=="object"&&mr.is_deleted===!1&&mr.bot_params)||wr.find(mr=>mr&&typeof mr=="object"&&mr.is_deleted!==!0&&mr.bot_params)||null;if(ss){if(ss.wallet_id&&String(ss.wallet_id)!==String(xe.id)){const mr=rt.find(es=>String(es.wallet_id)===String(ss.wallet_id));if(mr){const es={id:mr.wallet_id,address:mr.wallet_address,apiKey:mr.wallet_api_key};be(es),typeof s=="function"&&s({id:String(es.id),address:es.address,apiKey:es.apiKey})}}Kn(ss.bot_params,Vn),te(!0)}else te(!1),Rt(),f(""),g("")}catch{te(!1),Rt(),f(""),g("")}finally{et||q(!1)}}return gt(),()=>{et=!0}},[t,xe==null?void 0:xe.id,xe==null?void 0:xe.address,Ye,rt,s]),m.useEffect(()=>{if(typeof window>"u")return;const et=window.localStorage.getItem("gridbot:pending_selection");if(!et)return;let gt=null;try{gt=JSON.parse(et)}catch{gt=null}if(!(!gt||gt.sourceMarket&>.sourceMarket!=="extended"||String(gt.coin||"").toUpperCase()!==String(t||"").toUpperCase())){if(dn.current=!0,Kn(gt.botParams||{},Vn),gt.isActive===!0?te(!0):gt.isActive===!1&&te(!1),gt.walletId&&rt&&rt.length){const Tn=rt.find(sr=>String(sr.wallet_id)===String(gt.walletId));if(Tn){const sr={id:Tn.wallet_id,address:Tn.wallet_address,apiKey:Tn.wallet_api_key};be(sr),typeof s=="function"&&s({id:String(sr.id),address:sr.address,apiKey:sr.apiKey})}}try{window.localStorage.removeItem("gridbot:pending_selection")}catch{}}},[t,rt,s,Vn]),m.useEffect(()=>{const et=gt=>{const Tn=gt&>.detail&>.detail.sourceMarket;Tn&&Tn!=="extended"||Je(sr=>sr+1)};return window.addEventListener("gridbotUpdated",et),()=>{window.removeEventListener("gridbotUpdated",et)}},[]),m.useEffect(()=>{const et=gt=>{const Tn=gt&>.detail;if(!Tn)return;const sr=Tn.sourceMarket||Tn.source_market;if(sr&&sr!=="extended"||String(Tn.coin||"").toUpperCase()!==String(t||"").toUpperCase())return;const Lr=Tn.botParams||{};if(Kn(Lr,Vn),dn.current=!0,Tn.isActive===!0?te(!0):Tn.isActive===!1&&te(!1),Tn.walletId&&rt&&rt.length){const $r=rt.find(lr=>String(lr.wallet_id)===String(Tn.walletId));if($r){const lr={id:$r.wallet_id,address:$r.wallet_address,apiKey:$r.wallet_api_key};be(lr),typeof s=="function"&&s({id:String(lr.id),address:lr.address,apiKey:lr.apiKey})}}};return window.addEventListener("gridbotSelectFromTasks",et),()=>{window.removeEventListener("gridbotSelectFromTasks",et)}},[t,rt,s]);const Dn=m.useMemo(()=>Math.min(W,Math.max(1,Number(ne)||1)),[ne,W]),Xn=(()=>{const et=Number($);return!Number.isFinite(et)||et<=0?0:et>=3?et*.99:et})(),Nn=Number($)||0,on=m.useMemo(()=>{const et=Number(d),gt=Number(x);return!Number.isFinite(et)||!Number.isFinite(gt)?null:(et+gt)/2},[d,x]),Oe=m.useMemo(()=>{if(An>0)return An;const et=Number(e||0);if(et>0)return et;const gt=Number(n||0);return gt>0?gt:on!=null&&on>0?on:0},[An,e,n,on]),Zt=Number.isFinite(Oe)&&Oe>0?Oe:on,sn=m.useMemo(()=>l1n(d,x,y,Xn,M,Dn),[d,x,y,Xn,M,Dn]),jt=m.useMemo(()=>{const et=sn.map((ss,mr)=>{const es=Number(ss==null?void 0:ss.price);return Number.isFinite(es)?{index:Number.isFinite(ss==null?void 0:ss.index)?ss.index:mr,price:es}:null}).filter(Boolean);if(!et.length)return[];const gt=Xn*Dn,Tn=Number.isFinite(Zt)&&Zt>0?Zt:null;let sr=0,Tr=0;if(Tn!=null)for(const ss of et)ss.price>=Tn?Tr+=1:sr+=1;else sr=et.length;let Lr=et.length;c==="long"?Lr=sr+Tr*2:c==="short"&&(Lr=Tr+sr*2),(!Number.isFinite(Lr)||Lr<=0)&&(Lr=et.length);const $r=Lr>0?gt/Lr:0,lr=on??0,wr=M==="geometric";return et.map(ss=>{const mr=wr?ss.price>0?$r/ss.price:0:lr>0?$r/lr:0;return{index:ss.index,price:ss.price,qty:mr,order_size_usd:$r}})},[sn,Xn,Dn,on,M,c,Zt]),Qn=m.useMemo(()=>jt.length?jt.map(et=>({price:et.price,side:Zt==null?null:Number(et.price)>=Zt?"sell":"buy"})):[],[jt,Zt]);m.useEffect(()=>{typeof a=="function"&&a(Qn)},[Qn,a]);const bn=et=>{const gt=Number(et);if(!(gt>0))return;const Tn=gt*.01;f((gt-Tn).toFixed(2)),g((gt+Tn).toFixed(2))},Dt=Oe,en=Xn*Dn,Pn=jt.length,tr=m.useMemo(()=>{if(!jt.length)return 0;let et=0,gt=0;for(const Tn of jt){const sr=Number(Tn==null?void 0:Tn.qty);Number.isFinite(sr)&&(et+=sr,gt+=1)}return gt?et/gt:0},[jt]),ar=Number(gn==null?void 0:gn.collateralAssetPrecision),hr=Number(gn==null?void 0:gn.assetPrecision),qt=(rr=gn==null?void 0:gn.tradingConfig)==null?void 0:rr.minOrderSizeChange,zn=(()=>{const et=Number(qt);if(!Number.isFinite(et))return null;const[,gt=""]=String(qt).split(".");return Math.max(0,gt.length)})(),Zn=Number.isFinite(ar)?ar:Number.isFinite(hr)?hr:4,Ft=zn!=null&&Number.isFinite(zn)?zn:Zn,En=Number((ls=gn==null?void 0:gn.tradingConfig)==null?void 0:ls.minPriceChange),Ee=m.useMemo(()=>Number.isFinite(En)&&En>0?En>=1?0:Math.min(8,Math.max(0,-Math.floor(Math.log10(En)))):c1n(Oe),[En,Oe]),h=Ee,p=Number(((cs=gn==null?void 0:gn.tradingConfig)==null?void 0:cs.minOrderSize)??0),S=0,_=tr>0?Number(tr.toFixed(Ft)):0,k=m.useMemo(()=>jt.some(et=>Number(et==null?void 0:et.qty)>0),[jt]),I=k&&p>0&&jt.some(et=>{const gt=Number(et==null?void 0:et.qty);return Number.isFinite(gt)?gt<p:!1}),B=k&&S>0,G=m.useMemo(()=>{if(!k||jt.length===0)return 0;let et=1/0;for(const gt of jt){const Tn=Number(gt==null?void 0:gt.price),sr=Number(gt==null?void 0:gt.qty);if(!Number.isFinite(Tn)||!Number.isFinite(sr))continue;if(Tn<=0||sr<=0){et=0;break}const Tr=Tn*sr;Tr<et&&(et=Tr)}return et===1/0?0:et},[k,jt]),re=k&&G<i1n,ce=Oe>0&&en>0&&Xn>0?gAe({entry:Oe,side:"buy",notionalUSD:en,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Xn,isolatedMarginUSD:Xn}):null,ue=Oe>0&&en>0&&Xn>0?gAe({entry:Oe,side:"sell",notionalUSD:en,maintenanceFrac:.01,marginMode:"Cross",accountValueUSD:Xn,isolatedMarginUSD:Xn}):null,ge=m.useMemo(()=>{if(!d&&!x)return"";const et=Number(d),gt=Number(x);if(!Number.isFinite(et)||!Number.isFinite(gt))return"";if(!(gt>et))return"Upper price must be greater than lower price.";if(Dt>0){if(et>Dt)return`Lower price cannot be above mark price (${Dt.toFixed(Ee)}).`;if(gt<Dt)return`Upper price cannot be below mark price (${Dt.toFixed(Ee)}).`}return""},[d,x,Dt,Ee]),Ae=m.useMemo(()=>{const et=Number(d),gt=Number(x);return!(!Number.isFinite(et)||!Number.isFinite(gt)||!(gt>et)||Dt>0&&(et>Dt||gt<Dt))},[d,x,Dt]),ke=Number(d),Me=Number(x),qe=Number(Ke),Fe=Number(tt),at=Number(Le),ie=Number(ht),Se=Gt&&(Ke===""||!Number.isFinite(qe)||!(qe>Me)),$e=nn&&(tt===""||!Number.isFinite(Fe)||!(Fe<ke));m.useEffect(()=>{Gt||dt(""),nn||nt("")},[Gt,nn]),m.useEffect(()=>{Un||Be(""),an||pt("")},[Un,an]);const Ue=Un&&(Le===""||!Number.isFinite(at)||!Gt&&Number.isFinite(Me)&&!(at>Me)||Gt&&Number.isFinite(qe)&&!(at>qe)),_e=an&&(ht===""||!Number.isFinite(ie)||!nn&&Number.isFinite(ke)&&!(ie<ke)||nn&&Number.isFinite(Fe)&&!(ie<Fe)),st=Pn>1&&Ae&&Xn>0&&Dn>0&&(xe==null?void 0:xe.id)&&(xe==null?void 0:xe.address),ut=ee>0,yt=!!P,Mt=I||B,Kt=Se||$e||Ue||_e,un=st&&!fe&&!se&&!rn&&!ut&&!yt&&!Mt&&!re&&!Kt,Xe=se||fe||rn||yt||Mt||re||ut||Kt?!1:K?!0:st,Pt=K||se||fe||rn;m.useEffect(()=>{if(!ee)return;const et=setInterval(()=>oe(gt=>gt>1?gt-1:0),1e3);return()=>clearInterval(et)},[ee]);const Wt=()=>{if(Pt)return;const et=An>0?An:Oe>0?Oe:Number(e||n||0);!Number.isFinite(et)||et<=0||bn(et)},ct=et=>{if(Pt)return;hn.current=!1;const gt=Math.max(0,Math.min(100,Number(et)||0));if(X(gt),!Vn||Vn<=0){gt===0&&L("");return}const Tn=Vn*gt/100;Yt(Tn),L(Number.isFinite(Tn)?Tn.toFixed(2):"")},Ge=et=>{if(Pt)return;hn.current=!1;const gt=Number(et);if(L(et),!Vn||!Number.isFinite(gt)||gt<=0||Vn<=0){X(0);return}const Tn=(gt>=3?gt*.99:gt)/Vn*100;X(Math.max(0,Math.min(100,Tn)))},Tt=async()=>{if(!un||typeof window>"u"||!(xe!=null&&xe.address)||!(xe!=null&&xe.id))return;const et=jt.filter(_s=>Number.isFinite(_s==null?void 0:_s.price));if(et.length<2)return;const gt=et[0],Tn=et[et.length-1],sr=et.length,Tr=sr>1?sr-1:0,Lr=M!=="geometric"&&Tr>0?(Tn.price-gt.price)/Tr:null,$r=M==="geometric"&&Tr>0?Math.pow(Tn.price/gt.price,1/Tr):null,lr=(gt.price+Tn.price)/2,wr=window.localStorage.getItem("hyperToken");if(!wr)return;if(Gt&&Se){tn.error("Trailing Up is invalid.");return}if(nn&&$e){tn.error("Trailing Down is invalid.");return}if(Un&&Ue){const _s=Gt?"SL Up must be greater than Trailing Up.":"SL Up must be greater than Upper price.";tn.error(_s);return}if(an&&_e){const _s=nn?"SL Down must be less than Trailing Down.":"SL Down must be less than Lower price.";tn.error(_s);return}const ss=_,mr=YQ(t),es={symbol:String(t||"").toUpperCase(),dex:mr,gridType:M==="geometric"?"geometric":"arithmetic",direction:c,grid_side_mode:c,grid_count_base:y,priceRange:{lower:Number(gt.price.toFixed(h)),upper:Number(Tn.price.toFixed(h)),middle:Number(lr.toFixed(h))},gridCount:sr,gridPrices:et.map(_s=>({price:Number(_s.price.toFixed(h)),qty:Number(Number(_s.qty||0).toFixed(Ft))})),trailing_up_grid_prices:(()=>{if(!(Gt&&!Se&&Number.isFinite(qe)))return[];const _s=[];if(M==="geometric"&&$r&&$r>0){let br=Tn.price*$r,zt=0;for(;br<=qe+1e-12&&zt<500;){const he=(Oe>0,_);_s.push({price:Number(br.toFixed(h)),qty:Number(he.toFixed(Ft))}),br*=$r,zt+=1}}else if(Lr&&Lr>0)for(let br=Tn.price+Lr,zt=0;br<=qe+1e-12&&zt<500;br+=Lr,zt+=1)_s.push({price:Number(br.toFixed(h)),qty:Number(_.toFixed(Ft))});return _s})(),trailing_down_grid_prices:(()=>{if(!(nn&&!$e&&Number.isFinite(Fe)))return[];const _s=[];if(M==="geometric"&&$r&&$r>0){let br=gt.price/$r,zt=0;for(;br>=Fe-1e-12&&zt<500;)_s.push({price:Number(br.toFixed(h)),qty:Number(_.toFixed(Ft))}),br/=$r,zt+=1}else if(Lr&&Lr>0)for(let br=gt.price-Lr,zt=0;br>=Fe-1e-12&&zt<500;br-=Lr,zt+=1)_s.push({price:Number(br.toFixed(h)),qty:Number(_.toFixed(Ft))});return _s})(),investment:{collateral:Nn,collateralUsed:Xn,percentChosen:z,leverage:Dn,totalInvestment:Xn,qtyPerOrder:ss},liquidationPrices:{long:ce?Number(ce.toFixed(2)):null,short:ue?Number(ue.toFixed(2)):null},trailing_up:Gt&&!Se?Number(qe.toFixed(h)):null,trailing_down:nn&&!$e?Number(Fe.toFixed(h)):null,sl_up:Un&&!Ue?Number(at.toFixed(h)):null,sl_down:an&&!_e?Number(ie.toFixed(h)):null,marginMode:"Cross",currentPrice:Oe||null,timestamp:new Date().toISOString()},Ys={address:window.localStorage.getItem("hyperAddress"),token:wr,wallet_id:Number(xe.id),source_market:"extended",bot_params:es,coin:String(t||"").toUpperCase()};ae(!0);try{const br=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/save/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ys)})).json().catch(()=>null);if(!(br&&(br.success===!0||br.status==="ok"||br.status==="success"))){const he=br&&(br.error_message||br.message||br.detail)||"Grid bot failed to start.";tn.error(he);return}te(!0),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),tn.success("Grid bot started.")}catch{tn.error("An error occurred while starting the grid bot.")}finally{ae(!1)}},fn=async()=>{if(typeof window>"u"||!(xe!=null&&xe.address)||!(xe!=null&&xe.id))return;const et=window.localStorage.getItem("hyperToken");if(!et)return;YQ(t);const gt={address:window.localStorage.getItem("hyperAddress"),token:et,wallet_id:Number(xe.id),source_market:"extended",coin:String(t||"").toUpperCase()};ae(!0);try{const sr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/extended_bot/stop/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gt)})).json().catch(()=>null);if(!(sr&&(sr.success===!0||sr.status==="ok"||sr.status==="success"))){const Lr=sr&&(sr.error_message||sr.message||sr.detail)||"Grid bot could not be stopped.";tn.error(Lr);return}te(!1),oe(10),typeof window<"u"&&window.dispatchEvent(new CustomEvent("gridbotUpdated",{detail:{sourceMarket:"extended"}})),tn.success("Grid bot has been stopped.")}catch{tn.error("An error occurred while stopping the grid bot.")}finally{ae(!1)}},Yn=()=>{Xe&&(K?fn():we(!0))},Fn=async()=>{un&&(we(!1),await Tt())},Gn=se?K?"Stopping...":"Starting...":K?"Stop":ut?`Stopping ${ee}s`:"Start",Sr=["xyz","vntl","flx"].includes(YQ(t))?"Isolated":"Cross",ur=Gt&&!Se,kr=nn&&!$e,Bn=Un&&!Ue,Sn=an&&!_e,Mn=[{key:"neutral",label:"Neutral",activeClass:"bg-[#E6E6E6] text-[#101010] border-[#E6E6E6]"},{key:"short",label:"Short Only",activeClass:"bg-[#FF7173] text-[#0f151a] border-[#FF7173]"},{key:"long",label:"Long Only",activeClass:"bg-[#67FFBD] text-[#0f151a] border-[#67FFBD]"}];return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"h-full w-full flex flex-col text-[13px]",children:[i.jsx("div",{className:"px-3 pb-2 flex items-center justify-between border-b border-[#292929]"}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pb-3 space-y-4 mt-2",children:[i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Perps Wallet"}),i.jsx(iP,{wallets:rt,mode:"extended",value:xe&&xe.id?String(xe.id):"",onChange:et=>{const gt=(rt||[]).find(Tn=>String(Tn.wallet_id)===String(et))||null;if(gt){const Tn={id:gt.wallet_id,address:gt.wallet_address,apiKey:gt.wallet_api_key};be(Tn),typeof s=="function"&&s({id:String(Tn.id),address:Tn.address,apiKey:Tn.apiKey})}},selectedBalance:Vn})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Grid Mode"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:Mn.map(et=>{const gt=c===et.key;return i.jsx("button",{type:"button",onClick:()=>{Pt||u(et.key)},disabled:Pt,"aria-pressed":gt,className:`h-8 rounded-lg border text-[11px] font-semibold transition-colors ${Pt?"opacity-60 cursor-not-allowed":"cursor-pointer"} ${gt?et.activeClass:"bg-[#161616] text-white/60 border-[#292929] hover:text-white"}`,children:et.label},et.key)})})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between mt-2",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Price Range"}),i.jsx("button",{type:"button",onClick:Wt,disabled:Pt,className:"text-[11px] px-2 py-0.5 rounded-md bg-[#161616] border border-[#292929] text-white/60 hover:text-white disabled:opacity-60 disabled:cursor-not-allowed",children:"Autofill"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Lower"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:d,onChange:et=>{Pt||f(et.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pt})})]}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"text-[11px] text-white/40",children:"Upper"}),i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex items-center",children:i.jsx("input",{value:x,onChange:et=>{Pt||g(et.target.value)},className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"0",inputMode:"decimal",disabled:Pt})})]})]}),Dt>0&&i.jsxs("div",{className:"text-[11px] text-white/40",children:["Mark Price: ",Dt.toFixed(Ee)]}),ge&&i.jsx("div",{className:"text-[11px] text-[#FF7173]",children:ge})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx("span",{className:"text-xs text-white/70",children:"Number of Grids (Even only)"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:i.jsx("input",{value:C,onChange:et=>{if(Pt)return;const gt=et.target.value.replace(/[^\d]/g,"");if(N(gt),T(""),gt==="")return;const Tn=Number(gt);if(Number.isFinite(Tn)){if(Tn<2){T("The minimum number of grids must be 2.");return}if(Tn>200){T("The maximum number of grids is 200.");return}if(Tn%2!==0){T("The number of grids must be even.");return}v(Tn)}},className:"bg-transparent outline-none flex-1 text-[13px]",inputMode:"numeric",disabled:Pt})}),i.jsx("div",{className:"relative",children:i.jsx("select",{value:M,onChange:et=>{Pt||F(et.target.value)},className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 text-[12px] outline-none",disabled:Pt,children:s1n.map(et=>i.jsx("option",{value:et,className:"bg-[#101010]",children:et[0].toUpperCase()+et.slice(1)},et))})})]}),i.jsx("div",{className:"text-[11px] text-white/40",children:P&&i.jsx("div",{className:"text-[11px] text-[#FF7173] mt-1",children:P})})]}),(c==="short"||c==="long")&&i.jsx("section",{className:"space-y-2",children:i.jsx("div",{className:"flex items-center gap-3 h-8 min-w-0",children:i.jsx(gi,{content:"Enable [Open a position on creation] to automatically open a position at market price when the grid is created.",children:i.jsxs("label",{className:"flex items-center gap-2 shrink-0 w-24",children:[i.jsx("input",{type:"checkbox",checked:!0,className:"accent-[#67FFBD]"}),i.jsx("span",{className:"text-[11px] select-none text-white/80 min-w-max",children:"Open a position on creation"})]})})})}),i.jsxs("section",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-white/70",children:"Investment"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"bg-[#161616] border border-[#292929] rounded-lg px-2 py-1.5 flex-1 flex items-center",children:[i.jsx("input",{value:$,onChange:et=>Ge(et.target.value),className:"bg-transparent outline-none flex-1 text-[13px]",placeholder:"USDC",inputMode:"decimal",disabled:Pt}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"USDC"})]}),i.jsx("div",{className:"flex flex-col gap-1 w-[120px]",children:i.jsx(z4,{onClick:W&&W>0&&!Pt?()=>Ce(!0):void 0,children:W&&W>0?`${Dn}x`:"--"})})]}),i.jsxs("div",{className:"flex items-center gap-3 !mt-4 pb-6",children:[i.jsx(vA,{value:z,onChange:et=>ct(et),accent:"#67FFBD"}),i.jsxs("div",{className:"h-[30px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-xs",inputMode:"numeric",value:z,onChange:et=>ct(Math.max(0,Math.min(100,Number(et.target.value)||0))),style:{color:Bi,fontFeatureSettings:'"tnum"'},disabled:Pt}),i.jsx("span",{style:{color:wi},className:"ml-1",children:"%"})]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between mt-2 border-t border-[#292929] pt-4 font-semibold",children:[i.jsxs("span",{children:["Max ",t,": ",`${W}x`]}),i.jsxs("span",{children:["Total:"," ",en>0?`${en.toFixed(2)} USDC`:"--"]})]}),i.jsxs("div",{className:"text-[11px] text-white/40 flex justify-between font-semibold",children:[i.jsxs("span",{children:["Qty per order:"," ",_>0?`${_} ${t}`:"--"]}),i.jsxs("span",{children:["Margin Mode: ",Sr]})]})]}),i.jsxs("section",{className:"pt-2 border-t border-[#292929]",children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-2",children:[i.jsx("span",{children:"Est. Liq Long"}),i.jsx("span",{children:ce?`$${ce.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-white/40 mb-3",children:[i.jsx("span",{children:"Est. Liq Short"}),i.jsx("span",{children:ue?`$${ue.toLocaleString(void 0,{maximumFractionDigits:2})}`:"--"})]}),ze?i.jsx(om,{onClick:()=>typeof o=="function"?o(!0):null}):i.jsx("button",{type:"button",onClick:Yn,disabled:!Xe,className:`w-full h-[32px] rounded-xl font-bold text-[13px] flex items-center justify-center transition-opacity ${Xe?K?"bg-[#FF7173] text-black hover:opacity-90":"bg-[#67FFBD] text-black hover:opacity-90":"bg-[#303030] text-white/40 cursor-not-allowed opacity-70"}`,children:Gn}),I&&i.jsxs("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:["Quantity per order is below min size (",p," ",t,")."]}),B,re&&i.jsx("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:"Each grid order must be at least $10 notional. Increase your investment, reduce the number of grids, or lower leverage."}),Kt&&i.jsx("div",{className:"mt-2 text-[11px] text-[#FF7173] text-center",children:"Fix trailing/SL input errors to start."})]})]})]}),i.jsx(lp,{open:de,onClose:()=>Ce(!1),children:i.jsxs(ym,{title:"Adjust Leverage",children:[i.jsxs("div",{className:"text-[12px] leading-5 mb-3",style:{color:wi},children:["Control the leverage used for ",t," grid bot positions. The maximum leverage is ",W,"x."]}),i.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[i.jsx("input",{type:"range",min:1,max:W||1,step:1,value:ne,onChange:et=>J(Math.max(1,Math.min(W||1,Number(et.target.value)))),className:"flex-1",style:{accentColor:"#67FFBD"}}),i.jsxs("div",{className:"h-[36px] rounded-lg flex items-center px-2",style:{width:84,background:Ro,border:`1px solid ${Ra}`},children:[i.jsx("input",{className:"w-full bg-transparent outline-none text-right text-white",inputMode:"numeric",value:ne,onChange:et=>{const gt=Number(et.target.value)||1,Tn=Math.max(1,Math.min(W||1,gt));J(Tn)}}),i.jsx("span",{className:"text-[11px] text-white/40 ml-1",children:"x"})]})]}),i.jsx(z0,{onClick:()=>Ce(!1),children:"Confirm"})]})}),i.jsx(lp,{open:me,onClose:()=>we(!1),children:i.jsxs(ym,{title:`${t} Grid Bot`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4 text-[10px]",children:[i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-[#151b23] text-[#9CA3AF]",children:Sr}),i.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-[#FF71731a] text-[#FF7173]",children:["Leverage ",Dn,"x"]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-y-2 gap-x-6 text-[12px] mb-4",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Price Range"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Number.isFinite(Number(d))&&Number.isFinite(Number(x))?`${Number(d).toFixed(h)} - ${Number(x).toFixed(h)} USDC`:"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Number of Grids"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:Pn||"--"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Mode"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:M==="geometric"?"Geometric":"Arithmetic"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Qty Per Order"}),i.jsx("div",{className:"font-medium",style:{color:Bi},children:_>0?`${_} ${t}`:"--"})]}),ur&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Trailing Up"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(Ke).toFixed(h)," USDC"]})]}),kr&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"Trailing Down"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(tt).toFixed(h)," USDC"]})]}),Bn&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"SL Up"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(Le).toFixed(h)," USDC"]})]}),Sn&&i.jsxs("div",{children:[i.jsx("div",{className:"text-[11px]",style:{color:wi},children:"SL Down"}),i.jsxs("div",{className:"font-medium",style:{color:Bi},children:[Number(ht).toFixed(h)," USDC"]})]})]}),i.jsx("div",{className:"mt-2 pt-3 border-t border-[#292929]",children:i.jsxs("div",{className:"flex items-center justify-between text-[12px]",children:[i.jsx("span",{className:"font-medium",style:{color:Bi},children:"Total Investment"}),i.jsx("span",{className:"font-semibold text-[#67FFBD]",children:en>0?`${en.toFixed(2)} USDC`:"--"})]})}),i.jsx("div",{className:"mt-4",children:i.jsx(z0,{onClick:Fn,disabled:se,children:se?"Starting...":"Confirm"})})]})})]})}const wA="/assets/fee-animation-Cvx53PQy.mp4",u1n="wss://mainnet.zklighter.elliot.ai/stream",d1n="https://api.hyperliquid.xyz/info",QD=t=>t==null?0:Number(t),ZD=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),f1n=(t,e)=>{if(isNaN(t))return"--";const n=Number(e);let r=0;return n>0&&n<1&&(r=Math.min(8,Math.max(0,-Math.floor(Math.log10(n))))),t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:r})},h1n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},p1n={BTC:{1:{value:1},10:{value:2},20:{value:5},50:{value:10},100:{value:100},1e3:{value:1e3}},ETH:{.1:{value:.1},.2:{value:.2},.5:{value:.5},1:{value:1},10:{value:10},100:{value:100}}},m1n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=p1n[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null};async function x1n(t){var o;const n=await fetch(d1n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"l2Book",coin:t})});if(!n.ok)throw new Error("info request failed");const r=await n.json(),s=(r==null?void 0:r.levels)||((o=r==null?void 0:r.data)==null?void 0:o.levels),a=Array.isArray(s==null?void 0:s[0])&&s[0]||(s==null?void 0:s.bs)||(s==null?void 0:s.bids)||[];if(!Array.isArray(a)||!a.length)throw new Error("orderbook empty or bad format");return a}function g1n(t){const e=t.slice(0,10).map(o=>Number(o.px??(Array.isArray(o)?o[0]:void 0))).filter(o=>Number.isFinite(o)),n=[];for(let o=0;o<e.length-1;o++){const l=e[o]-e[o+1];l>0&&n.push(l)}if(!n.length)return 0;const s=Math.min(...n).toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),a=Number(s);return Number.isFinite(a)?a:0}function b1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function y1n(t,e){if(!t||t<=0)return[];const n=Math.floor(Math.log10(t)),r=[];e>0&&r.push(e);const s=n-4,a=Math.pow(10,s);[1,2,5].forEach(g=>r.push(g*a));const o=n-3;r.push(Math.pow(10,o));const l=n-2;r.push(Math.pow(10,l));const c=n-1;r.push(Math.pow(10,c));const u=r.filter(g=>g>0&&Number.isFinite(g)).map(b1n),d=Array.from(new Set(u)).sort((g,y)=>g-y),f=e>0?e:0;return d.filter(g=>g>=f&&g>0)}function yAe(t){const n=(t||"").toUpperCase()==="BTC"?[1,10,20,50,100,1e3,1e4]:[.001,.01,.1,10,100];return Array.from(new Set(n)).sort((r,s)=>r-s)}async function v1n(t){if(!t)return[];const e=String(t).trim(),n=m1n(e);if(n&&n.length)return n;const r=e.toUpperCase();try{const s=await x1n(e),a=s[0],o=Number((a==null?void 0:a.px)??(Array.isArray(a)?a[0]:void 0));if(!Number.isFinite(o)||o<=0)throw new Error("bad bestBid");const l=g1n(s);let c=y1n(o,l);return r!=="BTC"?c=c.filter(u=>u!==1):c.includes(1)||c.push(1),c=Array.from(new Set(c.filter(u=>Number.isFinite(u)&&u>0))).sort((u,d)=>u-d),c.length?c:yAe(e)}catch(s){return console.error("getUiStepsForCoin error",e,s),yAe(e)}}function vAe(t,e,n){const r=new Map;for(const s of t||[]){const a=QD(s.px),o=QD(s.sz);if(!a||!o||!e)continue;const l=n==="bid"?Math.floor(a/e)*e:Math.ceil(a/e)*e,c=Number(l.toFixed(12));r.set(c,(r.get(c)||0)+o)}return[...r.entries()].map(([s,a])=>({price:s,size:a}))}function w1n({marketId:t,baseSymbol:e,rows:n=16,onSelectPrice:r,onBest:s}){const a=m.useRef(null),o=m.useRef(null),l=m.useRef(0),c=m.useRef({bids:new Map,asks:new Map}),u=m.useRef(!1),d=m.useRef(!0),[f,x]=m.useState({bids:[],asks:[]}),[g,y]=m.useState("COIN"),[v,C]=m.useState(null),[N,P]=m.useState([]),T=(ae,W)=>g==="USD"?ae*W:ae,M=g==="USD"?"USD":e?String(e):"COIN";m.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]);const F=()=>{u.current||(u.current=!0,requestAnimationFrame(()=>{if(u.current=!1,!d.current)return;const ae=c.current;if(!((ae==null?void 0:ae.bids)instanceof Map)||!((ae==null?void 0:ae.asks)instanceof Map))return;const W=512,V=Array.from(ae.bids.entries()).map(([oe,de])=>({px:oe,sz:de})).sort((oe,de)=>de.px-oe.px).slice(0,W),ee=Array.from(ae.asks.entries()).map(([oe,de])=>({px:oe,sz:de})).sort((oe,de)=>oe.px-de.px).slice(0,W);x({bids:V,asks:ee})}))},$=ae=>{if(ae==null)return;const W=a.current;if(W&&(W.readyState===WebSocket.OPEN||W.readyState===WebSocket.CONNECTING))return;const V=new WebSocket(u1n);a.current=V,V.onopen=()=>{l.current=0;const ee={type:"subscribe",channel:`order_book/${String(ae)}`};try{V.send(JSON.stringify(ee))}catch{}},V.onmessage=ee=>{let oe;try{oe=JSON.parse(ee.data||"{}")}catch{return}if((oe==null?void 0:oe.type)!=="update/order_book")return;const de=`order_book:${String(ae)}`;if(oe.channel!==de)return;const Ce=oe.order_book;if(!Ce)return;let me=c.current;(!me||typeof me!="object")&&(me={bids:new Map,asks:new Map},c.current=me),me.bids instanceof Map||(me.bids=new Map),me.asks instanceof Map||(me.asks=new Map);const we=(xe,be)=>{const je=Array.isArray(Ce[xe])?Ce[xe]:[];if(je.length)for(const Ie of je){const Re=Number(Ie.price),Qe=Number(Ie.size);Number.isFinite(Re)&&(!Number.isFinite(Qe)||Qe<=0?be.delete(Re):be.set(Re,Qe))}};we("bids",me.bids),we("asks",me.asks),F()},V.onclose=()=>{l.current=Math.min(l.current+1,6),!o.current&&(o.current=setTimeout(()=>{o.current=null,$(ae)},500*Math.pow(2,l.current)))},V.onerror=()=>{try{V.close()}catch{}}};m.useEffect(()=>{if(a.current)try{a.current.onmessage=null,a.current.onopen=null,a.current.onclose=null,a.current.onerror=null,a.current.close()}catch{}if(a.current=null,o.current&&(clearTimeout(o.current),o.current=null),l.current=0,c.current={bids:new Map,asks:new Map},x({bids:[],asks:[]}),P([]),C(null),t==null)return;$(t);let ae=!1;return(async()=>{const W=await v1n(e||"");ae||(P(W),C(W[0]??null))})(),()=>{ae=!0}},[t,e]);const L=m.useMemo(()=>(f.bids||[]).map(ae=>QD(ae.px)).filter(ae=>Number.isFinite(ae)&&ae>0),[f]),z=m.useMemo(()=>(f.asks||[]).map(ae=>QD(ae.px)).filter(ae=>Number.isFinite(ae)&&ae>0),[f]),X=L.length?Math.max(...L):null,ne=z.length?Math.min(...z):null;m.useEffect(()=>{X!=null&&ne!=null&&(s==null||s({bestBid:X,bestAsk:ne,mid:(X+ne)/2}))},[X,ne,s]);const J=m.useMemo(()=>{const ae=Number(v)||1,W=vAe(f.bids,ae,"bid").sort((ee,oe)=>oe.price-ee.price),V=vAe(f.asks,ae,"ask").sort((ee,oe)=>ee.price-oe.price);return{bids:W,asksAsc:V}},[f,v]),K=m.useMemo(()=>{const ae=J.asksAsc.slice(0,n);let W=0;return ae.map(ee=>(W+=T(ee.size,ee.price),{...ee,total:W})).reverse()},[J,n,g]),te=m.useMemo(()=>{const ae=J.bids.slice(0,n);let W=0;return ae.map(V=>(W+=T(V.size,V.price),{...V,total:W}))},[J,n,g]),fe=m.useMemo(()=>{if(X==null||ne==null)return null;const ae=Math.abs(ne-X),W=(ne+X)/2;return{diff:ae,pct:W?ae/W*100:0}},[X,ne]),q=Math.max(K.reduce((ae,W)=>Math.max(ae,W.total||0),0),1e-9),se=Math.max(te.reduce((ae,W)=>Math.max(ae,W.total||0),0),1e-9);return i.jsxs("div",{className:"flex flex-col h-full w-full font-semibold font-inter",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#292929]",children:[i.jsx(CAe,{value:String(v??""),onChange:ae=>C(Number(ae)),items:(N||[]).map(ae=>({key:String(ae),label:h1n(ae)}))}),i.jsx(CAe,{value:g,onChange:y,items:[{key:"USD",label:"USD"},{key:"COIN",label:e||"COIN"}],align:"right"})]}),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] w-full",children:[i.jsx("span",{className:"uppercase",children:"Price"}),i.jsxs("span",{className:"uppercase text-center",children:["Size (",M,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",M,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[K.map((ae,W)=>i.jsx(wAe,{side:"ask",step:Number(v)||1,price:ae.price,size:ae.size!=null?T(ae.size,ae.price):null,total:ae.total,widthPct:ae.total?Math.min(100,ae.total/q*100):0,onClick:()=>ae.price!=null&&(r==null?void 0:r(ae.price)),unit:g},`ask-${W}`)),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] border-y border-[#292929] my-1 w-full",children:[i.jsx("span",{className:"uppercase",children:"Spread"}),i.jsx("span",{className:"text-right",children:fe?ZD(fe.diff,4):"--"}),i.jsx("span",{className:"text-right",children:fe?`${ZD(fe.pct,4)}%`:"--"})]}),te.map((ae,W)=>i.jsx(wAe,{side:"bid",step:Number(v)||1,price:ae.price,size:ae.size!=null?T(ae.size,ae.price):null,total:ae.total,widthPct:ae.total?Math.min(100,ae.total/se*100):0,onClick:()=>ae.price!=null&&(r==null?void 0:r(ae.price)),unit:g},`bid-${W}`))]})})]})}function wAe({side:t,price:e,size:n,total:r,widthPct:s,onClick:a,step:o,unit:l}){const c=e==null,u=t==="bid"?"from-transparent to-[#67ffbd]/30":"from-transparent to-[#FF7272]/30",d=t==="bid"?"text-[#67FFBD]":"text-[#FF797C]",f=l==="USD";return i.jsxs("div",{className:"relative w-full font-semibold",children:[!c&&i.jsx("div",{className:`absolute left-0 top-px bottom-px bg-gradient-to-r ${u} transition-all duration-300 ease-[cubic-bezier(0.42,0,0.58,1)]`,style:{width:`${Math.max(0,s-2)}%`}}),i.jsxs("div",{className:`grid grid-cols-[84px_1fr_1fr] px-3 py-1 text-xs relative w-full ${c?"":"cursor-pointer"}`,onClick:c?void 0:a,children:[i.jsx("span",{className:`${c?"text-[#555]":d} hover:text-white`,children:c?"—":f1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":ZD(n,f?0:6)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":ZD(r,f?0:6)})]})]})}function CAe({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=m.useState(!1),o=m.useRef(null);return m.useEffect(()=>{if(!s)return;const u=d=>{o.current&&(o.current.contains(d.target)||a(!1))};return window.addEventListener("mousedown",u),window.addEventListener("touchstart",u),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("touchstart",u)}},[s]),i.jsxs("div",{className:"relative",ref:o,children:[i.jsxs("button",{className:"h-7 px-2 text-xs rounded-md border border-[#292929] bg-[#101010] text-[#dcdada] flex items-center gap-1",onClick:()=>a(u=>!u),children:[((l=n.find(u=>u.key===t))==null?void 0:l.label)??((c=n.find(u=>String(u.key)===String(t)))==null?void 0:c.label)??t,i.jsx("span",{className:"text-[#8b8b8b]",children:"▾"})]}),s&&i.jsx("div",{className:`absolute z-10 mt-1 min-w-[80px] rounded-md border border-[#292929] bg-[#101010] p-1 ${r==="right"?"right-0":"left-0"}`,children:n.map(u=>i.jsx("div",{className:`px-2 py-1 text-xs rounded cursor-pointer ${String(u.key)===String(t)?"bg-[#262626] text-white":"text-[#dcdada] hover:bg-[#262626]"}`,onClick:()=>{e(u.key),a(!1)},children:u.label},u.key))})]})}const sd=t=>{const e=Number(t);return Number.isFinite(e)?e:0},SAe=(t,e)=>{if(!Number.isFinite(t))return"--";const n=Math.abs(t),r=Math.pow(10,-e);return n>0&&n<r?"0":t.toLocaleString(void 0,{maximumFractionDigits:e})},NAe=(t,e=6)=>isNaN(t)?"--":t.toLocaleString(void 0,{maximumFractionDigits:e}),C1n=(t,e)=>{if(isNaN(t))return"--";const n=Number(e);let r=0;return n>0&&n<1&&(r=Math.min(8,Math.max(0,-Math.floor(Math.log10(n))))),t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:r})},S1n=t=>{if(t>=1)return t.toLocaleString();const e=Math.min(8,Math.max(0,-Math.floor(Math.log10(t))));return t.toFixed(e)},N1n={BTC:{1:{value:1},10:{value:2},20:{value:5},50:{value:10},100:{value:100},1e3:{value:1e3}},ETH:{.1:{value:.1},.2:{value:.2},.5:{value:.5},1:{value:1},10:{value:10},100:{value:100}}},A1n=t=>{if(!t)return null;const e=String(t).toUpperCase(),n=N1n[e];return n?Object.values(n).map(s=>s.value).filter(s=>Number.isFinite(s)&&s>0).sort((s,a)=>s-a):null};function j1n(t){const e=t.toFixed(18).replace(/0+$/g,"").replace(/\.$/,""),n=Number(e);return Number.isFinite(n)?n:0}function E1n(t,e){if(!t||t<=0)return[];const n=Math.floor(Math.log10(t)),r=[];e>0&&r.push(e);const s=n-4,a=Math.pow(10,s);[1,2,5].forEach(g=>r.push(g*a));const o=n-3;r.push(Math.pow(10,o));const l=n-2;r.push(Math.pow(10,l));const c=n-1;r.push(Math.pow(10,c));const u=n;r.push(Math.pow(10,u));const d=r.filter(g=>g>0&&Number.isFinite(g)).map(j1n),f=Array.from(new Set(d)).sort((g,y)=>g-y),x=e>0?e:0;return f.filter(g=>g>=x&&g>0)}function AAe(t){const e=(t||"").toUpperCase();return e==="BTC"?[1,10,20,50,100,1e3,1e4]:e==="ETH"?[.1,.2,.5,1,5,10,50,100]:[1e-4,.001,.01,.1,1,10,100]}async function _1n(t,e){const n=`${t}/info/markets?market=${encodeURIComponent(e)}`,r=await fetch(n);if(!r.ok)throw new Error("markets info request failed");const s=await r.json();return(Array.isArray(s==null?void 0:s.data)?s.data:[])[0]||null}async function k1n(t,e){const n=`${t}/info/markets/${encodeURIComponent(e)}/orderbook`,r=await fetch(n);if(!r.ok)throw new Error("orderbook request failed");const s=await r.json(),a=s==null?void 0:s.data,o=Array.isArray(a==null?void 0:a.bid)?a.bid:[],l=Array.isArray(a==null?void 0:a.ask)?a.ask:[];return{bids:o,asks:l}}async function T1n({apiBaseUrl:t,market:e,baseSymbol:n}){var s,a,o,l;const r=A1n(n);if(r&&r.length)return r;try{const c=await _1n(t,e),u=sd((s=c==null?void 0:c.tradingConfig)==null?void 0:s.minPriceChange),d=sd((a=c==null?void 0:c.marketStats)==null?void 0:a.lastPrice)||sd((o=c==null?void 0:c.marketStats)==null?void 0:o.askPrice)||sd((l=c==null?void 0:c.marketStats)==null?void 0:l.bidPrice);let f=E1n(d,u);return f=Array.from(new Set(f.filter(x=>Number.isFinite(x)&&x>0))).sort((x,g)=>x-g),f.length?f:AAe(n)}catch{return AAe(n)}}function jAe(t,e,n){const r=new Map;for(const s of t||[]){const a=sd(s.px),o=sd(s.sz);if(!a||!o||!e)continue;const l=n==="bid"?Math.floor(a/e)*e:Math.ceil(a/e)*e,c=Number(l.toFixed(12));r.set(c,(r.get(c)||0)+o)}return[...r.entries()].map(([s,a])=>({price:s,size:a}))}function P1n({market:t,baseSymbol:e,rows:n=16,onSelectPrice:r,onBest:s,apiBaseUrl:a="https://express-proxy-delta.vercel.app/proxy?url=https://api.starknet.extended.exchange/api/v1",wsBaseUrl:o="wss://api.starknet.extended.exchange"}){var Ce;const c=m.useRef(null),u=m.useRef(null),d=m.useRef(0),f=m.useRef(null),x=m.useRef({bids:new Map,asks:new Map}),g=m.useRef(!1),y=m.useRef(!0),[v,C]=m.useState({bids:[],asks:[]}),[N,P]=m.useState("COIN"),[T,M]=m.useState(null),[F,$]=m.useState([]),L=(me,we)=>N==="USD"?me*we:me,z=N==="USD"?"USD":e?String(e):"COIN";m.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]);const X=()=>{g.current||(g.current=!0,requestAnimationFrame(()=>{if(g.current=!1,!y.current)return;const me=x.current;if(!((me==null?void 0:me.bids)instanceof Map)||!((me==null?void 0:me.asks)instanceof Map))return;const we=1024,xe=Array.from(me.bids.entries()).map(([je,Ie])=>({px:je,sz:Ie})).sort((je,Ie)=>Ie.px-je.px).slice(0,we),be=Array.from(me.asks.entries()).map(([je,Ie])=>({px:je,sz:Ie})).sort((je,Ie)=>je.px-Ie.px).slice(0,we);C({bids:xe,asks:be})}))},ne=(me,we)=>{const xe=x.current||{bids:new Map,asks:new Map};xe.bids=new Map,xe.asks=new Map,x.current=xe;for(const be of me||[]){const je=sd((be==null?void 0:be.p)??(be==null?void 0:be.price)),Ie=sd((be==null?void 0:be.q)??(be==null?void 0:be.qty));if(!je||!Number.isFinite(Ie)||Ie<=1e-8)continue;const Re=Number(Ie.toFixed(12));Re>1e-8&&xe.bids.set(je,Re)}for(const be of we||[]){const je=sd((be==null?void 0:be.p)??(be==null?void 0:be.price)),Ie=sd((be==null?void 0:be.q)??(be==null?void 0:be.qty));if(!je||!Number.isFinite(Ie)||Ie<=1e-8)continue;const Re=Number(Ie.toFixed(12));Re>1e-8&&xe.asks.set(je,Re)}},J=(me,we)=>{for(const xe of me||[]){const be=sd(xe==null?void 0:xe.p),je=sd(xe==null?void 0:xe.q);if(!be||!Number.isFinite(je)||je===0)continue;const Re=sd(we.get(be)||0)+je;if(Math.abs(Re)<=1e-8)we.delete(be);else{const Qe=Number(Re.toFixed(12));Qe<=0?we.delete(be):we.set(be,Qe)}}},K=me=>{if(!me)return;const we=c.current;if(we&&(we.readyState===WebSocket.OPEN||we.readyState===WebSocket.CONNECTING))return;const xe=`${o}/stream.extended.exchange/v1/orderbooks/${encodeURIComponent(me)}`,be=new WebSocket(xe);c.current=be,be.onopen=()=>{d.current=0,f.current=null},be.onmessage=je=>{let Ie;try{Ie=JSON.parse(je.data||"{}")}catch{return}const Re=Number(Ie==null?void 0:Ie.seq);if(Number.isFinite(Re)){const Be=f.current;if(Be!=null&&Re!==Be+1){try{be.close()}catch{}return}f.current=Re}const Qe=String((Ie==null?void 0:Ie.type)||"").toUpperCase(),Ke=Ie==null?void 0:Ie.data;if(!Ke)return;const dt=Array.isArray(Ke)?Ke.find(Be=>String(Be==null?void 0:Be.m)===String(me)):Ke;if(!dt||String(dt==null?void 0:dt.m)!==String(me))return;const tt=String((dt==null?void 0:dt.t)||Qe).toUpperCase(),nt=(dt==null?void 0:dt.b)||[],Le=(dt==null?void 0:dt.a)||[];if(tt==="SNAPSHOT")ne(nt,Le);else if(tt==="DELTA"){const Be=x.current;Be!=null&&Be.bids||(Be.bids=new Map),Be!=null&&Be.asks||(Be.asks=new Map),J(nt,Be.bids),J(Le,Be.asks)}else return;X()},be.onclose=()=>{d.current=Math.min(d.current+1,6),!u.current&&(u.current=setTimeout(()=>{u.current=null,K(me)},500*Math.pow(2,d.current)))},be.onerror=()=>{try{be.close()}catch{}}};m.useEffect(()=>{if(c.current)try{c.current.onmessage=null,c.current.onopen=null,c.current.onclose=null,c.current.onerror=null,c.current.close()}catch{}if(c.current=null,u.current&&(clearTimeout(u.current),u.current=null),d.current=0,f.current=null,x.current={bids:new Map,asks:new Map},C({bids:[],asks:[]}),$([]),M(null),!t)return;let me=!1;return(async()=>{try{const we=await k1n(a,t);if(me)return;ne(((we==null?void 0:we.bids)||[]).map(xe=>({price:xe.price,qty:xe.qty})),((we==null?void 0:we.asks)||[]).map(xe=>({price:xe.price,qty:xe.qty}))),X()}catch{}})(),K(t),(async()=>{const we=await T1n({apiBaseUrl:a,market:t,baseSymbol:e||t.split("-")[0]});me||($(we),M(we[0]??null))})(),()=>{me=!0}},[t,e,a,o]);const te=m.useMemo(()=>(v.bids||[]).map(me=>sd(me.px)).filter(me=>Number.isFinite(me)&&me>0),[v]),fe=m.useMemo(()=>(v.asks||[]).map(me=>sd(me.px)).filter(me=>Number.isFinite(me)&&me>0),[v]),q=te.length?Math.max(...te):null,se=fe.length?Math.min(...fe):null;m.useEffect(()=>{q!=null&&se!=null&&(s==null||s({bestBid:q,bestAsk:se,mid:(q+se)/2}))},[q,se,s]);const ae=m.useMemo(()=>{const me=Number(T)||1,we=jAe(v.bids,me,"bid").sort((be,je)=>je.price-be.price),xe=jAe(v.asks,me,"ask").sort((be,je)=>be.price-je.price);return{bids:we,asksAsc:xe}},[v,T]),W=m.useMemo(()=>{const me=ae.asksAsc.slice(0,n);let we=0;return me.map(be=>(we+=L(be.size,be.price),{...be,total:we})).reverse()},[ae,n,N]),V=m.useMemo(()=>{const me=ae.bids.slice(0,n);let we=0;return me.map(xe=>(we+=L(xe.size,xe.price),{...xe,total:we}))},[ae,n,N]),ee=m.useMemo(()=>{if(q==null||se==null)return null;const me=Math.abs(se-q),we=(se+q)/2;return{diff:me,pct:we?me/we*100:0}},[q,se]),oe=Math.max(W.reduce((me,we)=>Math.max(me,we.total||0),0),1e-9),de=Math.max(V.reduce((me,we)=>Math.max(me,we.total||0),0),1e-9);return i.jsxs("div",{className:"flex flex-col h-full w-full font-semibold font-inter",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#292929]",children:[i.jsx(_Ae,{value:String(T??""),onChange:me=>M(Number(me)),items:(F||[]).map(me=>({key:String(me),label:S1n(me)}))}),i.jsx(_Ae,{value:N,onChange:P,items:[{key:"USD",label:"USD"},{key:"COIN",label:e||((Ce=t==null?void 0:t.split("-"))==null?void 0:Ce[0])||"COIN"}],align:"right"})]}),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] w-full",children:[i.jsx("span",{className:"uppercase",children:"Price"}),i.jsxs("span",{className:"uppercase text-center",children:["Size (",z,")"]}),i.jsxs("span",{className:"uppercase text-right",children:["Total (",z,")"]})]}),i.jsx("div",{className:"flex-1 overflow-hidden w-full",children:i.jsxs("div",{className:"overflow-auto w-full",children:[W.map((me,we)=>i.jsx(EAe,{side:"ask",step:Number(T)||1,price:me.price,size:me.size!=null?L(me.size,me.price):null,total:me.total,widthPct:me.total?Math.min(100,me.total/oe*100):0,onClick:()=>me.price!=null&&(r==null?void 0:r(me.price)),unit:N},`ask-${we}`)),i.jsxs("div",{className:"grid grid-cols-[84px_1fr_1fr] px-3 py-2 text-[11px] text-[#9b9b9b] border-y border-[#292929] my-1 w-full",children:[i.jsx("span",{className:"uppercase",children:"Spread"}),i.jsx("span",{className:"text-right",children:ee?NAe(ee.diff,4):"--"}),i.jsx("span",{className:"text-right",children:ee?`${NAe(ee.pct,4)}%`:"--"})]}),V.map((me,we)=>i.jsx(EAe,{side:"bid",step:Number(T)||1,price:me.price,size:me.size!=null?L(me.size,me.price):null,total:me.total,widthPct:me.total?Math.min(100,me.total/de*100):0,onClick:()=>me.price!=null&&(r==null?void 0:r(me.price)),unit:N},`bid-${we}`))]})})]})}function EAe({side:t,price:e,size:n,total:r,widthPct:s,onClick:a,step:o,unit:l}){const c=e==null,u=t==="bid"?"from-transparent to-[#67ffbd]/30":"from-transparent to-[#FF7272]/30",d=t==="bid"?"text-[#67FFBD]":"text-[#FF797C]",x=l==="USD"?2:8;return i.jsxs("div",{className:"relative w-full font-semibold",children:[!c&&i.jsx("div",{className:`absolute left-0 top-px bottom-px bg-gradient-to-r ${u} transition-all duration-300 ease-[cubic-bezier(0.42,0,0.58,1)]`,style:{width:`${Math.max(0,s-2)}%`}}),i.jsxs("div",{className:`grid grid-cols-[84px_1fr_1fr] px-3 py-1 text-xs relative w-full ${c?"":"cursor-pointer"}`,onClick:c?void 0:a,children:[i.jsx("span",{className:`${c?"text-[#555]":d} hover:text-white`,children:c?"—":C1n(e,o)}),i.jsx("span",{className:"text-center text-[#dcdada] hover:text-white",children:c?"—":SAe(n,x)}),i.jsx("span",{className:"text-right text-[#a8a8a8] hover:text-white",children:c?"—":SAe(r,x)})]})]})}function _Ae({value:t,onChange:e,items:n,align:r="left"}){var l,c;const[s,a]=m.useState(!1),o=m.useRef(null);return m.useEffect(()=>{if(!s)return;const u=d=>{o.current&&(o.current.contains(d.target)||a(!1))};return window.addEventListener("mousedown",u),window.addEventListener("touchstart",u),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("touchstart",u)}},[s]),i.jsxs("div",{className:"relative",ref:o,children:[i.jsxs("button",{className:"h-7 px-2 text-xs rounded-md border border-[#292929] bg-[#101010] text-[#dcdada] flex items-center gap-1",onClick:()=>a(u=>!u),children:[((l=n.find(u=>u.key===t))==null?void 0:l.label)??((c=n.find(u=>String(u.key)===String(t)))==null?void 0:c.label)??t,i.jsx("span",{className:"text-[#8b8b8b]",children:"▾"})]}),s&&i.jsx("div",{className:`absolute z-10 mt-1 min-w-[80px] rounded-md border border-[#292929] bg-[#101010] p-1 ${r==="right"?"right-0":"left-0"}`,children:n.map(u=>i.jsx("div",{className:`px-2 py-1 text-xs rounded cursor-pointer ${String(u.key)===String(t)?"bg-[#262626] text-white":"text-[#dcdada] hover:bg-[#262626]"}`,onClick:()=>{e(u.key),a(!1)},children:u.label},u.key))})]})}const qF="#67FFBD",I1n={type:"spring",stiffness:260,damping:26,mass:1},Mqe=t=>{const e=Number(t);return Number.isFinite(e)?e:null},lg=(...t)=>{for(const e of t){const n=Mqe(e);if(n!=null)return n}return null},F1n=t=>{const e=Mqe(t);return e==null?null:Math.abs(e)>1?e/100:e};function F7({title:t,subtitle:e}){return i.jsx("div",{className:"w-full h-full flex items-center justify-center px-4",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-sm text-white font-semibold mb-1",children:t}),i.jsx("div",{className:"text-xs text-white/50",children:e})]})})}function GF({code:t,onCodeChange:e,onSubmit:n,loading:r,checking:s,message:a}){const o=r||s||!t.trim();return i.jsxs("div",{className:"relative h-full w-full flex justify-center overflow-hidden rounded-[16px] bg-black",children:[i.jsx(Ao.div,{className:"pointer-events-none absolute -inset-[40%] opacity-80 blur-3xl",style:{background:"radial-gradient(circle at 15% 0%, rgba(103,255,189,0.32), transparent 55%), radial-gradient(circle at 85% 100%, rgba(103,255,189,0.24), transparent 60%)"},initial:{x:"-4%",y:"-8%"},animate:{x:["-4%","4%","-2%","-4%"],y:["-8%","6%","2%","-8%"]},transition:{duration:24,repeat:1/0,ease:"easeInOut"}}),i.jsxs(Ao.div,{initial:{opacity:0,y:16,scale:.96},animate:{opacity:1,y:0,scale:1},transition:{duration:.5,ease:[.16,1,.3,1]},className:"relative z-10 w-full max-w-[460px] rounded-2xl border border-[#17211b] bg-[#050505] shadow-[0_30px_90px_rgba(0,0,0,0.9)] overflow-hidden",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-50",children:i.jsx("div",{className:"w-full h-full",style:{background:"radial-gradient(900px 500px at 50% -10%, rgba(103,255,189,0.45), transparent 70%)"}})}),i.jsx("video",{src:wA,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},wA)]}),i.jsxs("div",{className:"px-5 pb-5 pt-4 space-y-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"text-[11px] font-medium tracking-[0.18em] uppercase",style:{color:qF},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:qF},children:"Alpha Code"})]}),i.jsx("p",{className:"text-[12px] text-white/60",children:"Grid Bot is currently in private alpha. Enter your invitation code to unlock this feature in your account."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[11px] text-white/45",children:"Alpha Code"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"text",value:t,onChange:l=>e(l.target.value.toUpperCase()),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),n())},placeholder:"DXTR-XXXXX",autoComplete:"off",spellCheck:!1,className:"flex-1 h-10 px-3 rounded-md bg-[#050505] border border-[#1e2e27] text-[13px] tracking-[0.18em] font-mono text-white placeholder:text-white/20 focus:outline-none focus:border-[#67FFBD]"}),i.jsx("button",{type:"button",onClick:n,disabled:o,className:`h-10 px-4 rounded-md text-[13px] font-semibold transition-colors ${o?"bg-[#101613] text-white/40 cursor-not-allowed":"text-black hover:opacity-90"}`,style:o?void 0:{backgroundColor:qF},children:r?"Checking…":"Access"})]})]}),(s||a)&&i.jsxs("div",{className:"text-[11px] min-h-[16px]",children:[s&&!a&&i.jsx("span",{className:"text-white/40",children:"Checking your eligibility…"}),a&&i.jsx("span",{style:{color:qF},children:a})]})]})]})]})}function O1n({data:t,loading:e,error:n,coin:r,setCoin:s,period:a,periods:o,handlePeriodChange:l}){var tr,ar,hr,qt,zn,Zn;const c=jo(),u=Kl(),{exchange:d,coin:f}=g2(),{address:x,isConnected:g}=ns(),{setSignInConnectButtonOpen:y}=m.useContext(Qr),[v,C]=m.useState("single"),[N,P]=m.useState("BTC/ETH"),[T,M]=m.useState([]),[F,$]=m.useState(2),[L,z]=m.useState("1m"),[X,ne]=m.useState(null),[J,K]=m.useState(null),[te,fe]=m.useState({}),[q,se]=m.useState({id:null,address:null}),[ae,W]=m.useState(!1),[V,ee]=m.useState(!1),[oe,de]=m.useState(()=>typeof window>"u"||window.location.hash==="#gridbot"?"grid":window.location.hash==="#trade"?"trade":"grid"),[Ce,me]=m.useState([]),[we,xe]=m.useState(()=>d==="lighter"?"lighter":d==="extended"?"extended":"hyperliquid"),[be,je]=m.useState(()=>r||f||"BTC"),[Ie,Re]=m.useState(()=>d==="lighter"&&f||"BTC"),[Qe,Ke]=m.useState(()=>d==="extended"&&f||"BTC"),[dt,tt]=m.useState(null),[nt,Le]=m.useState(!1),[Be,ht]=m.useState(null),[pt,Gt]=m.useState(!1),[wt,nn]=m.useState(null),[cn,Un]=m.useState(!1),[Xt,an]=m.useState({address:null,token:null}),[Jt,Ye]=m.useState(!1),[Je,It]=m.useState(!1),[hn,Yt]=m.useState(!1),[Rt,ot]=m.useState(!1),[De,At]=m.useState(""),[ze,rt]=m.useState(!1),[mt,Lt]=m.useState(""),kt=m.useRef(null),dn=m.useRef(null),rn=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,gn=Ft=>z(Ft),An=gz(),kn=tfe(),yn=nfe(),Vn=we==="hyperliquid"?An:we==="lighter"?kn:yn,Kn=we==="hyperliquid"?!An.length:we==="lighter"?!kn.length:!yn.length,Dn=we==="hyperliquid"?be:we==="lighter"?Ie:Qe,Xn=we==="hyperliquid"&&v==="pair"?N:Dn,Nn=we==="hyperliquid"&&v==="pair"&&N.split("/")[0]||be,on=m.useMemo(()=>we==="lighter"&&Dn?kn.find(Ft=>Ft.symbol===Dn):null,[we,kn,Dn]),Oe=(on==null?void 0:on.marketIndex)??(on==null?void 0:on.market_id)??(on==null?void 0:on.id)??((tr=on==null?void 0:on.raw)==null?void 0:tr.marketIndex)??((ar=on==null?void 0:on.raw)==null?void 0:ar.market_id)??((hr=on==null?void 0:on.raw)==null?void 0:hr.id)??null,Zt=m.useMemo(()=>{if(!Dn)return null;const Ft=String(Dn||"").toUpperCase(),En=Ft.replace(/-USD$/,"");return yn.find(Ee=>{const h=String((Ee==null?void 0:Ee.symbol)||"").toUpperCase(),p=String((Ee==null?void 0:Ee.rawSymbol)||"").toUpperCase();return h===Ft||p===Ft||h===En||p===En})||null},[yn,Dn]),sn=m.useMemo(()=>{if(Zt!=null&&Zt.rawSymbol)return Zt.rawSymbol;if(!Dn)return"";const Ft=String(Dn||"").toUpperCase();return Ft.includes("-")?Ft:`${Ft}-USD`},[Zt,Dn]),jt=m.useMemo(()=>Zt!=null&&Zt.symbol?Zt.symbol:Dn?String(Dn||"").toUpperCase().replace(/-USD$/,"").replace(/\/USD$/,""):"",[Zt,Dn]),Qn=m.useMemo(()=>{const Ft=(Zt==null?void 0:Zt.lastPrice)??(Zt==null?void 0:Zt.last);if(Ft!=null&&Number.isFinite(Number(Ft)))return Number(Ft);const En=Zt==null?void 0:Zt.marketStats,Ee=(En==null?void 0:En.lastPrice)??(En==null?void 0:En.markPrice)??(Zt==null?void 0:Zt.markPrice)??null;return Ee!=null&&Number.isFinite(Number(Ee))?Number(Ee):null},[Zt]);m.useEffect(()=>{u.hash==="#gridbot"?de("grid"):u.hash==="#trade"?de("trade"):u.hash||de("grid")},[u.hash]),m.useEffect(()=>{d==="lighter"&&we!=="lighter"?xe("lighter"):d==="hyperliquid"&&we!=="hyperliquid"?xe("hyperliquid"):d==="extended"&&we!=="extended"&&xe("extended")},[d,we]),m.useEffect(()=>{d==="hyperliquid"?f&&f!==be&&(je(f),s(f)):d==="lighter"?f&&f!==Ie&&Re(f):d==="extended"&&f&&f!==Qe&&Ke(f)},[d,f,be,Ie,Qe,s]),m.useEffect(()=>{const Ft=()=>{if(typeof window>"u")return;const En=window.localStorage.getItem("hyperAddress"),Ee=window.localStorage.getItem("hyperToken");an({address:En,token:Ee})};return Ft(),window.addEventListener("localStorageUpdated",Ft),window.addEventListener("storage",Ft),()=>{window.removeEventListener("localStorageUpdated",Ft),window.removeEventListener("storage",Ft)}},[]);const bn=m.useMemo(()=>!Xt.address||!Xt.token?!1:rn?!0:x?Xt.address.toLowerCase()===x.toLowerCase():!1,[Xt.address,Xt.token,x,rn]);m.useEffect(()=>{if(!bn){Ye(!1),It(!1),Yt(!1),ot(!1),At(""),Lt("");return}if(Jt)return;let Ft=!1;return(async()=>{if(typeof window>"u")return;const Ee=window.localStorage.getItem("hyperToken"),h=window.localStorage.getItem("hyperAddress");if(!Ee||!h){Ft||(Ye(!0),It(!1),Yt(!1));return}ot(!0);try{const p=await ki(h.toLowerCase(),Ee);if(Ft)return;const S=(p==null?void 0:p.data)||p||{},_=(S==null?void 0:S.data)||S||{},k=_.grid_hyper_alpha_code??S.grid_hyper_alpha_code??!1,I=_.grid_lighter_alpha_code??S.grid_lighter_alpha_code??!1;It(!k),Yt(!I),Ye(!0)}catch{Ft||(It(!1),Yt(!1),Ye(!0))}finally{Ft||ot(!1)}})(),()=>{Ft=!0}},[bn,Jt]),m.useEffect(()=>{bn&&Ye(!1)},[we,bn]),m.useEffect(()=>{(we!=="lighter"||oe!=="grid")&&(At(""),Lt(""))},[we,oe]);const Dt=async()=>{var Ft,En,Ee,h;if(!De.trim()){tn.error("Please enter your alpha code");return}if(!Xt.address||!Xt.token){tn.error("Please sign in again");return}rt(!0),Lt("");try{const p={address:Xt.address.toLowerCase(),token:Xt.token,alpha_code:De.trim(),source_market:we==="hyperliquid"?"hyper":"lighter",app_type:"grid_bot"},_=(await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",p)).data||{};if(_.success){const k=_.message||"Alpha code added successfully";tn.success(k),Lt(k),we==="hyperliquid"?It(!1):we==="lighter"&&Yt(!1),Ye(!0)}else{const k=_.error_message||_.message||"This alpha code is invalid";tn.error(k),Lt(k)}}catch(p){const S=((En=(Ft=p==null?void 0:p.response)==null?void 0:Ft.data)==null?void 0:En.error_message)||((h=(Ee=p==null?void 0:p.response)==null?void 0:Ee.data)==null?void 0:h.message)||p.message||"Failed to validate alpha code";tn.error(S),Lt(S)}finally{rt(!1)}};m.useEffect(()=>{we==="hyperliquid"?s(be):we==="lighter"?!Ie&&kn.length>0&&Re(kn[0].symbol):we==="extended"&&!Qe&&yn.length>0&&Ke(yn[0].symbol)},[we,be,Ie,Qe,kn,yn,s]),m.useEffect(()=>{if(we!=="extended"||!yn.length)return;const Ft=yn.some(En=>En.symbol===Qe);(!Qe||!Ft)&&Ke(yn[0].symbol)},[we,Qe,yn]),m.useEffect(()=>{if(!x){if(rn&&Xt.address){se(Ft=>Ft.address&&Ft.address.toLowerCase()===Xt.address.toLowerCase()?Ft:{id:null,address:Xt.address});return}se(Ft=>Ft.address?{id:null,address:null}:Ft);return}se(Ft=>Ft.address&&Ft.address.toLowerCase()===x.toLowerCase()?Ft:{id:null,address:x})},[x,Xt.address,rn]),m.useEffect(()=>{if(we!=="hyperliquid"){if(kt.current){try{kt.current.close()}catch{}kt.current=null}M([]),dn.current=null;return}if(!Nn)return;const Ft=(En,Ee)=>{if(En)try{En.readyState===WebSocket.OPEN&&En.send(JSON.stringify(Ee))}catch(h){console.error("activeAssetCtx ws send error",h)}};if(kt.current){const En=kt.current;dn.current&&dn.current!==Nn&&Ft(En,{method:"unsubscribe",subscription:{type:"activeAssetCtx",coin:dn.current}}),Ft(En,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:Nn}})}else{const En=new WebSocket("wss://api-ui.hyperliquid.xyz/ws");kt.current=En,En.onopen=()=>{Ft(En,{method:"subscribe",subscription:{type:"activeAssetCtx",coin:Nn}})},En.onmessage=Ee=>{var p;let h;try{h=JSON.parse(Ee.data)}catch(S){console.error("activeAssetCtx ws parse error",S);return}(p=h==null?void 0:h.data)!=null&&p.ctx&&M({...h.data.ctx,source:"hyperliquid"})},En.onclose=()=>{kt.current===En&&(kt.current=null)},En.onerror=Ee=>{console.error("activeAssetCtx ws error",Ee)}}dn.current=Nn},[Nn,we]),m.useEffect(()=>()=>{kt.current&&(kt.current.close(),kt.current=null)},[]),m.useEffect(()=>{if(we!=="lighter")return;if(!Dn){M([]);return}const Ft=kn.find(k=>k.symbol===Dn);if(!Ft||!Ft.raw){M([]);return}const En=Ft.raw,Ee=Number(En.last_trade_price??0)||0,h=Number(En.daily_price_change??0)||0,p=Number(En.daily_quote_token_volume??0)||0,S=Number(En.open_interest??0)||0,_=h&&Ee?Ee/(1+h/100):Ee;M({markPx:Ee,oraclePx:Ee,prevDayPx:_,dayNtlVlm:p,openInterest:S,funding:0,source:"lighter"})},[we,Dn,kn]),m.useEffect(()=>{if(we!=="extended")return;if(!Zt){M([]);return}const Ft=Zt.marketStats||{},En=lg(Ft.markPrice,Ft.lastPrice,Ft.indexPrice,Zt.markPrice,Zt.lastPrice,Zt.last),Ee=lg(Ft.indexPrice,Ft.markPrice,Ft.lastPrice,Zt.indexPrice,En),h=lg(Ft.dailyPriceChange,Zt.dailyPriceChange),p=lg(Ft.dailyPriceChangePercentage,Zt.dailyPriceChangePercentage,Zt.change24hPct,Zt.chg24),S=F1n(p);let _=null;if(En!=null){if(h!=null){const ue=En-h;Number.isFinite(ue)&&ue>0&&(_=ue)}if(_==null&&S!=null){const ue=1+S;if(Number.isFinite(ue)&&ue!==0){const ge=En/ue;Number.isFinite(ge)&&ge>0&&(_=ge)}}}const k=lg(Ft.dailyVolume,Zt.volume,Zt.vol),I=lg(Ft.openInterestBase,Zt.openInterestBase),B=lg(Ft.openInterest,Zt.openInterestUsd,Zt.openInterest);let G=I;G==null&&B!=null&&Ee!=null&&Ee>0&&(G=B/Ee);const re=lg(Ft.fundingRate,Zt.fundingRate,Zt.funding),ce=lg(Ft.nextFundingRate,Zt.nextFundingRate);M({markPx:En,oraclePx:Ee,prevDayPx:_,dayNtlVlm:k,openInterest:G,funding:re,nextFundingTime:ce,source:"extended"})},[we,Zt]),m.useEffect(()=>{we==="hyperliquid"&&me([])},[we]),m.useEffect(()=>{we==="lighter"&&(ne(null),K(null))},[we]),m.useEffect(()=>{if(we!=="lighter"){tt(null);return}if(!g||!x){tt(null);return}let Ft=!1;return(async()=>{if(typeof window>"u")return;const Ee=Xt.address,h=Xt.token;if(!Ee||!h){Ft||tt(null);return}if(Ee.toLowerCase()!==x.toLowerCase()){Ft||tt(null);return}Le(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/list-lighter",{address:Ee,token:h});if(Ft)return;const S=p.data;let _=[];if(Array.isArray(S)?_=S:S&&Array.isArray(S.data)?_=S.data:S&&S.wallet_id!=null&&(_=[S]),!_.length)tt(null);else{const k=_[0],I={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};tt(I),se({id:I.id,address:I.address})}}catch{Ft||tt(null)}finally{Ft||Le(!1)}})(),()=>{Ft=!0}},[we,g,x,Xt.address,Xt.token]),m.useEffect(()=>{if(we!=="extended"){ht(null);return}const Ft=Xt.address,En=Xt.token;if(!Ft||!En){ht(null);return}if(!rn&&x&&Ft.toLowerCase()!==x.toLowerCase()){ht(null);return}let Ee=!1;return(async()=>{Gt(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{address:Ft,token:En});if(Ee)return;const S=p.data;let _=[];if(Array.isArray(S)?_=S:S&&Array.isArray(S.data)?_=S.data:S&&S.wallet_id!=null&&(_=[S]),!_.length)ht(null);else{const k=_[0],I={id:k.wallet_id,address:k.wallet_address,name:k.wallet_name};ht(I),se({id:I.id,address:I.address})}}catch{Ee||ht(null)}finally{Ee||Gt(!1)}})(),()=>{Ee=!0}},[we,Xt.address,Xt.token,x,rn]),m.useEffect(()=>{if(we!=="hyperliquid"){nn(null);return}if(!g||!x){nn(null);return}let Ft=!1;return(async()=>{if(typeof window>"u")return;const Ee=Xt.address,h=Xt.token;if(!Ee||!h){Ft||nn(null);return}if(Ee.toLowerCase()!==x.toLowerCase()){Ft||nn(null);return}Un(!0);try{const p=await ps.post("https://dextrabothypev2.nftinit.io/api/wallet/confirmed-list",{address:Ee,token:h});if(Ft)return;const S=p.data;let _=!1;Array.isArray(S)?_=S.length>0:S&&Array.isArray(S.data)?_=S.data.length>0:S&&S.wallet_id!=null&&(_=!0),nn(_)}catch{Ft||nn(null)}finally{Ft||Un(!1)}})(),()=>{Ft=!0}},[we,g,x,Xt.address,Xt.token]);const en=Ft=>{if(v==="pair")return;const En=oe==="grid"?"#gridbot":"#trade";we==="hyperliquid"?(je(Ft),s(Ft),c(`/terminal/hyperliquid/${Ft}${En}`)):we==="lighter"?(Re(Ft),c(`/terminal/lighter/${Ft}${En}`)):(Ke(Ft),c(`/terminal/extended/${Ft}${En}`))},Pn=()=>{typeof window>"u"||window.open("/dca-bot","_blank","noopener,noreferrer")};return i.jsxs("div",{className:"w-full min-h-screen bg-[#050505] text-white font-manrope p-2 mb-6",children:[i.jsx("div",{className:"flex items-center gap-2 mb-4",children:i.jsxs("div",{className:"inline-flex bg-[#161616] rounded-full p-1 text-[11px]",children:[i.jsxs("div",{className:"flex justify-center items-center",children:[i.jsx("img",{src:"https://i.imgflip.com/7zho2e.png",className:"w-4 h-4 mr-1 ml-2",alt:""}),i.jsx("button",{onClick:()=>{const Ft=be||r||"BTC";de("grid"),xe("hyperliquid"),c(`/terminal/hyperliquid/${Ft}#gridbot`)},className:`px-3 py-1 rounded-full transition mr-2 ${we==="hyperliquid"?"bg-white text-black":"text:white/60 text-white/60 hover:text-white"}`,children:"Hyperliquid"})]}),i.jsxs("div",{className:"flex justify-center items-center mr-2",children:[i.jsx(bf,{className:"w-4 h-4 text-[#fff] mr-1"}),i.jsx("button",{onClick:()=>{const Ft=Ie||"BTC";de("grid"),xe("lighter"),c(`/terminal/lighter/${Ft}#gridbot`)},className:`px-3 py-1 rounded-full transition ${we==="lighter"?"bg:white bg-white text-black":"text:white/60 text-white/60 hover:text-white"}`,children:"Lighter"})]}),i.jsxs("div",{className:"flex justify-center items-center",children:[i.jsx("img",{src:"https://app.extended.exchange/assets/favicon/favicon-32x32.png",className:"w-4 h-4 mr-1",alt:""}),i.jsx("button",{onClick:()=>{const Ft=Qe||"BTC";de("grid"),xe("extended"),c(`/terminal/extended/${Ft}#gridbot`)},className:`px-3 py-1 rounded-full transition ${we==="extended"?"bg-white text-black":"text:white/60 text-white/60 hover:text-white"}`,children:"Extended"})]})]})}),i.jsx(Ao.div,{className:"fixed inset-0 pointer-events-none z-10",initial:{opacity:.14},animate:{opacity:0},transition:{duration:.9,ease:[.16,1,.3,1]},style:{background:"radial-gradient(1200px 600px at 50% 8%, rgba(255,255,255,0.08), rgba(0,0,0,0) 60%)"}}),i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col gap-1 xl:flex-row w-full min-w-0",children:[i.jsxs("div",{className:"flex flex-col gap-1 w-full min-w-0 xl:flex-1",children:[i.jsx(Ao.div,{className:"xl:hidden bg-[#101010] border border-[#292929] px-2 rounded-[16px]",children:i.jsx("div",{className:"flex items-center justify-between w-full",children:i.jsx(Dmn,{coin:Dn,data:(qt=t.position_info)==null?void 0:qt[0],setIsDigits:$,headerData:T,active:L,onCoinChange:en,markets:Vn,marketsLoading:Kn,mode:v,pairKey:N,onPairChange:P})})}),i.jsxs("div",{className:"flex flex-col gap-1 xl:grid xl:h-[600px] rounded-[16px]",style:{gridTemplateColumns:ae?"minmax(0,1fr) 24px":"minmax(0,1fr) 300px"},children:[i.jsxs(Ao.div,{className:"relative bg-[#101010] border border-[#292929] overflow-hidden min-w-0 h-[420px] sm:h-[500px] xl:h-full rounded-[16px] flex flex-col",children:[i.jsx("div",{className:"hidden xl:flex h-[56px] w-full items-center justify-between px-2 border-b border-[#292929]",children:i.jsx(tmn,{coin:Dn,data:(zn=t.position_info)==null?void 0:zn[0],setIsDigits:$,headerData:T,handleClick:gn,active:L,onCoinChange:en,mode:v,pairKey:N,onPairChange:P,markets:Vn,market:we})}),i.jsx("div",{className:"flex-1 min-h-0",children:we==="hyperliquid"?i.jsx(TQ,{coin:Xn,interval:L,walletAddress:q==null?void 0:q.address,gridLines:oe==="grid"?Ce:[],market:"hyperliquid"},`hl-${Xn}-${L}`):we==="lighter"?i.jsx(TQ,{coin:Dn,interval:"1h",walletAddress:q==null?void 0:q.address,gridLines:oe==="grid"?Ce:[],market:"lighter",lighterMarketId:Oe},`lighter-${Dn}-${L}-${Oe||"x"}`):i.jsx(TQ,{coin:Dn,interval:L,walletAddress:q==null?void 0:q.address,gridLines:oe==="grid"?Ce:[],market:"extended",extendedMarket:sn,extendedLastPrice:Qn},`extended-${Dn}-${L}-${sn||"x"}`)})]}),i.jsxs(Ao.div,{className:"hidden sm:flex w-full xl:h-full xl:min-h-0 relative rounded-[16px]",children:[!ae&&i.jsxs("div",{className:"group relative w-full h-full bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:[i.jsx("button",{onClick:()=>W(!0),className:"hidden xl:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-20 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity bg-transparent",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#161616] border border-r-0 border-[#292929] flex items-center justify-center shadow",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M9 6l6 6-6 6",stroke:"#CFCFCF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),we==="hyperliquid"?i.jsx(o0n,{className:"w-full xl:h-full xl:min-h-0 overflow-y-auto",coin:r,data:e?[]:(Zn=t.position_info)==null?void 0:Zn[0],loading:e,period:a,periods:o,handlePeriodChange:l,onBookPrice:Ft=>ne(Ft),onBest:({mid:Ft})=>K(Ft)}):we==="lighter"?Oe!=null?i.jsx(w1n,{marketId:Oe,baseSymbol:Dn,rows:10,onSelectPrice:Ft=>ne(Ft),onBest:({mid:Ft})=>K(Ft)}):i.jsx(F7,{title:"Lighter Order Book",subtitle:"Select a market to see the order book"}):i.jsx(P1n,{market:sn,baseSymbol:jt||Dn,rows:10,onSelectPrice:Ft=>ne(Ft),onBest:({mid:Ft})=>K(Ft)})]}),ae&&i.jsxs("div",{className:"group relative w-[24px] h-full bg-[#101010] border border-[#292929] rounded-[16px] flex items-center justify-center",children:[i.jsx("button",{onClick:()=>W(!1),className:"hidden xl:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-20 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity bg-transparent",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#161616] border border-r-0 border-[#292929] flex items-center justify-center shadow",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",className:"rotate-180",children:i.jsx("path",{d:"M9 6l6 6-6 6",stroke:"#CFCFCF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),i.jsx("div",{className:"-rotate-90 whitespace-nowrap text-[11px] tracking-wide text-[#BFBFBF]",children:"Position / Order Book / Trades"})]})]})]}),i.jsxs(Ao.div,{className:"xl:hidden bg-[#101010] border border-[#292929] rounded-[16px]",children:[i.jsx("div",{className:"flex items-center justify-center pt-3 pb-2",children:i.jsxs("div",{className:"inline-flex bg-[#161616] rounded-full p-1 text-xs",children:[i.jsx("button",{onClick:()=>{const Ft=we==="hyperliquid"?be||r||"BTC":we==="lighter"?Ie||"BTC":Qe||"BTC";me([]),de("trade"),c(`/terminal/${we}/${Ft}#trade`)},className:`px-3 py-1 rounded-full transition ${oe==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const Ft=we==="hyperliquid"?be||r||"BTC":we==="lighter"?Ie||"BTC":Qe||"BTC";de("grid"),c(`/terminal/${we}/${Ft}#gridbot`)},className:`px-3 py-1 rounded-full transition ${oe==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:we==="hyperliquid"?"HL Grid Bot":we==="lighter"?"Lighter Grid Bot":"Extended Grid Bot"}),we==="extended"&&i.jsx("button",{onClick:Pn,className:"px-3 py-1 rounded-full transition text-white/60 hover:text-white",children:"DCA Bot"})]})}),i.jsx("div",{className:"min-h-[260px]",children:oe==="trade"?we==="hyperliquid"?i.jsx(eAe,{coin:r,midPrice:J,selectedPrice:X,maxLeverage:te[r]||25,wallet:q,onWalletChange:se,uiMode:v,pairKey:N},`trade-${q.address}`):we==="lighter"?i.jsx("div",{className:"h-[260px]",children:i.jsx(F7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"})}):i.jsx("div",{className:"h-[260px]",children:i.jsx(F7,{title:"Extended Perp Trading",subtitle:"Coming Soon"})}):we==="hyperliquid"?cn||Rt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):bn?Je?i.jsx(GF,{code:De,onCodeChange:At,onSubmit:Dt,loading:ze,checking:Rt,message:mt}):wt===!1?i.jsx("div",{className:"w-full h-full flex items-center justify-center py-6",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#hyperliquid","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create HL Account"})}):i.jsx(xAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onWalletChange:se,onLevelsChange:me}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4 py-6",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Hyperliquid Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]}):we==="lighter"?nt||Rt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60 py-6",children:"Loading Lighter account…"}):bn?hn?i.jsx(GF,{code:De,onCodeChange:At,onSubmit:Dt,loading:ze,checking:Rt,message:mt}):dt?i.jsx(pAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onLevelsChange:me}):i.jsx("div",{className:"w-full h-full flex items-center justify-center py-6",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#lighter","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create Lighter Account"})}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4 py-6",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Lighter Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]}):pt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60 py-6",children:"Loading Extended account…"}):bn?Be?i.jsx(bAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onLevelsChange:me}):i.jsx("div",{className:"w-full h-full flex items-center justify-center py-6",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#extended","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create Extended Account"})}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4 py-6",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Extended Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]})})]}),we==="lighter"&&bn&&i.jsx(Ao.div,{className:"xl:hidden bg-[#101010] border border-[#292929] rounded-[16px] overflow-hidden",children:i.jsx(jM,{walletAddress:q==null?void 0:q.address,sourceMarket:"lighter"})}),i.jsx(Ao.div,{className:"h-[500px] bg-[#101010] border border-[#292929] overflow-hidden rounded-[16px]",children:we==="hyperliquid"?i.jsx(Dgn,{data:t.positions_list,loading:e,error:n,isDigits:F,period:a,periods:o,handlePeriodChange:l,className:"h-full",minHeight:"min-h-0",walletAddress:q==null?void 0:q.address,coin:r,sourceMarket:"hyper"},`tabs-${q.address}`):we==="lighter"?bn?i.jsx(jM,{walletAddress:q==null?void 0:q.address,sourceMarket:"lighter"}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to manage Lighter grid bots"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]}):i.jsx(jM,{walletAddress:q==null?void 0:q.address,sourceMarket:"extended"})})]}),i.jsxs(Ao.div,{animate:{width:V?28:350},transition:I1n,className:"hidden xl:flex flex-col gap-1 rounded-[16px] overflow-visible",style:{minWidth:V?28:350},children:[!V&&i.jsxs("div",{className:"group relative bg-[#101010] border border-[#292929] flex-1 rounded-[16px] flex flex-col",children:[i.jsx("button",{onClick:()=>ee(!0),className:"hidden xl:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-20 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity bg-transparent",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#161616] border border-r-0 border-[#292929] flex items-center justify-center shadow",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M9 6l6 6-6 6",stroke:"#CFCFCF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),i.jsx("div",{className:"px-3 pt-3 pb-2 items-center justify-center flex",children:i.jsxs("div",{className:"inline-flex bg-[#161616] rounded-full p-1 text-xs",children:[i.jsx("button",{onClick:()=>{const Ft=we==="hyperliquid"?be||r||"BTC":we==="lighter"?Ie||"BTC":Qe||"BTC";de("trade"),me([]),c(`/terminal/${we}/${Ft}#trade`)},className:`px-3 py-1 rounded-full transition ${oe==="trade"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Trade"}),i.jsx("button",{onClick:()=>{const Ft=we==="hyperliquid"?be||r||"BTC":we==="lighter"?Ie||"BTC":Qe||"BTC";de("grid"),c(`/terminal/${we}/${Ft}#gridbot`)},className:`px-3 py-1 rounded-full transition ${oe==="grid"?"bg-white text-black":"text-white/60 hover:text-white"}`,children:"Grid Bot"}),we==="extended"&&i.jsx("button",{onClick:Pn,className:"px-3 py-1 rounded-full transition text-white/60 hover:text-white",children:"DCA Bot"})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:oe==="trade"?we==="hyperliquid"?i.jsx(eAe,{coin:r,midPrice:J,selectedPrice:X,maxLeverage:te[r]||25,wallet:q,onWalletChange:se,uiMode:v,pairKey:N}):we==="lighter"?i.jsx(F7,{title:"Lighter Perp Trading",subtitle:"Coming Soon"}):i.jsx(F7,{title:"Extended Perp Trading",subtitle:"Coming Soon"}):we==="hyperliquid"?cn||Rt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Hyperliquid account…"}):bn?Je?i.jsx(GF,{code:De,onCodeChange:At,onSubmit:Dt,loading:ze,checking:Rt,message:mt}):wt===!1?i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#hyperliquid","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create HL Account"})}):i.jsx(xAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onWalletChange:se,onLevelsChange:me}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Hyperliquid Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]}):we==="lighter"?nt||Rt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Lighter account…"}):bn?hn?i.jsx(GF,{code:De,onCodeChange:At,onSubmit:Dt,loading:ze,checking:Rt,message:mt}):dt?i.jsx(pAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onLevelsChange:me}):i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#lighter","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create Lighter Account"})}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Lighter Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]}):pt?i.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-white/60",children:"Loading Extended account…"}):bn?Be?i.jsx(bAe,{coin:Dn,midPrice:J,selectedPrice:X,wallet:q,onLevelsChange:me}):i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx("button",{onClick:()=>window.open("/wallet-management#extended","_blank","noopener,noreferrer"),className:"px-4 py-2 rounded-full bg-white text-black text-xs font-semibold",children:"Create Extended Account"})}):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 px-4",children:[i.jsx("p",{className:"text-[13px] text-[#9BA1A6] text-center",children:"Connect your wallet to use Extended Grid Bot"}),i.jsx("div",{className:"w-[220px]",children:i.jsx(om,{onClick:()=>y(!0)})})]})})]}),V&&i.jsxs("div",{className:"group relative h-full min-h-[505px] bg-[#101010] border border-[#292929] rounded-[16px] flex items-center justify-center",children:[i.jsx("button",{onClick:()=>ee(!1),className:"hidden xl:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity bg-transparent z-10",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#161616] border border-r-0 border-[#292929] flex items-center justify-center shadow z-10",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M15 6L9 12l6 6",stroke:"#CFCFCF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),i.jsx("div",{className:"-rotate-90 whitespace-nowrap text-[11px] tracking-wide text-[#BFBFBF] z-0",children:oe==="trade"?"Trade Panel":"Grid Bot"})]})]})]})})]})}const M1n=()=>{ns();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u,getCopyTradeWatchList:d,getTrackedWatchList:f}=m.useContext(Qr),{coin:x}=g2(),[g,y]=m.useState(x||"BTC"),v=gz();function C(ee){return ee?ee.includes(":")?ee.split(":")[1]:ee:""}function N(ee){if(!ee)return"";if(ee.includes(":")){const[oe,de]=ee.split(":");return`${de} (${oe})`}return ee}const P=C(g),T=v.find(ee=>ee.symbol===`${P}-USD`||ee.symbol===`${P}-USDH`||ee.symbol===`${P}-USDC`),M=(T==null?void 0:T.last)??(T==null?void 0:T.coin),$=`${M?(ee=>{if(ee==null||!isFinite(ee))return"";const oe=Number(ee),de=Math.abs(oe),Ce=de>=1e3?0:de>=1?2:de>=.1?6:7,me=oe.toFixed(Ce);return Number(me).toLocaleString(void 0,{maximumFractionDigits:Ce})})(M):""} | ${N(g)} | Dextrabot | Top Hyperliquid Wallets`;m.useEffect(()=>{$&&(document.title=$)},[$]);const[L,z]=m.useState([]),[X,ne]=m.useState(!1),[J,K]=m.useState(null);m.useEffect(()=>{const ee=document.querySelector("main > div");return ee&&(ee.style.background="#050505"),()=>{ee&&(ee.style.background="")}},[]);const te=[{index:0,name:"1D",value:1},{index:1,name:"7D",value:7},{index:2,name:"30D",value:30},{index:3,name:"90D",value:90}],fe=parseInt(localStorage.getItem("ticker_period")),q=!isNaN(fe)&&te[fe]?te[fe].value:te[1].value,[se,ae]=m.useState(q),W=ee=>{ae(Number(ee)),localStorage.setItem("ticker_period",te.findIndex(oe=>oe.value===Number(ee)).toFixed(0))},V=async({coin:ee,period:oe})=>{try{ne(!0);const de=`https://dextradata.nftinit.io/api/hyper/terminal/v2/${ee}/${oe}`,Ce=await fetch(de);if(!Ce.ok)throw z([]),new Error("Network response was not ok");const me=await Ce.json();me!=null&&me.success?(z(me),ne(!1),window.localStorage.getItem("hyperToken")&&(d(),f())):(z([]),ne(!1),K(me==null?void 0:me.error_message))}catch(de){K(de.message),ne(!1)}};return m.useEffect(()=>{g&&se&&V({coin:g,period:se})},[g,se]),m.useEffect(()=>{(async()=>{var Ce,me;const oe=window.localStorage.getItem("hyperToken"),de=window.localStorage.getItem("hyperAddress");if(!(!oe||!de))try{const we=await ki(de.toLowerCase(),oe);we!=null&&we.success?(t(we==null?void 0:we.telegram_chat_id),e(we==null?void 0:we.subscriber_role),n(we==null?void 0:we.subs_expire_day),r((Ce=we==null?void 0:we.mushboomer_counts)==null?void 0:Ce.eth),a((me=we==null?void 0:we.mushboomer_counts)==null?void 0:me.sol),o(we==null?void 0:we.referral_code),l(we==null?void 0:we.refcode),s(we==null?void 0:we.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(we){console.error("Token verification error:",we)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("meta",{name:"description",content:`View real-time ${g} positions of top Hyperliquid traders wallet by wallet. Track entry prices, unrealized PnL, position sizes, and copy trade profitable Bitcoin strategies instantly.`}),i.jsx("meta",{property:"og:title",content:`${g} Terminal | Top Hyperliquid Wallets | Real-time Positions | Dextrabot`}),i.jsx("meta",{property:"og:description",content:`View real-time ${g} positions of top Hyperliquid traders wallet by wallet. Track entry prices, unrealized PnL, position sizes, and copy trade profitable Bitcoin strategies instantly.`}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:`https://app.dextrabot.com/terminal/${g}`})]})}),i.jsx("div",{className:"flex justify-center w-full min-h-screen px-1 pt-1 sm:px-3 sm:pt-3 bg-[#161616]",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full flex-grow xl:flex-grow-0",children:i.jsx(O1n,{data:L,loading:X,error:J,coin:g,setCoin:y,period:se,periods:te,handlePeriodChange:W})})})]})},R1n="https://dextradata.nftinit.io/api/hyper/whale_stats/v2/",Rh=t=>{if(t==null)return"-";const e=Number(t),n=e<0?"-":"",r=Math.abs(e);return r>=1e9?`${n}$${(r/1e9).toFixed(2)}B`:r>=1e6?`${n}$${(r/1e6).toFixed(2)}M`:r>=1e3?`${n}$${(r/1e3).toFixed(2)}K`:`${n}$${r.toFixed(2)}`},cg=t=>t==null?"-":`${Number(t).toFixed(1)}%`,KF=t=>`calc(${t}%)`;function L1n({onData:t}){const[e,n]=m.useState(null);if(m.useEffect(()=>{let l=null;const c=()=>ps.get(R1n).then(d=>{var x,g,y,v;const f=(v=(y=(g=(x=d.data)==null?void 0:x.results)==null?void 0:g.other)==null?void 0:y.tracker)==null?void 0:v[0];if(f){n(f);const C=f.total_position;C!==l&&(l=C,t==null||t(f))}}).catch(d=>{console.error("fetch error",d)});c();const u=setInterval(c,3e4);return()=>clearInterval(u)},[]),!e)return i.jsx("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 space-y-6",children:[...Array(3)].map((l,c)=>i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"h-[32px] w-[160px] bg-[#202020] rounded-md animate-pulse"}),i.jsx("div",{className:"h-[24px] w-full max-w-[170px] bg-[#202020] rounded-md animate-pulse"}),i.jsx("div",{className:"h-[10px] w-[80%] bg-[#202020] rounded-md animate-pulse"}),i.jsx("div",{className:"h-[1px] w-full bg-[#262626]"})]},c))});const r=e.long.position_ratio,s=100-r,a=e.long.margin_ratio,o=100-a;return i.jsxs("div",{className:"font-inter w-full text-white space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("img",{src:rct,alt:"Dextrabot - Whale Trades"}),i.jsx("h2",{className:"text-[16px] leading-[21px] tracking-[-0.32px] font-medium",children:"Overview"}),i.jsxs("div",{className:"flex items-center gap-1 bg-[#262626] p-1 rounded-full w-fit ml-[2px]",children:[i.jsxs("div",{className:"relative w-2 h-2 flex justify-center items-center",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-[#67FFBD]/[0.32] animate-ping"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-[#67FFBD]"})]}),i.jsx("span",{className:"text-white text-[10px] leading-[10px] font-medium",children:"LIVE"})]})]}),i.jsxs("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(gi,{content:"Total value of whale positions opened in the last 24 hours.",children:i.jsxs("div",{className:"flex items-center gap-[6px] w-fit",children:[i.jsx("span",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Open Positions"}),i.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-[6px] py-[3px] bg-[#202020] text-[10px] leading-[10px] font-medium rounded-full",children:"LAST 24H"}),i.jsx("img",{src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_position)}),i.jsxs("div",{className:"flex gap-1 h-[16px] w-full max-w-[170px]",children:[i.jsx("span",{className:"flex items-center justify-center bg-[#67FFBD] rounded-[4px] text-[#12450F] text-[10px] leading-[10px] font-semibold px-6",style:{width:KF(r)},children:cg(r)}),i.jsx("span",{className:"flex items-center justify-center bg-[#FF797C] rounded-[4px] text-[#5E2425] text-[10px] leading-[10px] font-semibold px-6",style:{width:KF(s)},children:cg(s)})]}),i.jsxs("div",{className:"flex items-center text-[10px] leading-[10px] font-medium gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"}),i.jsx("span",{children:"Long"}),i.jsx("span",{children:Rh(e.long.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",cg(r),")"]})]}),i.jsx("span",{className:"h-[10px] w-px bg-[#262626]"}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"}),i.jsx("span",{children:"Short"}),i.jsx("span",{children:Rh(e.short.position)}),i.jsxs("span",{className:"text-[#909090]",children:["(",cg(s),")"]})]})]})]}),i.jsx("div",{className:"h-px w-full bg-[#262626]"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(gi,{content:"Total margin whales are currently using across all positions.",children:i.jsxs("div",{className:"flex items-center gap-[6px] mt-2 w-fit",children:[i.jsx("span",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Whale Margin Usage"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsxs("div",{className:"flex items-end gap-2",children:[i.jsx("span",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_margin)}),i.jsx(gi,{content:"(Total Margin / Total Perp. Equity) * 100",children:i.jsxs("span",{className:"text-[#929292] font-inter text-[20px] not-italic font-semibold leading-[21px] tracking-[-0.2px]",children:["(",cg(e.total_margin/e.total_perp_equity*100),")"]})}),e.long.margin>e.short.margin?i.jsx("span",{className:"bg-[rgba(103,255,189,0.16)] p-[2px] rounded-full",children:i.jsx(Pie,{className:"w-4 h-4 text-[#67FFBD]"})}):i.jsx("span",{className:"bg-[rgba(255,121,124,0.16)] p-[2px] rounded-full",children:i.jsx(Ul,{className:"w-4 h-4 text-[#FF797C]"})})]}),i.jsxs("div",{className:"flex gap-1 h-[16px] w-full max-w-[170px]",children:[i.jsx("span",{className:"flex items-center justify-center bg-[#67FFBD] rounded-[4px] text-[#12450F] text-[10px] leading-[10px] font-semibold px-6",style:{width:KF(a)},children:cg(a)}),i.jsx("span",{className:"flex items-center justify-center bg-[#FF797C] rounded-[4px] text-[#5E2425] text-[10px] leading-[10px] font-semibold px-6",style:{width:KF(o)},children:cg(o)})]}),i.jsxs("div",{className:"flex items-center text-[10px] leading-[10px] font-medium gap-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"}),i.jsx("span",{children:"Long"}),i.jsx("span",{className:"text-[#909090]",children:Rh(e.long.margin)}),i.jsxs("span",{children:["(",cg(a),")"]})]}),i.jsx("span",{className:"h-[10px] w-px bg-[#262626]"}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"}),i.jsx("span",{children:"Short"}),i.jsx("span",{className:"text-[#909090]",children:Rh(e.short.margin)}),i.jsxs("span",{children:["(",cg(o),")"]})]})]})]}),i.jsx("div",{className:"h-px w-full bg-[#262626]"}),i.jsxs("div",{className:"flex gap-16",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(gi,{content:"Whales’ unrealized profit and loss from open positions in the last 24 hours.",children:i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("div",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"PnL"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_pnl)}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"})," Long"," ",Rh(e.long.pnl)]})]}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"})," Short"," ",Rh(e.short.pnl)]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(gi,{content:"Funding fees paid or received by whales based on their open positions.",children:i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("div",{className:"text-[#929292] text-[14px] tracking-[-0.14px]",children:"Funding"}),i.jsx("img",{className:"mt-[2px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("div",{className:"text-[20px] leading-[21px] tracking-[-0.2px] font-semibold",children:Rh(e.total_funding)}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#67FFBD]"})," Long"," ",Rh(e.long.funding)]})]}),i.jsxs("div",{className:"flex items-center text-[10px] font-medium gap-1",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-[#FF797C]"})," Short"," ",Rh(e.short.funding)]})]})]})]})]})}const id={1:{label:"Shrimp",emoji:"🦐",bg:"bg-[rgba(255,144,0,0.16)]",txt:"text-[#FF9000]"},2:{label:"Fish",emoji:"🐟",bg:"bg-[rgba(121,156,232,0.16)]",txt:"text-[#97B8FF]"},3:{label:"Dolphin",emoji:"🐬",bg:"bg-[rgba(103,255,245,0.16)]",txt:"text-[#4DDCDE]"},4:{label:"Apex Predator",emoji:"🦈",bg:"bg-[rgba(81,180,255,0.16)]",txt:"text-[#51B4FF]"},5:{label:"Small Whale",emoji:"🐋",bg:"bg-[rgba(255,121,173,0.16)]",txt:"text-[#FF79AD]"},6:{label:"Whale",emoji:"🐳",bg:"bg-[rgba(198,121,255,0.16)]",txt:"text-[#C679FF]"},7:{label:"Tidal Whale",emoji:"🌊",bg:"bg-[rgba(255,121,137,0.16)]",txt:"text-[#FF7989]"},8:{label:"Leviathan",emoji:"🐉",bg:"bg-[rgba(73,242,73,0.16)]",txt:"text-[#49F249]"}},Ek=[{id:1,...id[1],description:"$0 – $250 — Low-value frequent trader"},{id:2,...id[2],description:"$250 – $10K — Small but active trader"},{id:3,...id[3],description:"$10K – $50K — Consistent mid-size trader"},{id:4,...id[4],description:"$50K – $100K — Aggressive high-leverage trader"},{id:5,...id[5],description:"$100K – $500K — Influential swing trader"},{id:6,...id[6],description:"$500K – $1M — Market-moving whale"},{id:7,...id[7],description:"$1M – $5M — Mega whale, highly impactful"},{id:8,...id[8],description:"≥ $5M — Rare leviathan with massive positions"}],rfe=t=>{if(t==null)return id[6];const e=Number(t);if(!isNaN(e)&&id[e])return id[e];const n=Object.values(id).find(a=>String(a.label).toLowerCase()===String(t).toLowerCase());if(n)return n;const r=a=>String(a).replace(/[\s_]+/g,"").toLowerCase();return Object.values(id).find(a=>r(a.label)===r(t))||id[6]},D1n="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",B1n=t=>{const e=Date.now()-t,n=Math.floor(e/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`},OC=t=>{if(t==null)return"-";const e=Number(t),n=e<0?"-":"",r=Math.abs(e);return r>=1e9?`${n}$${(r/1e9).toFixed(2)}B`:r>=1e6?`${n}$${(r/1e6).toFixed(2)}M`:r>=1e3?`${n}$${(r/1e3).toFixed(2)}K`:`${n}$${r.toFixed(2)}`},$1n=t=>t<250?1:t<1e4?2:t<5e4?3:t<1e5?4:t<5e5?5:t<1e6?6:t<5e6?7:8,kAe=t=>rfe($1n(t)),TAe=()=>{const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,a]=m.useState(Date.now()),[o,l]=m.useState(""),c=m.useCallback(async(x=!1)=>{x&&r(!0);try{const g=await ps.post(D1n,{limit:1e3,offset:0});if(g.data.success){const y=g.data.data.filter(v=>{var C;return!((C=v==null?void 0:v.typeDetail)!=null&&C.includes("Top100Wallet"))});e(y),a(Date.now())}}finally{x&&r(!1)}},[]);m.useEffect(()=>{c(!0);const x=setInterval(c,3e4);return()=>clearInterval(x)},[c]);const u=m.useMemo(()=>o?t.filter(x=>{var y;if(!o)return!0;const g=kAe((x==null?void 0:x.global_account_value)??0);return o===((y=Ek.find(v=>v.label===g.label))==null?void 0:y.id)}):t,[t,o]),d=[{key:"rank",label:"#",width:"45px",render:(x,g,y)=>i.jsx("span",{className:"text-[#9B9B9B]",children:y+1})},{key:"wallet",label:"Address",width:"235px",render:(x,g)=>{const y=(g==null?void 0:g.global_account_value)??0,v=kAe(y);return i.jsxs("div",{className:"flex items-center gap-1.5 text-[14px] tracking-[0.24px]",children:[i.jsx("span",{className:"text-[18px] leading-none",children:v.emoji}),i.jsxs("span",{className:"max-w-20 mr-2",children:[g.wallet.slice(0,5),"...",g.wallet.slice(-4)]}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ml-[10px] ${v.bg} ${v.txt}`,children:v.label})]})}},{key:"coin",label:"Symbol",sortable:!0,width:"90px",render:(x,g)=>i.jsxs("div",{className:"flex items-center gap-2 text-[14px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${g.coin}.svg`,onError:oa,className:"w-5 h-5"}),g.coin]})},{key:"activity",label:"Activity",width:"140px",render:(x,g)=>{var M,F,$,L;const y=(M=g==null?void 0:g.position_details)==null?void 0:M.direction,v=y==="Long",C=y==="Short",N=(L=($=(F=g==null?void 0:g.position_details)==null?void 0:F.position)==null?void 0:$.leverage)==null?void 0:L.value,P=g.side==="Change Position"?v?"Short > Long":"Long > Short":y??"Position Close",T=y==="Long"||y==="Short";return i.jsxs("div",{className:"flex items-center gap-[10px]",children:[i.jsxs("div",{className:`inline-flex justify-center items-center gap-1 px-2 py-1 h-6 rounded-[6px] text-[11px] uppercase font-medium ${v?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":C?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[T&&i.jsx(Os,{className:`w-3 h-3 ${v?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),P]}),N&&i.jsxs("div",{className:"inline-flex justify-center items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium text-[#67ffbd] bg-[rgba(103,255,189,0.16)]",children:[N,"X"]})]})}},{key:"current_trade_value",label:"Trade",width:"80px",sortable:!0,render:x=>OC(x)},{key:"position_value",label:"Position",width:"90px",sortable:!0,sortValue:x=>{var g,y;return Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.positionValue)},render:(x,g)=>{var y,v;return(v=(y=g==null?void 0:g.position_details)==null?void 0:y.position)!=null&&v.positionValue?OC(g.position_details.position.positionValue):"-"}},{key:"price",label:"Price",width:"80px",sortable:!0,sortValue:x=>{var g,y;return Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.entryPx)},render:(x,g)=>{var y,v;return(v=(y=g==null?void 0:g.position_details)==null?void 0:y.position)!=null&&v.entryPx?OC(g.position_details.position.entryPx):"-"}},{key:"side",label:"Side",width:"120px",sortable:!0,sortValue:x=>(x==null?void 0:x.side)||"",render:x=>i.jsx("div",{className:`h-5 pl-1 pr-1.5 py-1 rounded-md inline-flex items-center gap-0.5 text-[11px] font-semibold font-manrope leading-[8px] tracking-wide uppercase ${x==="Increase"||x==="Change Position"?"text-[#67ffbd] bg-[#67ffbd]/20":x==="Decrease"||x==="Position Close"?"text-[#ff787b] bg-[#ff797c]/20":"text-white"}`,children:x||"-"})},{key:"position_details.position.size",label:"Size",sortable:!0,width:"110px",sortValue:x=>{var g,y;return Math.abs(Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.szi))||0},render:(x,g)=>{var N,P;const y=(P=(N=g==null?void 0:g.position_details)==null?void 0:N.position)==null?void 0:P.szi,v=y>0,C=v?"text-[#3DB380]":y<0?"text-[#FF797C]":"text-white";return i.jsxs("span",{className:`font-semibold ${C} inline-flex items-center`,children:[isNaN(y)?"-":OC(Math.abs(y)),!isNaN(y)&&i.jsx("img",{src:v?pE:mE,className:"ml-[6px] w-[9px] h-[8px]",alt:""})]})}},{key:"position_details.position.entryPx",label:"Entry",sortable:!0,sortValue:x=>{var g,y;return Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.entryPx)||0},width:"80px",render:(x,g)=>{var v,C;const y=(C=(v=g==null?void 0:g.position_details)==null?void 0:v.position)==null?void 0:C.entryPx;return y?`${OC(y)}`:"-"}},{key:"position_details.position.unrealizedPnl",label:"uPnL",sortable:!0,width:"100px",sortValue:x=>{var g,y;return Math.abs(Number((y=(g=x==null?void 0:x.position_details)==null?void 0:g.position)==null?void 0:y.unrealizedPnl))||0},render:(x,g)=>{var N,P;const y=parseFloat((P=(N=g==null?void 0:g.position_details)==null?void 0:N.position)==null?void 0:P.unrealizedPnl),v=y>0,C=v?"text-[#3DB380]":y<0?"text-[#FF797C]":"text-white";return i.jsxs("span",{className:`font-semibold ${C} inline-flex items-center`,children:[isNaN(y)?"-":`${OC(Math.abs(y))}`,!isNaN(y)&&i.jsx("img",{src:v?pE:mE,className:"ml-[6px] w-[9px] h-[8px]",alt:""})]})}},{key:"flags",label:i.jsx(gi,{content:"Quick view of this whale’s recent trading performance.",children:i.jsx("span",{children:"Last 5 T."})}),width:"90px",render:(x,g)=>{const y=g.last5Trade??[];return i.jsx("div",{className:"inline-flex h-[18px] px-[2px] py-[4px] justify-center items-center rounded-[6px] overflow-visible",children:y.slice(0,5).map((v,C)=>{let N="",P=null;return v===null?(N="bg-[#747474]",P=X7e):v===!0?(N="bg-[#67FFBD]",P=Y7e):(N="bg-[#FF9C9C]",P=Q7e),i.jsx("div",{className:`relative z[${C}] w-[18px] h-[18px] flex-shrink-0 flex items-center justify-center rounded-full border-2 border-[#101010] ${N} ${C!==0?"-ml-[6px]":""}`,children:i.jsx(P,{className:"w-3 h-3 text-black"})},C)})})}},{key:"insert_date",label:"Time",width:"80px",sortable:!0,sortValue:x=>{var g;return(g=x.insert_date)==null?void 0:g.$date},render:(x,g)=>{var y;return i.jsx("div",{className:"text-gray-400",children:B1n(new Date((y=g.insert_date)==null?void 0:y.$date).getTime())})}}],f=(x,g)=>{var M;const v=((M=x==null?void 0:x.position_details)==null?void 0:M.direction)==="Long",C=x.current_trade_value>=5e6,N=C?v?"before:bg-[#67FFBD] before:shadow-[0_0_12px_#67FFBD] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-[#FF797C] before:shadow-[0_0_12px_#FF797C] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-transparent";return`
relative before:content-[''] before:absolute before:left-[8px] before:w-[2px] before:rounded-full
${C?v?"bg-[rgba(103,255,189,0.16)]":"bg-[rgba(255,131,117,0.16)]":g%2===0?"bg-[#191919]":"bg-transparent"} ${N} ${C?v?"hover:bg-[rgba(14,70,53,0.32)]":"hover:bg-[rgba(74,16,18,0.32)]":"hover:bg-[rgba(39,39,39,0.32)]"} cursor-pointer mb-4 py-5 transition-colors duration-300
`};return n?i.jsx("div",{className:"rounded-[16px] bg-[#101010] p-4 space-y-4 mt-6",children:i.jsx("div",{className:"space-y-3",children:[...Array(32)].map((x,g)=>i.jsx("div",{className:"h-[42px] w-full bg-[#202020] rounded-md animate-pulse"},g))})}):i.jsx(i.Fragment,{children:i.jsxs("div",{className:"font-manrope font-medium relative p-1 mt-4 sm:w-[1440px] sm:mx-auto",children:[i.jsxs("div",{className:"flex-col items-center space-y-2 sm:pl-[60px]",children:[i.jsx("div",{className:"flex items-center justify-between",children:i.jsx(gi,{content:"Displays real-time executed trades from top whales.",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-white text-[16px] leading-[21px] font-medium tracking-[-0.32px] pl-[5px] font-inter",children:"Hot Whale Trades"}),i.jsxs("div",{className:"flex items-center gap-1 bg-[#262626] p-1 rounded-full w-fit",children:[i.jsxs("div",{className:"relative w-2 h-2 flex justify-center items-center",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full [#4DFF43]/[0.32] animate-ping"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-[#4DFF43]"})]}),i.jsx("span",{className:"text-white text-[10px] leading-[10px] font-medium",children:"LIVE"})]}),i.jsx("img",{className:"-ml-[4px]",src:R0,alt:"Dextrabot - Hyperliquid Whale Trades"})]})})}),i.jsx("div",{className:"flex items-center",children:i.jsx("div",{className:"inline-flex items-center h-8 px-1.5 py-[18px] rounded-[8px] border border-[#262626] flex-shrink-0 gap-[12px]",children:i.jsxs("div",{className:"flex items-center gap-[12px]",children:[i.jsx("div",{onClick:()=>l(""),className:`flex items-center justify-center h-7 w-7 px-4 rounded-[8px] text-white text-[14px] font-inter leading-[16px] cursor-pointer transition-colors ${o===""?"bg-[#262626]":"hover:bg-[#262626]"}`,children:"All"}),Ek.map(({id:x,label:g,emoji:y,description:v})=>{const C=o===g;return i.jsx("div",{onClick:()=>l(C?"":x),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] transition-colors cursor-pointer ${C?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(gi,{content:v,children:y})},x)})]})})})]}),i.jsx("div",{className:"pt-2 bg-[#101010] rounded-[16px]",children:i.jsx(zu,{data:u,columns:d,tableClassName:"text-[14px] flex justify-center",theadClassName:"text-[13px] font-inter !text-[#9B9B9B] bg-transparent font-normal",tbodyClassName:"text-[14px]",cellClassName:"text-[14px] font-medium",rowClassName:f,rowHeight:42,listHeight:window.screen.height,rowKey:x=>{var g,y;return((g=x._id)==null?void 0:g.$oid)||((y=x.insert_date)==null?void 0:y.$date)},onVisibleRows:()=>{},onRowClick:x=>window.open(`/wallet-details/${x.wallet}`,"_blank")})})]})})},Lj=t=>{let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e)},Rqe=(t,e)=>Math.floor(t/Math.pow(10,e)%10),Rse=(t,e)=>!(Rqe(t,e)%2),ku=(t,e,n)=>{const r=t%e;return n&&Rqe(t,n)%2===0?-r:r},x5=(t,e,n)=>e[t%n],U1n=t=>{t.slice(0,1)==="#"&&(t=t.slice(1));const e=parseInt(t.substr(0,2),16),n=parseInt(t.substr(2,2),16),r=parseInt(t.substr(4,2),16);return(e*299+n*587+r*114)/1e3>=128?"#000000":"#FFFFFF"},z1n=4,ao=80;function H1n(t,e){const n=Lj(t),r=e&&e.length;return Array.from({length:z1n},(s,a)=>({color:x5(n+a,e,r),translateX:ku(n*(a+1),ao/2-(a+17),1),translateY:ku(n*(a+1),ao/2-(a+17),2),rotate:ku(n*(a+1),360),isSquare:Rse(n,2)}))}const PAe=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=H1n(t,e),l=m.useId();return i.jsxs("svg",{viewBox:"0 0 "+ao+" "+ao,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:ao,height:ao,children:i.jsx("rect",{width:ao,height:ao,rx:r?void 0:ao*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:ao,height:ao,fill:o[0].color}),i.jsx("rect",{x:(ao-60)/2,y:(ao-20)/2,width:ao,height:o[1].isSquare?ao:ao/8,fill:o[1].color,transform:"translate("+o[1].translateX+" "+o[1].translateY+") rotate("+o[1].rotate+" "+ao/2+" "+ao/2+")"}),i.jsx("circle",{cx:ao/2,cy:ao/2,fill:o[2].color,r:ao/5,transform:"translate("+o[2].translateX+" "+o[2].translateY+")"}),i.jsx("line",{x1:0,y1:ao/2,x2:ao,y2:ao/2,strokeWidth:2,stroke:o[3].color,transform:"translate("+o[3].translateX+" "+o[3].translateY+") rotate("+o[3].rotate+" "+ao/2+" "+ao/2+")"})]})]})},Dv=90,V1n=5;function W1n(t,e){const n=Lj(t),r=e&&e.length,s=Array.from({length:V1n},(o,l)=>x5(n+l,e,r)),a=[];return a[0]=s[0],a[1]=s[1],a[2]=s[1],a[3]=s[2],a[4]=s[2],a[5]=s[3],a[6]=s[3],a[7]=s[0],a[8]=s[4],a}const q1n=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=W1n(t,e),l=Ne.useId();return i.jsxs("svg",{viewBox:"0 0 "+Dv+" "+Dv,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:Dv,height:Dv,children:i.jsx("rect",{width:Dv,height:Dv,rx:r?void 0:Dv*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("path",{d:"M0 0h90v45H0z",fill:o[0]}),i.jsx("path",{d:"M0 45h90v45H0z",fill:o[1]}),i.jsx("path",{d:"M83 45a38 38 0 00-76 0h76z",fill:o[2]}),i.jsx("path",{d:"M83 45a38 38 0 01-76 0h76z",fill:o[3]}),i.jsx("path",{d:"M77 45a32 32 0 10-64 0h64z",fill:o[4]}),i.jsx("path",{d:"M77 45a32 32 0 11-64 0h64z",fill:o[5]}),i.jsx("path",{d:"M71 45a26 26 0 00-52 0h52z",fill:o[6]}),i.jsx("path",{d:"M71 45a26 26 0 01-52 0h52z",fill:o[7]}),i.jsx("circle",{cx:45,cy:45,r:23,fill:o[8]})]})]})},G1n=64,Bv=80;function K1n(t,e){const n=Lj(t),r=e&&e.length;return Array.from({length:G1n},(s,a)=>x5(n%(a+1),e,r))}const Y1n=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=K1n(t,e),l=m.useId();return i.jsxs("svg",{viewBox:"0 0 "+Bv+" "+Bv,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,"mask-type":"alpha",maskUnits:"userSpaceOnUse",x:0,y:0,width:Bv,height:Bv,children:i.jsx("rect",{width:Bv,height:Bv,rx:r?void 0:Bv*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:10,height:10,fill:o[0]}),i.jsx("rect",{x:20,width:10,height:10,fill:o[1]}),i.jsx("rect",{x:40,width:10,height:10,fill:o[2]}),i.jsx("rect",{x:60,width:10,height:10,fill:o[3]}),i.jsx("rect",{x:10,width:10,height:10,fill:o[4]}),i.jsx("rect",{x:30,width:10,height:10,fill:o[5]}),i.jsx("rect",{x:50,width:10,height:10,fill:o[6]}),i.jsx("rect",{x:70,width:10,height:10,fill:o[7]}),i.jsx("rect",{y:10,width:10,height:10,fill:o[8]}),i.jsx("rect",{y:20,width:10,height:10,fill:o[9]}),i.jsx("rect",{y:30,width:10,height:10,fill:o[10]}),i.jsx("rect",{y:40,width:10,height:10,fill:o[11]}),i.jsx("rect",{y:50,width:10,height:10,fill:o[12]}),i.jsx("rect",{y:60,width:10,height:10,fill:o[13]}),i.jsx("rect",{y:70,width:10,height:10,fill:o[14]}),i.jsx("rect",{x:20,y:10,width:10,height:10,fill:o[15]}),i.jsx("rect",{x:20,y:20,width:10,height:10,fill:o[16]}),i.jsx("rect",{x:20,y:30,width:10,height:10,fill:o[17]}),i.jsx("rect",{x:20,y:40,width:10,height:10,fill:o[18]}),i.jsx("rect",{x:20,y:50,width:10,height:10,fill:o[19]}),i.jsx("rect",{x:20,y:60,width:10,height:10,fill:o[20]}),i.jsx("rect",{x:20,y:70,width:10,height:10,fill:o[21]}),i.jsx("rect",{x:40,y:10,width:10,height:10,fill:o[22]}),i.jsx("rect",{x:40,y:20,width:10,height:10,fill:o[23]}),i.jsx("rect",{x:40,y:30,width:10,height:10,fill:o[24]}),i.jsx("rect",{x:40,y:40,width:10,height:10,fill:o[25]}),i.jsx("rect",{x:40,y:50,width:10,height:10,fill:o[26]}),i.jsx("rect",{x:40,y:60,width:10,height:10,fill:o[27]}),i.jsx("rect",{x:40,y:70,width:10,height:10,fill:o[28]}),i.jsx("rect",{x:60,y:10,width:10,height:10,fill:o[29]}),i.jsx("rect",{x:60,y:20,width:10,height:10,fill:o[30]}),i.jsx("rect",{x:60,y:30,width:10,height:10,fill:o[31]}),i.jsx("rect",{x:60,y:40,width:10,height:10,fill:o[32]}),i.jsx("rect",{x:60,y:50,width:10,height:10,fill:o[33]}),i.jsx("rect",{x:60,y:60,width:10,height:10,fill:o[34]}),i.jsx("rect",{x:60,y:70,width:10,height:10,fill:o[35]}),i.jsx("rect",{x:10,y:10,width:10,height:10,fill:o[36]}),i.jsx("rect",{x:10,y:20,width:10,height:10,fill:o[37]}),i.jsx("rect",{x:10,y:30,width:10,height:10,fill:o[38]}),i.jsx("rect",{x:10,y:40,width:10,height:10,fill:o[39]}),i.jsx("rect",{x:10,y:50,width:10,height:10,fill:o[40]}),i.jsx("rect",{x:10,y:60,width:10,height:10,fill:o[41]}),i.jsx("rect",{x:10,y:70,width:10,height:10,fill:o[42]}),i.jsx("rect",{x:30,y:10,width:10,height:10,fill:o[43]}),i.jsx("rect",{x:30,y:20,width:10,height:10,fill:o[44]}),i.jsx("rect",{x:30,y:30,width:10,height:10,fill:o[45]}),i.jsx("rect",{x:30,y:40,width:10,height:10,fill:o[46]}),i.jsx("rect",{x:30,y:50,width:10,height:10,fill:o[47]}),i.jsx("rect",{x:30,y:60,width:10,height:10,fill:o[48]}),i.jsx("rect",{x:30,y:70,width:10,height:10,fill:o[49]}),i.jsx("rect",{x:50,y:10,width:10,height:10,fill:o[50]}),i.jsx("rect",{x:50,y:20,width:10,height:10,fill:o[51]}),i.jsx("rect",{x:50,y:30,width:10,height:10,fill:o[52]}),i.jsx("rect",{x:50,y:40,width:10,height:10,fill:o[53]}),i.jsx("rect",{x:50,y:50,width:10,height:10,fill:o[54]}),i.jsx("rect",{x:50,y:60,width:10,height:10,fill:o[55]}),i.jsx("rect",{x:50,y:70,width:10,height:10,fill:o[56]}),i.jsx("rect",{x:70,y:10,width:10,height:10,fill:o[57]}),i.jsx("rect",{x:70,y:20,width:10,height:10,fill:o[58]}),i.jsx("rect",{x:70,y:30,width:10,height:10,fill:o[59]}),i.jsx("rect",{x:70,y:40,width:10,height:10,fill:o[60]}),i.jsx("rect",{x:70,y:50,width:10,height:10,fill:o[61]}),i.jsx("rect",{x:70,y:60,width:10,height:10,fill:o[62]}),i.jsx("rect",{x:70,y:70,width:10,height:10,fill:o[63]})]})]})},nl=36;function X1n(t,e){const n=Lj(t),r=e&&e.length,s=x5(n,e,r),a=ku(n,10,1),o=a<5?a+nl/9:a,l=ku(n,10,2),c=l<5?l+nl/9:l;return{wrapperColor:s,faceColor:U1n(s),backgroundColor:x5(n+13,e,r),wrapperTranslateX:o,wrapperTranslateY:c,wrapperRotate:ku(n,360),wrapperScale:1+ku(n,nl/12)/10,isMouthOpen:Rse(n,2),isCircle:Rse(n,1),eyeSpread:ku(n,5),mouthSpread:ku(n,3),faceRotate:ku(n,10,3),faceTranslateX:o>nl/6?o/2:ku(n,8,1),faceTranslateY:c>nl/6?c/2:ku(n,7,2)}}const IAe=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=X1n(t,e),l=m.useId();return i.jsxs("svg",{viewBox:"0 0 "+nl+" "+nl,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:nl,height:nl,children:i.jsx("rect",{width:nl,height:nl,rx:r?void 0:nl*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:nl,height:nl,fill:o.backgroundColor}),i.jsx("rect",{x:"0",y:"0",width:nl,height:nl,transform:"translate("+o.wrapperTranslateX+" "+o.wrapperTranslateY+") rotate("+o.wrapperRotate+" "+nl/2+" "+nl/2+") scale("+o.wrapperScale+")",fill:o.wrapperColor,rx:o.isCircle?nl:nl/6}),i.jsxs("g",{transform:"translate("+o.faceTranslateX+" "+o.faceTranslateY+") rotate("+o.faceRotate+" "+nl/2+" "+nl/2+")",children:[o.isMouthOpen?i.jsx("path",{d:"M15 "+(19+o.mouthSpread)+"c2 1 4 1 6 0",stroke:o.faceColor,fill:"none",strokeLinecap:"round"}):i.jsx("path",{d:"M13,"+(19+o.mouthSpread)+" a1,0.75 0 0,0 10,0",fill:o.faceColor}),i.jsx("rect",{x:14-o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:"none",fill:o.faceColor}),i.jsx("rect",{x:20+o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:"none",fill:o.faceColor})]})]})]})},Q1n=4,Vd=80;function Z1n(t,e){const n=Lj(t),r=e&&e.length;return Array.from({length:Q1n},(s,a)=>x5(n+a,e,r))}const J1n=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=Z1n(t,e),l=t.replace(/\s/g,""),c=m.useId();return i.jsxs("svg",{viewBox:"0 0 "+Vd+" "+Vd,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:c,maskUnits:"userSpaceOnUse",x:0,y:0,width:Vd,height:Vd,children:i.jsx("rect",{width:Vd,height:Vd,rx:r?void 0:Vd*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${c})`,children:[i.jsx("path",{fill:"url(#gradient_paint0_linear_"+l+")",d:"M0 0h80v40H0z"}),i.jsx("path",{fill:"url(#gradient_paint1_linear_"+l+")",d:"M0 40h80v40H0z"})]}),i.jsxs("defs",{children:[i.jsxs("linearGradient",{id:"gradient_paint0_linear_"+l,x1:Vd/2,y1:0,x2:Vd/2,y2:Vd/2,gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:o[0]}),i.jsx("stop",{offset:1,stopColor:o[1]})]}),i.jsxs("linearGradient",{id:"gradient_paint1_linear_"+l,x1:Vd/2,y1:Vd/2,x2:Vd/2,y2:Vd,gradientUnits:"userSpaceOnUse",children:[i.jsx("stop",{stopColor:o[2]}),i.jsx("stop",{offset:1,stopColor:o[3]})]})]})]})},ebn=3,Cu=80;function tbn(t,e){const n=Lj(t),r=e&&e.length;return Array.from({length:ebn},(s,a)=>({color:x5(n+a,e,r),translateX:ku(n*(a+1),Cu/10,1),translateY:ku(n*(a+1),Cu/10,2),scale:1.2+ku(n*(a+1),Cu/20)/10,rotate:ku(n*(a+1),360,1)}))}const Lqe=({name:t,colors:e,title:n,square:r,size:s,...a})=>{const o=tbn(t,e),l=m.useId();return i.jsxs("svg",{viewBox:"0 0 "+Cu+" "+Cu,fill:"none",role:"img",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,...a,children:[n&&i.jsx("title",{children:t}),i.jsx("mask",{id:l,maskUnits:"userSpaceOnUse",x:0,y:0,width:Cu,height:Cu,children:i.jsx("rect",{width:Cu,height:Cu,rx:r?void 0:Cu*2,fill:"#FFFFFF"})}),i.jsxs("g",{mask:`url(#${l})`,children:[i.jsx("rect",{width:Cu,height:Cu,fill:o[0].color}),i.jsx("path",{filter:`url(#filter_${l})`,d:"M32.414 59.35L50.376 70.5H72.5v-71H33.728L26.5 13.381l19.057 27.08L32.414 59.35z",fill:o[1].color,transform:"translate("+o[1].translateX+" "+o[1].translateY+") rotate("+o[1].rotate+" "+Cu/2+" "+Cu/2+") scale("+o[2].scale+")"}),i.jsx("path",{filter:`url(#filter_${l})`,style:{mixBlendMode:"overlay"},d:"M22.216 24L0 46.75l14.108 38.129L78 86l-3.081-59.276-22.378 4.005 12.972 20.186-23.35 27.395L22.215 24z",fill:o[2].color,transform:"translate("+o[2].translateX+" "+o[2].translateY+") rotate("+o[2].rotate+" "+Cu/2+" "+Cu/2+") scale("+o[2].scale+")"})]}),i.jsx("defs",{children:i.jsxs("filter",{id:`filter_${l}`,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[i.jsx("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),i.jsx("feBlend",{in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:7,result:"effect1_foregroundBlur"})]})})]})},nbn={pixel:Y1n,bauhaus:PAe,ring:q1n,beam:IAe,sunset:J1n,marble:Lqe,geometric:IAe,abstract:PAe},Dqe=({variant:t="marble",colors:e=["#92A1C6","#146A7C","#F0AB3D","#C271B4","#C20D90"],name:n="Clara Barton",title:r=!1,size:s,square:a=!1,...o})=>{const l=nbn[t]||Lqe;return i.jsx(l,{colors:e,name:n,title:r,size:s,square:a,...o})},YF="rgba(155,155,155,0.16)";function rbn({row:t}){var f,x,g,y,v,C,N,P,T,M,F,$;const e=(f=t==null?void 0:t.position_details)==null?void 0:f.direction,n=(y=(g=(x=t==null?void 0:t.position_details)==null?void 0:x.position)==null?void 0:g.leverage)==null?void 0:y.value,r=e==="Long",s=e==="Short",a=(C=(v=t==null?void 0:t.position_details)==null?void 0:v.position)==null?void 0:C.szi,o=(P=(N=t==null?void 0:t.position_details)==null?void 0:N.position)==null?void 0:P.entryPx,l=parseFloat((M=(T=t==null?void 0:t.position_details)==null?void 0:T.position)==null?void 0:M.unrealizedPnl),c=t.side==="Change Position"?r?"Short > Long":"Long > Short":e??"Position Close",u=e==="Long"||e==="Short",d=({label:L,value:z,extraClass:X=""})=>i.jsxs("div",{className:"flex flex-col flex-1 px-2",children:[i.jsx("span",{className:"text-white/64 text-[12px] font-medium leading-[13px] tracking-[0.24px]",children:L}),i.jsx("span",{className:`text-[12px] font-semibold leading-[13px] tracking-[0.24px] ${X}`,children:z})]});return i.jsxs("div",{className:"z-[80] w-[362px] h-[204px] rounded-[16px] bg-white/10 backdrop-blur-[43px] p-3 flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Dqe,{size:20,name:t.wallet}),i.jsxs("span",{className:"text-white font-manrope text-[14px] font-semibold leading-[13px] tracking-[0.28px]",children:[t.wallet.slice(0,6),"...",t.wallet.slice(-4)]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${t.coin}.svg`,onError:oa,className:"w-8 h-8"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-white text-[14px] font-semibold leading-[13px] tracking-[0.28px]",children:t.coin}),i.jsx("span",{className:"text-white/40 text-[12px] font-medium leading-[13px] tracking-[0.24px]",children:t.coin_name||""})]}),i.jsxs("div",{className:"ml-[10px] flex gap-[8px]",children:[i.jsxs("div",{className:`inline-flex items-center gap-1 px-1 py-1 h-6 rounded-[6px] text-[11px] uppercase font-medium ${r?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":s?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[u&&i.jsx(Os,{className:`w-3 h-3 ${r?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),c]}),n&&i.jsxs("div",{className:"inline-flex items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium text-[#67ffbd] bg-[rgba(103,255,189,0.16)]",children:[n,"X"]})]})]}),i.jsx("div",{style:{background:YF},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:YF},children:[i.jsx(d,{label:"Trade Value",value:`$${_r(t.current_trade_value)}`,extraClass:"text-[#67FFBD]"}),i.jsx(d,{label:"Side",value:t.side}),i.jsx(d,{label:"Entry",value:isNaN(o)?"-":i.jsx("span",{className:"inline-flex items-center",children:_r(Math.abs(o))})})]}),i.jsx("div",{style:{background:YF},className:"h-px w-full"}),i.jsxs("div",{className:"flex divide-x",style:{divideColor:YF},children:[i.jsx(d,{label:"Size",value:isNaN(a)?"-":_r(Math.abs(a))}),i.jsx(d,{label:"Entry Price",value:`$${_r((($=(F=t==null?void 0:t.position_details)==null?void 0:F.position)==null?void 0:$.entryPx)||0)}`}),i.jsx(d,{label:"uPnL",value:isNaN(l)?"-":i.jsxs("span",{className:`inline-flex items-center ${l>0?"text-[#67FFBD]":l<0?"text-[#FF797C]":"text-white"}`,children:[`${l<0?"-":""}$${_r(Math.abs(l))}`,i.jsx("img",{src:l>0?pE:mE,className:"ml-[6px] w-[9px] h-[8px]"})]})})]})]})}function sbn(){const[t,e]=m.useState(!1);return m.useEffect(()=>{const n=()=>e(window.innerWidth<640);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}const ibn="https://dextradata.nftinit.io/api/hyper/trade/highVolumeTrades/",FAe=t=>{const e=Date.now()-t,n=Math.floor(e/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`},XQ=t=>{if(t==null)return"-";const e=Number(t),n=e<0?"-":"",r=Math.abs(e);return r>=1e9?`${n}$${(r/1e9).toFixed(2)}B`:r>=1e6?`${n}$${(r/1e6).toFixed(2)}M`:r>=1e3?`${n}$${(r/1e3).toFixed(2)}K`:`${n}$${r.toFixed(2)}`},abn=t=>t<250?1:t<1e4?2:t<5e4?3:t<1e5?4:t<5e5?5:t<1e6?6:t<5e6?7:8,OAe=t=>rfe(abn(t)),obn=()=>{const[t,e]=m.useState([]),[n,r]=m.useState(!0),[s,a]=m.useState(!1),[o,l]=m.useState(Date.now()),[c,u]=m.useState(""),d=sbn(),f=m.useCallback(async(C=!1)=>{C&&r(!0);try{const N=await ps.post(ibn,{limit:1e3,offset:0});if(N.data.success){const P=N.data.data.filter(T=>{var M;return!((M=T==null?void 0:T.typeDetail)!=null&&M.includes("Top100Wallet"))});e(P),l(Date.now())}}finally{C&&r(!1)}},[]);m.useEffect(()=>{f(!0);const C=setInterval(f,3e4);return()=>clearInterval(C)},[f]);const x=m.useMemo(()=>c?t.filter(C=>{var P;if(!c)return!0;const N=OAe((C==null?void 0:C.global_account_value)??0);return c===((P=Ek.find(T=>T.label===N.label))==null?void 0:P.id)}):t,[t,c]),g=[{key:"wallet",label:"Address",width:"235px",render:(C,N)=>{const P=(N==null?void 0:N.global_account_value)??0,T=OAe(P);return i.jsx(gi,{content:i.jsx(rbn,{row:N}),children:i.jsxs("div",{className:"flex items-center gap-1.5 text-[14px] tracking-[0.24px] cursor-pointer",children:[i.jsx("span",{className:"text-[18px] leading-none",children:T.emoji}),i.jsxs("span",{className:"max-w-20 mr-2",children:[N.wallet.slice(0,5),"...",N.wallet.slice(-4)]}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ml-[10px] ${T.bg} ${T.txt}`,children:T.label})]})})}},{key:"coin",label:"Symbol",width:"114px",sortable:!0,render:(C,N)=>i.jsxs("div",{className:"flex items-center gap-2 text-[14px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${N.coin}.svg`,onError:oa,className:"w-5 h-5"}),N.coin]})},{key:"activity",label:"Activity",width:"130px",render:(C,N)=>{var z,X,ne,J;const P=(z=N==null?void 0:N.position_details)==null?void 0:z.direction,T=P==="Long",M=P==="Short",F=(J=(ne=(X=N==null?void 0:N.position_details)==null?void 0:X.position)==null?void 0:ne.leverage)==null?void 0:J.value,$=N.side==="Change Position"?T?"Short > Long":"Long > Short":P??"Position Close",L=P==="Long"||P==="Short";return i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("div",{className:`inline-flex justify-center items-center gap-1 px-2 py-1 h-6 rounded-[6px] text-[11px] uppercase font-medium ${T?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":M?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[L&&i.jsx(Os,{className:`w-3 h-3 ${T?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),$]}),F&&i.jsxs("div",{className:`inline-flex justify-center items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium
${T?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":M?"text-[#ff787b] bg-[rgba(255,131,117,0.16)]":"text-[#8B8B8B] bg-transparent"}`,children:[F,"X"]})]})}},{key:"current_trade_value",label:"Trade",width:"70px",sortable:!0,render:C=>XQ(C)},{key:"position_value",label:"Position",sortable:!0,width:"85px",sortValue:C=>{var N,P;return Number((P=(N=C==null?void 0:C.position_details)==null?void 0:N.position)==null?void 0:P.positionValue)},render:(C,N)=>{var P,T;return(T=(P=N==null?void 0:N.position_details)==null?void 0:P.position)!=null&&T.positionValue?XQ(N.position_details.position.positionValue):"-"}},{key:"price",label:"Price",width:"80px",sortable:!0,sortValue:C=>{var N,P;return Number((P=(N=C==null?void 0:C.position_details)==null?void 0:N.position)==null?void 0:P.entryPx)},render:(C,N)=>{var P,T;return(T=(P=N==null?void 0:N.position_details)==null?void 0:P.position)!=null&&T.entryPx?XQ(N.position_details.position.entryPx):"-"}},{key:"flags",label:i.jsx(gi,{content:"Quick view of this whale’s recent trading performance.",children:i.jsx("span",{children:"Last 5 T."})}),width:"90px",render:(C,N)=>{const P=N.last5Trade??[];return i.jsx("div",{className:"inline-flex h-[18px] px-[2px] py-[4px] justify-center items-center rounded-[6px] overflow-visible",children:P.slice(0,5).map((T,M)=>{let F="",$=null;return T===null?(F="bg-[#747474]",$=X7e):T===!0?(F="bg-[#67FFBD]",$=Y7e):(F="bg-[#FF9C9C]",$=Q7e),i.jsx("div",{className:`relative z[${M}] w-[18px] h-[18px] flex-shrink-0 flex items-center justify-center rounded-full border-2 border-[#101010] ${F} ${M!==0?"-ml-[6px]":""}`,children:i.jsx($,{className:"w-3 h-3 text-black"})},M)})})}},{key:"insert_date",label:"Time",sortable:!0,width:"80px",sortValue:C=>{var N;return(N=C.insert_date)==null?void 0:N.$date},render:(C,N)=>{var P;return i.jsx("div",{className:"text-gray-400",children:FAe(new Date((P=N.insert_date)==null?void 0:P.$date).getTime())})}}],y=m.useMemo(()=>d?g.slice(1):g,[g,d]),v=(C,N)=>{var z;const T=((z=C==null?void 0:C.position_details)==null?void 0:z.direction)==="Long",M=C.current_trade_value>=5e6,F=M?T?"before:bg-[#67FFBD] before:shadow-[0_0_12px_#67FFBD] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-[#FF797C] before:shadow-[0_0_12px_#FF797C] before:h-[24px] before:top-1/2 before:-translate-y-1/2":"before:bg-transparent";return`
relative before:content-[''] before:absolute before:left-[8px] before:w-[2px] before:rounded-full
${M?T?"bg-[rgba(103,255,189,0.16)]":"bg-[rgba(255,131,117,0.16)]":N%2===0?"bg-[#191919]":"bg-transparent"} ${F} ${M?T?"hover:bg-[rgba(14,70,53,0.32)]":"hover:bg-[rgba(74,16,18,0.32)]":"hover:bg-[rgba(39,39,39,0.32)]"} cursor-pointer mb-4 py-5 transition-colors duration-300
`};return n?i.jsxs("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 space-y-4",children:[i.jsx("div",{className:"flex justify-end",children:i.jsx("div",{className:"h-8 w-24 bg-[#202020] rounded-[8px] animate-pulse"})}),i.jsx("div",{className:"space-y-3",children:[...Array(7)].map((C,N)=>i.jsx("div",{className:"h-[34px] w-full bg-[#202020] rounded-md animate-pulse"},N))})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-full font-manrope font-medium relative mt-1",children:[i.jsxs("div",{className:"flex items-center justify-between pb-2",children:[i.jsx(gi,{content:"Real-time view of whales’ largest open positions.",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-white text-[16px] leading-[21px] font-medium tracking-[-0.32px] pl-[5px] font-inter",children:"Hot Whale Trades"}),i.jsxs("div",{className:"flex items-center gap-1 bg-[#262626] p-1 rounded-full w-fit",children:[i.jsxs("div",{className:"relative w-2 h-2 flex justify-center items-center",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-[#4DFF43]/[0.32] animate-ping"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-[#4DFF43]"})]}),i.jsx("span",{className:"text-white text-[10px] leading-[10px] font-medium",children:"LIVE"})]}),i.jsx("img",{className:"-ml-[4px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsxs("span",{className:"text-[#929292] text-[12px] font-medium",children:["Last updated ",FAe(o)]})]}),i.jsxs("div",{className:"laser-frame",children:[i.jsx("span",{className:"laser-beam"}),i.jsxs("div",{className:"pt-3 pl-3 pr-3 border border-[#1E1E1E] bg-[#101010] rounded-[16px]",children:[i.jsxs("div",{className:"w-full flex items-center justify-between mb-3",children:[i.jsx("div",{className:"flex items-center gap-[12px]",children:i.jsx("div",{className:"sm:w-auto w-[260px] overflow-x-auto whitespace-nowrap flex items-center gap-[12px] scrollbar-thin scrollbar-thumb-[#444] scrollbar-track-transparent",children:i.jsxs("div",{className:"flex items-center gap-[12px]",children:[i.jsx("div",{onClick:()=>u(""),className:`flex items-center justify-center h-7 w-7 px-4 rounded-[8px] text-white text-[14px] font-inter leading-[16px] cursor-pointer transition-colors ${c===""?"bg-[#262626]":"hover:bg-[#262626]"}`,children:"All"}),Ek.map(({id:C,label:N,emoji:P,description:T})=>{const M=c===C;return i.jsx("div",{onClick:()=>u(M?"":C),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] transition-colors cursor-pointer ${M?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(gi,{content:T,children:P})},C)})]})})}),i.jsxs("div",{className:"flex items-center justify-center w-12 sm:w-40 font-medium text-[#929292] text-[14px] leading-[18px] gap-2 px-4 py-2 cursor-pointer bg-[#262626] rounded-[8px] hover:scale-105 hover:bg-[#585858] hover:text-white transition-all",onClick:()=>a(!0),children:[i.jsx("span",{className:"hidden sm:inline",children:"View Full Activity"}),i.jsx("img",{src:sct,alt:"Expand",className:"w-5 h-5 sm:hidden"})]})]}),x.length===0?i.jsx("div",{className:"h-[312px] flex items-center justify-center text-[#9B9B9B] text-sm",children:"No data available for this filter."}):i.jsx(zu,{data:x,columns:y,tableClassName:"text-[14px]",theadClassName:"text-[13px] font-inter !text-[#9B9B9B] bg-transparent font-normal",tbodyClassName:"text-[14px]",cellClassName:"text-[14px] text-right font-medium",rowClassName:v,rowHeight:42,listHeight:285,rowKey:C=>{var N,P;return((N=C._id)==null?void 0:N.$oid)||((P=C.insert_date)==null?void 0:P.$date)},onVisibleRows:()=>{},onRowClick:C=>window.open(`/wallet-details/${C.wallet}`,"_blank")})]})]})]}),s&&i.jsxs(yp,{isOpen:s,onClose:()=>a(!1),fullscreen:d,children:[i.jsx("div",{className:"hidden sm:flex w-[95vw] max-h-[95vh] bg-[#101010] rounded-lg flex-col",children:i.jsx("div",{className:"px-4 py-2 overflow-x-auto",children:i.jsx("div",{className:"min-w-[1000px]",children:i.jsx(TAe,{})})})}),i.jsx("div",{className:" w-screen h-screen bg-[#101010] flex flex-col overflow-x-auto overflow-y-auto z-[9999]",children:i.jsx(TAe,{})})]})]})};function fi(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function MAe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bz(...t){return e=>{let n=!1;const r=t.map(s=>{const a=MAe(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():MAe(t[s],null)}}}}function du(...t){return m.useCallback(bz(...t),t)}function G5(t,e=[]){let n=[];function r(a,o){const l=m.createContext(o),c=n.length;n=[...n,o];const u=f=>{var N;const{scope:x,children:g,...y}=f,v=((N=x==null?void 0:x[t])==null?void 0:N[c])||l,C=m.useMemo(()=>y,Object.values(y));return i.jsx(v.Provider,{value:C,children:g})};u.displayName=a+"Provider";function d(f,x){var v;const g=((v=x==null?void 0:x[t])==null?void 0:v[c])||l,y=m.useContext(g);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const s=()=>{const a=n.map(o=>m.createContext(o));return function(l){const c=(l==null?void 0:l[t])||a;return m.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,lbn(s,...e)]}function lbn(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var m2=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},cbn=Wy[" useInsertionEffect ".trim().toString()]||m2;function yz({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=ubn({defaultProp:e,onChange:n}),l=t!==void 0,c=l?t:s;{const d=m.useRef(t!==void 0);m.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. 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.`),d.current=l},[l,r])}const u=m.useCallback(d=>{var f;if(l){const x=dbn(d)?d(t):d;x!==t&&((f=o.current)==null||f.call(o,x))}else a(d)},[l,t,a,o]);return[c,u]}function ubn({defaultProp:t,onChange:e}){const[n,r]=m.useState(t),s=m.useRef(n),a=m.useRef(e);return cbn(()=>{a.current=e},[e]),m.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function dbn(t){return typeof t=="function"}function _k(t){const e=fbn(t),n=m.forwardRef((r,s)=>{const{children:a,...o}=r,l=m.Children.toArray(a),c=l.find(pbn);if(c){const u=c.props.children,d=l.map(f=>f===c?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:f);return i.jsx(e,{...o,ref:s,children:m.isValidElement(u)?m.cloneElement(u,void 0,d):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function fbn(t){const e=m.forwardRef((n,r)=>{const{children:s,...a}=n;if(m.isValidElement(s)){const o=xbn(s),l=mbn(a,s.props);return s.type!==m.Fragment&&(l.ref=r?bz(r,o):o),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var hbn=Symbol("radix.slottable");function pbn(t){return m.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===hbn}function mbn(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function xbn(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gbn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Uc=gbn.reduce((t,e)=>{const n=_k(`Primitive.${e}`),r=m.forwardRef((s,a)=>{const{asChild:o,...l}=s,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Bqe(t,e){t&&Aa.flushSync(()=>t.dispatchEvent(e))}function $qe(t){const e=t+"CollectionProvider",[n,r]=G5(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:C,children:N}=v,P=Ne.useRef(null),T=Ne.useRef(new Map).current;return i.jsx(s,{scope:C,itemMap:T,collectionRef:P,children:N})};o.displayName=e;const l=t+"CollectionSlot",c=_k(l),u=Ne.forwardRef((v,C)=>{const{scope:N,children:P}=v,T=a(l,N),M=du(C,T.collectionRef);return i.jsx(c,{ref:M,children:P})});u.displayName=l;const d=t+"CollectionItemSlot",f="data-radix-collection-item",x=_k(d),g=Ne.forwardRef((v,C)=>{const{scope:N,children:P,...T}=v,M=Ne.useRef(null),F=du(C,M),$=a(d,N);return Ne.useEffect(()=>($.itemMap.set(M,{ref:M,...T}),()=>void $.itemMap.delete(M))),i.jsx(x,{[f]:"",ref:F,children:P})});g.displayName=d;function y(v){const C=a(t+"CollectionConsumer",v);return Ne.useCallback(()=>{const P=C.collectionRef.current;if(!P)return[];const T=Array.from(P.querySelectorAll(`[${f}]`));return Array.from(C.itemMap.values()).sort(($,L)=>T.indexOf($.ref.current)-T.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:o,Slot:u,ItemSlot:g},y,r]}var bbn=m.createContext(void 0);function Uqe(t){const e=m.useContext(bbn);return t||e||"ltr"}function T1(t){const e=m.useRef(t);return m.useEffect(()=>{e.current=t}),m.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function ybn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(t);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var vbn="DismissableLayer",Lse="dismissableLayer.update",wbn="dismissableLayer.pointerDownOutside",Cbn="dismissableLayer.focusOutside",RAe,zqe=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vz=m.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,u=m.useContext(zqe),[d,f]=m.useState(null),x=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=m.useState({}),y=du(e,L=>f(L)),v=Array.from(u.layers),[C]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),N=v.indexOf(C),P=d?v.indexOf(d):-1,T=u.layersWithOutsidePointerEventsDisabled.size>0,M=P>=N,F=Abn(L=>{const z=L.target,X=[...u.branches].some(ne=>ne.contains(z));!M||X||(s==null||s(L),o==null||o(L),L.defaultPrevented||l==null||l())},x),$=jbn(L=>{const z=L.target;[...u.branches].some(ne=>ne.contains(z))||(a==null||a(L),o==null||o(L),L.defaultPrevented||l==null||l())},x);return ybn(L=>{P===u.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},x),m.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(RAe=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),LAe(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=RAe)}},[d,x,n,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),LAe())},[d,u]),m.useEffect(()=>{const L=()=>g({});return document.addEventListener(Lse,L),()=>document.removeEventListener(Lse,L)},[]),i.jsx(Uc.div,{...c,ref:y,style:{pointerEvents:T?M?"auto":"none":void 0,...t.style},onFocusCapture:fi(t.onFocusCapture,$.onFocusCapture),onBlurCapture:fi(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:fi(t.onPointerDownCapture,F.onPointerDownCapture)})});vz.displayName=vbn;var Sbn="DismissableLayerBranch",Nbn=m.forwardRef((t,e)=>{const n=m.useContext(zqe),r=m.useRef(null),s=du(e,r);return m.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(Uc.div,{...t,ref:s})});Nbn.displayName=Sbn;function Abn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(t),r=m.useRef(!1),s=m.useRef(()=>{});return m.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){Hqe(wbn,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function jbn(t,e=globalThis==null?void 0:globalThis.document){const n=T1(t),r=m.useRef(!1);return m.useEffect(()=>{const s=a=>{a.target&&!r.current&&Hqe(Cbn,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function LAe(){const t=new CustomEvent(Lse);document.dispatchEvent(t)}function Hqe(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?Bqe(s,a):s.dispatchEvent(a)}var QQ=0;function Vqe(){m.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??DAe()),document.body.insertAdjacentElement("beforeend",t[1]??DAe()),QQ++,()=>{QQ===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),QQ--}},[])}function DAe(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ZQ="focusScope.autoFocusOnMount",JQ="focusScope.autoFocusOnUnmount",BAe={bubbles:!1,cancelable:!0},Ebn="FocusScope",sfe=m.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[l,c]=m.useState(null),u=T1(s),d=T1(a),f=m.useRef(null),x=du(e,v=>c(v)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(T){if(g.paused||!l)return;const M=T.target;l.contains(M)?f.current=M:Ub(f.current,{select:!0})},C=function(T){if(g.paused||!l)return;const M=T.relatedTarget;M!==null&&(l.contains(M)||Ub(f.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const F of T)F.removedNodes.length>0&&Ub(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const P=new MutationObserver(N);return l&&P.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),P.disconnect()}}},[r,l,g.paused]),m.useEffect(()=>{if(l){UAe.add(g);const v=document.activeElement;if(!l.contains(v)){const N=new CustomEvent(ZQ,BAe);l.addEventListener(ZQ,u),l.dispatchEvent(N),N.defaultPrevented||(_bn(Fbn(Wqe(l)),{select:!0}),document.activeElement===v&&Ub(l))}return()=>{l.removeEventListener(ZQ,u),setTimeout(()=>{const N=new CustomEvent(JQ,BAe);l.addEventListener(JQ,d),l.dispatchEvent(N),N.defaultPrevented||Ub(v??document.body,{select:!0}),l.removeEventListener(JQ,d),UAe.remove(g)},0)}}},[l,u,d,g]);const y=m.useCallback(v=>{if(!n&&!r||g.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,N=document.activeElement;if(C&&N){const P=v.currentTarget,[T,M]=kbn(P);T&&M?!v.shiftKey&&N===M?(v.preventDefault(),n&&Ub(T,{select:!0})):v.shiftKey&&N===T&&(v.preventDefault(),n&&Ub(M,{select:!0})):N===P&&v.preventDefault()}},[n,r,g.paused]);return i.jsx(Uc.div,{tabIndex:-1,...o,ref:x,onKeyDown:y})});sfe.displayName=Ebn;function _bn(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ub(r,{select:e}),document.activeElement!==n)return}function kbn(t){const e=Wqe(t),n=$Ae(e,t),r=$Ae(e.reverse(),t);return[n,r]}function Wqe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function $Ae(t,e){for(const n of t)if(!Tbn(n,{upTo:e}))return n}function Tbn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Pbn(t){return t instanceof HTMLInputElement&&"select"in t}function Ub(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Pbn(t)&&e&&t.select()}}var UAe=Ibn();function Ibn(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=zAe(t,e),t.unshift(e)},remove(e){var n;t=zAe(t,e),(n=t[0])==null||n.resume()}}}function zAe(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Fbn(t){return t.filter(e=>e.tagName!=="A")}var Obn=Wy[" useId ".trim().toString()]||(()=>{}),Mbn=0;function JD(t){const[e,n]=m.useState(Obn());return m2(()=>{t||n(r=>r??String(Mbn++))},[t]),t||(e?`radix-${e}`:"")}var Rbn=typeof document<"u",Lbn=function(){},EM=Rbn?m.useLayoutEffect:Lbn;function eB(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!eB(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!eB(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function qqe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function HAe(t,e){const n=qqe(t);return Math.round(e*n)/n}function eZ(t){const e=m.useRef(t);return EM(()=>{e.current=t}),e}function Dbn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,f]=m.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,g]=m.useState(r);eB(x,r)||g(r);const[y,v]=m.useState(null),[C,N]=m.useState(null),P=m.useCallback(W=>{W!==$.current&&($.current=W,v(W))},[]),T=m.useCallback(W=>{W!==L.current&&(L.current=W,N(W))},[]),M=a||y,F=o||C,$=m.useRef(null),L=m.useRef(null),z=m.useRef(d),X=c!=null,ne=eZ(c),J=eZ(s),K=eZ(u),te=m.useCallback(()=>{if(!$.current||!L.current)return;const W={placement:e,strategy:n,middleware:x};J.current&&(W.platform=J.current),N7e($.current,L.current,W).then(V=>{const ee={...V,isPositioned:K.current!==!1};fe.current&&!eB(z.current,ee)&&(z.current=ee,Aa.flushSync(()=>{f(ee)}))})},[x,e,n,J,K]);EM(()=>{u===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[u]);const fe=m.useRef(!1);EM(()=>(fe.current=!0,()=>{fe.current=!1}),[]),EM(()=>{if(M&&($.current=M),F&&(L.current=F),M&&F){if(ne.current)return ne.current(M,F,te);te()}},[M,F,te,ne,X]);const q=m.useMemo(()=>({reference:$,floating:L,setReference:P,setFloating:T}),[P,T]),se=m.useMemo(()=>({reference:M,floating:F}),[M,F]),ae=m.useMemo(()=>{const W={position:n,left:0,top:0};if(!se.floating)return W;const V=HAe(se.floating,d.x),ee=HAe(se.floating,d.y);return l?{...W,transform:"translate("+V+"px, "+ee+"px)",...qqe(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:ee}},[n,l,se.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:te,refs:q,elements:se,floatingStyles:ae}),[d,te,q,se,ae])}const Bbn=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?_he({element:r.current,padding:s}).fn(n):{}:r?_he({element:r,padding:s}).fn(n):{}}}},$bn=(t,e)=>({...v7e(t),options:[t,e]}),Ubn=(t,e)=>({...w7e(t),options:[t,e]}),zbn=(t,e)=>({...ttt(t),options:[t,e]}),Hbn=(t,e)=>({...C7e(t),options:[t,e]}),Vbn=(t,e)=>({...S7e(t),options:[t,e]}),Wbn=(t,e)=>({...ett(t),options:[t,e]}),qbn=(t,e)=>({...Bbn(t),options:[t,e]});var Gbn="Arrow",Gqe=m.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(Uc.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});Gqe.displayName=Gbn;var Kbn=Gqe;function Ybn(t){const[e,n]=m.useState(void 0);return m2(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ife="Popper",[Kqe,Dj]=G5(ife),[Xbn,Yqe]=Kqe(ife),Xqe=t=>{const{__scopePopper:e,children:n}=t,[r,s]=m.useState(null);return i.jsx(Xbn,{scope:e,anchor:r,onAnchorChange:s,children:n})};Xqe.displayName=ife;var Qqe="PopperAnchor",Zqe=m.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=Yqe(Qqe,n),o=m.useRef(null),l=du(e,o);return m.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:i.jsx(Uc.div,{...s,ref:l})});Zqe.displayName=Qqe;var afe="PopperContent",[Qbn,Zbn]=Kqe(afe),Jqe=m.forwardRef((t,e)=>{var be,je,Ie,Re,Qe,Ke;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:x=!1,updatePositionStrategy:g="optimized",onPlaced:y,...v}=t,C=Yqe(afe,n),[N,P]=m.useState(null),T=du(e,dt=>P(dt)),[M,F]=m.useState(null),$=Ybn(M),L=($==null?void 0:$.width)??0,z=($==null?void 0:$.height)??0,X=r+(a!=="center"?"-"+a:""),ne=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},J=Array.isArray(u)?u:[u],K=J.length>0,te={padding:ne,boundary:J.filter(eyn),altBoundary:K},{refs:fe,floatingStyles:q,placement:se,isPositioned:ae,middlewareData:W}=Dbn({strategy:"fixed",placement:X,whileElementsMounted:(...dt)=>y7e(...dt,{animationFrame:g==="always"}),elements:{reference:C.anchor},middleware:[$bn({mainAxis:s+z,alignmentAxis:o}),c&&Ubn({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zbn():void 0,...te}),c&&Hbn({...te}),Vbn({...te,apply:({elements:dt,rects:tt,availableWidth:nt,availableHeight:Le})=>{const{width:Be,height:ht}=tt.reference,pt=dt.floating.style;pt.setProperty("--radix-popper-available-width",`${nt}px`),pt.setProperty("--radix-popper-available-height",`${Le}px`),pt.setProperty("--radix-popper-anchor-width",`${Be}px`),pt.setProperty("--radix-popper-anchor-height",`${ht}px`)}}),M&&qbn({element:M,padding:l}),tyn({arrowWidth:L,arrowHeight:z}),x&&Wbn({strategy:"referenceHidden",...te})]}),[V,ee]=nGe(se),oe=T1(y);m2(()=>{ae&&(oe==null||oe())},[ae,oe]);const de=(be=W.arrow)==null?void 0:be.x,Ce=(je=W.arrow)==null?void 0:je.y,me=((Ie=W.arrow)==null?void 0:Ie.centerOffset)!==0,[we,xe]=m.useState();return m2(()=>{N&&xe(window.getComputedStyle(N).zIndex)},[N]),i.jsx("div",{ref:fe.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:ae?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(Re=W.transformOrigin)==null?void 0:Re.x,(Qe=W.transformOrigin)==null?void 0:Qe.y].join(" "),...((Ke=W.hide)==null?void 0:Ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(Qbn,{scope:n,placedSide:V,onArrowChange:F,arrowX:de,arrowY:Ce,shouldHideArrow:me,children:i.jsx(Uc.div,{"data-side":V,"data-align":ee,...v,ref:T,style:{...v.style,animation:ae?void 0:"none"}})})})});Jqe.displayName=afe;var eGe="PopperArrow",Jbn={top:"bottom",right:"left",bottom:"top",left:"right"},tGe=m.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=Zbn(eGe,r),o=Jbn[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(Kbn,{...s,ref:n,style:{...s.style,display:"block"}})})});tGe.displayName=eGe;function eyn(t){return t!==null}var tyn=t=>({name:"transformOrigin",options:t,fn(e){var C,N,P;const{placement:n,rects:r,middlewareData:s}=e,o=((C=s.arrow)==null?void 0:C.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[u,d]=nGe(n),f={start:"0%",center:"50%",end:"100%"}[d],x=(((N=s.arrow)==null?void 0:N.x)??0)+l/2,g=(((P=s.arrow)==null?void 0:P.y)??0)+c/2;let y="",v="";return u==="bottom"?(y=o?f:`${x}px`,v=`${-c}px`):u==="top"?(y=o?f:`${x}px`,v=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,v=o?f:`${g}px`):u==="left"&&(y=`${r.floating.width+c}px`,v=o?f:`${g}px`),{data:{x:y,y:v}}}});function nGe(t){const[e,n="center"]=t.split("-");return[e,n]}var ofe=Xqe,wz=Zqe,lfe=Jqe,cfe=tGe,nyn="Portal",ufe=m.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,a]=m.useState(!1);m2(()=>a(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?Kse.createPortal(i.jsx(Uc.div,{...r,ref:e}),o):null});ufe.displayName=nyn;function ryn(t,e){return m.useReducer((n,r)=>e[n][r]??n,t)}var $2=t=>{const{present:e,children:n}=t,r=syn(e),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),a=du(r.ref,iyn(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:a}):null};$2.displayName="Presence";function syn(t){const[e,n]=m.useState(),r=m.useRef(null),s=m.useRef(t),a=m.useRef("none"),o=t?"mounted":"unmounted",[l,c]=ryn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=XF(r.current);a.current=l==="mounted"?u:"none"},[l]),m2(()=>{const u=r.current,d=s.current;if(d!==t){const x=a.current,g=XF(u);t?c("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&x!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),m2(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=g=>{const v=XF(r.current).includes(g.animationName);if(g.target===e&&v&&(c("ANIMATION_END"),!s.current)){const C=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=C)})}},x=g=>{g.target===e&&(a.current=XF(r.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function XF(t){return(t==null?void 0:t.animationName)||"none"}function iyn(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var tZ="rovingFocusGroup.onEntryFocus",ayn={bubbles:!1,cancelable:!0},oP="RovingFocusGroup",[Dse,rGe,oyn]=$qe(oP),[lyn,sGe]=G5(oP,[oyn]),[cyn,uyn]=lyn(oP),iGe=m.forwardRef((t,e)=>i.jsx(Dse.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(Dse.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(dyn,{...t,ref:e})})}));iGe.displayName=oP;var dyn=m.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,x=m.useRef(null),g=du(e,x),y=Uqe(a),[v,C]=yz({prop:o,defaultProp:l??null,onChange:c,caller:oP}),[N,P]=m.useState(!1),T=T1(u),M=rGe(n),F=m.useRef(!1),[$,L]=m.useState(0);return m.useEffect(()=>{const z=x.current;if(z)return z.addEventListener(tZ,T),()=>z.removeEventListener(tZ,T)},[T]),i.jsx(cyn,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:v,onItemFocus:m.useCallback(z=>C(z),[C]),onItemShiftTab:m.useCallback(()=>P(!0),[]),onFocusableItemAdd:m.useCallback(()=>L(z=>z+1),[]),onFocusableItemRemove:m.useCallback(()=>L(z=>z-1),[]),children:i.jsx(Uc.div,{tabIndex:N||$===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...t.style},onMouseDown:fi(t.onMouseDown,()=>{F.current=!0}),onFocus:fi(t.onFocus,z=>{const X=!F.current;if(z.target===z.currentTarget&&X&&!N){const ne=new CustomEvent(tZ,ayn);if(z.currentTarget.dispatchEvent(ne),!ne.defaultPrevented){const J=M().filter(se=>se.focusable),K=J.find(se=>se.active),te=J.find(se=>se.id===v),q=[K,te,...J].filter(Boolean).map(se=>se.ref.current);lGe(q,d)}}F.current=!1}),onBlur:fi(t.onBlur,()=>P(!1))})})}),aGe="RovingFocusGroupItem",oGe=m.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...l}=t,c=JD(),u=a||c,d=uyn(aGe,n),f=d.currentTabStopId===u,x=rGe(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:v}=d;return m.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),i.jsx(Dse.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:i.jsx(Uc.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:e,onMouseDown:fi(t.onMouseDown,C=>{r?d.onItemFocus(u):C.preventDefault()}),onFocus:fi(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:fi(t.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){d.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const N=pyn(C,d.orientation,d.dir);if(N!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let T=x().filter(M=>M.focusable).map(M=>M.ref.current);if(N==="last")T.reverse();else if(N==="prev"||N==="next"){N==="prev"&&T.reverse();const M=T.indexOf(C.currentTarget);T=d.loop?myn(T,M+1):T.slice(M+1)}setTimeout(()=>lGe(T))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:v!=null}):o})})});oGe.displayName=aGe;var fyn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hyn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function pyn(t,e,n){const r=hyn(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fyn[r]}function lGe(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function myn(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var xyn=iGe,gyn=oGe,byn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},MC=new WeakMap,QF=new WeakMap,ZF={},nZ=0,cGe=function(t){return t&&(t.host||cGe(t.parentNode))},yyn=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=cGe(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},vyn=function(t,e,n,r){var s=yyn(e,Array.isArray(t)?t:[t]);ZF[n]||(ZF[n]=new WeakMap);var a=ZF[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(x){if(l.has(x))d(x);else try{var g=x.getAttribute(r),y=g!==null&&g!=="false",v=(MC.get(x)||0)+1,C=(a.get(x)||0)+1;MC.set(x,v),a.set(x,C),o.push(x),v===1&&y&&QF.set(x,!0),C===1&&x.setAttribute(n,"true"),y||x.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",x,N)}})};return d(e),l.clear(),nZ++,function(){o.forEach(function(f){var x=MC.get(f)-1,g=a.get(f)-1;MC.set(f,x),a.set(f,g),x||(QF.has(f)||f.removeAttribute(r),QF.delete(f)),g||f.removeAttribute(n)}),nZ--,nZ||(MC=new WeakMap,MC=new WeakMap,QF=new WeakMap,ZF={})}},uGe=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=byn(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),vyn(r,s,n,"aria-hidden")):function(){return null}},Yb=function(){return Yb=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Yb.apply(this,arguments)};function wyn(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Cyn(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,a;r<s;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}var dGe=qDe(),rZ=function(){},Cz=m.forwardRef(function(t,e){var n=m.useRef(null),r=m.useState({onScrollCapture:rZ,onWheelCapture:rZ,onTouchMoveCapture:rZ}),s=r[0],a=r[1],o=t.forwardProps,l=t.children,c=t.className,u=t.removeScrollBar,d=t.enabled,f=t.shards,x=t.sideCar,g=t.noRelative,y=t.noIsolation,v=t.inert,C=t.allowPinchZoom,N=t.as,P=N===void 0?"div":N,T=t.gapMode,M=wyn(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=x,$=yDe([n,e]),L=Yb(Yb({},M),s);return m.createElement(m.Fragment,null,d&&m.createElement(F,{sideCar:dGe,removeScrollBar:u,shards:f,noRelative:g,noIsolation:y,inert:v,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:T}),o?m.cloneElement(m.Children.only(l),Yb(Yb({},L),{ref:$})):m.createElement(P,Yb({},L,{className:c,ref:$}),l))});Cz.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cz.classNames={fullWidth:M9,zeroRight:O9};var Bse=!1;if(typeof window<"u")try{var JF=Object.defineProperty({},"passive",{get:function(){return Bse=!0,!0}});window.addEventListener("test",JF,JF),window.removeEventListener("test",JF,JF)}catch{Bse=!1}var RC=Bse?{passive:!1}:!1,Syn=function(t){return t.tagName==="TEXTAREA"},fGe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Syn(t)&&n[e]==="visible")},Nyn=function(t){return fGe(t,"overflowY")},Ayn=function(t){return fGe(t,"overflowX")},VAe=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=hGe(t,r);if(s){var a=pGe(t,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},jyn=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Eyn=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},hGe=function(t,e){return t==="v"?Nyn(e):Ayn(e)},pGe=function(t,e){return t==="v"?jyn(e):Eyn(e)},_yn=function(t,e){return t==="h"&&e==="rtl"?-1:1},kyn=function(t,e,n,r,s){var a=_yn(t,window.getComputedStyle(e).direction),o=a*r,l=n.target,c=e.contains(l),u=!1,d=o>0,f=0,x=0;do{if(!l)break;var g=pGe(t,l),y=g[0],v=g[1],C=g[2],N=v-C-a*y;(y||N)&&hGe(t,l)&&(f+=N,x+=y);var P=l.parentNode;l=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(d&&Math.abs(f)<1||!d&&Math.abs(x)<1)&&(u=!0),u},eO=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},WAe=function(t){return[t.deltaX,t.deltaY]},qAe=function(t){return t&&"current"in t?t.current:t},Tyn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Pyn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Iyn=0,LC=[];function Fyn(t){var e=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(Iyn++)[0],a=m.useState(kce)[0],o=m.useRef(t);m.useEffect(function(){o.current=t},[t]),m.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var v=Cyn([t.lockRef.current],(t.shards||[]).map(qAe),!0).filter(Boolean);return v.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=m.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var N=eO(v),P=n.current,T="deltaX"in v?v.deltaX:P[0]-N[0],M="deltaY"in v?v.deltaY:P[1]-N[1],F,$=v.target,L=Math.abs(T)>Math.abs(M)?"h":"v";if("touches"in v&&L==="h"&&$.type==="range")return!1;var z=VAe(L,$);if(!z)return!0;if(z?F=L:(F=L==="v"?"h":"v",z=VAe(L,$)),!z)return!1;if(!r.current&&"changedTouches"in v&&(T||M)&&(r.current=F),!F)return!0;var X=r.current||F;return kyn(X,C,v,X==="h"?T:M)},[]),c=m.useCallback(function(v){var C=v;if(!(!LC.length||LC[LC.length-1]!==a)){var N="deltaY"in C?WAe(C):eO(C),P=e.current.filter(function(F){return F.name===C.type&&(F.target===C.target||C.target===F.shadowParent)&&Tyn(F.delta,N)})[0];if(P&&P.should){C.cancelable&&C.preventDefault();return}if(!P){var T=(o.current.shards||[]).map(qAe).filter(Boolean).filter(function(F){return F.contains(C.target)}),M=T.length>0?l(C,T[0]):!o.current.noIsolation;M&&C.cancelable&&C.preventDefault()}}},[]),u=m.useCallback(function(v,C,N,P){var T={name:v,delta:C,target:N,should:P,shadowParent:Oyn(N)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(M){return M!==T})},1)},[]),d=m.useCallback(function(v){n.current=eO(v),r.current=void 0},[]),f=m.useCallback(function(v){u(v.type,WAe(v),v.target,l(v,t.lockRef.current))},[]),x=m.useCallback(function(v){u(v.type,eO(v),v.target,l(v,t.lockRef.current))},[]);m.useEffect(function(){return LC.push(a),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,RC),document.addEventListener("touchmove",c,RC),document.addEventListener("touchstart",d,RC),function(){LC=LC.filter(function(v){return v!==a}),document.removeEventListener("wheel",c,RC),document.removeEventListener("touchmove",c,RC),document.removeEventListener("touchstart",d,RC)}},[]);var g=t.removeScrollBar,y=t.inert;return m.createElement(m.Fragment,null,y?m.createElement(a,{styles:Pyn(s)}):null,g?m.createElement(XDe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Oyn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Myn=KDe(dGe,Fyn);var dfe=m.forwardRef(function(t,e){return m.createElement(Cz,Yb({},t,{ref:e,sideCar:Myn}))});dfe.classNames=Cz.classNames;var $se=["Enter"," "],Ryn=["ArrowDown","PageUp","Home"],mGe=["ArrowUp","PageDown","End"],Lyn=[...Ryn,...mGe],Dyn={ltr:[...$se,"ArrowRight"],rtl:[...$se,"ArrowLeft"]},Byn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},lP="Menu",[kk,$yn,Uyn]=$qe(lP),[K5,xGe]=G5(lP,[Uyn,Dj,sGe]),Sz=Dj(),gGe=sGe(),[zyn,Bj]=K5(lP),[Hyn,cP]=K5(lP),bGe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:a,modal:o=!0}=t,l=Sz(e),[c,u]=m.useState(null),d=m.useRef(!1),f=T1(a),x=Uqe(s);return m.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),i.jsx(ofe,{...l,children:i.jsx(zyn,{scope:e,open:n,onOpenChange:f,content:c,onContentChange:u,children:i.jsx(Hyn,{scope:e,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:x,modal:o,children:r})})})};bGe.displayName=lP;var Vyn="MenuAnchor",ffe=m.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Sz(n);return i.jsx(wz,{...s,...r,ref:e})});ffe.displayName=Vyn;var Wyn="MenuPortal",[XCn,yGe]=K5(Wyn,{forceMount:void 0}),fp="MenuContent",[qyn,hfe]=K5(fp),vGe=m.forwardRef((t,e)=>{const n=yGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=Bj(fp,t.__scopeMenu),o=cP(fp,t.__scopeMenu);return i.jsx(kk.Provider,{scope:t.__scopeMenu,children:i.jsx($2,{present:r||a.open,children:i.jsx(kk.Slot,{scope:t.__scopeMenu,children:o.modal?i.jsx(Gyn,{...s,ref:e}):i.jsx(Kyn,{...s,ref:e})})})})}),Gyn=m.forwardRef((t,e)=>{const n=Bj(fp,t.__scopeMenu),r=m.useRef(null),s=du(e,r);return m.useEffect(()=>{const a=r.current;if(a)return uGe(a)},[]),i.jsx(pfe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fi(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Kyn=m.forwardRef((t,e)=>{const n=Bj(fp,t.__scopeMenu);return i.jsx(pfe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Yyn=_k("MenuContent.ScrollLock"),pfe=m.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:x,onDismiss:g,disableOutsideScroll:y,...v}=t,C=Bj(fp,n),N=cP(fp,n),P=Sz(n),T=gGe(n),M=$yn(n),[F,$]=m.useState(null),L=m.useRef(null),z=du(e,L,C.onContentChange),X=m.useRef(0),ne=m.useRef(""),J=m.useRef(0),K=m.useRef(null),te=m.useRef("right"),fe=m.useRef(0),q=y?dfe:m.Fragment,se=y?{as:Yyn,allowPinchZoom:!0}:void 0,ae=V=>{var be,je;const ee=ne.current+V,oe=M().filter(Ie=>!Ie.disabled),de=document.activeElement,Ce=(be=oe.find(Ie=>Ie.ref.current===de))==null?void 0:be.textValue,me=oe.map(Ie=>Ie.textValue),we=o2n(me,ee,Ce),xe=(je=oe.find(Ie=>Ie.textValue===we))==null?void 0:je.ref.current;(function Ie(Re){ne.current=Re,window.clearTimeout(X.current),Re!==""&&(X.current=window.setTimeout(()=>Ie(""),1e3))})(ee),xe&&setTimeout(()=>xe.focus())};m.useEffect(()=>()=>window.clearTimeout(X.current),[]),Vqe();const W=m.useCallback(V=>{var oe,de;return te.current===((oe=K.current)==null?void 0:oe.side)&&c2n(V,(de=K.current)==null?void 0:de.area)},[]);return i.jsx(qyn,{scope:n,searchRef:ne,onItemEnter:m.useCallback(V=>{W(V)&&V.preventDefault()},[W]),onItemLeave:m.useCallback(V=>{var ee;W(V)||((ee=L.current)==null||ee.focus(),$(null))},[W]),onTriggerLeave:m.useCallback(V=>{W(V)&&V.preventDefault()},[W]),pointerGraceTimerRef:J,onPointerGraceIntentChange:m.useCallback(V=>{K.current=V},[]),children:i.jsx(q,{...se,children:i.jsx(sfe,{asChild:!0,trapped:s,onMountAutoFocus:fi(a,V=>{var ee;V.preventDefault(),(ee=L.current)==null||ee.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(vz,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:x,onDismiss:g,children:i.jsx(xyn,{asChild:!0,...T,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:F,onCurrentTabStopIdChange:$,onEntryFocus:fi(c,V=>{N.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(lfe,{role:"menu","aria-orientation":"vertical","data-state":RGe(C.open),"data-radix-menu-content":"",dir:N.dir,...P,...v,ref:z,style:{outline:"none",...v.style},onKeyDown:fi(v.onKeyDown,V=>{const oe=V.target.closest("[data-radix-menu-content]")===V.currentTarget,de=V.ctrlKey||V.altKey||V.metaKey,Ce=V.key.length===1;oe&&(V.key==="Tab"&&V.preventDefault(),!de&&Ce&&ae(V.key));const me=L.current;if(V.target!==me||!Lyn.includes(V.key))return;V.preventDefault();const xe=M().filter(be=>!be.disabled).map(be=>be.ref.current);mGe.includes(V.key)&&xe.reverse(),i2n(xe)}),onBlur:fi(t.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(X.current),ne.current="")}),onPointerMove:fi(t.onPointerMove,Tk(V=>{const ee=V.target,oe=fe.current!==V.clientX;if(V.currentTarget.contains(ee)&&oe){const de=V.clientX>fe.current?"right":"left";te.current=de,fe.current=V.clientX}}))})})})})})})});vGe.displayName=fp;var Xyn="MenuGroup",mfe=m.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Uc.div,{role:"group",...r,ref:e})});mfe.displayName=Xyn;var Qyn="MenuLabel",wGe=m.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Uc.div,{...r,ref:e})});wGe.displayName=Qyn;var tB="MenuItem",GAe="menu.itemSelect",Nz=m.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,a=m.useRef(null),o=cP(tB,t.__scopeMenu),l=hfe(tB,t.__scopeMenu),c=du(e,a),u=m.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const x=new CustomEvent(GAe,{bubbles:!0,cancelable:!0});f.addEventListener(GAe,g=>r==null?void 0:r(g),{once:!0}),Bqe(f,x),x.defaultPrevented?u.current=!1:o.onClose()}};return i.jsx(CGe,{...s,ref:c,disabled:n,onClick:fi(t.onClick,d),onPointerDown:f=>{var x;(x=t.onPointerDown)==null||x.call(t,f),u.current=!0},onPointerUp:fi(t.onPointerUp,f=>{var x;u.current||(x=f.currentTarget)==null||x.click()}),onKeyDown:fi(t.onKeyDown,f=>{const x=l.searchRef.current!=="";n||x&&f.key===" "||$se.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nz.displayName=tB;var CGe=m.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=t,o=hfe(tB,n),l=gGe(n),c=m.useRef(null),u=du(e,c),[d,f]=m.useState(!1),[x,g]=m.useState("");return m.useEffect(()=>{const y=c.current;y&&g((y.textContent??"").trim())},[a.children]),i.jsx(kk.ItemSlot,{scope:n,disabled:r,textValue:s??x,children:i.jsx(gyn,{asChild:!0,...l,focusable:!r,children:i.jsx(Uc.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:u,onPointerMove:fi(t.onPointerMove,Tk(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fi(t.onPointerLeave,Tk(y=>o.onItemLeave(y))),onFocus:fi(t.onFocus,()=>f(!0)),onBlur:fi(t.onBlur,()=>f(!1))})})})}),Zyn="MenuCheckboxItem",SGe=m.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return i.jsx(_Ge,{scope:t.__scopeMenu,checked:n,children:i.jsx(Nz,{role:"menuitemcheckbox","aria-checked":nB(n)?"mixed":n,...s,ref:e,"data-state":gfe(n),onSelect:fi(s.onSelect,()=>r==null?void 0:r(nB(n)?!0:!n),{checkForDefaultPrevented:!1})})})});SGe.displayName=Zyn;var NGe="MenuRadioGroup",[Jyn,e2n]=K5(NGe,{value:void 0,onValueChange:()=>{}}),AGe=m.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,a=T1(r);return i.jsx(Jyn,{scope:t.__scopeMenu,value:n,onValueChange:a,children:i.jsx(mfe,{...s,ref:e})})});AGe.displayName=NGe;var jGe="MenuRadioItem",EGe=m.forwardRef((t,e)=>{const{value:n,...r}=t,s=e2n(jGe,t.__scopeMenu),a=n===s.value;return i.jsx(_Ge,{scope:t.__scopeMenu,checked:a,children:i.jsx(Nz,{role:"menuitemradio","aria-checked":a,...r,ref:e,"data-state":gfe(a),onSelect:fi(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});EGe.displayName=jGe;var xfe="MenuItemIndicator",[_Ge,t2n]=K5(xfe,{checked:!1}),kGe=m.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,a=t2n(xfe,n);return i.jsx($2,{present:r||nB(a.checked)||a.checked===!0,children:i.jsx(Uc.span,{...s,ref:e,"data-state":gfe(a.checked)})})});kGe.displayName=xfe;var n2n="MenuSeparator",TGe=m.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return i.jsx(Uc.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});TGe.displayName=n2n;var r2n="MenuArrow",PGe=m.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=Sz(n);return i.jsx(cfe,{...s,...r,ref:e})});PGe.displayName=r2n;var s2n="MenuSub",[QCn,IGe]=K5(s2n),f9="MenuSubTrigger",FGe=m.forwardRef((t,e)=>{const n=Bj(f9,t.__scopeMenu),r=cP(f9,t.__scopeMenu),s=IGe(f9,t.__scopeMenu),a=hfe(f9,t.__scopeMenu),o=m.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:t.__scopeMenu},d=m.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return m.useEffect(()=>d,[d]),m.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),i.jsx(ffe,{asChild:!0,...u,children:i.jsx(CGe,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":RGe(n.open),...t,ref:bz(e,s.onTriggerChange),onClick:f=>{var x;(x=t.onClick)==null||x.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fi(t.onPointerMove,Tk(f=>{a.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:fi(t.onPointerLeave,Tk(f=>{var g,y;d();const x=(g=n.content)==null?void 0:g.getBoundingClientRect();if(x){const v=(y=n.content)==null?void 0:y.dataset.side,C=v==="right",N=C?-5:5,P=x[C?"left":"right"],T=x[C?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+N,y:f.clientY},{x:P,y:x.top},{x:T,y:x.top},{x:T,y:x.bottom},{x:P,y:x.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:fi(t.onKeyDown,f=>{var g;const x=a.searchRef.current!=="";t.disabled||x&&f.key===" "||Dyn[r.dir].includes(f.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),f.preventDefault())})})})});FGe.displayName=f9;var OGe="MenuSubContent",MGe=m.forwardRef((t,e)=>{const n=yGe(fp,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,a=Bj(fp,t.__scopeMenu),o=cP(fp,t.__scopeMenu),l=IGe(OGe,t.__scopeMenu),c=m.useRef(null),u=du(e,c);return i.jsx(kk.Provider,{scope:t.__scopeMenu,children:i.jsx($2,{present:r||a.open,children:i.jsx(kk.Slot,{scope:t.__scopeMenu,children:i.jsx(pfe,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:fi(t.onFocusOutside,d=>{d.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:fi(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:fi(t.onKeyDown,d=>{var g;const f=d.currentTarget.contains(d.target),x=Byn[o.dir].includes(d.key);f&&x&&(a.onOpenChange(!1),(g=l.trigger)==null||g.focus(),d.preventDefault())})})})})})});MGe.displayName=OGe;function RGe(t){return t?"open":"closed"}function nB(t){return t==="indeterminate"}function gfe(t){return nB(t)?"indeterminate":t?"checked":"unchecked"}function i2n(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function a2n(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function o2n(t,e,n){const s=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=a2n(t,Math.max(a,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function l2n(t,e){const{x:n,y:r}=t;let s=!1;for(let a=0,o=e.length-1;a<e.length;o=a++){const l=e[a],c=e[o],u=l.x,d=l.y,f=c.x,x=c.y;d>r!=x>r&&n<(f-u)*(r-d)/(x-d)+u&&(s=!s)}return s}function c2n(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return l2n(n,e)}function Tk(t){return e=>e.pointerType==="mouse"?t(e):void 0}var u2n=bGe,d2n=ffe,f2n=vGe,h2n=mfe,p2n=wGe,m2n=Nz,x2n=SGe,g2n=AGe,b2n=EGe,y2n=kGe,v2n=TGe,w2n=PGe,C2n=FGe,S2n=MGe,Az="DropdownMenu",[N2n,ZCn]=G5(Az,[xGe]),Cf=xGe(),[A2n,LGe]=N2n(Az),DGe=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,c=Cf(e),u=m.useRef(null),[d,f]=yz({prop:s,defaultProp:a??!1,onChange:o,caller:Az});return i.jsx(A2n,{scope:e,triggerId:JD(),triggerRef:u,contentId:JD(),open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(x=>!x),[f]),modal:l,children:i.jsx(u2n,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};DGe.displayName=Az;var BGe="DropdownMenuTrigger",$Ge=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,a=LGe(BGe,n),o=Cf(n);return i.jsx(d2n,{asChild:!0,...o,children:i.jsx(Uc.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:bz(e,a.triggerRef),onPointerDown:fi(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:fi(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});$Ge.displayName=BGe;var UGe="DropdownMenuContent",zGe=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=LGe(UGe,n),a=Cf(n),o=m.useRef(!1);return i.jsx(f2n,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...r,ref:e,onCloseAutoFocus:fi(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:fi(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zGe.displayName=UGe;var j2n="DropdownMenuGroup",E2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(h2n,{...s,...r,ref:e})});E2n.displayName=j2n;var _2n="DropdownMenuLabel",k2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(p2n,{...s,...r,ref:e})});k2n.displayName=_2n;var T2n="DropdownMenuItem",HGe=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(m2n,{...s,...r,ref:e})});HGe.displayName=T2n;var P2n="DropdownMenuCheckboxItem",I2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(x2n,{...s,...r,ref:e})});I2n.displayName=P2n;var F2n="DropdownMenuRadioGroup",O2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(g2n,{...s,...r,ref:e})});O2n.displayName=F2n;var M2n="DropdownMenuRadioItem",R2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(b2n,{...s,...r,ref:e})});R2n.displayName=M2n;var L2n="DropdownMenuItemIndicator",D2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(y2n,{...s,...r,ref:e})});D2n.displayName=L2n;var B2n="DropdownMenuSeparator",$2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(v2n,{...s,...r,ref:e})});$2n.displayName=B2n;var U2n="DropdownMenuArrow",z2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(w2n,{...s,...r,ref:e})});z2n.displayName=U2n;var H2n="DropdownMenuSubTrigger",V2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(C2n,{...s,...r,ref:e})});V2n.displayName=H2n;var W2n="DropdownMenuSubContent",q2n=m.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=Cf(n);return i.jsx(S2n,{...s,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});q2n.displayName=W2n;var sZ=DGe,G2n=$Ge,iZ=zGe,aZ=HGe,jz="Popover",[VGe,JCn]=G5(jz,[Dj]),uP=Dj(),[K2n,U2]=VGe(jz),WGe=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!1}=t,l=uP(e),c=m.useRef(null),[u,d]=m.useState(!1),[f,x]=yz({prop:r,defaultProp:s??!1,onChange:a,caller:jz});return i.jsx(ofe,{...l,children:i.jsx(K2n,{scope:e,contentId:JD(),triggerRef:c,open:f,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(g=>!g),[x]),hasCustomAnchor:u,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:o,children:n})})};WGe.displayName=jz;var qGe="PopoverAnchor",Y2n=m.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(qGe,n),a=uP(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return m.useEffect(()=>(o(),()=>l()),[o,l]),i.jsx(wz,{...a,...r,ref:e})});Y2n.displayName=qGe;var GGe="PopoverTrigger",KGe=m.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(GGe,n),a=uP(n),o=du(e,s.triggerRef),l=i.jsx(Uc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":JGe(s.open),...r,ref:o,onClick:fi(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:i.jsx(wz,{asChild:!0,...a,children:l})});KGe.displayName=GGe;var bfe="PopoverPortal",[X2n,Q2n]=VGe(bfe,{forceMount:void 0}),YGe=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,a=U2(bfe,e);return i.jsx(X2n,{scope:e,forceMount:n,children:i.jsx($2,{present:n||a.open,children:i.jsx(ufe,{asChild:!0,container:s,children:r})})})};YGe.displayName=bfe;var CA="PopoverContent",XGe=m.forwardRef((t,e)=>{const n=Q2n(CA,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,a=U2(CA,t.__scopePopover);return i.jsx($2,{present:r||a.open,children:a.modal?i.jsx(J2n,{...s,ref:e}):i.jsx(evn,{...s,ref:e})})});XGe.displayName=CA;var Z2n=_k("PopoverContent.RemoveScroll"),J2n=m.forwardRef((t,e)=>{const n=U2(CA,t.__scopePopover),r=m.useRef(null),s=du(e,r),a=m.useRef(!1);return m.useEffect(()=>{const o=r.current;if(o)return uGe(o)},[]),i.jsx(dfe,{as:Z2n,allowPinchZoom:!0,children:i.jsx(QGe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fi(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),a.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:fi(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:fi(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),evn=m.forwardRef((t,e)=>{const n=U2(CA,t.__scopePopover),r=m.useRef(!1),s=m.useRef(!1);return i.jsx(QGe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var c,u;(c=t.onInteractOutside)==null||c.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),QGe=m.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=t,x=U2(CA,n),g=uP(n);return Vqe(),i.jsx(sfe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(vz,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>x.onOpenChange(!1),children:i.jsx(lfe,{"data-state":JGe(x.open),role:"dialog",id:x.contentId,...g,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ZGe="PopoverClose",tvn=m.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=U2(ZGe,n);return i.jsx(Uc.button,{type:"button",...r,ref:e,onClick:fi(t.onClick,()=>s.onOpenChange(!1))})});tvn.displayName=ZGe;var nvn="PopoverArrow",rvn=m.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=uP(n);return i.jsx(cfe,{...s,...r,ref:e})});rvn.displayName=nvn;function JGe(t){return t?"open":"closed"}var svn=WGe,ivn=KGe,avn=YGe,ovn=XGe;const lvn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,cvn=[{label:"$0 - $100,000",min:0,max:1e5},{label:"$100,000 - $500,000",min:1e5,max:5e5},{label:"$500,000 - $1,000,000",min:5e5,max:1e6},{label:"$1,000,000 - $5,000,000",min:1e6,max:5e6},{label:">$5,000,000",min:5e6,max:1/0},{label:"$0 - -$100,000",min:-1e5,max:0},{label:"-$100,000 - -$500,000",min:-5e5,max:-1e5},{label:"-$500,000 - -$1,000,000",min:-1e6,max:-5e5},{label:"-$1,000,000 - -$5,000,000",min:-5e6,max:-1e6},{label:"< -$5,000,000",min:-1/0,max:-5e6}];function uvn(){const[t,e]=m.useState([]),[n,r]=m.useState("All"),[s,a]=m.useState("All"),[o,l]=m.useState(null),[c,u]=m.useState("All"),[d,f]=m.useState("All"),[x,g]=m.useState(!1),[y,v]=m.useState(!1),[C,N]=m.useState(null),[P,T]=m.useState(null),[M,F]=m.useState(""),{setSignModalOpen:$,copyTradeWatchList:L,getCopyTradeWatchList:z,getTrackedWatchList:X,setIsWhitelist:ne,setMushboomerETH:J,setMushboomerSOL:K}=m.useContext(Qr);m.useEffect(()=>{const W=()=>{const ee="https://dextradata.nftinit.io/api/hyper/top_whales/",oe=d==="All"?ee:`${ee}?user_tier=${d}`;ps.get(oe).then(de=>{var Ce;return e(((Ce=de.data)==null?void 0:Ce.positions_list)||[])})};W();const V=setInterval(W,3e4);return()=>clearInterval(V)},[d]),m.useEffect(()=>{const W=localStorage.getItem("hyperToken"),V=localStorage.getItem("hyperAddress");!W||!V||(async()=>{var ee,oe;try{const de=await ki(V.toLowerCase(),W);de!=null&&de.success&&(ne(de.whitelist),J(((ee=de.mushboomer_counts)==null?void 0:ee.eth)||0),K(((oe=de.mushboomer_counts)==null?void 0:oe.sol)||0))}catch{}})()},[]),m.useEffect(()=>{localStorage.getItem("hyperToken")&&(z(),X())},[]);const te=async({walletAddress:W,isFollow:V,isScalper:ee})=>{try{const oe=localStorage.getItem("hyperToken"),de=localStorage.getItem("hyperAddress");if(!oe){$(!0);return}const Ce=V?"https://dextrabothypev2.nftinit.io/api/test_app/following/info/":"https://dextrabothypev2.nftinit.io/api/hyper/following/get_setting/",me=V?{address:de?de.toLowerCase():localAddress,token:oe,follow_address:W.toLowerCase()}:{address:de?de.toLowerCase():localAddress,token:oe},xe=await(await fetch(Ce,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(me)})).json();if(!xe.success){tn.error(xe.error_message||"Something went wrong");return}z(),X(),T(Array.isArray(xe==null?void 0:xe.data)?[...xe.data].sort((be,je)=>new Date(je.created_at||0)-new Date(be.created_at||0)):xe==null?void 0:xe.data),F(W),N(ee),v(!0)}catch(oe){tn.error(oe.message||"Something went wrong")}},fe=m.useMemo(()=>[...new Set(t.map(W=>W.coin))],[t]),q=m.useMemo(()=>t.filter(W=>{if(n!=="All"&&W.coin!==n||s!=="All"&&W.direction!==s.toLowerCase()||d!=="All"&&![String(d),id[d].label].includes(String(W.user_tier)))return!1;if(o){const V=Number(W.unrealized_pnl),ee=Math.min(o.min,o.max),oe=Math.max(o.min,o.max);if(V<ee||V>oe)return!1}return!(c==="Profit"&&Number(W.funding_paid)<=0||c==="Loss"&&Number(W.funding_paid)>=0)}),[t,n,s,o,c,d]),se=W=>{if(W==null)return"-";const V=Number(W),ee=V<0?"-":"",oe=Math.abs(V);return oe>=1e9?`${ee}$${(oe/1e9).toFixed(2)}B`:oe>=1e6?`${ee}$${(oe/1e6).toFixed(2)}M`:oe>=1e3?`${ee}$${(oe/1e3).toFixed(2)}K`:`${ee}$${oe.toFixed(2)}`},ae=[{key:"rank",label:"#",width:"46px",render:(W,V,ee)=>i.jsx("span",{className:"text-[#9B9B9B]",children:ee+1})},{key:"wallet",label:"Wallet",width:"210px",render:(W,V)=>{const ee=rfe(V.user_tier);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[18px] leading-none",children:ee.emoji}),i.jsx("a",{href:`/wallet-details/${V.address}`,target:"_blank",onClick:oe=>oe.stopPropagation(),className:"text-white font-medium hover:text-white w-24",children:lvn(V.address)}),i.jsx("span",{className:`flex justify-center items-center px-1 h-6 rounded-[6px] text-[11px] font-medium ${ee.bg} ${ee.txt}`,children:ee.label})]})}},{key:"coin",label:"Coin",sortable:!0,width:"95px",render:(W,V)=>i.jsxs("a",{href:`/terminal/${V.coin}`,target:"_blank",rel:"noreferrer",className:"flex items-center text-white hover:text-gray-400 font-medium",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${V.coin}.svg`,onError:oa,className:"w-5 h-5 mr-2"}),V.coin]})},{key:"direction",label:"Direction",width:"150px ",sortable:!0,render:(W,V)=>{const ee=V.direction==="long",oe=ee?"LONG":"SHORT",de=ee?"#67FFBD":"#FF797C",Ce=ee?"bg-[#67ffbd]/20":"bg-[#ff797c]/20";return i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("div",{className:`inline-flex items-center gap-1 px-2 py-1 h-6 rounded-[6px] text-[11px] uppercase font-medium ${Ce}`,style:{color:de},children:[i.jsx(Os,{className:`w-3 h-3 ${ee?"rotate-180":""}`,style:{color:de}}),oe]}),i.jsxs("div",{className:`inline-flex items-center px-2 py-1 h-6 rounded-[6px] text-[11px] font-medium ${Ce}`,style:{color:de},children:[V.max_leverage,"X"]})]})}},{key:"notional",label:"Position",sortable:!0,width:"130px",sortValue:W=>Number(W.notional),render:(W,V)=>se(Number(V.notional))},{key:"szi",label:"Size",sortable:!0,sortValue:W=>Number(W.szi),render:W=>se(W)},{key:"entry_price",label:"Entry",sortable:!0,sortValue:W=>Number(W.entry_price),render:W=>se(W)},{key:"market_price",label:"Market",sortable:!0,sortValue:W=>Number(W.market_price),render:W=>se(W)},{key:"unrealized_pnl",label:"PnL",sortable:!0,sortValue:W=>Math.abs(Number(W.unrealized_pnl)),render:W=>{const V=Number(W)>=0;return i.jsxs("span",{className:`flex items-center ${V?"text-[#3DB380]":"text-[#FF797C]"}`,children:[se(Math.abs(W)),i.jsx("img",{src:V?pE:mE,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"liq_price",label:"Liq. Price",sortable:!0,sortValue:W=>Number(W.liq_price),render:W=>se(W)},{key:"funding_paid",label:"Fee",sortable:!0,sortValue:W=>Number(W.funding_paid),render:W=>{const V=Number(W)>=0;return i.jsxs("span",{className:`flex items-center ${V?"text-[#3DB380]":"text-[#FF797C]"}`,children:[se(Math.abs(W)),i.jsx("img",{src:V?pE:mE,className:"ml-[6px] w-[9px] h-[8px]"})]})}},{key:"action",label:"Action",width:"100px",render:(W,V)=>{const ee=L.some(oe=>oe.wallet_address===V.address);return i.jsx("div",{onClick:oe=>{oe.preventDefault(),oe.stopPropagation(),te({walletAddress:V.address,isFollow:ee})},className:"flex w-[81px] py-2 px-4 justify-center items-center gap-2 flex-shrink-0 rounded-[8px] bg-[#262626] text-[#929292] font-inter text-[12px] font-normal leading-[8px] tracking-[-0.12px] cursor-pointer hover:bg-[#585858] hover:text-white transition-all",children:"Copy Trade"})}}];return i.jsxs(i.Fragment,{children:[i.jsx($5,{open:y,setOpen:v,copyTradeData:P,copyTradeWallet:M,setCopyTradeWallet:F,isScalper:C,setCopyTradeData:T}),i.jsx(gi,{content:"Displays real-time executed trades from top whales.",children:i.jsxs("div",{className:"flex items-center gap-2 mb-4 mt-8 w-fit",children:[i.jsx("h2",{className:"text-white text-[16px] leading-[21px] font-medium tracking-[-0.32px] pl-[5px] font-inter",children:"Whale Positions"}),i.jsxs("div",{className:"flex items-center gap-1 bg-[#262626] p-1 rounded-full w-fit",children:[i.jsxs("div",{className:"relative w-2 h-2 flex justify-center items-center",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-[#4DFF43]/[0.32] animate-ping"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-[#4DFF43]"})]}),i.jsx("span",{className:"text-white text-[10px] leading-[10px] font-medium",children:"LIVE"})]}),i.jsx("img",{className:"-ml-[4px]",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsxs("div",{className:"w-full opacity-0 animate-fadeInUp",children:[i.jsxs("div",{className:"md:hidden mt-4",children:[i.jsxs("button",{onClick:()=>g(W=>!W),className:"w-[110px] h-[32px] rounded-[8px] flex items-center justify-center px-[8px] py-[12px] bg-[rgba(103,255,189,0.16)] text-[#67FFBD] font-manrope text-[14px] font-medium",children:[i.jsx("img",{src:tct,className:"w-[21px] h-[21px] mr-2"}),"Filters"]}),i.jsx("div",{className:`overflow-hidden transition-all duration-300 ${x?"max-h-[640px] mt-4":"max-h-0"}`,children:i.jsx(KAe,{mobile:!0,symbols:fe,symbol:n,setSymbol:r,side:s,setSide:a,pnl:o,setPnl:l,fund:c,setFund:u,tier:d,setTier:f})})]}),i.jsx("div",{className:"hidden md:block",children:i.jsx(KAe,{symbols:fe,symbol:n,setSymbol:r,side:s,setSide:a,pnl:o,setPnl:l,fund:c,setFund:u,tier:d,setTier:f})}),t.length===0?i.jsx("div",{className:"space-y-2",children:Array.from({length:34}).map((W,V)=>i.jsx("div",{className:"animate-pulse bg-[#202020] h-[24px] w-full rounded-md"},V))}):i.jsx(zu,{data:q,columns:ae,rowKey:W=>W.id,rowHeight:42,listHeight:window.innerHeight-180,tableClassName:"text-[14px]",theadClassName:"text-[13px] font-inter !text-[#9B9B9B] bg-transparent font-normal ",tbodyClassName:"text-[14px]",cellClassName:"text-[14px] font-medium",rowClassName:"bg-transparent border-b border-[#1E1E1E] last:border-0 py-5"})]})]})}function oZ({children:t,value:e}){return i.jsx(G2n,{asChild:!0,children:i.jsxs("button",{className:"h-8 px-3 rounded-lg flex items-center gap-2 text-[13px] bg-transparent text-[#fff] border border-[#2A2A2A]",children:[t,i.jsx(lE,{className:"w-4 h-4 shrink-0"})]})})}function KAe({mobile:t=!1,symbols:e,symbol:n,setSymbol:r,side:s,setSide:a,pnl:o,setPnl:l,fund:c,setFund:u,tier:d,setTier:f}){const[x,g]=m.useState(""),[y,v]=m.useState("");m.useEffect(()=>{if(x===""&&y===""){l(null);return}const N=x===""?null:Number(x),P=y===""?null:Number(y),T=N??P??0,M=P??N??1/0;l({min:T,max:M,label:`${T<0?"-":""}$${Math.abs(T)} - ${M===1/0?"∞":`${M<0?"-":""}$${Math.abs(M)}`}`})},[x,y]);const C=t?"flex flex-wrap gap-2 px-4 py-4 bg-[#1B1B1B] rounded-[16px]":"flex items-center gap-[8px] py-3 overflow-x-auto";return i.jsxs("div",{className:C,children:[!t&&i.jsxs("div",{className:"flex items-center gap-[8px] text-white font-medium pr-[8px]",children:[i.jsx("img",{src:ect,className:"w-[21px] h-[21px]"}),i.jsx("span",{className:"font-manrope text-[14px] font-medium",children:"Filters"})]}),i.jsxs(sZ,{children:[i.jsxs(oZ,{value:n!=="All",children:["Symbol"," ",i.jsxs("span",{className:"ml-1 px-1.5 py-0.5 flex items-center gap-1 text-white",children:[n!=="All"&&i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${n}.svg`,onError:oa,className:"w-4 h-4"}),n]})]}),i.jsx(iZ,{sideOffset:6,className:"z-50 min-w-[140px] max-h-[280px] overflow-y-auto rounded-md bg-[#242424] p-2",children:["All",...e].map(N=>i.jsxs(aZ,{onSelect:()=>r(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${n===N?"bg-[#2F2F2F]":""}`,children:[N!=="All"&&i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${N}.svg`,onError:oa,className:"w-4 h-4"}),N]},N))})]}),i.jsxs(sZ,{children:[i.jsxs(oZ,{value:s!=="All",children:["Side ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:s})]}),i.jsx(iZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Long","Short"].map(N=>i.jsx(aZ,{onSelect:()=>a(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${s===N?"bg-[#2F2F2F]":""}`,children:N},N))})]}),i.jsxs(sZ,{children:[i.jsxs(oZ,{value:c!=="All",children:["Fee ",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:c})]}),i.jsx(iZ,{sideOffset:6,className:"z-50 rounded-md bg-[#242424] p-2 text-[#A8A8A8]",children:["All","Profit","Loss"].map(N=>i.jsx(aZ,{onSelect:()=>u(N),className:`h-8 px-2 flex items-center gap-2 rounded cursor-pointer text-[#A8A8A8] font-inter text-[13px] font-medium leading-[8px] tracking-[-0.26px] hover:bg-[#353535] hover:text-white ${c===N?"bg-[#2F2F2F]":""}`,children:N},N))})]}),i.jsxs(svn,{children:[i.jsx(ivn,{asChild:!0,children:i.jsxs("button",{className:"h-8 px-3 rounded-lg flex items-center gap-2 text-[13px] bg-transparent text-[#fff] border border-[#2A2A2A]",children:["Unrealized PnL",i.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-white",children:o?o.label:"All"}),i.jsx(lE,{className:"w-4 h-4"})]})}),i.jsx(avn,{children:i.jsxs(ovn,{sideOffset:6,align:"start",className:"z-50 w-64 rounded-lg bg-[#242424] p-4 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("span",{className:"text-white font-manrope text-[13px] font-medium leading-[8px] pl-[15px]",children:"Unrealized PnL"}),i.jsx("button",{onClick:()=>{g(""),v("")},className:"rounded-[6px] border border-[#353535] px-2 py-[6px] text-[#CECECE] font-manrope text-[11px] font-medium leading-[8px] bg-transparent",children:"Clear"})]}),i.jsx("div",{className:"space-y-3",children:["Min","Max"].map((N,P)=>{const T=P===0?x:y,M=P===0?g:v,F=T!=="";return i.jsxs("div",{children:[i.jsx("label",{className:"block mb-1 text-[#A8A8A8] text-[13px] leading-[8px] tracking-[-0.26px] font-normal pl-[15px] pb-[9px]",children:N}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#67FFBD] text-sm",children:"$"}),i.jsx("input",{type:"number",value:T,onChange:$=>M($.target.value),placeholder:"..",className:`w-full h-[32px] pl-7 pr-3 rounded-md outline-none text-[14px] leading-[8px] tracking-[-0.28px] font-medium ${F?"bg-[rgba(103,255,189,0.16)] text-[#67FFBD]":"bg-[#353535] text-[#A8A8A8]"}`})]})]},N)})}),i.jsx("div",{className:"h-px bg-[#363636]"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-white font-inter text-[13px] font-medium leading-[8px] pl-[15px] pb-[13px] pt-1",children:"Presets"}),cvn.map(N=>i.jsx("button",{onClick:()=>{N.label==="All"?(g(""),v("")):(g(N.min.toString()),v(N.max===1/0?"":N.max.toString()))},className:`w-full text-left px-3 py-2 rounded-md text-[13px] leading-[8px] tracking-[-0.26px] font-medium bg-transparent ${(o==null?void 0:o.label)===N.label?"bg-[#2F2F2F] text-white":"text-[#A8A8A8]"} hover:bg-[#2A2A2A] hover:rounded-[6px] hover:p-[9px] hover:text-white hover:border-none`,children:N.label},N.label))]})]})})]}),i.jsx("div",{className:"h-5 w-px bg-[#262626] mx-3"}),i.jsx("div",{className:"inline-flex items-center h-8 px-1.5 py-[18px] rounded-[8px] border border-[#262626] flex-shrink-0 gap-[12px]",children:i.jsxs("div",{className:"flex items-center gap-[12px]",children:[i.jsx("div",{onClick:()=>f("All"),className:`flex items-center justify-center h-7 w-7 px-4 rounded-[8px] text-white text-[14px] font-inter leading-[16px] cursor-pointer transition-colors ${d==="All"?"bg-[#262626]":"hover:bg-[#262626]"}`,children:"All"}),Ek.map(({id:N,emoji:P,description:T})=>{const M=d===N;return i.jsx("div",{onClick:()=>f(M?"All":N),className:`h-7 w-7 flex items-center justify-center rounded-[8px] text-[18px] cursor-pointer transition-colors ${M?"bg-[#262626]":"hover:bg-[#262626]"}`,children:i.jsx(gi,{content:T,children:P})},N)})]})})]})}function dvn({data:t}){var d,f;if(!t)return i.jsxs("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 flex justify-between items-center h-[128px] animate-pulse",children:[i.jsxs("div",{className:"space-y-3 max-w-[220px] flex-1",children:[i.jsx("div",{className:"h-[16px] w-[80px] rounded bg-[#262626]"}),i.jsx("div",{className:"h-[16px] w-[60px] rounded bg-[#262626]"}),i.jsx("div",{className:"h-[32px] w-full rounded bg-[#262626]"})]}),i.jsx("div",{className:"flex flex-col items-center gap-3",children:i.jsx("div",{className:"h-[96px] w-[96px] rounded-full bg-[#262626]"})})]});const e=((d=t.long)==null?void 0:d.position)??0,n=((f=t.short)==null?void 0:f.position)??0,r=e+n,s=e>=n,a=r?Math.round(Math.max(e,n)/r*100):0,o=s?"#67FFBD":"#FF797C",l=s?"#FF797C":"#67FFBD",c=s?"#1B4734":"#5E2425",u={chart:{type:"radialBar",sparkline:{enabled:!0}},plotOptions:{radialBar:{startAngle:-90,endAngle:90,hollow:{size:"60%"},track:{background:l,strokeWidth:"100%",margin:0},dataLabels:{show:!1}}},stroke:{lineCap:"round"},fill:{colors:[o]}};return i.jsxs("div",{className:"rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-4 flex justify-between items-center h-[128px] opacity-0 animate-fadeInUp",children:[i.jsxs("div",{className:"space-y-2 max-w-[220px]",children:[i.jsx("div",{className:"text-[#929292] text-[14px] leading-[16px] tracking-[-0.14px]",children:"Direction"}),i.jsx("div",{className:"text-white text-[14px] font-semibold leading-[16px] tracking-[-0.14px]",children:s?"Long":"Short"}),i.jsxs("p",{className:"text-[#9C9C9C] text-[14px] leading-[16px] tracking-[-0.12px]",children:["The least loss and funding load in the last 24 hours is on the"," ",s?"Long":"Short"," side."]})]}),i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsxs("div",{className:"relative w-[96px] h-[48px]",children:[i.jsx($D,{options:u,series:[a],height:96,width:96,type:"radialBar"}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center translate-y-[10px]",children:i.jsxs("span",{className:"text-white font-semibold font-manrope text-[18px] leading-[21px] mt-5",children:["%",a]})})]}),i.jsxs("div",{className:`mt-3 rounded-[6px] px-1.5 py-1 flex items-center gap-1 ${s?"bg-[#67FFBD]":"bg-[#FF797C]"}`,children:[s?i.jsx(Pie,{className:"w-[10px] h-[10px]",style:{color:c}}):i.jsx(Ul,{className:"w-[10px] h-[10px]",style:{color:c}}),i.jsx("span",{className:"text-[11px] font-semibold leading-[8px] tracking-[0.66px] font-[Manrope]",style:{color:c},children:s?"LONG":"SHORT"})]})]})]})}var lZ,Ez="HoverCard",[eKe,e4n]=G5(Ez,[Dj]),_z=Dj(),[fvn,kz]=eKe(Ez),tKe=t=>{const{__scopeHoverCard:e,children:n,open:r,defaultOpen:s,onOpenChange:a,openDelay:o=700,closeDelay:l=300}=t,c=_z(e),u=m.useRef(0),d=m.useRef(0),f=m.useRef(!1),x=m.useRef(!1),[g,y]=yz({prop:r,defaultProp:s??!1,onChange:a,caller:Ez}),v=m.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>y(!0),o)},[o,y]),C=m.useCallback(()=>{clearTimeout(u.current),!f.current&&!x.current&&(d.current=window.setTimeout(()=>y(!1),l))},[l,y]),N=m.useCallback(()=>y(!1),[y]);return m.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),i.jsx(fvn,{scope:e,open:g,onOpenChange:y,onOpen:v,onClose:C,onDismiss:N,hasSelectionRef:f,isPointerDownOnContentRef:x,children:i.jsx(ofe,{...c,children:n})})};tKe.displayName=Ez;var nKe="HoverCardTrigger",rKe=m.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=kz(nKe,n),a=_z(n);return i.jsx(wz,{asChild:!0,...a,children:i.jsx(Uc.a,{"data-state":s.open?"open":"closed",...r,ref:e,onPointerEnter:fi(t.onPointerEnter,sB(s.onOpen)),onPointerLeave:fi(t.onPointerLeave,sB(s.onClose)),onFocus:fi(t.onFocus,s.onOpen),onBlur:fi(t.onBlur,s.onClose),onTouchStart:fi(t.onTouchStart,o=>o.preventDefault())})})});rKe.displayName=nKe;var yfe="HoverCardPortal",[hvn,pvn]=eKe(yfe,{forceMount:void 0}),sKe=t=>{const{__scopeHoverCard:e,forceMount:n,children:r,container:s}=t,a=kz(yfe,e);return i.jsx(hvn,{scope:e,forceMount:n,children:i.jsx($2,{present:n||a.open,children:i.jsx(ufe,{asChild:!0,container:s,children:r})})})};sKe.displayName=yfe;var rB="HoverCardContent",iKe=m.forwardRef((t,e)=>{const n=pvn(rB,t.__scopeHoverCard),{forceMount:r=n.forceMount,...s}=t,a=kz(rB,t.__scopeHoverCard);return i.jsx($2,{present:r||a.open,children:i.jsx(mvn,{"data-state":a.open?"open":"closed",...s,onPointerEnter:fi(t.onPointerEnter,sB(a.onOpen)),onPointerLeave:fi(t.onPointerLeave,sB(a.onClose)),ref:e})})});iKe.displayName=rB;var mvn=m.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,...l}=t,c=kz(rB,n),u=_z(n),d=m.useRef(null),f=du(e,d),[x,g]=m.useState(!1);return m.useEffect(()=>{if(x){const y=document.body;return lZ=y.style.userSelect||y.style.webkitUserSelect,y.style.userSelect="none",y.style.webkitUserSelect="none",()=>{y.style.userSelect=lZ,y.style.webkitUserSelect=lZ}}},[x]),m.useEffect(()=>{if(d.current){const y=()=>{g(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var C;((C=document.getSelection())==null?void 0:C.toString())!==""&&(c.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",y),()=>{document.removeEventListener("pointerup",y),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),m.useEffect(()=>{d.current&&bvn(d.current).forEach(v=>v.setAttribute("tabindex","-1"))}),i.jsx(vz,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:fi(a,y=>{y.preventDefault()}),onDismiss:c.onDismiss,children:i.jsx(lfe,{...u,...l,onPointerDown:fi(l.onPointerDown,y=>{y.currentTarget.contains(y.target)&&g(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:f,style:{...l.style,userSelect:x?"text":void 0,WebkitUserSelect:x?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),xvn="HoverCardArrow",gvn=m.forwardRef((t,e)=>{const{__scopeHoverCard:n,...r}=t,s=_z(n);return i.jsx(cfe,{...s,...r,ref:e})});gvn.displayName=xvn;function sB(t){return e=>e.pointerType==="touch"?void 0:t()}function bvn(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var yvn=tKe,vvn=rKe,wvn=sKe,Cvn=iKe;const Svn="#67FFBD",Nvn="#FF797C",cZ=t=>{const e=Math.abs(Number(t));return e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`};function Avn({data:t=[],title:e=""}){const n=m.useMemo(()=>t.map(r=>({...r,total:r.total??r.long+r.short})).sort((r,s)=>s.total-r.total).slice(0,10),[t]);return i.jsxs("div",{className:"flex w-96 min-w-[240px] flex-col gap-[12px] rounded-[12px] border-[0.8px] border-[rgba(133,133,133,0.32)] bg-[rgba(255,255,255,0.08)] p-[12px] shadow-[0_4px_4px_0_#050505] backdrop-blur-[43px]",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"text-[14px] font-medium leading-[14px] tracking-[-0.14px] text-white",children:e})}),n.map(r=>{const s=(r.long/r.total*100).toFixed(1),a=(100-s).toFixed(1),o=i.jsxs("div",{className:"flex flex-col gap-[2px] rounded-[8px] border-[0.8px] border-[rgba(133,133,133,0.32)] bg-[rgba(255,255,255,0.08)] shadow-[0_2px_2px_0_rgba(5,5,5,0.48)] backdrop-blur-[43px] p-2 space-y-[2px]",children:[i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("span",{className:"inline-block h-[6px] w-[6px] rounded-full",style:{backgroundColor:Svn}}),i.jsx("span",{className:"text-[10px] font-medium leading-[10px] text-white",children:"Long"}),i.jsx("span",{className:"text-[10px] font-medium leading-[10px] text-white",children:cZ(r.long)}),i.jsxs("span",{className:"text-[10px] font-medium leading-[10px] text-[#909090]",children:["(",s,"%)"]})]}),i.jsxs("div",{className:"flex items-center gap-[6px]",children:[i.jsx("span",{className:"inline-block h-[6px] w-[6px] rounded-full",style:{backgroundColor:Nvn}}),i.jsx("span",{className:"text-[10px] font-medium leading-[10px] text-white",children:"Short"}),i.jsx("span",{className:"text-[10px] font-medium leading-[10px] text-white",children:cZ(r.short)}),i.jsxs("span",{className:"text-[10px] font-medium leading-[10px] text-[#909090]",children:["(",a,"%)"]})]})]});return i.jsx(gi,{content:o,children:i.jsxs("div",{className:"flex items-center gap-[8px] w-full",children:[i.jsxs("div",{className:"flex w-[100px] items-center gap-[4px] mt-[2px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${r.coin}.svg`,alt:r.coin,className:"h-[18px] w-[18px] rounded-full",onError:l=>{l.currentTarget.onerror=null,l.currentTarget.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Ccircle cx='9' cy='9' r='9' fill='%23575757'/%3E%3C/svg%3E"}}),i.jsx("span",{className:"text-[12px] font-normal leading-[14px] tracking-[-0.12px] text-white",children:r.coin})]}),i.jsxs("div",{className:"flex h-[16px] w-full gap-[2px] overflow-hidden ml-3",children:[i.jsx("div",{className:"flex rounded-[4px] items-center justify-center bg-[rgba(103,255,189,0.16)] text-[10px] font-semibold leading-[10px] tracking-[-0.1px] text-[#67FFBD]",style:{flexGrow:r.long,flexBasis:0},children:s>=15?`${s}%`:""}),i.jsx("div",{className:"flex rounded-[4px] items-center justify-center bg-[rgba(255,121,124,0.16)] text-[10px] font-semibold leading-[10px] tracking-[-0.1px] text-[#FF797C]",style:{flexGrow:r.short,flexBasis:0},children:a>=15?`${a}%`:""})]}),i.jsx("span",{className:"w-[48px] text-right text-[12px] font-medium leading-[14px] tracking-[-0.12px] text-white mt-[2px]",children:cZ(r.total)})]})},r.coin)})]})}const jvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/open_interest/?period=1d",Evn="https://dextradata.nftinit.io/api/hyper/wallet/whale/tx_summary/?period=1d",_vn={BTC:"Bitcoin",ETH:"Ethereum",HYPE:"Hyperliquid",SOL:"Solana",XRP:"XRP",PUMP:"Pump",FARTCOIN:"Fartcoin"},kvn=t=>{if(t==null)return"-";const e=Number(t),n=e<0?"-":"",r=Math.abs(e);return r>=1e9?`${n}$${(r/1e9).toFixed(2)}B`:r>=1e6?`${n}$${(r/1e6).toFixed(2)}M`:r>=1e3?`${n}$${(r/1e3).toFixed(0)}K`:`${n}$${r.toFixed(0)}`};function Tvn(){const[t,e]=m.useState(null),[n,r]=m.useState([]),[s,a]=m.useState([]);return m.useEffect(()=>{const o=async()=>{var c,u,d,f,x,g;try{const[y,v]=await Promise.all([ps.get(jvn),ps.get(Evn)]),C=((u=(c=y.data)==null?void 0:c.position_summary)==null?void 0:u.slice(0,10).map(M=>({coin:M.coin,long:Number(M.long),short:Number(M.short),total:Number(M.total)})))||[],N=((f=(d=v.data)==null?void 0:d.whale_summary)==null?void 0:f.slice(0,10).map(M=>({coin:M.coin,long:Number(M.long_tx_count),short:Number(M.short_tx_count),total:Number(M.total_tx_count)})))||[];r(C),a(N);const P=C[0]||{},T=((g=(x=v.data)==null?void 0:x.whale_summary)==null?void 0:g[0])||{};e([{type:"position",title:"Highest OI",coin:P.coin||"",name:_vn[P.coin]||P.coin,value:kvn(P.total)},{type:"trader",title:"Most Traded",coin:T.coin||"",name:"Top Trader",value:`${T.whale_count??"-"} Whales | TX: ${T.total_tx_count??"-"}`}])}catch{e([])}};o();const l=setInterval(o,3e4);return()=>clearInterval(l)},[]),t?i.jsx("div",{className:"border border-[#1E1E1E] bg-[#101010] rounded-[16px] p-2 flex gap-2 h-[128px]",children:t.map(o=>i.jsxs(yvn,{openDelay:0,closeDelay:0,children:[i.jsx(vvn,{asChild:!0,children:i.jsxs("div",{className:"flex-1 bg-[#1B1B1B] rounded-[12px] p-[10px] flex flex-col gap-1 hover:bg-[#2A2A2A] transition cursor-pointer",children:[i.jsxs("div",{className:"flex gap-1 justify-between items-center",children:[i.jsx("span",{className:"text-[#929292] text-[14px] leading-[16px] tracking-[-0.14px]",children:o.title}),i.jsxs("div",{className:"relative w-3 h-3 flex justify-center items-center mt-[4px]",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-[#4DFF43]/[0.32] animate-ping"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-[#4DFF43]"})]})]}),i.jsxs("div",{children:[i.jsx("img",{src:o.coin!=="wallet"?`https://app.hyperliquid.xyz/coins/${o.coin}.svg`:"https://app.hyperliquid.xyz/coins/BTC.svg",alt:o.coin,className:"w-[24px] h-[24px] mt-[5px]"}),i.jsxs("div",{className:"flex items-center gap-1 mt-[5px]",children:[i.jsx("div",{className:"text-white text-[14px] font-semibold leading-[16px] tracking-[-0.14px]",children:o.coin}),i.jsx("span",{className:"text-[#B7B7B7] text-[12px] leading-[11px]",children:o.name})]})]}),i.jsx("div",{className:"text-white font-inter text-[13px] font-medium leading-[14px] tracking-[-0.14px] mt-[6px] break-words whitespace-normal",children:o.value})]})}),i.jsx(wvn,{children:i.jsx(Cvn,{side:"right",align:"start",sideOffset:0,collisionPadding:8,children:i.jsx(Avn,{title:o.type==="position"?"Top 10 Open OI":"Top 5 Most Trades",data:o.type==="position"?n:s})})})]},o.title))}):i.jsx("div",{className:"border border-[#1E1E1E] bg-[#101010] rounded-[16px] p-2 flex gap-2 h-[128px]",children:Array.from({length:2}).map((o,l)=>i.jsxs("div",{className:"flex-1 bg-[#1B1B1B] rounded-[12px] p-[10px] flex flex-col gap-3 animate-pulse",children:[i.jsx("div",{className:"h-[16px] w-24 rounded bg-[#262626]"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-[#262626]"}),i.jsx("div",{className:"h-[14px] w-24 rounded bg-[#262626]"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-[14px] w-24 rounded bg-[#262626]"}),i.jsx("div",{className:"h-[14px] w-14 rounded bg-[#262626]"})]})]},l))})}const Pvn="https://dextradata.nftinit.io/api/hyper/wallet/whale/top_user_pnl/?period=1d",Ivn="https://dextradata.nftinit.io/api/hyper/wallet/whale/high_risk_traders/?period=1d",Fvn=t=>`${t.slice(0,5)}...${t.slice(-4)}`,Ovn=t=>{const e=Math.abs(Number(t));return e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(2)}K`:`$${e.toFixed(2)}`};function Mvn(){const[t,e]=m.useState(null);return m.useEffect(()=>{const n=async()=>{var s,a,o,l;try{const[c,u]=await Promise.all([ps.get(Pvn),ps.get(Ivn)]),d=(a=(s=c.data)==null?void 0:s.top_users)==null?void 0:a[0],f=(l=(o=u.data)==null?void 0:o.high_risk_traders)==null?void 0:l[0],x=(g,y,v="growth_rate")=>({title:y,address:Fvn(g.user_token),wallet:g.user_token,amount:`${Number(g.pnl)>=0?"+":"-"}${Ovn(g.pnl)}`,percent:`${Number(g[v]||0).toFixed(1)}%`});e([x(d,"Today's Trader","growth_rate"),x(f,"Low Risk Trader","total_win_rate")])}catch(c){console.error("Error loading Highlighted Whales",c),e([])}};n();const r=setInterval(n,3e4);return()=>clearInterval(r)},[]),t?i.jsx("div",{className:"flex gap-2 rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-2 ",children:t.map(({title:n,address:r,amount:s,percent:a,wallet:o},l)=>i.jsx("div",{className:"flex-1",children:i.jsx("a",{href:`/wallet-details/${o}`,target:"_blank",rel:"noopener noreferrer",className:"flex-1 cursor-pointer",children:i.jsxs("div",{className:"flex flex-col gap-4 rounded-[12px] bg-[#1B1B1B] p-[10px] hover:bg-[#2A2A2A] transition",children:[i.jsx("h3",{className:"text-[#929292] font-inter text-[14px] leading-[16px] tracking-[-0.14px]",children:n}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Dqe,{size:24,name:r}),i.jsx("span",{className:"text-white font-inter font-medium text-[14px] leading-[13px] tracking-[-0.14px]",children:r})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-white font-inter font-medium text-[14px] leading-[13px] tracking-[-0.14px]",children:s}),i.jsx(gi,{content:n==="Today's Trader"?"Growth Rate":"Win Rate",children:i.jsx("div",{className:"flex h-[18px] w-[48px] items-center justify-center gap-[2px] rounded-[4px] bg-[#67FFBD]/20 pl-[4px] pr-[6px] py-[4px]",children:i.jsx("span",{className:"font-manrope text-[11px] font-semibold leading-[8px] text-[#67FFBD]",children:a})})})]})]})})},l))}):i.jsx("div",{className:"flex gap-4 rounded-[16px] border border-[#1E1E1E] bg-[#101010] p-2",children:Array.from({length:2}).map((n,r)=>i.jsx("div",{className:"flex-1 animate-pulse",children:i.jsxs("div",{className:"flex flex-col gap-4 rounded-[12px] bg-[#1B1B1B] p-[10px]",children:[i.jsx("div",{className:"h-[16px] w-24 rounded bg-[#262626]"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-6 w-6 rounded-full bg-[#262626]"}),i.jsx("div",{className:"h-[14px] w-32 rounded bg-[#262626]"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"h-[14px] w-20 rounded bg-[#262626]"}),i.jsx("div",{className:"h-[18px] w-12 rounded bg-[#262626]"})]})]})},r))})}function uZ(t){if(!t)return"-";const e=Math.floor((Date.now()-t.getTime())/1e3);return e<60?`Last updated ${e} sec ago`:`Last updated ${Math.floor(e/60)} min ago`}function Rvn({data:t,lastUpdated:e}){const[n,r]=m.useState(0);return m.useEffect(()=>{const s=setInterval(()=>{r(a=>a+1)},1e3);return()=>clearInterval(s)},[]),i.jsxs("div",{className:"w-full flex flex-col xl:flex-row gap-4 mt-10",children:[i.jsxs("div",{className:"flex-1 min-w-[300px] bg-transparent space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(gi,{content:`Shows overall market direction from whale positions in the last 24 hours.
Covers all coins on Hyperliquid.
Note: Only includes whales with PERP equity > $1M.`,children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-white font-inter text-[16px] not-italic font-medium leading-[21px] tracking-[-0.32px]",children:"Market Insights"}),i.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-[6px] py-[3px] bg-[#202020] text-[10px] leading-[10px] font-medium rounded-full text-white",children:"LAST 24H"}),i.jsx("img",{className:"-ml-1",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("span",{className:"text-[#8B8B8B] font-inter text-[12px] not-italic font-normal leading-[14px] tracking-[0.12px]",children:uZ(e)})]}),i.jsx(dvn,{data:t})]}),i.jsxs("div",{className:"flex-1 min-w-[300px] bg-transparent space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(gi,{content:"Highlights the most active assets by whale positions and trading volume.",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-white font-inter text-[16px] not-italic font-medium leading-[21px] tracking-[-0.32px]",children:"Asset Insights"}),i.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-[6px] py-[3px] bg-[#202020] text-[10px] leading-[10px] font-medium rounded-full text-white",children:"LAST 24H"}),i.jsx("img",{className:"-ml-1",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("span",{className:"text-[#8B8B8B] font-inter text-[12px] not-italic font-normal leading-[14px] tracking-[0.12px]",children:uZ(e)})]}),i.jsx(Tvn,{})]}),i.jsxs("div",{className:"flex-1 min-w-[300px] bg-transparent space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(gi,{content:"Spotlights standout whale traders based on daily performance and risk profile.",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-white font-inter text-[16px] not-italic font-medium leading-[21px] tracking-[-0.32px]",children:"Highlighted Whales"}),i.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-[6px] py-[3px] bg-[#202020] text-[10px] leading-[10px] font-medium rounded-full text-white",children:"LAST 24H"}),i.jsx("img",{className:"-ml-1",src:R0,alt:"Dextrabot - Whale Trades"})]})}),i.jsx("span",{className:"text-[#8B8B8B] font-inter text-[12px] not-italic font-normal leading-[14px] tracking-[0.12px]",children:uZ(e)})]}),i.jsx(Mvn,{})]})]})}function Lvn(){const[t,e]=m.useState(null),[n,r]=m.useState(null);return m.useEffect(()=>{const s=document.querySelector("main");return s&&(s.style.background="#050505"),()=>{s&&(s.style.background="")}},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"High Volume Trades on Hyperliquid"}),i.jsx("meta",{name:"description",content:"Track Hyperliquid high volume trades and whale activity in real-time."}),i.jsx("meta",{name:"og:title",content:"Hyperliquid High Volume Trades Tracker | DextraBot"}),i.jsx("meta",{name:"og:description",content:"Track Hyperliquid high volume trades and whale activity in real-time."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/hyperliquid-whale-trades"})]})}),i.jsxs("div",{className:"max-w-[1440px] w-full mx-auto px-4 font-manrope relative mt-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h1",{className:"flex items-center gap-[6px] py-4 text-[18px] leading-[21px] tracking-[-0.36px] font-normal",children:[i.jsx("span",{className:"text-[#929292] font-normal",children:"Dextrabot"}),i.jsx("span",{className:"text-[#929292] font-normal",children:"/"}),i.jsx("img",{className:"w-6 h-6",src:mae,alt:"Dextrabot - Hyperliquid Whale Trades"}),i.jsx("span",{className:"hidden sm:block text-white font-bold text-[16px]",children:"Hyperliquid Whale Trades"}),i.jsx("span",{className:"block sm:hidden text-white font-bold text-[16px]",children:"Whale Trades"})]}),i.jsx(gi,{content:"Join our Telegram for Hyperliquid whale alerts.",children:i.jsxs("a",{href:"https://t.me/+bYnGEvP0fB41M2I0",target:"_blank",rel:"noopener noreferrer",className:"rounded-[10px] border border-[#242424] inline-flex h-8 px-2 py-3 justify-center items-center gap-[10px] shrink-0 text-white font-manrope text-[13px] font-semibold leading-[8px] hover:text-white",children:[i.jsx("img",{src:flt,alt:"Dextrabot Whale Trades - Join Telegram"}),"Join Telegram"]})})]}),i.jsxs("div",{className:"flex flex-col space-y-4 sm:flex-row sm:space-y-0 sm:space-x-4",children:[i.jsx("div",{className:"w-full sm:w-1/3",children:i.jsx(L1n,{onData:s=>{e(s),r(new Date)}})}),i.jsx("div",{className:"w-full sm:w-2/3",children:i.jsx(obn,{})})]}),i.jsx("div",{className:"mt-4",children:i.jsx(Rvn,{data:t,lastUpdated:n})}),i.jsx("div",{className:"mt-4",children:i.jsx(uvn,{})})]})]})}const Dvn=()=>{const{setSignModalOpen:t}=m.useContext(Qr),{address:e}=ns(),[n,r]=m.useState(Array(6).fill("")),[s,a]=m.useState(""),[o,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(!1),x=async()=>{try{const N=window.localStorage.getItem("hyperToken"),P=window.localStorage.getItem("hyperAddress");if(!N||n.join("")===""||n.join("").length<6){N?n.join("")===""?a("Please enter the verification code."):n.join("").length<6&&a("The verification code must be 6 characters long."):t(!0);return}l(!0),a("");const T="https://dextrabothypev2.nftinit.io/api/telegram/sign_with_telegram/",M={address:e?e.toLowerCase():P,token:N,temp_password:n.join("")},$=await(await fetch(T,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(M)})).json();$!=null&&$.success?($!=null&&$.telegram_chat_id&&u(!0),r(Array(6).fill("")),tn.success(i.jsx(i.Fragment,{children:i.jsx("span",{style:{color:"#67ffbd",paddingLeft:"5px"},children:"Verified successfully."})}),{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.32)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}}),l(!1)):(console.log($.error_message),a("Invalid code. Please request a new code from Telegram and try again."),f(!0),l(!1))}catch(N){console.error("Error in telegram verify:",N),tn.error(N.message||"Something went wrong!"),a(N.message||"Something went wrong!"),f(!0),l(!1)}},g=(N,P)=>{f(!1);const T=[...n];T[P]=N.target.value.toUpperCase().slice(0,1),r(T),N.target.value.length===1&&P<5&&document.getElementById(`code-input-${P+1}`).focus()},y=N=>{f(!1);const P=N.clipboardData.getData("Text").slice(0,6),T=[...n];for(let F=0;F<P.length;F++)T[F]=P[F].toUpperCase();r(T);const M=document.getElementById(`code-input-${(P==null?void 0:P.length)-1}`);M==null||M.focus(),M==null||M.select()},v=(N,P)=>{var T,M;if(f(!1),N.key==="Backspace"){if(n[P]){const F=[...n];F[P]="",r(F)}else if(P>0){const F=document.getElementById(`code-input-${P-1}`),$=[...n];$[P-1]="",r($),F==null||F.focus()}}else N.key==="ArrowLeft"&&P>0?(T=document.getElementById(`code-input-${P-1}`))==null||T.focus():N.key==="ArrowRight"&&P<5&&((M=document.getElementById(`code-input-${P+1}`))==null||M.focus())},C=()=>{r(Array(6).fill("")),f(!1)};return i.jsxs("div",{className:"flex flex-col items-center justify-center px-2 pb-2 gap-6 w-max h-max bg-[#212121]/90 rounded-2xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#2a2a2a] relative pt-10",onPaste:y,children:[s&&i.jsxs("div",{style:{backdropFilter:"blur(16px)"},className:"w-full max-w-[345px] px-3 py-2 bg-[#ff7171]/20 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-start items-center gap-2.5 absolute top-2 ",children:[i.jsx("img",{src:rc,alt:"",className:"mb-[2.5px]"}),i.jsx("div",{className:"flex justify-start text-[#ff7171] text-[13px] font-normal font-['Inter'] leading-4 tracking-[-0.26px]",children:s})]}),c?i.jsxs("div",{className:"flex flex-col items-center text-white text-base font-medium font-['Inter'] text-center gap-2",children:[i.jsx("img",{src:NEe,alt:""}),i.jsx("div",{className:"text-center text-white text-sm font-medium font-['Inter'] leading-4 tracking-[-0.28px]",children:"Successfully"}),i.jsx("div",{className:" w-[186px] text-center text-white text-[13px] font-normal font-['Inter'] leading-4",children:"Your Telegram account is now synced with your wallet."}),i.jsx("div",{className:"flex flex-col items-center gap-6 mt-[33px]",children:i.jsxs("div",{onClick:()=>window.open("https://t.me/Dextrabot_CopyTrade_bot","_blank"),className:"w-[345px] h-10 px-6 py-3 bg-white hover:bg-[#E5E5E5] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] inline-flex justify-center items-center gap-2.5 cursor-pointer",children:[i.jsx("img",{src:AEe,alt:""}),i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-none",children:"Open Telegram App"})]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("img",{src:act,alt:"",className:"w-auto h-[40px]"}),i.jsx("h1",{className:"text-center text-white text-sm font-medium font-['Inter'] leading-4 tracking-[-0.28px]",children:"Verify Your Telegram Account"}),i.jsx("p",{className:"mb-2 -mt-4 text-center text-[#929292] text-[13px] font-normal font-['Inter'] leading-4 max-w-[240px]",children:"Enter the 6-character verification code sent to your Telegram account."}),i.jsx("div",{className:"flex gap-2",children:n.map((N,P)=>i.jsx("input",{id:`code-input-${P}`,type:"text",maxLength:"1",value:N,autoComplete:"off",onChange:T=>g(T,P),onKeyDown:T=>v(T,P),className:`${d?"border-[#ff787b]":"border-white/20"} w-10 h-12 text-center text-white text-[32px] font-medium font-['Inter'] leading-10 bg-transparent shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border-[0.60px] rounded-[10px] focus:bg-[#353535] outline-none`},P))}),i.jsxs("div",{className:"text-center",children:[i.jsxs("span",{class:"text-[#929292] text-[11px] font-normal font-['Inter'] leading-none",children:["Didn’t get a code?"," "]}),i.jsx("span",{onClick:()=>window.open("https://t.me/Dextrabot_CopyTrade_bot","_blank"),class:"text-[#929292] hover:text-white text-[11px] font-medium font-['Inter'] leading-4 cursor-pointer",children:"Open Telegram App"})]}),i.jsxs("div",{className:"flex items-center justify-center gap-2 relative",children:[i.jsx("div",{onClick:C,className:"w-[140px] h-10 px-6 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] outline outline-1 outline-offset-[-1px] outline-[#424242] flex justify-center items-center gap-2.5 cursor-pointer group",children:i.jsx("div",{className:"text-[#b7b7b7] group-hover:text-white text-sm font-semibold font-['Inter'] leading-4 tracking-[-0.28px]",children:"Clear"})}),i.jsx("div",{onClick:N=>{N.preventDefault(),o||x()},className:"w-[196px] h-10 px-6 py-3 bg-white hover:bg-[#E5E5E5] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] flex justify-center items-center gap-2.5 cursor-pointer",children:o?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[72px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-[8px]",children:"Authorize Wallet"})})]})]})]})},Bvn=()=>{const{isConnected:t,address:e}=ns(),{hyperToken:n,hyperAddress:r,setSignModalOpen:s,setTelegramChatId:a,setSubscriberRole:o,setSubsExpireDay:l,setMushboomerETH:c,setMushboomerSOL:u,setIsReferralCode:d,setIsReferralCodeName:f,setIsWhitelist:x,setHyperToken:g,setHyperAddress:y}=m.useContext(Qr),[v,C]=m.useState(!!window.localStorage.getItem("hyperToken"));return m.useEffect(()=>{const N=window.localStorage.getItem("hyperToken");C(!!N)},[e,t,n,r]),m.useEffect(()=>{(async()=>{var M,F;const P=window.localStorage.getItem("hyperToken"),T=window.localStorage.getItem("hyperAddress");if(!(!P||!T))try{const $=await ki(T.toLowerCase(),P);$!=null&&$.success?(a($==null?void 0:$.telegram_chat_id),o($==null?void 0:$.subscriber_role),l($==null?void 0:$.subs_expire_day),c((M=$==null?void 0:$.mushboomer_counts)==null?void 0:M.eth),u((F=$==null?void 0:$.mushboomer_counts)==null?void 0:F.sol),d($==null?void 0:$.referral_code),f($==null?void 0:$.refcode),x($==null?void 0:$.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),g(""),y(""))}catch($){console.error("Token verification error:",$),console.error($.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Telegram Verify – DextraBot"}),i.jsx("meta",{name:"description",content:"Verify your Telegram account to start earning with DextraBot's referral program. Follow the steps to confirm your Telegram identity and gain access to exclusive rewards."}),i.jsx("meta",{name:"og:title",content:"Telegram Verify – DextraBot"}),i.jsx("meta",{name:"og:description",content:"Verify your Telegram account to start earning with DextraBot's referral program. Follow the steps to confirm your Telegram identity and gain access to exclusive rewards."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/telegram-verify"})]})}),i.jsx("div",{style:{background:"linear-gradient(135deg, #0d0d0d 0%, #1c1c1c 50%, #0d0d0d 100%)"},className:"flex justify-center items-center w-full h-[calc(100vh-6rem)] sm:h-[calc(100vh-5rem)] min-h-max max-h-[calc(100vh-6rem)] sm:max-h-[calc(100vh-5rem)] px-4 pt-16 sm:pt-4 pb-10 bg-[#161616]",children:v?i.jsx(Dvn,{}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(fz,{})})})]})};function $vn({onRun:t}){const[e,n]=m.useState({wallet:"",pairs:[],equity:"",scale:"",period:"30D",method:"3"}),[r,s]=m.useState([]);m.useEffect(()=>{fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_coins/").then(u=>u.json()).then(u=>s(u.coins.filter(d=>!d.startsWith("@")).map(d=>({value:d,label:d,icon:`https://app.hyperliquid.xyz/coins/${d}.svg`}))))},[]);const a=[{value:"All",label:"All"},...r],o=({label:u,icon:d})=>i.jsxs("div",{className:"flex items-center gap-2",children:[u!=="All"&&i.jsx("img",{src:d,alt:u,className:"w-4 h-4",onError:f=>f.currentTarget.style.display="none"}),i.jsx("span",{children:u})]}),l={control:(u,d)=>({...u,backgroundColor:"#1B1B1B",borderColor:"#303030",height:"32px",minHeight:"32px",borderRadius:"6px",boxShadow:"none",fontSize:"14px",alignItems:"center"}),valueContainer:u=>({...u,height:"32px",padding:"0 8px",display:"flex",alignItems:"center"}),input:u=>({...u,margin:0,padding:0,color:"#C9C9C9",fontSize:"14px",display:"flex",alignItems:"center"}),indicatorsContainer:u=>({...u,height:"32px"}),indicatorSeparator:u=>({...u,height:"16px",alignSelf:"center",backgroundColor:"#444"}),placeholder:u=>({...u,color:"#7F7F7F",fontSize:"14px",display:"flex",alignItems:"center"}),singleValue:u=>({...u,color:"#7F7F7F",fontSize:"14px",display:"flex",alignItems:"center"}),menu:u=>({...u,backgroundColor:"#1B1B1B",fontSize:"14px"}),option:(u,d)=>({...u,backgroundColor:d.isFocused?"#292929":"#1B1B1B",color:"#C9C9C9",fontSize:"14px",paddingTop:"8px",paddingBottom:"8px",display:"flex",alignItems:"center",":active":{backgroundColor:"#292929"}}),multiValue:u=>({...u,backgroundColor:"#292929"}),multiValueLabel:u=>({...u,color:"#fff",fontSize:"14px"}),multiValueRemove:u=>({...u,color:"#fff",":hover":{backgroundColor:"#555",color:"#fff"}})},c=u=>d=>n({...e,[u]:d.target.value});return i.jsxs("div",{className:"w-[388px] h-auto rounded-[16px] bg-[rgba(30,30,30,0.64)] backdrop-blur-[64px] p-6 flex flex-col gap-4",children:[i.jsx("h2",{className:"text-white font-inter text-[18px] font-semibold tracking-[-0.36px]",children:"Start your backtest"}),i.jsx("p",{className:"text-[#8E8E8E] text-[14px] leading-[16px] tracking-[-0.28px] w-[277px]",children:"Test how profitable it would be to copy any trader’s strategy"}),i.jsxs("label",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Wallet Address"}),i.jsx("input",{className:"w-full h-[32px] rounded-[6px] border border-[#303030] bg-[#1B1B1B] px-3 text-[#7F7F7F] text-[14px] placeholder:text-[#7F7F7F] outline-none",placeholder:"Enter trader’s wallet address",value:e.wallet,onChange:c("wallet")})]}),i.jsxs("label",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Method"}),i.jsxs("select",{value:e.method,onChange:c("method"),className:"w-full h-[32px] rounded-[6px] border border-[#303030] bg-[#1B1B1B] px-2 text-[14px] text-[#7F7F7F] outline-none",children:[i.jsx("option",{value:"1",disabled:!0,children:"Method I (coming soon)"}),i.jsx("option",{value:"2",disabled:!0,children:"Method II (coming soon)"}),i.jsx("option",{value:"3",children:"Method III"})]})]}),i.jsxs("label",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Trading Pairs"}),i.jsx(jl,{options:a,isMulti:!0,placeholder:"All",closeMenuOnSelect:!1,hideSelectedOptions:!1,formatOptionLabel:o,styles:l,value:e.pairs.length?a.filter(u=>e.pairs.includes(u.value)):null,onChange:u=>{u!=null&&u.some(d=>d.value==="All")?n({...e,pairs:[]}):n({...e,pairs:u?u.map(d=>d.value):[]})}})]}),i.jsxs("label",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Initial Equity"}),i.jsx("input",{type:"number",placeholder:"1000",className:"w-full h-[32px] rounded-[6px] border border-[#303030] bg-[#1B1B1B] px-3 text-[#7F7F7F] text-[14px] placeholder:text-[#7F7F7F] outline-none",value:e.equity,onChange:c("equity")})]}),i.jsxs("label",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Scaling Factor (%)"}),i.jsx("input",{type:"number",placeholder:"50",className:"w-full h-[32px] rounded-[6px] border border-[#303030] bg-[#1B1B1B] px-3 text-[#7F7F7F] text-[14px] placeholder:text-[#7F7F7F] outline-none",value:e.scale,onChange:c("scale")})]}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("span",{className:"text-[#C9C9C9] text-[13px] font-manrope font-medium tracking-[0.26px]",children:"Time Period"}),i.jsx("div",{className:"flex gap-2",children:["7D","30D","90D"].map(u=>i.jsx("button",{onClick:()=>n({...e,period:u}),className:`w-[40px] h-[32px] rounded-[6px] bg-transparent border border-[#303030] flex justify-center items-center text-[12px] ${e.period===u?"text-white":"text-[#7F7F7F]"}`,children:u},u))})]}),i.jsx("button",{onClick:()=>t(e),className:"h-[32px] mt-auto flex py-[12px] px-[24px] justify-center items-center gap-[10px] rounded-[10px] bg-[#1DE674] text-[#0B331C] text-[13px] font-inter font-semibold tracking-[-0.13px]",children:"Run Backtest"})]})}function Uvn(){const[t,e]=m.useState(0);return m.useEffect(()=>{const n=setInterval(()=>{e(r=>(r+1)%3)},600);return()=>clearInterval(n)},[]),i.jsxs("div",{className:"flex flex-col items-center justify-center h-full bg-transparent text-white text-[13px] font-inter space-y-2",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("span",{className:"font-semibold leading-[14px] tracking-[-0.26px]",children:"Backtest Engine"})," ",i.jsx("span",{className:"font-normal leading-[14px] tracking-[-0.26px]",children:"is running..."})]}),i.jsx("div",{className:"text-[#7F7F7F] text-[13px] leading-[14px] tracking-[-0.26px] text-center font-normal",children:"Your strategy is being tested, the results will be here shortly...."}),i.jsx("div",{className:"flex gap-2 pt-1",children:[0,1,2].map(n=>i.jsx("div",{className:`w-[8px] h-[8px] rounded-full transition-all duration-300 ${n===t?"bg-[#1DE674]":"bg-[#404040]"}`},n))})]})}var vfe={};(function t(e,n,r,s){var a=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!e.OffscreenCanvas)return!1;var ee=new OffscreenCanvas(1,1),oe=ee.getContext("2d");oe.fillRect(0,0,1,1);var de=ee.transferToImageBitmap();try{oe.createPattern(de,"no-repeat")}catch{return!1}return!0}();function c(){}function u(ee){var oe=n.exports.Promise,de=oe!==void 0?oe:e.Promise;return typeof de=="function"?new de(ee):(ee(c,c),null)}var d=function(ee,oe){return{transform:function(de){if(ee)return de;if(oe.has(de))return oe.get(de);var Ce=new OffscreenCanvas(de.width,de.height),me=Ce.getContext("2d");return me.drawImage(de,0,0),oe.set(de,Ce),Ce},clear:function(){oe.clear()}}}(l,new Map),f=function(){var ee=Math.floor(16.666666666666668),oe,de,Ce={},me=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(oe=function(we){var xe=Math.random();return Ce[xe]=requestAnimationFrame(function be(je){me===je||me+ee-1<je?(me=je,delete Ce[xe],we()):Ce[xe]=requestAnimationFrame(be)}),xe},de=function(we){Ce[we]&&cancelAnimationFrame(Ce[we])}):(oe=function(we){return setTimeout(we,ee)},de=function(we){return clearTimeout(we)}),{frame:oe,cancel:de}}(),x=function(){var ee,oe,de={};function Ce(me){function we(xe,be){me.postMessage({options:xe||{},callback:be})}me.init=function(be){var je=be.transferControlToOffscreen();me.postMessage({canvas:je},[je])},me.fire=function(be,je,Ie){if(oe)return we(be,null),oe;var Re=Math.random().toString(36).slice(2);return oe=u(function(Qe){function Ke(dt){dt.data.callback===Re&&(delete de[Re],me.removeEventListener("message",Ke),oe=null,d.clear(),Ie(),Qe())}me.addEventListener("message",Ke),we(be,Re),de[Re]=Ke.bind(null,{data:{callback:Re}})}),oe},me.reset=function(){me.postMessage({reset:!0});for(var be in de)de[be](),delete de[be]}}return function(){if(ee)return ee;if(!r&&a){var me=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
`);try{ee=new Worker(URL.createObjectURL(new Blob([me])))}catch(we){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",we),null}Ce(ee)}return ee}}(),g={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function y(ee,oe){return oe?oe(ee):ee}function v(ee){return ee!=null}function C(ee,oe,de){return y(ee&&v(ee[oe])?ee[oe]:g[oe],de)}function N(ee){return ee<0?0:Math.floor(ee)}function P(ee,oe){return Math.floor(Math.random()*(oe-ee))+ee}function T(ee){return parseInt(ee,16)}function M(ee){return ee.map(F)}function F(ee){var oe=String(ee).replace(/[^0-9a-f]/gi,"");return oe.length<6&&(oe=oe[0]+oe[0]+oe[1]+oe[1]+oe[2]+oe[2]),{r:T(oe.substring(0,2)),g:T(oe.substring(2,4)),b:T(oe.substring(4,6))}}function $(ee){var oe=C(ee,"origin",Object);return oe.x=C(oe,"x",Number),oe.y=C(oe,"y",Number),oe}function L(ee){ee.width=document.documentElement.clientWidth,ee.height=document.documentElement.clientHeight}function z(ee){var oe=ee.getBoundingClientRect();ee.width=oe.width,ee.height=oe.height}function X(ee){var oe=document.createElement("canvas");return oe.style.position="fixed",oe.style.top="0px",oe.style.left="0px",oe.style.pointerEvents="none",oe.style.zIndex=ee,oe}function ne(ee,oe,de,Ce,me,we,xe,be,je){ee.save(),ee.translate(oe,de),ee.rotate(we),ee.scale(Ce,me),ee.arc(0,0,1,xe,be,je),ee.restore()}function J(ee){var oe=ee.angle*(Math.PI/180),de=ee.spread*(Math.PI/180);return{x:ee.x,y:ee.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:ee.startVelocity*.5+Math.random()*ee.startVelocity,angle2D:-oe+(.5*de-Math.random()*de),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:ee.color,shape:ee.shape,tick:0,totalTicks:ee.ticks,decay:ee.decay,drift:ee.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:ee.gravity*3,ovalScalar:.6,scalar:ee.scalar,flat:ee.flat}}function K(ee,oe){oe.x+=Math.cos(oe.angle2D)*oe.velocity+oe.drift,oe.y+=Math.sin(oe.angle2D)*oe.velocity+oe.gravity,oe.velocity*=oe.decay,oe.flat?(oe.wobble=0,oe.wobbleX=oe.x+10*oe.scalar,oe.wobbleY=oe.y+10*oe.scalar,oe.tiltSin=0,oe.tiltCos=0,oe.random=1):(oe.wobble+=oe.wobbleSpeed,oe.wobbleX=oe.x+10*oe.scalar*Math.cos(oe.wobble),oe.wobbleY=oe.y+10*oe.scalar*Math.sin(oe.wobble),oe.tiltAngle+=.1,oe.tiltSin=Math.sin(oe.tiltAngle),oe.tiltCos=Math.cos(oe.tiltAngle),oe.random=Math.random()+2);var de=oe.tick++/oe.totalTicks,Ce=oe.x+oe.random*oe.tiltCos,me=oe.y+oe.random*oe.tiltSin,we=oe.wobbleX+oe.random*oe.tiltCos,xe=oe.wobbleY+oe.random*oe.tiltSin;if(ee.fillStyle="rgba("+oe.color.r+", "+oe.color.g+", "+oe.color.b+", "+(1-de)+")",ee.beginPath(),o&&oe.shape.type==="path"&&typeof oe.shape.path=="string"&&Array.isArray(oe.shape.matrix))ee.fill(ae(oe.shape.path,oe.shape.matrix,oe.x,oe.y,Math.abs(we-Ce)*.1,Math.abs(xe-me)*.1,Math.PI/10*oe.wobble));else if(oe.shape.type==="bitmap"){var be=Math.PI/10*oe.wobble,je=Math.abs(we-Ce)*.1,Ie=Math.abs(xe-me)*.1,Re=oe.shape.bitmap.width*oe.scalar,Qe=oe.shape.bitmap.height*oe.scalar,Ke=new DOMMatrix([Math.cos(be)*je,Math.sin(be)*je,-Math.sin(be)*Ie,Math.cos(be)*Ie,oe.x,oe.y]);Ke.multiplySelf(new DOMMatrix(oe.shape.matrix));var dt=ee.createPattern(d.transform(oe.shape.bitmap),"no-repeat");dt.setTransform(Ke),ee.globalAlpha=1-de,ee.fillStyle=dt,ee.fillRect(oe.x-Re/2,oe.y-Qe/2,Re,Qe),ee.globalAlpha=1}else if(oe.shape==="circle")ee.ellipse?ee.ellipse(oe.x,oe.y,Math.abs(we-Ce)*oe.ovalScalar,Math.abs(xe-me)*oe.ovalScalar,Math.PI/10*oe.wobble,0,2*Math.PI):ne(ee,oe.x,oe.y,Math.abs(we-Ce)*oe.ovalScalar,Math.abs(xe-me)*oe.ovalScalar,Math.PI/10*oe.wobble,0,2*Math.PI);else if(oe.shape==="star")for(var tt=Math.PI/2*3,nt=4*oe.scalar,Le=8*oe.scalar,Be=oe.x,ht=oe.y,pt=5,Gt=Math.PI/pt;pt--;)Be=oe.x+Math.cos(tt)*Le,ht=oe.y+Math.sin(tt)*Le,ee.lineTo(Be,ht),tt+=Gt,Be=oe.x+Math.cos(tt)*nt,ht=oe.y+Math.sin(tt)*nt,ee.lineTo(Be,ht),tt+=Gt;else ee.moveTo(Math.floor(oe.x),Math.floor(oe.y)),ee.lineTo(Math.floor(oe.wobbleX),Math.floor(me)),ee.lineTo(Math.floor(we),Math.floor(xe)),ee.lineTo(Math.floor(Ce),Math.floor(oe.wobbleY));return ee.closePath(),ee.fill(),oe.tick<oe.totalTicks}function te(ee,oe,de,Ce,me){var we=oe.slice(),xe=ee.getContext("2d"),be,je,Ie=u(function(Re){function Qe(){be=je=null,xe.clearRect(0,0,Ce.width,Ce.height),d.clear(),me(),Re()}function Ke(){r&&!(Ce.width===s.width&&Ce.height===s.height)&&(Ce.width=ee.width=s.width,Ce.height=ee.height=s.height),!Ce.width&&!Ce.height&&(de(ee),Ce.width=ee.width,Ce.height=ee.height),xe.clearRect(0,0,Ce.width,Ce.height),we=we.filter(function(dt){return K(xe,dt)}),we.length?be=f.frame(Ke):Qe()}be=f.frame(Ke),je=Qe});return{addFettis:function(Re){return we=we.concat(Re),Ie},canvas:ee,promise:Ie,reset:function(){be&&f.cancel(be),je&&je()}}}function fe(ee,oe){var de=!ee,Ce=!!C(oe||{},"resize"),me=!1,we=C(oe,"disableForReducedMotion",Boolean),xe=a&&!!C(oe||{},"useWorker"),be=xe?x():null,je=de?L:z,Ie=ee&&be?!!ee.__confetti_initialized:!1,Re=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,Qe;function Ke(tt,nt,Le){for(var Be=C(tt,"particleCount",N),ht=C(tt,"angle",Number),pt=C(tt,"spread",Number),Gt=C(tt,"startVelocity",Number),wt=C(tt,"decay",Number),nn=C(tt,"gravity",Number),cn=C(tt,"drift",Number),Un=C(tt,"colors",M),Xt=C(tt,"ticks",Number),an=C(tt,"shapes"),Jt=C(tt,"scalar"),Ye=!!C(tt,"flat"),Je=$(tt),It=Be,hn=[],Yt=ee.width*Je.x,Rt=ee.height*Je.y;It--;)hn.push(J({x:Yt,y:Rt,angle:ht,spread:pt,startVelocity:Gt,color:Un[It%Un.length],shape:an[P(0,an.length)],ticks:Xt,decay:wt,gravity:nn,drift:cn,scalar:Jt,flat:Ye}));return Qe?Qe.addFettis(hn):(Qe=te(ee,hn,je,nt,Le),Qe.promise)}function dt(tt){var nt=we||C(tt,"disableForReducedMotion",Boolean),Le=C(tt,"zIndex",Number);if(nt&&Re)return u(function(Gt){Gt()});de&&Qe?ee=Qe.canvas:de&&!ee&&(ee=X(Le),document.body.appendChild(ee)),Ce&&!Ie&&je(ee);var Be={width:ee.width,height:ee.height};be&&!Ie&&be.init(ee),Ie=!0,be&&(ee.__confetti_initialized=!0);function ht(){if(be){var Gt={getBoundingClientRect:function(){if(!de)return ee.getBoundingClientRect()}};je(Gt),be.postMessage({resize:{width:Gt.width,height:Gt.height}});return}Be.width=Be.height=null}function pt(){Qe=null,Ce&&(me=!1,e.removeEventListener("resize",ht)),de&&ee&&(document.body.contains(ee)&&document.body.removeChild(ee),ee=null,Ie=!1)}return Ce&&!me&&(me=!0,e.addEventListener("resize",ht,!1)),be?be.fire(tt,Be,pt):Ke(tt,Be,pt)}return dt.reset=function(){be&&be.reset(),Qe&&Qe.reset()},dt}var q;function se(){return q||(q=fe(null,{useWorker:!0,resize:!0})),q}function ae(ee,oe,de,Ce,me,we,xe){var be=new Path2D(ee),je=new Path2D;je.addPath(be,new DOMMatrix(oe));var Ie=new Path2D;return Ie.addPath(je,new DOMMatrix([Math.cos(xe)*me,Math.sin(xe)*me,-Math.sin(xe)*we,Math.cos(xe)*we,de,Ce])),Ie}function W(ee){if(!o)throw new Error("path confetti are not supported in this browser");var oe,de;typeof ee=="string"?oe=ee:(oe=ee.path,de=ee.matrix);var Ce=new Path2D(oe),me=document.createElement("canvas"),we=me.getContext("2d");if(!de){for(var xe=1e3,be=xe,je=xe,Ie=0,Re=0,Qe,Ke,dt=0;dt<xe;dt+=2)for(var tt=0;tt<xe;tt+=2)we.isPointInPath(Ce,dt,tt,"nonzero")&&(be=Math.min(be,dt),je=Math.min(je,tt),Ie=Math.max(Ie,dt),Re=Math.max(Re,tt));Qe=Ie-be,Ke=Re-je;var nt=10,Le=Math.min(nt/Qe,nt/Ke);de=[Le,0,0,Le,-Math.round(Qe/2+be)*Le,-Math.round(Ke/2+je)*Le]}return{type:"path",path:oe,matrix:de}}function V(ee){var oe,de=1,Ce="#000000",me='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof ee=="string"?oe=ee:(oe=ee.text,de="scalar"in ee?ee.scalar:de,me="fontFamily"in ee?ee.fontFamily:me,Ce="color"in ee?ee.color:Ce);var we=10*de,xe=""+we+"px "+me,be=new OffscreenCanvas(we,we),je=be.getContext("2d");je.font=xe;var Ie=je.measureText(oe),Re=Math.ceil(Ie.actualBoundingBoxRight+Ie.actualBoundingBoxLeft),Qe=Math.ceil(Ie.actualBoundingBoxAscent+Ie.actualBoundingBoxDescent),Ke=2,dt=Ie.actualBoundingBoxLeft+Ke,tt=Ie.actualBoundingBoxAscent+Ke;Re+=Ke+Ke,Qe+=Ke+Ke,be=new OffscreenCanvas(Re,Qe),je=be.getContext("2d"),je.font=xe,je.fillStyle=Ce,je.fillText(oe,dt,tt);var nt=1/de;return{type:"bitmap",bitmap:be.transferToImageBitmap(),matrix:[nt,0,0,nt,-Re*nt/2,-Qe*nt/2]}}n.exports=function(){return se().apply(this,arguments)},n.exports.reset=function(){se().reset()},n.exports.create=fe,n.exports.shapeFromPath=W,n.exports.shapeFromText=V})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),vfe,!1);const zvn=vfe.exports;vfe.exports.create;const Hvn=200,Vvn={origin:{y:.7}};function O7(t,e){zvn({...Vvn,...e,particleCount:Math.floor(Hvn*t)})}function Wvn(){O7(.25,{spread:26,startVelocity:55}),O7(.2,{spread:60}),O7(.35,{spread:100,decay:.91,scalar:.8}),O7(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),O7(.1,{spread:120,startVelocity:45})}function qvn({result:t,period:e,onBack:n}){const[r,s]=m.useState(!1),[a,o]=m.useState(!1),[l,c]=m.useState({}),u="#00FF91",d="#252525",f=`PnL (${e})`,x=me=>{navigator.clipboard.writeText(me),tn.success("Successfully copied.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})},g=me=>me>=1e9?`${(me/1e9).toFixed(0)}B`:me>=1e6?`${(me/1e6).toFixed(0)}M`:me>=1e3?`${(me/1e3).toFixed(0)}K`:me.toFixed(0),{main:y,steps:v}=t,C=Object.values(t.steps).flat().map(me=>({...me,timestamp:new Date(me.timestamp).getTime()})).sort((me,we)=>me.timestamp-we.timestamp),N={};C.forEach(me=>{N[me.timestamp]=(N[me.timestamp]||0)+me.pnl_this_step});let P=t.main.initial_equity;const T=Object.entries(N).sort((me,we)=>me[0]-we[0]).map(([me,we])=>(P+=we,[Number(me),+P.toFixed(2)])),M=T.map(([,me])=>me);let F=M[0],$=0;M.forEach(me=>{me>F&&(F=me);const we=(F-me)/F;we>$&&($=we)});const L=($*100).toFixed(2),z=C.filter(me=>me.pnl_this_step>0).length,X=C.filter(me=>me.pnl_this_step<0).length,ne=`${(z/C.length*100).toFixed(2)}%`,J=T.slice(1).map(([,me],we)=>{const xe=T[we][1];return(me-xe)/xe}),K=me=>me.length?me.reduce((we,xe)=>we+xe,0)/me.length:0,te=me=>{const we=K(me),xe=K(me.map(be=>(be-we)**2));return Math.sqrt(xe)},fe=(te(J)?K(J)/te(J):0).toFixed(2),q=((y.my_total_equity/y.initial_equity-1)*100).toFixed(2),se={},ae=me=>{var we;return{time:new Date(me.timestamp).toLocaleTimeString(),pnl:me.pnl_this_step,coin:me.coin,activity:{direction:((we=me.trader_direction)==null?void 0:we.toLowerCase())==="long"?"Long":"Short",leverage:me.trader_leverage},size:me.trader_szi,posValue:me.our_target_value,entry:me.our_pos_entry_price,close:me.market_price}};C.forEach(me=>{const we=new Date(me.timestamp).toLocaleDateString();se[we]=se[we]||{rows:[],totalPnl:0},se[we].rows.push(ae(me)),se[we].totalPnl+=me.pnl_this_step});const W=Object.entries(se).sort((me,we)=>new Date(me[0])-new Date(we[0]));let V=y.initial_equity;const ee=W.map(([me,{rows:we,totalPnl:xe}])=>(V+=xe,{date:me,rows:we,totalPnl:xe,equity:V}));m.useEffect(()=>{var me;if(((me=t==null?void 0:t.main)==null?void 0:me.final_pnl)>0){Wvn(),o(!0);const we=setTimeout(()=>o(!1),3e3);return()=>clearTimeout(we)}},[t]);const oe={chart:{type:"area",toolbar:{show:!1},background:"transparent",animations:{enabled:!1}},stroke:{width:2,curve:"straight",colors:[u]},fill:{type:"gradient",gradient:{shade:"dark",shadeIntensity:1,opacityFrom:.45,opacityTo:0,stops:[0,100],colorStops:[{offset:0,color:u,opacity:.45},{offset:100,color:u,opacity:0}]}},grid:{show:!0,borderColor:d,strokeDashArray:6,xaxis:{lines:{show:!0}},yaxis:{lines:{show:!0}}},xaxis:{type:"datetime",labels:{style:{colors:"#9B9B9B",fontSize:"12px",fontFamily:"Manrope",fontWeight:500},datetimeUTC:!1,format:"dd/MM"}},yaxis:{labels:{style:{colors:"#9B9B9B",fontSize:"12px",fontFamily:"Manrope",fontWeight:500},formatter:me=>g(me)}},dataLabels:{enabled:!1},tooltip:{theme:"dark",x:{format:"dd/MM HH:mm"},y:{formatter:me=>`$${me.toFixed(2)}`},marker:{fillColors:[u]}},zoom:{enabled:!1},markers:{size:0,colors:[u]}},de=[{key:"time",label:"Time",width:"0.7fr"},{key:"pnl",label:"PnL",width:"0.7fr",headerClassName:"flex justify-end",render:me=>i.jsxs("span",{className:`flex justify-end ${me<0?"text-[#FF797C]":"text-[#67FFBD]"}`,children:[me<0?"- $":"$",Math.abs(me).toFixed(2)]})},{key:"coin",label:"Symbol",sortable:!0,width:"0.7fr",render:(me,we)=>i.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${we.coin}.svg`,onError:oa,className:"w-5 h-5"}),we.coin]})},{key:"activity",label:"Direction",width:"1.3fr",render:(me,we)=>{const xe=we.activity.direction==="Long";return i.jsxs("div",{className:`inline-flex justify-center items-center gap-1 px-2 py-1 h-6 rounded-[6px] w-[115px] text-[11px] uppercase font-semibold ${xe?"text-[#67ffbd] bg-[rgba(103,255,189,0.16)]":"text-[#ff787b] bg-[rgba(255,131,117,0.16)]"}`,children:[i.jsx(Os,{className:`w-3 h-3 ${xe?"rotate-180 text-[#67ffbd]":"text-[#ff787b]"}`}),`${we.activity.direction} - ${we.activity.leverage}x`]})}},{key:"size",label:"Size",width:"0.8fr"},{key:"posValue",label:"Position Value",width:"1fr",render:me=>`$${me.toFixed(2)}`},{key:"entry",label:"Entry Price",width:"0.9fr",render:me=>`$${me.toLocaleString()}`},{key:"close",label:"Close Price",width:"0.9fr",render:me=>`$${me.toLocaleString()}`}],Ce=Object.values(l).some(Boolean);return i.jsxs(i.Fragment,{children:[a&&i.jsx("div",{className:"fixed inset-0 top-24 flex items-start justify-center z-50 pointer-events-none font-manrope",children:i.jsx("div",{className:"text-4xl font-bold text-white px-6 py-4 rounded-xl animate-pulse",children:"🎉 You are the winner! 🥳"})}),i.jsxs(yp,{isOpen:r,onClose:()=>s(!1),children:[i.jsx("h2",{className:"text-white text-lg mb-4",children:"Perp Equity Chart"}),i.jsx($D,{options:{...oe,chart:{...oe.chart,sparkline:{enabled:!1}}},series:[{name:"Equity",data:T}],type:"area",height:320,width:"100%"})]}),i.jsxs("div",{className:["animate-slide-in text-white font-inter p-4 sm:p-6 mx-auto","rounded-[24px] border border-[#343434] backdrop-blur-[64px]","mt-0 sm:mt-20 transition-[max-width] duration-300",Ce?"max-w-96 sm:max-w-5xl":"max-w-96 sm:max-w-xl"].join(" "),children:[i.jsxs("div",{className:"flex items-center justify-between mb-[19px]",children:[i.jsx("div",{className:"flex items-center gap-1",children:i.jsx("span",{className:"text-[18px] font-semibold",children:"My Backtest Results"})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{className:"px-6 py-3 text-[#0B331C] text-[13px] font-semibold rounded-[10px] bg-[#1DE674] h-[32px] flex justify-center items-center",onClick:n,children:"New Backtest"}),i.jsx("button",{className:"px-6 py-3 text-[#67FFBD] text-[13px] font-semibold rounded-[10px] bg-[rgba(103,255,189,0.16)] h-[32px] flex items-center gap-2",onClick:()=>x(window.location.href),children:"Share"})]})]}),i.jsx("div",{className:"grid grid-cols-4 gap-4",children:[["Initial Perp Equity",y.initial_equity,"white"],["Final Perp Equity",y.my_total_equity,y.my_total_equity<y.initial_equity?"#FF797C":"#67FFBD"],[f,y.final_pnl,y.final_pnl<0?"#FF797C":"#67FFBD"],["Max Drawdown",`${L}%`,"#FF797C"],["Win Rate",ne,"white"],["Win / Loss",i.jsxs("div",{className:"flex gap-0 sm:gap-1",children:[i.jsxs("span",{className:"flex gap-1 items-center",children:[i.jsx("span",{className:"text-[#67FFBD]",children:"●"}),z]})," ",i.jsxs("span",{className:"flex gap-1 items-center",children:[i.jsx("span",{className:"text-[#FF797C]",children:"●"}),X]})]}),"white"],["Growth Rate",`${q}%`,q<0?"#FF797C":"#67FFBD"],["Sharpe",fe,"white"]].map(([me,we,xe])=>i.jsxs("div",{children:[i.jsx("div",{className:"text-[#8E8E8E] text-[14px] pb-1",children:me}),i.jsx("div",{style:{color:xe},className:"text-[14px] font-semibold whitespace-nowrap",children:typeof we=="number"?`$${we.toFixed(2)}`:we})]},me))}),i.jsxs("div",{className:"bg-[#1B1B1B] rounded-xl mt-4 mb-4",children:[i.jsxs("div",{className:"flex px-3 pt-3 justify-between items-center text-[#8E8E8E] text-[14px] mb-2",children:["Perp Equity Chart",i.jsx("img",{src:ict,alt:"expand",className:"cursor-pointer",onClick:()=>s(!0)})]}),i.jsx($D,{options:oe,series:[{name:"Equity",data:T}],type:"area",height:150,width:"100%"})]}),i.jsx("div",{className:"bg-[#1B1B1B] rounded-xl divide-y divide-[#2A2A2A] max-h-[320px] overflow-y-auto overflow-x-hidden",children:ee.map(({date:me,rows:we,totalPnl:xe,equity:be})=>{const je=xe>=0,Ie=l[me];return i.jsxs("div",{children:[i.jsxs("button",{className:"w-full grid grid-cols-3 items-center px-4 py-[10px] text-[13px] font-semibold bg-transparent",onClick:()=>c(Re=>({...Re,[me]:!Ie})),children:[i.jsx("span",{className:"text-left text-white",children:me}),i.jsxs("span",{className:"text-center text-white",children:["$",be.toFixed(2)]}),i.jsxs("span",{className:`text-right ${je?"text-[#67FFBD]":"text-[#FF797C]"}`,children:[je?"+":"-","$",Math.abs(xe).toFixed(2)]})]}),Ie&&i.jsx("div",{className:"overflow-x-auto",children:i.jsx(zu,{columns:de,data:we,listHeight:Math.min(we.length*36,180),rowClassName:"border-t border-[#2A2A2A] text-white !text-[13px] font-inter",tableClassName:"min-w-[900px] bg-[#1B1B1B] rounded-xl overflow-hidden",theadClassName:"bg-[#1B1B1B] !text-[#9B9B9B] font-manrope !text-[13px] font-semibold",tbodyClassName:"divide-y divide-[#2A2A2A]",cellClassName:"px-4 py-[10px]",rowHeight:36})})]},me)})})]})]})}const Gvn=t=>{const e=new URLSearchParams;return e.set("wallet",t.wallet),t.pairs.length&&e.set("pairs",t.pairs.join(",")),e.set("equity",t.equity),e.set("scale",t.scale),e.set("period",t.period),e.set("method",t.method),e.toString()},Kvn=()=>{const t=new URLSearchParams(window.location.search);return{wallet:t.get("wallet")||"",pairs:t.get("pairs")?t.get("pairs").split(","):[],equity:t.get("equity")||"",scale:t.get("scale")||"",period:t.get("period")||"30D",method:t.get("method")||"3"}};function Yvn(){const[t,e]=m.useState("starter"),[n,r]=m.useState(null),[s,a]=m.useState("30D"),o=m.useCallback(async l=>{e("loading");const c={"7D":7,"30D":30,"90D":90},u=l.pairs.length?{coin:{$in:l.pairs}}:{},d={period:c[l.period]||1,filters:{user_wallet:l.wallet,...u},method:Number(l.method),initial_equity:Number(l.equity),scaling_factor:Number(l.scale),steps:!0};try{const x=await(await fetch("https://dextradata.nftinit.io/api/hyper/backtest/fills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).json();if(x.error_message){tn.error(x.error_message),e("starter");return}window.history.replaceState(null,"","?"+Gvn(l)),a(l.period),r(x),e("result")}catch(f){console.error(f),e("starter"),tn.error("Backtest failed. Please try again.")}},[]);return m.useEffect(()=>{const l=Kvn();l.wallet&&o(l)},[o]),i.jsxs("div",{className:"flex items-start sm:items-center justify-center w-screen h-screen mt-4 sm:mt-0 mb-32 sm:mb-0",children:[t==="starter"&&i.jsx($vn,{onRun:o}),t==="loading"&&i.jsx(Uvn,{}),t==="result"&&i.jsx(qvn,{result:n,period:s,onBack:()=>{window.history.replaceState(null,"",window.location.pathname),e("starter")}})]})}const Xvn=({tg:t})=>{const{address:e}=ns(),[n,r]=m.useState(!1);return m.useEffect(()=>{if(!t||isNaN(Number(t)))return;(async()=>{try{const a=window.localStorage.getItem("hyperToken"),o=window.localStorage.getItem("hyperAddress"),l=await fetch("https://dextrabothypev2.nftinit.io/api/telegram/sign_api_wallet_telegram/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:e?e.toLowerCase():o,token:a,telegram_id:t})});if(!l.ok)throw new Error(`Request failed with status ${l.status}`);const c=await l.json();c!=null&&c.success&&r(!0)}catch(a){console.error("Error sending data:",a)}})()},[t]),i.jsxs(i.Fragment,{children:[i.jsx(P5,{open:n,setOpen:r,handleListRequest:()=>{},handlePageChange:()=>{}}),i.jsx("div",{className:"flex flex-col items-center justify-center px-6 sm:px-16 pb-10 gap-6 w-max h-max bg-[#212121]/90 rounded-2xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#2a2a2a] relative pt-10",children:i.jsxs("div",{className:"flex flex-col items-center text-white text-base font-medium font-['Inter'] text-center gap-4",children:[i.jsx("img",{src:Yi,alt:"",className:"w-8 h-8"}),i.jsx("div",{className:"text-center text-white text-base font-medium font-['Inter'] leading-4 tracking-[-0.28px]",children:"Dextrabot Wallet Setup"}),i.jsx("div",{className:"max-w-[240px] text-center text-white text-[13px] font-normal font-['Inter'] leading-4",children:"Add an account to start your copy trading journey on Telegram. Choose between creating an API Wallet or a Generate Wallet."}),i.jsxs("div",{className:"flex flex-col items-center gap-6 mt-[33px]",children:[i.jsxs("div",{onClick:()=>{r(!0)},className:"w-full h-10 px-6 py-3 bg-[#7445ff] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#8860ff] flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsxs("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M5 9H14",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M9.5 13.5V4.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px] min-w-max -mb-[1px]",children:"Add Account"})]}),i.jsxs("div",{onClick:()=>window.open("https://t.me/Dextrabot_CopyTrade_bot","_blank"),className:"w-full h-10 px-6 py-3 bg-white hover:bg-[#E5E5E5] rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] inline-flex justify-center items-center gap-2.5 cursor-pointer",children:[i.jsx("img",{src:AEe,alt:""}),i.jsx("div",{className:"justify-start text-black text-sm font-semibold font-['Inter'] leading-none min-w-max",children:"Open Telegram App"})]})]})]})})]})},Qvn=()=>{const[t]=T8e(),e=t==null?void 0:t.get("tg"),{isConnected:n,address:r}=ns(),{hyperToken:s,hyperAddress:a,setSignModalOpen:o,setTelegramChatId:l,setSubscriberRole:c,setSubsExpireDay:u,setMushboomerETH:d,setMushboomerSOL:f,setIsReferralCode:x,setIsReferralCodeName:g,setIsWhitelist:y,setHyperToken:v,setHyperAddress:C}=m.useContext(Qr),[N,P]=m.useState(!!window.localStorage.getItem("hyperToken"));return m.useEffect(()=>{const T=window.localStorage.getItem("hyperToken");P(!!T)},[r,n,s,a]),m.useEffect(()=>{(async()=>{var $,L;const M=window.localStorage.getItem("hyperToken"),F=window.localStorage.getItem("hyperAddress");if(!(!M||!F))try{const z=await ki(F.toLowerCase(),M);z!=null&&z.success?(l(z==null?void 0:z.telegram_chat_id),c(z==null?void 0:z.subscriber_role),u(z==null?void 0:z.subs_expire_day),d(($=z==null?void 0:z.mushboomer_counts)==null?void 0:$.eth),f((L=z==null?void 0:z.mushboomer_counts)==null?void 0:L.sol),x(z==null?void 0:z.referral_code),g(z==null?void 0:z.refcode),y(z==null?void 0:z.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),v(""),C(""))}catch(z){console.error("Token verification error:",z),console.error(z.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Dextrabot Telegram Wallet Setup – Create API or Generated Wallet"}),i.jsx("meta",{name:"description",content:"Easily set up your Telegram copy trading wallet on Dextrabot. Create an API Wallet with your own account or generate a new wallet instantly, then connect to Telegram to start trading."}),i.jsx("meta",{name:"og:title",content:"Dextrabot Telegram Wallet Setup – Create API or Generated Wallet"}),i.jsx("meta",{name:"og:description",content:"Easily set up your Telegram copy trading wallet on Dextrabot. Create an API Wallet with your own account or generate a new wallet instantly, then connect to Telegram to start trading."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/telegram-api-wallet"})]})}),i.jsx("div",{style:{background:"linear-gradient(135deg, #0d0d0d 0%, #1c1c1c 50%, #0d0d0d 100%)"},className:"flex justify-center items-center w-full h-[calc(100vh-6rem)] sm:h-[calc(100vh-5rem)] min-h-max max-h-[calc(100vh-6rem)] sm:max-h-[calc(100vh-5rem)] px-4 pt-16 sm:pt-4 pb-10 bg-[#161616]",children:N?i.jsx(Xvn,{tg:e}):i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsx(fz,{})})})]})},YAe="/assets/share1-C-zw_JWP.jpg",Zvn="/assets/share2-DdEku457.jpg",Jvn="/assets/share3-CNxpeTYT.jpg",ewn="/assets/share4-DJuI_ZiE.jpg",twn="/assets/share5-T6uiFcTh.jpg",nwn="/assets/share6-DjS5fdAF.jpg",rwn="/assets/share7-BaMtg3x6.jpg",swn="/assets/share8-xyCgNFII.jpg",iwn="/assets/share9-BLclkV1L.jpg",awn="/assets/share10-C9sVwYdl.jpg",own="/assets/share11-_FKzaoRV.jpg",lwn="/assets/share12-DHiXk6_m.jpg",cwn="/assets/share13-0mVBxTxA.jpg",uwn="/assets/share14-B6N7agx8.jpg",dwn="/assets/share15-D46qu5xc.jpg",fwn="/assets/share16-B06pZYlo.jpg",hwn="/assets/share17-C9ObNWuI.jpg",pwn="/assets/share18-DafUfIIP.jpg",mwn="/assets/share19-DdeHQJDd.jpg",xwn="/assets/share20-Cx0LCWyZ.jpg",gwn="/assets/lighter-banner-B9jyiBZ3.png",bwn="#67FFBD",ywn="https://dextrabothypev2.nftinit.io/api/hyper/fee_calculator_save/";function vwn({initialWalletAddress:t}){const e=jo(),[n,r]=m.useState(t||""),[s,a]=m.useState(!1),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState(t||""),[x,g]=m.useState(!1),[y,v]=m.useState(0),[C,N]=m.useState(!1),[P,T]=m.useState(YAe),[M,F]=m.useState(""),[$,L]=m.useState(""),z=m.useRef(!1),X=m.useRef(null),ne=m.useRef(null),J=m.useRef(0),K=[YAe,Zvn,Jvn,ewn,twn,nwn,rwn,swn,iwn,awn,own,lwn,cwn,uwn,dwn,fwn,hwn,pwn,mwn,xwn];m.useEffect(()=>{const Re=document.querySelector("main");Re&&(Re.style.background="#0b0b0b"),F(`${window.location.origin}${window.location.pathname}`);const Qe=decodeURIComponent((window.location.hash||"").replace(/^#/,"")),Ke=window.location.pathname.split("/").filter(Boolean),dt=Ke[Ke.length-1]||"",nt=dt&&dt.toLowerCase()!=="hyperliquid-fee-calculator"?decodeURIComponent(dt):"",Le=Qe||nt;if(Le){f(Le),r(Le);const Be=`${window.location.pathname}#${encodeURIComponent(Le)}`;window.history.replaceState(null,"",Be),L(`${window.location.origin}${Be}`),ae(Le)}return()=>{Re&&(Re.style.background="")}},[]),m.useEffect(()=>{t&&t.trim()&&ae(t)},[t]);const te=Re=>{const Qe=Number(Re||0);return Math.abs(Qe)>=1e6?`$${(Qe/1e6).toFixed(2)}M`:Math.abs(Qe)>=1e3?`$${(Qe/1e3).toFixed(2)}K`:`$${Qe.toFixed(2)}`},fe=Re=>`$${Number(Re||0).toFixed(2)}`,q=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"}),se=async Re=>{if(z.current)return;z.current=!0;const Qe=window.localStorage.getItem("hyperAddress")||"",Ke={wallet_address:n||null,calculator_logs:{total_fee_spent:fe(((Re==null?void 0:Re.totalFee)||0)+((Re==null?void 0:Re.totalBuilderFee)||0)),trading_fees:fe((Re==null?void 0:Re.totalFee)||0),builder_fees:fe((Re==null?void 0:Re.totalBuilderFee)||0),total_fills:Number((Re==null?void 0:Re.totalFills)||0),created_at:q()}};Qe&&(Ke.address=Qe);try{await fetch(ywn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ke)})}catch{}},ae=async Re=>{if(!Re){tn.error("Please enter a wallet address");return}z.current=!1,a(!0),l(null),u(null),g(!1),v(0),N(!1),e(`/hyperliquid-fee-calculator/${Re}`,{replace:!0}),L(`${window.location.origin}/hyperliquid-fee-calculator/${Re}`);try{await cln(Re,Qe=>{Qe.totalFills>=2e3&&g(!0),u({...Qe,isPartial:!Qe.isComplete}),v(Math.min(Qe.requestCount/12*100,100)),Qe.isComplete&&(g(!1),v(100),a(!1),N(!0),se(Qe),e(`/hyperliquid-fee-calculator/${Re}`,{replace:!0}))})}catch(Qe){l(Qe.message||"Failed to calculate fees"),tn.error("Failed to calculate fees"),g(!1),a(!1)}},W=Re=>{f(Re),Re.trim()&&r(Re.trim())},V=(()=>{const Re=((c==null?void 0:c.totalFee)||0)+((c==null?void 0:c.totalBuilderFee)||0);return`I paid ${te(Re)} in total fees on Hyperliquid.
Generate your own fee report and see potential savings with 0% builder fees.`})(),ee=async()=>{if(X.current)try{await document.fonts.ready;const Re=await V1(X.current,{cacheBust:!0,backgroundColor:"#0b0b0b",useCORS:!0,pixelRatio:2}),Qe=document.createElement("a");Qe.href=Re,Qe.download="dextrabot-fee-card.png",document.body.appendChild(Qe),Qe.click(),document.body.removeChild(Qe)}catch{tn.error("Failed to download PNG.")}},oe=$||M||"https://app.dextrabot.com/hyperliquid-fee-calculator",de=`https://x.com/intent/post?text=${encodeURIComponent(V)}&url=${encodeURIComponent(oe)}`,[Ce,me]=m.useState({rx:0,ry:0,gx:50,gy:50}),we=12,xe=Re=>{ne.current&&(cancelAnimationFrame(J.current),J.current=requestAnimationFrame(()=>{const Qe=ne.current.getBoundingClientRect(),Ke=(Re.clientX-Qe.left)/Qe.width,dt=(Re.clientY-Qe.top)/Qe.height,tt=(Ke-.5)*(we*2),nt=(.5-dt)*(we*2);me({rx:Math.max(-12,Math.min(we,nt)),ry:Math.max(-12,Math.min(we,tt)),gx:Ke*100,gy:dt*100})}))},be=()=>{cancelAnimationFrame(J.current),me({rx:0,ry:0,gx:50,gy:50})},je=s,Ie=!n.trim();return i.jsxs(to,{children:[i.jsxs(xo,{children:[i.jsx("title",{children:"Hyperliquid Fee Spent Report — Dextrabot"}),i.jsx("meta",{name:"description",content:"Hyperliquid Fee Spent Report"})]}),i.jsxs("div",{className:"relative text-white overflow-hidden overscroll-none",style:{fontFamily:"Manrope, ui-sans-serif"},children:[i.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-16 bottom-0 opacity-40 ",style:{background:"radial-gradient(800px 800px at 10% 0%, rgba(103,255,189,0.12) 0%, transparent 60%), radial-gradient(900px 900px at 90% 100%, rgba(103,255,189,0.08) 0%, transparent 55%)"}}),i.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-16 bottom-0 opacity-[0.06] ",style:{background:"repeating-linear-gradient(0deg, #fff 0, #fff 1px, transparent 1px, transparent 3px)"}}),i.jsxs("div",{className:" mx-auto pt-4 pb-4 gap-4 flex justify-center ",children:[!C&&i.jsxs(Ao.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"relative overflow-hidden rounded-2xl border border-[#17211b] bg-[#0a0c0c]",children:[i.jsx("div",{className:"absolute inset-0 opacity-60",style:{background:"radial-gradient(1000px 300px at 0% 0%, rgba(103,255,189,0.22) 0%, transparent 60%)"}}),i.jsx("div",{className:"absolute -inset-[1px] rounded-2xl",style:{background:"linear-gradient(120deg, rgba(103,255,189,0.35), transparent 25% 75%, rgba(103,255,189,0.2))",filter:"blur(10px)",opacity:.35}}),i.jsxs("div",{className:"relative grid grid-cols-1 lg:grid-cols-2 gap-10 p-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"inline-flex items-center gap-3 bg-[#0b1511] border border-[#1e2e27] rounded-xl px-3 py-2 shadow-[0_0_24px_rgba(103,255,189,0.12)]",children:[i.jsx("img",{src:WA,alt:"Dextrabot",className:"w-7 h-7 rounded-md"}),i.jsx("span",{className:"text-[#d7ffe9] font-semibold tracking-wide",children:"Hyperliquid Fee Spent Report"})]}),i.jsxs("h2",{className:"mt-4 text-[28px] leading-tight font-extrabold tracking-tight",children:["Calculate Your Hyperliquid Trading Fees",i.jsx("br",{}),i.jsx("span",{style:{color:bwn},children:"Fee Report Generator"})]}),i.jsx("p",{className:"mt-3 text-[#a6b6b0] max-w-xl",children:"Discover how much you've paid in Hyperliquid trading fees. Free calculator generates your complete fee report."}),i.jsxs("div",{className:"mt-6",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:i.jsx(LVe,{className:"h-5 w-5 text-[#88a296]"})}),i.jsx("input",{type:"text",value:d,onChange:Re=>W(Re.target.value),placeholder:"Paste wallet address…",className:"w-full pl-10 pr-12 py-3 rounded-xl bg-[#060808] border border-[#1c2a24] text-white placeholder-[#6e857d] focus:outline-none focus:border-[#67FFBD] focus:ring-1 focus:ring-[#67FFBD]"}),d?i.jsx("button",{onClick:()=>{f(""),r(""),window.history.replaceState(null,"",window.location.pathname),L("")},className:"absolute inset-y-0 right-2 flex justify-center items-center h-10 top-[5px]",children:i.jsx(bde,{className:"h-6 w-6 text-[#8ea79e] hover:text-white transition-colors"})}):null]}),i.jsxs(Ao.button,{whileTap:{scale:.98},onClick:()=>ae(n),disabled:je||Ie,className:`mt-3 relative overflow-hidden rounded-xl font-semibold py-3 px-5 transition-colors shadow-[0_0_24px_rgba(103,255,189,0.24)] ${je?"bg-[rgba(103,255,189,0.95)] text-[#0b0b0b]":Ie?"bg-[#16211b] text-[#7ea391] cursor-not-allowed border border-[#1e2e27]":"bg[rgba(103,255,189,0.95)]"}`,style:!je&&!Ie?{backgroundColor:"rgba(103,255,189,0.95)",color:"#0b0b0b"}:void 0,children:[i.jsx(nP,{initial:!1,children:je&&i.jsx(Ao.span,{initial:{width:0,opacity:0},animate:{width:`${y}%`,opacity:1},exit:{width:0,opacity:0},transition:{ease:"easeOut",duration:.3},className:"absolute top-0 left-0 h-full bg-[#2bb584]"})}),i.jsx("span",{className:"relative z-10",children:je?"Calculating…":"Generate Report"})]})]})]}),i.jsx("div",{className:"relative",children:i.jsxs("div",{className:"rounded-2xl border border-[#1e2e27] bg-[#050707] overflow-hidden shadow-[0_0_60px_rgba(103,255,189,0.15)]",children:[i.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.06] rounded-2xl overflow-hidden",style:{background:"repeating-linear-gradient(180deg, #fff 0, #fff 1px, transparent 1px, transparent 3px)"}}),i.jsx("video",{src:wA,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[320px] lg:h-[380px] object-cover"},wA)]})})]})]}),C&&c&&i.jsx(Ao.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},children:i.jsxs("div",{className:"flex flex-col lg:flex-row items-start gap-4",children:[i.jsx("div",{className:"shrink-0",children:i.jsxs("button",{onClick:()=>{N(!1),e("/hyperliquid-fee-calculator",{replace:!0})},className:"inline-flex items-center gap-2 rounded-lg px-3 py-2 border border-[#23372e] bg-[#0c1210] hover:bg-[#0f1714] text-[#d7ffe9]",children:[i.jsx(Vcn,{className:"w-5 h-5"}),"Back"]})}),i.jsxs("div",{className:"shrink-0",children:[i.jsx(wwn,{refCard:X,refWrap:ne,tilt:Ce,onMove:xe,onLeave:be,feeData:c,selectedImage:P}),i.jsxs("div",{className:"rounded-2xl border border-[#1e2e27] bg-[#0a0c0c] overflow-hidden shadow-[0_0_30px_rgba(103,255,189,0.12)] p-4 mt-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full grid place-items-center bg-[#67FFBD22] text-[#67FFBD]",children:i.jsx(ISt,{})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"text-[15px] font-semibold",children:"Share"}),i.jsx("div",{className:"text-xs text-[#a6b6b0]",children:"Share your card on X and show off your stats!"})]}),i.jsx(tQ,{className:"w-5 h-5 text-[#7a8c86]"})]}),i.jsx("div",{className:"mt-3 grid grid-cols-1 gap-2",children:i.jsx("a",{href:de,target:"_blank",className:"h-10 grid place-items-center rounded-lg bg-white text-[#111] hover:bg-[#eaeaea] transition-colors text-sm font-medium",children:"Share on X"})})]})]}),i.jsxs("div",{className:"w-full lg:w[420px] space-y-3",style:{width:"100%",maxWidth:"420px"},children:[i.jsx("a",{href:"https://t.me/Dextrabot_CopyTrade_bot",target:"_blank",className:"block rounded-2xl border border-[#1e2e27] bg-[#0a0c0c] hover:border-[#67FFBD66] hover:bg-[#0d120f] transition-colors",children:i.jsxs("div",{className:"flex items-center gap-3 p-4",children:[i.jsx("div",{className:"w-9 h-9 rounded-full grid place-items-center bg-[#67FFBD22] font-bold text-[#67FFBD]",children:i.jsx(jSt,{})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"text-[15px] font-semibold text-[#67FFBD]",children:"Zero Builder Fee on HL"}),i.jsx("div",{className:"text-xs text-[#a6b6b0]",children:"Trade with Zero Builder Fees on HL via Telegram."})]}),i.jsx(tQ,{className:"w-5 h-5 text-[#7a8c86]"})]})}),i.jsx("div",{className:"rounded-2xl border border-[#1e2e27] bg-[#0a0c0c] overflow-hidden shadow-[0_0_30px_rgba(103,255,189,0.12)]",children:i.jsxs("div",{className:"p-4 pb-[18px]",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full grid place-items-center bg-[#67FFBD22] text-[#67FFBD]",children:i.jsx(kSt,{})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("div",{className:"text-[15px] font-semibold",children:"Choose an Image"}),i.jsx("div",{className:"text-xs text-[#a6b6b0]",children:"Pick a meme background and download your card."})]}),i.jsx(tQ,{className:"w-5 h-5 text-[#7a8c86]"})]}),i.jsxs("div",{className:"mt-8",children:[i.jsx("div",{className:"grid grid-cols-4 gap-2 pb-4",children:K.map((Re,Qe)=>i.jsx(Ao.button,{whileHover:{y:-2},whileTap:{scale:.98},onClick:()=>T(Re),className:`rounded-md overflow-hidden border ${P===Re?"border-[#67FFBD]":"border-[#2b2b2b]"}`,children:i.jsx("img",{src:Re,alt:`bg-${Qe}`,className:"w-full h-16 object-cover"})},Qe))}),i.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[i.jsx("button",{onClick:ee,className:"h-8 flex justify-center items-center rounded-lg border border-[#1e2e27] bg-[#0e1211] hover:border-[#67FFBD66] hover:bg-[#111716] transition-colors text-sm font-medium",children:"Download Image"}),i.jsx("button",{onClick:()=>window.open(`/wallet-details/${n}`,"_blank","noopener,noreferrer"),className:"h-8 flex justify-center items-center rounded-lg border border-[#1e2e27] bg-[#0e1211] hover:border-[#67FFBD66] hover:bg-[#111716] transition-colors text-sm font-medium",children:"Go to Wallet Details"})]})]})]})})]})]})}),C&&i.jsx("div",{className:"rounded-2xl border border-[#1e2e27] bg-[#0a0c0c] overflow-hidden shadow-[0_0_30px_rgba(103,255,189,0.12)]",children:i.jsx("img",{src:gwn,alt:"Lighter — Zero Fee",className:"h-full w-full cursor-pointer",loading:"eager",decoding:"async",draggable:!1,onClick:()=>{window.location.hash="lighter-farming"}})})]})]})]})}function wwn({refCard:t,refWrap:e,tilt:n,onMove:r,onLeave:s,feeData:a,selectedImage:o}){const l=((a==null?void 0:a.totalFee)||0)+((a==null?void 0:a.totalBuilderFee)||0),c=f=>{const x=Number(f||0);return Math.abs(x)>=1e6?`$${(x/1e6).toFixed(2)}M`:Math.abs(x)>=1e3?`$${(x/1e3).toFixed(2)}K`:`$${x.toFixed(2)}`},d=m.useRef(new Date).current.toLocaleDateString("en-US",{month:"short",day:"numeric"});return a!=null&&a.isPartial,i.jsx("div",{ref:e,onMouseMove:r,onMouseLeave:s,className:"relative",style:{perspective:"1200px"},children:i.jsxs("div",{ref:t,className:"relative will-change-transform rounded-2xl overflow-hidden bg-[#0a0d0c] shadow-[0_30px_80px_rgba(0,0,0,0.45),0_0_60px_rgba(103,255,189,0.16)] border border-[#1c2d26]",style:{width:"clamp(280px, 450px, 520px)",aspectRatio:"3/4",transform:`rotateX(${n.rx}deg) rotateY(${n.ry}deg)`,transition:"transform 180ms ease-out"},children:[i.jsx("div",{className:"absolute -inset-[1px] rounded-[30px] pointer-events-none",style:{background:"linear-gradient(130deg, rgba(103,255,189,0.35), transparent 25% 75%, rgba(103,255,189,0.2))",filter:"blur(10px)",opacity:.35}}),i.jsxs("div",{className:"h-14 px-5 flex items-center justify-between bg-[#1b2622] border-b border-[#253730]",children:[i.jsx("div",{className:"text-sm tracking-wide text-[#cfeee0] font-semibold",children:"Hyperliquid Fee Spent Report"}),i.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-black/60 backdrop-blur px-3 py-1.5",children:[i.jsx("img",{src:Yi,alt:"",className:"w-5 h-5"}),i.jsx("span",{className:"text-[12px] tracking-wide font-semibold",children:"DEXTRABOT"})]})]}),i.jsx("div",{className:"px-5 pt-4",children:i.jsxs("div",{className:"relative h-64 rounded-xl overflow-hidden border border-[#2a3c35]",children:[i.jsx("img",{src:o,alt:"","aria-hidden":"true",className:"absolute inset-0 w-full h-full object-cover blur-md scale-110"}),i.jsx("div",{className:"absolute inset-0 bg-black/25"}),i.jsx("img",{src:o,alt:"Dextrabot - Hyperliquid Fee Calculator",className:"relative z-10 w-full h-full object-contain select-none",loading:"eager",decoding:"async",draggable:!1,style:{imageRendering:"-webkit-optimize-contrast"}})]})}),i.jsx("div",{className:"px-5 pb-5 pt-4",children:i.jsxs("div",{className:"relative rounded-2xl border border-[#21342c] bg-gradient-to-b from-[#0d1211] to-[#0a0e0d] p-6",children:[i.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-2xl",style:{boxShadow:"inset 0 0 0 1px rgba(103,255,189,0.08)"}}),i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-[22px] leading-6 font-extrabold text-white/95",children:"TOTAL FEE SPENT"}),i.jsx("div",{className:"mt-2 font-extrabold leading-none",style:{color:"#67FFBD",fontSize:"clamp(32px, 4.4vw, 48px)"},children:c(l)})]}),i.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-xs tracking-wide text-white/70",children:"TRADING FEES"}),i.jsx("div",{className:"text-[20px] font-bold text-white",children:c((a==null?void 0:a.totalFee)||0)})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-xs tracking-wide text-white/70",children:"BUILDER FEES"}),i.jsx("div",{className:"text-[20px] font-bold text-white",children:c((a==null?void 0:a.totalBuilderFee)||0)})]})]}),i.jsxs("div",{className:"mt-5 flex items-center justify-center gap-6 text-[11px] text-white/70 px-2",children:[i.jsxs("div",{className:"whitespace-nowrap",style:{fontStyle:"italic"},children:["Shows Last ",((a==null?void 0:a.totalFills)||0).toLocaleString()," Fills"]}),i.jsxs("div",{className:"flex items-center gap-1 text-white/60 whitespace-nowrap",children:[i.jsx("img",{src:Yi,alt:"",className:"w-3 h-3"}),"Generated by Dextrabot"]}),i.jsxs("div",{className:"whitespace-nowrap",children:["Created on ",d]})]})]})}),i.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[28px] opacity-60 mix-blend-screen",style:{background:`radial-gradient(220px 220px at ${n.gx}% ${n.gy}%, rgba(103,255,189,0.25), transparent 60%)`}})]})})}const XAe=()=>{const{walletAddress:t}=g2(),{setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setIsWhitelist:a,setMushboomerSOL:o,setIsReferralCode:l,setIsReferralCodeName:c,setHyperToken:u,setHyperAddress:d}=m.useContext(Qr);return m.useEffect(()=>{(async()=>{var y,v;const x=window.localStorage.getItem("hyperToken"),g=window.localStorage.getItem("hyperAddress");if(!(!x||!g))try{const C=await ki(g.toLowerCase(),x);C!=null&&C.success?(e(C==null?void 0:C.telegram_chat_id),n(C==null?void 0:C.subscriber_role),r(C==null?void 0:C.subs_expire_day),s((y=C==null?void 0:C.mushboomer_counts)==null?void 0:y.eth),o((v=C==null?void 0:C.mushboomer_counts)==null?void 0:v.sol),l(C==null?void 0:C.referral_code),c(C==null?void 0:C.refcode),a(C==null?void 0:C.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""))}catch(C){console.error("Token verification error:",C)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Copy Trade on Hyperliquid | Mirror Top Traders with Dextrabot"}),i.jsx("meta",{name:"description",content:"Automatically copy trade top-performing Hyperliquid traders with customizable risk parameters. Set position sizing, stop-loss levels, and take-profit targets with Dextrabot's copy trade system."}),i.jsx("meta",{property:"og:title",content:"Copy Trade on Hyperliquid | Mirror Top Traders with Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Automatically copy trade top-performing Hyperliquid traders with customizable risk parameters. Set position sizing, stop-loss levels, and take-profit targets with Dextrabot's copy trade system."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/hyperliquid-fee-calculator "})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full px-4 pt-6 pb-6 sm:px-6 sm:pt-6 sm:pb-6 bg-[#161616] overflow-auto",children:i.jsx("div",{className:"flex flex-col items-stretch justify-start gap-[26px] w-full flex-grow xl:flex-grow-0",children:i.jsx(vwn,{initialWalletAddress:t})})})]})};function Cwn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M1.72 5.47a.75.75 0 0 1 1.06 0L9 11.69l3.756-3.756a.75.75 0 0 1 .985-.066 12.698 12.698 0 0 1 4.575 6.832l.308 1.149 2.277-3.943a.75.75 0 1 1 1.299.75l-3.182 5.51a.75.75 0 0 1-1.025.275l-5.511-3.181a.75.75 0 0 1 .75-1.3l3.943 2.277-.308-1.149a11.194 11.194 0 0 0-3.528-5.617l-3.809 3.81a.75.75 0 0 1-1.06 0L1.72 6.53a.75.75 0 0 1 0-1.061Z",clipRule:"evenodd"},child:[]}]})(t)}function QAe(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15.22 6.268a.75.75 0 0 1 .968-.431l5.942 2.28a.75.75 0 0 1 .431.97l-2.28 5.94a.75.75 0 1 1-1.4-.537l1.63-4.251-1.086.484a11.2 11.2 0 0 0-5.45 5.173.75.75 0 0 1-1.199.19L9 12.312l-6.22 6.22a.75.75 0 0 1-1.06-1.061l6.75-6.75a.75.75 0 0 1 1.06 0l3.606 3.606a12.695 12.695 0 0 1 5.68-4.974l1.086-.483-4.251-1.632a.75.75 0 0 1-.432-.97Z",clipRule:"evenodd"},child:[]}]})(t)}function ZAe(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M15.97 2.47a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H7.5a.75.75 0 0 1 0-1.5h11.69l-3.22-3.22a.75.75 0 0 1 0-1.06Zm-7.94 9a.75.75 0 0 1 0 1.06l-3.22 3.22H16.5a.75.75 0 0 1 0 1.5H4.81l3.22 3.22a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"},child:[]}]})(t)}function JAe(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"},child:[]}]})(t)}function Swn(t){return Pl({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M12 .75a8.25 8.25 0 0 0-4.135 15.39c.686.398 1.115 1.008 1.134 1.623a.75.75 0 0 0 .577.706c.352.083.71.148 1.074.195.323.041.6-.218.6-.544v-4.661a6.714 6.714 0 0 1-.937-.171.75.75 0 1 1 .374-1.453 5.261 5.261 0 0 0 2.626 0 .75.75 0 1 1 .374 1.452 6.712 6.712 0 0 1-.937.172v4.66c0 .327.277.586.6.545.364-.047.722-.112 1.074-.195a.75.75 0 0 0 .577-.706c.02-.615.448-1.225 1.134-1.623A8.25 8.25 0 0 0 12 .75Z"},child:[]},{tag:"path",attr:{fillRule:"evenodd",d:"M9.013 19.9a.75.75 0 0 1 .877-.597 11.319 11.319 0 0 0 4.22 0 .75.75 0 1 1 .28 1.473 12.819 12.819 0 0 1-4.78 0 .75.75 0 0 1-.597-.876ZM9.754 22.344a.75.75 0 0 1 .824-.668 13.682 13.682 0 0 0 2.844 0 .75.75 0 1 1 .156 1.492 15.156 15.156 0 0 1-3.156 0 .75.75 0 0 1-.668-.824Z",clipRule:"evenodd"},child:[]}]})(t)}function Nwn({value:t,onChange:e,options:n=[{value:"extended",label:"Extended"}],activeTextColor:r="#1de674",chevronColor:s="#1de674"}){const[a,o]=m.useState(!1),l=m.useRef(null);m.useEffect(()=>{const u=f=>{l.current&&(l.current.contains(f.target)||o(!1))},d=f=>{f.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",u,!0),document.addEventListener("keydown",d),()=>{document.removeEventListener("pointerdown",u,!0),document.removeEventListener("keydown",d)}},[]);const c=m.useMemo(()=>n.find(u=>String(u.value)===String(t))||n[0]||null,[n,t]);return i.jsxs("div",{className:"relative",ref:l,children:[i.jsxs("div",{onClick:()=>o(u=>!u),className:"h-[32px] px-3 rounded-md flex justify-between items-center cursor-pointer",style:{background:Ro,border:`1px solid ${Ra}`,color:Bi},children:[i.jsx("span",{className:"truncate text-xs font-medium",style:{color:Bi},children:(c==null?void 0:c.label)||"Select"}),i.jsx("span",{className:"ml-2 flex items-center",children:i.jsx("span",{className:"ml-2",children:"▾"})})]}),a&&i.jsx("div",{className:"absolute z-50 mt-1 w-full max-h-[240px] overflow-auto rounded-md p-1",style:{background:Ro,border:`1px solid ${Ra}`},children:n.map(u=>{const d=String(u.value)===String(t);return i.jsx("div",{className:"px-3 py-2 rounded cursor-pointer text-xs font-medium",style:{background:d?"#26313b":"transparent",color:d?"#ffffff":Bi},onClick:()=>{e==null||e(u.value),o(!1)},children:u.label},u.value)})})]})}const zb="#67FFBD",_M="#ff7073",tO="#60A5FA",eje="#A78BFA",Awn="#F97316",jwn={KBONK:"BONK",KPEPE:"PEPE",KSHIB:"SHIB",KFLOKI:"FLOKI",KNEIRO:"NEIRO",KDOGS:"DOGS",KLUNC:"LUNC"},Ewn=new Set(["KBONK","KPEPE","KSHIB"]),_wn="https://app.hyperliquid.xyz/coins",tje={SAFE:{icon:"✅",color:zb,label:"Safe",tooltip:"Order can be safely executed with sufficient collateral buffer"},WARNING:{icon:"⚠️",color:Awn,label:"Warning",tooltip:"Position is approaching liquidation risk, consider reducing leverage or adding collateral"},STOPPED:{icon:"🛑",color:_M,label:"Stopped",tooltip:"Stop loss will trigger before this DCA order executes"},LIQUIDATED:{icon:"💀",color:"#991B1B",label:"Liquidated",tooltip:"Position will be liquidated at this price level"},CANCELLED:{icon:"❌",color:"#6B7280",label:"Cancelled",tooltip:"Order will not execute - position was already closed"},EXCEEDED:{icon:"⛔",color:"#6B7280",label:"Exceeded",tooltip:"Price deviation exceeds 100% - reduce deviation multiplier or number of orders"}},Uh=({children:t,content:e})=>{const[n,r]=m.useState(!1),[s,a]=m.useState({x:0,y:0}),o=m.useRef(null),l=u=>{const d=u.currentTarget.getBoundingClientRect();a({x:d.left+d.width/2,y:d.top}),r(!0)},c=t==null||typeof t=="string"&&t.trim()==="?"?i.jsx("div",{className:"flex items-center has-tooltip relative",children:i.jsx(ji,{className:"text-[#7C7C7C] w-3.5 min-w-3.5 min-h-3.5 h-3.5"})}):t;return i.jsxs("span",{className:"relative inline-flex",children:[i.jsx("span",{ref:o,onMouseEnter:l,onMouseLeave:()=>r(!1),className:"cursor-help transition-colors ml-1 inline-flex",children:c}),n&&i.jsxs("div",{className:"fixed z-50 px-3 py-2 text-xs bg-[#1a1a1a] border border-[#333] rounded-lg shadow-xl max-w-xs text-[#ccc] whitespace-normal",style:{left:s.x,top:s.y-8,transform:"translate(-50%, -100%)"},children:[e,i.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0",style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:"6px solid #333"}})]})]})},ug=({label:t,value:e,onChange:n,min:r,max:s,step:a,suffix:o,tooltip:l,placeholder:c,helperText:u,validate:d,readOnly:f=!1,forceError:x=!1,forceErrorMessage:g=null})=>{const[y,v]=m.useState(!1),C=F=>{const $=parseFloat(F);return d?d($,F):r!==void 0&&!isNaN($)&&$<parseFloat(r)?`Minimum value is ${r}`:s!==void 0&&!isNaN($)&&$>parseFloat(s)?`Maximum value is ${s}`:null},N=F=>{let $=F.target.value;const L=parseFloat($);$!==""&&r!==void 0&&!Number.isNaN(L)&&!Number.isNaN(parseFloat(r))&&L<parseFloat(r)&&($=String(parseFloat(r))),$!==""&&s!==void 0&&!Number.isNaN(L)&&!Number.isNaN(parseFloat(s))&&L>parseFloat(s)&&($=String(parseFloat(s))),n($)},P=()=>{v(!0)},T=C(e),M=x&&(g||T)?g||T:y&&T?T:null;return i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:[t,l&&i.jsx(Uh,{content:l,children:"?"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"number",value:e,onChange:N,onBlur:P,onWheel:F=>F.currentTarget.blur(),min:r,max:s,step:a,readOnly:f,placeholder:c,className:`w-full px-3 py-2 rounded-lg ${f?"bg-[#101010]":"bg-[#161616]"} border text-white text-sm focus:outline-none transition-colors ${M?"border-[#ff7073] focus:border-[#ff7073]":f?"border-[#1c2a24] focus:border-[#1c2a24] cursor-not-allowed":"border-[#1c2a24] focus:border-[#67FFBD]"}`}),o&&i.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#6e857d] text-sm",children:o})]}),M&&i.jsx("p",{className:"text-[10px] text-[#ff7073] px-1",children:M}),u&&!M&&i.jsx("p",{className:"text-[10px] text-[#666] px-1",children:u})]})},kwn=t=>{const e=String(t||"").toUpperCase();return Ewn.has(e)?`1000${e.slice(1)}`:e},Po=(t,e=2)=>{if(t==null||isNaN(t))return"-";const n=Math.abs(t);return n>=1e9?`${(t/1e9).toFixed(2)}B`:n>=1e6?`${(t/1e6).toFixed(2)}M`:n>=1e3?`${(t/1e3).toFixed(2)}K`:t.toFixed(e)},Ob=(t,e=!1)=>t==null||isNaN(t)?"-":t<=0?e?"Safe ✓":"N/A":t>=1e4?`$${t.toFixed(1)}`:t>=1e3?`$${t.toFixed(2)}`:t>=100?`$${t.toFixed(3)}`:t>=10?`$${t.toFixed(4)}`:`$${t.toFixed(5)}`,Twn=t=>t==null||isNaN(t)?"-":`${t.toFixed(2)}%`,Pwn=(t,e)=>{const n=Number(t),r=!Number.isFinite(n)||n<=0?2:n<1e-4?8:n<.01?6:n<1?5:n<10?4:2,s=Number(e);return Math.max(r,Number.isFinite(s)&&s>0?s:0)},jc=t=>String(t||"").toUpperCase().replace(/-USD(T)?$/,"").replace(/\/USD(T)?$/,"").replace(/USD(T)?$/,""),Iwn=(t,e=[])=>{const n=jc(t),r=e.find(s=>{var o;const a=jc(s.symbol||s.rawSymbol||((o=s.raw)==null?void 0:o.symbol)||s.market||"");return a===n||a===`${n}USDT`||a===`${n}USD`||a===n.replace(/USD$/,"")});return r?r.market_index??r.marketIndex??r.market_id??r.marketId??r.id??null:null},Fwn=(t,e=[])=>{const n=jc(t);return e.find(r=>{var a;const s=jc(r.symbol||r.rawSymbol||((a=r.raw)==null?void 0:a.symbol)||r.market||"");return s===n||s===`${n}USDT`||s===`${n}USD`||s===n.replace(/USD$/,"")})||null},Own=({value:t,onChange:e,min:n=1,max:r=100,tooltip:s})=>{const a=(t-n)/(r-n)*100,o=l=>{const c=l.target.value;if(c===""){e("1");return}const u=parseInt(c);isNaN(u)||e(String(Math.min(r,Math.max(n,u))))};return i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:["Leverage",s&&i.jsx(Uh,{content:s,children:"?"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex-1 relative",children:[i.jsx("div",{className:"h-1.5 bg-[#1c2a24] rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#67FFBD] rounded-full transition-all",style:{width:`${a}%`}})}),i.jsx("input",{type:"range",min:n,max:r,value:t,onChange:l=>e(l.target.value),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"}),i.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 w-3.5 h-3.5 bg-[#67FFBD] rounded-full border-2 border-[#101010] pointer-events-none transition-all",style:{left:`calc(${a}% - 7px)`}})]}),i.jsxs("div",{className:"flex items-center bg-[#161616] border border-[#1c2a24] rounded-lg overflow-hidden",children:[i.jsx("input",{type:"number",value:t,onChange:o,onWheel:l=>l.currentTarget.blur(),min:n,max:r,className:"w-12 px-2 py-1.5 bg-transparent text-white text-sm text-center focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"}),i.jsx("span",{className:"pr-2 text-[#6e857d] text-sm",children:"x"})]})]})]})},nje=({className:t="",entryPrice:e,onEntryPriceChange:n,maxBudget:r,onBudgetChange:s})=>i.jsxs("div",{className:`bg-[#0f0f0f] border border-[#2b3640] rounded-lg px-3 py-2 flex items-center gap-3 text-xs text-[#cfd4db] whitespace-nowrap overflow-x-auto ${t}`,children:[i.jsxs("div",{className:"flex items-center gap-2 text-white font-semibold",children:[i.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-[#1b2630] text-[#67FFBD]",children:"i"}),i.jsx("span",{children:"Preview Mode"})]}),i.jsxs("div",{className:"flex-1 flex justify-center items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#cfd4db] text-xs",children:"Entry Price:"}),i.jsx("input",{type:"number",value:e,onChange:a=>n==null?void 0:n(a.target.value.replace(",",".")),step:"0.000001",inputMode:"decimal",className:"h-8 px-3 rounded-lg bg-[#161616] border border-[#1c2a24] text-white text-xs focus:outline-none focus:border-[#67FFBD] w-28",placeholder:"0.000000"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#cfd4db] text-xs",children:"Budget:"}),i.jsx("input",{type:"number",value:r,onChange:a=>s==null?void 0:s(a.target.value.replace(",",".")),step:"1",inputMode:"decimal",className:"h-8 px-3 rounded-lg bg-[#161616] border border-[#1c2a24] text-white text-xs focus:outline-none focus:border-[#67FFBD] w-28",placeholder:"0"})]})]}),i.jsxs("div",{className:"flex items-center gap-2 text-[#facc15] ml-auto",children:[i.jsx("span",{children:"⚠️"}),i.jsx("span",{className:"text-[11px] text-[#cfd4db]",children:"Calculator only (preview)"})]})]});function Mwn(){var un;const t=tfe(),e=t.length===0,n=nfe(),r=n.length===0,[s,a]=m.useState("extended"),[o,l]=m.useState([]),[c,u]=m.useState(50),[d,f]=m.useState({}),[x,g]=m.useState("extended"),[y,v]=m.useState("BTC"),[C,N]=m.useState(""),[P,T]=m.useState("long"),[M,F]=m.useState("10"),[$,L]=m.useState("5"),[z,X]=m.useState("10"),[ne,J]=m.useState("10"),[K,te]=m.useState("1500"),[fe,q]=m.useState(!1),[se,ae]=m.useState("1"),[W,V]=m.useState(""),[ee,oe]=m.useState(!0),[de,Ce]=m.useState("0.50"),[me,we]=m.useState("1.1"),[xe,be]=m.useState("1"),[je,Ie]=m.useState(!0),[Re,Qe]=m.useState(!0),[Ke,dt]=m.useState(!0),[tt,nt]=m.useState(!0),[Le,Be]=m.useState("details"),[ht,pt]=m.useState([]),[Gt,wt]=m.useState(!1),[nn,cn]=m.useState([]),[Un,Xt]=m.useState(!1),[an,Jt]=m.useState(null),[Ye,Je]=m.useState(!1),[It,hn]=m.useState({}),[Yt,Rt]=m.useState({}),[ot,De]=m.useState(null),At=m.useRef(!1),ze=m.useRef(!0),rt=m.useRef(0),mt=s==="extended"?n:t,Lt=s==="extended"?r:e,kt=s==="extended"?"extended_selected_wallet_id":"lighter_selected_wallet_id",dn=m.useMemo(()=>`dca_last_coin_${s}`,[s]),rn=m.useMemo(()=>`dca_settings_${s}`,[s]),gn=m.useMemo(()=>({baseOrderMargin:"5",dcaOrderMargin:"10",maxDcaOrders:"10",tpTarget:"1",stopLoss:"",priceDeviation:"0.50",dcaSizeMultiplier:"1.1",priceDevMultiplier:"1"}),[]);m.useEffect(()=>{if(typeof window>"u")return;const Xe=window.localStorage.getItem(rn),Pt={...gn};if(Xe)try{const Wt=JSON.parse(Xe)||{};Object.keys(gn).forEach(ct=>{Wt[ct]!==void 0&&Wt[ct]!==null&&(Pt[ct]=String(Wt[ct]))})}catch{}L(Pt.baseOrderMargin),X(Pt.dcaOrderMargin),J(Pt.maxDcaOrders),ae(Pt.tpTarget),V(Pt.stopLoss),Ce(Pt.priceDeviation),we(Pt.dcaSizeMultiplier),be(Pt.priceDevMultiplier)},[rn,gn]),m.useEffect(()=>{if(typeof window>"u")return;const Xe={baseOrderMargin:$,dcaOrderMargin:z,maxDcaOrders:ne,tpTarget:se,stopLoss:W,priceDeviation:de,dcaSizeMultiplier:me,priceDevMultiplier:xe};try{window.localStorage.setItem(rn,JSON.stringify(Xe))}catch{}},[rn,$,z,ne,se,W,de,me,xe]);const An=m.useMemo(()=>{const Xe=new Map;return o.forEach(Pt=>{const Wt=jc(Pt.value||Pt.label||Pt.symbol||Pt.coin);if(!Wt)return;const ct=Pt.maxLeverage??Pt.max_leverage??Pt.leverage??null,Ge=Number(ct);Xe.set(Wt,Number.isFinite(Ge)?Ge:null)}),Xe},[o]),kn=m.useMemo(()=>mt.map(Xe=>{var Ge,Tt,fn;const Pt=jc(Xe.symbol||Xe.rawSymbol||((Ge=Xe.raw)==null?void 0:Ge.symbol)||Xe.market||Xe.coin),Wt=Xe.leverage??Xe.maxLeverage??Xe.max_leverage??(Pt?An.get(Pt):null),ct=Number.isFinite(Number(Wt))&&Number(Wt)>0?Number(Wt):null;return{...Xe,symbol:Xe.symbol||((Tt=Xe.raw)==null?void 0:Tt.symbol)||Xe.rawSymbol||Xe.market||"",rawSymbol:Xe.rawSymbol||((fn=Xe.raw)==null?void 0:fn.symbol)||Xe.symbol,leverage:ct,maxLeverage:Xe.maxLeverage??Xe.max_leverage??ct}}),[mt,An]),yn="https://dextrabothypev2.nftinit.io/api/hyper/dca_bot",{setSignModalOpen:Vn,hyperToken:Kn,hyperAddress:Dn}=m.useContext(Qr),[Xn,Nn]=m.useState({address:null,token:null}),on=m.useCallback(()=>Xn,[Xn]),[Oe,Zt]=m.useState(!1),sn=Xe=>{if(!Xe)return null;const Pt=String(Xe);return Pt==="null"||Pt==="undefined"?null:Pt};m.useEffect(()=>{const Xe=()=>{if(typeof window>"u")return;const Wt=sn(Dn||window.localStorage.getItem("hyperAddress")),ct=sn(Kn||window.localStorage.getItem("hyperToken"));Nn({address:Wt,token:ct}),(!Wt||!ct)&&(Zt(!1),cn([]),Jt(null),rt.current=0)};Xe(),window.addEventListener("localStorageUpdated",Xe),window.addEventListener("storage",Xe);const Pt=setInterval(()=>{if(typeof window>"u")return;const Wt=sn(Dn||window.localStorage.getItem("hyperAddress")),ct=sn(Kn||window.localStorage.getItem("hyperToken"));Nn(Ge=>Ge.address===Wt&&Ge.token===ct?Ge:{address:Wt,token:ct}),(!Wt||!ct)&&(Zt(!1),cn([]),Jt(null),rt.current=0)},1500);return()=>{window.removeEventListener("localStorageUpdated",Xe),window.removeEventListener("storage",Xe),clearInterval(Pt)}},[Kn,Dn]),m.useEffect(()=>{const Xe=!!Xn.token,Pt=!!Xn.address;Zt(Xe&&Pt)},[Xn]),m.useEffect(()=>()=>{ze.current=!1},[]);const jt=m.useCallback(async()=>{if(At.current)return;const Xe=Xn.address,Pt=Xn.token;if(!Xe||!Pt){At.current=!1,Xt(!1);return}const Wt=Date.now();if(!(Wt-rt.current<4500)){rt.current=Wt,At.current=!0,Xt(!0);try{let ct=[];const Tt=await(await fetch("https://dextrabothypev2.nftinit.io/api/wallet/list-extended",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Xe.toLowerCase(),token:Pt,balance:"true"})})).json().catch(()=>null);if(!ze.current||!Tt){At.current=!1,Xt(!1);return}let fn=[];if(Array.isArray(Tt)?fn=Tt:Array.isArray(Tt==null?void 0:Tt.data)&&(fn=Tt.data),ct=await Promise.all(fn.map(async(Fn,Gn)=>{var Sn,Mn,rr;let Sr=null;const ur=Number(Fn.available_balance??Fn.availableForTrade??Fn.available_for_trade??Fn.balance??Fn.available??null);Number.isFinite(ur)&&(Sr=ur);const kr=Fn.wallet_id??Fn.id??Gn,Bn=Fn.wallet_api_key||Fn.api_key||null;if(Bn&&Sr==null)try{const ls=`https://express-proxy-delta.vercel.app/proxy?url==${encodeURIComponent("https://api.starknet.extended.exchange/api/v1/user/balance")}`,et=await(await fetch(ls,{headers:{"X-Api-Key":Bn}})).json().catch(()=>null),gt=((Sn=et==null?void 0:et.data)==null?void 0:Sn.availableForTrade)??(et==null?void 0:et.availableForTrade)??((Mn=et==null?void 0:et.data)==null?void 0:Mn.available_balance)??(et==null?void 0:et.available_balance)??((rr=et==null?void 0:et.data)==null?void 0:rr.available)??(et==null?void 0:et.available),Tn=Number(gt);Number.isFinite(Tn)&&Tn>=0&&(Sr=Tn)}catch{}return{wallet_id:kr,wallet_address:Fn.wallet_address||Fn.address||"",wallet_name:Fn.wallet_name||Fn.name||`Extended Wallet ${Gn+1}`,available_balance:Sr,wallet_api_key:Bn}})),!ze.current)return;cn(ct),ct.length>0?Jt(Fn=>{const Gn=typeof window<"u"?window.localStorage.getItem(kt):null,Sr=(Fn==null?void 0:Fn.id)??Gn,ur=Sr&&ct.find(kr=>String(kr.wallet_id)===String(Sr))||ct[0];return ur?{id:ur.wallet_id,address:ur.wallet_address,apiKey:ur.wallet_api_key}:null}):Jt(null)}catch(ct){console.error("Error loading wallets:",ct),ze.current&&cn([])}finally{At.current=!1,ze.current&&Xt(!1)}}},[Xn.address,Xn.token,s,kt]);m.useEffect(()=>{Oe&&jt()},[Oe,jt]),m.useEffect(()=>{Xn.address&&Xn.token?(Zt(!0),jt()):(Zt(!1),cn([]),Jt(null),rt.current=0)},[Xn.address,Xn.token,jt]),m.useEffect(()=>{const Xe=()=>jt();return window.addEventListener("localStorageUpdated",Xe),window.addEventListener("storage",Xe),()=>{window.removeEventListener("localStorageUpdated",Xe),window.removeEventListener("storage",Xe)}},[jt]),m.useEffect(()=>{rt.current=0,cn([]),Jt(null),De(null)},[s]),m.useEffect(()=>{q(!1)},[an==null?void 0:an.id,s]);const Qn=m.useMemo(()=>{if(!an||!an.id)return null;const Xe=nn.find(Wt=>String(Wt.wallet_id)===String(an.id));if(!Xe)return null;if(s==="extended"&&an.apiKey){const Wt=Number(ot==null?void 0:ot.availableForTrade);if(Number.isFinite(Wt))return Wt}const Pt=Number(Xe.available_balance??Xe.availableForTrade??Xe.available_for_trade??Xe.balance??Xe.available??null);return Number.isFinite(Pt)?Pt:null},[nn,an,s,ot]),bn=m.useCallback(async()=>{const Xe=Xn.address,Pt=Xn.token;if(!Xe||!Pt){pt([]);return}wt(!0);try{const ct=await(await fetch(`${yn}/info/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Xe.toLowerCase(),token:Pt,source_market:s})})).json().catch(()=>null),Tt=(Array.isArray(ct==null?void 0:ct.data)?ct.data:ct!=null&&ct.data?[ct.data]:[]).filter(fn=>fn?s?String(fn.source_market||"").toLowerCase()===String(s||"").toLowerCase()?!0:s==="hyper"&&!fn.source_market:!0:!1);pt(Tt)}catch(Wt){console.error("Error loading bots:",Wt),pt([])}finally{wt(!1)}},[on,yn,s]);m.useEffect(()=>{bn()},[bn,Xn.address,Xn.token,s]);const Dt=m.useCallback(async()=>{var Wt,ct;const{address:Xe,token:Pt}=on();if(!Xe||!Pt||!an||!an.id){tn.error("Please connect your wallet and select a wallet.");return}Je(!0);try{const Ge=(Wt=y==null?void 0:y.toUpperCase())==null?void 0:Wt.trim(),Tt=kwn(Ge);let fn=null;if(s==="lighter")try{const sr=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(sr!=null&&sr.funding_rates&&Array.isArray(sr.funding_rates)){const Tr=sr.funding_rates.find(Lr=>String(Lr.symbol||"").toUpperCase().trim()===Ge);console.log("coinRate",Tr),Tr&&Tr.market_id!=null?(fn=Tr.market_id,console.log(`✅ Found market_id ${fn} for coin ${Ge} from funding-rates API (exchange: ${Tr.exchange})`)):(console.warn(`❌ Coin ${Ge} not found in funding-rates API`),console.log("Sample available symbols:",sr.funding_rates.slice(0,20).map(Lr=>Lr.symbol)))}else console.warn("No funding_rates array in API response")}catch(Tn){console.error("Error fetching funding-rates API:",Tn),fn=d[Ge]||null,fn&&console.log(`Using cached market_id ${fn} for coin ${Ge}`)}if(fn===null){if(s==="extended"&&(!mt||!mt.length)){tn.error("Extended markets are loading. Please try again in a moment."),Je(!1);return}fn=Iwn(y,mt)}if(fn===null&&s!=="extended"){console.error("Market not found for coin:",Ge),tn.error(`Unable to find market index for ${Ge}. Please make sure the coin is available on ${s}.`),Je(!1);return}fn!=null&&console.log(`Using market_index: ${fn} for coin: ${Ge}`);const Yn=nn.find(Tn=>String(Tn.wallet_id)===String(an.id));if(!Yn||!Yn.wallet_id){tn.error("Unable to find selected wallet. Please select a wallet again."),Je(!1);return}const Fn=Math.max(1,Math.min(Number(c)||100,Number(M)||1)),Gn=Fwn(y,mt),Sr=String(y||"").toUpperCase(),ur=Number((Gn==null?void 0:Gn.maxLeverage)??(Gn==null?void 0:Gn.leverage)??(Gn==null?void 0:Gn.max_leverage)??c??0),kr=s==="extended"&&ur>0?Math.min(ur,Fn||ur):Fn,Bn=parseFloat(se)||0,Sn=Number(C)||Number(Gn==null?void 0:Gn.markPrice)||Number(Gn==null?void 0:Gn.lastPrice)||Number(Gn==null?void 0:Gn.last)||null,Mn=Number(((ct=Gn==null?void 0:Gn.tradingConfig)==null?void 0:ct.minOrderSize)??(Gn==null?void 0:Gn.minOrderSize)),rr=Number.isFinite(Mn)&&Mn>0&&Number.isFinite(Sn)&&Sn>0?Mn*Sn:null;if(s==="extended"&&rr!=null){const Tn=parseFloat($)||0,sr=parseFloat(z)||0,Tr=Tn*kr,Lr=sr*kr;if(Tr<rr||Lr<rr){const $r=[];Tr<rr&&$r.push("Base Order"),Lr<rr&&$r.push("DCA Order");const lr=$r.length===1?` (${$r[0]})`:$r.length===2?" (Base Order & DCA Order)":"";tn.error(`Minimum order size for ${Sr} is $${rr.toFixed(2)}${lr}. Increase order size or leverage.`),Je(!1);return}}const ls={direction:P,leverage:kr,base_amount_usd:parseFloat($)||0,safety_amount_usd:parseFloat(z)||0,max_safety_orders:parseInt(ne)||0,price_deviation:parseFloat(de)||.5,step_scale:parseFloat(xe)||1,volume_scale:parseFloat(me)||1.5,tp_percent:Bn,stop_loss_percent:W?parseFloat(W):0};s!=="extended"&&fn!=null&&(ls.market_index=Number.isFinite(Number(fn))?Number(fn):fn);const cs={address:Xe.toLowerCase(),token:Pt,wallet_id:Yn.wallet_id,source_market:s,bot_params:ls,coin:Tt};console.log("DCA Bot API Request:",JSON.stringify(cs,null,2));const gt=await(await fetch(`${yn}/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(cs)})).json().catch(()=>null);gt!=null&>.success?(tn.success("DCA Bot started successfully!"),await bn(),Be("bots")):tn.error((gt==null?void 0:gt.error_message)||"Failed to start bot. Please try again.")}catch(Ge){console.error("Error starting bot:",Ge),tn.error("Error starting bot. Please try again.")}finally{Je(!1)}},[on,an,s,y,mt,d,nn,P,M,$,z,ne,de,me,xe,se,W,bn,yn]);m.useCallback(async Xe=>{const{address:Pt,token:Wt}=on();if(!Pt||!Wt||!an||!an.id){tn.error("Please connect your wallet and select a wallet.");return}const ct=nn.find(Ge=>String(Ge.wallet_id)===String(an.id));if(!ct||!ct.wallet_id){tn.error("Unable to find selected wallet. Please select a wallet again.");return}hn(Ge=>({...Ge,[Xe]:!0}));try{const Tt=await(await fetch(`${yn}/stop/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:Wt,wallet_id:ct.wallet_id,source_market:s,coin:y})})).json().catch(()=>null);Tt!=null&&Tt.success?await bn():tn.error((Tt==null?void 0:Tt.error_message)||"Failed to stop bot. Please try again.")}catch(Ge){console.error("Error stopping bot:",Ge),tn.error("Error stopping bot. Please try again.")}finally{hn(Ge=>({...Ge,[Xe]:!1}))}},[on,an,s,y,nn,bn,yn]);const en=m.useCallback(async(Xe,Pt,Wt={})=>{const{address:ct,token:Ge}=on();if(!ct||!Ge){tn.error("Please connect your wallet.");return}hn(Tt=>({...Tt,[Xe]:!0})),pt(Tt=>Tt.map(fn=>fn.id===Xe||fn.bot_id===Xe?{...fn,is_deleted:Pt,...Wt}:fn));try{const fn=await(await fetch(`${yn}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:ct.toLowerCase(),token:Ge,bot_id:Xe,update_params:{is_deleted:Pt,...Wt}})})).json().catch(()=>null);if(fn!=null&&fn.success)await bn(),Pt&&tn.success("DCA Bot has been stopped.");else{await bn();const Yn=(fn==null?void 0:fn.error_message)||(fn==null?void 0:fn.message)||(fn==null?void 0:fn.detail)||(fn==null?void 0:fn.error),Fn=Pt?"Failed to stop bot. Please try again.":"Cannot start this bot. Another bot for this coin may already be active. Stop it first or choose a different coin.";tn.error(Yn||Fn)}}catch(Tt){console.error("Error updating bot:",Tt),await bn(),tn.error(Pt?"Failed to stop bot. Please try again.":"Cannot start this bot. Another bot for this coin may already be active. Stop it first or choose a different coin.")}finally{hn(Tt=>({...Tt,[Xe]:!1}))}},[on,bn,yn]);m.useCallback(async Xe=>{const{address:Pt,token:Wt}=on();if(!Pt||!Wt){tn.error("Please connect your wallet.");return}if(confirm("Are you sure you want to delete this bot? This action cannot be undone.")){Rt(ct=>({...ct,[Xe]:!0})),pt(ct=>ct.filter(Ge=>Ge.id!==Xe&&Ge.bot_id!==Xe));try{const ct=await fetch(`${yn}/update/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:Wt,bot_id:Xe,update_params:{permanent_delete:!0,is_deleted:!0}})}),Ge=await ct.json().catch(()=>null);if(console.log("Delete bot response:",Ge),console.log("Response status:",ct.status),Ge!=null&&Ge.success)await bn();else{console.log("Trying delete endpoint as fallback...");const Tt=await fetch(`${yn}/delete/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:Pt.toLowerCase(),token:Wt,bot_id:Xe})}),fn=await Tt.json().catch(()=>null);if(console.log("Delete endpoint response:",fn),fn!=null&&fn.success)await bn();else{await bn();const Yn=(fn==null?void 0:fn.error_message)||(Ge==null?void 0:Ge.error_message)||(fn==null?void 0:fn.message)||(Ge==null?void 0:Ge.message)||(fn==null?void 0:fn.detail)||(Ge==null?void 0:Ge.detail)||`Failed to delete bot. Status: ${Tt.status||ct.status}`;console.error("Delete bot error:",Yn,{data:Ge,deleteData:fn}),tn.error(Yn)}}}catch(ct){console.error("Error deleting bot:",ct),await bn(),tn.error(`Error deleting bot: ${ct.message||"Please try again."}`)}finally{Rt(ct=>({...ct,[Xe]:!1}))}}},[on,bn,yn]),m.useEffect(()=>{let Xe=!1;async function Pt(){try{const ct=await(await fetch("https://mainnet.zklighter.elliot.ai/api/v1/funding-rates")).json().catch(()=>null);if(Xe||!(ct!=null&&ct.funding_rates))return;const Ge={};ct.funding_rates.filter(Tt=>Tt.exchange==="lighter").forEach(Tt=>{if(Tt.symbol&&Tt.market_id!=null){const fn=String(Tt.symbol).toUpperCase().trim();Ge[fn]=Tt.market_id}}),Xe||(f(Ge),console.log(`✅ Loaded ${Object.keys(Ge).length} market IDs from funding-rates API for lighter exchange`))}catch(Wt){console.error("Error loading market IDs from funding-rates API:",Wt),Xe||f({})}}return Pt(),()=>{Xe=!0}},[]),m.useEffect(()=>{let Xe=!1;async function Pt(){try{const ct=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=lighter_fr")).json().catch(()=>null);if(Xe)return;let Ge=[];Array.isArray(ct)?Ge=ct:Array.isArray(ct==null?void 0:ct.data)?Ge=ct.data:Array.isArray(ct==null?void 0:ct.coins)&&(Ge=ct.coins);const Tt=Ge.map(fn=>({value:String(fn.value||fn.label||fn.symbol||fn.coin||"").toUpperCase(),label:fn.label||fn.value||fn.symbol||fn.coin,maxLeverage:fn.maxLeverage||50}));Xe||l(Tt)}catch{Xe||l([])}}return Pt(),()=>{Xe=!0}},[]),m.useEffect(()=>{var Yn;if(!mt.length)return;const Xe=jc(y);if(Xe?mt.some(Fn=>jc(Fn.symbol)===Xe):!1)return;const Wt=typeof window<"u"?window.localStorage.getItem(dn):null,ct=jc(Wt),Ge=Wt&&ct?mt.some(Fn=>jc(Fn.symbol)===ct):!1,Tt=mt[0],fn=Ge?ct:jc((Tt==null?void 0:Tt.symbol)||((Yn=Tt==null?void 0:Tt.raw)==null?void 0:Yn.symbol)||(Tt==null?void 0:Tt.rawSymbol));v(fn||"BTC")},[mt,y,dn]);const Pn=m.useMemo(()=>{const Xe=jc(y);return Xe&&(mt.find(Pt=>jc(Pt.symbol)===Xe)||mt.find(Pt=>{var Wt;return jc(((Wt=Pt.raw)==null?void 0:Wt.symbol)||Pt.rawSymbol)===Xe}))||null},[mt,y]),tr=m.useMemo(()=>{const Xe=jc(y);if(!Xe)return null;const Pt=jwn[Xe]||Xe;return(Pn==null?void 0:Pn.kind)==="hip3"&&(Pn!=null&&Pn.builder)?`${Pn.builder}:${Pt}`:Pt},[y,Pn]),ar=m.useMemo(()=>{const Xe=jc(y);return Xe&&ht.find(Pt=>{var ct,Ge;const Wt=jc(Pt.coin||Pt.symbol||((ct=Pt.bot_params)==null?void 0:ct.coin)||((Ge=Pt.bot_params)==null?void 0:Ge.symbol));return!Pt.is_deleted&&Wt===Xe})||null},[ht,y]),hr=m.useMemo(()=>{const Xe=ht.filter(Wt=>!Wt.is_deleted),Pt=ht.filter(Wt=>Wt.is_deleted);return[...Xe,...Pt]},[ht]),qt=Number(C)||Number(Pn==null?void 0:Pn.markPrice)||Number(Pn==null?void 0:Pn.lastPrice)||Number(Pn==null?void 0:Pn.last)||null,zn=Number(((un=Pn==null?void 0:Pn.tradingConfig)==null?void 0:un.minOrderSize)??(Pn==null?void 0:Pn.minOrderSize)),Zn=s==="extended"&&Number.isFinite(zn)&&zn>0&&Number.isFinite(qt)&&qt>0?zn*qt:null,Ft=Math.max(1,Number(M)||1),En=parseFloat($)||0,Ee=parseFloat(z)||0,h=En*Ft,p=Ee*Ft,S=s==="extended"&&Zn!=null&&h<Zn,_=s==="extended"&&Zn!=null&&p<Zn,k=S||_,I=Xe=>{if(Zn==null||!Number.isFinite(Ft)||Ft<=0)return"Minimum order size not met";const Pt=Zn/Ft,Wt=Math.abs(Ft-Math.round(Ft))<1e-6?Math.round(Ft):Number(Ft.toFixed(2));return`${Xe} must be at least $${Pt.toFixed(2)} (min. $${Zn.toFixed(2)} notional ÷ ${Wt}x leverage)`};m.useEffect(()=>{const Xe=o.find(ct=>ct.value===y),Pt=s==="extended"?(Pn==null?void 0:Pn.maxLeverage)??(Pn==null?void 0:Pn.leverage)??(Pn==null?void 0:Pn.max_leverage)??50:Xe==null?void 0:Xe.maxLeverage,Wt=Number(Pt);Number.isFinite(Wt)&&Wt>0&&(u(Wt),F(ct=>{const Ge=parseInt(ct)||1;return String(Math.min(Wt,Math.max(1,Ge)))}))},[y,o,Pn,s]),m.useEffect(()=>{if(s!=="extended"||!(an!=null&&an.apiKey)){De(null);return}let Xe=!1;const Pt=async()=>{var ct,Ge,Tt,fn;try{const Yn=`https://express-proxy-delta.vercel.app/proxy?url=${encodeURIComponent("https://api.starknet.extended.exchange/api/v1/user/balance")}`,Gn=await(await fetch(Yn,{headers:{"X-Api-Key":an.apiKey}})).json().catch(()=>null);if(Xe)return;const Sr=((ct=Gn==null?void 0:Gn.data)==null?void 0:ct.availableForTrade)??(Gn==null?void 0:Gn.availableForTrade)??((Ge=Gn==null?void 0:Gn.data)==null?void 0:Ge.available_balance)??(Gn==null?void 0:Gn.available_balance)??((Tt=Gn==null?void 0:Gn.data)==null?void 0:Tt.available)??(Gn==null?void 0:Gn.available),ur=Number(Sr),kr=((fn=Gn==null?void 0:Gn.data)==null?void 0:fn.equity)??(Gn==null?void 0:Gn.equity),Bn=Number(kr);De({availableForTrade:Number.isFinite(ur)&&ur>=0?ur:null,equity:Number.isFinite(Bn)?Bn:null,raw:Gn})}catch{Xe||De(null)}};Pt();const Wt=setInterval(Pt,2e4);return()=>{Xe=!0,clearInterval(Wt)}},[s,an==null?void 0:an.apiKey]),m.useEffect(()=>{if(s!=="extended")return;const Xe=ot==null?void 0:ot.equity;Number.isFinite(Xe)&&!fe&&te(String(Xe))},[ot==null?void 0:ot.equity,s,fe]);const B=m.useRef(y),G=m.useRef(!1);m.useEffect(()=>{const Xe=B.current!==y,Pt=!G.current&&!C;if((Xe||Pt)&&(Pn!=null&&Pn.last)&&Pn.last>0){B.current=y,G.current=!0;const Wt=Pwn(Pn.last,Pn.priceDecimals);N(Number(Pn.last).toFixed(Wt))}},[y,Pn==null?void 0:Pn.last,C]);const re=m.useCallback(Xe=>{const Pt=jc(Xe);v(Pt),typeof window<"u"&&window.localStorage.setItem(dn,Pt)},[dn]),ce=m.useCallback(Xe=>{q(!0),te(Xe)},[]),ue=m.useCallback(Xe=>{N(Xe)},[]),ge=Lt,Ae=P==="smart",ke=m.useCallback(Xe=>{const Pt=parseFloat(M)||10,Wt=.6/Pt,ct=parseFloat(C)||0,Ge=parseFloat($)||0,Tt=parseFloat(z)||0,fn=parseInt(ne)||0,Yn=parseFloat(K)||1/0,Fn=parseFloat(de)||0,Gn=parseFloat(me)||1.1,Sr=parseFloat(xe)||1,ur=parseFloat(se)||0,kr=parseFloat(W)||100,Bn=Xe==="smart",Sn=Xe==="long";if(Bn)return{orders:[],metrics:null};if(ct<=0||Ge<=0)return{orders:[],metrics:null};let Mn=Ge;for(let ln=1;ln<=fn;ln++)Mn+=Tt*Math.pow(Gn,ln-1);const rr=[];let ls=0,cs=0,et=0,gt=0,Tn=0,sr=0,Tr=!1,Lr=null;const $r=Yn,lr=Ge*Pt,wr=lr/ct;ls=Ge,cs=lr,et=wr,ls>Yn&&(Tr=!0,Lr=0);const ss=Sn?(ct*et-$r)/(et*(1-Wt)):($r+ct*et)/(et*(1+Wt)),mr=Sn?ct*(1+ur/100):ct*(1-ur/100);let es="SAFE";ss<=0||(Sn&&ss>=ct||!Sn&&ss<=ct)&&(es="LIQUIDATED"),Tr&&(es="WARNING",sr++);const Ys=wr*ct*Wt,_s=$r/Ys,br=Sn?(mr-ct)*wr:(ct-mr)*wr;rr.push({label:"Base",deviation:0,price:ct,margin:Ge,positionValue:lr,coins:wr,totalCoins:wr,totalMargin:ls,avgEntry:ct,tpPrice:mr,tpProfit:br,liqPrice:ss,healthRatio:_s,status:es});let zt=!1,he=ss,it=ct,Ct=mr;for(let ln=1;ln<=fn;ln++){ln===1?gt=Fn:gt+=Fn*Math.pow(Sr,ln-1);const xn=Sn?ct*(1-gt/100):ct*(1+gt/100);if(zt){rr.push({label:`DCA ${ln}`,deviation:gt,price:xn,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:"CANCELLED"});continue}if(xn<=0){zt=!0,rr.push({label:`DCA ${ln}-${fn}`,deviation:gt,price:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:"EXCEEDED",exceededCount:fn-ln+1,isLong:Sn});break}const dr=Tt*Math.pow(Gn,ln-1),Er=dr*Pt,pr=Er/xn,fr=ls+dr;fr>Yn&&!Tr&&(Tr=!0,Lr=ln),ls=fr,cs+=Er,et+=pr;const Yr=cs/et,is=Sn?(Yr*et-$r)/(et*(1-Wt)):($r+Yr*et)/(et*(1+Wt));if(Sn?is>0&&xn<=is:is>0&&xn>=is){zt=!0,rr.push({label:"💀 Liq",deviation:null,price:he,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:it,tpPrice:Ct,tpProfit:null,liqPrice:he,healthRatio:null,status:"LIQUIDATED"});for(let Bt=ln;Bt<=fn;Bt++){let nr=0;for(let Pr=1;Pr<=Bt;Pr++)Pr===1?nr=Fn:nr+=Fn*Math.pow(Sr,Pr-1);const Wn=Sn?ct*(1-nr/100):ct*(1+nr/100),Or=Wn>0;rr.push({label:`DCA ${Bt}`,deviation:nr,price:Or?Wn:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:Or?"CANCELLED":"EXCEEDED"})}break}const yr=Sn?is>=Yr:is<=Yr,Jn=Sn?Yr*(1+ur/100):Yr*(1-ur/100),gs=kr>=100?null:Sn?Yr*(1-kr/100):Yr*(1+kr/100),Zs=Sn?(xn-Yr)*et:(Yr-xn)*et,oi=$r+Zs,Fr=et*xn*Wt,wn=oi/Fr;let On="SAFE";if(yr){zt=!0,rr.push({label:`DCA ${ln}`,deviation:gt,price:xn,margin:dr,positionValue:Er,coins:pr,totalCoins:et,totalMargin:ls,avgEntry:Yr,tpPrice:null,tpProfit:null,liqPrice:is,healthRatio:null,status:"LIQUIDATED"});for(let Bt=ln+1;Bt<=fn;Bt++){let nr=0;for(let Pr=1;Pr<=Bt;Pr++)Pr===1?nr=Fn:nr+=Fn*Math.pow(Sr,Pr-1);const Wn=Sn?ct*(1-nr/100):ct*(1+nr/100),Or=Wn>0;rr.push({label:`DCA ${Bt}`,deviation:nr,price:Or?Wn:null,margin:null,positionValue:null,coins:null,totalCoins:null,totalMargin:null,avgEntry:null,tpPrice:null,tpProfit:null,liqPrice:null,healthRatio:null,status:Or?"CANCELLED":"EXCEEDED"})}break}else gs!==null&&(Sn&&xn<=gs||!Sn&&xn>=gs)?(On="STOPPED",zt=!0):wn<1.5?(On="WARNING",sr++):Tn++;const lt=Sn?(Jn-Yr)*et:(Yr-Jn)*et;he=is,it=Yr,Ct=Jn,rr.push({label:`DCA ${ln}`,deviation:gt,price:xn,margin:dr,positionValue:Er,coins:pr,totalCoins:et,totalMargin:ls,avgEntry:Yr,tpPrice:Jn,tpProfit:lt,liqPrice:is,healthRatio:wn,status:On})}const vt=[...rr].reverse().find(ln=>ln.status!=="CANCELLED")||rr[rr.length-1];return{orders:rr,metrics:{totalMargin:ls,totalPositionValue:cs,liquidationPrice:vt.liqPrice,breakEvenPrice:vt.avgEntry,safeCount:Tn,warningCount:sr,budgetOk:!Tr,budgetExceededAt:Lr,leverage:Pt,requiredBudget:Mn}}},[C,M,$,z,ne,K,de,me,xe,se,W]),Me=m.useMemo(()=>ke(P),[ke,P]),qe=m.useMemo(()=>Me.orders.filter(Xe=>Xe.status!=="CANCELLED").map(Xe=>({name:Xe.label,orderPrice:je&&Xe.price!=null&&Xe.price>0?Xe.price:null,avgEntry:Re&&Xe.avgEntry!=null&&Xe.avgEntry>0?Xe.avgEntry:null,tpPrice:Ke&&Xe.tpPrice!=null&&Xe.tpPrice>0?Xe.tpPrice:null,liqPrice:tt&&Xe.liqPrice!=null&&Xe.liqPrice>0?Xe.liqPrice:null,status:Xe.status})),[Me.orders,je,Re,Ke,tt]),Fe=m.useMemo(()=>{const Xe=[];if(qe.forEach(Ge=>{Ge.orderPrice!=null&&Xe.push(Ge.orderPrice),Ge.avgEntry!=null&&Xe.push(Ge.avgEntry),Ge.tpPrice!=null&&Xe.push(Ge.tpPrice)}),Xe.length===0)return["auto","auto"];const Pt=Math.min(...Xe),Wt=Math.max(...Xe),ct=(Wt-Pt)*.1;return[Math.max(0,Pt-ct),Wt+ct]},[qe]),at=Xe=>{const{cx:Pt,cy:Wt,payload:ct}=Xe;return ct.status==="LIQUIDATED"&&Pt&&Wt?i.jsx("text",{x:Pt,y:Wt,textAnchor:"middle",dominantBaseline:"middle",fontSize:14,children:"💀"}):null},ie=Xe=>{switch(Xe){case"orderPrice":Ie(!je);break;case"avgEntry":Qe(!Re);break;case"tpPrice":dt(!Ke);break;case"liqPrice":nt(!tt);break}},Se=Xe=>{const{payload:Pt}=Xe;return i.jsx("div",{className:"flex flex-wrap justify-center gap-2 sm:gap-4 mt-2",children:Pt.map((Wt,ct)=>{const Ge=Wt.dataKey==="orderPrice"?je:Wt.dataKey==="avgEntry"?Re:Wt.dataKey==="tpPrice"?Ke:Wt.dataKey==="liqPrice"?tt:!0;return i.jsxs("button",{onClick:()=>ie(Wt.dataKey),className:`flex items-center gap-1.5 text-xs px-2 py-1 rounded transition-all ${Ge?"opacity-100":"opacity-40"}`,style:{color:Wt.color},children:[i.jsx("span",{className:"w-3 h-0.5",style:{backgroundColor:Wt.color}}),Wt.value]},ct)})})},{orders:$e,metrics:Ue}=Me,_e=$e.filter(Xe=>Xe.status!=="CANCELLED"),st=m.useMemo(()=>{var Fn,Gn;if(!Ae)return null;const Xe=ke("long"),Pt=ke("short"),Wt=(Fn=Xe.metrics)==null?void 0:Fn.safeCount,ct=(Gn=Pt.metrics)==null?void 0:Gn.safeCount,Ge=Xe.orders.some(Sr=>Sr.status==="LIQUIDATED"),Tt=Pt.orders.some(Sr=>Sr.status==="LIQUIDATED"),fn=Number.isFinite(Wt)&&Number.isFinite(ct)?Math.max(Wt,ct):null;let Yn=!1;return Number.isFinite(Wt)&&Number.isFinite(ct)?Wt>ct?Yn=Ge:ct>Wt?Yn=Tt:Yn=Ge&&Tt:Yn=Ge||Tt,{safeOrders:fn,hasLiquidation:Yn}},[ke,Ae]),ut=m.useMemo(()=>Ae?!!(st!=null&&st.hasLiquidation):_e.some(Xe=>Xe.status==="LIQUIDATED"),[Ae,_e,st==null?void 0:st.hasLiquidation]),yt=m.useMemo(()=>{if(!ut)return null;const Xe=Ae?st==null?void 0:st.safeOrders:Ue==null?void 0:Ue.safeCount,Pt=Number.isFinite(Xe)?Xe:0,Wt=parseInt(ne)||0;return`Liquidation occurs before completing all DCA orders. Safe orders: ${Pt} of ${Wt}. Reduce leverage, widen spacing, or lower max DCA orders.`},[ut,Ae,st==null?void 0:st.safeOrders,Ue==null?void 0:Ue.safeCount,ne]),Mt=m.useMemo(()=>{const Xe=Ae?st==null?void 0:st.safeOrders:Ue==null?void 0:Ue.safeCount,Pt=parseInt(ne);return!Number.isFinite(Xe)||!Number.isFinite(Pt)?null:Pt>Xe?`Only ${Xe} of ${Pt} DCA orders are currently safe. Increase budget, reduce leverage, or lower Max DCA Orders.`:null},[Ae,st==null?void 0:st.safeOrders,Ue==null?void 0:Ue.safeCount,ne]),Kt=({variant:Xe="desktop"})=>{const Pt=Xe==="desktop"?"px-4 py-5":"p-3";return i.jsxs("div",{className:`${Pt} space-y-3`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-full bg-[#a78bfa]/15 text-[#d7c8ff]",children:i.jsx(ZAe,{className:"w-4 h-4"})}),i.jsxs("div",{children:[i.jsx("div",{className:"text-sm font-semibold text-white",children:"Smart Direction Mode"}),i.jsx("p",{className:"text-[12px] text-[#9b9b9b]",children:"When Smart mode is enabled, the bot checks the Extended 24h price change before each trade:"})]})]}),i.jsx("div",{className:"rounded-lg border border-[#1c2a24] bg-[#0b1511] p-4 space-y-3",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(JAe,{className:"w-5 h-5 text-[#67FFBD] mt-0.5"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-sm font-semibold text-white",children:"How it works"}),i.jsxs("div",{className:"space-y-2 text-sm text-[#cfd4db]",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(QAe,{className:"w-4 h-4 mt-0.5 text-[#67FFBD]"}),i.jsx("span",{children:"If 24h change is positive (+%) → Opens a Long position."})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(Cwn,{className:"w-4 h-4 mt-0.5 text-[#ff7073]"}),i.jsxs("span",{children:[" ","If 24h change is negative (-%) → Opens a Short position."]})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(JAe,{className:"w-4 h-4 mt-0.5 text-[#a78bfa]"}),i.jsx("span",{children:"Order details and calculations are not available in Smart mode since the direction is dynamic."})]})]})]})]})}),i.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-[#1c2a24] bg-[#111] p-3",children:[i.jsx(Swn,{className:"w-5 h-5 text-[#facc15] mt-0.5"}),i.jsxs("p",{className:"text-[13px] text-[#e5e7eb]",children:[i.jsx("span",{className:"font-semibold text-white",children:"Tip:"})," To preview the DCA order table for Long or Short scenarios, switch the Direction selector to the desired mode."]})]})]})};return i.jsx("div",{className:"text-white",style:{fontFamily:"Manrope, sans-serif"},children:i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:[i.jsxs("div",{className:"lg:col-span-1 space-y-4",children:[i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"1"}),"Market & Coin"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx("div",{className:"col-span-2",children:i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:["Market",i.jsx(Uh,{content:"Extended is temporarily the only available market.",children:"?"})]}),i.jsx(Nwn,{value:x,onChange:g})]})}),i.jsx("div",{className:"col-span-2",children:i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:[s==="extended"?"Extended Wallet":"Lighter Wallet",i.jsx(Uh,{content:"Select the wallet to use for this DCA bot. The bot will execute trades using this wallet.",children:"?"})]}),Oe?Un?i.jsx("div",{className:"w-full px-3 py-2 rounded-lg bg-[#161616] border border-[#1c2a24] text-white text-sm flex items-center justify-center",children:i.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#67FFBD]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}):i.jsx(iP,{wallets:nn,value:an&&an.id?String(an.id):"",onChange:Xe=>{const Pt=nn.find(Wt=>String(Wt.wallet_id)===String(Xe));Pt&&(Jt({id:Pt.wallet_id,address:Pt.wallet_address,apiKey:Pt.wallet_api_key}),typeof window<"u"&&window.localStorage.setItem(kt,String(Pt.wallet_id)))},selectedBalance:Qn,mode:s}):i.jsx("div",{className:"w-full",children:i.jsx(om,{onClick:()=>Vn(!0)})})]})}),i.jsx("div",{className:"col-span-2",children:i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:["Coin",i.jsx(Uh,{content:"Select the trading pair. Price and max leverage will update automatically.",children:"?"})]}),i.jsxs("div",{className:"relative rounded-lg border border-[#1c2a24] bg-[#161616] px-2 py-1.5 flex items-center gap-2 h-8",children:[i.jsx("img",{src:`${_wn}/${tr||"BTC"}.svg`,alt:y||"coin",className:"w-6 h-6 rounded-full bg-[#161616] border border-[#1c2a24]",loading:"lazy",onError:Xe=>wm(Xe)}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Kde,{markets:kn,value:y,onChange:re,loading:ge,showIcon:!0})})]})]})})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"2"}),"Position Setup"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"col-span-2 space-y-1.5",children:[i.jsxs("label",{className:"text-xs text-[#9b9b9b] flex items-center",children:["Direction",i.jsx(Uh,{content:"Long: Profit when price rises. Short: Profit when price falls.",children:"?"})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[i.jsx("button",{type:"button",onClick:()=>T("short"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${P==="short"?"bg-[#ff7073]/20 border-[#ff7073] text-[#ff7073]":"bg-[#161616] border-[#1c2a24] text-[#6e857d] hover:border-[#ff7073]/50"}`,children:"Short"}),i.jsx("button",{type:"button",onClick:()=>T("long"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${P==="long"?"bg-[#67FFBD]/20 border-[#67FFBD] text-[#67FFBD]":"bg-[#161616] border-[#1c2a24] text-[#6e857d] hover:border-[#67FFBD]/50"}`,children:"Long"}),i.jsxs("button",{type:"button",onClick:()=>T("smart"),className:`py-2 px-3 rounded-lg text-sm font-medium transition-all border flex items-center justify-center gap-1 ${P==="smart"?"bg-[#a78bfa]/20 border-[#a78bfa] text-[#d7c8ff]":"bg-[#161616] border-[#1c2a24] text-[#7f7b9f] hover:border-[#a78bfa]/50"}`,children:[i.jsx(ZAe,{className:"w-4 h-4"}),"Smart"]})]})]}),i.jsx("div",{className:"col-span-2",children:i.jsx(Own,{value:M,onChange:F,min:1,max:c,tooltip:`Position multiplier. 10x leverage means $100 margin controls $1,000 position. Max leverage for ${y}: ${c}x`})})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"3"}),"Order Sizing"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(ug,{label:"Base Order Margin",value:$,onChange:L,step:"1",min:"1",suffix:"$",tooltip:"Initial margin for the first position opened at Entry Price.",validate:(Xe,Pt)=>!Pt||isNaN(Xe)?"Required":Xe<1?"Must be at least 1":s==="extended"&&Zn!=null&&Xe*Ft<Zn?I("Base Order Margin"):null}),i.jsx(ug,{label:"DCA Order Margin",value:z,onChange:X,step:"1",min:"1",suffix:"$",tooltip:"Starting margin for DCA orders.",validate:(Xe,Pt)=>!Pt||isNaN(Xe)?"Required":Xe<1?"Must be at least 1":s==="extended"&&Zn!=null&&Xe*Ft<Zn?I("DCA Order Margin"):null}),i.jsx(ug,{label:"Max DCA Orders",value:ne,onChange:J,step:"1",max:"50",tooltip:"Maximum number of DCA orders to place after the Base Order.",validate:(Xe,Pt)=>!Pt||isNaN(Xe)?"Required":Xe<1?"Minimum 1":Xe>50?"Maximum 50":null,forceError:ut||!!Mt,forceErrorMessage:yt||Mt}),i.jsx(ug,{label:"Available to Trade",value:Qn!=null?String(Qn):"",onChange:()=>{},step:"100",suffix:"$",readOnly:!0,tooltip:"Wallet balance available for trading. Read only."})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-4 text-[#d7ffe9] flex items-center gap-2",children:[i.jsx("span",{className:"w-5 h-5 rounded-full bg-[#67FFBD]/20 text-[#67FFBD] flex items-center justify-center text-xs",children:"4"}),"Exit Strategy"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(ug,{label:"Take Profit",value:se,onChange:ae,step:"0.1",suffix:"%",tooltip:"Target profit % calculated from the weighted average entry price."}),i.jsx(ug,{label:"Stop Loss",value:W,onChange:V,step:"1",suffix:"%",tooltip:"Maximum loss % from average entry before position closes. Leave empty to disable stop loss and rely only on liquidation"})]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] overflow-hidden",children:[i.jsxs("button",{onClick:()=>oe(!ee),className:"w-full flex items-center justify-between p-4 hover:bg-[#111] transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm font-semibold text-[#d7ffe9]",children:"Advanced Settings"}),i.jsxs("span",{className:"text-xs text-[#666]",children:["Dev: ",de,"% • Dev Mult: ",xe,"x • Size: ",me,"x"]})]}),ee?i.jsx(Gcn,{className:"w-4 h-4 text-[#67FFBD]"}):i.jsx(H9,{className:"w-4 h-4 text-[#67FFBD]"})]}),i.jsx(nP,{children:ee&&i.jsx(Ao.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},children:i.jsxs("div",{className:"px-4 pb-4 grid grid-cols-2 gap-3 border-t border-[#1c2a24] pt-3",children:[i.jsx(ug,{label:"Price Deviation",value:de,onChange:Ce,step:"0.1",suffix:"%",tooltip:"Initial price change % from Entry Price to trigger DCA."}),i.jsx(ug,{label:"DCA Order Size Multiplier",value:me,onChange:we,step:"0.1",suffix:"x",tooltip:"Multiplier for each DCA order's margin."}),i.jsx(ug,{label:"Price Deviation Multiplier",value:xe,onChange:be,step:"0.05",suffix:"x",tooltip:"Multiplier for price gaps between DCA orders."})]})})})]}),(()=>{const Xe=C&&!isNaN(parseFloat(C))&&parseFloat(C)>0,Pt=$&&!isNaN(parseFloat($))&&parseFloat($)>=1,Wt=z&&!isNaN(parseFloat(z))&&parseFloat(z)>=1,ct=ne&&!isNaN(parseInt(ne))&&parseInt(ne)>=1,Ge=K&&!isNaN(parseFloat(K))&&parseFloat(K)>0,Tt=Xe&&Pt&&Wt&&ct&&Ge,fn=k,Yn=kr=>{const Bn=parseFloat(C)||0,Sn=parseFloat($)||0,Mn=parseFloat(z)||0,rr=parseInt(ne)||0,ls=parseFloat(K)||1/0,cs=parseFloat(me)||1.1;if(Bn<=0||Sn<=0)return null;let et=Sn,gt=0,Tn=et>ls;Tn||(gt+=1);for(let Tr=1;Tr<=rr;Tr++){const Lr=Mn*Math.pow(cs,Tr-1);et+=Lr,!Tn&&et>ls&&(Tn=!0),Tn||(gt+=1)}return{budgetOk:et<=ls,safeCount:gt}},Fn=Ae?{long:Yn(),short:Yn()}:null,Gn=Ae&&(Fn==null?void 0:Fn.long)&&(Fn==null?void 0:Fn.short)&&Fn.long.budgetOk&&Fn.short.budgetOk&&Fn.long.safeCount>0&&Fn.short.safeCount>0&&!fn,Sr=Ae?Tt&&Gn:Tt&&Ue&&Ue.budgetOk&&Ue.safeCount>0&&!fn;let ur=null;if(!Tt)ur="Please fill in all required fields";else if(fn&&Zn!=null){const kr=[];S&&kr.push("Base Order"),_&&kr.push("DCA Order");const Bn=kr.length===1?` (${kr[0]})`:kr.length===2?" (Base Order & DCA Order)":"";ur=`Minimum order size for ${String(y||"").toUpperCase()} is $${Zn.toFixed(2)}${Bn}. Increase order size or leverage.`}else!Ae&&Ue&&!Ue.budgetOk?ur="Budget exceeded - increase budget or reduce orders":!Ae&&Ue&&Ue.safeCount===0?ur="No safe orders - reduce leverage or increase budget":Ae&&(!(Fn!=null&&Fn.long)||!(Fn!=null&&Fn.short)||!Fn.long.budgetOk||!Fn.short.budgetOk)?ur="Budget exceeded in Smart mode - adjust margin or orders":Ae&&(Fn!=null&&Fn.long)&&(Fn!=null&&Fn.short)&&(Fn.long.safeCount===0||Fn.short.safeCount===0)&&(ur="No safe orders in Smart mode - reduce leverage or increase budget");return i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[(()=>{const kr=(ar==null?void 0:ar.id)||(ar==null?void 0:ar.bot_id),Bn=kr&&It[kr]===!0,Sn=kr&&Yt[kr]===!0,Mn=!!ar,rr=Mn?Bn||Sn:!Sr||Ye||!an||!an.id,ls=()=>{Mn&&kr?en(kr,!0):Dt()};return i.jsx("button",{onClick:ls,disabled:rr,className:`w-full py-2.5 rounded-lg text-sm font-semibold transition-all flex items-center justify-center gap-2 ${Mn?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":Sr&&an&&an.id&&!Ye?"bg-[#67FFBD] text-[#101010] hover:bg-[#9FFFDA]":"bg-[#333] text-[#666] cursor-not-allowed"} disabled:opacity-60 disabled:cursor-not-allowed`,children:Mn?Bn?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Stopping..."]}):i.jsxs(i.Fragment,{children:[i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Stop DCA Bot"]}):Ye?i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Starting..."]}):i.jsxs(i.Fragment,{children:[i.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]}),"Start DCA Bot"]})})})(),ur&&i.jsx("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:ur}),(!an||!an.id)&&i.jsx("p",{className:"text-xs text-[#ff7073] text-center mt-2",children:"Please select a Extended wallet first"}),i.jsx("p",{className:"text-xs text-[#555] text-center mt-2",children:"Bot will execute orders on Extended exchange"})]})})(),i.jsx("div",{className:"h-4"})]}),i.jsxs("div",{className:"lg:col-span-2 space-y-4 pb-6",children:[i.jsx("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4 mb-4",children:i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#0b1511] border border-[#1e2e27] flex items-center justify-center",children:i.jsx(QAe,{className:"w-5 h-5 text-[#67FFBD]"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-base font-semibold text-[#d7ffe9]",children:"DCA Bot and Calculator"}),i.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Plan your strategy and start DCAing"}),i.jsx("div",{className:"flex items-center mt-1 text-sm text-[#67FFBD]",children:i.jsxs("a",{href:"https://docs.dextrabot.com/dca-bot/extended-dca-bot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-lg bg-[#101010]/70 hover:bg-[#111] transition-colors",children:[i.jsx("span",{className:"text-xs text-white",children:"New to DCA? Learn how it works"}),i.jsx("span",{children:"📚"})]})})]})]}),Ue&&i.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Total Margin",i.jsx(Uh,{content:"Total margin required for Base Order + all DCA orders",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold text-white",children:["$",Po(Ue.totalMargin)]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Position Value",i.jsx(Uh,{content:"Combined notional value of all positions. Total Margin × Leverage",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold text-white",children:["$",Po(Ue.totalPositionValue)]}),i.jsxs("div",{className:"text-xs text-[#555]",children:[Ue.leverage,"x leverage"]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"text-xs text-[#888] flex items-center mb-1",children:["Safe Orders",i.jsx(Uh,{content:"DCA orders that can be executed safely.",children:"?"})]}),i.jsxs("div",{className:"text-lg sm:text-xl font-bold",style:{color:zb},children:[Ue.safeCount,"/",parseInt(ne)||0]})]})]})]})}),!Ae&&i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] p-4",children:[i.jsx("h3",{className:"text-sm font-semibold text-[#d7ffe9] mb-3",children:"Price Chart"}),i.jsx("div",{className:"h-[280px] sm:h-[320px]",children:i.jsx(WUe,{width:"100%",height:"100%",children:i.jsxs(uan,{data:qe.length>0?qe:[{name:"No Data",orderPrice:null,avgEntry:null,tpPrice:null,liqPrice:null}],margin:{top:10,right:20,left:10,bottom:5},children:[i.jsx(LHe,{strokeDasharray:"3 3",stroke:"#1c2a24"}),i.jsx(Ij,{dataKey:"name",stroke:"#666",fontSize:10,interval:0,angle:qe.length>6?-45:0,textAnchor:qe.length>6?"end":"middle",height:qe.length>6?50:30,tickFormatter:Xe=>Xe==="Base"?"B":Xe.startsWith("DCA")?`D${Xe.split(" ")[1]}`:Xe.includes("Liq")?"💀":Xe}),i.jsx(Fj,{stroke:"#666",fontSize:10,tickFormatter:Xe=>`$${Po(Xe)}`,domain:Fe,allowDataOverflow:!0}),i.jsx(sm,{contentStyle:{backgroundColor:"#101010",border:"1px solid #333",borderRadius:"6px",fontSize:"11px"},formatter:(Xe,Pt)=>[Ob(Xe),Pt],labelFormatter:Xe=>Xe==="B"?"Base Order":Xe.startsWith("D")?`DCA ${Xe.slice(1)}`:Xe}),i.jsx(N3,{content:Se}),i.jsx($0,{type:"monotone",dataKey:"orderPrice",name:"Order Price",stroke:zb,strokeWidth:2,dot:{fill:zb,r:3},connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"avgEntry",name:"Avg Entry",stroke:tO,strokeWidth:2,dot:{fill:tO,r:2},connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"tpPrice",name:"TP",stroke:eje,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,connectNulls:!0}),i.jsx($0,{type:"monotone",dataKey:"liqPrice",name:"Liq",stroke:_M,strokeWidth:1.5,strokeDasharray:"4 4",dot:at,connectNulls:!0})]})})}),i.jsxs("div",{className:"text-xs text-[#555] text-center mt-2",children:["B = Base Order • D1-D",ne," = DCA Orders • 💀 = Liquidation Point"]})]}),i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] overflow-hidden hidden md:block",children:[i.jsxs("div",{className:"flex border-b border-[#1c2a24]",children:[i.jsx("button",{onClick:()=>Be("details"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${Le==="details"?"text-[#67FFBD] bg-[#0b1511] border-[#67FFBD] shadow-[0_0_0_1px_rgba(103,255,189,0.35)]":"text-[#888] hover:text-white hover:bg-[#111] border-transparent"}`,children:"Order Details"}),i.jsx("button",{onClick:()=>Be("bots"),className:`flex-1 px-4 py-3 text-sm font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${Le==="bots"?"text-[#67FFBD] bg-[#0b1511] border-[#67FFBD] shadow-[0_0_0_1px_rgba(103,255,189,0.35)]":"text-[#888] hover:text-white hover:bg-[#111] border-transparent"}`,children:"DCA Bots"})]}),Le==="details"&&(Ae?i.jsx(Kt,{variant:"desktop"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"px-4 py-3",children:i.jsx(nje,{entryPrice:C,onEntryPriceChange:ue,maxBudget:K,onBudgetChange:ce})}),i.jsxs("div",{className:"overflow-x-auto",children:[i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#161616] text-[#888]",children:[i.jsx("th",{className:"px-3 py-2 text-left",children:"#"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Dev %"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Price"}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"Margin"}),i.jsx("th",{className:"px-3 py-2 text-right hidden xl:table-cell",children:"Pos. Value"}),i.jsxs("th",{className:"px-3 py-2 text-right",children:["Size (",y,")"]}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"Total Margin"}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Avg Entry"}),i.jsx("th",{className:"px-3 py-2 text-right hidden lg:table-cell",children:"TP"}),i.jsx("th",{className:"px-3 py-2 text-right",children:i.jsxs("span",{className:"flex items-center justify-end gap-1",children:["TP Profit",i.jsx(Uh,{content:"Profit if price reaches Take Profit level after this order executes.",children:i.jsx("span",{className:"text-[#666]",children:"?"})})]})}),i.jsx("th",{className:"px-3 py-2 text-right",children:"Liq"}),i.jsx("th",{className:"px-3 py-2 text-center",children:"Status"})]})}),i.jsx("tbody",{children:_e.map((Xe,Pt)=>{const Wt=tje[Xe.status];if(Xe.status==="EXCEEDED"){const ct=Xe.isLong?"Price would drop below $0 (impossible). Reduce deviation multiplier or fewer DCA orders.":"Price deviation exceeds 100%. Reduce deviation multiplier or fewer DCA orders.";return i.jsx("tr",{className:"border-t border-[#1c2a24] bg-[#1a1a1a]",children:i.jsx("td",{colSpan:12,className:"px-3 py-3",children:i.jsxs("div",{className:"flex items-center gap-2 text-[#6B7280]",children:[i.jsx("span",{children:Wt.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:Xe.label})," ","— ",ct]})]})})},Pt)}return i.jsxs("tr",{className:"border-t border-[#1c2a24] hover:bg-[#111]",children:[i.jsx("td",{className:"px-3 py-2 font-medium whitespace-nowrap",children:Xe.label}),i.jsx("td",{className:"px-3 py-2 text-right",children:Xe.deviation!=null?Twn(Xe.deviation):"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:Ob(Xe.price)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:Xe.margin!=null?`$${Po(Xe.margin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden xl:table-cell",children:Xe.positionValue!=null?`$${Po(Xe.positionValue)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",children:Xe.coins!=null?Po(Xe.coins,4):"-"}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",children:Xe.totalMargin!=null?`$${Po(Xe.totalMargin)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:tO},children:Ob(Xe.avgEntry)}),i.jsx("td",{className:"px-3 py-2 text-right hidden lg:table-cell",style:{color:eje},children:Ob(Xe.tpPrice)}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:zb},children:Xe.tpProfit!=null?`$${Po(Xe.tpProfit)}`:"-"}),i.jsx("td",{className:"px-3 py-2 text-right",style:{color:Xe.liqPrice<=0?zb:_M},children:Ob(Xe.liqPrice,!0)}),i.jsx("td",{className:"px-3 py-2 text-center",children:i.jsx(Uh,{content:Wt.tooltip,children:i.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium cursor-help",style:{backgroundColor:`${Wt.color}15`,color:Wt.color},children:Wt.icon})})})]},Pt)})})]}),_e.length===0&&i.jsxs("div",{className:"p-8 text-center text-[#666] text-sm",children:[i.jsx("p",{children:"No orders to display"}),i.jsx("p",{className:"text-xs text-[#555] mt-1",children:"Enter entry price and base order margin to see order details"})]})]})]})),Le==="bots"&&i.jsx("div",{className:"p-4",children:Gt?i.jsxs("div",{className:"text-center py-8",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-[#0b1511] border border-[#1c2a24] flex items-center justify-center",children:i.jsxs("svg",{className:"animate-spin h-8 w-8 text-[#67FFBD]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),i.jsx("p",{className:"text-sm text-[#666]",children:"Loading bots..."})]}):hr.length===0?i.jsxs("div",{className:"text-center py-8",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-[#0b1511] border border-[#1c2a24] flex items-center justify-center",children:i.jsx("svg",{className:"w-8 h-8 text-[#67FFBD]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),i.jsx("h4",{className:"text-sm font-medium text-[#d7ffe9] mb-2",children:"No Active DCA Bots"}),i.jsx("p",{className:"text-xs text-[#666] mb-4",children:'Configure your DCA strategy and click "Start Bot" to create your first bot.'}),i.jsx("p",{className:"text-xs text-[#555]",children:"Your active bots will appear here."})]}):i.jsx("div",{className:"space-y-3 max-h-[845px] overflow-y-auto pr-1",children:hr.map(Xe=>{const Pt=!Xe.is_deleted,Wt=Xe.bot_params||{},ct=Xe.created_at?new Date(Xe.created_at):null,Ge=ct?(()=>{const ur=Date.now()-ct.getTime(),kr=Math.floor(ur/(1e3*60*60)),Bn=Math.floor(kr/24);return Bn>0?`${Bn}d ago`:kr>0?`${kr}h ago`:`${Math.floor(ur/(1e3*60))}m ago`})():null,Tt=Wt.direction==="long"?"Long":Wt.direction==="short"?"Short":"Smart",fn=Wt.price_deviation??Wt.priceDeviation??0,Yn=Wt.step_scale??Wt.price_dev_multiplier??Wt.priceDevMultiplier??0,Fn=Wt.volume_scale??Wt.dca_size_multiplier??Wt.dcaSizeMultiplier??0,Gn=Wt.tp_percent??Wt.tp_target??Wt.take_profit_percent??0,Sr=Wt.stop_loss_percent??Wt.stop_loss??0;return Wt.market_index??Wt.marketIndex,Wt.coin_idx??Wt.coinIndex,i.jsxs("div",{className:"bg-[#111] rounded-lg p-4 border border-[#1c2a24]",children:[i.jsxs("div",{className:"flex justify-between items-start mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-sm font-medium",children:[Xe.coin||y," DCA Bot"]}),Pt?i.jsx("span",{className:"px-2 py-0.5 text-xs rounded bg-[#67FFBD]/20 text-[#67FFBD]",children:"Active"}):i.jsx("span",{className:"px-2 py-0.5 text-xs rounded bg-[#666]/20 text-[#666]",children:"Stopped"})]}),Ge&&i.jsx("span",{className:"text-[11px] text-[#7c7c7c]",children:Ge})]}),i.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2 text-xs mb-3",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Direction:"}),i.jsx("span",{className:`ml-1 ${Wt.direction==="long"?"text-[#67FFBD]":Wt.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:Tt})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Wt.leverage||0,"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Base Order Margin:"}),i.jsxs("span",{className:"ml-1 text-white",children:["$",Po(Wt.base_amount_usd||Wt.base_order_margin||0)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"DCA Order Margin:"}),i.jsxs("span",{className:"ml-1 text-white",children:["$",Po(Wt.safety_amount_usd||Wt.dca_order_margin||0)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Max DCA Orders:"}),i.jsx("span",{className:"ml-1 text-white",children:Wt.max_safety_orders||Wt.max_dca_orders||0})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(fn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(Yn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"DCA Order Size Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(Fn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Take Profit:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Po(Gn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Stop Loss:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Po(Sr),"%"]})]}),Ge&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:Ge})]})]}),i.jsx("div",{className:"mt-4",children:i.jsx("button",{onClick:()=>en(Xe.id||Xe.bot_id,Pt),disabled:It[Xe.id||Xe.bot_id]||Yt[Xe.id||Xe.bot_id],className:`w-full py-2 rounded-lg text-sm font-semibold transition-colors ${Pt?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:It[Xe.id||Xe.bot_id]?Pt?"Stopping...":"Starting...":Pt?"Stop Bot":"Start Bot"})})]},Xe.id||Xe.bot_id)})})})]}),i.jsx("div",{className:"md:hidden space-y-2",children:i.jsxs("div",{className:"bg-[#101010] rounded-xl border border-[#1c2a24] overflow-hidden",children:[i.jsxs("div",{className:"flex border-b border-[#1c2a24]",children:[i.jsx("button",{onClick:()=>Be("details"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${Le==="details"?"text-[#67FFBD] bg-[#0b1511] border-[#67FFBD] shadow-[0_0_0_1px_rgba(103,255,189,0.35)]":"text-[#888] hover:text-white border-transparent"}`,children:"Order Details"}),i.jsx("button",{onClick:()=>Be("bots"),className:`flex-1 px-3 py-2 text-xs font-medium transition-colors relative first:rounded-tl-xl last:rounded-tr-xl border ${Le==="bots"?"text-[#67FFBD] bg-[#0b1511] border-[#67FFBD] shadow-[0_0_0_1px_rgba(103,255,189,0.35)]":"text-[#888] hover:text-white border-transparent"}`,children:"DCA Bots"})]}),Le==="details"&&(Ae?i.jsx(Kt,{variant:"mobile"}):i.jsxs("div",{className:"p-3 space-y-2",children:[i.jsx(nje,{className:"w-full",entryPrice:C,onEntryPriceChange:ue,maxBudget:K,onBudgetChange:ce}),_e.map((Xe,Pt)=>{const Wt=tje[Xe.status];if(Xe.status==="EXCEEDED"){const ct=Xe.isLong?"Price would drop below $0":"Price deviation exceeds 100%";return i.jsx("div",{className:"bg-[#1a1a1a] rounded-lg p-3 border border-[#333]",children:i.jsxs("div",{className:"flex items-center gap-2 text-[#6B7280]",children:[i.jsx("span",{children:Wt.icon}),i.jsxs("span",{className:"text-sm",children:[i.jsx("span",{className:"font-medium",children:Xe.label})," ","— ",ct]})]})},Pt)}return i.jsxs("div",{className:"bg-[#111] rounded-lg p-3 border border-[#1c2a24]",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsx("span",{className:"font-medium text-sm",children:Xe.label}),i.jsx(Uh,{content:Wt.tooltip,children:i.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium cursor-help",style:{backgroundColor:`${Wt.color}15`,color:Wt.color},children:Wt.icon})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Price:"}),i.jsx("span",{children:Ob(Xe.price)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Size:"}),i.jsx("span",{children:Xe.coins!=null?`${Po(Xe.coins,4)} ${y}`:"-"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Avg Entry:"}),i.jsx("span",{style:{color:tO},children:Ob(Xe.avgEntry)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-[#666]",children:"Liq:"}),i.jsx("span",{style:{color:Xe.liqPrice<=0?zb:_M},children:Ob(Xe.liqPrice,!0)})]}),i.jsxs("div",{className:"flex justify-between col-span-2 pt-1 border-t border-[#1c2a24] mt-1",children:[i.jsx("span",{className:"text-[#666]",children:"TP Profit:"}),i.jsx("span",{style:{color:zb},className:"font-medium",children:Xe.tpProfit!=null?`$${Po(Xe.tpProfit)}`:"-"})]})]})]},Pt)})]})),Le==="bots"&&i.jsx("div",{className:"p-3",children:Gt?i.jsxs("div",{className:"text-center py-6",children:[i.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-[#0b1511] border border-[#1c2a24] flex items-center justify-center",children:i.jsxs("svg",{className:"animate-spin h-6 w-6 text-[#67FFBD]",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),i.jsx("p",{className:"text-[10px] text-[#666]",children:"Loading bots..."})]}):hr.length===0?i.jsxs("div",{className:"text-center py-6",children:[i.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-[#0b1511] border border-[#1c2a24] flex items-center justify-center",children:i.jsx("svg",{className:"w-6 h-6 text-[#67FFBD]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),i.jsx("h4",{className:"text-xs font-medium text-[#d7ffe9] mb-1",children:"No Active DCA Bots"}),i.jsx("p",{className:"text-[10px] text-[#666]",children:"Your bots will appear here."})]}):i.jsx("div",{className:"space-y-2 max-h-[360px] overflow-y-auto pr-1",children:hr.map(Xe=>{const Pt=!Xe.is_deleted,Wt=Xe.bot_params||{},ct=Xe.created_at?new Date(Xe.created_at):null,Ge=ct?(()=>{const Bn=Date.now()-ct.getTime(),Sn=Math.floor(Bn/(1e3*60*60)),Mn=Math.floor(Sn/24);return Mn>0?`${Mn}d ago`:Sn>0?`${Sn}h ago`:`${Math.floor(Bn/(1e3*60))}m ago`})():null,Tt=Wt.direction==="long"?"Long":Wt.direction==="short"?"Short":"Smart",fn=Wt.price_deviation??Wt.priceDeviation??0,Yn=Wt.step_scale??Wt.price_dev_multiplier??Wt.priceDevMultiplier??0,Fn=Wt.volume_scale??Wt.dca_size_multiplier??Wt.dcaSizeMultiplier??0,Gn=Wt.tp_percent??Wt.tp_target??Wt.take_profit_percent??0,Sr=Wt.stop_loss_percent??Wt.stop_loss??0,ur=Wt.market_index??Wt.marketIndex,kr=Wt.coin_idx??Wt.coinIndex;return i.jsxs("div",{className:"bg-[#111] rounded-lg p-3 border border-[#1c2a24]",children:[i.jsxs("div",{className:"flex justify-between items-start mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-xs font-medium",children:[Xe.coin||y," DCA"]}),Pt?i.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded bg-[#67FFBD]/20 text-[#67FFBD]",children:"Active"}):i.jsx("span",{className:"px-1.5 py-0.5 text-[10px] rounded bg-[#666]/20 text-[#666]",children:"Stopped"})]}),Ge&&i.jsx("span",{className:"text-[10px] text-[#7c7c7c]",children:Ge})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1 text-[10px]",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Direction:"}),i.jsx("span",{className:`ml-1 ${Wt.direction==="long"?"text-[#67FFBD]":Wt.direction==="short"?"text-[#ff7073]":"text-[#A78BFA]"}`,children:Tt})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Leverage:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Wt.leverage||0,"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Base Order Margin:"}),i.jsxs("span",{className:"ml-1 text-white",children:["$",Po(Wt.base_amount_usd||Wt.base_order_margin||0)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"DCA Order Margin:"}),i.jsxs("span",{className:"ml-1 text-white",children:["$",Po(Wt.safety_amount_usd||Wt.dca_order_margin||0)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Max DCA Orders:"}),i.jsx("span",{className:"ml-1 text-white",children:Wt.max_safety_orders||Wt.max_dca_orders||0})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(fn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Price Deviation Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(Yn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"DCA Order Size Multiplier:"}),i.jsxs("span",{className:"ml-1 text-white",children:[Po(Fn),"x"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"TP:"}),i.jsxs("span",{className:"ml-1 text-[#67FFBD]",children:[Po(Gn),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"SL:"}),i.jsxs("span",{className:"ml-1 text-[#ff7073]",children:[Po(Sr),"%"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Market:"}),i.jsx("span",{className:"ml-1 text-white",children:ur??"-"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Coin Idx:"}),i.jsx("span",{className:"ml-1 text-white",children:kr??"-"})]}),Ge&&i.jsxs("div",{children:[i.jsx("span",{className:"text-[#666]",children:"Created:"}),i.jsx("span",{className:"ml-1 text-white",children:Ge})]})]}),i.jsx("div",{className:"mt-3",children:i.jsx("button",{onClick:()=>en(Xe.id||Xe.bot_id,Pt),disabled:It[Xe.id||Xe.bot_id]||Yt[Xe.id||Xe.bot_id],className:`w-full py-1.5 rounded-lg text-[11px] font-semibold transition-colors ${Pt?"bg-[#ff7073] text-black hover:bg-[#ff8a8d]":"bg-[#67FFBD] text-black hover:bg-[#8bffd0]"} disabled:opacity-60 disabled:cursor-not-allowed`,children:It[Xe.id||Xe.bot_id]?"...":Pt?"Stop Bot":"Start Bot"})})]},Xe.id||Xe.bot_id)})})})]})})]})]})})}const Rwn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setIsWhitelist:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setHyperToken:c,setHyperAddress:u}=m.useContext(Qr);return m.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await ki(x.toLowerCase(),f);v!=null&&v.success?(t(v==null?void 0:v.telegram_chat_id),e(v==null?void 0:v.subscriber_role),n(v==null?void 0:v.subs_expire_day),r((g=v==null?void 0:v.mushboomer_counts)==null?void 0:g.eth),a((y=v==null?void 0:v.mushboomer_counts)==null?void 0:y.sol),o(v==null?void 0:v.referral_code),l(v==null?void 0:v.refcode),s(v==null?void 0:v.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(v){console.error("Token verification error:",v)}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"DCA Bot Calculator | Dollar Cost Averaging Strategy | Dextrabot"}),i.jsx("meta",{name:"description",content:"Calculate your DCA bot strategy for perpetual futures. Plan safety orders, visualize liquidation prices, and optimize your dollar cost averaging strategy."}),i.jsx("meta",{property:"og:title",content:"DCA Bot Calculator | Dollar Cost Averaging Strategy | Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Calculate your DCA bot strategy for perpetual futures. Plan safety orders, visualize liquidation prices, and optimize your dollar cost averaging strategy."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/dca-bot"})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full px-4 pt-6 pb-6 sm:px-6 sm:pt-6 sm:pb-6 bg-[#050505] overflow-auto",children:i.jsx("div",{className:"flex flex-col items-stretch justify-start gap-[26px] w-full max-w-[1400px]",children:i.jsx(Mwn,{})})})]})},M7=({size:t})=>i.jsxs("div",{role:"status",className:"flex justify-center items-center min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:`${t} inline text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]
`,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}),iB="/assets/subscribeAnimation-oYDBxlRF.mp4",Lwn=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=m.useContext(Qr),{address:f}=ns(),[x,g]=m.useState(1),[y,v]=m.useState(""),[C,N]=m.useState(""),[P,T]=m.useState(!1),[M,F]=m.useState(!1),[$,L]=m.useState(""),[z,X]=m.useState(0),[ne,J]=m.useState(0),[K,te]=m.useState(!1),fe=xe=>/^\d*$/.test(xe),q=xe=>{["e","E","+","-"].includes(xe.key)&&xe.preventDefault()},se=m.useMemo(()=>{if(x==="")return!1;const xe=Number(x);return Number.isInteger(xe)&&xe>=1},[x]),V=(xe=>{const[be,je]=xe.split(" "),[Ie,Re,Qe]=be.split("-").map(Number),[Ke,dt]=je.split(":").map(Number);return new Date(Date.UTC(Qe,Re-1,Ie,Ke-3,dt))})("29-11-2025 23:59");m.useState(()=>new Date().getTime()>=V.getTime());const ee=m.useRef(z);m.useEffect(()=>{ee.current=z},[z]);const oe=m.useRef(0);m.useEffect(()=>{oe.current=ne},[ne]);const de=async()=>{var je,Ie;const xe=window.localStorage.getItem("hyperToken"),be=window.localStorage.getItem("hyperAddress");if(!(!xe||!be))try{const Re=await ki(be.toLowerCase(),xe);Re!=null&&Re.success?(e(Re==null?void 0:Re.telegram_chat_id),n(Re==null?void 0:Re.subscriber_role),r(Re==null?void 0:Re.subs_expire_day),s((je=Re==null?void 0:Re.mushboomer_counts)==null?void 0:je.eth),a((Ie=Re==null?void 0:Re.mushboomer_counts)==null?void 0:Ie.sol),o(Re==null?void 0:Re.referral_code),l(Re==null?void 0:Re.refcode),c(Re==null?void 0:Re.whitelist),u(xe),d(be),v(Re==null?void 0:Re.farming_tools),X(Number((Re==null?void 0:Re.subs_expire_day)||0))):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""))}catch(Re){console.error("Token verification error:",Re),console.error(Re.message||"An unknown error occurred.")}};m.useEffect(()=>{K&&de()},[K]),m.useEffect(()=>{const xe=localStorage.getItem("hyperToken"),be=localStorage.getItem("hyperAddress");te(!!(xe&&be));const je=setInterval(()=>{const Ie=localStorage.getItem("hyperToken"),Re=localStorage.getItem("hyperAddress");te(!!(Ie&&Re))},800);return()=>clearInterval(je)},[]);const Ce=async()=>new _l(window.ethereum).eth.getAccounts(be=>be),me=async(xe="subscribe",be=24,je=5e3)=>{be<=0||(await new Promise(Ie=>setTimeout(Ie,je)),await de(),xe==="subscribe"&&ee.current===oe.current?me(xe,be-1,je):de())},we=async xe=>{const be=window.localStorage.getItem("hyperToken"),je=window.localStorage.getItem("hyperAddress");if(!be||!f){t(!0);return}N(""),J(ee.current),oe.current=ee.current,F(!0),T(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(Qe){console.error("Failed to switch network",Qe),T(!1);return}const Ie=new _l(window.ethereum);var Re=await Ce();if(Re.length>0?Re=Re[0]:Re=void 0,Re){const Ke=xe*.12,dt=Ie.utils.toWei(Ke.toString(),"ether"),tt={from:Re,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:dt};await Ie.eth.sendTransaction(tt).then(nt=>{console.log("txHash :>> ",nt),T(!1),L(nt.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():je,token:be,payment_tx:nt.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),de(),me("subscribe")}).catch(nt=>{console.log(nt),nt.code===-32003||nt.message.includes("insufficient funds")?N("Insufficient funds."):nt.message==="MetaMask Tx Signature: User denied transaction signature."&&F(!1)})}else await Ie.eth.requestAccounts()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:M,setOpen:F,transactionHash:$,transactionLoading:P,paymentPresaleRole:!(z<=ne),errorFunds:C,activeMethod:2}),i.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-start md:justify-center md:items-start gap-8 w-full h-screen md:h-full mb-72 md:mb-0",children:[i.jsx("div",{className:"flex justify-center items-start md:items-center w-full h-max md:h-full pl-0 sm:pl-4 md:pl-2",children:i.jsx("div",{className:"flex flex-col gap-2 pt-0 md:pt-7 lg:pt-0",children:i.jsx("div",{className:"flex flex-col items-start justify-start gap-4 md:mb-10 lg:mb-16",children:i.jsxs("div",{className:"flex flex-col gap-3 text-gray-200 text-sm leading-relaxed mt-2 max-w-[600px]",children:[i.jsxs("ul",{className:"space-y-2.5",children:[i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-lg",children:"🌾"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-base font-semibold text-white",children:"Farm Bot"}),i.jsxs("ul",{className:"text-sm text-gray-400",children:[i.jsx("li",{children:"• Generate volume, earn rewards."}),i.jsx("li",{children:"• Delta neutral = zero directional risk."}),i.jsx("li",{children:"• Safe automated farming."})]})]})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-lg",children:"🎯"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-base font-semibold text-white",children:"Grid Bot"}),i.jsxs("ul",{className:"text-sm text-gray-400",children:[i.jsx("li",{children:"• Auto-trade price ranges."}),i.jsx("li",{children:"• Profit from volatility."}),i.jsx("li",{children:"• Built-in risk management."})]})]})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-lg",children:"🔄"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-base font-semibold text-white",children:"Copy Trade"}),i.jsxs("ul",{className:"text-sm text-gray-400",children:[i.jsx("li",{children:"• Hyperliquid → Lighter copy trading."}),i.jsx("li",{children:"• Follow top traders automatically."}),i.jsx("li",{children:"• Scale positions to your size."})]})]})]})]}),i.jsx("p",{className:"mt-4 text-gray-300 text-base",children:"👉 Get Dextrabot's complete suite."})]})})})}),i.jsxs("div",{className:"relative mx-1 h-full py-10 hidden md:block",children:[i.jsx("div",{className:"w-[2px] h-full bg-[linear-gradient(to_bottom,rgba(255,140,0,0)_0%,rgba(255,140,0,0.8)_15%,rgba(255,50,150,0.8)_85%,rgba(255,50,150,0)_100%)]"}),i.jsx("div",{className:"absolute inset-0 w-[8px] h-full bg-[linear-gradient(to_bottom,rgba(255,140,0,0)_0%,rgba(255,140,0,0.4)_15%,rgba(255,50,150,0.4)_85%,rgba(255,50,150,0)_100%)] blur-md mx-auto"})]}),i.jsx("div",{className:"flex justify-center items-start md:items-center w-full h-full",children:i.jsxs("div",{className:"flex flex-col items-center gap-4 border border-[#404040] bg-[#141414] rounded-xl px-3 py-7 shadow-[0_0_25px_rgba(255,120,50,0.25)] min-w-[362px]",children:[i.jsx("div",{className:"rounded-lg overflow-hidden",children:i.jsx("video",{src:iB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},iB)}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>g(xe=>{const be=Number(xe||0);return be>1?String(be-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:x,onChange:xe=>{const be=xe.target.value.trim();if(be==="")return g("");fe(be)&&g(be)},onKeyDown:q,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] font-semibold outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>g(xe=>{const be=Number(xe||0);return String(be+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),x!==""&&!se&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),se&&i.jsxs("div",{className:"text-[12px] font-semibold text-green-400",children:[" ",x," months will be added to your subscription."]}),i.jsx("div",{className:"relative flex items-center justify-center gap-3 px-4 py-2 rounded-xl shadow-[0_0_25px_rgba(255,140,0,0.15)] backdrop-blur-md bg-white/5 border border-white/10",children:i.jsxs("span",{className:"text-2xl font-bold bg-gradient-to-r from-orange-400 to-pink-500 bg-clip-text text-transparent",children:[(x*.12).toFixed(2)," ETH"]})}),i.jsx("div",{onClick:xe=>{xe.preventDefault(),se&&we(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${se?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})})]})]})},Dwn=()=>{ns();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=m.useContext(Qr);return m.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await ki(x.toLowerCase(),f);v!=null&&v.success?(t(v==null?void 0:v.telegram_chat_id),e(v==null?void 0:v.subscriber_role),n(v==null?void 0:v.subs_expire_day),r((g=v==null?void 0:v.mushboomer_counts)==null?void 0:g.eth),s((y=v==null?void 0:v.mushboomer_counts)==null?void 0:y.sol),a(v==null?void 0:v.referral_code),o(v==null?void 0:v.refcode),l(v==null?void 0:v.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(v){console.error("Token verification error:",v),console.error(v.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Dextrabot Subscription"}),i.jsx("meta",{name:"description",content:"Subscribe to Dextrabot and unlock automated trading bots including Farm Bot, Grid Bot, Market Maker and Copy Trade. Smart automation for Hyperliquid & Lighter."}),i.jsx("meta",{name:"og:title",content:"Dextrabot Subscription"}),i.jsx("meta",{name:"og:description",content:"Subscribe to Dextrabot and unlock automated trading bots including Farm Bot, Grid Bot, Market Maker and Copy Trade. Smart automation for Hyperliquid & Lighter."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/subscribe"})]})}),i.jsx("div",{className:"flex justify-center items-start w-full h-[calc(100vh-5rem)] min-h-max px-4 pt-4 pb-10 bg-[#161616] md:bg-gradient-to-b from-[#0d0d0d] via-[#1a1a1a] to-[#0d0d0d]",children:i.jsx(Lwn,{})})]})},aKe=({open:t,setOpen:e,makerStatus:n,isStatusWallet:r,info:s,modalLoading:a})=>i.jsxs(_a,{open:t,onClose:e,className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#101010] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsx("div",{className:"flex flex-col justify-start items-center gap-8 w-[400px] h-max relative bg-[#252525] rounded-3xl pt-4 pb-6",children:i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>{e(!1)},className:"cursor-pointer flex w-full items-center justify-end absolute right-2 top-1",children:i.jsx("span",{className:"absolute top-2 right-2 w-9 h-9 rounded-full p-1 flex justify-center items-center hover:bg-[#7535FE]",children:i.jsx("img",{className:"p-1",src:Ua})})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsxs("div",{className:"flex flex-col justify-start items-center gap-2",children:[i.jsx("div",{className:"w-80 text-center text-white text-2xl font-semibold font-manropeleading-7",children:"Are you sure?"}),i.jsx("div",{className:"w-[348px] text-center text-white/60 text-[16px] font-medium font-manrope leading-5",children:s==="settings"||s==="table"&&(r!=null&&r.isDeleted)?"Do you want to start this Market Maker operation?":"Do you want to stop this Market Maker operation?"})]}),i.jsxs("div",{className:"flex items-center justify-center gap-4",children:[i.jsx("div",{onClick:()=>{e(!1)},className:"h-8 px-4 py-3 rounded-xl shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-white justify-center items-center gap-2.5 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-white text-[13px] font-medium font-inter leading-[8px]",children:"Cancel"})}),i.jsx("div",{onClick:o=>{a||(o.preventDefault(),s==="settings"?n():n(r))},className:`h-8 px-4 rounded-[10px] shadow border flex items-center justify-center cursor-pointer ${a?"bg-[#444] border-[#666] cursor-not-allowed":s==="settings"||s==="table"&&(r!=null&&r.isDeleted)?"bg-[#7445ff] border-[#8860ff]":"bg-[#ff4444] border-[#ff6666]"}`,children:a?i.jsx("span",{className:"text-white text-[13px] animate-pulse",children:"Loading..."}):i.jsx("span",{className:"text-white text-[13px]",children:s==="settings"||s==="table"&&(r!=null&&r.isDeleted)?"Start":"Stop"})})]})]})})})})})]}),Bwn=({fetchInfoOnOpen:t,setIsFilterWallet:e})=>{const[n,r]=m.useState([]),[s,a]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState([]),[x,g]=m.useState([]),[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState(!1);m.useState(!1);const[M,F]=m.useState(""),[$,L]=m.useState(!1),[z,X]=m.useState(null),[ne,J]=m.useState(""),[K,te]=m.useState(!1);m.useState(!1);const[fe,q]=m.useState([]),[se,ae]=m.useState("");m.useState("");const[W,V]=m.useState(100),[ee,oe]=m.useState("NEUTRAL"),[de,Ce]=m.useState("AGGRESSIVE"),[me,we]=m.useState("");m.useState(""),m.useState("");const[xe,be]=m.useState(!1),[je,Ie]=m.useState(!1),[Re,Qe]=m.useState(!1),{setSignModalOpen:Ke,setTelegramChatId:dt,setSubscriberRole:tt,setMushboomerETH:nt,setMushboomerSOL:Le,setIsReferralCode:Be,setIsReferralCodeName:ht,setIsWhitelist:pt,setHyperToken:Gt,setHyperAddress:wt}=m.useContext(Qr),nn="https://dextrabothypev2.nftinit.io",cn="https://api.hyperliquid.xyz/info",Un={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};m.useEffect(()=>{async function Dt(){var en;if(open)try{const tr=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/get_farming_coins/?app=hyper")).json();if(tr!=null&&tr.coins){const ar=(en=tr==null?void 0:tr.coins)==null?void 0:en.map(qt=>{const zn=(qt==null?void 0:qt.value)||"",Zn=Un[zn]||zn,Ft=Zn==="xyz:MSTR"?"":`https://app.hyperliquid.xyz/coins/${Zn}.svg`;return{...qt,icon:Ft}}),hr=tr.coins.filter(qt=>qt.value.includes(":")).map(qt=>{const[zn,Zn]=qt.value.split(":");return Zn});f(ar),g(hr)}}catch(Pn){console.error("Failed to fetch coin list:",Pn)}}Dt()},[]);const Xt=Dt=>{var en;return((en=d.find(Pn=>Pn.label===Dt))==null?void 0:en.maxLeverage)??100},an=Dt=>({HL_FEE:15e-5,BUILDER_FEE:2e-4,GROW_RATE:(x==null?void 0:x.includes(Dt))?.1:1}),Jt=(Dt,en)=>{if(!Dt||!en)return"";const{HL_FEE:Pn,BUILDER_FEE:tr,GROW_RATE:ar}=an(en);return(Number(Dt)*(Pn+tr*ar)).toFixed(0)},Ye=(Dt,en)=>{if(!Dt||!en)return"";const{HL_FEE:Pn,BUILDER_FEE:tr,GROW_RATE:ar}=an(en);return(Number(Dt)/(Pn+tr*ar)).toFixed(0)},Je=Dt=>Dt===""||Dt===null?"":Number(Dt).toLocaleString("en-US"),It=Dt=>Dt?Dt.replace(/,/g,""):"",hn=Dt=>{if(Dt==null||Dt==="")return"0.00";const en=Number(Dt);return Number.isNaN(en)?"0.00":en.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})},Yt=Dt=>/^\d*$/.test(Dt),Rt=Dt=>/^\d*\.?\d{0,6}$/.test(Dt),ot=Dt=>{["e","E","+","-"].includes(Dt.key)&&Dt.preventDefault()};m.useEffect(()=>{if(!o)return;const Dt=Xt(o),en=Number(se);!Number.isNaN(en)&&en>Dt&&ae(String(Dt)),!Number.isNaN(en)&&en<1&&se!==""&&ae("1")},[o]);const De=m.useMemo(()=>{if(!z||!se||!me)return"";const Dt=de==="NORMAL"?.02:de==="PASSIVE"?.05:.1,en=Number(z)*Number(se),Pn=Number(me)*Dt;return en>Pn?"":"Insufficient margin to create order, please increase your margin."},[z,se,me,de]),At=m.useMemo(()=>{if(se==="")return!1;const Dt=Number(se),en=Xt(o);return Number.isInteger(Dt)&&Dt>=1&&Dt<=en},[se,o,d]);m.useEffect(()=>{if(!o)return;const Dt=Xt(o),en=Number(se);!Number.isNaN(en)&&en>Dt&&ae(String(Dt)),!Number.isNaN(en)&&en<1&&se!==""&&ae("1")},[o]);const ze=m.useMemo(()=>{if(W==="")return!1;const Dt=Number(W);return Number.isNaN(Dt)?!1:Dt===0?!0:Dt>=0},[W]),rt=m.useMemo(()=>{if(me==="")return!1;const Dt=Number(me);return!Number.isNaN(Dt)&&Dt>0},[me]),mt=m.useMemo(()=>n.map(Dt=>{const en=(Dt==null?void 0:Dt.wallet_name)??(Dt==null?void 0:Dt.name)??(Dt==null?void 0:Dt.label)??String(Dt==null?void 0:Dt.wallet_id),Pn=(Dt==null?void 0:Dt.version)===3?`${en} - (API-AGENT) Wallet`:en;return{value:(Dt==null?void 0:Dt.wallet_id)??(Dt==null?void 0:Dt.id)??(Dt==null?void 0:Dt.value)??"",label:Pn,raw:Dt}}),[n]),Lt=m.useMemo(()=>{var Dt;return(Dt=mt.find(en=>String(en.value)===String(s)))==null?void 0:Dt.raw},[mt,s]),kt=m.useMemo(()=>{const Dt=Lt||{};return Dt.address||Dt.evm_address||Dt.wallet_address||Dt.public_address||Dt.eth_address||Dt.addr||null},[Lt]),dn=s!==""&&o!==""&&K&&At&&rt&&!De&&(ee==="LONG"||ee==="SHORT"||ee==="NEUTRAL")&&(de==="AGGRESSIVE"||de==="NORMAL"||de==="PASSIVE");m.useEffect(()=>{const Dt=localStorage.getItem("hyperToken"),en=localStorage.getItem("hyperAddress");te(!!(Dt&&en));const Pn=setInterval(()=>{const tr=localStorage.getItem("hyperToken"),ar=localStorage.getItem("hyperAddress");te(!!(tr&&ar))},800);return()=>clearInterval(Pn)},[]),m.useEffect(()=>{F(""),K&&An()},[K]),m.useEffect(()=>{kt?rn(kt):(X(null),J(""),q([]))},[kt]),m.useEffect(()=>{K&&(t(),Zt())},[K]);async function rn(Dt){var en;try{J(""),L(!0),X(null);const tr=await(await fetch(cn,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"clearinghouseState",user:Dt})})).json();X((en=tr==null?void 0:tr.marginSummary)==null?void 0:en.accountValue)}catch(Pn){J(Pn.message||"Failed to load USDC balance.")}finally{L(!1)}}function gn(){const Dt=kt||window.localStorage.getItem("hyperAddress");Dt&&rn(Dt)}async function An(){try{v(!0);const Dt=window.localStorage.getItem("hyperToken"),en=window.localStorage.getItem("hyperAddress");if(!Dt||!en){te(!1),Ke(!0);return}const tr=await(await fetch(`${nn}/api/wallet/confirmed-list`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:en.toLowerCase(),token:Dt})})).json();tr!=null&&tr.success?r((tr==null?void 0:tr.data)||[]):F((tr==null?void 0:tr.error_message)||"Failed to load wallets.")}catch(Dt){F(Dt.message||"Wallet list error.")}finally{v(!1)}}async function kn(){if(!K){Ke(!0);return}if(dn)try{T(!0),F(""),Qe(!0);const Dt=window.localStorage.getItem("hyperToken"),en=window.localStorage.getItem("hyperAddress");if(!Dt||!en){te(!1),Ke(!0);return}const Pn={coin:c,leverage:Number(se),volume:Number(me),orderBookDepth:1,perOrderPosValue:de==="PASSIVE"?2:de==="NORMAL"?5:10,direction:ee,executionMode:de,budget:Number(W)},tr={address:en.toLowerCase(),token:Dt,wallet_id:Number(s),source_market:"hyper",bot_params:Pn,coin:o},hr=await(await fetch(`${nn}/api/hyper/mmbot/save/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tr)})).json();hr!=null&&hr.success?(t(),tn.success("Successfully saved.",{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(103, 255, 189, 0.16)",width:"280px",minWidth:"280px",height:"40px",backdropFilter:"blur(16px)"},iconTheme:{primary:"#67FFBD",secondary:"#276047"}})):(F((hr==null?void 0:hr.error_message)||"Start failed."),tn.error((hr==null?void 0:hr.error_message)||"Save failed."))}catch(Dt){F(Dt.message||"An error occurred while saving.")}finally{T(!1),Ie(!1),Qe(!1)}}const yn=32,Vn={control:(Dt,en)=>({...Dt,backgroundColor:"#242424",borderColor:en.isFocused?"#67FFBD":"#353535",minHeight:yn,height:yn,boxShadow:"none",cursor:"pointer",alignItems:"center",minWidth:"max-content"}),valueContainer:Dt=>({...Dt,height:yn,paddingTop:0,paddingBottom:0,display:"flex",alignItems:"center"}),indicatorsContainer:Dt=>({...Dt,height:yn}),input:Dt=>({...Dt,color:"#FFFFFF",margin:0,padding:0}),singleValue:Dt=>({...Dt,color:"#FFFFFF",margin:0,lineHeight:"normal",fontSize:"12px",display:"flex",alignItems:"center"}),placeholder:Dt=>({...Dt,color:"#7F7F7F",fontSize:"12px"}),menu:Dt=>({...Dt,backgroundColor:"#242424",border:"1px solid #353535",zIndex:9999}),menuList:Dt=>({...Dt,paddingTop:0,paddingBottom:0,maxHeight:180}),option:(Dt,en)=>({...Dt,backgroundColor:en.isFocused?"#2e2e2e":"#242424",color:"#FFFFFF",cursor:"pointer",minHeight:yn,display:"flex",alignItems:"center",fontSize:"12px"}),dropdownIndicator:Dt=>({...Dt,color:"#9B9B9B",paddingTop:4,paddingBottom:4}),indicatorSeparator:Dt=>({...Dt,backgroundColor:"#353535"})},Kn=({max:Dt})=>i.jsxs("span",{className:"inline-flex items-center h-4 px-1.5 py-2 rounded bg-black/40 border border-[#2A2A2A] text-[10px] text-[#CECECE] font-bold",children:[Dt,"x"]}),Dn=()=>i.jsx("div",{className:"px-2 py-0.5 rounded-md bg-[#0f1b1b] text-[#67ffbd] text-[10px] font-semibold",children:"xyz"}),Xn=Dt=>{var Pn;const en=x==null?void 0:x.includes(Dt.data.label);return i.jsx(Sa.Option,{...Dt,children:i.jsxs("div",{className:"flex items-center gap-2 px-3",children:[(Pn=Dt.data)!=null&&Pn.icon?i.jsx("img",{src:Dt.data.icon,alt:Dt.data.label,className:"w-4 h-4",onError:tr=>tr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F]"}),i.jsx("span",{className:"text-white text-[13px]",children:Dt.data.label}),en&&i.jsx(Dn,{}),i.jsx(Kn,{max:Dt.data.maxLeverage})]})})},Nn=Dt=>{var Pn;const en=x==null?void 0:x.includes(Dt.data.label);return i.jsx(Sa.SingleValue,{...Dt,children:i.jsxs("div",{className:"flex items-center gap-2",children:[(Pn=Dt.data)!=null&&Pn.icon?i.jsx("img",{src:Dt.data.icon,alt:Dt.data.label,className:"w-4 h-4",onError:tr=>tr.currentTarget.style.display="none"}):i.jsx("div",{className:"rounded-full w-4 h-4 min-w-4 min-h-4 bg-[#4F4F4F]"}),i.jsx("span",{className:"text-white text-[13px]",children:Dt.data.label}),en&&i.jsx(Dn,{}),i.jsx(Kn,{max:Dt.data.maxLeverage})]})})},on=(Dt,en)=>{if(l(Dt),u(en),W===""&&me===""){V(100),we(Ye(100,Dt));return}if(W===""&&me!==""){V(Jt(me,Dt));return}if(W!==""&&me===""){we(Ye(W,Dt));return}V(Jt(me,Dt))},Oe=d,Zt=async()=>{var Pn,tr;const Dt=window.localStorage.getItem("hyperToken"),en=window.localStorage.getItem("hyperAddress");if(!(!Dt||!en))try{N(!0);const ar=await ki(en.toLowerCase(),Dt);ar!=null&&ar.success?(dt(ar==null?void 0:ar.telegram_chat_id),tt(ar==null?void 0:ar.subscriber_role),nt((Pn=ar==null?void 0:ar.mushboomer_counts)==null?void 0:Pn.eth),Le((tr=ar==null?void 0:ar.mushboomer_counts)==null?void 0:tr.sol),Be(ar==null?void 0:ar.referral_code),ht(ar==null?void 0:ar.refcode),pt(ar==null?void 0:ar.whitelist),Gt(Dt),wt(en),N(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),Gt(""),wt(""),N(!1))}catch(ar){console.error("Token verification error:",ar),console.error(ar.message||"An unknown error occurred."),N(!1)}},sn=Dt=>i.jsxs(Sa.MenuList,{...Dt,children:[i.jsxs("div",{onClick:()=>{Dt.selectProps.setIsGenWalletModal(!0)},className:"mx-2 mt-2 mb-1 px-3 py-2 bg-[#7445ff] hover:bg-[#5834C3] rounded-md text-white text-[13px] font-medium cursor-pointer flex items-center gap-2",children:[i.jsx("span",{className:"text-[18px] leading-none",children:"+"}),"Add Account"]}),i.jsx("div",{className:"h-px bg-[#353535] my-1 mx-2"}),Dt.children]}),jt=y||P,Qn=!1,bn=Xt(o);return i.jsxs(i.Fragment,{children:[xe&&Aa.createPortal(i.jsx("div",{className:"fixed inset-0 z-[999999999]",children:i.jsx(P5,{open:xe,setOpen:be,handleListRequest:An,handlePageChange:()=>{}})}),document.body),i.jsx(aKe,{open:je,setOpen:Ie,makerStatus:kn,isStatusWallet:"",info:"settings",modalLoading:Re}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 w-full",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Select Wallet"}),i.jsxs("div",{className:"relative",children:[i.jsx(jl,{styles:Vn,isDisabled:jt||y||Qn,isLoading:y,options:mt,components:{MenuList:sn},setIsGenWalletModal:be,value:mt.find(Dt=>String(Dt.value)===String(s))||null,onChange:Dt=>{a((Dt==null?void 0:Dt.value)??""),e((Dt==null?void 0:Dt.value)??"")},placeholder:K?y?"Loading...":"Select":"Connect to select",isSearchable:!0,onMenuOpen:()=>{K||Ke(!0)},menuIsOpen:K?void 0:!1}),!K&&i.jsx("button",{type:"button",onClick:()=>Ke(!0),className:"absolute inset-0 rounded-md cursor-pointer bg-transparent","aria-label":"Connect to select",title:"Connect"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Select Coin"}),i.jsx(jl,{styles:Vn,components:{Option:Xn,SingleValue:Nn},isDisabled:jt||Qn,options:Oe,value:Oe.find(Dt=>Dt.label===o)||null,onChange:Dt=>on((Dt==null?void 0:Dt.label)??"",(Dt==null?void 0:Dt.value)??""),placeholder:"Select",isSearchable:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Leverage"}),i.jsx("input",{value:se,onChange:Dt=>{const en=Dt.target.value.trim();if(en==="")return ae("");Yt(en)&&ae(en)},onKeyDown:ot,inputMode:"numeric",autoComplete:"off",placeholder:o?`1–${bn}x`:"e.g. 3",className:`w-full h-8 px-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${se===""?"border-[#353535]":At?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:jt||Qn})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Budget"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"$"}),i.jsx("input",{value:Je(W),onChange:Dt=>{let en=It(Dt.target.value);if(en===""){V(""),we("");return}if(Rt(en)){V(en);const Pn=Ye(en,o);we(Pn)}},onKeyDown:ot,inputMode:"decimal",autoComplete:"off",placeholder:"e.g. 5",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${W===""?"border-[#353535]":ze?"border-[#353535] focus:border-[#67FFBD]":"border-[#FF797C]"}`,disabled:jt||Qn})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Volume"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-2 top-1/2 -translate-y-1/2 text-[#7F7F7F] font-semibold",children:"$"}),i.jsx("input",{value:Je(me),onChange:Dt=>{let en=It(Dt.target.value);if(en===""){we(""),V("");return}if(Rt(en)){we(en);const Pn=Jt(en,o);V(Pn)}},onKeyDown:ot,inputMode:"decimal",autoComplete:"off",placeholder:"VOLUME",className:`w-full h-8 pl-7 pr-3 rounded-md bg-[#242424] border text-[13px] outline-none placeholder:text-[#7F7F7F] ${me===""?"border-[#353535]":"border-[#353535] focus:border-[#67FFBD]"}`,disabled:jt||Qn})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Directional Bias"}),i.jsxs("div",{className:"flex items-center gap-2 md:pr-6 xl:pt-1",children:[i.jsx("div",{"aria-pressed":ee==="SHORT",onClick:()=>oe("SHORT"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",jt||Qn?"cursor-not-allowed":"cursor-pointer",ee==="SHORT"?"bg-[#FF797C] text-black border-[#FF797C] shadow-[0_0_0_3px_rgba(255,121,124,0.25)]":"text-[#FF787B] bg-[#FF797C]/20 border-[#2A2A2A] hover:bg-[#FF797C]/30"].join(" "),children:i.jsx("span",{className:"min-w-max",children:"SHORT"})}),i.jsx("div",{"aria-pressed":ee==="NEUTRAL",onClick:()=>oe("NEUTRAL"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",jt||Qn?"cursor-not-allowed":"cursor-pointer",ee==="NEUTRAL"?"bg-[#3b82f6] text-[#ffffff] border-[#93c5fd] shadow-[0_0_0_3px_rgba(59,130,246,0.3)]":"text-[#3b82f6] bg-[rgba(59,130,246,0.15)] border-[rgba(59,130,246,0.15)] hover:bg-[#2563eb] hover:text-white"].join(" "),children:i.jsx("span",{className:"min-w-max",children:"NEUTRAL"})}),i.jsx("div",{"aria-pressed":ee==="LONG",onClick:()=>oe("LONG"),className:["inline-flex justify-center items-center gap-1.5 h-6 rounded-[8px] uppercase tracking-wide font-semibold transition-all border w-1/2","text-[8.5px] px-1",jt||Qn?"cursor-not-allowed":"cursor-pointer",ee==="LONG"?"bg-[#67FFBD] text-black border-[#67FFBD] shadow-[0_0_0_3px_rgba(103,255,189,0.25)]":"text-[#67FFBD] bg-[#67FFBD]/15 border-[#2A2A2A] hover:bg-[#67FFBD]/25"].join(" "),children:i.jsx("span",{className:"min-w-max",children:"LONG"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[13px] text-[#7C7C7C] font-manrope font-semibold leading-[8px]",children:"Execution Mode"}),i.jsxs("div",{className:"flex items-center gap-3 xl:pt-1",children:[i.jsx("button",{"aria-pressed":de==="AGGRESSIVE",onClick:()=>Ce("AGGRESSIVE"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",jt||Qn?"cursor-not-allowed":"cursor-pointer",de==="AGGRESSIVE"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["AGGRESSIVE ",de==="AGGRESSIVE"?" ✓":""]})}),i.jsx("button",{"aria-pressed":de==="NORMAL",onClick:()=>Ce("NORMAL"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",jt||Qn?"cursor-not-allowed":"cursor-pointer",de==="NORMAL"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["NORMAL ",de==="NORMAL"?" ✓":""]})}),i.jsx("button",{"aria-pressed":de==="PASSIVE",onClick:()=>Ce("PASSIVE"),className:["inline-flex justify-center items-center gap-1.5 h-6 px-2 rounded-[8px] uppercase tracking-wide text-[8.5px] font-semibold transition-all border w-1/2",jt||Qn?"cursor-not-allowed":"cursor-pointer",de==="PASSIVE"?"bg-[#8e643a] text-white border-[#44382C]":"text-[#7C7C7C] bg-transparent border-[#404040] hover:bg-[#404040]/25 hover:text-white"].join(" "),children:i.jsxs("span",{children:["PASSIVE ",de==="PASSIVE"?" ✓":""]})})]})]})]}),i.jsxs("div",{className:"flex items-start gap-3 mt-3 pt-3 border-t border-[#353535] bg[rgba(27,27,27,0.32)] rounded-b-3xl w-full",children:[i.jsxs("div",{className:"flex basis-1/2 flex-col gap-1",children:[K&&i.jsxs("div",{className:"text-[12px] text-[#9B9B9B] flex items-center gap-2",children:["Available Perp Balance (USDC):",i.jsx("span",{className:"text-white",children:$?"Loading...":ne?"—":hn(z??"0")}),i.jsx("div",{onClick:gn,className:"flex justify-center items-center cursor-pointer",title:"Refresh balance",children:i.jsx(XS,{className:`w-4 h-4 ${$?"animate-spin":""}`})})]}),De&&i.jsxs("div",{className:"flex justify-start items-center gap-2 text-[12px] text-[#FF797C] bg-[#3b2626] border border-[#ff797c]/30 rounded-md px-3 py-1.5 max-w-[470px]",children:[i.jsx("img",{src:rc,alt:"Dextrabot",className:"w-3.5 min-w-3.5 min-h-3.5 h-3.5"}),i.jsxs("div",{className:"text-[#FF797C] text-[11px] leading-[14px]",children:[De+" ",i.jsxs("span",{onClick:()=>window.open("https://docs.dextrabot.com/market-maker-bot/hyperliquid-market-maker-bot#margin-requirements","_blank"),className:"underline cursor-pointer text-[#FF797C] hover:text-white inline-flex items-center gap-1",children:["How it works",i.jsx("img",{src:Am,alt:"Dextrabot",className:"w-2.5 h-2.5"})]})]})]})]}),i.jsx("div",{className:"flex flex-col items-end sm:flex-row sm:justify-end gap-2 sm:gap-4 w-full basis-1/2",children:i.jsx("div",{className:"flex justify-end items-center",children:i.jsx("button",{onClick:()=>{Ie(!0)},disabled:!dn||jt,className:`flex items-center justify-center h-8 px-6 rounded-[10px] text-[13px] border ${!dn||jt?"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed":"bg-[#7446FF] border-[#8861FF] hover:bg-[#5834C3] cursor-pointer"}`,children:P?"Loading...":"Start"})})})]})]})},$wn=({isOpen:t,onClose:e,children:n,fullscreen:r=!1,blurBackground:s=!1})=>{const[a,o]=m.useState(t),[l,c]=m.useState(!1);m.useEffect(()=>{if(t)o(!0),requestAnimationFrame(()=>c(!0));else{c(!1);const d=setTimeout(()=>o(!1),300);return()=>clearTimeout(d)}},[t]),m.useEffect(()=>{const d=f=>{f.key==="Escape"&&u()};return a&&(document.body.style.overflow="hidden",document.addEventListener("keydown",d)),()=>{document.body.style.overflow="",document.removeEventListener("keydown",d)}},[a]);const u=()=>{c(!1),setTimeout(()=>{e()},300)};return a?Aa.createPortal(i.jsxs("div",{className:`fixed inset-0 z-[100] transition-opacity duration-300 ${l?"opacity-100":"opacity-0"} flex items-center justify-center`,children:[i.jsx("div",{className:`absolute inset-0 ${s?"backdrop-blur-md bg-black/50":"bg-black/50"}`,onClick:u}),i.jsxs("div",{className:`relative bg-[#101010] shadow-lg transform transition-transform duration-300 ${l?"translate-y-0":"translate-y-full"} ${r?"w-screen h-[100dvh] rounded-none p-0":"w-auto max-w-[95vw] max-h-[95vh] rounded-t-[24px] p-2"}`,onClick:d=>d.stopPropagation(),children:[n,i.jsx("div",{className:`absolute ${r?"top-4 right-4 text-white":"top-2 right-4 text-gray-400 hover:text-white"} text-2xl cursor-pointer z-50`,onClick:u,children:"×"})]})]}),document.body):null},Uwn=({data:t,shareModalOpen:e,setShareModalOpen:n})=>{var C,N,P,T,M;const{isReferralCodeName:r}=m.useContext(Qr),[s,a]=m.useState(qa),[o,l]=m.useState(!0),c=m.useRef(null),u=async()=>{if(c.current)try{await document.fonts.ready,await new Promise(L=>setTimeout(L,500));const F=await V1(c.current,{cacheBust:!0,backgroundColor:null,useCORS:!0,style:{transform:"scale(1)",transformOrigin:"top left"}}),$=document.createElement("a");$.href=F,$.download="dextrabot-market-maker.png",document.body.appendChild($),$.click(),document.body.removeChild($),tn.success("PNG successfully downloaded!")}catch(F){console.error("Error generating PNG:",F),tn.error("Failed to download PNG.")}},d=async F=>{l(!0);try{const L=await(await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(F)}`)).blob();return new Promise((z,X)=>{const ne=new FileReader;ne.onloadend=()=>z(ne.result),ne.onerror=X,ne.readAsDataURL(L)})}catch($){throw console.error("Image conversion failed:",$),$}finally{l(!1)}};m.useEffect(()=>{t!=null&&t.coin&&d(`https://app.hyperliquid.xyz/coins/${t==null?void 0:t.coin}.svg`).then(F=>a(F)).catch(()=>a(qa))},[t]);const f=r||window.localStorage.getItem("refcode")||"",x=f?`https://app.dextrabot.com/referral/${f}`:"",g=t?`I’m market making #${t==null?void 0:t.coin} with Dextrabot on Hyperliquid HIP-3
Low risk. High XP.
Watch me farm the airdrop while everyone sleep.
Volume: $${((N=(C=t==null?void 0:t.bot_params)==null?void 0:C.volume)==null?void 0:N.toLocaleString("en-US"))||0}`:`I’m market making with Dextrabot on Hyperliquid HIP-3
Low risk. High XP.
Watch me farm the airdrop while everyone sleep.`,y=x||"https://app.dextrabot.com/market-maker",v=`https://x.com/intent/post?text=${encodeURIComponent(g)}&url=${encodeURIComponent(y)}`;return i.jsx(i.Fragment,{children:i.jsx($wn,{isOpen:e,onClose:()=>n(!1),blurBackground:!0,children:i.jsxs("div",{className:"w-[340px] sm:w-[460px] bg-[#101010] rounded-3xl p-6 text-white",children:[i.jsxs("div",{ref:c,className:"bg-gradient-to-b from-[#0c1414] via-[#040707] to-[#040505] rounded-[32px] border border-emerald-500/10 p-5 shadow-[0_0_60px_rgba(0,255,200,0.08)]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("p",{className:"text-sm uppercase tracking-[0.3em] text-white/70",children:"Market Maker"}),i.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 rounded-full bg-white/5 border border-white/10",children:[i.jsx("img",{src:WA,alt:"Dextrabot",className:"w-5 h-5 rounded-full"}),i.jsx("span",{className:"text-xs font-semibold tracking-wide",children:"DEXTRABOT"})]})]}),i.jsxs("div",{className:"mt-5 bg-[#05090a] rounded-3xl p-5 text-center border border-white/5",children:[i.jsx("p",{className:"text-xs uppercase tracking-[0.4em] text-white/50",children:"VOLUME"}),i.jsxs("p",{className:"text-4xl font-bold text-[#67FFBD] mt-2",children:["$",(P=t==null?void 0:t.bot_params)!=null&&P.volume?Ms((T=t==null?void 0:t.bot_params)==null?void 0:T.volume):"--"]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-6 text-left",children:[i.jsxs("div",{className:"bg-white/3 rounded-2xl p-3 border border-white/5",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-wide text-white/50",children:"Coin"}),i.jsxs("p",{className:"text-lg font-semibold text-white mt-1 flex items-center gap-2",children:[o?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[34px] px-0.5 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("img",{src:s||qa,alt:"",className:"rounded-full w-8 h-8",onError:F=>oa(F)}),(t==null?void 0:t.coin)||"--"]})]}),i.jsxs("div",{className:"bg-white/3 rounded-2xl p-3 border border-white/5",children:[i.jsx("p",{className:"text-[11px] uppercase tracking-wide text-white/50",children:"Directional Bias"}),i.jsx("p",{className:"text-lg font-semibold text-white mt-1",children:((M=t==null?void 0:t.bot_params)==null?void 0:M.direction)||"--"})]})]})]}),i.jsxs("div",{className:"mt-4 flex items-center justify-between text-[11px] text-white/50",children:[i.jsx("span",{children:"Generated by Dextrabot"}),i.jsx("span",{children:new Date().toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]}),!t&&i.jsx("p",{className:"text-xs text-white/60 mt-4",children:"An unknown error has occurred."}),i.jsxs("div",{className:"mt-6 space-y-3",children:[i.jsx("button",{onClick:F=>{F.preventDefault(),o||u()},disabled:!t,className:`${o?"cursor-not-allowed":"cursor-pointer"} w-full border border-emerald-400/60 rounded-2xl py-3
text-emerald-300 font-semibold hover:bg-emerald-400/10
transition disabled:opacity-40 disabled:cursor-not-allowed`,children:"Download image"}),i.jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:`w-full block text-center bg-white text-black
font-semibold rounded-2xl py-3 hover:bg-gray-100 transition`,children:"Share on X"})]})]})})})},zwn=({data:t,setData:e,loading:n,error:r,fetchInfoOnOpen:s,isFilterWallet:a})=>{var Jt,Ye;m.useContext(Qr);const{isConnected:o,address:l}=ns(),[c,u]=m.useState([]),[d,f]=m.useState(null),[x,g]=m.useState(!1);m.useState(!1);const[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState({}),[M,F]=m.useState(!1),[$,L]=m.useState({id:"",walletAddress:"",isDeleted:!1}),[z,X]=m.useState(!1),[ne,J]=m.useState(""),[K,te]=m.useState([]),[fe,q]=m.useState([]),[se,ae]=m.useState([]),[W,V]=m.useState(!1),[ee,oe]=m.useState(!1),[de,Ce]=m.useState(!1),[me,we]=m.useState(!1),xe=m.useRef(null),be=m.useRef(null),je=m.useRef(null),Ie=m.useRef(null),[Re,Qe]=m.useState(!1),Ke="tag",[dt,tt]=m.useState(Ke),nt=Je=>{if(!y){let It=t;a&&(It=It==null?void 0:It.filter(Yt=>String(Yt==null?void 0:Yt.wallet_id)===String(a)));const hn=It==null?void 0:It.filter(Yt=>{var Rt,ot,De,At,ze,rt,mt,Lt;if(K.length>0){const kt=K.includes("HyperLiquid")&&(Yt==null?void 0:Yt.source_market)==="hyper",dn=K.includes("Lighter")&&(Yt==null?void 0:Yt.source_market)==="lighter";if(!kt&&!dn)return!1}if(fe.length>0){const kt=fe.includes("Short")&&((Rt=Yt==null?void 0:Yt.bot_params)==null?void 0:Rt.direction)==="SHORT",dn=fe.includes("Neutral")&&((ot=Yt==null?void 0:Yt.bot_params)==null?void 0:ot.direction)==="NEUTRAL",rn=fe.includes("Long")&&((De=Yt==null?void 0:Yt.bot_params)==null?void 0:De.direction)==="LONG";if(!kt&&!dn&&!rn)return!1}if(se.length>0){const kt=se.includes("Aggressive")&&((At=Yt==null?void 0:Yt.bot_params)==null?void 0:At.executionMode)==="AGGRESSIVE",dn=se.includes("Normal")&&((ze=Yt==null?void 0:Yt.bot_params)==null?void 0:ze.executionMode)==="NORMAL",rn=se.includes("Passive")&&((rt=Yt==null?void 0:Yt.bot_params)==null?void 0:rt.executionMode)==="PASSIVE";if(!kt&&!dn&&!rn)return!1}return!(Re&&(Yt!=null&&Yt.is_deleted)||ne&&!((Lt=(mt=Yt==null?void 0:Yt.bot_params)==null?void 0:mt.coin)!=null&&Lt.toLowerCase().includes(ne.toLowerCase())))});return hn==null?void 0:hn.sort((Yt,Rt)=>{var Vn,Kn,Dn,Xn,Nn,on,Oe,Zt,sn,jt,Qn,bn,Dt,en;const ot=((Kn=(Vn=Yt==null?void 0:Yt.bot_params)==null?void 0:Vn.coin)==null?void 0:Kn.toUpperCase())||"",De=((Xn=(Dn=Rt==null?void 0:Rt.bot_params)==null?void 0:Dn.coin)==null?void 0:Xn.toUpperCase())||"",At=(Yt==null?void 0:Yt.wallet_id)||0,ze=(Rt==null?void 0:Rt.wallet_id)||0,rt=Number(((Nn=Yt==null?void 0:Yt.bot_params)==null?void 0:Nn.volume)||0),mt=Number(((on=Rt==null?void 0:Rt.bot_params)==null?void 0:on.volume)||0),Lt=Number(((Oe=Yt==null?void 0:Yt.bot_params)==null?void 0:Oe.volume)||0),kt=Number(((Zt=Rt==null?void 0:Rt.bot_params)==null?void 0:Zt.volume)||0),dn=Number(((sn=Yt==null?void 0:Yt.bot_params)==null?void 0:sn.volume)||0),rn=Number(((jt=Rt==null?void 0:Rt.bot_params)==null?void 0:jt.volume)||0),gn=Number(((Qn=Yt==null?void 0:Yt.bot_params)==null?void 0:Qn.leverage)||0),An=Number(((bn=Rt==null?void 0:Rt.bot_params)==null?void 0:bn.leverage)||0),kn=Number(((Dt=Yt==null?void 0:Yt.bot_params)==null?void 0:Dt.budget)||0),yn=Number(((en=Rt==null?void 0:Rt.bot_params)==null?void 0:en.budget)||0);return Je==="coin"?ot<De?-1:ot>De?1:0:Je==="-coin"?ot>De?-1:ot<De?1:0:Je==="account"?At>ze?-1:At<ze?1:0:Je==="-account"?At<ze?-1:At>ze?1:0:Je==="volume"?rt-mt:Je==="-volume"?mt-rt:Je==="order"?Lt-kt:Je==="-order"?kt-Lt:Je==="perOrder"?dn-rn:Je==="-perOrder"?rn-dn:Je==="leverage"?gn-An:Je==="-leverage"?An-gn:Je==="budget"?kn-yn:Je==="-budget"?yn-kn:0})}return t},Le=m.useRef(null),Be=["Short","Neutral","Long"],ht=["Aggressive","Normal","Passive"],pt=Je=>{q(It=>It.includes(Je)?It.filter(hn=>hn!==Je):[...It,Je])},Gt=Je=>{ae(It=>It.includes(Je)?It.filter(hn=>hn!==Je):[...It,Je])};m.useEffect(()=>{function Je(It){xe.current&&!xe.current.contains(It.target)&&oe(!1),be.current&&!be.current.contains(It.target)&&Ce(!1),Ie.current&&!Ie.current.contains(It.target)&&we(!1),je.current&&!je.current.contains(It.target)&&V(!1)}return document.addEventListener("mousedown",Je),()=>document.removeEventListener("mousedown",Je)},[]);const wt=async({id:Je,walletAddress:It,isDeleted:hn})=>{try{const Yt=window.localStorage.getItem("hyperToken"),Rt=window.localStorage.getItem("hyperAddress");if(!Yt||!Rt||!Je){tn.error("Something went wrong!");return}X(!0),It&&T(rt=>({...rt,[It]:!0}));const ot="https://dextrabothypev2.nftinit.io/api/hyper/mmbot/update/",De={is_deleted:!hn},ze=await(await fetch(ot,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l?l.toLowerCase():Rt,token:Yt,bot_id:Number(Je),update_params:De})})).json();ze.success?(e((ze==null?void 0:ze.data)||[]),tn.success("Action completed successfully.")):tn.error(ze.error_message),F(!1)}catch{tn.error("Something went wrong")}finally{X(!1),T(Yt=>({...Yt,[It]:!1}))}},nn=async()=>{try{const Je=window.localStorage.getItem("hyperToken"),It=window.localStorage.getItem("hyperAddress");if(!Je||!It)return;const Rt=await(await fetch("https://dextrabothypev2.nftinit.io/api/hyper/mmbot/feed/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:l?l.toLowerCase():It,token:Je})})).json();Rt.success&&u((Rt==null?void 0:Rt.data)||[])}catch(Je){tn.error(Je.message||"Something went wrong")}finally{}};m.useEffect(()=>{nn();const Je=setInterval(()=>{nn()},15e3);return()=>clearInterval(Je)},[t]);const cn=m.useMemo(()=>{const Je={};return c==null||c.forEach(It=>{It!=null&&It.id&&(Je[It.id]=It.bot_params)}),Je},[c]);m.useEffect(()=>{const Je=localStorage.getItem("hyperToken"),It=localStorage.getItem("hyperAddress");N(!!(Je&&It));const hn=setInterval(()=>{const Yt=localStorage.getItem("hyperToken"),Rt=localStorage.getItem("hyperAddress");N(!!(Yt&&Rt))},800);return()=>clearInterval(hn)},[]);const Un={started:{label:"Started",color:"text-[#67FFBD]"},stopped:{label:"Stopped",color:"text-[#FF7173]"},completed:{label:"Completed",color:"text-[#F5D97A]"},forced_stopped:{label:"Stopped",color:"text-[#FF9E57]"}},Xt=()=>i.jsx(XS,{className:"w-4 h-4 text-yellow-400"}),an={kBONK:"BONK",kPEPE:"PEPE",kSHIB:"SHIB",kFLOKI:"FLOKI",kNEIRO:"NEIRO",kDOGS:"DOGS",kLUNC:"LUNC"};return i.jsxs(i.Fragment,{children:[i.jsx(aKe,{open:M,setOpen:F,makerStatus:wt,isStatusWallet:$,info:"table",modalLoading:z}),i.jsx(Uwn,{data:d,shareModalOpen:x,setShareModalOpen:g}),i.jsxs("div",{className:"flex flex-col items-stretch justify-start gap-[17px] text-white w-full font-manrope",children:[i.jsx("div",{className:"flex flex-col items-start justify-start gap-2 font-manrope max-w-full w-full pl-2 sm:pl-0 pt-2",children:i.jsxs("div",{className:"flex items-center justify-between gap-4 w-full px-2 sm:px-3",children:[i.jsx("div",{className:"text-white text-lg font-medium font-manrope leading-[21px]",children:"History"}),i.jsxs("label",{onClick:()=>Qe(!Re),className:"flex items-center gap-2 p-[3px] px-1 h-6 relative rounded cursor-pointer text-white text-[13px] font-semibold font-manrope",children:[i.jsx("div",{className:`w-[18px] h-[18px] flex items-center justify-center border ${Re?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} rounded`,children:Re&&i.jsx("img",{src:eu,alt:"",className:"w-[8.5px] h-[5.6px] ml-[1px]"})}),"Active Only"]})]})}),i.jsx("div",{className:"relative w-full h-full",children:i.jsx("div",{className:"w-full h-full max-h-[540px] overflow-x-scroll relative overflow-y-scroll flex-grow",ref:Le,children:i.jsxs("table",{className:"w-full relative mb-20",children:[i.jsx("thead",{className:"sticky top-0 z-[3] bg-[#090909] whitespace-nowrap",children:i.jsxs("tr",{className:"w-full z-[4] text-[#9b9b9b] text-[13px] font-semibold font-manrope leading-[13px] tracking-tight",children:[i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#090909] sm:left-0 h-8 pl-3 min-w-[120px] sm:min-w-[120px] z-[8] relative",children:i.jsxs("div",{className:"flex items-center justify-start w-full min-w-max sticky left-0 h-8",children:[i.jsx(mi,{title:"Coin",sortKey:"coin",sortOption:dt,setSortOption:tt,isFilterIcon:!1}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>V(!W),className:`${ne?"bg-gray-900":"bg-[#555555]"} inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${ne?"text-blue-500":"text-white"}`})}),W&&i.jsxs("div",{ref:je,className:"absolute left-[58px] mt-32 w-[208px] bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10",children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>J(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),i.jsx("input",{type:"text",value:ne,onChange:Je=>J(Je.target.value),className:"bg-[#333] rounded text-white py-1 px-2 text-sm outline-none mt-2 placeholder:text-sm placeholder:font-semibold placeholder:font-manrope placeholder:text-[#7c7c7c]",placeholder:"Coin"})]})]})]})}),i.jsx("th",{scope:"col",className:"font-medium sm:sticky bg-[#090909] left-[120px] h-8 px-1 min-w-[130px] z-[8] relative",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max h-8",children:i.jsx("div",{className:"flex items-center justify-start",children:"Account"})})}),i.jsx("th",{scope:"col",className:"font-medium bg-[#090909] h-8 px-1 min-w-[100px] z-[7]",children:i.jsx("div",{className:"flex items-center justify-start w-full min-w-max h-8",children:i.jsx(mi,{title:"Leverage",sortKey:"leverage",sortOption:dt,setSortOption:tt,isFilterIcon:!1})})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[110px] z-[7]",children:i.jsx(mi,{title:"Volume",sortKey:"volume",sortOption:dt,setSortOption:tt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[120px] z-[8]",children:i.jsx(mi,{title:"Budget",sortKey:"budget",sortOption:dt,setSortOption:tt,isFilterIcon:!1})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[120px] z-[7] relative",children:i.jsxs("div",{className:"flex items-center justify-start w-full min-w-max h-8",children:[i.jsx("div",{className:"flex items-center justify-start",children:"Direction"}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>Ce(!de),className:`${fe.length>0?"bg-gray-900":"bg-[#555555]"} ml-2 inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${fe.length>0?"text-blue-500":"text-white"}`})}),de&&i.jsxs("div",{ref:be,className:`absolute left-[58px] mt-44 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>q(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),Be==null?void 0:Be.map(Je=>i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-6 relative rounded hover:bg-[#464646] cursor-pointer text-white text-[13px] font-semibold font-manrope leading-[8px] mt-2",children:[i.jsx("input",{type:"checkbox",checked:fe.includes(Je),onChange:()=>pt(Je),className:"mr-2 bg-[#3b3b3b] hidden "}),i.jsx("div",{className:`w-4 h-4 max-w-4 max-h-4 flex items-center justify-center border ${fe.includes(Je)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:fe.includes(Je)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),Je]},Je))]})]})]})}),i.jsx("th",{scope:"col",className:"bg-[#090909] h-10 px-1 min-w-[150px] z-[6] relative",children:i.jsxs("div",{className:"flex items-center justify-start w-full min-w-max h-8",children:[i.jsx("div",{className:"flex items-center justify-start",children:"Execution Mode"}),i.jsxs("div",{className:"flex items-center justify-start",children:[i.jsx("button",{onClick:()=>we(!me),className:`${se.length>0?"bg-gray-900":"bg-[#555555]"} ml-2 inline-flex items-center p-1 rounded hover:bg-gray-700 focus:outline-none focus:ring-0 border-none`,children:i.jsx(Xf,{className:`w-4 h-4 ${se.length>0?"text-blue-500":"text-white"}`})}),me&&i.jsxs("div",{ref:Ie,className:`absolute left-[58px] mt-44 w-[208px]
bg-[#222] border border-gray-700 rounded shadow-lg p-2 z-10`,children:[i.jsxs("div",{className:"flex justify-between items-center px-2 pb-2 border-b border-gray-600",children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:"Filter"}),i.jsx("div",{onClick:()=>ae(""),className:"h-5 px-2 py-1.5 bg-[#3d3d3d] rounded-md justify-start items-center gap-2 inline-flex cursor-pointer",children:i.jsx("div",{className:"text-[#cdcdcd] text-[11px] font-semibold font-manrope leading-[8px] pointer-events-none",children:"Clear All"})})]}),ht==null?void 0:ht.map(Je=>i.jsxs("label",{className:"flex items-center gap-2 p-[7px] h-6 relative rounded hover:bg-[#464646] cursor-pointer text-white text-[13px] font-semibold font-manrope leading-[8px] mt-2",children:[i.jsx("input",{type:"checkbox",checked:se.includes(Je),onChange:()=>Gt(Je),className:"mr-2 bg-[#3b3b3b] hidden "}),i.jsx("div",{className:`w-4 h-4 max-w-4 max-h-4 flex items-center justify-center border ${se.includes(Je)?"bg-[#3ec78c] border-[#3ec78c]":"border-[#9d9d9d]"} w-[18px] h-[18px] relative rounded border`,children:se.includes(Je)&&i.jsx("img",{src:eu,alt:"",className:"w-[8.50px] h-[5.66px] ml-[1px]"})}),Je]},Je))]})]})]})}),i.jsx("th",{scope:"col",className:"min-w-[90px] px-1",children:i.jsx("div",{className:"flex items-center justify-start gap-1 min-w-max font-manrope",children:i.jsx("div",{className:"flex items-center justify-start group",children:"Process"})})}),i.jsx("th",{scope:"col",className:"min-w-[90px] px-1",children:i.jsx("div",{className:"flex items-center justify-start gap-1 min-w-max font-manrope",children:i.jsx("div",{className:"flex items-center justify-start group",children:"Status"})})}),i.jsx("th",{scope:"col",className:"min-w-[60px] px-1",children:i.jsx("div",{className:"flex items-center justify-center gap-1 min-w-max font-manrope",children:i.jsx("div",{className:"flex items-center justify-end group",children:"Actions"})})}),i.jsx("th",{scope:"col",className:"min-w-[60px] pl-1 pr-4",children:i.jsx("div",{className:"flex items-center justify-center gap-1 min-w-max font-manrope",children:i.jsx("div",{className:"flex items-center justify-end group"})})})]})}),i.jsx("tbody",{children:C?!t||n?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:10,children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center -mt-16 ml-[45%] w-max",children:i.jsx($a,{})})})}):r&&!t?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:10,children:i.jsx("div",{className:"flex min-h-[66vh] flex-col justify-center items-center ml-[33%] w-max",children:i.jsx(Vl,{})})})}):((Jt=nt(dt))==null?void 0:Jt.length)==0?i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:10,children:i.jsx("div",{className:`${(t==null?void 0:t.length)==0?"ml-[33%]":"ml-[40%]"} flex min-h-[44vh] h-66 flex-col justify-center items-center w-max`,children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16 md:-ml-0",children:[i.jsx("img",{src:cc,alt:""}),(t==null?void 0:t.length)==0?i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"You do not have any recorded transactions yet."})}):i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"No results match your filters."})})]})})})})}):(Ye=nt(dt))==null?void 0:Ye.map((Je,It)=>{var Lt,kt,dn,rn,gn,An,kn,yn,Vn,Kn,Dn,Xn,Nn,on;const hn=!!(Je!=null&&Je.is_deleted),Yt=hn?"bg-[#3c1518]/70 border-[#ff6b6b]/60 text-[#ffd4d1] hover:bg-[#571f24]/80":"bg-[#123424]/70 border-[#2bd27c]/50 text-[#9cf7cb] hover:bg-[#185134]/80",Rt=cn[Je==null?void 0:Je.id]||{},ot=(Rt==null?void 0:Rt.status)||(Je!=null&&Je.is_deleted?"completed":"started"),De=Un[ot],At=ot==="completed",ze=At?"↻":hn?"▶":"⏹",rt=Rt!=null&&Rt.volume_usd?Rt.current_volume/Rt.volume_usd*100:0,mt=Math.min(100,Math.max(0,rt));return i.jsxs("tr",{className:`relative group hover:bg-[#151515] h-[56px] border-b border-white/5 text-white transition-opacity ${hn?"opacity-60":"opacity-100"}`,children:[i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#151515]"} sm:sticky sm:left-0 z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2.5 pl-2 h-14 max-h-14",children:i.jsx("div",{onClick:()=>{window.open(`/terminal/${Je==null?void 0:Je.coin}`,"_blank")},className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-1.5 sm:pl-1.5 h-8 max-h-14 rounded-2xl cursor-pointer",children:i.jsxs("div",{className:"flex justify-start items-center gap-1.5",children:[i.jsx("div",{className:"w-5 h-5 rounded-full",children:i.jsx("img",{src:`https://app.hyperliquid.xyz/coins/${an[(Lt=Je==null?void 0:Je.bot_params)==null?void 0:Lt.coin]||((dn=(kt=Je==null?void 0:Je.bot_params)==null?void 0:kt.coin)==null?void 0:dn.split("/")[0])}.svg`||qa,alt:(rn=Je==null?void 0:Je.bot_params)==null?void 0:rn.coin,className:"rounded-full w-5 h-5 min-w-5 min-h-5",loading:"lazy",onError:Oe=>oa(Oe)})}),i.jsx("div",{className:"text-white text-sm font-semibold font-manrope leading-[13px] tracking-[0.18px]",children:i.jsx("div",{className:"flex justify-start items-center gap-1",children:(()=>{var Qn;const Oe=((Qn=Je==null?void 0:Je.bot_params)==null?void 0:Qn.coin)||"",Zt=Oe.includes(":"),sn=Zt?Oe.split(":")[1]:Oe,jt=Zt?Oe.split(":")[0]:null;return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-white text-sm font-semibold",children:sn}),jt&&i.jsx("span",{className:"text-[8px] bg-[#233] text-[#67FFBD] px-1 py-[0.5px] rounded-md w-fit mt-[1px]",children:jt})]})})()})})]})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#151515]"} sm:sticky left-[120px] z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-0.5 h-14 max-h-14",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 text-sm font-semibold font-manrope leading-[13px] tracking-[0.28px]",children:(Je==null?void 0:Je.source_market)==="lighter"?i.jsx(gi,{content:"Lighter",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx(bf,{className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:Je==null?void 0:Je.wm_name})]})}):(Je==null?void 0:Je.source_market)==="hyper"?i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(gi,{content:"Hyperliquid",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:I1,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:Je==null?void 0:Je.wm_name})]})})}):i.jsx("div",{className:"flex justify-start items-center gap-1",children:i.jsx(gi,{content:"Dextrabot",children:i.jsxs("div",{className:"flex justify-start items-center gap-1",children:[i.jsx("img",{src:Yi,alt:"",className:"w-4 h-4 text-[#fff]"}),i.jsx("p",{children:Je==null?void 0:Je.wm_name})]})})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#151515]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 pl-5 h-14 max-h-14",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(ua,{info1:(gn=Je==null?void 0:Je.bot_params)!=null&&gn.leverage?`${(An=Je==null?void 0:Je.bot_params)==null?void 0:An.leverage}x`:"--",info1_Color:"text-white",rowTwo:!1})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[1] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5 has-tooltip relative",children:i.jsx(ua,{info1:(kn=Je==null?void 0:Je.bot_params)!=null&&kn.volume?`$${(Vn=(yn=Je==null?void 0:Je.bot_params)==null?void 0:yn.volume)==null?void 0:Vn.toLocaleString("en-US")}`:"--",info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(ua,{info1:(Kn=Je==null?void 0:Je.bot_params)!=null&&Kn.budget?`$${(Xn=(Dn=Je==null?void 0:Je.bot_params)==null?void 0:Dn.budget)==null?void 0:Xn.toLocaleString("en-US")}`:"--",info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(ua,{info1:(Nn=Je==null?void 0:Je.bot_params)==null?void 0:Nn.direction,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(ua,{info1:(on=Je==null?void 0:Je.bot_params)==null?void 0:on.executionMode,info1_Color:"text-white",rowTwo:!1})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx("div",{className:"w-16",children:i.jsxs("div",{className:"w-full h-5 rounded-md relative overflow-hidden",style:{backgroundColor:mt>=100?"rgba(40, 180, 40, 0.25)":"rgba(255, 170, 60, 0.15)"},children:[i.jsx("div",{className:"h-full transition-all duration-300",style:{width:`${mt||0}%`,backgroundColor:mt>=100?"#3ec78c":"#d68b38"}}),i.jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-bold",style:{color:mt>=100?"#d0ffd9":"#ffcb8a"},children:[mt?mt.toFixed(0):"0","%"]})]})})})})})}),i.jsx("td",{scope:"row",className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-4 min-h-[56px]",children:i.jsx("div",{className:"group-hover:bg-[#222222] flex justify-start items-center gap-2 h-16 max-h-16",children:i.jsx("div",{className:"flex justify-start items-center gap-1.5",children:i.jsx(ua,{info1:De==null?void 0:De.label,info1_Color:De==null?void 0:De.color,rowTwo:!1})})})})}),i.jsx("td",{className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222]`,children:i.jsx("div",{className:"pl-1 flex flex-col items-end gap-2 font-manrope",children:P[Je.wallet_address]?i.jsxs("div",{role:"status",className:"flex justify-center items-center h-5 min-h-5 w-[54px] px-2 py-1.5 rounded-md",children:[i.jsxs("svg",{"aria-hidden":"true",className:"inline w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-[#67FFBD]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),i.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),i.jsx("span",{className:"sr-only",children:"Loading..."})]}):i.jsx("div",{onClick:()=>{L({id:Number(Je==null?void 0:Je.id),walletAddress:Je==null?void 0:Je.wm_address,isDeleted:At?!0:Je==null?void 0:Je.is_deleted}),F(!0)},className:`h-7 px-3 w-[42px] rounded-md border justify-center items-center gap-2 inline-flex cursor-pointer transition ${At?"bg-[#2d2d2d] border-[#444]":Yt}`,title:ze,children:i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:At?i.jsx(Xt,{}):i.jsx("div",{className:"text-[11px] font-semibold font-manrope leading-[8px] tracking-tight",children:ze})})})})}),i.jsx("td",{className:`${It%2==0,"bg-[#161616]"} z-[2] group-hover:bg-[#222222] pr-4`,children:i.jsx("div",{onClick:()=>{f(Je),g(!0)},className:"pl-1 flex flex-col items-end gap-2 font-manrope cursor-pointer",children:i.jsx(Frt,{className:"w-5 h-5 text-white"})})})]},It)}):i.jsx("tr",{className:"text-center w-full h-full",children:i.jsx("td",{colSpan:10,children:i.jsx("div",{className:"flex min-h-[44vh] h-66 flex-col justify-center items-center ml-[33%] w-max",children:i.jsx("div",{className:"flex items-center justify-center gap-4 px-4 py-2 flex-col",children:i.jsxs("div",{className:"flex flex-col justify-center items-center gap-3 -ml-16 md:-ml-0",children:[i.jsx("img",{src:cc,alt:""}),i.jsx("div",{className:"flex flex-col items-center h-max gap-3",children:i.jsx("div",{className:"text-[#d3d3d3] text-sm font-semibold font-manrope leading-[8px] pt-3",children:"View your recorded transactions by connecting your wallet."})})]})})})})})})]})})})]})]})},Hwn="https://dextrabothypev2.nftinit.io",Vwn=()=>{const[t,e]=m.useState(!1),[n,r]=m.useState([]),[s,a]=m.useState(""),[o,l]=m.useState("");async function c(){try{e(!0);const u=window.localStorage.getItem("hyperToken"),d=window.localStorage.getItem("hyperAddress");if(!u||!d)return;const x=await(await fetch(`${Hwn}/api/hyper/mmbot/list/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:d.toLowerCase(),token:u})})).json();x!=null&&x.success?r((x==null?void 0:x.data)||[]):(r([]),a((x==null?void 0:x.error_message)||"Failed to load info."))}catch(u){a(u.message||"Wallet list error.")}finally{e(!1)}}return i.jsxs("div",{className:"relative text-white overflow-hidden overscroll-none bg-[#050505]",children:[i.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[i.jsx("div",{className:"absolute inset-0 opacity-60",style:{background:"radial-gradient(1200px 800px at 10% 0%, rgba(103,255,189,0.12), transparent 55%), radial-gradient(900px 900px at 90% 100%, rgba(96,93,255,0.12), transparent 55%)"}}),i.jsx("div",{className:"absolute inset-0 opacity-[0.08]",style:{background:"repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 1px, transparent 1px, transparent 120px)"}})]}),i.jsxs("div",{className:"relative mx-auto flex w-full flex-col gap-10 px-4 pb-16 pt-10 sm:px-6 lg:px-0",style:{fontFamily:"Manrope, ui-sans-serif"},children:[i.jsxs("div",{className:"relative mx-auto flex w-full flex-col gap-10 max-w-6xl",children:[i.jsx("div",{className:"absolute right-2 -top-11 text-xs font-semibold text-[#7C7C7C] mt-2",children:i.jsxs("div",{className:"flex justify-start items-center gap-2",children:[i.jsxs("div",{onClick:()=>window.open("https://www.youtube.com/watch?v=QJHZwcKMSI0","_blank"),className:"h-6 sm:h-7 w-[130px] py-2 bg-[#FF0000] rounded-[10px] shadow-[0px_2px_4px_0px_rgba(0,0,0,0.16)] border border-[#ff4d4d] inline-flex justify-center items-center gap-1 cursor-pointer",children:[i.jsx("div",{"data-svg-wrapper":!0,children:i.jsx(IT,{className:"w-4 h-4 text-white"})}),i.jsx("div",{className:"text-white text-[13px] font-medium leading-[8px]",children:"YouTube"})]}),i.jsxs("div",{onClick:()=>window.open("https://docs.dextrabot.com/market-maker-bot/hyperliquid-market-maker-bot","_blank"),className:"h-6 sm:h-7 w-max py-[5px] rounded-[256px] flex justify-start items-center gap-2 cursor-pointer border border-[#353535] px-4 bg-[#242424] hover:bg-[#2e2e2e]",children:[i.jsx("img",{src:A5,className:"w-[14px] h-[14px]"}),i.jsx("div",{className:"min-w-max text-white text-xs font-medium font-manrope leading-none pointer-events-none",children:"Docs"})]})]})}),i.jsxs(Ao.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4},className:"relative overflow-hidden rounded-[28px] border border-white/10 bg-[#050606]/90 px-4 pb-6 pt-8 shadow-[0_25px_80px_rgba(0,0,0,0.65)] backdrop-blur-xl sm:px-10",children:[i.jsx("div",{className:"absolute inset-0 opacity-40",children:i.jsx("div",{className:"absolute inset-y-0 left-0 w-1/3",style:{background:"radial-gradient(450px 200px at 0% 0%, rgba(103,255,189,0.3), transparent 75%)"}})}),i.jsx("div",{className:"relative z-10",children:i.jsx(Bwn,{fetchInfoOnOpen:c,setIsFilterWallet:l})})]})]}),i.jsx("section",{className:"relative w-full rounded-[32px] border border-white/10 bg-[#050606]/90 px-3 pb-4 pt-6 shadow-[0_25px_80px_rgba(0,0,0,0.65)] backdrop-blur-2xl sm:px-6",children:i.jsx("div",{className:"rounded-[28px] border border-white/5 bg-[#090909]/90 p-3 shadow-inner",children:i.jsx(zwn,{data:n,setData:r,loading:t,error:s,fetchInfoOnOpen:c,isFilterWallet:o})})})]})]})},nO="#67FFBD",Wwn=({code:t,onCodeChange:e,onSubmit:n,loading:r,loadingCheckAccount:s,message:a})=>{const o=r||s||!t.trim();return i.jsx("div",{className:"h-[calc(100vh-10rem)]",children:s?i.jsxs("div",{className:"absolute mx-auto z-50 h-full w-full flex justify-center items-center overflow-hidden rounded-[16px] bg-transparent",children:[i.jsx(Ao.div,{className:"pointer-events-none absolute -inset-[40%] opacity-80 blur-3xl h-full",style:{background:"radial-gradient(circle at 15% 0%, rgba(103,255,189,0.32), transparent 55%), radial-gradient(circle at 85% 100%, rgba(103,255,189,0.24), transparent 60%)"},initial:{x:"-4%",y:"-8%"},animate:{x:["-4%","4%","-2%","-4%"],y:["-8%","6%","2%","-8%"]},transition:{duration:24,repeat:1/0,ease:"easeInOut"}}),i.jsx($a,{})]}):i.jsxs("div",{className:"relative h-full w-full flex justify-center items-center overflow-hidden rounded-[16px] bg-black",children:[i.jsx(Ao.div,{className:"pointer-events-none absolute -inset-[40%] opacity-80 blur-3xl h-full",style:{background:"radial-gradient(circle at 15% 0%, rgba(103,255,189,0.32), transparent 55%), radial-gradient(circle at 85% 100%, rgba(103,255,189,0.24), transparent 60%)"},initial:{x:"-4%",y:"-8%"},animate:{x:["-4%","4%","-2%","-4%"],y:["-8%","6%","2%","-8%"]},transition:{duration:24,repeat:1/0,ease:"easeInOut"}}),i.jsxs(Ao.div,{initial:{opacity:0,y:16,scale:.96},animate:{opacity:1,y:0,scale:1},transition:{duration:.5,ease:[.16,1,.3,1]},className:"relative z-10 w-full max-w-[460px] rounded-2xl border border-[#17211b] bg-[#050505] shadow-[0_30px_90px_rgba(0,0,0,0.9)] overflow-hidden",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-50",children:i.jsx("div",{className:"w-full h-full",style:{background:"radial-gradient(900px 500px at 50% -10%, rgba(103,255,189,0.45), transparent 70%)"}})}),i.jsx("video",{src:wA,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[260px] object-cover bg-black"},wA)]}),i.jsxs("div",{className:"px-5 pb-5 pt-4 space-y-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"text-[11px] font-medium tracking-[0.18em] uppercase",style:{color:nO},children:"Early Access"}),i.jsxs("div",{className:"text-lg font-semibold",children:["Enter ",i.jsx("span",{style:{color:nO},children:"Alpha Code"})]}),i.jsx("p",{className:"text-[12px] text-white/60",children:"Market Maker is currently in private alpha. Enter your invitation code to unlock this feature in your account."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[11px] text-white/45",children:"Alpha Code"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"text",value:t,onChange:l=>e(l.target.value.toUpperCase()),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),n())},placeholder:"DXTR-XXXXX",autoComplete:"off",spellCheck:!1,className:"flex-1 h-10 px-3 rounded-md bg-[#050505] border border-[#1e2e27] text-[13px] tracking-[0.18em] font-mono text-white placeholder:text-white/20 focus:outline-none focus:border-[#67FFBD]"}),i.jsx("button",{type:"button",onClick:n,disabled:o,className:`h-10 px-4 rounded-md text-[13px] font-semibold transition-colors ${o?"bg-[#101613] text-white/40 cursor-not-allowed":"text-black hover:opacity-90"}`,style:o?void 0:{backgroundColor:nO},children:r?"Checking…":"Access"})]})]}),(s||a)&&i.jsxs("div",{className:"text-[11px] min-h-[16px]",children:[s&&!a&&i.jsx("span",{className:"text-white/40",children:"Checking your eligibility…"}),a&&i.jsx("span",{style:{color:nO},children:a})]})]})]})]})})},qwn=()=>{const{setSignModalOpen:t}=m.useContext(Qr);return i.jsxs("div",{className:"relative h-[calc(100vh-10rem)]",children:[i.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-80",style:{background:"radial-gradient(900px 600px at 0% 0%, rgba(103,255,189,0.16), transparent 65%), radial-gradient(700px 500px at 100% 100%, rgba(96,93,255,0.14), transparent 65%)"}}),i.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.08]",style:{background:"repeating-linear-gradient(135deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 10px)"}}),i.jsx("div",{className:"relative mx-auto z-10 flex h-full w-full max-w-4xl items-center justify-center px-4",children:i.jsxs("div",{className:"relative flex w-full max-w-xl flex-col items-center justify-center gap-4 rounded-[24px] border border-white/10 bg-[#050505]/95 px-6 py-7 shadow-[0_20px_60px_rgba(0,0,0,0.65)] backdrop-blur-xl",children:[i.jsx("div",{className:"absolute inset-x-10 -top-10 h-24 bg-gradient-to-br from-[#67ffbd]/40 via-transparent to-[#8570ff]/30 opacity-60 blur-2xl"}),i.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-4",children:[i.jsx("div",{className:"inline-flex items-center rounded-full border border-[#1c2b25] bg-[#07130d] px-3 py-1 text-[11px] font-semibold uppercase tracking-[0.25em] text-[#67ffbd]",children:"Market Maker"}),i.jsx("p",{className:"text-sm font-semibold text-white sm:text-base",children:"Connect your wallet to use Market Maker"}),i.jsx("p",{className:"text-[12px] text-[#9BA1A6] text-center max-w-md",children:"To start and manage your market maker bots on Hyperliquid, you need to connect your wallet first."}),i.jsx("div",{className:"w-[220px] pt-1",children:i.jsx("button",{onClick:()=>t(!0),className:"w-full h-[36px] rounded-xl font-bold text-[12px] transition-opacity mb-2 flex items-center justify-center bg-[#67FFBD] text-black",children:"Connect"})})]})]})})]})},Gwn=()=>{const{setTelegramChatId:t,setSubscriberRole:e,setMushboomerETH:n,setIsWhitelist:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setHyperToken:l,setHyperAddress:c,setSignModalOpen:u}=m.useContext(Qr),[d,f]=m.useState(!1),[x,g]=m.useState(!1),[y,v]=m.useState(""),[C,N]=m.useState(!1),[P,T]=m.useState(""),[M,F]=m.useState(!1);m.useEffect(()=>{const L=localStorage.getItem("hyperToken"),z=localStorage.getItem("hyperAddress");f(!!(L&&z));const X=setInterval(()=>{const ne=localStorage.getItem("hyperToken"),J=localStorage.getItem("hyperAddress");f(!!(ne&&J))},800);return()=>clearInterval(X)},[]),m.useEffect(()=>{(async()=>{var ne,J;const z=window.localStorage.getItem("hyperToken"),X=window.localStorage.getItem("hyperAddress");if(!(!z||!X))try{F(!0);const K=await ki(X.toLowerCase(),z);K!=null&&K.success?(t(K==null?void 0:K.telegram_chat_id),e(K==null?void 0:K.subscriber_role),n((ne=K==null?void 0:K.mushboomer_counts)==null?void 0:ne.eth),s((J=K==null?void 0:K.mushboomer_counts)==null?void 0:J.sol),a(K==null?void 0:K.referral_code),o(K==null?void 0:K.refcode),r(K==null?void 0:K.whitelist),g(K==null?void 0:K.mm_hyper_alpha_code),F(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),l(""),c(""),F(!1))}catch(K){console.error("Token verification error:",K),F(!1)}})()},[d]);const $=async()=>{var X,ne,J,K;const L=window.localStorage.getItem("hyperToken"),z=window.localStorage.getItem("hyperAddress");if(!y.trim()){tn.error("Please enter your alpha code");return}if(!L||!z){u(!0);return}N(!0),T("");try{const te={address:z==null?void 0:z.toLowerCase(),token:L,alpha_code:y.trim(),source_market:"hyper",app_type:"mm_bot"},q=(await ps.post("https://dextrabothypev2.nftinit.io/api/subscriber/alpha_code/set/",te)).data||{};if(q.success){const se=q.message||"Alpha code added successfully";tn.success(`${se}`,{style:{border:"1px solid #22c55e",padding:"16px",color:"#fff",borderRadius:"999px",background:"#14532d",height:"60px"},iconTheme:{primary:"#22c55e",secondary:"#FFFAEE"}}),T(se),g(!0)}else{const se=q.error_message||q.message||"This alpha code is invalid";tn.success(`${se}.`,{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"400px",minWidth:"400px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}),T(se)}}catch(te){const fe=((ne=(X=te==null?void 0:te.response)==null?void 0:X.data)==null?void 0:ne.error_message)||((K=(J=te==null?void 0:te.response)==null?void 0:J.data)==null?void 0:K.message)||te.message||"Failed to validate alpha code";tn.success(`${fe}.`,{style:{padding:"12px",color:"#e2e2e2",borderRadius:"256px",background:"rgba(255, 121, 124, 0.32)",width:"300px",minWidth:"300px",height:"40px",backdropFilter:"blur(48px)"},iconTheme:{primary:"#ff797c",secondary:"#7d3031"}}),T(fe)}finally{N(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Market Maker Bot (Hyperliquid) | Dextrabot"}),i.jsx("meta",{name:"description",content:"Automate market making on Hyperliquid. Generate trading volume and provide liquidity 24/7."}),i.jsx("meta",{property:"og:title",content:"Market Maker Bot (Hyperliquid) | Dextrabot"}),i.jsx("meta",{property:"og:description",content:"Automate market making on Hyperliquid. Generate trading volume and provide liquidity 24/7."}),i.jsx("meta",{property:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{property:"og:url",content:"https://app.dextrabot.com/market-maker "})]})}),i.jsx("div",{style:{minHeight:"calc(100vh - 5rem)"},className:"flex justify-center items-start w-full h-full px-4 pt-6 pb-6 sm:px-6 sm:pt-6 sm:pb-6 bg-[#050505] overflow-auto",children:i.jsx("div",{className:"flex flex-col items-stretch justify-start gap-[26px] w-full flex-grow xl:flex-grow-0",children:d?x&&d?i.jsx(Vwn,{}):i.jsx(Wwn,{code:y,onCodeChange:v,onSubmit:$,loading:C,loadingCheckAccount:M,message:P}):i.jsx(qwn,{})})})]})},Kwn=({data:t,refreshAgent:e,loadingCheckAccount:n,slotCount:r})=>{var q,se,ae;const s=t==null?void 0:t.subs_expire_date,[a,o]=m.useState(!1),[l,c]=m.useState(!1),[u,d]=m.useState(!1),[f,x]=m.useState(null),g=s?new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null,y={extended:{name:"Extended",type:"img",src:"https://app.extended.exchange/assets/logo/extended-long.svg"},lighter:{name:"Lighter",type:"component",component:i.jsx(bf,{className:"w-6 h-6 text-white"})},pacifica:{name:"Pacifica",type:"img",src:"https://app.pacifica.fi/imgs/logo.svg"},paradex:{name:"Paradex",type:"component",component:i.jsx(HLe,{className:"h-2.5 text-white -ml-6"})},variational:{name:"Variational",type:"img",src:"https://omni.variational.io/_app/immutable/assets/full_omni_wordmark.DwlcSpMk.svg"},aster:{name:"Aster",type:"img",src:"https://static.asterdex.com/cloud-futures/static/images/aster/logo.svg"},basedapp:{name:"BasedApp",type:"img",src:jEe},apex:{name:"Apex",type:"img",src:"https://omni.apex.exchange/assets/logo_content-CY9uyFbz.svg"}},v={lighter:{name:"Lighter",type:"component",src:i.jsx(bf,{className:"w-6 h-6 text-white"})}},C=["aster","basedapp","apex","extended"],N=(t==null?void 0:t.slots_info)||{},P=Object.fromEntries(Object.entries(N).filter(([W])=>!C.includes(W))),T=Object.values(P).reduce((W,V)=>W+V.total_qty,0),M=Object.values(P).reduce((W,V)=>W+V.active_qty,0),F=(((q=t==null?void 0:t.copy_trade_slots_info)==null?void 0:q.using_slot_count)||0)+(((se=t==null?void 0:t.copy_trade_slots_info)==null?void 0:se.total_slot_count)||0),$=((ae=t==null?void 0:t.copy_trade_slots_info)==null?void 0:ae.using_slot_count)||0,L=((t==null?void 0:t.bot_slots_info)||[]).find(W=>String((W==null?void 0:W.bot_type)||"").toLowerCase()==="grid_bot"&&String((W==null?void 0:W.source_market)||"").toLowerCase()==="lighter")||{},z=(L==null?void 0:L.total_slot_count)||0,X=(L==null?void 0:L.using_subs_slot_count)||0,ne=(L==null?void 0:L.using_extra_slot_count)||0,J=X+ne,K=J+z,te=()=>{navigator.clipboard.writeText(`https://app.dextrabot.com/referral/${t.refcode}`),o(!0),setTimeout(()=>o(!1),2e3)},fe=!!window.localStorage.getItem("hyperToken");return i.jsxs(i.Fragment,{children:[l&&Aa.createPortal(i.jsx(nue,{open:l,setOpen:c,oldSlotCount:f,checkAccountTrade:n,tradeMarket:"copyTrade"}),document.body),u&&Aa.createPortal(i.jsx(O5,{open:u,setOpen:d,oldSlotCount:J,checkAccountLighter:e,product:"grid_bot"}),document.body),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 flex items-center justify-center text-2xl font-bold shadow-lg shadow-orange-500/30",children:i.jsx("img",{src:WA,alt:"",className:"w-7 h-7"})}),i.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Profile"}),i.jsx("div",{onClick:()=>{e()},className:"flex justify-center items-center cursor-pointer",children:i.jsx(XS,{className:"w-4 h-4 text-[#929292] hover:text-white"})})]}),fe?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`${(t==null?void 0:t.subs_expire_day)===null?"flex":"hidden"} flex-col items-start gap-4 bg-gradient-to-br from-[#141414] to-[#0c0c0c] border border-white/5 rounded-2xl p-6 max-w-[480px] shadow-[0_0_40px_-15px_rgba(255,140,0,0.3)]`,children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-orange-500 to-red-600 flex items-center justify-center text-xl font-bold text-white shadow-lg shadow-orange-500/40",children:"!"}),i.jsx("h2",{className:"text-xl font-semibold text-white/90",children:"No Active Subscription"}),i.jsx("p",{className:"text-base text-white/70 leading-relaxed",children:"You don't have an active subscription yet. Subscribe now to unlock trading bots, copy trading, and farming tools across multiple DEXs."})]}),i.jsxs("div",{className:`${(t==null?void 0:t.subs_expire_day)===null||!(t!=null&&t.subs_expire_day)?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 relative overflow-hidden w-full`,children:[i.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-orange-500/10 to-transparent rounded-bl-full"}),i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"text-orange-400",children:"⏱"}),i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Subscription Status"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(M7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"flex flex-wrap items-baseline gap-2 mb-2",children:[i.jsx("span",{className:"text-4xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-orange-400 to-red-500",children:t==null?void 0:t.subs_expire_day}),i.jsx("span",{className:"text-white/60 text-lg",children:"days remaining"})]}),i.jsxs("p",{className:"text-white/40 text-sm",children:["Expires on"," ",i.jsx("span",{className:"text-white/60",children:g||"-"})]})]}),i.jsxs("div",{className:`${(t==null?void 0:t.copy_trade_slots_info)===null?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 relative overflow-hidden w-full`,children:[i.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-orange-500/10 to-transparent rounded-bl-full"}),i.jsxs("div",{className:"flex justify-between items-center mb-2.5 gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Copy Trade Slots"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(M7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"px-3 py-1 bg-orange-500/10 rounded-lg text-orange-400 text-sm font-medium -mt-2.5",children:[$,"/",F," Active"]})]}),i.jsxs("div",{className:`flex items-center justify-between py-3 px-4 rounded-xl
bg-white/[0.02] hover:bg-white/[0.04] transition-colors
border border-white/5`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"h-5 flex items-center justify-center",children:v.lighter.src}),i.jsx("span",{className:"font-medium text-white/80",children:v.lighter.name})]}),i.jsxs("div",{className:"flex justify-end items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2 h-2 rounded-full ${$>0?"bg-green-400 shadow-green-400/50 shadow-sm":"bg-white/20"}`}),i.jsx("span",{className:$>0?"text-green-400 font-semibold":"text-white/40",children:$}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:F})]}),i.jsx("div",{className:"w-24 h-1.5 bg-white/5 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-gradient-to-r from-orange-500 to-red-500 rounded-full transition-all",style:{width:`${F>0?$/F*100:0}%`}})})]})]}),i.jsx("div",{className:"flex justify-end items-center w-full mt-4",children:i.jsx("button",{onClick:()=>{x(r),c(!0)},className:"px-4 py-1.5 rounded-lg text-sm font-semibold bg-gradient-to-r from-orange-500 to-red-500 text-white shadow-[0_0_12px_rgba(255,100,0,0.4)]hover:shadow-[0_0_18px_rgba(255,120,0,0.6)] transition-all",children:"Get More Slots"})})]}),i.jsxs("div",{className:`${K===0?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 relative overflow-hidden w-full`,children:[i.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-orange-500/10 to-transparent rounded-bl-full"}),i.jsxs("div",{className:"flex justify-between items-center mb-2.5 gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Grid Bot Slots"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(M7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"px-3 py-1 bg-orange-500/10 rounded-lg text-orange-400 text-sm font-medium -mt-2.5",children:[J,"/",K," Active"]})]}),i.jsxs("div",{className:`flex items-center justify-between py-3 px-4 rounded-xl
bg-white/[0.02] hover:bg-white/[0.04] transition-colors
border border-white/5`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"h-5 flex items-center justify-center",children:v.lighter.src}),i.jsx("span",{className:"font-medium text-white/80",children:"Lighter"})]}),i.jsxs("div",{className:"flex justify-end items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2 h-2 rounded-full ${J>0?"bg-green-400 shadow-green-400/50 shadow-sm":"bg-white/20"}`}),i.jsx("span",{className:J>0?"text-green-400 font-semibold":"text-white/40",children:J}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:K})]}),i.jsx("div",{className:"w-24 h-1.5 bg-white/5 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-gradient-to-r from-orange-500 to-red-500 rounded-full transition-all",style:{width:`${K>0?J/K*100:0}%`}})})]})]}),i.jsx("div",{className:"flex justify-end items-center w-full mt-4",children:i.jsx("button",{onClick:()=>{d(!0)},className:"px-4 py-1.5 rounded-lg text-sm font-semibold bg-gradient-to-r from-orange-500 to-red-500 text-white shadow-[0_0_12px_rgba(255,100,0,0.4)]hover:shadow-[0_0_18px_rgba(255,120,0,0.6)] transition-all",children:"Get More Slots"})})]}),i.jsxs("div",{className:`${Object.keys((t==null?void 0:t.slots_info)||{}).length===0?"hidden":""} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 w-full`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Slots Overview"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(M7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"px-3 py-1 bg-orange-500/10 rounded-lg text-orange-400 text-sm font-medium",children:[M,"/",T," Active"]})]}),i.jsx("div",{className:"space-y-2",children:Object.entries(P).filter(([W])=>!C.includes(W)).map(([W,V])=>{var ee,oe,de;return i.jsxs("div",{className:"flex items-center justify-between py-3 px-4 rounded-xl bg-white/[0.02] hover:bg-white/[0.04] transition-colors border border-transparent hover:border-white/5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("span",{className:`${W==="apex"?"h-6":W==="basedapp"?"h-3.5":W==="pacifica"?"h-5":W==="variational"?"h-3":"h-3.5"} flex items-center justify-center`,children:[((ee=y[W])==null?void 0:ee.type)==="img"&&i.jsx("img",{src:y[W].src,alt:y[W].name,className:"w-full h-full"}),((oe=y[W])==null?void 0:oe.type)==="component"&&y[W].component]}),W==="lighter"&&i.jsx("span",{className:"font-medium text-white/80 -ml-3",children:((de=y[W])==null?void 0:de.name)||W})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${V.active_qty>0?"bg-green-400 shadow-lg shadow-green-400/50":"bg-white/20"}`}),i.jsx("span",{className:V.active_qty>0?"text-green-400 font-semibold":"text-white/40",children:V.active_qty}),i.jsx("span",{className:"text-white/30",children:"/"}),i.jsx("span",{className:"text-white/60",children:V.total_qty})]}),i.jsx("div",{className:"w-24 h-1.5 bg-white/5 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-gradient-to-r from-orange-500 to-red-500 rounded-full transition-all",style:{width:`${V.active_qty/V.total_qty*100}%`}})})]})]},W)})})]}),i.jsxs("div",{className:`${t!=null&&t.referral_code&&(t==null?void 0:t.refcode)!==null?"":"hidden"} bg-gradient-to-br from-[#141414] to-[#0c0c0c] rounded-2xl p-6 border border-white/5 w-full`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx("span",{className:"text-orange-400",children:"🎁"}),i.jsx("h2",{className:"text-lg font-semibold text-white/90",children:"Referral Code"}),n&&i.jsx("span",{className:"-ml-1",children:i.jsx(M7,{size:"w-3.5 h-3.5"})})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 px-4 py-3 bg-black/30 rounded-xl border border-white/10 font-mono text-lg text-orange-400 tracking-wider",children:t==null?void 0:t.refcode}),i.jsx("button",{onClick:te,className:"px-4 py-3 bg-white/5 border border-white/10 rounded-xl hover:bg-orange-500/10 hover:border-orange-500/30 transition-all group",children:a?i.jsx("span",{className:"text-green-400",children:"✓"}):i.jsx("span",{className:"text-white/60 group-hover:text-orange-400 transition-colors",children:"📋"})})]}),i.jsx("p",{className:"text-white/40 text-sm mt-3",children:"Share your code and earn rewards for each referral"})]})]}):i.jsxs("div",{className:"flex flex-col items-start gap-4 bg-gradient-to-br from-[#141414] to-[#0c0c0c] border border-white/5 rounded-2xl p-6 max-w-[480px] shadow-[0_0_40px_-15px_rgba(255,140,0,0.3)]",children:[i.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br from-orange-500 to-red-600
flex items-center justify-center text-xl font-bold text-white shadow-lg shadow-orange-500/40`,children:"!"}),i.jsx("h2",{className:"text-xl font-semibold text-white/90",children:"Wallet Not Connected"}),i.jsx("p",{className:"text-base text-white/70 leading-relaxed",children:"Connect your wallet to access your profile, manage subscriptions, and view your active trading slots."})]})]})},Ywn=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=m.useContext(Qr),{address:f}=ns(),[x,g]=m.useState(1),[y,v]=m.useState({}),[C,N]=m.useState(""),[P,T]=m.useState(""),[M,F]=m.useState(!1),[$,L]=m.useState(!1),[z,X]=m.useState(""),[ne,J]=m.useState(0),[K,te]=m.useState(0),[fe,q]=m.useState(!1),[se,ae]=m.useState(0),[W,V]=m.useState(!1),ee=dt=>/^\d*$/.test(dt),oe=dt=>{["e","E","+","-"].includes(dt.key)&&dt.preventDefault()},de=m.useMemo(()=>{if(x==="")return!1;const dt=Number(x);return Number.isInteger(dt)&&dt>=1},[x]),we=(dt=>{const[tt,nt]=dt.split(" "),[Le,Be,ht]=tt.split("-").map(Number),[pt,Gt]=nt.split(":").map(Number);return new Date(Date.UTC(ht,Be-1,Le,pt-3,Gt))})("29-11-2025 23:59");m.useState(()=>new Date().getTime()>=we.getTime());const xe=m.useRef(ne);m.useEffect(()=>{xe.current=ne},[ne]);const be=m.useRef(0);m.useEffect(()=>{be.current=K},[K]);const je=async()=>{var nt,Le,Be;const dt=window.localStorage.getItem("hyperToken"),tt=window.localStorage.getItem("hyperAddress");if(!(!dt||!tt))try{V(!0);const ht=await ki(tt.toLowerCase(),dt);ht!=null&&ht.success?(e(ht==null?void 0:ht.telegram_chat_id),n(ht==null?void 0:ht.subscriber_role),r(ht==null?void 0:ht.subs_expire_day),s((nt=ht==null?void 0:ht.mushboomer_counts)==null?void 0:nt.eth),a((Le=ht==null?void 0:ht.mushboomer_counts)==null?void 0:Le.sol),o(ht==null?void 0:ht.referral_code),l(ht==null?void 0:ht.refcode),c(ht==null?void 0:ht.whitelist),u(dt),d(tt),N(ht==null?void 0:ht.farming_tools),J(Number((ht==null?void 0:ht.subs_expire_day)||0)),v(ht),V(!1),ae(((Be=ht==null?void 0:ht.copy_trade_slots_info)==null?void 0:Be.extra_slot_count)||0)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),V(!1))}catch(ht){console.error("Token verification error:",ht),console.error(ht.message||"An unknown error occurred."),V(!1)}};m.useEffect(()=>{fe&&je()},[fe]),m.useEffect(()=>{const dt=localStorage.getItem("hyperToken"),tt=localStorage.getItem("hyperAddress");q(!!(dt&&tt));const nt=setInterval(()=>{const Le=localStorage.getItem("hyperToken"),Be=localStorage.getItem("hyperAddress");q(!!(Le&&Be))},800);return()=>clearInterval(nt)},[]);const Ie=async()=>new _l(window.ethereum).eth.getAccounts(tt=>tt),Re=async(dt="subscribe",tt=24,nt=5e3)=>{tt<=0||(await new Promise(Le=>setTimeout(Le,nt)),await je(),dt==="subscribe"&&xe.current===be.current?Re(dt,tt-1,nt):je())},Qe=async dt=>{const tt=window.localStorage.getItem("hyperToken"),nt=window.localStorage.getItem("hyperAddress");if(!tt||!f){t(!0);return}T(""),te(xe.current),be.current=xe.current,L(!0),F(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(ht){console.error("Failed to switch network",ht),F(!1);return}const Le=new _l(window.ethereum);var Be=await Ie();if(Be.length>0?Be=Be[0]:Be=void 0,Be){const pt=dt*.12,Gt=Le.utils.toWei(pt.toString(),"ether"),wt={from:Be,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Gt};await Le.eth.sendTransaction(wt).then(nn=>{console.log("txHash :>> ",nn),F(!1),X(nn.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():nt,token:tt,payment_tx:nn.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),je(),Re("subscribe")}).catch(nn=>{console.log(nn),nn.code===-32003||nn.message.includes("insufficient funds")?T("Insufficient funds."):nn.message==="MetaMask Tx Signature: User denied transaction signature."&&L(!1)})}else await Le.eth.requestAccounts()},Ke=()=>{je()};return window.localStorage.getItem("hyperToken"),i.jsxs(i.Fragment,{children:[i.jsx(jd,{open:$,setOpen:L,transactionHash:z,transactionLoading:M,paymentPresaleRole:!(ne<=K),errorFunds:P,activeMethod:2}),i.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-start md:justify-center md:items-start gap-8 w-full h-full bg-[#161616]",children:[i.jsx("div",{className:"flex justify-center items-start md:items-center w-full pl-0 sm:pl-4 md:pl-2",children:i.jsx("div",{className:"flex flex-col gap-2 pt-0 md:pt-7 lg:pt-0",children:i.jsx("div",{className:"flex flex-col items-start justify-start gap-4 md:mb-10 lg:mb-16 overflow-scroll h-full",children:i.jsx(Kwn,{data:y,refreshAgent:Ke,loadingCheckAccount:W,slotCount:se})})})}),i.jsxs("div",{className:"relative mx-1 h-full py-10 hidden md:block",children:[i.jsx("div",{className:"w-[2px] h-full bg-[linear-gradient(to_bottom,rgba(255,140,0,0)_0%,rgba(255,140,0,0.8)_15%,rgba(255,50,150,0.8)_85%,rgba(255,50,150,0)_100%)]"}),i.jsx("div",{className:"absolute inset-0 w-[8px] h-full bg-[linear-gradient(to_bottom,rgba(255,140,0,0)_0%,rgba(255,140,0,0.4)_15%,rgba(255,50,150,0.4)_85%,rgba(255,50,150,0)_100%)] blur-md mx-auto"})]}),i.jsx("div",{className:"flex flex-col justify-center items-center md:items-center w-full h-full gap-4 pb-10 mb:pb-0",children:i.jsxs("div",{className:"flex flex-col items-center gap-4 border border-[#404040] bg-[#141414] rounded-xl px-3 py-7 shadow-[0_0_25px_rgba(255,120,50,0.25)] min-w-[362px]",children:[i.jsx("div",{className:"rounded-lg overflow-hidden",children:i.jsx("video",{src:iB,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-[284px] lg:h-[284px] object-cover"},iB)}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>g(dt=>{const tt=Number(dt||0);return tt>1?String(tt-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:x,onChange:dt=>{const tt=dt.target.value.trim();if(tt==="")return g("");ee(tt)&&g(tt)},onKeyDown:oe,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] font-semibold outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>g(dt=>{const tt=Number(dt||0);return String(tt+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),x!==""&&!de&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),de&&i.jsxs("div",{className:"text-[12px] font-semibold text-green-400",children:[" ",x," months will be added to your subscription."]}),i.jsx("div",{className:"relative flex items-center justify-center gap-3 px-4 py-2 rounded-xl shadow-[0_0_25px_rgba(255,140,0,0.15)] backdrop-blur-md bg-white/5 border border-white/10",children:i.jsxs("span",{className:"text-2xl font-bold bg-gradient-to-r from-orange-400 to-pink-500 bg-clip-text text-transparent",children:[(x*.12).toFixed(2)," ETH"]})}),i.jsx("div",{onClick:dt=>{dt.preventDefault(),de&&Qe(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${de?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})})]})]})},Xwn=()=>{ns();const{setTelegramChatId:t,setSubscriberRole:e,setSubsExpireDay:n,setMushboomerETH:r,setMushboomerSOL:s,setIsReferralCode:a,setIsReferralCodeName:o,setIsWhitelist:l,setHyperToken:c,setHyperAddress:u}=m.useContext(Qr);return m.useEffect(()=>{(async()=>{var g,y;const f=window.localStorage.getItem("hyperToken"),x=window.localStorage.getItem("hyperAddress");if(!(!f||!x))try{const v=await ki(x.toLowerCase(),f);v!=null&&v.success?(t(v==null?void 0:v.telegram_chat_id),e(v==null?void 0:v.subscriber_role),n(v==null?void 0:v.subs_expire_day),r((g=v==null?void 0:v.mushboomer_counts)==null?void 0:g.eth),s((y=v==null?void 0:v.mushboomer_counts)==null?void 0:y.sol),a(v==null?void 0:v.referral_code),o(v==null?void 0:v.refcode),l(v==null?void 0:v.whitelist)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),c(""),u(""))}catch(v){console.error("Token verification error:",v),console.error(v.message||"An unknown error occurred.")}})()},[]),i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"My Profile - Dextrabot | Manage Your Trading Bots & Subscriptions"}),i.jsx("link",{rel:"canonical",href:"https://app.dextrabot.com/my-profile"}),i.jsx("meta",{name:"description",content:"View and manage your Dextrabot profile. Track your subscription status, active trading slots across multiple DEXs, referral rewards, and account features. Optimize your automated trading experience."}),i.jsx("meta",{name:"og:title",content:"My Profile - Dextrabot | Manage Your Trading Bots & Subscriptions"}),i.jsx("meta",{name:"og:description",content:"View and manage your Dextrabot profile. Track your subscription status, active trading slots across multiple DEXs, referral rewards, and account features. Optimize your automated trading experience."}),i.jsx("meta",{name:"og:image",content:"https://app.dextrabot.com/dextrabotIcon.png"}),i.jsx("meta",{name:"og:url",content:"https://app.dextrabot.com/my-profile"})]})}),i.jsx("div",{className:"flex justify-center items-start w-full h-[calc(100vh-5rem)] min-h-max px-4 pt-4 pb-10 bg-[#161616]",children:i.jsx("div",{className:"flex flex-col items-stretch justify-center h-full gap-[26px] w-full flex-grow xl:flex-grow-0",children:i.jsx(Ywn,{})})})]})},Qwn="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",rje=[{label:"1h",multiplier:1},{label:"8h",multiplier:8},{label:"1d",multiplier:24},{label:"1w",multiplier:168},{label:"1m",multiplier:720},{label:"3m",multiplier:2160},{label:"1y",multiplier:8760}],dg=[{id:"extended",name:"Extended",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{id:"variational",name:"Variational",iconType:"variational"},{id:"lighter",name:"Lighter",iconType:"lighter"},{id:"hyperliquid",name:"Hyperliquid",iconType:"hyperliquid"},{id:"aster",name:"Aster",iconType:"aster"},{id:"paradex",name:"Paradex",iconType:"paradex"}],sje={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},ije=(t,e)=>{const n=e.filter(o=>{var l,c;return(c=(l=t.marketplaces)==null?void 0:l[o])==null?void 0:c.available});if(n.length<2)return 0;let r=1/0,s=-1/0;for(const o of n){const l=parseFloat(t.marketplaces[o].hourly_rate)||0;l<r&&(r=l),l>s&&(s=l)}const a=(s-r)*8760*100;return a>0?a:0},aje=({exchange:t,className:e="w-4 h-4"})=>{if(t.icon)return i.jsx("img",{src:t.icon,alt:t.name,className:e});switch(t.iconType){case"variational":return i.jsx("img",{src:lT,alt:t.name,className:`${e} rounded`});case"lighter":return i.jsx(bf,{className:e});case"hyperliquid":return i.jsx("img",{src:mae,alt:t.name,className:e});case"aster":return i.jsx($A,{className:e});case"paradex":return i.jsx("img",{src:cT,alt:t.name,className:`${e} rounded`});default:return null}},Zwn=()=>{const t=jo(),[e,n]=m.useState([]),[r,s]=m.useState(!0),[a,o]=m.useState(null),[l,c]=m.useState(""),[u,d]=m.useState({key:"best_arb_apr",direction:"desc"}),[f,x]=m.useState(null),[g,y]=m.useState("1h"),[v,C]=m.useState(()=>{const q=localStorage.getItem("fundingSelectedExchanges");if(q)try{const ae=JSON.parse(q).filter(W=>dg.some(V=>V.id===W));return ae.length>0?ae:dg.map(W=>W.id)}catch{return dg.map(se=>se.id)}return dg.map(se=>se.id)}),[N,P]=m.useState(!1),T=m.useRef(!0),M=m.useRef(null);m.useEffect(()=>{localStorage.setItem("fundingSelectedExchanges",JSON.stringify(v))},[v]);const F=(q,se,ae)=>{const W=sje[se],V=sje[ae];W&&V&&t(`/funding-history/${W}-${V}-${q.toLowerCase()}`)};m.useEffect(()=>{const q=async()=>{try{const W=await(await fetch(Qwn)).json();W.success&&Array.isArray(W.data)?(n(W.data),x(W.updated_at),o(null)):T.current&&o("Failed to fetch data")}catch(ae){T.current&&o(ae.message||"Failed to fetch data")}finally{T.current&&(s(!1),T.current=!1)}};q();const se=setInterval(q,5e3);return()=>clearInterval(se)},[]),m.useEffect(()=>{const q=se=>{M.current&&!M.current.contains(se.target)&&P(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const $=q=>{C(se=>se.includes(q)?se.length===1?se:se.filter(ae=>ae!==q):[...se,q])},L=q=>{if(!q)return"";const se=q.endsWith("Z")?q:q+"Z";return new Date(se).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},z=m.useMemo(()=>{let q=e;if(l.trim()){const se=l.toLowerCase();q=e.filter(ae=>ae.ticker.toLowerCase().includes(se))}return q=q.filter(se=>v.some(ae=>{var W,V;return(V=(W=se.marketplaces)==null?void 0:W[ae])==null?void 0:V.available})),u.key&&(q=[...q].sort((se,ae)=>{var ee,oe,de,Ce;let W,V;if(u.key==="ticker")return W=se.ticker,V=ae.ticker,u.direction==="asc"?W.localeCompare(V):V.localeCompare(W);if(u.key==="best_arb_apr")W=ije(se,v),V=ije(ae,v);else if(u.key.startsWith("mp_")){const me=u.key.replace("mp_","");W=parseFloat((oe=(ee=se.marketplaces)==null?void 0:ee[me])==null?void 0:oe.hourly_rate)||0,V=parseFloat((Ce=(de=ae.marketplaces)==null?void 0:de[me])==null?void 0:Ce.hourly_rate)||0}else W=parseFloat(se[u.key])||0,V=parseFloat(ae[u.key])||0;return u.direction==="asc"?W-V:V-W})),q},[e,l,u,v]),X=q=>{d(se=>se.key===q?se.direction==="asc"?{key:q,direction:"desc"}:se.direction==="desc"?{key:null,direction:null}:{key:q,direction:"asc"}:{key:q,direction:"desc"})},ne=q=>{if(u.key===q){if(u.direction==="asc")return i.jsx(i2,{className:"inline ml-1 text-[#67FFBD]"});if(u.direction==="desc")return i.jsx(s2,{className:"inline ml-1 text-[#67FFBD]"})}return i.jsx(a2,{className:"inline ml-1 text-gray-500"})},J=q=>q>=0?"text-[#4ade80]":"text-[#f87171]",K=()=>{const q=rje.find(se=>se.label===g);return q?q.multiplier:1},te=q=>{const se=v.filter(xe=>{var be,je;return(je=(be=q.marketplaces)==null?void 0:be[xe])==null?void 0:je.available});if(se.length<2)return null;let ae=1/0,W=-1/0,V=null,ee=null;for(const xe of se){const be=parseFloat(q.marketplaces[xe].hourly_rate)||0;be<ae&&(ae=be,V=xe),be>W&&(W=be,ee=xe)}const oe=(W-ae)*8760*100;if(oe<=0||V===ee)return null;let de;oe>=100?de=`${oe.toFixed(2)}%`:oe>=1?de=`${oe.toFixed(2)}%`:de=`${oe.toFixed(4)}%`;const Ce=dg.find(xe=>xe.id===V),me=dg.find(xe=>xe.id===ee),we=`${(me==null?void 0:me.name.toLowerCase())||ee}/${(Ce==null?void 0:Ce.name.toLowerCase())||V}`;return{apr:oe,apr_fmt:de,long_mp:V,short_mp:ee,long_rate:q.marketplaces[V].hourly_rate,short_rate:q.marketplaces[ee].hourly_rate,pair:we}},fe=q=>{const se=K(),W=(parseFloat(q)||0)*se*100;return Math.abs(W)>=100?`${W.toFixed(0)}%`:Math.abs(W)>=1?`${W.toFixed(2)}%`:`${W.toFixed(4)}%`};return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("title",{children:"Funding Rates Arbitrage - Dextrabot"}),i.jsx("meta",{name:"description",content:"Compare funding rates across exchanges to discover delta neutral arbitrage opportunities."})]})}),i.jsxs("div",{className:"flex flex-col w-full h-[calc(100vh-5rem)] bg-[#0a0a0a]",children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("h1",{className:"text-lg font-semibold text-white tracking-wide",children:"Funding Rates Arbitrage"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"Compare funding rates across exchanges to discover delta neutral arbitrage opportunities."})]}),i.jsx("div",{className:"flex items-center gap-4",children:!r&&!a&&e.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),i.jsx("span",{className:"text-gray-400 text-[10px] uppercase tracking-widest",children:"Live"})]}),f&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-px h-3 bg-neutral-700"}),i.jsxs("span",{className:"text-gray-400 text-[10px]",children:["Updated ",L(f)]})]})]})})]}),i.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:i.jsx(LVe,{className:"h-4 w-4 text-gray-500"})}),i.jsx("input",{type:"text",value:l,onChange:q=>c(q.target.value),placeholder:"Search market...",className:"w-48 pl-9 pr-8 py-1.5 rounded-lg bg-neutral-900 border border-neutral-700 text-white placeholder-gray-500 focus:outline-none focus:border-neutral-600 text-xs"}),l&&i.jsx("button",{onClick:()=>c(""),className:"absolute inset-y-0 right-2 flex items-center",children:i.jsx(bde,{className:"h-4 w-4 text-gray-500 hover:text-white transition-colors"})})]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsx("div",{className:"flex items-center gap-1",children:rje.map(q=>i.jsx("button",{onClick:()=>y(q.label),className:`px-2.5 py-1 text-[10px] font-medium uppercase rounded transition-colors ${g===q.label?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":"text-gray-400 hover:text-white hover:bg-neutral-800"}`,children:q.label},q.label))})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[!r&&!a&&e.length>0&&i.jsxs("span",{className:"text-gray-500 text-[10px] tabular-nums",children:[z.length," of ",e.length," markets"]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsxs("div",{className:"relative",ref:M,children:[i.jsxs("button",{onClick:()=>P(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-neutral-900 border border-neutral-700 text-gray-300 hover:border-neutral-600 transition-colors",children:[i.jsxs("span",{className:"text-xs",children:["Exchanges (",v.length,")"]}),i.jsx(H9,{className:`w-3.5 h-3.5 transition-transform ${N?"rotate-180":""}`})]}),N&&i.jsx("div",{className:"absolute right-0 mt-1 w-56 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 p-2",children:dg.map(q=>i.jsxs("div",{onClick:()=>$(q.id),className:"flex items-center gap-2.5 px-3 py-2 rounded-lg hover:bg-neutral-800 cursor-pointer transition-colors",children:[i.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center transition-colors ${v.includes(q.id)?"bg-emerald-500 border-emerald-500":"border-neutral-600"}`,children:v.includes(q.id)&&i.jsx("svg",{className:"w-2.5 h-2.5 text-black",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),i.jsx(aje,{exchange:q,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-xs",children:q.name})]},q.id))})]})]})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[#0f0f0f]",children:i.jsxs("table",{className:"w-full text-white",children:[i.jsx("thead",{className:"text-left sticky top-0 z-10 bg-[#0f0f0f]",children:i.jsxs("tr",{className:"text-white text-[10px] uppercase tracking-widest border-b border-neutral-800",children:[i.jsxs("th",{className:"px-6 py-3 cursor-pointer hover:text-white transition-colors font-medium",onClick:()=>X("ticker"),children:["Market ",ne("ticker")]}),i.jsx("th",{className:"px-4 py-3 text-center font-medium",children:"Automate"}),i.jsxs("th",{className:"px-4 py-3 cursor-pointer hover:text-white transition-colors font-medium text-center",onClick:()=>X("best_arb_apr"),children:["Best Arb APR ",ne("best_arb_apr")]}),dg.filter(q=>v.includes(q.id)).map(q=>i.jsx("th",{className:"px-4 py-3 cursor-pointer hover:text-white transition-colors font-medium w-[180px] min-w-[180px]",onClick:()=>X(`mp_${q.id}`),children:i.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[i.jsx(aje,{exchange:q,className:"w-3.5 h-3.5"}),i.jsx("span",{children:q.name}),ne(`mp_${q.id}`)]})},q.id))]})}),i.jsx("tbody",{children:r?Array.from({length:15}).map((q,se)=>i.jsx("tr",{className:"border-b border-neutral-800/50",children:Array.from({length:3+v.length}).map((ae,W)=>i.jsx("td",{className:"px-6 py-3",children:i.jsx("div",{className:"h-8 bg-neutral-800/50 rounded animate-pulse w-20 mx-auto"})},W))},se)):a?i.jsx("tr",{children:i.jsx("td",{colSpan:3+v.length,className:"px-6 py-12 text-center text-gray-400 text-xs",children:a})}):z.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:3+v.length,className:"px-6 py-12 text-center text-gray-500 text-xs",children:"No results found"})}):z.map(q=>{const se=te(q)||{};return i.jsxs("tr",{onClick:()=>{se.long_mp&&se.short_mp&&F(q.ticker,se.long_mp,se.short_mp)},className:"border-b border-neutral-800/50 hover:bg-neutral-800/30 transition-colors cursor-pointer",children:[i.jsx("td",{className:"px-6 py-3",children:i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${q.ticker}.svg`,alt:q.ticker,className:"w-5 h-5 rounded-full",onError:ae=>{ae.target.style.display="none"}}),i.jsx("span",{className:"text-sm text-white",children:q.ticker})]})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("div",{className:"flex justify-center",children:i.jsxs("div",{className:"relative group",children:[i.jsxs("button",{onClick:ae=>{ae.stopPropagation(),console.log("Start bot for",q.ticker)},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-neutral-900 border border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10 hover:border-emerald-500/50 transition-all whitespace-nowrap",children:[i.jsx(Xcn,{className:"w-3 h-3"}),"Automate"]}),i.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] text-white bg-neutral-800 border border-neutral-700 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-20",children:["Coming Soon",i.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-neutral-800"})]})]})})}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i.jsx("span",{className:"text-emerald-400 font-medium text-base tabular-nums",children:se.apr_fmt||"—"}),se.pair&&i.jsx("span",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:se.pair})]})}),dg.filter(ae=>v.includes(ae.id)).map(ae=>{var we;const W=(we=q.marketplaces)==null?void 0:we[ae.id],V=W==null?void 0:W.available,ee=W==null?void 0:W.hourly_rate,oe=parseFloat(ee)||0,de=se.long_mp===ae.id,Ce=se.short_mp===ae.id,me=de||Ce;return i.jsx("td",{className:"px-2 py-2 w-[180px] min-w-[180px]",children:V?i.jsxs("div",{className:`flex flex-col items-center py-1.5 px-2 rounded ${me?Ce?"bg-red-500/10 border border-red-500/20":"bg-emerald-500/10 border border-emerald-500/20":""}`,children:[i.jsx("span",{className:`text-xs tabular-nums ${J(oe)}`,children:fe(ee)}),i.jsx("div",{className:"h-4 flex items-center",children:me&&i.jsx("span",{className:`text-[9px] font-bold tracking-wide ${Ce?"text-red-400":"text-emerald-400"}`,children:Ce?"SHORT":"LONG"})})]}):i.jsxs("div",{className:"flex flex-col items-center py-1.5 px-2",children:[i.jsx("span",{className:"text-neutral-600 text-xs",children:"—"}),i.jsx("div",{className:"h-4"})]})},ae.id)})]},q.ticker)})})]})})]})]})};function Qa(t){var e=t.width,n=t.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(n<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:n}}function T3(t,e){return t.width===e.width&&t.height===e.height}var Jwn=function(){function t(e){var n=this;this._resolutionListener=function(){return n._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(e){var n=this,r={next:e};return this._observers.push(r),{unsubscribe:function(){n._observers=n._observers.filter(function(s){return s!==r})}}},t.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(n){return n.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},t}();function e3n(t){return new Jwn(t)}var t3n=function(){function t(e,n,r){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=Qa({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=n??function(a){return a},this._allowResizeObserver=(s=r==null?void 0:r.allowResizeObserver)!==null&&s!==void 0?s:!0,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var e,n;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(n=this._devicePixelRatioObservable)===null||n===void 0||n.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return Qa({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=Qa(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},t.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(n){return n!==e})},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(n){return n!==e})},t.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(e){var n=this.bitmapSize;T3(n,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(n,e))},t.prototype._emitBitmapSizeChanged=function(e,n){var r=this;this._bitmapSizeChangedListeners.forEach(function(s){return s.call(r,e,n)})},t.prototype._suggestNewBitmapSize=function(e){var n=this._suggestedBitmapSize,r=Qa(this._transformBitmapSize(e,this._canvasElementClientSize)),s=T3(this.bitmapSize,r)?null:r;n===null&&s===null||n!==null&&s!==null&&T3(n,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(n,s))},t.prototype._emitSuggestedBitmapSizeChanged=function(e,n){var r=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(r,e,n)})},t.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}r3n().then(function(n){return n?e._initResizeObserver():e._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var n=oje(this._canvasElement);if(n===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=e3n(n),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var e,n;if(this._canvasElement!==null){var r=oje(this._canvasElement);if(r!==null){var s=(n=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:r.devicePixelRatio,a=this._canvasElement.getClientRects(),o=a[0]!==void 0?s3n(a[0],s):Qa({width:this._canvasElementClientSize.width*s,height:this._canvasElementClientSize.height*s});this._suggestNewBitmapSize(o)}}},t.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(n){var r=n.find(function(o){return o.target===e._canvasElement});if(!(!r||!r.devicePixelContentBoxSize||!r.devicePixelContentBoxSize[0])){var s=r.devicePixelContentBoxSize[0],a=Qa({width:s.inlineSize,height:s.blockSize});e._suggestNewBitmapSize(a)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function n3n(t,e){if(e.type==="device-pixel-content-box")return new t3n(t,e.transform,e.options);throw new Error("Unsupported binding target")}function oje(t){return t.ownerDocument.defaultView}function r3n(){return new Promise(function(t){var e=new ResizeObserver(function(n){t(n.every(function(r){return"devicePixelContentBoxSize"in r})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function s3n(t,e){return Qa({width:Math.round(t.left*e+t.width*e)-Math.round(t.left*e),height:Math.round(t.top*e+t.height*e)-Math.round(t.top*e)})}var i3n=function(){function t(e,n,r){if(n.width===0||n.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=n,r.width===0||r.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=r,this._context=e}return t.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function g5(t,e){var n=t.canvasElementClientSize;if(n.width===0||n.height===0)return null;var r=t.bitmapSize;if(r.width===0||r.height===0)return null;var s=t.canvasElement.getContext("2d",e);return s===null?null:new i3n(s,n,r)}/*!
* @license
* TradingView Lightweight Charts™ v5.0.7
* Copyright (c) 2025 TradingView, Inc.
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
*/const oKe={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var lje,cje;function SA(t,e){const n={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[e];t.setLineDash(n)}function lKe(t,e,n,r){t.beginPath();const s=t.lineWidth%2?.5:0;t.moveTo(n,e+s),t.lineTo(r,e+s),t.stroke()}function Fu(t,e){if(!t)throw new Error("Assertion failed"+(e?": "+e:""))}function yf(t){if(t===void 0)throw new Error("Value is undefined");return t}function Jr(t){if(t===null)throw new Error("Value is null");return t}function Fy(t){return Jr(yf(t))}(function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"})(lje||(lje={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(cje||(cje={}));class El{constructor(){this.t=[]}i(e,n,r){const s={h:e,l:n,o:r===!0};this.t.push(s)}_(e){const n=this.t.findIndex(r=>e===r.h);n>-1&&this.t.splice(n,1)}u(e){this.t=this.t.filter(n=>n.l!==e)}p(e,n,r){const s=[...this.t];this.t=this.t.filter(a=>!a.o),s.forEach(a=>a.h(e,n,r))}v(){return this.t.length>0}m(){this.t=[]}}function nh(t,...e){for(const n of e)for(const r in n)n[r]!==void 0&&Object.prototype.hasOwnProperty.call(n,r)&&!["__proto__","constructor","prototype"].includes(r)&&(typeof n[r]!="object"||t[r]===void 0||Array.isArray(n[r])?t[r]=n[r]:nh(t[r],n[r]));return t}function NA(t){return typeof t=="number"&&isFinite(t)}function Pk(t){return typeof t=="number"&&t%1==0}function dP(t){return typeof t=="string"}function rO(t){return typeof t=="boolean"}function Xg(t){const e=t;if(!e||typeof e!="object")return e;let n,r,s;for(r in n=Array.isArray(e)?[]:{},e)e.hasOwnProperty(r)&&(s=e[r],n[r]=s&&typeof s=="object"?Xg(s):s);return n}function a3n(t){return t!==null}function Use(t){return t===null?void 0:t}const cKe="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function aB(t,e,n){return e===void 0&&(e=cKe),`${n=n!==void 0?`${n} `:""}${t}px ${e}`}class o3n{constructor(e){this.M={S:1,C:5,k:NaN,P:"",T:"",R:"",D:"",V:0,I:0,B:0,A:0,L:0},this.O=e}N(){const e=this.M,n=this.W(),r=this.F();return e.k===n&&e.T===r||(e.k=n,e.T=r,e.P=aB(n,r),e.A=2.5/12*n,e.V=e.A,e.I=n/12*e.C,e.B=n/12*e.C,e.L=0),e.R=this.H(),e.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}W(){return this.O.N().layout.fontSize}F(){return this.O.N().layout.fontFamily}}function dZ(t){return t<0?0:t>255?255:Math.round(t)||0}function uje(t){return .199*t[0]+.687*t[1]+.114*t[2]}class l3n{constructor(e,n){this.q=new Map,this.Y=e,n&&(this.q=n)}j(e,n){if(e==="transparent")return e;const r=this.K(e),s=r[3];return`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${n*s})`}X(e){const n=this.K(e);return{Z:`rgb(${n[0]}, ${n[1]}, ${n[2]})`,G:uje(n)>160?"black":"white"}}J(e){return uje(this.K(e))}tt(e,n,r){const[s,a,o,l]=this.K(e),[c,u,d,f]=this.K(n),x=[dZ(s+r*(c-s)),dZ(a+r*(u-a)),dZ(o+r*(d-o)),(g=l+r*(f-l),g<=0||g>1?Math.min(Math.max(g,0),1):Math.round(1e4*g)/1e4)];var g;return`rgba(${x[0]}, ${x[1]}, ${x[2]}, ${x[3]})`}K(e){const n=this.q.get(e);if(n)return n;const r=function(o){const l=document.createElement("div");l.style.display="none",document.body.appendChild(l),l.style.color=o;const c=window.getComputedStyle(l).color;return document.body.removeChild(l),c}(e),s=r.match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!s){if(this.Y.length)for(const o of this.Y){const l=o(e);if(l)return this.q.set(e,l),l}throw new Error(`Failed to parse color: ${e}`)}const a=[parseInt(s[1],10),parseInt(s[2],10),parseInt(s[3],10),s[4]?parseFloat(s[4]):1];return this.q.set(e,a),a}}class c3n{constructor(){this.it=[]}st(e){this.it=e}nt(e,n,r){this.it.forEach(s=>{s.nt(e,n,r)})}}class Y5{nt(e,n,r){e.useBitmapCoordinateSpace(s=>this.et(s,n,r))}}class u3n extends Y5{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et({context:e,horizontalPixelRatio:n,verticalPixelRatio:r}){if(this.rt===null||this.rt.lt===null)return;const s=this.rt.lt,a=this.rt,o=Math.max(1,Math.floor(n))%2/2,l=c=>{e.beginPath();for(let u=s.to-1;u>=s.from;--u){const d=a.ot[u],f=Math.round(d._t*n)+o,x=d.ut*r,g=c*r+o;e.moveTo(f,x),e.arc(f,x,g,0,2*Math.PI)}e.fill()};a.ct>0&&(e.fillStyle=a.dt,l(a.ft+a.ct)),e.fillStyle=a.vt,l(a.ft)}}function d3n(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}const f3n={from:0,to:1};class h3n{constructor(e,n,r){this.Mt=new c3n,this.bt=[],this.St=[],this.xt=!0,this.O=e,this.Ct=n,this.yt=r,this.Mt.st(this.bt)}kt(e){this.Pt(),this.xt=!0}Tt(){return this.xt&&(this.Rt(),this.xt=!1),this.Mt}Pt(){const e=this.yt.Dt();e.length!==this.bt.length&&(this.St=e.map(d3n),this.bt=this.St.map(n=>{const r=new u3n;return r.ht(n),r}),this.Mt.st(this.bt))}Rt(){const e=this.Ct.N().mode===2||!this.Ct.Vt(),n=this.yt.It(),r=this.Ct.Bt(),s=this.O.At();this.Pt(),n.forEach((a,o)=>{const l=this.St[o],c=a.Et(r),u=a.zt();!e&&c!==null&&a.Vt()&&u!==null?(l.vt=c.Lt,l.ft=c.ft,l.ct=c.Ot,l.ot[0].gt=c.gt,l.ot[0].ut=a.Wt().Nt(c.gt,u.Ft),l.dt=c.Ht??this.O.Ut(l.ot[0].ut/a.Wt().$t()),l.ot[0].wt=r,l.ot[0]._t=s.qt(r),l.lt=f3n):l.lt=null})}}class p3n extends Y5{constructor(e){super(),this.Yt=e}et({context:e,bitmapSize:n,horizontalPixelRatio:r,verticalPixelRatio:s}){if(this.Yt===null)return;const a=this.Yt.jt.Vt,o=this.Yt.Kt.Vt;if(!a&&!o)return;const l=Math.round(this.Yt._t*r),c=Math.round(this.Yt.ut*s);e.lineCap="butt",a&&l>=0&&(e.lineWidth=Math.floor(this.Yt.jt.ct*r),e.strokeStyle=this.Yt.jt.R,e.fillStyle=this.Yt.jt.R,SA(e,this.Yt.jt.Xt),function(u,d,f,x){u.beginPath();const g=u.lineWidth%2?.5:0;u.moveTo(d+g,f),u.lineTo(d+g,x),u.stroke()}(e,l,0,n.height)),o&&c>=0&&(e.lineWidth=Math.floor(this.Yt.Kt.ct*s),e.strokeStyle=this.Yt.Kt.R,e.fillStyle=this.Yt.Kt.R,SA(e,this.Yt.Kt.Xt),lKe(e,c,0,n.width))}}class m3n{constructor(e,n){this.xt=!0,this.Zt={jt:{ct:1,Xt:0,R:"",Vt:!1},Kt:{ct:1,Xt:0,R:"",Vt:!1},_t:0,ut:0},this.Gt=new p3n(this.Zt),this.Jt=e,this.yt=n}kt(){this.xt=!0}Tt(e){return this.xt&&(this.Rt(),this.xt=!1),this.Gt}Rt(){const e=this.Jt.Vt(),n=this.yt.Qt().N().crosshair,r=this.Zt;if(n.mode===2)return r.Kt.Vt=!1,void(r.jt.Vt=!1);r.Kt.Vt=e&&this.Jt.ti(this.yt),r.jt.Vt=e&&this.Jt.ii(),r.Kt.ct=n.horzLine.width,r.Kt.Xt=n.horzLine.style,r.Kt.R=n.horzLine.color,r.jt.ct=n.vertLine.width,r.jt.Xt=n.vertLine.style,r.jt.R=n.vertLine.color,r._t=this.Jt.si(),r.ut=this.Jt.ni()}}function Tz(t,e,n,r,s,a){t.save(),t.globalCompositeOperation="copy",t.fillStyle=a,t.fillRect(e,n,r,s),t.restore()}function dje(t,e,n,r,s,a){t.beginPath(),t.roundRect?t.roundRect(e,n,r,s,a):(t.lineTo(e+r-a[1],n),a[1]!==0&&t.arcTo(e+r,n,e+r,n+a[1],a[1]),t.lineTo(e+r,n+s-a[2]),a[2]!==0&&t.arcTo(e+r,n+s,e+r-a[2],n+s,a[2]),t.lineTo(e+a[3],n+s),a[3]!==0&&t.arcTo(e,n+s,e,n+s-a[3],a[3]),t.lineTo(e,n+a[0]),a[0]!==0&&t.arcTo(e,n,e+a[0],n,a[0]))}function fje(t,e,n,r,s,a,o=0,l=[0,0,0,0],c=""){if(t.save(),!o||!c||c===a)return dje(t,e,n,r,s,l),t.fillStyle=a,t.fill(),void t.restore();const u=o/2;var d;dje(t,e+u,n+u,r-o,s-o,(d=-u,l.map(f=>f===0?f:f+d))),a!=="transparent"&&(t.fillStyle=a,t.fill()),c!=="transparent"&&(t.lineWidth=o,t.strokeStyle=c,t.closePath(),t.stroke()),t.restore()}function uKe(t,e,n,r,s,a,o){t.save(),t.globalCompositeOperation="copy";const l=t.createLinearGradient(0,0,0,s);l.addColorStop(0,a),l.addColorStop(1,o),t.fillStyle=l,t.fillRect(e,n,r,s),t.restore()}class hje{constructor(e,n){this.ht(e,n)}ht(e,n){this.Yt=e,this.ei=n}$t(e,n){return this.Yt.Vt?e.k+e.A+e.V:0}nt(e,n,r,s){if(!this.Yt.Vt||this.Yt.ri.length===0)return;const a=this.Yt.R,o=this.ei.Z,l=e.useBitmapCoordinateSpace(c=>{const u=c.context;u.font=n.P;const d=this.hi(c,n,r,s),f=d.ai;return d.li?fje(u,f.oi,f._i,f.ui,f.ci,o,f.di,[f.ft,0,0,f.ft],o):fje(u,f.fi,f._i,f.ui,f.ci,o,f.di,[0,f.ft,f.ft,0],o),this.Yt.pi&&(u.fillStyle=a,u.fillRect(f.fi,f.mi,f.wi-f.fi,f.gi)),this.Yt.Mi&&(u.fillStyle=n.D,u.fillRect(d.li?f.bi-f.di:0,f._i,f.di,f.Si-f._i)),d});e.useMediaCoordinateSpace(({context:c})=>{const u=l.xi;c.font=n.P,c.textAlign=l.li?"right":"left",c.textBaseline="middle",c.fillStyle=a,c.fillText(this.Yt.ri,u.Ci,(u._i+u.Si)/2+u.yi)})}hi(e,n,r,s){const{context:a,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:u}=e,d=this.Yt.pi||!this.Yt.ki?n.C:0,f=this.Yt.Pi?n.S:0,x=n.A+this.ei.Ti,g=n.V+this.ei.Ri,y=n.I,v=n.B,C=this.Yt.ri,N=n.k,P=r.Di(a,C),T=Math.ceil(r.Vi(a,C)),M=N+x+g,F=n.S+y+v+T+d,$=Math.max(1,Math.floor(u));let L=Math.round(M*u);L%2!=$%2&&(L+=1);const z=f>0?Math.max(1,Math.floor(f*c)):0,X=Math.round(F*c),ne=Math.round(d*c),J=this.ei.Ii??this.ei.Bi,K=Math.round(J*u)-Math.floor(.5*u),te=Math.floor(K+$/2-L/2),fe=te+L,q=s==="right",se=q?l.width-f:f,ae=q?o.width-z:z;let W,V,ee;return q?(W=ae-X,V=ae-ne,ee=se-d-y-f):(W=ae+X,V=ae+ne,ee=se+d+y),{li:q,ai:{_i:te,mi:K,Si:fe,ui:X,ci:L,ft:2*c,di:z,oi:W,fi:ae,wi:V,gi:$,bi:o.width},xi:{_i:te/u,Si:fe/u,Ci:ee,yi:P}}}}class Pz{constructor(e){this.Ai={Bi:0,Z:"#000",Ri:0,Ti:0},this.Ei={ri:"",Vt:!1,pi:!0,ki:!1,Ht:"",R:"#FFF",Mi:!1,Pi:!1},this.zi={ri:"",Vt:!1,pi:!1,ki:!0,Ht:"",R:"#FFF",Mi:!0,Pi:!0},this.xt=!0,this.Li=new(e||hje)(this.Ei,this.Ai),this.Oi=new(e||hje)(this.zi,this.Ai)}ri(){return this.Ni(),this.Ei.ri}Bi(){return this.Ni(),this.Ai.Bi}kt(){this.xt=!0}$t(e,n=!1){return Math.max(this.Li.$t(e,n),this.Oi.$t(e,n))}Wi(){return this.Ai.Ii||0}Fi(e){this.Ai.Ii=e}Hi(){return this.Ni(),this.Ei.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ei.Vt}Tt(e){return this.Ni(),this.Ei.pi=this.Ei.pi&&e.N().ticksVisible,this.zi.pi=this.zi.pi&&e.N().ticksVisible,this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ei,this.Ai),this.Oi.ht(this.zi,this.Ai),this.Oi}Ni(){this.xt&&(this.Ei.pi=!0,this.zi.pi=!1,this.qi(this.Ei,this.zi,this.Ai))}}class x3n extends Pz{constructor(e,n,r){super(),this.Jt=e,this.Yi=n,this.ji=r}qi(e,n,r){if(e.Vt=!1,this.Jt.N().mode===2)return;const s=this.Jt.N().horzLine;if(!s.labelVisible)return;const a=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Ki()||a===null)return;const o=this.Yi.Xi().X(s.labelBackgroundColor);r.Z=o.Z,e.R=o.G;const l=2/12*this.Yi.k();r.Ti=l,r.Ri=l;const c=this.ji(this.Yi);r.Bi=c.Bi,e.ri=this.Yi.Zi(c.gt,a),e.Vt=!0}}const g3n=/[1-9]/g;class dKe{constructor(){this.Yt=null}ht(e){this.Yt=e}nt(e,n){if(this.Yt===null||this.Yt.Vt===!1||this.Yt.ri.length===0)return;const r=e.useMediaCoordinateSpace(({context:x})=>(x.font=n.P,Math.round(n.Gi.Vi(x,Jr(this.Yt).ri,g3n))));if(r<=0)return;const s=n.Ji,a=r+2*s,o=a/2,l=this.Yt.Qi;let c=this.Yt.Bi,u=Math.floor(c-o)+.5;u<0?(c+=Math.abs(0-u),u=Math.floor(c-o)+.5):u+a>l&&(c-=Math.abs(l-(u+a)),u=Math.floor(c-o)+.5);const d=u+a,f=Math.ceil(0+n.S+n.C+n.A+n.k+n.V);e.useBitmapCoordinateSpace(({context:x,horizontalPixelRatio:g,verticalPixelRatio:y})=>{const v=Jr(this.Yt);x.fillStyle=v.Z;const C=Math.round(u*g),N=Math.round(0*y),P=Math.round(d*g),T=Math.round(f*y),M=Math.round(2*g);if(x.beginPath(),x.moveTo(C,N),x.lineTo(C,T-M),x.arcTo(C,T,C+M,T,M),x.lineTo(P-M,T),x.arcTo(P,T,P,T-M,M),x.lineTo(P,N),x.fill(),v.pi){const F=Math.round(v.Bi*g),$=N,L=Math.round(($+n.C)*y);x.fillStyle=v.R;const z=Math.max(1,Math.floor(g)),X=Math.floor(.5*g);x.fillRect(F-X,$,z,L-$)}}),e.useMediaCoordinateSpace(({context:x})=>{const g=Jr(this.Yt),y=0+n.S+n.C+n.A+n.k/2;x.font=n.P,x.textAlign="left",x.textBaseline="middle",x.fillStyle=g.R;const v=n.Gi.Di(x,"Apr0");x.translate(u+s,y+v),x.fillText(g.ri,0,0)})}}class b3n{constructor(e,n,r){this.xt=!0,this.Gt=new dKe,this.Zt={Vt:!1,Z:"#4c525e",R:"white",ri:"",Qi:0,Bi:NaN,pi:!0},this.Ct=e,this.ts=n,this.ji=r}kt(){this.xt=!0}Tt(){return this.xt&&(this.Rt(),this.xt=!1),this.Gt.ht(this.Zt),this.Gt}Rt(){const e=this.Zt;if(e.Vt=!1,this.Ct.N().mode===2)return;const n=this.Ct.N().vertLine;if(!n.labelVisible)return;const r=this.ts.At();if(r.Ki())return;e.Qi=r.Qi();const s=this.ji();if(s===null)return;e.Bi=s.Bi;const a=r.ss(this.Ct.Bt());e.ri=r.ns(Jr(a)),e.Vt=!0;const o=this.ts.Xi().X(n.labelBackgroundColor);e.Z=o.Z,e.R=o.G,e.pi=r.N().ticksVisible}}let fKe=class{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(e){this.rs=e}Wt(){return this.es}_s(e){this.es=e}us(e){return[]}cs(){return[]}Vt(){return!0}};var pje;(function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden",t[t.MagnetOHLC=3]="MagnetOHLC"})(pje||(pje={}));class y3n extends fKe{constructor(e,n){super(),this.yt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.Ss=NaN,this.xs=NaN,this.Cs=NaN,this.ts=e,this.ys=n,this.ks=((s,a)=>o=>{const l=a(),c=s();if(o===Jr(this.yt).Ps())return{gt:c,Bi:l};{const u=Jr(o.zt());return{gt:o.Ts(l,u),Bi:l}}})(()=>this.ds,()=>this.Ss);const r=((s,a)=>()=>{const o=this.ts.At().Rs(s()),l=a();return o&&Number.isFinite(l)?{wt:o,Bi:l}:null})(()=>this.fs,()=>this.si());this.Ds=new b3n(this,e,r)}N(){return this.ys}Vs(e,n){this.xs=e,this.Cs=n}Is(){this.xs=NaN,this.Cs=NaN}Bs(){return this.xs}As(){return this.Cs}Es(e,n,r){this.ws||(this.ws=!0),this.ps=!0,this.zs(e,n,r)}Bt(){return this.fs}si(){return this.bs}ni(){return this.Ss}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.Ss=NaN,this.yt=null,this.Is(),this.Ns()}Ws(e){let n=this.gs.get(e);n||(n=new m3n(this,e),this.gs.set(e,n));let r=this.Ms.get(e);return r||(r=new h3n(this.ts,this,e),this.Ms.set(e,r)),[n,r]}ti(e){return e===this.yt&&this.ys.horzLine.visible}ii(){return this.ys.vertLine.visible}Fs(e,n){this.ps&&this.yt===e||this.vs.clear();const r=[];return this.yt===e&&r.push(this.Hs(this.vs,n,this.ks)),r}cs(){return this.ps?[this.Ds]:[]}Us(){return this.yt}Ns(){this.ts.$s().forEach(e=>{var n,r;(n=this.gs.get(e))==null||n.kt(),(r=this.Ms.get(e))==null||r.kt()}),this.vs.forEach(e=>e.kt()),this.Ds.kt()}qs(e){return e&&!e.Ps().Ki()?e.Ps():null}zs(e,n,r){this.Ys(e,n,r)&&this.Ns()}Ys(e,n,r){const s=this.bs,a=this.Ss,o=this.ds,l=this.fs,c=this.yt,u=this.qs(r);this.fs=e,this.bs=isNaN(e)?NaN:this.ts.At().qt(e),this.yt=r;const d=u!==null?u.zt():null;return u!==null&&d!==null?(this.ds=n,this.Ss=u.Nt(n,d)):(this.ds=NaN,this.Ss=NaN),s!==this.bs||a!==this.Ss||l!==this.fs||o!==this.ds||c!==this.yt}Os(){const e=this.ts.js().map(r=>r.Xs().Ks()).filter(a3n),n=e.length===0?null:Math.max(...e);this.fs=n!==null?n:NaN}Hs(e,n,r){let s=e.get(n);return s===void 0&&(s=new x3n(this,n,r),e.set(n,s)),s}}function Iz(t){return t==="left"||t==="right"}class Qc{constructor(e){this.Zs=new Map,this.Gs=[],this.Js=e}Qs(e,n){const r=function(s,a){return s===void 0?a:{tn:Math.max(s.tn,a.tn),sn:s.sn||a.sn}}(this.Zs.get(e),n);this.Zs.set(e,r)}nn(){return this.Js}en(e){const n=this.Zs.get(e);return n===void 0?{tn:this.Js}:{tn:Math.max(this.Js,n.tn),sn:n.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(e){this.hn(),this.Gs=[{an:1,Ft:e}]}_n(e){this.un(),this.Gs.push({an:5,Ft:e})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(e){this.hn(),this.Gs.push({an:2,Ft:e})}fn(e){this.hn(),this.Gs.push({an:3,Ft:e})}pn(){return this.Gs}vn(e){for(const n of e.Gs)this.mn(n);this.Js=Math.max(this.Js,e.Js),e.Zs.forEach((n,r)=>{this.Qs(r,n)})}static wn(){return new Qc(2)}static gn(){return new Qc(3)}mn(e){switch(e.an){case 0:this.rn();break;case 1:this.ln(e.Ft);break;case 2:this.dn(e.Ft);break;case 3:this.fn(e.Ft);break;case 4:this.cn();break;case 5:this._n(e.Ft);break;case 6:this.un()}}un(){const e=this.Gs.findIndex(n=>n.an===5);e!==-1&&this.Gs.splice(e,1)}}const mje=".";function Qg(t,e){if(!NA(t))return"n/a";if(!Pk(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?t.toString():("0000000000000000"+t.toString()).slice(-e)}class Fz{constructor(e,n){if(n||(n=1),NA(e)&&Pk(e)||(e=100),e<0)throw new TypeError("invalid base");this.Yi=e,this.Mn=n,this.bn()}format(e){const n=e<0?"−":"";return e=Math.abs(e),n+this.Sn(e)}bn(){if(this.xn=0,this.Yi>0&&this.Mn>0){let e=this.Yi;for(;e>1;)e/=10,this.xn++}}Sn(e){const n=this.Yi/this.Mn;let r=Math.floor(e),s="";const a=this.xn!==void 0?this.xn:NaN;if(n>1){let o=+(Math.round(e*n)-r*n).toFixed(this.xn);o>=n&&(o-=n,r+=1),s=mje+Qg(+o.toFixed(this.xn)*this.Mn,a)}else r=Math.round(r*n)/n,a>0&&(s=mje+Qg(0,a));return r.toFixed(0)+s}}class hKe extends Fz{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class v3n{constructor(e){this.Cn=e}format(e){let n="";return e<0&&(n="-",e=-e),e<995?n+this.yn(e):e<999995?n+this.yn(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),n+this.yn(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),n+this.yn(e/1e9)+"B")}yn(e){let n;const r=Math.pow(10,this.Cn);return n=(e=Math.round(e*r)/r)>=1e-15&&e<1?e.toFixed(this.Cn).replace(/\.?0+$/,""):String(e),n.replace(/(\.[1-9]*)0+$/,(s,a)=>a)}}const w3n=/[2-9]/g;class oB{constructor(e=50){this.kn=0,this.Pn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=e}In(){this.kn=0,this.Dn.clear(),this.Pn=1,this.Tn=1,this.Rn={}}Vi(e,n,r){return this.Bn(e,n,r).width}Di(e,n,r){const s=this.Bn(e,n,r);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}Bn(e,n,r){const s=r||w3n,a=String(n).replace(s,"0");if(this.Dn.has(a))return yf(this.Dn.get(a)).An;if(this.kn===this.Vn){const l=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(l),this.Tn++,this.kn--}e.save(),e.textBaseline="middle";const o=e.measureText(a);return e.restore(),o.width===0&&n.length||(this.Dn.set(a,{An:o,En:this.Pn}),this.Rn[this.Pn]=a,this.kn++,this.Pn++),o}}class C3n{constructor(e){this.zn=null,this.M=null,this.Ln="right",this.On=e}Nn(e,n,r){this.zn=e,this.M=n,this.Ln=r}nt(e){this.M!==null&&this.zn!==null&&this.zn.nt(e,this.M,this.On,this.Ln)}}class pKe{constructor(e,n,r){this.Wn=e,this.On=new oB(50),this.Fn=n,this.O=r,this.W=-1,this.Gt=new C3n(this.On)}Tt(){const e=this.O.Hn(this.Fn);if(e===null)return null;const n=e.Un(this.Fn)?e.$n():this.Fn.Wt();if(n===null)return null;const r=e.qn(n);if(r==="overlay")return null;const s=this.O.Yn();return s.k!==this.W&&(this.W=s.k,this.On.In()),this.Gt.Nn(this.Wn.$i(),s,r),this.Gt}}class S3n extends Y5{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}jn(e,n){var o;if(!((o=this.Yt)!=null&&o.Vt))return null;const{ut:r,ct:s,Kn:a}=this.Yt;return n>=r-s-7&&n<=r+s+7?{Xn:this.Yt,Kn:a}:null}et({context:e,bitmapSize:n,horizontalPixelRatio:r,verticalPixelRatio:s}){if(this.Yt===null||this.Yt.Vt===!1)return;const a=Math.round(this.Yt.ut*s);a<0||a>n.height||(e.lineCap="butt",e.strokeStyle=this.Yt.R,e.lineWidth=Math.floor(this.Yt.ct*r),SA(e,this.Yt.Xt),lKe(e,a,0,n.width))}}class wfe{constructor(e){this.Zn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Xt:0,Vt:!1},this.Gn=new S3n,this.xt=!0,this.Jn=e,this.Qn=e.Qt(),this.Gn.ht(this.Zn)}kt(){this.xt=!0}Tt(){return this.Jn.Vt()?(this.xt&&(this.te(),this.xt=!1),this.Gn):null}}class N3n extends wfe{constructor(e){super(e)}te(){this.Zn.Vt=!1;const e=this.Jn.Wt(),n=e.ie().ie;if(n!==2&&n!==3)return;const r=this.Jn.N();if(!r.baseLineVisible||!this.Jn.Vt())return;const s=this.Jn.zt();s!==null&&(this.Zn.Vt=!0,this.Zn.ut=e.Nt(s.Ft,s.Ft),this.Zn.R=r.baseLineColor,this.Zn.ct=r.baseLineWidth,this.Zn.Xt=r.baseLineStyle)}}class A3n extends Y5{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}se(){return this.Yt}et({context:e,horizontalPixelRatio:n,verticalPixelRatio:r}){const s=this.Yt;if(s===null)return;const a=Math.max(1,Math.floor(n)),o=a%2/2,l=Math.round(s.ne.x*n)+o,c=s.ne.y*r;e.fillStyle=s.ee,e.beginPath();const u=Math.max(2,1.5*s.re)*n;e.arc(l,c,u,0,2*Math.PI,!1),e.fill(),e.fillStyle=s.he,e.beginPath(),e.arc(l,c,s.ft*n,0,2*Math.PI,!1),e.fill(),e.lineWidth=a,e.strokeStyle=s.ae,e.beginPath(),e.arc(l,c,s.ft*n+a/2,0,2*Math.PI,!1),e.stroke()}}const j3n=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}];class E3n{constructor(e){this.Gt=new A3n,this.xt=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=e}Me(){this.we=this.me-1,this.kt()}be(){if(this.kt(),this.ge.N().lastPriceAnimation===2){const e=performance.now(),n=this.we-e;if(n>0)return void(n<650&&(this.we+=2600));this.me=e,this.we=e+2600}}kt(){this.xt=!0}Se(){this.ve=!0}Vt(){return this.ge.N().lastPriceAnimation!==0}xe(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.xt?(this.Rt(),this.xt=!1,this.ve=!1):this.ve&&(this.Ce(),this.ve=!1),this.Gt}Rt(){this.Gt.ht(null);const e=this.ge.Qt().At(),n=e.ye(),r=this.ge.zt();if(n===null||r===null)return;const s=this.ge.ke(!0);if(s.Pe||!n.Te(s.Re))return;const a={x:e.qt(s.Re),y:this.ge.Wt().Nt(s.gt,r.Ft)},o=s.R,l=this.ge.N().lineWidth,c=this.De(this.Ve(),o);this.Gt.ht({ee:o,re:l,he:c.he,ae:c.ae,ft:c.ft,ne:a})}Ce(){const e=this.Gt.se();if(e!==null){const n=this.De(this.Ve(),e.ee);e.he=n.he,e.ae=n.ae,e.ft=n.ft}}Ve(){return this.xe()?performance.now()-this.me:2599}Ie(e,n,r,s){const a=r+(s-r)*n;return this.ge.Qt().Xi().j(e,a)}De(e,n){const r=e%2600/2600;let s;for(const u of j3n)if(r>=u.le&&r<=u.oe){s=u;break}Fu(s!==void 0,"Last price animation internal logic error");const a=(r-s.le)/(s.oe-s.le);return{he:this.Ie(n,a,s.ce,s.de),ae:this.Ie(n,a,s.fe,s.pe),ft:(o=a,l=s._e,c=s.ue,l+(c-l)*o)};var o,l,c}}class _3n extends wfe{constructor(e){super(e)}te(){const e=this.Zn;e.Vt=!1;const n=this.Jn.N();if(!n.priceLineVisible||!this.Jn.Vt())return;const r=this.Jn.ke(n.priceLineSource===0);r.Pe||(e.Vt=!0,e.ut=r.Bi,e.R=this.Jn.Be(r.R),e.ct=n.priceLineWidth,e.Xt=n.priceLineStyle)}}class k3n extends Pz{constructor(e){super(),this.Jt=e}qi(e,n,r){e.Vt=!1,n.Vt=!1;const s=this.Jt;if(!s.Vt())return;const a=s.N(),o=a.lastValueVisible,l=s.Ae()!=="",c=a.seriesLastValueMode===0,u=s.ke(!1);if(u.Pe)return;o&&(e.ri=this.Ee(u,o,c),e.Vt=e.ri.length!==0),(l||c)&&(n.ri=this.ze(u,o,l,c),n.Vt=n.ri.length>0);const d=s.Be(u.R),f=this.Jt.Qt().Xi().X(d);r.Z=f.Z,r.Bi=u.Bi,n.Ht=s.Qt().Ut(u.Bi/s.Wt().$t()),e.Ht=d,e.R=f.G,n.R=f.G}ze(e,n,r,s){let a="";const o=this.Jt.Ae();return r&&o.length!==0&&(a+=`${o} `),n&&s&&(a+=this.Jt.Wt().Le()?e.Oe:e.Ne),a.trim()}Ee(e,n,r){return n?r?this.Jt.Wt().Le()?e.Ne:e.Oe:e.ri:""}}function xje(t,e,n,r){const s=Number.isFinite(e),a=Number.isFinite(n);return s&&a?t(e,n):s||a?s?e:n:r}class wd{constructor(e,n){this.We=e,this.Fe=n}He(e){return e!==null&&this.We===e.We&&this.Fe===e.Fe}Ue(){return new wd(this.We,this.Fe)}$e(){return this.We}qe(){return this.Fe}Ye(){return this.Fe-this.We}Ki(){return this.Fe===this.We||Number.isNaN(this.Fe)||Number.isNaN(this.We)}vn(e){return e===null?this:new wd(xje(Math.min,this.$e(),e.$e(),-1/0),xje(Math.max,this.qe(),e.qe(),1/0))}je(e){if(!NA(e)||this.Fe-this.We===0)return;const n=.5*(this.Fe+this.We);let r=this.Fe-n,s=this.We-n;r*=e,s*=e,this.Fe=n+r,this.We=n+s}Ke(e){NA(e)&&(this.Fe+=e,this.We+=e)}Xe(){return{minValue:this.We,maxValue:this.Fe}}static Ze(e){return e===null?null:new wd(e.minValue,e.maxValue)}}class lB{constructor(e,n){this.Ge=e,this.Je=n||null}Qe(){return this.Ge}tr(){return this.Je}Xe(){return{priceRange:this.Ge===null?null:this.Ge.Xe(),margins:this.Je||void 0}}static Ze(e){return e===null?null:new lB(wd.Ze(e.priceRange),e.margins)}}class T3n extends wfe{constructor(e,n){super(e),this.ir=n}te(){const e=this.Zn;e.Vt=!1;const n=this.ir.N();if(!this.Jn.Vt()||!n.lineVisible)return;const r=this.ir.sr();r!==null&&(e.Vt=!0,e.ut=r,e.R=n.color,e.ct=n.lineWidth,e.Xt=n.lineStyle,e.Kn=this.ir.N().id)}}class P3n extends Pz{constructor(e,n){super(),this.ge=e,this.ir=n}qi(e,n,r){e.Vt=!1,n.Vt=!1;const s=this.ir.N(),a=s.axisLabelVisible,o=s.title!=="",l=this.ge;if(!a||!l.Vt())return;const c=this.ir.sr();if(c===null)return;o&&(n.ri=s.title,n.Vt=!0),n.Ht=l.Qt().Ut(c/l.Wt().$t()),e.ri=this.nr(s.price),e.Vt=!0;const u=this.ge.Qt().Xi().X(s.axisLabelColor||s.color);r.Z=u.Z;const d=s.axisLabelTextColor||u.G;e.R=d,n.R=d,r.Bi=c}nr(e){const n=this.ge.zt();return n===null?"":this.ge.Wt().Zi(e,n.Ft)}}class I3n{constructor(e,n){this.ge=e,this.ys=n,this.er=new T3n(e,this),this.Wn=new P3n(e,this),this.rr=new pKe(this.Wn,e,e.Qt())}hr(e){nh(this.ys,e),this.kt(),this.ge.Qt().ar()}N(){return this.ys}lr(){return this.er}_r(){return this.rr}ur(){return this.Wn}kt(){this.er.kt(),this.Wn.kt()}sr(){const e=this.ge,n=e.Wt();if(e.Qt().At().Ki()||n.Ki())return null;const r=e.zt();return r===null?null:n.Nt(this.ys.price,r.Ft)}}class F3n extends fKe{constructor(e){super(),this.ts=e}Qt(){return this.ts}}const O3n={Bar:(t,e,n,r)=>{const s=e.upColor,a=e.downColor,o=Jr(t(n,r)),l=Fy(o.Ft[0])<=Fy(o.Ft[3]);return{cr:o.R??(l?s:a)}},Candlestick:(t,e,n,r)=>{const s=e.upColor,a=e.downColor,o=e.borderUpColor,l=e.borderDownColor,c=e.wickUpColor,u=e.wickDownColor,d=Jr(t(n,r)),f=Fy(d.Ft[0])<=Fy(d.Ft[3]);return{cr:d.R??(f?s:a),dr:d.Ht??(f?o:l),pr:d.vr??(f?c:u)}},Custom:(t,e,n,r)=>({cr:Jr(t(n,r)).R??e.color}),Area:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.vt??e.lineColor,vt:s.vt??e.lineColor,mr:s.mr??e.topColor,wr:s.wr??e.bottomColor}},Baseline:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.Ft[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,gr:s.gr??e.topLineColor,Mr:s.Mr??e.bottomLineColor,br:s.br??e.topFillColor1,Sr:s.Sr??e.topFillColor2,Cr:s.Cr??e.bottomFillColor1,yr:s.yr??e.bottomFillColor2}},Line:(t,e,n,r)=>{const s=Jr(t(n,r));return{cr:s.R??e.color,vt:s.R??e.color}},Histogram:(t,e,n,r)=>({cr:Jr(t(n,r)).R??e.color})};class M3n{constructor(e){this.kr=(n,r)=>r!==void 0?r.Ft:this.ge.Xs().Pr(n),this.ge=e,this.Tr=O3n[e.Rr()]}Dr(e,n){return this.Tr(this.kr,this.ge.N(),e,n)}}function mKe(t,e,n,r,s=0,a=e.length){let o=a-s;for(;0<o;){const l=o>>1,c=s+l;r(e[c],n)===t?(s=c+1,o-=l+1):o=l}return s}const AA=mKe.bind(null,!0),xKe=mKe.bind(null,!1);var gje;(function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"})(gje||(gje={}));const Mb=30;class R3n{constructor(){this.Vr=[],this.Ir=new Map,this.Br=new Map,this.Ar=[]}Er(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Ks(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Ki(){return this.zr()===0}Te(e){return this.Nr(e,0)!==null}Pr(e){return this.Wr(e)}Wr(e,n=0){const r=this.Nr(e,n);return r===null?null:{...this.Fr(r),Re:this.Or(r)}}Hr(){return this.Vr}Ur(e,n,r){if(this.Ki())return null;let s=null;for(const a of r)s=sO(s,this.$r(e,n,a));return s}ht(e){this.Br.clear(),this.Ir.clear(),this.Vr=e,this.Ar=e.map(n=>n.Re)}qr(){return this.Ar}Or(e){return this.Vr[e].Re}Fr(e){return this.Vr[e]}Nr(e,n){const r=this.Yr(e);if(r===null&&n!==0)switch(n){case-1:return this.jr(e);case 1:return this.Kr(e);default:throw new TypeError("Unknown search mode")}return r}jr(e){let n=this.Xr(e);return n>0&&(n-=1),n!==this.Vr.length&&this.Or(n)<e?n:null}Kr(e){const n=this.Zr(e);return n!==this.Vr.length&&e<this.Or(n)?n:null}Yr(e){const n=this.Xr(e);return n===this.Vr.length||e<this.Vr[n].Re?null:n}Xr(e){return AA(this.Vr,e,(n,r)=>n.Re<r)}Zr(e){return xKe(this.Vr,e,(n,r)=>n.Re>r)}Gr(e,n,r){let s=null;for(let a=e;a<n;a++){const o=this.Vr[a].Ft[r];Number.isNaN(o)||(s===null?s={Jr:o,Qr:o}:(o<s.Jr&&(s.Jr=o),o>s.Qr&&(s.Qr=o)))}return s}$r(e,n,r){if(this.Ki())return null;let s=null;const a=Jr(this.Lr()),o=Jr(this.Ks()),l=Math.max(e,a),c=Math.min(n,o),u=Math.ceil(l/Mb)*Mb,d=Math.max(u,Math.floor(c/Mb)*Mb);{const x=this.Xr(l),g=this.Zr(Math.min(c,u,n));s=sO(s,this.Gr(x,g,r))}let f=this.Ir.get(r);f===void 0&&(f=new Map,this.Ir.set(r,f));for(let x=Math.max(u+1,l);x<d;x+=Mb){const g=Math.floor(x/Mb);let y=f.get(g);if(y===void 0){const v=this.Xr(g*Mb),C=this.Zr((g+1)*Mb-1);y=this.Gr(v,C,r),f.set(g,y)}s=sO(s,y)}{const x=this.Xr(d),g=this.Zr(c);s=sO(s,this.Gr(x,g,r))}return s}}function sO(t,e){return t===null?e:e===null?t:{Jr:Math.min(t.Jr,e.Jr),Qr:Math.max(t.Qr,e.Qr)}}class L3n{constructor(e){this.th=e}nt(e,n,r){this.th.draw(e)}ih(e,n,r){var s,a;(a=(s=this.th).drawBackground)==null||a.call(s,e)}}class D3n{constructor(e){this.Dn=null,this.sh=e}Tt(){var r;const e=this.sh.renderer();if(e===null)return null;if(((r=this.Dn)==null?void 0:r.nh)===e)return this.Dn.eh;const n=new L3n(e);return this.Dn={nh:e,eh:n},n}rh(){var e,n;return((n=(e=this.sh).zOrder)==null?void 0:n.call(e))??"normal"}}class gKe{constructor(e){this.hh=null,this.ah=e}oh(){return this.ah}Ns(){var e,n;(n=(e=this.ah).updateAllViews)==null||n.call(e)}Ws(){var r,s,a;const e=((s=(r=this.ah).paneViews)==null?void 0:s.call(r))??[];if(((a=this.hh)==null?void 0:a.nh)===e)return this.hh.eh;const n=e.map(o=>new D3n(o));return this.hh={nh:e,eh:n},n}jn(e,n){var r,s;return((s=(r=this.ah).hitTest)==null?void 0:s.call(r,e,n))??null}}let B3n=class extends gKe{us(){return[]}};class $3n{constructor(e){this.th=e}nt(e,n,r){this.th.draw(e)}ih(e,n,r){var s,a;(a=(s=this.th).drawBackground)==null||a.call(s,e)}}class bje{constructor(e){this.Dn=null,this.sh=e}Tt(){var r;const e=this.sh.renderer();if(e===null)return null;if(((r=this.Dn)==null?void 0:r.nh)===e)return this.Dn.eh;const n=new $3n(e);return this.Dn={nh:e,eh:n},n}rh(){var e,n;return((n=(e=this.sh).zOrder)==null?void 0:n.call(e))??"normal"}}function bKe(t){var e,n,r;return{ri:t.text(),Bi:t.coordinate(),Ii:(e=t.fixedCoordinate)==null?void 0:e.call(t),R:t.textColor(),Z:t.backColor(),Vt:((n=t.visible)==null?void 0:n.call(t))??!0,pi:((r=t.tickVisible)==null?void 0:r.call(t))??!0}}class U3n{constructor(e,n){this.Gt=new dKe,this._h=e,this.uh=n}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...bKe(this._h)}),this.Gt}}class z3n extends Pz{constructor(e,n){super(),this._h=e,this.Yi=n}qi(e,n,r){const s=bKe(this._h);r.Z=s.Z,e.R=s.R;const a=2/12*this.Yi.k();r.Ti=a,r.Ri=a,r.Bi=s.Bi,r.Ii=s.Ii,e.ri=s.ri,e.Vt=s.Vt,e.pi=s.pi}}class H3n extends gKe{constructor(e,n){super(e),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=n}cs(){var s,a,o;const e=((a=(s=this.ah).timeAxisViews)==null?void 0:a.call(s))??[];if(((o=this.dh)==null?void 0:o.nh)===e)return this.dh.eh;const n=this.ge.Qt().At(),r=e.map(l=>new U3n(l,n));return this.dh={nh:e,eh:r},r}Fs(){var s,a,o;const e=((a=(s=this.ah).priceAxisViews)==null?void 0:a.call(s))??[];if(((o=this.fh)==null?void 0:o.nh)===e)return this.fh.eh;const n=this.ge.Wt(),r=e.map(l=>new z3n(l,n));return this.fh={nh:e,eh:r},r}wh(){var r,s,a;const e=((s=(r=this.ah).priceAxisPaneViews)==null?void 0:s.call(r))??[];if(((a=this.ph)==null?void 0:a.nh)===e)return this.ph.eh;const n=e.map(o=>new bje(o));return this.ph={nh:e,eh:n},n}gh(){var r,s,a;const e=((s=(r=this.ah).timeAxisPaneViews)==null?void 0:s.call(r))??[];if(((a=this.mh)==null?void 0:a.nh)===e)return this.mh.eh;const n=e.map(o=>new bje(o));return this.mh={nh:e,eh:n},n}Mh(e,n){var r,s;return((s=(r=this.ah).autoscaleInfo)==null?void 0:s.call(r,e,n))??null}}function fZ(t,e,n,r){t.forEach(s=>{e(s).forEach(a=>{a.rh()===n&&r.push(a)})})}function hZ(t){return t.Ws()}function V3n(t){return t.wh()}function W3n(t){return t.gh()}const q3n=["Area","Line","Baseline"];class Oz extends F3n{constructor(e,n,r,s,a){super(e),this.Yt=new R3n,this.er=new _3n(this),this.bh=[],this.Sh=new N3n(this),this.xh=null,this.Ch=null,this.yh=null,this.kh=[],this.ys=r,this.Ph=n;const o=new k3n(this);this.vs=[o],this.rr=new pKe(o,this,e),q3n.includes(this.Ph)&&(this.xh=new E3n(this)),this.Th(),this.sh=s(this,this.Qt(),a)}m(){this.yh!==null&&clearTimeout(this.yh)}Be(e){return this.ys.priceLineColor||e}ke(e){const n={Pe:!0},r=this.Wt();if(this.Qt().At().Ki()||r.Ki()||this.Yt.Ki())return n;const s=this.Qt().At().ye(),a=this.zt();if(s===null||a===null)return n;let o,l;if(e){const f=this.Yt.Er();if(f===null)return n;o=f,l=f.Re}else{const f=this.Yt.Wr(s.bi(),-1);if(f===null||(o=this.Yt.Pr(f.Re),o===null))return n;l=f.Re}const c=o.Ft[3],u=this.Rh().Dr(l,{Ft:o}),d=r.Nt(c,a.Ft);return{Pe:!1,gt:c,ri:r.Zi(c,a.Ft),Oe:r.Dh(c),Ne:r.Vh(c,a.Ft),R:u.cr,Bi:d,Re:l}}Rh(){return this.Ch!==null||(this.Ch=new M3n(this)),this.Ch}N(){return this.ys}hr(e){const n=e.priceScaleId;n!==void 0&&n!==this.ys.priceScaleId&&this.Qt().Ih(this,n),nh(this.ys,e),e.priceFormat!==void 0&&(this.Th(),this.Qt().Bh()),this.Qt().Ah(this),this.Qt().Eh(),this.sh.kt("options")}ht(e,n){this.Yt.ht(e),this.sh.kt("data"),this.xh!==null&&(n&&n.zh?this.xh.be():e.length===0&&this.xh.Me());const r=this.Qt().Hn(this);this.Qt().Lh(r),this.Qt().Ah(this),this.Qt().Eh(),this.Qt().ar()}Oh(e){const n=new I3n(this,e);return this.bh.push(n),this.Qt().Ah(this),n}Nh(e){const n=this.bh.indexOf(e);n!==-1&&this.bh.splice(n,1),this.Qt().Ah(this)}Wh(){return this.bh}Rr(){return this.Ph}zt(){const e=this.Fh();return e===null?null:{Ft:e.Ft[3],Hh:e.wt}}Fh(){const e=this.Qt().At().ye();if(e===null)return null;const n=e.Uh();return this.Yt.Wr(n,1)}Xs(){return this.Yt}$h(e){const n=this.Yt.Pr(e);return n===null?null:this.Ph==="Bar"||this.Ph==="Candlestick"||this.Ph==="Custom"?{qh:n.Ft[0],Yh:n.Ft[1],jh:n.Ft[2],Kh:n.Ft[3]}:n.Ft[3]}Xh(e){const n=[];fZ(this.kh,hZ,"top",n);const r=this.xh;return r!==null&&r.Vt()&&(this.yh===null&&r.xe()&&(this.yh=setTimeout(()=>{this.yh=null,this.Qt().Zh()},0)),r.Se(),n.unshift(r)),n}Ws(){const e=[];this.Gh()||e.push(this.Sh),e.push(this.sh,this.er);const n=this.bh.map(r=>r.lr());return e.push(...n),fZ(this.kh,hZ,"normal",e),e}Jh(){return this.Qh(hZ,"bottom")}ta(e){return this.Qh(V3n,e)}ia(e){return this.Qh(W3n,e)}sa(e,n){return this.kh.map(r=>r.jn(e,n)).filter(r=>r!==null)}us(){return[this.rr,...this.bh.map(e=>e._r())]}Fs(e,n){if(n!==this.es&&!this.Gh())return[];const r=[...this.vs];for(const s of this.bh)r.push(s.ur());return this.kh.forEach(s=>{r.push(...s.Fs())}),r}cs(){const e=[];return this.kh.forEach(n=>{e.push(...n.cs())}),e}Mh(e,n){if(this.ys.autoscaleInfoProvider!==void 0){const r=this.ys.autoscaleInfoProvider(()=>{const s=this.na(e,n);return s===null?null:s.Xe()});return lB.Ze(r)}return this.na(e,n)}ea(){return this.ys.priceFormat.minMove}ra(){return this.ha}Ns(){var e;this.sh.kt();for(const n of this.vs)n.kt();for(const n of this.bh)n.kt();this.er.kt(),this.Sh.kt(),(e=this.xh)==null||e.kt(),this.kh.forEach(n=>n.Ns())}Wt(){return Jr(super.Wt())}Et(e){if(!((this.Ph==="Line"||this.Ph==="Area"||this.Ph==="Baseline")&&this.ys.crosshairMarkerVisible))return null;const n=this.Yt.Pr(e);return n===null?null:{gt:n.Ft[3],ft:this.aa(),Ht:this.la(),Ot:this.oa(),Lt:this._a(e)}}Ae(){return this.ys.title}Vt(){return this.ys.visible}ua(e){this.kh.push(new H3n(e,this))}ca(e){this.kh=this.kh.filter(n=>n.oh()!==e)}da(){if(this.Ph==="Custom")return e=>this.sh.fa(e)}pa(){if(this.Ph==="Custom")return e=>this.sh.va(e)}ma(){return this.Yt.qr()}Gh(){return!Iz(this.Wt().wa())}na(e,n){if(!Pk(e)||!Pk(n)||this.Yt.Ki())return null;const r=this.Ph==="Line"||this.Ph==="Area"||this.Ph==="Baseline"||this.Ph==="Histogram"?[3]:[2,1],s=this.Yt.Ur(e,n,r);let a=s!==null?new wd(s.Jr,s.Qr):null,o=null;if(this.Rr()==="Histogram"){const l=this.ys.base,c=new wd(l,l);a=a!==null?a.vn(c):c}return this.kh.forEach(l=>{const c=l.Mh(e,n);if(c!=null&&c.priceRange){const u=new wd(c.priceRange.minValue,c.priceRange.maxValue);a=a!==null?a.vn(u):u}c!=null&&c.margins&&(o=c.margins)}),new lB(a,o)}aa(){switch(this.Ph){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerRadius}return 0}la(){switch(this.Ph){case"Line":case"Area":case"Baseline":{const e=this.ys.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}oa(){switch(this.Ph){case"Line":case"Area":case"Baseline":return this.ys.crosshairMarkerBorderWidth}return 0}_a(e){switch(this.Ph){case"Line":case"Area":case"Baseline":{const n=this.ys.crosshairMarkerBackgroundColor;if(n.length!==0)return n}}return this.Rh().Dr(e).cr}Th(){switch(this.ys.priceFormat.type){case"custom":this.ha={format:this.ys.priceFormat.formatter};break;case"volume":this.ha=new v3n(this.ys.priceFormat.precision);break;case"percent":this.ha=new hKe(this.ys.priceFormat.precision);break;default:{const e=Math.pow(10,this.ys.priceFormat.precision);this.ha=new Fz(e,this.ys.priceFormat.minMove*e)}}this.es!==null&&this.es.ga()}Qh(e,n){const r=[];return fZ(this.kh,e,n,r),r}}const G3n=[3],K3n=[0,1,2,3];class Y3n{constructor(e){this.ys=e}Ma(e,n,r){let s=e;if(this.ys.mode===0)return s;const a=r.Ps(),o=a.zt();if(o===null)return s;const l=a.Nt(e,o),c=r.ba().filter(d=>d instanceof Oz).reduce((d,f)=>{if(r.Un(f)||!f.Vt())return d;const x=f.Wt(),g=f.Xs();if(x.Ki()||!g.Te(n))return d;const y=g.Pr(n);if(y===null)return d;const v=Fy(f.zt()),C=this.ys.mode===3?K3n:G3n;return d.concat(C.map(N=>x.Nt(y.Ft[N],v.Ft)))},[]);if(c.length===0)return s;c.sort((d,f)=>Math.abs(d-l)-Math.abs(f-l));const u=c[0];return s=a.Ts(u,o),s}}function X9(t,e,n){return Math.min(Math.max(t,e),n)}function iO(t,e,n){return e-t<=n}class X3n extends Y5{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}et({context:e,bitmapSize:n,horizontalPixelRatio:r,verticalPixelRatio:s}){if(this.Yt===null)return;const a=Math.max(1,Math.floor(r));e.lineWidth=a,function(o,l){o.save(),o.lineWidth%2&&o.translate(.5,.5),l(),o.restore()}(e,()=>{const o=Jr(this.Yt);if(o.Sa){e.strokeStyle=o.xa,SA(e,o.Ca),e.beginPath();for(const l of o.ya){const c=Math.round(l.ka*r);e.moveTo(c,-a),e.lineTo(c,n.height+a)}e.stroke()}if(o.Pa){e.strokeStyle=o.Ta,SA(e,o.Ra),e.beginPath();for(const l of o.Da){const c=Math.round(l.ka*s);e.moveTo(-a,c),e.lineTo(n.width+a,c)}e.stroke()}})}}class Q3n{constructor(e){this.Gt=new X3n,this.xt=!0,this.yt=e}kt(){this.xt=!0}Tt(){if(this.xt){const e=this.yt.Qt().N().grid,n={Pa:e.horzLines.visible,Sa:e.vertLines.visible,Ta:e.horzLines.color,xa:e.vertLines.color,Ra:e.horzLines.style,Ca:e.vertLines.style,Da:this.yt.Ps().Va(),ya:(this.yt.Qt().At().Va()||[]).map(r=>({ka:r.coord}))};this.Gt.ht(n),this.xt=!1}return this.Gt}}class Z3n{constructor(e){this.sh=new Q3n(e)}lr(){return this.sh}}const pZ={Ia:4,Ba:1e-4};function m4(t,e){const n=100*(t-e)/e;return e<0?-n:n}function J3n(t,e){const n=m4(t.$e(),e),r=m4(t.qe(),e);return new wd(n,r)}function Q9(t,e){const n=100*(t-e)/e+100;return e<0?-n:n}function e5n(t,e){const n=Q9(t.$e(),e),r=Q9(t.qe(),e);return new wd(n,r)}function cB(t,e){const n=Math.abs(t);if(n<1e-15)return 0;const r=Math.log10(n+e.Ba)+e.Ia;return t<0?-r:r}function Z9(t,e){const n=Math.abs(t);if(n<1e-15)return 0;const r=Math.pow(10,n-e.Ia)-e.Ba;return t<0?-r:r}function R7(t,e){if(t===null)return null;const n=cB(t.$e(),e),r=cB(t.qe(),e);return new wd(n,r)}function h9(t,e){if(t===null)return null;const n=Z9(t.$e(),e),r=Z9(t.qe(),e);return new wd(n,r)}function mZ(t){if(t===null)return pZ;const e=Math.abs(t.qe()-t.$e());if(e>=1||e<1e-15)return pZ;const n=Math.ceil(Math.abs(Math.log10(e))),r=pZ.Ia+n;return{Ia:r,Ba:1/Math.pow(10,r)}}class xZ{constructor(e,n){if(this.Aa=e,this.Ea=n,function(r){if(r<0)return!1;for(let s=r;s>1;s/=10)if(s%10!=0)return!1;return!0}(this.Aa))this.za=[2,2.5,2];else{this.za=[];for(let r=this.Aa;r!==1;){if(r%2==0)this.za.push(2),r/=2;else{if(r%5!=0)throw new Error("unexpected base");this.za.push(2,2.5),r/=5}if(this.za.length>100)throw new Error("something wrong with base")}}}La(e,n,r){const s=this.Aa===0?0:1/this.Aa;let a=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-n)))),o=0,l=this.Ea[0];for(;;){const f=iO(a,s,1e-14)&&a>s+1e-14,x=iO(a,r*l,1e-14),g=iO(a,1,1e-14);if(!(f&&x&&g))break;a/=l,l=this.Ea[++o%this.Ea.length]}if(a<=s+1e-14&&(a=s),a=Math.max(1,a),this.za.length>0&&(c=a,u=1,d=1e-14,Math.abs(c-u)<d))for(o=0,l=this.za[0];iO(a,r*l,1e-14)&&a>s+1e-14;)a/=l,l=this.za[++o%this.za.length];var c,u,d;return a}}class yje{constructor(e,n,r,s){this.Oa=[],this.Yi=e,this.Aa=n,this.Na=r,this.Wa=s}La(e,n){if(e<n)throw new Error("high < low");const r=this.Yi.$t(),s=(e-n)*this.Fa()/r,a=new xZ(this.Aa,[2,2.5,2]),o=new xZ(this.Aa,[2,2,2.5]),l=new xZ(this.Aa,[2.5,2,2]),c=[];return c.push(a.La(e,n,s),o.La(e,n,s),l.La(e,n,s)),function(u){if(u.length<1)throw Error("array is empty");let d=u[0];for(let f=1;f<u.length;++f)u[f]<d&&(d=u[f]);return d}(c)}Ha(){const e=this.Yi,n=e.zt();if(n===null)return void(this.Oa=[]);const r=e.$t(),s=this.Na(r-1,n),a=this.Na(0,n),o=this.Yi.N().entireTextOnly?this.Ua()/2:0,l=o,c=r-1-o,u=Math.max(s,a),d=Math.min(s,a);if(u===d)return void(this.Oa=[]);const f=this.La(u,d);if(this.$a(n,f,u,d,l,c),e.qa()&&this.Ya(f,d,u)){const x=this.Yi.ja();this.Ka(n,f,l,c,x,2*x)}}Va(){return this.Oa}Ua(){return this.Yi.k()}Fa(){return Math.ceil(2.5*this.Ua())}$a(e,n,r,s,a,o){const l=this.Oa,c=this.Yi;let u=r%n;u+=u<0?n:0;const d=r>=s?1:-1;let f=null,x=0;for(let g=r-u;g>s;g-=n){const y=this.Wa(g,e,!0);f!==null&&Math.abs(y-f)<this.Fa()||y<a||y>o||(x<l.length?(l[x].ka=y,l[x].Xa=c.Za(g)):l.push({ka:y,Xa:c.Za(g)}),x++,f=y,c.Ga()&&(n=this.La(g*d,s)))}l.length=x}Ka(e,n,r,s,a,o){const l=this.Oa,c=this.Ja(e,r,a,o),u=this.Ja(e,s,-o,-a),d=this.Wa(0,e,!0)-this.Wa(n,e,!0);l.length>0&&l[0].ka-c.ka<d/2&&l.shift(),l.length>0&&u.ka-l[l.length-1].ka<d/2&&l.pop(),l.unshift(c),l.push(u)}Ja(e,n,r,s){const a=(r+s)/2,o=this.Na(n+r,e),l=this.Na(n+s,e),c=Math.min(o,l),u=Math.max(o,l),d=Math.max(.1,this.La(u,c)),f=this.Na(n+a,e),x=f-f%d,g=this.Wa(x,e,!0);return{Xa:this.Yi.Za(x),ka:g}}Ya(e,n,r){let s=Fy(this.Yi.Qe());return this.Yi.Ga()&&(s=h9(s,this.Yi.Qa())),s.$e()-n<e&&r-s.qe()<e}}function yKe(t){return t.slice().sort((e,n)=>Jr(e.hs())-Jr(n.hs()))}var vje;(function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"})(vje||(vje={}));const wje=new hKe,Cje=new Fz(100,1);class t5n{constructor(e,n,r,s,a){this.tl=0,this.il=null,this.Ge=null,this.sl=null,this.nl={el:!1,rl:null},this.hl=!1,this.al=0,this.ll=0,this.ol=new El,this._l=new El,this.ul=[],this.cl=null,this.dl=null,this.fl=null,this.pl=null,this.vl=null,this.ha=Cje,this.ml=mZ(null),this.wl=e,this.ys=n,this.gl=r,this.Ml=s,this.bl=a,this.Sl=new yje(this,100,this.xl.bind(this),this.Cl.bind(this))}wa(){return this.wl}N(){return this.ys}hr(e){if(nh(this.ys,e),this.ga(),e.mode!==void 0&&this.yl({ie:e.mode}),e.scaleMargins!==void 0){const n=yf(e.scaleMargins.top),r=yf(e.scaleMargins.bottom);if(n<0||n>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${n}`);if(r<0||r>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${r}`);if(n+r>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${n+r}`);this.kl(),this.fl=null}}Pl(){return this.ys.autoScale}Tl(){return this.hl}Ga(){return this.ys.mode===1}Le(){return this.ys.mode===2}Rl(){return this.ys.mode===3}Qa(){return this.ml}ie(){return{sn:this.ys.autoScale,Dl:this.ys.invertScale,ie:this.ys.mode}}yl(e){const n=this.ie();let r=null;e.sn!==void 0&&(this.ys.autoScale=e.sn),e.ie!==void 0&&(this.ys.mode=e.ie,e.ie!==2&&e.ie!==3||(this.ys.autoScale=!0),this.nl.el=!1),n.ie===1&&e.ie!==n.ie&&(function(a,o){if(a===null)return!1;const l=Z9(a.$e(),o),c=Z9(a.qe(),o);return isFinite(l)&&isFinite(c)}(this.Ge,this.ml)?(r=h9(this.Ge,this.ml),r!==null&&this.Vl(r)):this.ys.autoScale=!0),e.ie===1&&e.ie!==n.ie&&(r=R7(this.Ge,this.ml),r!==null&&this.Vl(r));const s=n.ie!==this.ys.mode;s&&(n.ie===2||this.Le())&&this.ga(),s&&(n.ie===3||this.Rl())&&this.ga(),e.Dl!==void 0&&n.Dl!==e.Dl&&(this.ys.invertScale=e.Dl,this.Il()),this._l.p(n,this.ie())}Bl(){return this._l}k(){return this.gl.fontSize}$t(){return this.tl}Al(e){this.tl!==e&&(this.tl=e,this.kl(),this.fl=null)}El(){if(this.il)return this.il;const e=this.$t()-this.zl()-this.Ll();return this.il=e,e}Qe(){return this.Ol(),this.Ge}Vl(e,n){const r=this.Ge;(n||r===null&&e!==null||r!==null&&!r.He(e))&&(this.fl=null,this.Ge=e)}Nl(e){this.Vl(e),this.Wl(e!==null)}Ki(){return this.Ol(),this.tl===0||!this.Ge||this.Ge.Ki()}Fl(e){return this.Dl()?e:this.$t()-1-e}Nt(e,n){return this.Le()?e=m4(e,n):this.Rl()&&(e=Q9(e,n)),this.Cl(e,n)}Hl(e,n,r){this.Ol();const s=this.Ll(),a=Jr(this.Qe()),o=a.$e(),l=a.qe(),c=this.El()-1,u=this.Dl(),d=c/(l-o),f=r===void 0?0:r.from,x=r===void 0?e.length:r.to,g=this.Ul();for(let y=f;y<x;y++){const v=e[y],C=v.gt;if(isNaN(C))continue;let N=C;g!==null&&(N=g(v.gt,n));const P=s+d*(N-o),T=u?P:this.tl-1-P;v.ut=T}}$l(e,n,r){this.Ol();const s=this.Ll(),a=Jr(this.Qe()),o=a.$e(),l=a.qe(),c=this.El()-1,u=this.Dl(),d=c/(l-o),f=r===void 0?0:r.from,x=r===void 0?e.length:r.to,g=this.Ul();for(let y=f;y<x;y++){const v=e[y];let C=v.qh,N=v.Yh,P=v.jh,T=v.Kh;g!==null&&(C=g(v.qh,n),N=g(v.Yh,n),P=g(v.jh,n),T=g(v.Kh,n));let M=s+d*(C-o),F=u?M:this.tl-1-M;v.ql=F,M=s+d*(N-o),F=u?M:this.tl-1-M,v.Yl=F,M=s+d*(P-o),F=u?M:this.tl-1-M,v.jl=F,M=s+d*(T-o),F=u?M:this.tl-1-M,v.Kl=F}}Ts(e,n){const r=this.xl(e,n);return this.Xl(r,n)}Xl(e,n){let r=e;return this.Le()?r=function(s,a){return a<0&&(s=-s),s/100*a+a}(r,n):this.Rl()&&(r=function(s,a){return s-=100,a<0&&(s=-s),s/100*a+a}(r,n)),r}ba(){return this.ul}Dt(){return this.dl||(this.dl=yKe(this.ul)),this.dl}Zl(e){this.ul.indexOf(e)===-1&&(this.ul.push(e),this.ga(),this.Gl())}Jl(e){const n=this.ul.indexOf(e);if(n===-1)throw new Error("source is not attached to scale");this.ul.splice(n,1),this.ul.length===0&&(this.yl({sn:!0}),this.Vl(null)),this.ga(),this.Gl()}zt(){let e=null;for(const n of this.ul){const r=n.zt();r!==null&&(e===null||r.Hh<e.Hh)&&(e=r)}return e===null?null:e.Ft}Dl(){return this.ys.invertScale}Va(){const e=this.zt()===null;if(this.fl!==null&&(e||this.fl.Ql===e))return this.fl.Va;this.Sl.Ha();const n=this.Sl.Va();return this.fl={Va:n,Ql:e},this.ol.p(),n}io(){return this.ol}so(e){this.Le()||this.Rl()||this.pl===null&&this.sl===null&&(this.Ki()||(this.pl=this.tl-e,this.sl=Jr(this.Qe()).Ue()))}no(e){if(this.Le()||this.Rl()||this.pl===null)return;this.yl({sn:!1}),(e=this.tl-e)<0&&(e=0);let n=(this.pl+.2*(this.tl-1))/(e+.2*(this.tl-1));const r=Jr(this.sl).Ue();n=Math.max(n,.1),r.je(n),this.Vl(r)}eo(){this.Le()||this.Rl()||(this.pl=null,this.sl=null)}ro(e){this.Pl()||this.vl===null&&this.sl===null&&(this.Ki()||(this.vl=e,this.sl=Jr(this.Qe()).Ue()))}ho(e){if(this.Pl()||this.vl===null)return;const n=Jr(this.Qe()).Ye()/(this.El()-1);let r=e-this.vl;this.Dl()&&(r*=-1);const s=r*n,a=Jr(this.sl).Ue();a.Ke(s),this.Vl(a,!0),this.fl=null}ao(){this.Pl()||this.vl!==null&&(this.vl=null,this.sl=null)}ra(){return this.ha||this.ga(),this.ha}Zi(e,n){switch(this.ys.mode){case 2:return this.lo(m4(e,n));case 3:return this.ra().format(Q9(e,n));default:return this.nr(e)}}Za(e){switch(this.ys.mode){case 2:return this.lo(e);case 3:return this.ra().format(e);default:return this.nr(e)}}Dh(e){return this.nr(e,Jr(this.cl).ra())}Vh(e,n){return e=m4(e,n),this.lo(e,wje)}oo(){return this.ul}_o(e){this.nl={rl:e,el:!1}}Ns(){this.ul.forEach(e=>e.Ns())}qa(){return this.ys.ensureEdgeTickMarksVisible&&this.Pl()}ja(){return this.k()/2}ga(){this.fl=null;let e=1/0;this.cl=null;for(const r of this.ul)r.hs()<e&&(e=r.hs(),this.cl=r);let n=100;this.cl!==null&&(n=Math.round(1/this.cl.ea())),this.ha=Cje,this.Le()?(this.ha=wje,n=100):this.Rl()?(this.ha=new Fz(100,1),n=100):this.cl!==null&&(this.ha=this.cl.ra()),this.Sl=new yje(this,n,this.xl.bind(this),this.Cl.bind(this)),this.Sl.Ha()}Gl(){this.dl=null}Xi(){return this.bl}Wl(e){this.hl=e}zl(){return this.Dl()?this.ys.scaleMargins.bottom*this.$t()+this.ll:this.ys.scaleMargins.top*this.$t()+this.al}Ll(){return this.Dl()?this.ys.scaleMargins.top*this.$t()+this.al:this.ys.scaleMargins.bottom*this.$t()+this.ll}Ol(){this.nl.el||(this.nl.el=!0,this.uo())}kl(){this.il=null}Cl(e,n){if(this.Ol(),this.Ki())return 0;e=this.Ga()&&e?cB(e,this.ml):e;const r=Jr(this.Qe()),s=this.Ll()+(this.El()-1)*(e-r.$e())/r.Ye();return this.Fl(s)}xl(e,n){if(this.Ol(),this.Ki())return 0;const r=this.Fl(e),s=Jr(this.Qe()),a=s.$e()+s.Ye()*((r-this.Ll())/(this.El()-1));return this.Ga()?Z9(a,this.ml):a}Il(){this.fl=null,this.Sl.Ha()}uo(){if(this.Tl()&&!this.Pl())return;const e=this.nl.rl;if(e===null)return;let n=null;const r=this.oo();let s=0,a=0;for(const c of r){if(!c.Vt())continue;const u=c.zt();if(u===null)continue;const d=c.Mh(e.Uh(),e.bi());let f=d&&d.Qe();if(f!==null){switch(this.ys.mode){case 1:f=R7(f,this.ml);break;case 2:f=J3n(f,u.Ft);break;case 3:f=e5n(f,u.Ft)}if(n=n===null?f:n.vn(Jr(f)),d!==null){const x=d.tr();x!==null&&(s=Math.max(s,x.above),a=Math.max(a,x.below))}}}if(this.qa()&&(s=Math.max(s,this.ja()),a=Math.max(a,this.ja())),s===this.al&&a===this.ll||(this.al=s,this.ll=a,this.fl=null,this.kl()),n!==null){if(n.$e()===n.qe()){const c=this.cl,u=5*(c===null||this.Le()||this.Rl()?1:c.ea());this.Ga()&&(n=h9(n,this.ml)),n=new wd(n.$e()-u,n.qe()+u),this.Ga()&&(n=R7(n,this.ml))}if(this.Ga()){const c=h9(n,this.ml),u=mZ(c);if(o=u,l=this.ml,o.Ia!==l.Ia||o.Ba!==l.Ba){const d=this.sl!==null?h9(this.sl,this.ml):null;this.ml=u,n=R7(c,u),d!==null&&(this.sl=R7(d,u))}}this.Vl(n)}else this.Ge===null&&(this.Vl(new wd(-.5,.5)),this.ml=mZ(null));var o,l}Ul(){return this.Le()?m4:this.Rl()?Q9:this.Ga()?e=>cB(e,this.ml):null}co(e,n,r){return n===void 0?(r===void 0&&(r=this.ra()),r.format(e)):n(e)}nr(e,n){return this.co(e,this.Ml.priceFormatter,n)}lo(e,n){return this.co(e,this.Ml.percentageFormatter,n)}}function Sje(t){return t instanceof Oz}class Nje{constructor(e,n){this.ul=[],this.do=new Map,this.tl=0,this.fo=0,this.po=1e3,this.dl=null,this.vo=new El,this.kh=[],this.uh=e,this.ts=n,this.mo=new Z3n(this);const r=n.N();this.wo=this.Mo("left",r.leftPriceScale),this.bo=this.Mo("right",r.rightPriceScale),this.wo.Bl().i(this.So.bind(this,this.wo),this),this.bo.Bl().i(this.So.bind(this,this.bo),this),this.xo(r)}xo(e){if(e.leftPriceScale&&this.wo.hr(e.leftPriceScale),e.rightPriceScale&&this.bo.hr(e.rightPriceScale),e.localization&&(this.wo.ga(),this.bo.ga()),e.overlayPriceScales){const n=Array.from(this.do.values());for(const r of n){const s=Jr(r[0].Wt());s.hr(e.overlayPriceScales),e.localization&&s.ga()}}}Co(e){switch(e){case"left":return this.wo;case"right":return this.bo}return this.do.has(e)?yf(this.do.get(e))[0].Wt():null}m(){this.Qt().yo().u(this),this.wo.Bl().u(this),this.bo.Bl().u(this),this.ul.forEach(e=>{e.m&&e.m()}),this.kh=this.kh.filter(e=>{const n=e.oh();return n.detached&&n.detached(),!1}),this.vo.p()}ko(){return this.po}Po(e){this.po=e}Qt(){return this.ts}Qi(){return this.fo}$t(){return this.tl}To(e){this.fo=e,this.Ro()}Al(e){this.tl=e,this.wo.Al(e),this.bo.Al(e),this.ul.forEach(n=>{if(this.Un(n)){const r=n.Wt();r!==null&&r.Al(e)}}),this.Ro()}Do(){return this.ul.filter(Sje)}ba(){return this.ul}Un(e){const n=e.Wt();return n===null||this.wo!==n&&this.bo!==n}Zl(e,n,r){this.Vo(e,n,r?e.hs():this.ul.length)}Jl(e,n){const r=this.ul.indexOf(e);Fu(r!==-1,"removeDataSource: invalid data source"),this.ul.splice(r,1),n||this.ul.forEach((o,l)=>o.ls(l));const s=Jr(e.Wt()).wa();if(this.do.has(s)){const o=yf(this.do.get(s)),l=o.indexOf(e);l!==-1&&(o.splice(l,1),o.length===0&&this.do.delete(s))}const a=e.Wt();a&&a.ba().indexOf(e)>=0&&(a.Jl(e),this.Io(a)),this.dl=null}qn(e){return e===this.wo?"left":e===this.bo?"right":"overlay"}Bo(){return this.wo}Ao(){return this.bo}Eo(e,n){e.so(n)}zo(e,n){e.no(n),this.Ro()}Lo(e){e.eo()}Oo(e,n){e.ro(n)}No(e,n){e.ho(n),this.Ro()}Wo(e){e.ao()}Ro(){this.ul.forEach(e=>{e.Ns()})}Ps(){let e=null;return this.ts.N().rightPriceScale.visible&&this.bo.ba().length!==0?e=this.bo:this.ts.N().leftPriceScale.visible&&this.wo.ba().length!==0?e=this.wo:this.ul.length!==0&&(e=this.ul[0].Wt()),e===null&&(e=this.bo),e}$n(){let e=null;return this.ts.N().rightPriceScale.visible?e=this.bo:this.ts.N().leftPriceScale.visible&&(e=this.wo),e}Io(e){e!==null&&e.Pl()&&this.Fo(e)}Ho(e){const n=this.uh.ye();e.yl({sn:!0}),n!==null&&e._o(n),this.Ro()}Uo(){this.Fo(this.wo),this.Fo(this.bo)}$o(){this.Io(this.wo),this.Io(this.bo),this.ul.forEach(e=>{this.Un(e)&&this.Io(e.Wt())}),this.Ro(),this.ts.ar()}Dt(){return this.dl===null&&(this.dl=yKe(this.ul)),this.dl}qo(e,n){n=X9(n,0,this.ul.length-1);const r=this.ul.indexOf(e);Fu(r!==-1,"setSeriesOrder: invalid data source"),this.ul.splice(r,1),this.ul.splice(n,0,e),this.ul.forEach((s,a)=>s.ls(a)),this.dl=null;for(const s of[this.wo,this.bo])s.Gl(),s.ga();this.ts.ar()}It(){return this.Dt().filter(Sje)}Yo(){return this.vo}jo(){return this.mo}ua(e){this.kh.push(new B3n(e))}ca(e){this.kh=this.kh.filter(n=>n.oh()!==e),e.detached&&e.detached(),this.ts.ar()}Ko(){return this.kh}sa(e,n){return this.kh.map(r=>r.jn(e,n)).filter(r=>r!==null)}Fo(e){const n=e.oo();if(n&&n.length>0&&!this.uh.Ki()){const r=this.uh.ye();r!==null&&e._o(r)}e.Ns()}Vo(e,n,r){let s=this.Co(n);if(s===null&&(s=this.Mo(n,this.ts.N().overlayPriceScales)),this.ul.splice(r,0,e),!Iz(n)){const a=this.do.get(n)||[];a.push(e),this.do.set(n,a)}e.ls(r),s.Zl(e),e._s(s),this.Io(s),this.dl=null}So(e,n,r){n.ie!==r.ie&&this.Fo(e)}Mo(e,n){const r={visible:!0,autoScale:!0,...Xg(n)},s=new t5n(e,r,this.ts.N().layout,this.ts.N().localization,this.ts.Xi());return s.Al(this.$t()),s}}function aO(t){return{Xo:t.Xo,Zo:{Kn:t.Go.externalId},Jo:t.Go.cursorStyle}}function n5n(t,e,n,r){for(const s of t){const a=s.Tt(r);if(a!==null&&a.jn){const o=a.jn(e,n);if(o!==null)return{Qo:s,Zo:o}}}return null}function r5n(t){return t.Ws!==void 0}function vKe(t,e,n){const r=[t,...t.Dt()],s=function(a,o,l){var x;let c,u;for(const g of a){const y=((x=g.sa)==null?void 0:x.call(g,o,l))??[];for(const v of y)d=v.zOrder,f=c==null?void 0:c.zOrder,(!f||d==="top"&&f!=="top"||d==="normal"&&f==="bottom")&&(c=v,u=g)}var d,f;return c&&u?{Go:c,Xo:u}:null}(r,e,n);if((s==null?void 0:s.Go.zOrder)==="top")return aO(s);for(const a of r){if(s&&s.Xo===a&&s.Go.zOrder!=="bottom"&&!s.Go.isBackground)return aO(s);if(r5n(a)){const o=n5n(a.Ws(t),e,n,t);if(o!==null)return{Xo:a,Qo:o.Qo,Zo:o.Zo}}if(s&&s.Xo===a&&s.Go.zOrder!=="bottom"&&s.Go.isBackground)return aO(s)}return s!=null&&s.Go?aO(s):null}class s5n{constructor(e,n,r=50){this.kn=0,this.Pn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.t_=e,this.i_=n,this.Vn=r}s_(e){const n=e.time,r=this.i_.cacheKey(n),s=this.Dn.get(r);if(s!==void 0)return s.n_;if(this.kn===this.Vn){const o=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(yf(o)),this.Tn++,this.kn--}const a=this.t_(e);return this.Dn.set(r,{n_:a,En:this.Pn}),this.Rn.set(this.Pn,r),this.kn++,this.Pn++,a}}class J9{constructor(e,n){Fu(e<=n,"right should be >= left"),this.e_=e,this.r_=n}Uh(){return this.e_}bi(){return this.r_}h_(){return this.r_-this.e_+1}Te(e){return this.e_<=e&&e<=this.r_}He(e){return this.e_===e.Uh()&&this.r_===e.bi()}}function Aje(t,e){return t===null||e===null?t===e:t.He(e)}class i5n{constructor(){this.a_=new Map,this.Dn=null,this.l_=!1}o_(e){this.l_=e,this.Dn=null}__(e,n){this.u_(n),this.Dn=null;for(let r=n;r<e.length;++r){const s=e[r];let a=this.a_.get(s.timeWeight);a===void 0&&(a=[],this.a_.set(s.timeWeight,a)),a.push({index:r,time:s.time,weight:s.timeWeight,originalTime:s.originalTime})}}c_(e,n,r,s,a){const o=Math.ceil(n/e);return this.Dn!==null&&this.Dn.d_===o&&a===this.Dn.f_&&r===this.Dn.p_||(this.Dn={f_:a,p_:r,Va:this.v_(o,r,s),d_:o}),this.Dn.Va}u_(e){if(e===0)return void this.a_.clear();const n=[];this.a_.forEach((r,s)=>{e<=r[0].index?n.push(s):r.splice(AA(r,e,a=>a.index<e),1/0)});for(const r of n)this.a_.delete(r)}v_(e,n,r){let s=[];const a=o=>!n||r.has(o.index);for(const o of Array.from(this.a_.keys()).sort((l,c)=>c-l)){if(!this.a_.get(o))continue;const l=s;s=[];const c=l.length;let u=0;const d=yf(this.a_.get(o)),f=d.length;let x=1/0,g=-1/0;for(let y=0;y<f;y++){const v=d[y],C=v.index;for(;u<c;){const N=l[u],P=N.index;if(!(P<C&&a(N))){x=P;break}u++,s.push(N),g=P,x=1/0}if(x-C>=e&&C-g>=e&&a(v))s.push(v),g=C;else if(this.l_)return l}for(;u<c;u++)a(l[u])&&s.push(l[u])}return s}}class H4{constructor(e){this.m_=e}w_(){return this.m_===null?null:new J9(Math.floor(this.m_.Uh()),Math.ceil(this.m_.bi()))}g_(){return this.m_}static M_(){return new H4(null)}}function a5n(t,e){return t.weight>e.weight?t:e}class o5n{constructor(e,n,r,s){this.fo=0,this.b_=null,this.S_=[],this.vl=null,this.pl=null,this.x_=new i5n,this.C_=new Map,this.y_=H4.M_(),this.k_=!0,this.P_=new El,this.T_=new El,this.R_=new El,this.D_=null,this.V_=null,this.I_=new Map,this.B_=-1,this.A_=[],this.ys=n,this.Ml=r,this.E_=n.rightOffset,this.z_=n.barSpacing,this.ts=e,this.i_=s,this.L_(),this.x_.o_(n.uniformDistribution),this.O_()}N(){return this.ys}N_(e){nh(this.Ml,e),this.W_(),this.L_()}hr(e,n){nh(this.ys,e),this.ys.fixLeftEdge&&this.F_(),this.ys.fixRightEdge&&this.H_(),e.barSpacing!==void 0&&this.ts.dn(e.barSpacing),e.rightOffset!==void 0&&this.ts.fn(e.rightOffset),e.minBarSpacing===void 0&&e.maxBarSpacing===void 0||this.ts.dn(e.barSpacing??this.z_),e.ignoreWhitespaceIndices!==void 0&&e.ignoreWhitespaceIndices!==this.ys.ignoreWhitespaceIndices&&this.O_(),this.W_(),this.L_(),this.R_.p()}Rs(e){var n;return((n=this.S_[e])==null?void 0:n.time)??null}ss(e){return this.S_[e]??null}U_(e,n){if(this.S_.length<1)return null;if(this.i_.key(e)>this.i_.key(this.S_[this.S_.length-1].time))return n?this.S_.length-1:null;const r=AA(this.S_,this.i_.key(e),(s,a)=>this.i_.key(s.time)<a);return this.i_.key(e)<this.i_.key(this.S_[r].time)?n?r:null:r}Ki(){return this.fo===0||this.S_.length===0||this.b_===null}q_(){return this.S_.length>0}ye(){return this.Y_(),this.y_.w_()}j_(){return this.Y_(),this.y_.g_()}K_(){const e=this.ye();if(e===null)return null;const n={from:e.Uh(),to:e.bi()};return this.X_(n)}X_(e){const n=Math.round(e.from),r=Math.round(e.to),s=Jr(this.Z_()),a=Jr(this.G_());return{from:Jr(this.ss(Math.max(s,n))),to:Jr(this.ss(Math.min(a,r)))}}J_(e){return{from:Jr(this.U_(e.from,!0)),to:Jr(this.U_(e.to,!0))}}Qi(){return this.fo}To(e){if(!isFinite(e)||e<=0||this.fo===e)return;const n=this.j_(),r=this.fo;if(this.fo=e,this.k_=!0,this.ys.lockVisibleTimeRangeOnResize&&r!==0){const s=this.z_*e/r;this.z_=s}if(this.ys.fixLeftEdge&&n!==null&&n.Uh()<=0){const s=r-e;this.E_-=Math.round(s/this.z_)+1,this.k_=!0}this.Q_(),this.tu()}qt(e){if(this.Ki()||!Pk(e))return 0;const n=this.iu()+this.E_-e;return this.fo-(n+.5)*this.z_-1}su(e,n){const r=this.iu(),s=n===void 0?0:n.from,a=n===void 0?e.length:n.to;for(let o=s;o<a;o++){const l=e[o].wt,c=r+this.E_-l,u=this.fo-(c+.5)*this.z_-1;e[o]._t=u}}nu(e,n){const r=Math.ceil(this.eu(e));return n&&this.ys.ignoreWhitespaceIndices&&!this.ru(r)?this.hu(r):r}fn(e){this.k_=!0,this.E_=e,this.tu(),this.ts.au(),this.ts.ar()}lu(){return this.z_}dn(e){this.ou(e),this.tu(),this.ts.au(),this.ts.ar()}_u(){return this.E_}Va(){if(this.Ki())return null;if(this.V_!==null)return this.V_;const e=this.z_,n=5*(this.ts.N().layout.fontSize+4)/8*(this.ys.tickMarkMaxCharacterLength||8),r=Math.round(n/e),s=Jr(this.ye()),a=Math.max(s.Uh(),s.Uh()-r),o=Math.max(s.bi(),s.bi()-r),l=this.x_.c_(e,n,this.ys.ignoreWhitespaceIndices,this.I_,this.B_),c=this.Z_()+r,u=this.G_()-r,d=this.uu(),f=this.ys.fixLeftEdge||d,x=this.ys.fixRightEdge||d;let g=0;for(const y of l){if(!(a<=y.index&&y.index<=o))continue;let v;g<this.A_.length?(v=this.A_[g],v.coord=this.qt(y.index),v.label=this.cu(y),v.weight=y.weight):(v={needAlignCoordinate:!1,coord:this.qt(y.index),label:this.cu(y),weight:y.weight},this.A_.push(v)),this.z_>n/2&&!d?v.needAlignCoordinate=!1:v.needAlignCoordinate=f&&y.index<=c||x&&y.index>=u,g++}return this.A_.length=g,this.V_=this.A_,this.A_}du(){this.k_=!0,this.dn(this.ys.barSpacing),this.fn(this.ys.rightOffset)}fu(e){this.k_=!0,this.b_=e,this.tu(),this.F_()}pu(e,n){const r=this.eu(e),s=this.lu(),a=s+n*(s/10);this.dn(a),this.ys.rightBarStaysOnScroll||this.fn(this._u()+(r-this.eu(e)))}so(e){this.vl&&this.ao(),this.pl===null&&this.D_===null&&(this.Ki()||(this.pl=e,this.vu()))}no(e){if(this.D_===null)return;const n=X9(this.fo-e,0,this.fo),r=X9(this.fo-Jr(this.pl),0,this.fo);n!==0&&r!==0&&this.dn(this.D_.lu*n/r)}eo(){this.pl!==null&&(this.pl=null,this.mu())}ro(e){this.vl===null&&this.D_===null&&(this.Ki()||(this.vl=e,this.vu()))}ho(e){if(this.vl===null)return;const n=(this.vl-e)/this.lu();this.E_=Jr(this.D_)._u+n,this.k_=!0,this.tu()}ao(){this.vl!==null&&(this.vl=null,this.mu())}wu(){this.gu(this.ys.rightOffset)}gu(e,n=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(n)||n<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const r=this.E_,s=performance.now();this.ts._n({Mu:a=>(a-s)/n>=1,bu:a=>{const o=(a-s)/n;return o>=1?e:r+(e-r)*o}})}kt(e,n){this.k_=!0,this.S_=e,this.x_.__(e,n),this.tu()}Su(){return this.P_}xu(){return this.T_}Cu(){return this.R_}iu(){return this.b_||0}yu(e){const n=e.h_();this.ou(this.fo/n),this.E_=e.bi()-this.iu(),this.tu(),this.k_=!0,this.ts.au(),this.ts.ar()}ku(){const e=this.Z_(),n=this.G_();e!==null&&n!==null&&this.yu(new J9(e,n+this.ys.rightOffset))}Pu(e){const n=new J9(e.from,e.to);this.yu(n)}ns(e){return this.Ml.timeFormatter!==void 0?this.Ml.timeFormatter(e.originalTime):this.i_.formatHorzItem(e.time)}O_(){if(!this.ys.ignoreWhitespaceIndices)return;this.I_.clear();const e=this.ts.js();for(const n of e)for(const r of n.ma())this.I_.set(r,!0);this.B_++}uu(){const e=this.ts.N().handleScroll,n=this.ts.N().handleScale;return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||n.axisDoubleClickReset.time||n.axisPressedMouseMove.time||n.mouseWheel||n.pinch)}Z_(){return this.S_.length===0?null:0}G_(){return this.S_.length===0?null:this.S_.length-1}Tu(e){return(this.fo-1-e)/this.z_}eu(e){const n=this.Tu(e),r=this.iu()+this.E_-n;return Math.round(1e6*r)/1e6}ou(e){const n=this.z_;this.z_=e,this.Q_(),n!==this.z_&&(this.k_=!0,this.Ru())}Y_(){if(!this.k_)return;if(this.k_=!1,this.Ki())return void this.Du(H4.M_());const e=this.iu(),n=this.fo/this.z_,r=this.E_+e,s=new J9(r-n+1,r);this.Du(new H4(s))}Q_(){const e=X9(this.z_,this.Vu(),this.Iu());this.z_!==e&&(this.z_=e,this.k_=!0)}Iu(){return this.ys.maxBarSpacing>0?this.ys.maxBarSpacing:.5*this.fo}Vu(){return this.ys.fixLeftEdge&&this.ys.fixRightEdge&&this.S_.length!==0?this.fo/this.S_.length:this.ys.minBarSpacing}tu(){const e=this.Bu();e!==null&&this.E_<e&&(this.E_=e,this.k_=!0);const n=this.Au();this.E_>n&&(this.E_=n,this.k_=!0)}Bu(){const e=this.Z_(),n=this.b_;return e===null||n===null?null:e-n-1+(this.ys.fixLeftEdge?this.fo/this.z_:Math.min(2,this.S_.length))}Au(){return this.ys.fixRightEdge?0:this.fo/this.z_-Math.min(2,this.S_.length)}vu(){this.D_={lu:this.lu(),_u:this._u()}}mu(){this.D_=null}cu(e){let n=this.C_.get(e.weight);return n===void 0&&(n=new s5n(r=>this.Eu(r),this.i_),this.C_.set(e.weight,n)),n.s_(e)}Eu(e){return this.i_.formatTickmark(e,this.Ml)}Du(e){const n=this.y_;this.y_=e,Aje(n.w_(),this.y_.w_())||this.P_.p(),Aje(n.g_(),this.y_.g_())||this.T_.p(),this.Ru()}Ru(){this.V_=null}W_(){this.Ru(),this.C_.clear()}L_(){this.i_.updateFormatter(this.Ml)}F_(){if(!this.ys.fixLeftEdge)return;const e=this.Z_();if(e===null)return;const n=this.ye();if(n===null)return;const r=n.Uh()-e;if(r<0){const s=this.E_-r-1;this.fn(s)}this.Q_()}H_(){this.tu(),this.Q_()}ru(e){return!this.ys.ignoreWhitespaceIndices||this.I_.get(e)||!1}hu(e){const n=function*(s){const a=Math.round(s),o=a<s;let l=1;for(;;)o?(yield a+l,yield a-l):(yield a-l,yield a+l),l++}(e),r=this.G_();for(;r;){const s=n.next().value;if(this.I_.get(s))return s;if(s<0||s>r)break}return e}}var jje,Eje,_je,kje,Tje;(function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"})(jje||(jje={}));class l5n{constructor(e,n,r){this.zu=[],this.Lu=[],this.fo=0,this.Ou=null,this.Nu=new El,this.Wu=new El,this.Fu=null,this.Hu=e,this.ys=n,this.i_=r,this.bl=new l3n(this.ys.layout.colorParsers),this.Uu=new o3n(this),this.uh=new o5n(this,n.timeScale,this.ys.localization,r),this.Ct=new y3n(this,n.crosshair),this.$u=new Y3n(n.crosshair),this.qu(0),this.zu[0].Po(2e3),this.Yu=this.ju(0),this.Ku=this.ju(1)}Bh(){this.Xu(Qc.gn())}ar(){this.Xu(Qc.wn())}Zh(){this.Xu(new Qc(1))}Ah(e){const n=this.Zu(e);this.Xu(n)}Gu(){return this.Ou}Ju(e){var r,s,a,o;if(((r=this.Ou)==null?void 0:r.Xo)===(e==null?void 0:e.Xo)&&((a=(s=this.Ou)==null?void 0:s.Zo)==null?void 0:a.Kn)===((o=e==null?void 0:e.Zo)==null?void 0:o.Kn))return;const n=this.Ou;this.Ou=e,n!==null&&this.Ah(n.Xo),e!==null&&e.Xo!==(n==null?void 0:n.Xo)&&this.Ah(e.Xo)}N(){return this.ys}hr(e){nh(this.ys,e),this.zu.forEach(n=>n.xo(e)),e.timeScale!==void 0&&this.uh.hr(e.timeScale),e.localization!==void 0&&this.uh.N_(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Nu.p(),this.Yu=this.ju(0),this.Ku=this.ju(1),this.Bh()}Qu(e,n,r=0){const s=this.zu[r];if(s===void 0)return;if(e==="left")return nh(this.ys,{leftPriceScale:n}),s.xo({leftPriceScale:n}),this.Nu.p(),void this.Bh();if(e==="right")return nh(this.ys,{rightPriceScale:n}),s.xo({rightPriceScale:n}),this.Nu.p(),void this.Bh();const a=this.tc(e,r);a!==null&&(a.Wt.hr(n),this.Nu.p())}tc(e,n){const r=this.zu[n];if(r===void 0)return null;const s=r.Co(e);return s!==null?{Us:r,Wt:s}:null}At(){return this.uh}$s(){return this.zu}sc(){return this.Ct}nc(){return this.Wu}ec(e,n){e.Al(n),this.au()}To(e){this.fo=e,this.uh.To(this.fo),this.zu.forEach(n=>n.To(e)),this.au()}rc(e){this.zu.length!==1&&(Fu(e>=0&&e<this.zu.length,"Invalid pane index"),this.zu.splice(e,1),this.Bh())}hc(e,n){if(this.zu.length<2)return;Fu(e>=0&&e<this.zu.length,"Invalid pane index");const r=this.zu[e],s=this.zu.reduce((f,x)=>f+x.ko(),0),a=this.zu.reduce((f,x)=>f+x.$t(),0),o=a-30*(this.zu.length-1);n=Math.min(o,Math.max(30,n));const l=s/a,c=r.$t();r.Po(n*l);let u=n-c,d=this.zu.length-1;for(const f of this.zu)if(f!==r){const x=Math.min(o,Math.max(30,f.$t()-u/d));u-=f.$t()-x,d-=1;const g=x*l;f.Po(g)}this.Bh()}ac(e,n){Fu(e>=0&&e<this.zu.length&&n>=0&&n<this.zu.length,"Invalid pane index");const r=this.zu[e],s=this.zu[n];this.zu[e]=s,this.zu[n]=r,this.Bh()}Eo(e,n,r){e.Eo(n,r)}zo(e,n,r){e.zo(n,r),this.Eh(),this.Xu(this.lc(e,2))}Lo(e,n){e.Lo(n),this.Xu(this.lc(e,2))}Oo(e,n,r){n.Pl()||e.Oo(n,r)}No(e,n,r){n.Pl()||(e.No(n,r),this.Eh(),this.Xu(this.lc(e,2)))}Wo(e,n){n.Pl()||(e.Wo(n),this.Xu(this.lc(e,2)))}Ho(e,n){e.Ho(n),this.Xu(this.lc(e,2))}oc(e){this.uh.so(e)}_c(e,n){const r=this.At();if(r.Ki()||n===0)return;const s=r.Qi();e=Math.max(1,Math.min(e,s)),r.pu(e,n),this.au()}uc(e){this.cc(0),this.dc(e),this.fc()}vc(e){this.uh.no(e),this.au()}mc(){this.uh.eo(),this.ar()}cc(e){this.uh.ro(e)}dc(e){this.uh.ho(e),this.au()}fc(){this.uh.ao(),this.ar()}js(){return this.Lu}wc(e,n,r,s,a){this.Ct.Vs(e,n);let o=NaN,l=this.uh.nu(e,!0);const c=this.uh.ye();c!==null&&(l=Math.min(Math.max(c.Uh(),l),c.bi()));const u=s.Ps(),d=u.zt();if(d!==null&&(o=u.Ts(n,d)),o=this.$u.Ma(o,l,s),this.Ct.Es(l,o,s),this.Zh(),!a){const f=vKe(s,e,n);this.Ju(f&&{Xo:f.Xo,Zo:f.Zo,Jo:f.Jo||null}),this.Wu.p(this.Ct.Bt(),{x:e,y:n},r)}}gc(e,n,r){const s=r.Ps(),a=s.zt(),o=s.Nt(e,Jr(a)),l=this.uh.U_(n,!0),c=this.uh.qt(Jr(l));this.wc(c,o,null,r,!0)}Mc(e){this.sc().Ls(),this.Zh(),e||this.Wu.p(null,null,null)}Eh(){const e=this.Ct.Us();if(e!==null){const n=this.Ct.Bs(),r=this.Ct.As();this.wc(n,r,null,e)}this.Ct.Ns()}bc(e,n,r){const s=this.uh.Rs(0);n!==void 0&&r!==void 0&&this.uh.kt(n,r);const a=this.uh.Rs(0),o=this.uh.iu(),l=this.uh.ye();if(l!==null&&s!==null&&a!==null){const c=l.Te(o),u=this.i_.key(s)>this.i_.key(a),d=e!==null&&e>o&&!u,f=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,x=c&&(r!==void 0||f)&&this.uh.N().shiftVisibleRangeOnNewBar;if(d&&!x){const g=e-o;this.uh.fn(this.uh._u()-g)}}this.uh.fu(e)}Lh(e){e!==null&&e.$o()}Hn(e){if(function(r){return r instanceof Nje}(e))return e;const n=this.zu.find(r=>r.Dt().includes(e));return n===void 0?null:n}au(){this.zu.forEach(e=>e.$o()),this.Eh()}m(){this.zu.forEach(e=>e.m()),this.zu.length=0,this.ys.localization.priceFormatter=void 0,this.ys.localization.percentageFormatter=void 0,this.ys.localization.timeFormatter=void 0}Sc(){return this.Uu}Yn(){return this.Uu.N()}yo(){return this.Nu}xc(e,n){const r=this.qu(n);this.Cc(e,r),this.Lu.push(e),this.Lu.length===1?this.Bh():this.ar()}yc(e){const n=this.Hn(e),r=this.Lu.indexOf(e);Fu(r!==-1,"Series not found");const s=Jr(n);this.Lu.splice(r,1),s.Jl(e),e.m&&e.m(),this.uh.O_(),this.kc(s)}Ih(e,n){const r=Jr(this.Hn(e));r.Jl(e,!0),r.Zl(e,n,!0)}ku(){const e=Qc.wn();e.rn(),this.Xu(e)}Pc(e){const n=Qc.wn();n.ln(e),this.Xu(n)}cn(){const e=Qc.wn();e.cn(),this.Xu(e)}dn(e){const n=Qc.wn();n.dn(e),this.Xu(n)}fn(e){const n=Qc.wn();n.fn(e),this.Xu(n)}_n(e){const n=Qc.wn();n._n(e),this.Xu(n)}hn(){const e=Qc.wn();e.hn(),this.Xu(e)}Tc(){return this.ys.rightPriceScale.visible?"right":"left"}Rc(e,n){if(Fu(n>=0,"Index should be greater or equal to 0"),n===this.Dc(e))return;const r=Jr(this.Hn(e));r.Jl(e);const s=this.qu(n);this.Cc(e,s),r.ba().length===0&&this.kc(r)}Vc(){return this.Ku}$(){return this.Yu}Ut(e){const n=this.Ku,r=this.Yu;if(n===r)return n;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Fu===null||this.Fu.mr!==r||this.Fu.wr!==n)this.Fu={mr:r,wr:n,Ic:new Map};else{const a=this.Fu.Ic.get(e);if(a!==void 0)return a}const s=this.bl.tt(r,n,e/100);return this.Fu.Ic.set(e,s),s}Bc(e){return this.zu.indexOf(e)}Xi(){return this.bl}qu(e){if(Fu(e>=0,"Index should be greater or equal to 0"),(e=Math.min(this.zu.length,e))<this.zu.length)return this.zu[e];const n=new Nje(this.uh,this);this.zu.push(n);const r=Qc.gn();return r.Qs(e,{tn:0,sn:!0}),this.Xu(r),n}Dc(e){return this.zu.findIndex(n=>n.Do().includes(e))}lc(e,n){const r=new Qc(n);if(e!==null){const s=this.zu.indexOf(e);r.Qs(s,{tn:n})}return r}Zu(e,n){return n===void 0&&(n=2),this.lc(this.Hn(e),n)}Xu(e){this.Hu&&this.Hu(e),this.zu.forEach(n=>n.jo().lr().kt())}Cc(e,n){const r=e.N().priceScaleId,s=r!==void 0?r:this.Tc();n.Zl(e,s),Iz(s)||e.hr(e.N())}ju(e){const n=this.ys.layout;return n.background.type==="gradient"?e===0?n.background.topColor:n.background.bottomColor:n.background.color}kc(e){e.ba().length===0&&this.zu.length>1&&(this.zu.splice(this.Bc(e),1),this.Bh())}}function zse(t){return!NA(t)&&!dP(t)}function wKe(t){return NA(t)}(function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"})(Eje||(Eje={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(_je||(_je={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(kje||(kje={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Tje||(Tje={}));const Pje=t=>t.getUTCFullYear();function c5n(t,e,n){return e.replace(/yyyy/g,(r=>Qg(Pje(r),4))(t)).replace(/yy/g,(r=>Qg(Pje(r)%100,2))(t)).replace(/MMMM/g,((r,s)=>new Date(r.getUTCFullYear(),r.getUTCMonth(),1).toLocaleString(s,{month:"long"}))(t,n)).replace(/MMM/g,((r,s)=>new Date(r.getUTCFullYear(),r.getUTCMonth(),1).toLocaleString(s,{month:"short"}))(t,n)).replace(/MM/g,(r=>Qg((s=>s.getUTCMonth()+1)(r),2))(t)).replace(/dd/g,(r=>Qg((s=>s.getUTCDate())(r),2))(t))}class CKe{constructor(e="yyyy-MM-dd",n="default"){this.Ac=e,this.Ec=n}s_(e){return c5n(e,this.Ac,this.Ec)}}class u5n{constructor(e){this.zc=e||"%h:%m:%s"}s_(e){return this.zc.replace("%h",Qg(e.getUTCHours(),2)).replace("%m",Qg(e.getUTCMinutes(),2)).replace("%s",Qg(e.getUTCSeconds(),2))}}const d5n={Lc:"yyyy-MM-dd",Oc:"%h:%m:%s",Nc:" ",Wc:"default"};class f5n{constructor(e={}){const n={...d5n,...e};this.Fc=new CKe(n.Lc,n.Wc),this.Hc=new u5n(n.Oc),this.Uc=n.Nc}s_(e){return`${this.Fc.s_(e)}${this.Uc}${this.Hc.s_(e)}`}}function oO(t){return 60*t*60*1e3}function gZ(t){return 60*t*1e3}const lO=[{$c:(Ije=1,1e3*Ije),qc:10},{$c:gZ(1),qc:20},{$c:gZ(5),qc:21},{$c:gZ(30),qc:22},{$c:oO(1),qc:30},{$c:oO(3),qc:31},{$c:oO(6),qc:32},{$c:oO(12),qc:33}];var Ije;function Fje(t,e){if(t.getUTCFullYear()!==e.getUTCFullYear())return 70;if(t.getUTCMonth()!==e.getUTCMonth())return 60;if(t.getUTCDate()!==e.getUTCDate())return 50;for(let n=lO.length-1;n>=0;--n)if(Math.floor(e.getTime()/lO[n].$c)!==Math.floor(t.getTime()/lO[n].$c))return lO[n].qc;return 0}function bZ(t){let e=t;if(dP(t)&&(e=Cfe(t)),!zse(e))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Yc:Math.round(n.getTime()/1e3),jc:e}}function Oje(t){if(!wKe(t))throw new Error("time must be of type isUTCTimestamp");return{Yc:t}}function Cfe(t){const e=new Date(t);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Mje(t){dP(t.time)&&(t.time=Cfe(t.time))}class Rje{options(){return this.ys}setOptions(e){this.ys=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?function(n){n.forEach(Mje)}(e):Mje(e)}createConverterToInternalObj(e){return Jr(function(n){return n.length===0?null:zse(n[0].time)||dP(n[0].time)?bZ:Oje}(e))}key(e){return typeof e=="object"&&"Yc"in e?e.Yc:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const n=e;return n.jc===void 0?new Date(1e3*n.Yc).getTime():new Date(Date.UTC(n.jc.year,n.jc.month-1,n.jc.day)).getTime()}convertHorzItemToInternal(e){return wKe(n=e)?Oje(n):zse(n)?bZ(n):bZ(Cfe(n));var n}updateFormatter(e){if(!this.ys)return;const n=e.dateFormat;this.ys.timeScale.timeVisible?this.Kc=new f5n({Lc:n,Oc:this.ys.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Nc:" ",Wc:e.locale}):this.Kc=new CKe(n,e.locale)}formatHorzItem(e){const n=e;return this.Kc.s_(new Date(1e3*n.Yc))}formatTickmark(e,n){const r=function(a,o,l){switch(a){case 0:case 10:return o?l?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return o?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(e.weight,this.ys.timeScale.timeVisible,this.ys.timeScale.secondsVisible),s=this.ys.timeScale;if(s.tickMarkFormatter!==void 0){const a=s.tickMarkFormatter(e.originalTime,r,n.locale);if(a!==null)return a}return function(a,o,l){const c={};switch(o){case 0:c.year="numeric";break;case 1:c.month="short";break;case 2:c.day="numeric";break;case 3:c.hour12=!1,c.hour="2-digit",c.minute="2-digit";break;case 4:c.hour12=!1,c.hour="2-digit",c.minute="2-digit",c.second="2-digit"}const u=a.jc===void 0?new Date(1e3*a.Yc):new Date(Date.UTC(a.jc.year,a.jc.month-1,a.jc.day));return new Date(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate(),u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()).toLocaleString(l,c)}(e.time,r,n.locale)}maxTickMarkWeight(e){let n=e.reduce(a5n,e[0]).weight;return n>30&&n<50&&(n=30),n}fillWeightsForPoints(e,n){(function(r,s=0){if(r.length===0)return;let a=s===0?null:r[s-1].time.Yc,o=a!==null?new Date(1e3*a):null,l=0;for(let c=s;c<r.length;++c){const u=r[c],d=new Date(1e3*u.time.Yc);o!==null&&(u.timeWeight=Fje(d,o)),l+=u.time.Yc-(a||u.time.Yc),a=u.time.Yc,o=d}if(s===0&&r.length>1){const c=Math.ceil(l/(r.length-1)),u=new Date(1e3*(r[0].time.Yc-c));r[0].timeWeight=Fje(new Date(1e3*r[0].time.Yc),u)}})(e,n)}static Xc(e){return nh({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const jA=typeof window<"u";function Lje(){return!!jA&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function yZ(){return!!jA&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Hse(t){return t+t%2}function h5n(t){jA&&window.chrome!==void 0&&t.addEventListener("mousedown",e=>{if(e.button===1)return e.preventDefault(),!1})}class Mz{constructor(e,n,r){this.Zc=0,this.Gc=null,this.Jc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.Qc=0,this.td=null,this.sd={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.nd=null,this.ed=!1,this.rd=null,this.hd=null,this.ad=!1,this.ld=!1,this.od=!1,this._d=null,this.ud=null,this.dd=null,this.fd=null,this.pd=null,this.vd=null,this.md=null,this.wd=0,this.gd=!1,this.Md=!1,this.bd=!1,this.Sd=0,this.xd=null,this.Cd=!yZ(),this.yd=s=>{this.kd(s)},this.Pd=s=>{if(this.Td(s)){const a=this.Rd(s);if(++this.Qc,this.td&&this.Qc>1){const{Dd:o}=this.Vd(u0(s),this.sd);o<30&&!this.od&&this.Id(a,this.Ad.Bd),this.Ed()}}else{const a=this.Rd(s);if(++this.Zc,this.Gc&&this.Zc>1){const{Dd:o}=this.Vd(u0(s),this.Jc);o<5&&!this.ld&&this.zd(a,this.Ad.Ld),this.Od()}}},this.Nd=e,this.Ad=n,this.ys=r,this.Wd()}m(){this._d!==null&&(this._d(),this._d=null),this.ud!==null&&(this.ud(),this.ud=null),this.fd!==null&&(this.fd(),this.fd=null),this.pd!==null&&(this.pd(),this.pd=null),this.vd!==null&&(this.vd(),this.vd=null),this.dd!==null&&(this.dd(),this.dd=null),this.Fd(),this.Od()}Hd(e){this.fd&&this.fd();const n=this.Ud.bind(this);if(this.fd=()=>{this.Nd.removeEventListener("mousemove",n)},this.Nd.addEventListener("mousemove",n),this.Td(e))return;const r=this.Rd(e);this.zd(r,this.Ad.$d),this.Cd=!0}Od(){this.Gc!==null&&clearTimeout(this.Gc),this.Zc=0,this.Gc=null,this.Jc={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Ed(){this.td!==null&&clearTimeout(this.td),this.Qc=0,this.td=null,this.sd={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}Ud(e){if(this.bd||this.hd!==null||this.Td(e))return;const n=this.Rd(e);this.zd(n,this.Ad.qd),this.Cd=!0}Yd(e){const n=vZ(e.changedTouches,Jr(this.xd));if(n===null||(this.Sd=cO(e),this.md!==null)||this.Md)return;this.gd=!0;const r=this.Vd(u0(n),Jr(this.hd)),{jd:s,Kd:a,Dd:o}=r;if(this.ad||!(o<5)){if(!this.ad){const l=.5*s,c=a>=l&&!this.ys.Xd(),u=l>a&&!this.ys.Zd();c||u||(this.Md=!0),this.ad=!0,this.od=!0,this.Fd(),this.Ed()}if(!this.Md){const l=this.Rd(e,n);this.Id(l,this.Ad.Gd),DC(e)}}}Jd(e){if(e.button!==0)return;const n=this.Vd(u0(e),Jr(this.rd)),{Dd:r}=n;if(r>=5&&(this.ld=!0,this.Od()),this.ld){const s=this.Rd(e);this.zd(s,this.Ad.Qd)}}Vd(e,n){const r=Math.abs(n._t-e._t),s=Math.abs(n.ut-e.ut);return{jd:r,Kd:s,Dd:r+s}}tf(e){let n=vZ(e.changedTouches,Jr(this.xd));if(n===null&&e.touches.length===0&&(n=e.changedTouches[0]),n===null)return;this.xd=null,this.Sd=cO(e),this.Fd(),this.hd=null,this.vd&&(this.vd(),this.vd=null);const r=this.Rd(e,n);if(this.Id(r,this.Ad.if),++this.Qc,this.td&&this.Qc>1){const{Dd:s}=this.Vd(u0(n),this.sd);s<30&&!this.od&&this.Id(r,this.Ad.Bd),this.Ed()}else this.od||(this.Id(r,this.Ad.sf),this.Ad.sf&&DC(e));this.Qc===0&&DC(e),e.touches.length===0&&this.ed&&(this.ed=!1,DC(e))}kd(e){if(e.button!==0)return;const n=this.Rd(e);if(this.rd=null,this.bd=!1,this.pd&&(this.pd(),this.pd=null),Lje()&&this.Nd.ownerDocument.documentElement.removeEventListener("mouseleave",this.yd),!this.Td(e))if(this.zd(n,this.Ad.nf),++this.Zc,this.Gc&&this.Zc>1){const{Dd:r}=this.Vd(u0(e),this.Jc);r<5&&!this.ld&&this.zd(n,this.Ad.Ld),this.Od()}else this.ld||this.zd(n,this.Ad.ef)}Fd(){this.nd!==null&&(clearTimeout(this.nd),this.nd=null)}rf(e){if(this.xd!==null)return;const n=e.changedTouches[0];this.xd=n.identifier,this.Sd=cO(e);const r=this.Nd.ownerDocument.documentElement;this.od=!1,this.ad=!1,this.Md=!1,this.hd=u0(n),this.vd&&(this.vd(),this.vd=null);{const a=this.Yd.bind(this),o=this.tf.bind(this);this.vd=()=>{r.removeEventListener("touchmove",a),r.removeEventListener("touchend",o)},r.addEventListener("touchmove",a,{passive:!1}),r.addEventListener("touchend",o,{passive:!1}),this.Fd(),this.nd=setTimeout(this.hf.bind(this,e),240)}const s=this.Rd(e,n);this.Id(s,this.Ad.af),this.td||(this.Qc=0,this.td=setTimeout(this.Ed.bind(this),500),this.sd=u0(n))}lf(e){if(e.button!==0)return;const n=this.Nd.ownerDocument.documentElement;Lje()&&n.addEventListener("mouseleave",this.yd),this.ld=!1,this.rd=u0(e),this.pd&&(this.pd(),this.pd=null);{const s=this.Jd.bind(this),a=this.kd.bind(this);this.pd=()=>{n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",a)},n.addEventListener("mousemove",s),n.addEventListener("mouseup",a)}if(this.bd=!0,this.Td(e))return;const r=this.Rd(e);this.zd(r,this.Ad._f),this.Gc||(this.Zc=0,this.Gc=setTimeout(this.Od.bind(this),500),this.Jc=u0(e))}Wd(){this.Nd.addEventListener("mouseenter",this.Hd.bind(this)),this.Nd.addEventListener("touchcancel",this.Fd.bind(this));{const e=this.Nd.ownerDocument,n=r=>{this.Ad.uf&&(r.composed&&this.Nd.contains(r.composedPath()[0])||r.target&&this.Nd.contains(r.target)||this.Ad.uf())};this.ud=()=>{e.removeEventListener("touchstart",n)},this._d=()=>{e.removeEventListener("mousedown",n)},e.addEventListener("mousedown",n),e.addEventListener("touchstart",n,{passive:!0})}yZ()&&(this.dd=()=>{this.Nd.removeEventListener("dblclick",this.Pd)},this.Nd.addEventListener("dblclick",this.Pd)),this.Nd.addEventListener("mouseleave",this.cf.bind(this)),this.Nd.addEventListener("touchstart",this.rf.bind(this),{passive:!0}),h5n(this.Nd),this.Nd.addEventListener("mousedown",this.lf.bind(this)),this.df(),this.Nd.addEventListener("touchmove",()=>{},{passive:!1})}df(){this.Ad.ff===void 0&&this.Ad.pf===void 0&&this.Ad.vf===void 0||(this.Nd.addEventListener("touchstart",e=>this.mf(e.touches),{passive:!0}),this.Nd.addEventListener("touchmove",e=>{if(e.touches.length===2&&this.md!==null&&this.Ad.pf!==void 0){const n=Dje(e.touches[0],e.touches[1])/this.wd;this.Ad.pf(this.md,n),DC(e)}},{passive:!1}),this.Nd.addEventListener("touchend",e=>{this.mf(e.touches)}))}mf(e){e.length===1&&(this.gd=!1),e.length!==2||this.gd||this.ed?this.wf():this.gf(e)}gf(e){const n=this.Nd.getBoundingClientRect()||{left:0,top:0};this.md={_t:(e[0].clientX-n.left+(e[1].clientX-n.left))/2,ut:(e[0].clientY-n.top+(e[1].clientY-n.top))/2},this.wd=Dje(e[0],e[1]),this.Ad.ff!==void 0&&this.Ad.ff(),this.Fd()}wf(){this.md!==null&&(this.md=null,this.Ad.vf!==void 0&&this.Ad.vf())}cf(e){if(this.fd&&this.fd(),this.Td(e)||!this.Cd)return;const n=this.Rd(e);this.zd(n,this.Ad.Mf),this.Cd=!yZ()}hf(e){const n=vZ(e.touches,Jr(this.xd));if(n===null)return;const r=this.Rd(e,n);this.Id(r,this.Ad.bf),this.od=!0,this.ed=!0}Td(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:cO(e)<this.Sd+500}Id(e,n){n&&n.call(this.Ad,e)}zd(e,n){n&&n.call(this.Ad,e)}Rd(e,n){const r=n||e,s=this.Nd.getBoundingClientRect()||{left:0,top:0};return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY,screenX:r.screenX,screenY:r.screenY,localX:r.clientX-s.left,localY:r.clientY-s.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Sf:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",xf:e.type,Cf:r.target,Qo:e.view,yf:()=>{e.type!=="touchstart"&&DC(e)}}}}function Dje(t,e){const n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function DC(t){t.cancelable&&t.preventDefault()}function u0(t){return{_t:t.pageX,ut:t.pageY}}function cO(t){return t.timeStamp||performance.now()}function vZ(t,e){for(let n=0;n<t.length;++n)if(t[n].identifier===e)return t[n];return null}class p5n{constructor(e,n,r){this.kf=null,this.Pf=null,this.Tf=!0,this.Rf=null,this.Df=e,this.Vf=e.If()[n],this.Bf=e.If()[r],this.Af=document.createElement("tr"),this.Af.style.height="1px",this.Ef=document.createElement("td"),this.Ef.style.position="relative",this.Ef.style.padding="0",this.Ef.style.margin="0",this.Ef.setAttribute("colspan","3"),this.zf(),this.Af.appendChild(this.Ef),this.Tf=this.Df.N().layout.panes.enableResize,this.Tf?this.Lf():(this.kf=null,this.Pf=null)}m(){this.Pf!==null&&this.Pf.m()}Of(){return this.Af}Nf(){return Qa({width:this.Vf.Nf().width,height:1})}Wf(){return Qa({width:this.Vf.Wf().width,height:1*window.devicePixelRatio})}Ff(e,n,r){const s=this.Wf();e.fillStyle=this.Df.N().layout.panes.separatorColor,e.fillRect(n,r,s.width,s.height)}kt(){this.zf(),this.Df.N().layout.panes.enableResize!==this.Tf&&(this.Tf=this.Df.N().layout.panes.enableResize,this.Tf?this.Lf():(this.kf!==null&&(this.Ef.removeChild(this.kf.Hf),this.Ef.removeChild(this.kf.Uf),this.kf=null),this.Pf!==null&&(this.Pf.m(),this.Pf=null)))}Lf(){const e=document.createElement("div"),n=e.style;n.position="fixed",n.display="none",n.zIndex="49",n.top="0",n.left="0",n.width="100%",n.height="100%",n.cursor="row-resize",this.Ef.appendChild(e);const r=document.createElement("div"),s=r.style;s.position="absolute",s.zIndex="50",s.top="-4px",s.height="9px",s.width="100%",s.backgroundColor="",s.cursor="row-resize",this.Ef.appendChild(r);const a={$d:this.$f.bind(this),Mf:this.qf.bind(this),_f:this.Yf.bind(this),af:this.Yf.bind(this),Qd:this.jf.bind(this),Gd:this.jf.bind(this),nf:this.Kf.bind(this),if:this.Kf.bind(this)};this.Pf=new Mz(r,a,{Xd:()=>!1,Zd:()=>!0}),this.kf={Uf:r,Hf:e}}zf(){this.Ef.style.background=this.Df.N().layout.panes.separatorColor}$f(e){this.kf!==null&&(this.kf.Uf.style.backgroundColor=this.Df.N().layout.panes.separatorHoverColor)}qf(e){this.kf!==null&&this.Rf===null&&(this.kf.Uf.style.backgroundColor="")}Yf(e){if(this.kf===null)return;const n=this.Vf.Xf().ko()+this.Bf.Xf().ko(),r=n/(this.Vf.Nf().height+this.Bf.Nf().height),s=30*r;n<=2*s||(this.Rf={Zf:e.pageY,Gf:this.Vf.Xf().ko(),Jf:n-s,Qf:n,tp:r,ip:s},this.kf.Hf.style.display="block")}jf(e){const n=this.Rf;if(n===null)return;const r=(e.pageY-n.Zf)*n.tp,s=X9(n.Gf+r,n.ip,n.Jf);this.Vf.Xf().Po(s),this.Bf.Xf().Po(n.Qf-s),this.Df.Qt().Bh()}Kf(e){this.Rf!==null&&this.kf!==null&&(this.Rf=null,this.kf.Hf.style.display="none")}}function wZ(t,e){return t.sp-e.sp}function CZ(t,e,n){const r=(t.sp-e.sp)/(t.wt-e.wt);return Math.sign(r)*Math.min(Math.abs(r),n)}class m5n{constructor(e,n,r,s){this.np=null,this.ep=null,this.rp=null,this.hp=null,this.ap=null,this.lp=0,this.op=0,this._p=e,this.up=n,this.cp=r,this.Mn=s}dp(e,n){if(this.np!==null){if(this.np.wt===n)return void(this.np.sp=e);if(Math.abs(this.np.sp-e)<this.Mn)return}this.hp=this.rp,this.rp=this.ep,this.ep=this.np,this.np={wt:n,sp:e}}le(e,n){if(this.np===null||this.ep===null||n-this.np.wt>50)return;let r=0;const s=CZ(this.np,this.ep,this.up),a=wZ(this.np,this.ep),o=[s],l=[a];if(r+=a,this.rp!==null){const u=CZ(this.ep,this.rp,this.up);if(Math.sign(u)===Math.sign(s)){const d=wZ(this.ep,this.rp);if(o.push(u),l.push(d),r+=d,this.hp!==null){const f=CZ(this.rp,this.hp,this.up);if(Math.sign(f)===Math.sign(s)){const x=wZ(this.rp,this.hp);o.push(f),l.push(x),r+=x}}}}let c=0;for(let u=0;u<o.length;++u)c+=l[u]/r*o[u];Math.abs(c)<this._p||(this.ap={sp:e,wt:n},this.op=c,this.lp=function(u,d){const f=Math.log(d);return Math.log(1*f/-u)/f}(Math.abs(c),this.cp))}bu(e){const n=Jr(this.ap),r=e-n.wt;return n.sp+this.op*(Math.pow(this.cp,r)-1)/Math.log(this.cp)}Mu(e){return this.ap===null||this.fp(e)===this.lp}fp(e){const n=e-Jr(this.ap).wt;return Math.min(n,this.lp)}}class x5n{constructor(e,n){this.pp=void 0,this.vp=void 0,this.mp=void 0,this.ps=!1,this.wp=e,this.gp=n,this.Mp()}kt(){this.Mp()}bp(){this.pp&&this.wp.removeChild(this.pp),this.vp&&this.wp.removeChild(this.vp),this.pp=void 0,this.vp=void 0}Sp(){return this.ps!==this.xp()||this.mp!==this.Cp()}Cp(){return this.gp.Qt().Xi().J(this.gp.N().layout.textColor)>160?"dark":"light"}xp(){return this.gp.N().layout.attributionLogo}yp(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.pathname:""}Mp(){this.Sp()&&(this.bp(),this.ps=this.xp(),this.ps&&(this.mp=this.Cp(),this.vp=document.createElement("style"),this.vp.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.pp=document.createElement("a"),this.pp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.yp()}`,this.pp.title="Charting by TradingView",this.pp.id="tv-attr-logo",this.pp.target="_blank",this.pp.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.pp.toggleAttribute("data-dark",this.mp==="dark"),this.wp.appendChild(this.vp),this.wp.appendChild(this.pp)))}}function b5(t,e){const n=Jr(t.ownerDocument).createElement("canvas");t.appendChild(n);const r=n3n(n,{type:"device-pixel-content-box",options:{allowResizeObserver:!0},transform:(s,a)=>({width:Math.max(s.width,a.width),height:Math.max(s.height,a.height)})});return r.resizeCanvasElement(e),r}function y5(t){var e;t.width=1,t.height=1,(e=t.getContext("2d"))==null||e.clearRect(0,0,1,1)}function Vse(t,e,n,r){t.ih&&t.ih(e,n,r)}function kM(t,e,n,r){t.nt(e,n,r)}function Wse(t,e,n,r){const s=t(n,r);for(const a of s){const o=a.Tt(r);o!==null&&e(o)}}function SZ(t,e){return n=>{var r,s;return function(a){return a.Wt!==void 0}(n)?(((r=n.Wt())==null?void 0:r.wa())??"")!==e?[]:((s=n.ta)==null?void 0:s.call(n,t))??[]:[]}}function Bje(t,e,n,r){if(!t.length)return;let s=0;const a=t[0].$t(r,!0);let o=e===1?n/2-(t[0].Wi()-a/2):t[0].Wi()-a/2-n/2;o=Math.max(0,o);for(let l=1;l<t.length;l++){const c=t[l],u=t[l-1],d=u.$t(r,!1),f=c.Wi(),x=u.Wi();if(e===1?f>x-d:f<x+d){const g=x-d*e;c.Fi(g);const y=g-e*d/2;if((e===1?y<0:y>n)&&o>0){const v=e===1?-1-y:y-n,C=Math.min(v,o);for(let N=s;N<t.length;N++)t[N].Fi(t[N].Wi()+e*C);o-=C}}else s=l,o=e===1?x-d-f:f-(x+d)}}class $je{constructor(e,n,r,s){this.Yi=null,this.kp=null,this.Pp=!1,this.Tp=new oB(200),this.Rp=null,this.Dp=0,this.Vp=!1,this.Ip=()=>{this.Vp||this.yt.Bp().Qt().ar()},this.Ap=()=>{this.Vp||this.yt.Bp().Qt().ar()},this.yt=e,this.ys=n,this.gl=n.layout,this.Uu=r,this.Ep=s==="left",this.zp=SZ("normal",s),this.Lp=SZ("top",s),this.Op=SZ("bottom",s),this.Ef=document.createElement("div"),this.Ef.style.height="100%",this.Ef.style.overflow="hidden",this.Ef.style.width="25px",this.Ef.style.left="0",this.Ef.style.position="relative",this.Np=b5(this.Ef,Qa({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip);const a=this.Np.canvasElement;a.style.position="absolute",a.style.zIndex="1",a.style.left="0",a.style.top="0",this.Wp=b5(this.Ef,Qa({width:16,height:16})),this.Wp.subscribeSuggestedBitmapSizeChanged(this.Ap);const o=this.Wp.canvasElement;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";const l={_f:this.Yf.bind(this),af:this.Yf.bind(this),Qd:this.jf.bind(this),Gd:this.jf.bind(this),uf:this.Fp.bind(this),nf:this.Kf.bind(this),if:this.Kf.bind(this),Ld:this.Hp.bind(this),Bd:this.Hp.bind(this),$d:this.Up.bind(this),Mf:this.qf.bind(this)};this.Pf=new Mz(this.Wp.canvasElement,l,{Xd:()=>!this.ys.handleScroll.vertTouchDrag,Zd:()=>!0})}m(){this.Pf.m(),this.Wp.unsubscribeSuggestedBitmapSizeChanged(this.Ap),y5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),y5(this.Np.canvasElement),this.Np.dispose(),this.Yi!==null&&this.Yi.io().u(this),this.Yi=null}Of(){return this.Ef}k(){return this.gl.fontSize}$p(){const e=this.Uu.N();return this.Rp!==e.P&&(this.Tp.In(),this.Rp=e.P),e}qp(){if(this.Yi===null)return 0;let e=0;const n=this.$p(),r=Jr(this.Np.canvasElement.getContext("2d",{colorSpace:this.yt.Bp().N().layout.colorSpace}));r.save();const s=this.Yi.Va();r.font=this.Yp(),s.length>0&&(e=Math.max(this.Tp.Vi(r,s[0].Xa),this.Tp.Vi(r,s[s.length-1].Xa)));const a=this.jp();for(let u=a.length;u--;){const d=this.Tp.Vi(r,a[u].ri());d>e&&(e=d)}const o=this.Yi.zt();if(o!==null&&this.kp!==null&&(l=this.ys.crosshair).mode!==2&&l.horzLine.visible&&l.horzLine.labelVisible){const u=this.Yi.Ts(1,o),d=this.Yi.Ts(this.kp.height-2,o);e=Math.max(e,this.Tp.Vi(r,this.Yi.Zi(Math.floor(Math.min(u,d))+.11111111111111,o)),this.Tp.Vi(r,this.Yi.Zi(Math.ceil(Math.max(u,d))-.11111111111111,o)))}var l;r.restore();const c=e||34;return Hse(Math.ceil(n.S+n.C+n.I+n.B+5+c))}Kp(e){this.kp!==null&&T3(this.kp,e)||(this.kp=e,this.Vp=!0,this.Np.resizeCanvasElement(e),this.Wp.resizeCanvasElement(e),this.Vp=!1,this.Ef.style.width=`${e.width}px`,this.Ef.style.height=`${e.height}px`)}Xp(){return Jr(this.kp).width}_s(e){this.Yi!==e&&(this.Yi!==null&&this.Yi.io().u(this),this.Yi=e,e.io().i(this.ol.bind(this),this))}Wt(){return this.Yi}In(){const e=this.yt.Xf();this.yt.Bp().Qt().Ho(e,Jr(this.Wt()))}Zp(e){if(this.kp===null)return;const n={colorSpace:this.yt.Bp().N().layout.colorSpace};if(e!==1){this.Gp(),this.Np.applySuggestedBitmapSize();const s=g5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a),this.Qp(a)}),this.yt.tv(s,this.Op),this.iv(s),this.yt.tv(s,this.zp),this.sv(s))}this.Wp.applySuggestedBitmapSize();const r=g5(this.Wp,n);r!==null&&(r.useBitmapCoordinateSpace(({context:s,bitmapSize:a})=>{s.clearRect(0,0,a.width,a.height)}),this.nv(r),this.yt.tv(r,this.Lp))}Wf(){return this.Np.bitmapSize}Ff(e,n,r){const s=this.Wf();s.width>0&&s.height>0&&e.drawImage(this.Np.canvasElement,n,r)}kt(){var e;(e=this.Yi)==null||e.Va()}Yf(e){if(this.Yi===null||this.Yi.Ki()||!this.ys.handleScale.axisPressedMouseMove.price)return;const n=this.yt.Bp().Qt(),r=this.yt.Xf();this.Pp=!0,n.Eo(r,this.Yi,e.localY)}jf(e){if(this.Yi===null||!this.ys.handleScale.axisPressedMouseMove.price)return;const n=this.yt.Bp().Qt(),r=this.yt.Xf(),s=this.Yi;n.zo(r,s,e.localY)}Fp(){if(this.Yi===null||!this.ys.handleScale.axisPressedMouseMove.price)return;const e=this.yt.Bp().Qt(),n=this.yt.Xf(),r=this.Yi;this.Pp&&(this.Pp=!1,e.Lo(n,r))}Kf(e){if(this.Yi===null||!this.ys.handleScale.axisPressedMouseMove.price)return;const n=this.yt.Bp().Qt(),r=this.yt.Xf();this.Pp=!1,n.Lo(r,this.Yi)}Hp(e){this.ys.handleScale.axisDoubleClickReset.price&&this.In()}Up(e){this.Yi!==null&&(!this.yt.Bp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.Rl()||this.ev(1))}qf(e){this.ev(0)}jp(){const e=[],n=this.Yi===null?void 0:this.Yi;return(r=>{for(let s=0;s<r.length;++s){const a=r[s].Fs(this.yt.Xf(),n);for(let o=0;o<a.length;o++)e.push(a[o])}})(this.yt.Xf().Dt()),e}Jp({context:e,bitmapSize:n}){const{width:r,height:s}=n,a=this.yt.Xf().Qt(),o=a.$(),l=a.Vc();o===l?Tz(e,0,0,r,s,o):uKe(e,0,0,r,s,o,l)}Qp({context:e,bitmapSize:n,horizontalPixelRatio:r}){if(this.kp===null||this.Yi===null||!this.Yi.N().borderVisible)return;e.fillStyle=this.Yi.N().borderColor;const s=Math.max(1,Math.floor(this.$p().S*r));let a;a=this.Ep?n.width-s:0,e.fillRect(a,0,s,n.height)}iv(e){if(this.kp===null||this.Yi===null)return;const n=this.Yi.Va(),r=this.Yi.N(),s=this.$p(),a=this.Ep?this.kp.width-s.C:0;r.borderVisible&&r.ticksVisible&&e.useBitmapCoordinateSpace(({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.fillStyle=r.borderColor;const u=Math.max(1,Math.floor(c)),d=Math.floor(.5*c),f=Math.round(s.C*l);o.beginPath();for(const x of n)o.rect(Math.floor(a*l),Math.round(x.ka*c)-d,f,u);o.fill()}),e.useMediaCoordinateSpace(({context:o})=>{o.font=this.Yp(),o.fillStyle=r.textColor??this.gl.textColor,o.textAlign=this.Ep?"right":"left",o.textBaseline="middle";const l=this.Ep?Math.round(a-s.I):Math.round(a+s.C+s.I),c=n.map(u=>this.Tp.Di(o,u.Xa));for(let u=n.length;u--;){const d=n[u];o.fillText(d.Xa,l,d.ka+c[u])}})}Gp(){if(this.kp===null||this.Yi===null)return;let e=this.kp.height/2;const n=[],r=this.Yi.Dt().slice(),s=this.yt.Xf(),a=this.$p();this.Yi===s.$n()&&this.yt.Xf().Dt().forEach(c=>{s.Un(c)&&r.push(c)});const o=this.Yi.ba()[0],l=this.Yi;r.forEach(c=>{const u=c.Fs(s,l);u.forEach(d=>{d.Fi(null),d.Hi()&&n.push(d)}),o===c&&u.length>0&&(e=u[0].Bi())}),n.forEach(c=>c.Fi(c.Bi())),this.Yi.N().alignLabels&&this.rv(n,a,e)}rv(e,n,r){if(this.kp===null)return;const s=e.filter(o=>o.Bi()<=r),a=e.filter(o=>o.Bi()>r);s.sort((o,l)=>l.Bi()-o.Bi()),s.length&&a.length&&a.push(s[0]),a.sort((o,l)=>o.Bi()-l.Bi());for(const o of e){const l=Math.floor(o.$t(n)/2),c=o.Bi();c>-l&&c<l&&o.Fi(l),c>this.kp.height-l&&c<this.kp.height+l&&o.Fi(this.kp.height-l)}Bje(s,1,this.kp.height,n),Bje(a,-1,this.kp.height,n)}sv(e){if(this.kp===null)return;const n=this.jp(),r=this.$p(),s=this.Ep?"right":"left";n.forEach(a=>{a.Ui()&&a.Tt(Jr(this.Yi)).nt(e,r,this.Tp,s)})}nv(e){if(this.kp===null||this.Yi===null)return;const n=this.yt.Bp().Qt(),r=[],s=this.yt.Xf(),a=n.sc().Fs(s,this.Yi);a.length&&r.push(a);const o=this.$p(),l=this.Ep?"right":"left";r.forEach(c=>{c.forEach(u=>{u.Tt(Jr(this.Yi)).nt(e,o,this.Tp,l)})})}ev(e){this.Ef.style.cursor=e===1?"ns-resize":"default"}ol(){const e=this.qp();this.Dp<e&&this.yt.Bp().Qt().Bh(),this.Dp=e}Yp(){return aB(this.gl.fontSize,this.gl.fontFamily)}}function g5n(t,e){var n;return((n=t.Jh)==null?void 0:n.call(t,e))??[]}function Uje(t,e){var n;return((n=t.Ws)==null?void 0:n.call(t,e))??[]}function zje(t,e){var n;return((n=t.us)==null?void 0:n.call(t,e))??[]}function b5n(t,e){var n;return((n=t.Xh)==null?void 0:n.call(t,e))??[]}class Sfe{constructor(e,n){this.kp=Qa({width:0,height:0}),this.hv=null,this.av=null,this.lv=null,this.ov=null,this._v=!1,this.uv=new El,this.cv=new El,this.dv=0,this.fv=!1,this.pv=null,this.vv=!1,this.mv=null,this.wv=null,this.Vp=!1,this.Ip=()=>{this.Vp||this.gv===null||this.ts().ar()},this.Ap=()=>{this.Vp||this.gv===null||this.ts().ar()},this.gp=e,this.gv=n,this.gv.Yo().i(this.Mv.bind(this),this,!0),this.bv=document.createElement("td"),this.bv.style.padding="0",this.bv.style.position="relative";const r=document.createElement("div");r.style.width="100%",r.style.height="100%",r.style.position="relative",r.style.overflow="hidden",this.Sv=document.createElement("td"),this.Sv.style.padding="0",this.xv=document.createElement("td"),this.xv.style.padding="0",this.bv.appendChild(r),this.Np=b5(r,Qa({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip);const s=this.Np.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Wp=b5(r,Qa({width:16,height:16})),this.Wp.subscribeSuggestedBitmapSizeChanged(this.Ap);const a=this.Wp.canvasElement;a.style.position="absolute",a.style.zIndex="2",a.style.left="0",a.style.top="0",this.Af=document.createElement("tr"),this.Af.appendChild(this.Sv),this.Af.appendChild(this.bv),this.Af.appendChild(this.xv),this.Cv(),this.Pf=new Mz(this.Wp.canvasElement,this,{Xd:()=>this.pv===null&&!this.gp.N().handleScroll.vertTouchDrag,Zd:()=>this.pv===null&&!this.gp.N().handleScroll.horzTouchDrag})}m(){this.hv!==null&&this.hv.m(),this.av!==null&&this.av.m(),this.lv=null,this.Wp.unsubscribeSuggestedBitmapSizeChanged(this.Ap),y5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),y5(this.Np.canvasElement),this.Np.dispose(),this.gv!==null&&(this.gv.Yo().u(this),this.gv.m()),this.Pf.m()}Xf(){return Jr(this.gv)}yv(e){var n;this.gv!==null&&this.gv.Yo().u(this),this.gv=e,this.gv!==null&&this.gv.Yo().i(Sfe.prototype.Mv.bind(this),this,!0),this.Cv(),this.gp.If().indexOf(this)===this.gp.If().length-1?(this.lv=this.lv??new x5n(this.bv,this.gp),this.lv.kt()):((n=this.lv)==null||n.bp(),this.lv=null)}Bp(){return this.gp}Of(){return this.Af}Cv(){if(this.gv!==null&&(this.kv(),this.ts().js().length!==0)){if(this.hv!==null){const e=this.gv.Bo();this.hv._s(Jr(e))}if(this.av!==null){const e=this.gv.Ao();this.av._s(Jr(e))}}}Pv(){this.hv!==null&&this.hv.kt(),this.av!==null&&this.av.kt()}ko(){return this.gv!==null?this.gv.ko():0}Po(e){this.gv&&this.gv.Po(e)}$d(e){if(!this.gv)return;this.Tv();const n=e.localX,r=e.localY;this.Rv(n,r,e)}_f(e){this.Tv(),this.Dv(),this.Rv(e.localX,e.localY,e)}qd(e){if(!this.gv)return;this.Tv();const n=e.localX,r=e.localY;this.Rv(n,r,e)}ef(e){this.gv!==null&&(this.Tv(),this.Vv(e))}Ld(e){this.gv!==null&&this.Iv(this.cv,e)}Bd(e){this.Ld(e)}Qd(e){this.Tv(),this.Bv(e),this.Rv(e.localX,e.localY,e)}nf(e){this.gv!==null&&(this.Tv(),this.fv=!1,this.Av(e))}sf(e){this.gv!==null&&this.Vv(e)}bf(e){if(this.fv=!0,this.pv===null){const n={x:e.localX,y:e.localY};this.Ev(n,n,e)}}Mf(e){this.gv!==null&&(this.Tv(),this.gv.Qt().Ju(null),this.zv())}Lv(){return this.uv}Ov(){return this.cv}ff(){this.dv=1,this.ts().hn()}pf(e,n){if(!this.gp.N().handleScale.pinch)return;const r=5*(n-this.dv);this.dv=n,this.ts()._c(e._t,r)}af(e){this.fv=!1,this.vv=this.pv!==null,this.Dv();const n=this.ts().sc();this.pv!==null&&n.Vt()&&(this.mv={x:n.si(),y:n.ni()},this.pv={x:e.localX,y:e.localY})}Gd(e){if(this.gv===null)return;const n=e.localX,r=e.localY;if(this.pv===null)this.Bv(e);else{this.vv=!1;const s=Jr(this.mv),a=s.x+(n-this.pv.x),o=s.y+(r-this.pv.y);this.Rv(a,o,e)}}if(e){this.Bp().N().trackingMode.exitMode===0&&(this.vv=!0),this.Nv(),this.Av(e)}jn(e,n){const r=this.gv;return r===null?null:vKe(r,e,n)}Wv(e,n){Jr(n==="left"?this.hv:this.av).Kp(Qa({width:e,height:this.kp.height}))}Nf(){return this.kp}Kp(e){T3(this.kp,e)||(this.kp=e,this.Vp=!0,this.Np.resizeCanvasElement(e),this.Wp.resizeCanvasElement(e),this.Vp=!1,this.bv.style.width=e.width+"px",this.bv.style.height=e.height+"px")}Fv(){const e=Jr(this.gv);e.Io(e.Bo()),e.Io(e.Ao());for(const n of e.ba())if(e.Un(n)){const r=n.Wt();r!==null&&e.Io(r),n.Ns()}for(const n of e.Ko())n.Ns()}Wf(){return this.Np.bitmapSize}Ff(e,n,r){const s=this.Wf();s.width>0&&s.height>0&&e.drawImage(this.Np.canvasElement,n,r)}Zp(e){if(e===0||this.gv===null)return;e>1&&this.Fv(),this.hv!==null&&this.hv.Zp(e),this.av!==null&&this.av.Zp(e);const n={colorSpace:this.gp.N().layout.colorSpace};if(e!==1){this.Np.applySuggestedBitmapSize();const s=g5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a)}),this.gv&&(this.Hv(s,g5n),this.Uv(s),this.Hv(s,Uje),this.Hv(s,zje)))}this.Wp.applySuggestedBitmapSize();const r=g5(this.Wp,n);r!==null&&(r.useBitmapCoordinateSpace(({context:s,bitmapSize:a})=>{s.clearRect(0,0,a.width,a.height)}),this.$v(r),this.Hv(r,b5n),this.Hv(r,zje))}qv(){return this.hv}Yv(){return this.av}tv(e,n){this.Hv(e,n)}Mv(){this.gv!==null&&this.gv.Yo().u(this),this.gv=null}Vv(e){this.Iv(this.uv,e)}Iv(e,n){const r=n.localX,s=n.localY;e.v()&&e.p(this.ts().At().nu(r),{x:r,y:s},n)}Jp({context:e,bitmapSize:n}){const{width:r,height:s}=n,a=this.ts(),o=a.$(),l=a.Vc();o===l?Tz(e,0,0,r,s,l):uKe(e,0,0,r,s,o,l)}Uv(e){const n=Jr(this.gv),r=n.jo().lr().Tt(n);r!==null&&r.nt(e,!1)}$v(e){this.jv(e,Uje,kM,this.ts().sc())}Hv(e,n){const r=Jr(this.gv),s=r.Dt(),a=r.Ko();for(const o of a)this.jv(e,n,Vse,o);for(const o of s)this.jv(e,n,Vse,o);for(const o of a)this.jv(e,n,kM,o);for(const o of s)this.jv(e,n,kM,o)}jv(e,n,r,s){const a=Jr(this.gv),o=a.Qt().Gu(),l=o!==null&&o.Xo===s,c=o!==null&&l&&o.Zo!==void 0?o.Zo.Xn:void 0;Wse(n,u=>r(u,e,l,c),s,a)}kv(){if(this.gv===null)return;const e=this.gp,n=this.gv.Bo().N().visible,r=this.gv.Ao().N().visible;n||this.hv===null||(this.Sv.removeChild(this.hv.Of()),this.hv.m(),this.hv=null),r||this.av===null||(this.xv.removeChild(this.av.Of()),this.av.m(),this.av=null);const s=e.Qt().Sc();n&&this.hv===null&&(this.hv=new $je(this,e.N(),s,"left"),this.Sv.appendChild(this.hv.Of())),r&&this.av===null&&(this.av=new $je(this,e.N(),s,"right"),this.xv.appendChild(this.av.Of()))}Kv(e){return e.Sf&&this.fv||this.pv!==null}Xv(e){return Math.max(0,Math.min(e,this.kp.width-1))}Zv(e){return Math.max(0,Math.min(e,this.kp.height-1))}Rv(e,n,r){this.ts().wc(this.Xv(e),this.Zv(n),r,Jr(this.gv))}zv(){this.ts().Mc()}Nv(){this.vv&&(this.pv=null,this.zv())}Ev(e,n,r){this.pv=e,this.vv=!1,this.Rv(n.x,n.y,r);const s=this.ts().sc();this.mv={x:s.si(),y:s.ni()}}ts(){return this.gp.Qt()}Av(e){if(!this._v)return;const n=this.ts(),r=this.Xf();if(n.Wo(r,r.Ps()),this.ov=null,this._v=!1,n.fc(),this.wv!==null){const s=performance.now(),a=n.At();this.wv.le(a._u(),s),this.wv.Mu(s)||n._n(this.wv)}}Tv(){this.pv=null}Dv(){if(this.gv){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Jr(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.gv.Ps().Ki()&&this.ts().At().Ki()}}Bv(e){if(this.gv===null)return;const n=this.ts(),r=n.At();if(r.Ki())return;const s=this.gp.N(),a=s.handleScroll,o=s.kineticScroll;if((!a.pressedMouseMove||e.Sf)&&(!a.horzTouchDrag&&!a.vertTouchDrag||!e.Sf))return;const l=this.gv.Ps(),c=performance.now();if(this.ov!==null||this.Kv(e)||(this.ov={x:e.clientX,y:e.clientY,Yc:c,Gv:e.localX,Jv:e.localY}),this.ov!==null&&!this._v&&(this.ov.x!==e.clientX||this.ov.y!==e.clientY)){if(e.Sf&&o.touch||!e.Sf&&o.mouse){const u=r.lu();this.wv=new m5n(.2/u,7/u,.997,15/u),this.wv.dp(r._u(),this.ov.Yc)}else this.wv=null;l.Ki()||n.Oo(this.gv,l,e.localY),n.cc(e.localX),this._v=!0}this._v&&(l.Ki()||n.No(this.gv,l,e.localY),n.dc(e.localX),this.wv!==null&&this.wv.dp(r._u(),c))}}class Hje{constructor(e,n,r,s,a){this.xt=!0,this.kp=Qa({width:0,height:0}),this.Ip=()=>this.Zp(3),this.Ep=e==="left",this.Uu=r.Sc,this.ys=n,this.Qv=s,this.tm=a,this.Ef=document.createElement("div"),this.Ef.style.width="25px",this.Ef.style.height="100%",this.Ef.style.overflow="hidden",this.Np=b5(this.Ef,Qa({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip)}m(){this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),y5(this.Np.canvasElement),this.Np.dispose()}Of(){return this.Ef}Nf(){return this.kp}Kp(e){T3(this.kp,e)||(this.kp=e,this.Np.resizeCanvasElement(e),this.Ef.style.width=`${e.width}px`,this.Ef.style.height=`${e.height}px`,this.xt=!0)}Zp(e){if(e<3&&!this.xt||this.kp.width===0||this.kp.height===0)return;this.xt=!1,this.Np.applySuggestedBitmapSize();const n=g5(this.Np,{colorSpace:this.ys.layout.colorSpace});n!==null&&n.useBitmapCoordinateSpace(r=>{this.Jp(r),this.Qp(r)})}Wf(){return this.Np.bitmapSize}Ff(e,n,r){const s=this.Wf();s.width>0&&s.height>0&&e.drawImage(this.Np.canvasElement,n,r)}Qp({context:e,bitmapSize:n,horizontalPixelRatio:r,verticalPixelRatio:s}){if(!this.Qv())return;e.fillStyle=this.ys.timeScale.borderColor;const a=Math.floor(this.Uu.N().S*r),o=Math.floor(this.Uu.N().S*s),l=this.Ep?n.width-a:0;e.fillRect(l,0,a,o)}Jp({context:e,bitmapSize:n}){Tz(e,0,0,n.width,n.height,this.tm())}}function Nfe(t){return e=>{var n;return((n=e.ia)==null?void 0:n.call(e,t))??[]}}const y5n=Nfe("normal"),v5n=Nfe("top"),w5n=Nfe("bottom");class C5n{constructor(e,n){this.im=null,this.sm=null,this.M=null,this.nm=!1,this.kp=Qa({width:0,height:0}),this.rm=new El,this.Tp=new oB(5),this.Vp=!1,this.Ip=()=>{this.Vp||this.gp.Qt().ar()},this.Ap=()=>{this.Vp||this.gp.Qt().ar()},this.gp=e,this.i_=n,this.ys=e.N().layout,this.pp=document.createElement("tr"),this.hm=document.createElement("td"),this.hm.style.padding="0",this.am=document.createElement("td"),this.am.style.padding="0",this.Ef=document.createElement("td"),this.Ef.style.height="25px",this.Ef.style.padding="0",this.lm=document.createElement("div"),this.lm.style.width="100%",this.lm.style.height="100%",this.lm.style.position="relative",this.lm.style.overflow="hidden",this.Ef.appendChild(this.lm),this.Np=b5(this.lm,Qa({width:16,height:16})),this.Np.subscribeSuggestedBitmapSizeChanged(this.Ip);const r=this.Np.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Wp=b5(this.lm,Qa({width:16,height:16})),this.Wp.subscribeSuggestedBitmapSizeChanged(this.Ap);const s=this.Wp.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.pp.appendChild(this.hm),this.pp.appendChild(this.Ef),this.pp.appendChild(this.am),this.om(),this.gp.Qt().yo().i(this.om.bind(this),this),this.Pf=new Mz(this.Wp.canvasElement,this,{Xd:()=>!0,Zd:()=>!this.gp.N().handleScroll.horzTouchDrag})}m(){this.Pf.m(),this.im!==null&&this.im.m(),this.sm!==null&&this.sm.m(),this.Wp.unsubscribeSuggestedBitmapSizeChanged(this.Ap),y5(this.Wp.canvasElement),this.Wp.dispose(),this.Np.unsubscribeSuggestedBitmapSizeChanged(this.Ip),y5(this.Np.canvasElement),this.Np.dispose()}Of(){return this.pp}_m(){return this.im}um(){return this.sm}_f(e){if(this.nm)return;this.nm=!0;const n=this.gp.Qt();!n.At().Ki()&&this.gp.N().handleScale.axisPressedMouseMove.time&&n.oc(e.localX)}af(e){this._f(e)}uf(){const e=this.gp.Qt();!e.At().Ki()&&this.nm&&(this.nm=!1,this.gp.N().handleScale.axisPressedMouseMove.time&&e.mc())}Qd(e){const n=this.gp.Qt();!n.At().Ki()&&this.gp.N().handleScale.axisPressedMouseMove.time&&n.vc(e.localX)}Gd(e){this.Qd(e)}nf(){this.nm=!1;const e=this.gp.Qt();e.At().Ki()&&!this.gp.N().handleScale.axisPressedMouseMove.time||e.mc()}if(){this.nf()}Ld(){this.gp.N().handleScale.axisDoubleClickReset.time&&this.gp.Qt().cn()}Bd(){this.Ld()}$d(){this.gp.Qt().N().handleScale.axisPressedMouseMove.time&&this.ev(1)}Mf(){this.ev(0)}Nf(){return this.kp}dm(){return this.rm}fm(e,n,r){T3(this.kp,e)||(this.kp=e,this.Vp=!0,this.Np.resizeCanvasElement(e),this.Wp.resizeCanvasElement(e),this.Vp=!1,this.Ef.style.width=`${e.width}px`,this.Ef.style.height=`${e.height}px`,this.rm.p(e)),this.im!==null&&this.im.Kp(Qa({width:n,height:e.height})),this.sm!==null&&this.sm.Kp(Qa({width:r,height:e.height}))}pm(){const e=this.vm();return Math.ceil(e.S+e.C+e.k+e.A+e.V+e.wm)}kt(){this.gp.Qt().At().Va()}Wf(){return this.Np.bitmapSize}Ff(e,n,r){const s=this.Wf();s.width>0&&s.height>0&&e.drawImage(this.Np.canvasElement,n,r)}Zp(e){if(e===0)return;const n={colorSpace:this.ys.colorSpace};if(e!==1){this.Np.applySuggestedBitmapSize();const s=g5(this.Np,n);s!==null&&(s.useBitmapCoordinateSpace(a=>{this.Jp(a),this.Qp(a),this.gm(s,w5n)}),this.iv(s),this.gm(s,y5n)),this.im!==null&&this.im.Zp(e),this.sm!==null&&this.sm.Zp(e)}this.Wp.applySuggestedBitmapSize();const r=g5(this.Wp,n);r!==null&&(r.useBitmapCoordinateSpace(({context:s,bitmapSize:a})=>{s.clearRect(0,0,a.width,a.height)}),this.Mm([...this.gp.Qt().js(),this.gp.Qt().sc()],r),this.gm(r,v5n))}gm(e,n){const r=this.gp.Qt().js();for(const s of r)Wse(n,a=>Vse(a,e,!1,void 0),s,void 0);for(const s of r)Wse(n,a=>kM(a,e,!1,void 0),s,void 0)}Jp({context:e,bitmapSize:n}){Tz(e,0,0,n.width,n.height,this.gp.Qt().Vc())}Qp({context:e,bitmapSize:n,verticalPixelRatio:r}){if(this.gp.N().timeScale.borderVisible){e.fillStyle=this.bm();const s=Math.max(1,Math.floor(this.vm().S*r));e.fillRect(0,0,n.width,s)}}iv(e){const n=this.gp.Qt().At(),r=n.Va();if(!r||r.length===0)return;const s=this.i_.maxTickMarkWeight(r),a=this.vm(),o=n.N();o.borderVisible&&o.ticksVisible&&e.useBitmapCoordinateSpace(({context:l,horizontalPixelRatio:c,verticalPixelRatio:u})=>{l.strokeStyle=this.bm(),l.fillStyle=this.bm();const d=Math.max(1,Math.floor(c)),f=Math.floor(.5*c);l.beginPath();const x=Math.round(a.C*u);for(let g=r.length;g--;){const y=Math.round(r[g].coord*c);l.rect(y-f,0,d,x)}l.fill()}),e.useMediaCoordinateSpace(({context:l})=>{const c=a.S+a.C+a.A+a.k/2;l.textAlign="center",l.textBaseline="middle",l.fillStyle=this.H(),l.font=this.Yp();for(const u of r)if(u.weight<s){const d=u.needAlignCoordinate?this.Sm(l,u.coord,u.label):u.coord;l.fillText(u.label,d,c)}this.gp.N().timeScale.allowBoldLabels&&(l.font=this.xm());for(const u of r)if(u.weight>=s){const d=u.needAlignCoordinate?this.Sm(l,u.coord,u.label):u.coord;l.fillText(u.label,d,c)}})}Sm(e,n,r){const s=this.Tp.Vi(e,r),a=s/2,o=Math.floor(n-a)+.5;return o<0?n+=Math.abs(0-o):o+s>this.kp.width&&(n-=Math.abs(this.kp.width-(o+s))),n}Mm(e,n){const r=this.vm();for(const s of e)for(const a of s.cs())a.Tt().nt(n,r)}bm(){return this.gp.N().timeScale.borderColor}H(){return this.ys.textColor}W(){return this.ys.fontSize}Yp(){return aB(this.W(),this.ys.fontFamily)}xm(){return aB(this.W(),this.ys.fontFamily,"bold")}vm(){this.M===null&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,k:NaN,P:"",Gi:new oB,wm:0});const e=this.M,n=this.Yp();if(e.P!==n){const r=this.W();e.k=r,e.P=n,e.A=3*r/12,e.V=3*r/12,e.Ji=9*r/12,e.L=0,e.wm=4*r/12,e.Gi.In()}return this.M}ev(e){this.Ef.style.cursor=e===1?"ew-resize":"default"}om(){const e=this.gp.Qt(),n=e.N();n.leftPriceScale.visible||this.im===null||(this.hm.removeChild(this.im.Of()),this.im.m(),this.im=null),n.rightPriceScale.visible||this.sm===null||(this.am.removeChild(this.sm.Of()),this.sm.m(),this.sm=null);const r={Sc:this.gp.Qt().Sc()},s=()=>n.leftPriceScale.borderVisible&&e.At().N().borderVisible,a=()=>e.Vc();n.leftPriceScale.visible&&this.im===null&&(this.im=new Hje("left",n,r,s,a),this.hm.appendChild(this.im.Of())),n.rightPriceScale.visible&&this.sm===null&&(this.sm=new Hje("right",n,r,s,a),this.am.appendChild(this.sm.Of()))}}var x8e;const S5n=!!jA&&!!navigator.userAgentData&&navigator.userAgentData.brands.some(t=>t.brand.includes("Chromium"))&&!!jA&&((x8e=navigator==null?void 0:navigator.userAgentData)!=null&&x8e.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);class N5n{constructor(e,n,r){var s;this.Cm=[],this.ym=[],this.km=0,this.tl=0,this.fo=0,this.Pm=0,this.Tm=0,this.Rm=null,this.Dm=!1,this.uv=new El,this.cv=new El,this.Wu=new El,this.Vm=null,this.Im=null,this.wp=e,this.ys=n,this.i_=r,this.pp=document.createElement("div"),this.pp.classList.add("tv-lightweight-charts"),this.pp.style.overflow="hidden",this.pp.style.direction="ltr",this.pp.style.width="100%",this.pp.style.height="100%",(s=this.pp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.Bm=document.createElement("table"),this.Bm.setAttribute("cellspacing","0"),this.pp.appendChild(this.Bm),this.Am=this.Em.bind(this),NZ(this.ys)&&this.zm(!0),this.ts=new l5n(this.Hu.bind(this),this.ys,r),this.Qt().nc().i(this.Lm.bind(this),this),this.Om=new C5n(this,this.i_),this.Bm.appendChild(this.Om.Of());const a=n.autoSize&&this.Nm();let o=this.ys.width,l=this.ys.height;if(a||o===0||l===0){const c=e.getBoundingClientRect();o=o||c.width,l=l||c.height}this.Wm(o,l),this.Fm(),e.appendChild(this.pp),this.Hm(),this.ts.At().Cu().i(this.ts.Bh.bind(this.ts),this),this.ts.yo().i(this.ts.Bh.bind(this.ts),this)}Qt(){return this.ts}N(){return this.ys}If(){return this.Cm}Um(){return this.Om}m(){this.zm(!1),this.km!==0&&window.cancelAnimationFrame(this.km),this.ts.nc().u(this),this.ts.At().Cu().u(this),this.ts.yo().u(this),this.ts.m();for(const e of this.Cm)this.Bm.removeChild(e.Of()),e.Lv().u(this),e.Ov().u(this),e.m();this.Cm=[];for(const e of this.ym)this.$m(e);this.ym=[],Jr(this.Om).m(),this.pp.parentElement!==null&&this.pp.parentElement.removeChild(this.pp),this.Wu.m(),this.uv.m(),this.cv.m(),this.qm()}Wm(e,n,r=!1){if(this.tl===n&&this.fo===e)return;const s=function(l){const c=Math.floor(l.width),u=Math.floor(l.height);return Qa({width:c-c%2,height:u-u%2})}(Qa({width:e,height:n}));this.tl=s.height,this.fo=s.width;const a=this.tl+"px",o=this.fo+"px";Jr(this.pp).style.height=a,Jr(this.pp).style.width=o,this.Bm.style.height=a,this.Bm.style.width=o,r?this.Ym(Qc.gn(),performance.now()):this.ts.Bh()}Zp(e){e===void 0&&(e=Qc.gn());for(let n=0;n<this.Cm.length;n++)this.Cm[n].Zp(e.en(n).tn);this.ys.timeScale.visible&&this.Om.Zp(e.nn())}hr(e){var s;const n=NZ(this.ys);this.ts.hr(e);const r=NZ(this.ys);r!==n&&this.zm(r),(s=e.layout)!=null&&s.panes&&this.jm(),this.Hm(),this.Km(e)}Lv(){return this.uv}Ov(){return this.cv}nc(){return this.Wu}Xm(){this.Rm!==null&&(this.Ym(this.Rm,performance.now()),this.Rm=null);const e=this.Zm(null),n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=Jr(n.getContext("2d"));return this.Zm(r),n}Gm(e){return e==="left"&&!this.Jm()||e==="right"&&!this.Qm()||this.Cm.length===0?0:Jr(e==="left"?this.Cm[0].qv():this.Cm[0].Yv()).Xp()}tw(){return this.ys.autoSize&&this.Vm!==null}Uf(){return this.pp}iw(e){this.Im=e,this.Im?this.Uf().style.setProperty("cursor",e):this.Uf().style.removeProperty("cursor")}sw(){return this.Im}nw(e){return yf(this.Cm[e]).Nf()}jm(){this.ym.forEach(e=>{e.kt()})}Km(e){(e.autoSize!==void 0||!this.Vm||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.Vm&&this.Nm(),e.autoSize===!1&&this.Vm!==null&&this.qm(),e.autoSize||e.width===void 0&&e.height===void 0||this.Wm(e.width||this.fo,e.height||this.tl))}Zm(e){let n=0,r=0;const s=this.Cm[0],a=(l,c)=>{let u=0;for(let d=0;d<this.Cm.length;d++){const f=this.Cm[d],x=Jr(l==="left"?f.qv():f.Yv()),g=x.Wf();if(e!==null&&x.Ff(e,c,u),u+=g.height,d<this.Cm.length-1){const y=this.ym[d],v=y.Wf();e!==null&&y.Ff(e,c,u),u+=v.height}}};this.Jm()&&(a("left",0),n+=Jr(s.qv()).Wf().width);for(let l=0;l<this.Cm.length;l++){const c=this.Cm[l],u=c.Wf();if(e!==null&&c.Ff(e,n,r),r+=u.height,l<this.Cm.length-1){const d=this.ym[l],f=d.Wf();e!==null&&d.Ff(e,n,r),r+=f.height}}n+=s.Wf().width,this.Qm()&&(a("right",n),n+=Jr(s.Yv()).Wf().width);const o=(l,c,u)=>{Jr(l==="left"?this.Om._m():this.Om.um()).Ff(Jr(e),c,u)};if(this.ys.timeScale.visible){const l=this.Om.Wf();if(e!==null){let c=0;this.Jm()&&(o("left",c,r),c=Jr(s.qv()).Wf().width),this.Om.Ff(e,c,r),c+=l.width,this.Qm()&&o("right",c,r)}r+=l.height}return Qa({width:n,height:r})}ew(){let e=0,n=0,r=0;for(const C of this.Cm)this.Jm()&&(n=Math.max(n,Jr(C.qv()).qp(),this.ys.leftPriceScale.minimumWidth)),this.Qm()&&(r=Math.max(r,Jr(C.Yv()).qp(),this.ys.rightPriceScale.minimumWidth)),e+=C.ko();n=Hse(n),r=Hse(r);const s=this.fo,a=this.tl,o=Math.max(s-n-r,0),l=1*this.ym.length,c=this.ys.timeScale.visible;let u=c?Math.max(this.Om.pm(),this.ys.timeScale.minimumHeight):0;var d;u=(d=u)+d%2;const f=l+u,x=a<f?0:a-f,g=x/e;let y=0;const v=window.devicePixelRatio||1;for(let C=0;C<this.Cm.length;++C){const N=this.Cm[C];N.yv(this.ts.$s()[C]);let P=0,T=0;T=C===this.Cm.length-1?Math.ceil((x-y)*v)/v:Math.round(N.ko()*g*v)/v,P=Math.max(T,2),y+=P,N.Kp(Qa({width:o,height:P})),this.Jm()&&N.Wv(n,"left"),this.Qm()&&N.Wv(r,"right"),N.Xf()&&this.ts.ec(N.Xf(),P)}this.Om.fm(Qa({width:c?o:0,height:u}),c?n:0,c?r:0),this.ts.To(o),this.Pm!==n&&(this.Pm=n),this.Tm!==r&&(this.Tm=r)}zm(e){e?this.pp.addEventListener("wheel",this.Am,{passive:!1}):this.pp.removeEventListener("wheel",this.Am)}rw(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return S5n?1/window.devicePixelRatio:1}Em(e){if(!(e.deltaX!==0&&this.ys.handleScroll.mouseWheel||e.deltaY!==0&&this.ys.handleScale.mouseWheel))return;const n=this.rw(e),r=n*e.deltaX/100,s=-n*e.deltaY/100;if(e.cancelable&&e.preventDefault(),s!==0&&this.ys.handleScale.mouseWheel){const a=Math.sign(s)*Math.min(1,Math.abs(s)),o=e.clientX-this.pp.getBoundingClientRect().left;this.Qt()._c(o,a)}r!==0&&this.ys.handleScroll.mouseWheel&&this.Qt().uc(-80*r)}Ym(e,n){var s;const r=e.nn();r===3&&this.hw(),r!==3&&r!==2||(this.aw(e),this.lw(e,n),this.Om.kt(),this.Cm.forEach(a=>{a.Pv()}),((s=this.Rm)==null?void 0:s.nn())===3&&(this.Rm.vn(e),this.hw(),this.aw(this.Rm),this.lw(this.Rm,n),e=this.Rm,this.Rm=null)),this.Zp(e)}lw(e,n){for(const r of e.pn())this.mn(r,n)}aw(e){const n=this.ts.$s();for(let r=0;r<n.length;r++)e.en(r).sn&&n[r].Uo()}mn(e,n){const r=this.ts.At();switch(e.an){case 0:r.ku();break;case 1:r.Pu(e.Ft);break;case 2:r.dn(e.Ft);break;case 3:r.fn(e.Ft);break;case 4:r.du();break;case 5:e.Ft.Mu(n)||r.fn(e.Ft.bu(n))}}Hu(e){this.Rm!==null?this.Rm.vn(e):this.Rm=e,this.Dm||(this.Dm=!0,this.km=window.requestAnimationFrame(n=>{if(this.Dm=!1,this.km=0,this.Rm!==null){const r=this.Rm;this.Rm=null,this.Ym(r,n);for(const s of r.pn())if(s.an===5&&!s.Ft.Mu(n)){this.Qt()._n(s.Ft);break}}}))}hw(){this.Fm()}$m(e){this.Bm.removeChild(e.Of()),e.m()}Fm(){const e=this.ts.$s(),n=e.length,r=this.Cm.length;for(let s=n;s<r;s++){const a=yf(this.Cm.pop());this.Bm.removeChild(a.Of()),a.Lv().u(this),a.Ov().u(this),a.m();const o=this.ym.pop();o!==void 0&&this.$m(o)}for(let s=r;s<n;s++){const a=new Sfe(this,e[s]);if(a.Lv().i(this.ow.bind(this,a),this),a.Ov().i(this._w.bind(this,a),this),this.Cm.push(a),s>0){const o=new p5n(this,s-1,s);this.ym.push(o),this.Bm.insertBefore(o.Of(),this.Om.Of())}this.Bm.insertBefore(a.Of(),this.Om.Of())}for(let s=0;s<n;s++){const a=e[s],o=this.Cm[s];o.Xf()!==a?o.yv(a):o.Cv()}this.Hm(),this.ew()}uw(e,n,r,s){var f;const a=new Map;e!==null&&this.ts.js().forEach(x=>{const g=x.Xs().Wr(e);g!==null&&a.set(x,g)});let o;if(e!==null){const x=(f=this.ts.At().ss(e))==null?void 0:f.originalTime;x!==void 0&&(o=x)}const l=this.Qt().Gu(),c=l!==null&&l.Xo instanceof Oz?l.Xo:void 0,u=l!==null&&l.Zo!==void 0?l.Zo.Kn:void 0,d=this.cw(s);return{dw:o,Re:e??void 0,fw:n??void 0,pw:d!==-1?d:void 0,mw:c,ww:a,gw:u,Mw:r??void 0}}cw(e){let n=-1;if(e)n=this.Cm.indexOf(e);else{const r=this.Qt().sc().Us();r!==null&&(n=this.Qt().$s().indexOf(r))}return n}ow(e,n,r,s){this.uv.p(()=>this.uw(n,r,s,e))}_w(e,n,r,s){this.cv.p(()=>this.uw(n,r,s,e))}Lm(e,n,r){var s;this.iw(((s=this.Qt().Gu())==null?void 0:s.Jo)??null),this.Wu.p(()=>this.uw(e,n,r))}Hm(){const e=this.ys.timeScale.visible?"":"none";this.Om.Of().style.display=e}Jm(){return this.Cm[0].Xf().Bo().N().visible}Qm(){return this.Cm[0].Xf().Ao().N().visible}Nm(){return"ResizeObserver"in window&&(this.Vm=new ResizeObserver(e=>{const n=e[e.length-1];n&&this.Wm(n.contentRect.width,n.contentRect.height)}),this.Vm.observe(this.wp,{box:"border-box"}),!0)}qm(){this.Vm!==null&&this.Vm.disconnect(),this.Vm=null}}function NZ(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function A5n(t){return t.open===void 0&&t.value===void 0}function j5n(t){return function(e){return e.open!==void 0}(t)||function(e){return e.value!==void 0}(t)}function Vje(t,e,n,r){const s=n.value,a={Re:e,wt:t,Ft:[s,s,s,s],dw:r};return n.color!==void 0&&(a.R=n.color),a}function E5n(t,e,n,r){const s=n.value,a={Re:e,wt:t,Ft:[s,s,s,s],dw:r};return n.lineColor!==void 0&&(a.vt=n.lineColor),n.topColor!==void 0&&(a.mr=n.topColor),n.bottomColor!==void 0&&(a.wr=n.bottomColor),a}function _5n(t,e,n,r){const s=n.value,a={Re:e,wt:t,Ft:[s,s,s,s],dw:r};return n.topLineColor!==void 0&&(a.gr=n.topLineColor),n.bottomLineColor!==void 0&&(a.Mr=n.bottomLineColor),n.topFillColor1!==void 0&&(a.br=n.topFillColor1),n.topFillColor2!==void 0&&(a.Sr=n.topFillColor2),n.bottomFillColor1!==void 0&&(a.Cr=n.bottomFillColor1),n.bottomFillColor2!==void 0&&(a.yr=n.bottomFillColor2),a}function k5n(t,e,n,r){const s={Re:e,wt:t,Ft:[n.open,n.high,n.low,n.close],dw:r};return n.color!==void 0&&(s.R=n.color),s}function T5n(t,e,n,r){const s={Re:e,wt:t,Ft:[n.open,n.high,n.low,n.close],dw:r};return n.color!==void 0&&(s.R=n.color),n.borderColor!==void 0&&(s.Ht=n.borderColor),n.wickColor!==void 0&&(s.vr=n.wickColor),s}function P5n(t,e,n,r,s){const a=yf(s)(n),o=Math.max(...a),l=Math.min(...a),c=a[a.length-1],u=[c,o,l,c],{time:d,color:f,...x}=n;return{Re:e,wt:t,Ft:u,dw:r,se:x,R:f}}function L7(t){return t.Ft!==void 0}function Wje(t,e){return e.customValues!==void 0&&(t.bw=e.customValues),t}function $v(t){return(e,n,r,s,a,o)=>function(l,c){return c?c(l):A5n(l)}(r,o)?Wje({wt:e,Re:n,dw:s},r):Wje(t(e,n,r,s,a),r)}function qje(t){return{Candlestick:$v(T5n),Bar:$v(k5n),Area:$v(E5n),Baseline:$v(_5n),Histogram:$v(Vje),Line:$v(Vje),Custom:$v(P5n)}[t]}function Gje(t){return{Re:0,Sw:new Map,Hh:t}}function Kje(t,e){if(t!==void 0&&t.length!==0)return{xw:e.key(t[0].wt),Cw:e.key(t[t.length-1].wt)}}function Yje(t){let e;return t.forEach(n=>{e===void 0&&(e=n.dw)}),yf(e)}class I5n{constructor(e){this.yw=new Map,this.kw=new Map,this.Pw=new Map,this.Tw=[],this.i_=e}m(){this.yw.clear(),this.kw.clear(),this.Pw.clear(),this.Tw=[]}Rw(e,n){let r=this.yw.size!==0,s=!1;const a=this.kw.get(e);if(a!==void 0)if(this.kw.size===1)r=!1,s=!0,this.yw.clear();else for(const c of this.Tw)c.pointData.Sw.delete(e)&&(s=!0);let o=[];if(n.length!==0){const c=n.map(g=>g.time),u=this.i_.createConverterToInternalObj(n),d=qje(e.Rr()),f=e.da(),x=e.pa();o=n.map((g,y)=>{const v=u(g.time),C=this.i_.key(v);let N=this.yw.get(C);N===void 0&&(N=Gje(v),this.yw.set(C,N),s=!0);const P=d(v,N.Re,g,c[y],f,x);return N.Sw.set(e,P),P})}r&&this.Dw(),this.Vw(e,o);let l=-1;if(s){const c=[];this.yw.forEach(u=>{c.push({timeWeight:0,time:u.Hh,pointData:u,originalTime:Yje(u.Sw)})}),c.sort((u,d)=>this.i_.key(u.time)-this.i_.key(d.time)),l=this.Iw(c)}return this.Bw(e,l,function(c,u,d){const f=Kje(c,d),x=Kje(u,d);if(f!==void 0&&x!==void 0)return{Aw:!1,zh:f.Cw>=x.Cw&&f.xw>=x.xw}}(this.kw.get(e),a,this.i_))}yc(e){return this.Rw(e,[])}Ew(e,n,r){const s=n;(function(C){C.dw===void 0&&(C.dw=C.time)})(s),this.i_.preprocessData(n);const a=this.i_.createConverterToInternalObj([n])(n.time),o=this.Pw.get(e);if(!r&&o!==void 0&&this.i_.key(a)<this.i_.key(o))throw new Error(`Cannot update oldest data, last time=${o}, new time=${a}`);let l=this.yw.get(this.i_.key(a));if(r&&l===void 0)throw new Error("Cannot update non-existing data point when historicalUpdate is true");const c=l===void 0;l===void 0&&(l=Gje(a),this.yw.set(this.i_.key(a),l));const u=qje(e.Rr()),d=e.da(),f=e.pa(),x=u(a,l.Re,n,s.dw,d,f);l.Sw.set(e,x),r?this.zw(e,x,l.Re):this.Lw(e,x);const g={zh:L7(x),Aw:r};if(!c)return this.Bw(e,-1,g);const y={timeWeight:0,time:l.Hh,pointData:l,originalTime:Yje(l.Sw)},v=AA(this.Tw,this.i_.key(y.time),(C,N)=>this.i_.key(C.time)<N);this.Tw.splice(v,0,y);for(let C=v;C<this.Tw.length;++C)AZ(this.Tw[C].pointData,C);return this.i_.fillWeightsForPoints(this.Tw,v),this.Bw(e,v,g)}Lw(e,n){let r=this.kw.get(e);r===void 0&&(r=[],this.kw.set(e,r));const s=r.length!==0?r[r.length-1]:null;s===null||this.i_.key(n.wt)>this.i_.key(s.wt)?L7(n)&&r.push(n):L7(n)?r[r.length-1]=n:r.splice(-1,1),this.Pw.set(e,n.wt)}zw(e,n,r){const s=this.kw.get(e);if(s===void 0)return;const a=AA(s,r,(o,l)=>o.Re<l);L7(n)?s[a]=n:s.splice(a,1)}Vw(e,n){n.length!==0?(this.kw.set(e,n.filter(L7)),this.Pw.set(e,n[n.length-1].wt)):(this.kw.delete(e),this.Pw.delete(e))}Dw(){for(const e of this.Tw)e.pointData.Sw.size===0&&this.yw.delete(this.i_.key(e.time))}Iw(e){let n=-1;for(let r=0;r<this.Tw.length&&r<e.length;++r){const s=this.Tw[r],a=e[r];if(this.i_.key(s.time)!==this.i_.key(a.time)){n=r;break}a.timeWeight=s.timeWeight,AZ(a.pointData,r)}if(n===-1&&this.Tw.length!==e.length&&(n=Math.min(this.Tw.length,e.length)),n===-1)return-1;for(let r=n;r<e.length;++r)AZ(e[r].pointData,r);return this.i_.fillWeightsForPoints(e,n),this.Tw=e,n}Ow(){if(this.kw.size===0)return null;let e=0;return this.kw.forEach(n=>{n.length!==0&&(e=Math.max(e,n[n.length-1].Re))}),e}Bw(e,n,r){const s={Do:new Map,At:{iu:this.Ow()}};if(n!==-1)this.kw.forEach((a,o)=>{s.Do.set(o,{se:a,Nw:o===e?r:void 0})}),this.kw.has(e)||s.Do.set(e,{se:[],Nw:r}),s.At.Ww=this.Tw,s.At.Fw=n;else{const a=this.kw.get(e);s.Do.set(e,{se:a||[],Nw:r})}return s}}function AZ(t,e){t.Re=e,t.Sw.forEach(n=>{n.Re=e})}function F5n(t,e){return t.wt<e}function O5n(t,e){return e<t.wt}function M5n(t,e,n){const r=e.Uh(),s=e.bi(),a=AA(t,r,F5n),o=xKe(t,s,O5n);if(!n)return{from:a,to:o};let l=a,c=o;return a>0&&a<t.length&&t[a].wt>=r&&(l=a-1),o>0&&o<t.length&&t[o-1].wt<=s&&(c=o+1),{from:l,to:c}}class SKe{constructor(e,n,r){this.Hw=!0,this.Uw=!0,this.$w=!0,this.qw=[],this.Yw=null,this.Jn=e,this.Qn=n,this.jw=r}kt(e){this.Hw=!0,e==="data"&&(this.Uw=!0),e==="options"&&(this.$w=!0)}Tt(){return this.Jn.Vt()?(this.Kw(),this.Yw===null?null:this.Xw):null}Zw(){this.qw=this.qw.map(e=>({...e,...this.Jn.Rh().Dr(e.wt)}))}Gw(){this.Yw=null}Kw(){this.Uw&&(this.Jw(),this.Uw=!1),this.$w&&(this.Zw(),this.$w=!1),this.Hw&&(this.Qw(),this.Hw=!1)}Qw(){const e=this.Jn.Wt(),n=this.Qn.At();if(this.Gw(),n.Ki()||e.Ki())return;const r=n.ye();if(r===null||this.Jn.Xs().zr()===0)return;const s=this.Jn.zt();s!==null&&(this.Yw=M5n(this.qw,r,this.jw),this.tg(e,n,s.Ft),this.ig())}}class R5n{constructor(e,n){this.sg=e,this.Yi=n}nt(e,n,r){this.sg.draw(e,this.Yi,n,r)}}class L5n extends SKe{constructor(e,n,r){super(e,n,!1),this.sh=r,this.Xw=new R5n(this.sh.renderer(),s=>{const a=e.zt();return a===null?null:e.Wt().Nt(s,a.Ft)})}fa(e){return this.sh.priceValueBuilder(e)}va(e){return this.sh.isWhitespace(e)}Jw(){const e=this.Jn.Rh();this.qw=this.Jn.Xs().Hr().map(n=>({wt:n.Re,_t:NaN,...e.Dr(n.Re),ng:n.se}))}tg(e,n){n.su(this.qw,Use(this.Yw))}ig(){this.sh.update({bars:this.qw.map(D5n),barSpacing:this.Qn.At().lu(),visibleRange:this.Yw},this.Jn.N())}}function D5n(t){return{x:t._t,time:t.wt,originalData:t.ng,barColor:t.cr}}const B5n={color:"#2196f3"},$5n=(t,e,n)=>{const r=Fy(n);return new L5n(t,e,r)};function Afe(t){const e={value:t.Ft[3],time:t.dw};return t.bw!==void 0&&(e.customValues=t.bw),e}function Xje(t){const e=Afe(t);return t.R!==void 0&&(e.color=t.R),e}function U5n(t){const e=Afe(t);return t.vt!==void 0&&(e.lineColor=t.vt),t.mr!==void 0&&(e.topColor=t.mr),t.wr!==void 0&&(e.bottomColor=t.wr),e}function z5n(t){const e=Afe(t);return t.gr!==void 0&&(e.topLineColor=t.gr),t.Mr!==void 0&&(e.bottomLineColor=t.Mr),t.br!==void 0&&(e.topFillColor1=t.br),t.Sr!==void 0&&(e.topFillColor2=t.Sr),t.Cr!==void 0&&(e.bottomFillColor1=t.Cr),t.yr!==void 0&&(e.bottomFillColor2=t.yr),e}function NKe(t){const e={open:t.Ft[0],high:t.Ft[1],low:t.Ft[2],close:t.Ft[3],time:t.dw};return t.bw!==void 0&&(e.customValues=t.bw),e}function H5n(t){const e=NKe(t);return t.R!==void 0&&(e.color=t.R),e}function V5n(t){const e=NKe(t),{R:n,Ht:r,vr:s}=t;return n!==void 0&&(e.color=n),r!==void 0&&(e.borderColor=r),s!==void 0&&(e.wickColor=s),e}function qse(t){return{Area:U5n,Line:Xje,Baseline:z5n,Histogram:Xje,Bar:H5n,Candlestick:V5n,Custom:W5n}[t]}function W5n(t){const e=t.dw;return{...t.se,time:e}}const q5n={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},G5n={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},K5n={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:cKe,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},jZ={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0,ensureEdgeTickMarksVisible:!1},Y5n={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function Qje(){return{width:0,height:0,autoSize:!1,layout:K5n,crosshair:q5n,grid:G5n,overlayPriceScales:{...jZ},leftPriceScale:{...jZ,visible:!1},rightPriceScale:{...jZ,visible:!0},timeScale:Y5n,localization:{locale:jA?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class AKe{constructor(e,n,r){this.Df=e,this.eg=n,this.rg=r??0}applyOptions(e){this.Df.Qt().Qu(this.eg,e,this.rg)}options(){return this.Yi().N()}width(){return Iz(this.eg)?this.Df.Gm(this.eg):0}setVisibleRange(e){this.setAutoScale(!1),this.Yi().Nl(new wd(e.from,e.to))}getVisibleRange(){const e=this.Yi().Qe();return e===null?null:{from:e.$e(),to:e.qe()}}setAutoScale(e){this.applyOptions({autoScale:e})}Yi(){return Jr(this.Df.Qt().tc(this.eg,this.rg)).Wt}}class X5n{constructor(e,n,r,s){this.Df=e,this.yt=r,this.hg=n,this.ag=s}getHeight(){return this.yt.$t()}setHeight(e){const n=this.Df.Qt(),r=n.Bc(this.yt);n.hc(r,e)}paneIndex(){return this.Df.Qt().Bc(this.yt)}moveTo(e){const n=this.paneIndex();n!==e&&(Fu(e>=0&&e<this.Df.If().length,"Invalid pane index"),this.Df.Qt().ac(n,e))}getSeries(){return this.yt.Do().map(e=>this.hg(e))??[]}getHTMLElement(){return this.Df.If()[this.paneIndex()].Of()}attachPrimitive(e){this.yt.ua(e),e.attached&&e.attached({chart:this.ag,requestUpdate:()=>this.yt.Qt().Bh()})}detachPrimitive(e){this.yt.ca(e)}priceScale(e){if(this.yt.Co(e)===null)throw new Error(`Cannot find price scale with id: ${e}`);return new AKe(this.Df,e,this.paneIndex())}}const Q5n={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class Zje{constructor(e){this.ir=e}applyOptions(e){this.ir.hr(e)}options(){return this.ir.N()}lg(){return this.ir}}class Z5n{constructor(e,n,r,s,a,o){this.og=new El,this.Jn=e,this._g=n,this.ug=r,this.i_=a,this.ag=s,this.cg=o}m(){this.og.m()}priceFormatter(){return this.Jn.ra()}priceToCoordinate(e){const n=this.Jn.zt();return n===null?null:this.Jn.Wt().Nt(e,n.Ft)}coordinateToPrice(e){const n=this.Jn.zt();return n===null?null:this.Jn.Wt().Ts(e,n.Ft)}barsInLogicalRange(e){if(e===null)return null;const n=new H4(new J9(e.from,e.to)).w_(),r=this.Jn.Xs();if(r.Ki())return null;const s=r.Wr(n.Uh(),1),a=r.Wr(n.bi(),-1),o=Jr(r.Lr()),l=Jr(r.Ks());if(s!==null&&a!==null&&s.Re>a.Re)return{barsBefore:e.from-o,barsAfter:l-e.to};const c={barsBefore:s===null||s.Re===o?e.from-o:s.Re-o,barsAfter:a===null||a.Re===l?l-e.to:l-a.Re};return s!==null&&a!==null&&(c.from=s.dw,c.to=a.dw),c}setData(e){this.i_,this.Jn.Rr(),this._g.dg(this.Jn,e),this.fg("full")}update(e,n=!1){this.Jn.Rr(),this._g.pg(this.Jn,e,n),this.fg("update")}dataByIndex(e,n){const r=this.Jn.Xs().Wr(e,n);return r===null?null:qse(this.seriesType())(r)}data(){const e=qse(this.seriesType());return this.Jn.Xs().Hr().map(n=>e(n))}subscribeDataChanged(e){this.og.i(e)}unsubscribeDataChanged(e){this.og._(e)}applyOptions(e){this.Jn.hr(e)}options(){return Xg(this.Jn.N())}priceScale(){return this.ug.priceScale(this.Jn.Wt().wa(),this.getPane().paneIndex())}createPriceLine(e){const n=nh(Xg(Q5n),e),r=this.Jn.Oh(n);return new Zje(r)}removePriceLine(e){this.Jn.Nh(e.lg())}priceLines(){return this.Jn.Wh().map(e=>new Zje(e))}seriesType(){return this.Jn.Rr()}attachPrimitive(e){this.Jn.ua(e),e.attached&&e.attached({chart:this.ag,series:this,requestUpdate:()=>this.Jn.Qt().Bh(),horzScaleBehavior:this.i_})}detachPrimitive(e){this.Jn.ca(e),e.detached&&e.detached(),this.Jn.Qt().Bh()}getPane(){const e=this.Jn,n=Jr(this.Jn.Qt().Hn(e));return this.cg(n)}moveToPane(e){this.Jn.Qt().Rc(this.Jn,e)}seriesOrder(){const e=this.Jn.Qt().Hn(this.Jn);return e===null?-1:e.Do().indexOf(this.Jn)}setSeriesOrder(e){const n=this.Jn.Qt().Hn(this.Jn);n!==null&&n.qo(this.Jn,e)}fg(e){this.og.v()&&this.og.p(e)}}class J5n{constructor(e,n,r){this.vg=new El,this.T_=new El,this.rm=new El,this.ts=e,this.uh=e.At(),this.Om=n,this.uh.Su().i(this.mg.bind(this)),this.uh.xu().i(this.wg.bind(this)),this.Om.dm().i(this.gg.bind(this)),this.i_=r}m(){this.uh.Su().u(this),this.uh.xu().u(this),this.Om.dm().u(this),this.vg.m(),this.T_.m(),this.rm.m()}scrollPosition(){return this.uh._u()}scrollToPosition(e,n){n?this.uh.gu(e,1e3):this.ts.fn(e)}scrollToRealTime(){this.uh.wu()}getVisibleRange(){const e=this.uh.K_();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const n={from:this.i_.convertHorzItemToInternal(e.from),to:this.i_.convertHorzItemToInternal(e.to)},r=this.uh.J_(n);this.ts.Pc(r)}getVisibleLogicalRange(){const e=this.uh.j_();return e===null?null:{from:e.Uh(),to:e.bi()}}setVisibleLogicalRange(e){Fu(e.from<=e.to,"The from index cannot be after the to index."),this.ts.Pc(e)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.ku()}logicalToCoordinate(e){const n=this.ts.At();return n.Ki()?null:n.qt(e)}coordinateToLogical(e){return this.uh.Ki()?null:this.uh.nu(e)}timeToIndex(e,n){const r=this.i_.convertHorzItemToInternal(e);return this.uh.U_(r,n)}timeToCoordinate(e){const n=this.timeToIndex(e,!1);return n===null?null:this.uh.qt(n)}coordinateToTime(e){const n=this.ts.At(),r=n.nu(e),s=n.ss(r);return s===null?null:s.originalTime}width(){return this.Om.Nf().width}height(){return this.Om.Nf().height}subscribeVisibleTimeRangeChange(e){this.vg.i(e)}unsubscribeVisibleTimeRangeChange(e){this.vg._(e)}subscribeVisibleLogicalRangeChange(e){this.T_.i(e)}unsubscribeVisibleLogicalRangeChange(e){this.T_._(e)}subscribeSizeChange(e){this.rm.i(e)}unsubscribeSizeChange(e){this.rm._(e)}applyOptions(e){this.uh.hr(e)}options(){return{...Xg(this.uh.N()),barSpacing:this.uh.lu()}}mg(){this.vg.v()&&this.vg.p(this.getVisibleRange())}wg(){this.T_.v()&&this.T_.p(this.getVisibleLogicalRange())}gg(e){this.rm.p(e.width,e.height)}}function e6n(t){if(t===void 0||t.type==="custom")return;const e=t;e.minMove!==void 0&&e.precision===void 0&&(e.precision=function(n){if(n>=1)return 0;let r=0;for(;r<8;r++){const s=Math.round(n);if(Math.abs(s-n)<1e-8)return r;n*=10}return r}(e.minMove))}function Jje(t){return function(e){if(rO(e.handleScale)){const r=e.handleScale;e.handleScale={axisDoubleClickReset:{time:r,price:r},axisPressedMouseMove:{time:r,price:r},mouseWheel:r,pinch:r}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:r,axisDoubleClickReset:s}=e.handleScale;rO(r)&&(e.handleScale.axisPressedMouseMove={time:r,price:r}),rO(s)&&(e.handleScale.axisDoubleClickReset={time:s,price:s})}const n=e.handleScroll;rO(n)&&(e.handleScroll={horzTouchDrag:n,vertTouchDrag:n,mouseWheel:n,pressedMouseMove:n})}(t),t}class t6n{constructor(e,n,r){this.Mg=new Map,this.bg=new Map,this.Sg=new El,this.xg=new El,this.Cg=new El,this.zu=new WeakMap,this.yg=new I5n(n);const s=r===void 0?Xg(Qje()):nh(Xg(Qje()),Jje(r));this.kg=n,this.Df=new N5n(e,s,n),this.Df.Lv().i(o=>{this.Sg.v()&&this.Sg.p(this.Pg(o()))},this),this.Df.Ov().i(o=>{this.xg.v()&&this.xg.p(this.Pg(o()))},this),this.Df.nc().i(o=>{this.Cg.v()&&this.Cg.p(this.Pg(o()))},this);const a=this.Df.Qt();this.Tg=new J5n(a,this.Df.Um(),this.kg)}remove(){this.Df.Lv().u(this),this.Df.Ov().u(this),this.Df.nc().u(this),this.Tg.m(),this.Df.m(),this.Mg.clear(),this.bg.clear(),this.Sg.m(),this.xg.m(),this.Cg.m(),this.yg.m()}resize(e,n,r){this.autoSizeActive()||this.Df.Wm(e,n,r)}addCustomSeries(e,n={},r=0){const s=(a=>({type:"Custom",isBuiltIn:!1,defaultOptions:{...B5n,...a.defaultOptions()},Rg:$5n,Dg:a}))(Fy(e));return this.Vg(s,n,r)}addSeries(e,n={},r=0){return this.Vg(e,n,r)}removeSeries(e){const n=yf(this.Mg.get(e)),r=this.yg.yc(n);this.Df.Qt().yc(n),this.Ig(r),this.Mg.delete(e),this.bg.delete(n)}dg(e,n){this.Ig(this.yg.Rw(e,n))}pg(e,n,r){this.Ig(this.yg.Ew(e,n,r))}subscribeClick(e){this.Sg.i(e)}unsubscribeClick(e){this.Sg._(e)}subscribeCrosshairMove(e){this.Cg.i(e)}unsubscribeCrosshairMove(e){this.Cg._(e)}subscribeDblClick(e){this.xg.i(e)}unsubscribeDblClick(e){this.xg._(e)}priceScale(e,n=0){return new AKe(this.Df,e,n)}timeScale(){return this.Tg}applyOptions(e){this.Df.hr(Jje(e))}options(){return this.Df.N()}takeScreenshot(){return this.Df.Xm()}removePane(e){this.Df.Qt().rc(e)}swapPanes(e,n){this.Df.Qt().ac(e,n)}autoSizeActive(){return this.Df.tw()}chartElement(){return this.Df.Uf()}panes(){return this.Df.Qt().$s().map(e=>this.Bg(e))}paneSize(e=0){const n=this.Df.nw(e);return{height:n.height,width:n.width}}setCrosshairPosition(e,n,r){const s=this.Mg.get(r);if(s===void 0)return;const a=this.Df.Qt().Hn(s);a!==null&&this.Df.Qt().gc(e,n,a)}clearCrosshairPosition(){this.Df.Qt().Mc(!0)}horzBehaviour(){return this.kg}Vg(e,n={},r=0){Fu(e.Rg!==void 0),e6n(n.priceFormat),e.type==="Candlestick"&&function(c){c.borderColor!==void 0&&(c.borderUpColor=c.borderColor,c.borderDownColor=c.borderColor),c.wickColor!==void 0&&(c.wickUpColor=c.wickColor,c.wickDownColor=c.wickColor)}(n);const s=nh(Xg(oKe),Xg(e.defaultOptions),n),a=e.Rg,o=new Oz(this.Df.Qt(),e.type,s,a,e.Dg);this.Df.Qt().xc(o,r);const l=new Z5n(o,this,this,this,this.kg,c=>this.Bg(c));return this.Mg.set(l,o),this.bg.set(o,l),l}Ig(e){const n=this.Df.Qt();n.bc(e.At.iu,e.At.Ww,e.At.Fw),e.Do.forEach((r,s)=>s.ht(r.se,r.Nw)),n.At().O_(),n.au()}Ag(e){return yf(this.bg.get(e))}Pg(e){const n=new Map;e.ww.forEach((s,a)=>{const o=a.Rr(),l=qse(o)(s);if(o!=="Custom")Fu(j5n(l));else{const c=a.pa();Fu(!c||c(l)===!1)}n.set(this.Ag(a),l)});const r=e.mw!==void 0&&this.bg.has(e.mw)?this.Ag(e.mw):void 0;return{time:e.dw,logical:e.Re,point:e.fw,paneIndex:e.pw,hoveredSeries:r,hoveredObjectId:e.gw,seriesData:n,sourceEvent:e.Mw}}Bg(e){let n=this.zu.get(e);return n||(n=new X5n(this.Df,r=>this.Ag(r),e,this),this.zu.set(e,n)),n}}function n6n(t){if(dP(t)){const e=document.getElementById(t);return Fu(e!==null,`Cannot find element in DOM with id=${t}`),e}return t}function r6n(t,e,n){const r=n6n(t),s=new t6n(r,e,n);return e.setOptions(s.options()),s}function s6n(t,e){return r6n(t,new Rje,Rje.Xc(e))}class jKe extends SKe{constructor(e,n){super(e,n,!0)}tg(e,n,r){n.su(this.qw,Use(this.Yw)),e.Hl(this.qw,r,Use(this.Yw))}Eg(e,n){return{wt:e,gt:n,_t:NaN,ut:NaN}}Jw(){const e=this.Jn.Rh();this.qw=this.Jn.Xs().Hr().map(n=>{const r=n.Ft[3];return this.zg(n.Re,r,e)})}}function i6n(t,e,n,r,s,a,o){if(e.length===0||r.from>=e.length||r.to<=0)return;const{context:l,horizontalPixelRatio:c,verticalPixelRatio:u}=t,d=e[r.from];let f=a(t,d),x=d;if(r.to-r.from<2){const g=s/2;l.beginPath();const y={_t:d._t-g,ut:d.ut},v={_t:d._t+g,ut:d.ut};l.moveTo(y._t*c,y.ut*u),l.lineTo(v._t*c,v.ut*u),o(t,f,y,v)}else{const g=(v,C)=>{o(t,f,x,C),l.beginPath(),f=v,x=C};let y=x;l.beginPath(),l.moveTo(d._t*c,d.ut*u);for(let v=r.from+1;v<r.to;++v){y=e[v];const C=a(t,y);switch(n){case 0:l.lineTo(y._t*c,y.ut*u);break;case 1:l.lineTo(y._t*c,e[v-1].ut*u),C!==f&&(g(C,y),l.lineTo(y._t*c,e[v-1].ut*u)),l.lineTo(y._t*c,y.ut*u);break;case 2:{const[N,P]=a6n(e,v-1,v);l.bezierCurveTo(N._t*c,N.ut*u,P._t*c,P.ut*u,y._t*c,y.ut*u);break}}n!==1&&C!==f&&(g(C,y),l.moveTo(y._t*c,y.ut*u))}(x!==y||x===y&&n===1)&&o(t,f,x,y)}}const e8e=6;function EZ(t,e){return{_t:t._t-e._t,ut:t.ut-e.ut}}function t8e(t,e){return{_t:t._t/e,ut:t.ut/e}}function a6n(t,e,n){const r=Math.max(0,e-1),s=Math.min(t.length-1,n+1);var a,o;return[(a=t[e],o=t8e(EZ(t[n],t[r]),e8e),{_t:a._t+o._t,ut:a.ut+o.ut}),EZ(t[n],t8e(EZ(t[s],t[e]),e8e))]}function o6n(t,e){const n=t.context;n.strokeStyle=e,n.stroke()}class l6n extends Y5{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et(e){if(this.rt===null)return;const{ot:n,lt:r,Lg:s,Og:a,ct:o,Xt:l,Ng:c}=this.rt;if(r===null)return;const u=e.context;u.lineCap="butt",u.lineWidth=o*e.verticalPixelRatio,SA(u,l),u.lineJoin="round";const d=this.Wg.bind(this);a!==void 0&&i6n(e,n,a,r,s,d,o6n),c&&function(f,x,g,y,v){if(y.to-y.from<=0)return;const{horizontalPixelRatio:C,verticalPixelRatio:N,context:P}=f;let T=null;const M=Math.max(1,Math.floor(C))%2/2,F=g*N+M;for(let $=y.to-1;$>=y.from;--$){const L=x[$];if(L){const z=v(f,L);z!==T&&(P.beginPath(),T!==null&&P.fill(),P.fillStyle=z,T=z);const X=Math.round(L._t*C)+M,ne=L.ut*N;P.moveTo(X,ne),P.arc(X,ne,F,0,2*Math.PI)}}P.fill()}(e,n,c,r,d)}}class c6n extends l6n{Wg(e,n){return n.vt}}class u6n extends jKe{constructor(){super(...arguments),this.Xw=new c6n}zg(e,n,r){return{...this.Eg(e,n),...r.Dr(e)}}ig(){const e=this.Jn.N(),n={ot:this.qw,Xt:e.lineStyle,Og:e.lineVisible?e.lineType:void 0,ct:e.lineWidth,Ng:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,lt:this.Yw,Lg:this.Qn.At().lu()};this.Xw.ht(n)}}const d6n={type:"Line",isBuiltIn:!0,defaultOptions:{color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Rg:(t,e)=>new u6n(t,e)};class f6n extends Y5{constructor(){super(...arguments),this.Yt=null,this.bM=[]}ht(e){this.Yt=e,this.bM=[]}et({context:e,horizontalPixelRatio:n,verticalPixelRatio:r}){if(this.Yt===null||this.Yt.ot.length===0||this.Yt.lt===null)return;this.bM.length||this.SM(n);const s=Math.max(1,Math.floor(r)),a=Math.round(this.Yt.xM*r)-Math.floor(s/2),o=a+s;for(let l=this.Yt.lt.from;l<this.Yt.lt.to;l++){const c=this.Yt.ot[l],u=this.bM[l-this.Yt.lt.from],d=Math.round(c.ut*r);let f,x;e.fillStyle=c.cr,d<=a?(f=d,x=o):(f=a,x=d-Math.floor(s/2)+s),e.fillRect(u.Uh,f,u.bi-u.Uh+1,x-f)}}SM(e){if(this.Yt===null||this.Yt.ot.length===0||this.Yt.lt===null)return void(this.bM=[]);const n=Math.ceil(this.Yt.lu*e)<=1?0:Math.max(1,Math.floor(e)),r=Math.round(this.Yt.lu*e)-n;this.bM=new Array(this.Yt.lt.to-this.Yt.lt.from);for(let a=this.Yt.lt.from;a<this.Yt.lt.to;a++){const o=this.Yt.ot[a],l=Math.round(o._t*e);let c,u;if(r%2){const d=(r-1)/2;c=l-d,u=l+d}else{const d=r/2;c=l-d,u=l+d-1}this.bM[a-this.Yt.lt.from]={Uh:c,bi:u,CM:l,ne:o._t*e,wt:o.wt}}for(let a=this.Yt.lt.from+1;a<this.Yt.lt.to;a++){const o=this.bM[a-this.Yt.lt.from],l=this.bM[a-this.Yt.lt.from-1];o.wt===l.wt+1&&o.Uh-l.bi!==n+1&&(l.CM>l.ne?l.bi=o.Uh-n-1:o.Uh=l.bi+n+1)}let s=Math.ceil(this.Yt.lu*e);for(let a=this.Yt.lt.from;a<this.Yt.lt.to;a++){const o=this.bM[a-this.Yt.lt.from];o.bi<o.Uh&&(o.bi=o.Uh);const l=o.bi-o.Uh+1;s=Math.min(l,s)}if(n>0&&s<4)for(let a=this.Yt.lt.from;a<this.Yt.lt.to;a++){const o=this.bM[a-this.Yt.lt.from];o.bi-o.Uh+1>s&&(o.CM>o.ne?o.bi-=1:o.Uh+=1)}}}class h6n extends jKe{constructor(){super(...arguments),this.Xw=new f6n}zg(e,n,r){return{...this.Eg(e,n),...r.Dr(e)}}ig(){const e={ot:this.qw,lu:this.Qn.At().lu(),lt:this.Yw,xM:this.Jn.Wt().Nt(this.Jn.N().base,Jr(this.Jn.zt()).Ft)};this.Xw.ht(e)}}const p6n={type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},Rg:(t,e)=>new h6n(t,e)};({...oKe});const m6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_rate_history/",x6n="https://dextrabothypev2.nftinit.io/api/hyper/funding_stats/",n8e={ext:"extended",lit:"lighter",hyp:"hyperliquid",var:"variational",ast:"aster",par:"paradex"},r8e={extended:"ext",lighter:"lit",hyperliquid:"hyp",variational:"var",aster:"ast",paradex:"par"},BC={extended:"Extended",lighter:"Lighter",hyperliquid:"Hyperliquid",variational:"Variational",aster:"Aster",paradex:"Paradex"},Gse=[{id:"extended",name:"Extended",icon:"https://app.extended.exchange/assets/logo/extended.svg"},{id:"variational",name:"Variational",iconType:"variational"},{id:"lighter",name:"Lighter",iconType:"lighter"},{id:"hyperliquid",name:"Hyperliquid",iconType:"hyperliquid"},{id:"aster",name:"Aster",iconType:"aster"},{id:"paradex",name:"Paradex",iconType:"paradex"}],uO=({exchangeId:t,className:e="w-4 h-4"})=>{const n=Gse.find(r=>r.id===t);if(!n)return null;if(n.icon)return i.jsx("img",{src:n.icon,alt:n.name,className:e});switch(n.iconType){case"variational":return i.jsx("img",{src:lT,alt:n.name,className:`${e} rounded`});case"lighter":return i.jsx(bf,{className:e});case"hyperliquid":return i.jsx("img",{src:mae,alt:n.name,className:e});case"aster":return i.jsx($A,{className:e});case"paradex":return i.jsx("img",{src:cT,alt:n.name,className:`${e} rounded`});default:return null}},g6n=t=>t?new Date(t.endsWith("Z")?t:t+"Z").toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"",b6n=()=>{const{pair:t}=g2(),e=jo(),[n,r]=m.useState([]),[s,a]=m.useState(!0),[o,l]=m.useState(null),[c,u]=m.useState(null),[d,f]=m.useState([]),x=m.useRef(),g=m.useRef(),[y,v]=m.useState(!1),[C,N]=m.useState(!1),[P,T]=m.useState(!1),M=m.useRef(null),F=m.useRef(null),$=m.useRef(null),L=Ne.useMemo(()=>{if(!t)return null;const K=t.toLowerCase().split("-");if(K.length<3)return null;const te=K[0],fe=K[1],q=K.slice(2).join("-").toUpperCase(),se=n8e[te],ae=n8e[fe];return!se||!ae?null:{longSide:se,shortSide:ae,ticker:q}},[t]);m.useEffect(()=>{const K=te=>{M.current&&!M.current.contains(te.target)&&v(!1),F.current&&!F.current.contains(te.target)&&N(!1),$.current&&!$.current.contains(te.target)&&T(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const z=(K,te,fe)=>{const q=r8e[K],se=r8e[te];e(`/funding-history/${q}-${se}-${fe.toLowerCase()}`)},X=()=>{L&&z(L.shortSide,L.longSide,L.ticker)};m.useEffect(()=>{if(!L){l("Invalid URL parameters"),a(!1);return}(async()=>{try{a(!0);const fe=await(await fetch(m6n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({long_side:L.longSide,short_side:L.shortSide,ticker:L.ticker})})).json();if(fe.success&&Array.isArray(fe.data)){const q=[...fe.data].sort((se,ae)=>Number(se.timestamp)-Number(ae.timestamp));r(q),l(null)}else l("Failed to fetch funding history data")}catch(te){l(te.message||"Failed to fetch data")}finally{a(!1)}})()},[L]),m.useEffect(()=>{if(!L)return;const K=async()=>{var fe,q;try{const ae=await(await fetch(x6n)).json();if(ae.success&&Array.isArray(ae.data)){const W=ae.data.map(ee=>ee.ticker).sort();f(W);const V=ae.data.find(ee=>ee.ticker===L.ticker);if(V){const ee=(fe=V.marketplaces)==null?void 0:fe[L.longSide],oe=(q=V.marketplaces)==null?void 0:q[L.shortSide];if(ee!=null&&ee.available&&(oe!=null&&oe.available)){const de=parseFloat(ee.hourly_rate)||0,Ce=parseFloat(oe.hourly_rate)||0,me=(Ce-de)*8760*100;u({apr:me,longRate:de*100,shortRate:Ce*100,updatedAt:ae.updated_at})}else u(null)}else u(null)}}catch(se){console.error("Failed to fetch live data:",se)}};K();const te=setInterval(K,5e3);return()=>clearInterval(te)},[L]),m.useEffect(()=>{if(!x.current||s||o||n.length===0)return;const K=x.current,te=s6n(K,{layout:{background:{color:"#0f0f0f"},textColor:"#9ca3af",fontFamily:"system-ui, -apple-system, sans-serif"},grid:{vertLines:{color:"rgba(255, 255, 255, 0.02)"},horzLines:{color:"rgba(255, 255, 255, 0.02)"}},crosshair:{mode:1,vertLine:{color:"rgba(255, 255, 255, 0.1)",width:1,style:0,labelBackgroundColor:"#262626"},horzLine:{color:"rgba(255, 255, 255, 0.1)",width:1,style:0,labelBackgroundColor:"#262626"}},rightPriceScale:{borderVisible:!1},timeScale:{borderVisible:!1,visible:!0,timeVisible:!0,secondsVisible:!1},autoSize:!0,localization:{locale:"en-US",timeFormatter:W=>{const V=new Date(W*1e3);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(V)},priceFormatter:W=>`${W.toFixed(2)}%`}});g.current=te;const fe=te.addSeries(p6n,{priceFormat:{type:"custom",formatter:W=>`${W.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!1}),q=n.map(W=>({time:Number(W.timestamp),value:W.total_apr,color:W.total_apr>=0?"rgba(52, 211, 153, 0.6)":"rgba(248, 113, 113, 0.6)"}));fe.setData(q);const se=te.addSeries(d6n,{color:"#9ca3af",lineWidth:1.5,priceFormat:{type:"custom",formatter:W=>`${W.toFixed(2)}%`},priceLineVisible:!1,lastValueVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBackgroundColor:"#ffffff",crosshairMarkerBorderColor:"#0f0f0f"}),ae=n.map(W=>({time:Number(W.timestamp),value:W.total_apr}));return se.setData(ae),te.priceScale("right").applyOptions({borderColor:"transparent",scaleMargins:{top:.1,bottom:.1}}),te.timeScale().applyOptions({borderColor:"transparent",rightOffset:12,barSpacing:10,minBarSpacing:3,fixLeftEdge:!1,tickMarkFormatter:W=>new Date(W*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"})}),te.timeScale().fitContent(),()=>{te.remove()}},[n,s,o]);const ne=Ne.useMemo(()=>{if(n.length===0)return null;const K=n.map(V=>V.total_apr),te=K.reduce((V,ee)=>V+ee,0)/K.length,fe=Math.max(...K),q=Math.min(...K),se=K[K.length-1],ae=K.filter(V=>V>0).length,W=K.filter(V=>V<0).length;return{avg:te,max:fe,min:q,latest:se,positive:ae,negative:W,total:K.length}},[n]);if(!L)return i.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[calc(100vh-5rem)] px-4 bg-[#0a0a0a]",children:[i.jsx("p",{className:"text-neutral-400 text-base mb-4",children:"Invalid URL format"}),i.jsx(Ho,{to:"/funding",className:"text-neutral-300 hover:text-white transition-colors text-sm",children:"← Back to Funding Rates"})]});const J=Ne.useMemo(()=>{if(n.length===0)return null;const K=new Date(Number(n[0].timestamp)*1e3),te=new Date(Number(n[n.length-1].timestamp)*1e3);return{start:K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),end:te.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}},[n]);return i.jsxs(i.Fragment,{children:[i.jsx(to,{children:i.jsxs(xo,{children:[i.jsxs("title",{children:[L.ticker," Funding History -"," ",BC[L.longSide]," /"," ",BC[L.shortSide]," - Dextrabot"]}),i.jsx("meta",{name:"description",content:`Historical funding rate arbitrage APR for ${L.ticker} between ${BC[L.longSide]} and ${BC[L.shortSide]}`})]})}),i.jsxs("div",{className:"flex flex-col w-full h-[calc(100vh-5rem)] bg-[#0a0a0a]",children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-neutral-800",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(Ho,{to:"/funding",className:"inline-flex items-center gap-1.5 text-white hover:text-gray-300 transition-colors text-xs tracking-wide",children:[i.jsx(Lcn,{className:"w-3 h-3"}),i.jsx("span",{children:"Back"})]}),i.jsx("div",{className:"w-px h-4 bg-neutral-700"}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${L.ticker}.svg`,alt:L.ticker,className:"w-5 h-5 rounded-full",onError:K=>{K.target.style.display="none"}}),i.jsxs("h1",{className:"text-sm text-white tracking-wide",children:[L.ticker,i.jsx("span",{className:"text-gray-400 ml-1.5",children:"Funding History"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[J&&i.jsxs("span",{className:"text-gray-400 text-[10px]",children:[J.start," — ",J.end]}),(c==null?void 0:c.updatedAt)&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-px h-3 bg-neutral-700"}),i.jsxs("span",{className:"text-gray-400 text-[10px]",children:["Updated ",g6n(c.updatedAt)]})]})]})]}),i.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[i.jsx("div",{className:"w-72 flex-shrink-0 border-r border-neutral-800 pt-6 px-4 pb-4 overflow-y-auto",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"relative",ref:$,children:[i.jsx("button",{onClick:()=>T(!P),className:"w-full rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5 text-left hover:border-neutral-600 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${L.ticker}.svg`,alt:L.ticker,className:"w-5 h-5 rounded-full",onError:K=>{K.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:L.ticker})]}),i.jsx(H9,{className:`w-4 h-4 text-gray-400 transition-transform ${P?"rotate-180":""}`})]})}),P&&i.jsx("div",{className:"absolute left-0 right-0 mt-1 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 max-h-60 overflow-y-auto",children:d.map(K=>i.jsxs("button",{onClick:()=>{z(L.longSide,L.shortSide,K),T(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K===L.ticker?"bg-neutral-800":""}`,children:[i.jsx("img",{src:`https://cdn.extended.exchange/crypto/${K}.svg`,alt:K,className:"w-5 h-5 rounded-full",onError:te=>{te.target.style.display="none"}}),i.jsx("span",{className:"text-white text-sm",children:K})]},K))})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),i.jsxs("div",{className:"relative",ref:M,children:[i.jsx("button",{onClick:()=>v(!y),className:"w-full rounded-lg border border-emerald-800 bg-emerald-950 p-4 text-left hover:border-emerald-700 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500"}),i.jsx("span",{className:"text-emerald-400 text-[10px] uppercase tracking-widest",children:"Long Position"})]}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(uO,{exchangeId:L.longSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:BC[L.longSide]})]}),c&&i.jsxs("p",{className:"text-emerald-400 text-xs mt-2 tabular-nums",children:[c.longRate>=0?"+":"",c.longRate.toFixed(4),"%/h"]})]}),i.jsx(H9,{className:`w-4 h-4 text-emerald-400 transition-transform ${y?"rotate-180":""}`})]})}),y&&i.jsx("div",{className:"absolute left-0 right-0 mt-1 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 max-h-60 overflow-y-auto",children:Gse.filter(K=>K.id!==L.shortSide).map(K=>i.jsxs("button",{onClick:()=>{z(K.id,L.shortSide,L.ticker),v(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K.id===L.longSide?"bg-neutral-800":""}`,children:[i.jsx(uO,{exchangeId:K.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:K.name})]},K.id))})]}),i.jsx("div",{className:"flex justify-center",children:i.jsx("button",{onClick:X,className:"p-2 rounded-lg border border-neutral-700 bg-neutral-900 hover:bg-neutral-800 hover:border-neutral-600 transition-colors",title:"Swap Long and Short",children:i.jsx(Bcn,{className:"w-4 h-4 text-gray-400 rotate-90"})})}),i.jsxs("div",{className:"relative",ref:F,children:[i.jsx("button",{onClick:()=>N(!C),className:"w-full rounded-lg border border-red-800 bg-red-950 p-4 text-left hover:border-red-700 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsx("span",{className:"text-red-400 text-[10px] uppercase tracking-widest",children:"Short Position"})]}),i.jsxs("div",{className:"flex items-center gap-2.5",children:[i.jsx(uO,{exchangeId:L.shortSide,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:BC[L.shortSide]})]}),c&&i.jsxs("p",{className:"text-red-400 text-xs mt-2 tabular-nums",children:[c.shortRate>=0?"+":"",c.shortRate.toFixed(4),"%/h"]})]}),i.jsx(H9,{className:`w-4 h-4 text-red-400 transition-transform ${C?"rotate-180":""}`})]})}),C&&i.jsx("div",{className:"absolute left-0 right-0 mt-1 rounded-lg bg-neutral-900 border border-neutral-700 shadow-xl z-30 max-h-60 overflow-y-auto",children:Gse.filter(K=>K.id!==L.longSide).map(K=>i.jsxs("button",{onClick:()=>{z(L.longSide,K.id,L.ticker),N(!1)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-left hover:bg-neutral-800 transition-colors ${K.id===L.shortSide?"bg-neutral-800":""}`,children:[i.jsx(uO,{exchangeId:K.id,className:"w-5 h-5"}),i.jsx("span",{className:"text-white text-sm",children:K.name})]},K.id))})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),i.jsx("span",{className:"text-gray-400 text-[10px] uppercase tracking-widest",children:"Live APR"})]}),c?i.jsxs("p",{className:`text-3xl tabular-nums ${c.apr>=0?"text-emerald-400":"text-red-400"}`,children:[c.apr>=0?"+":"",c.apr.toFixed(2),i.jsx("span",{className:"text-xl text-gray-400",children:"%"})]}):i.jsx("p",{className:"text-3xl text-gray-500",children:"—"})]}),ne&&i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 p-4",children:[i.jsx("div",{className:"flex items-center gap-2 mb-2",children:i.jsx("span",{className:"text-gray-400 text-[10px] uppercase tracking-widest",children:"Average APR"})}),i.jsxs("p",{className:`text-3xl tabular-nums ${ne.avg>=0?"text-emerald-400":"text-red-400"}`,children:[ne.avg>=0?"+":"",ne.avg.toFixed(2),i.jsx("span",{className:"text-xl text-gray-400",children:"%"})]})]}),i.jsx("div",{className:"border-t border-neutral-800 my-4"}),ne&&!s&&!o&&i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5",children:[i.jsx("p",{className:"text-gray-400 text-[9px] uppercase tracking-widest mb-1",children:"Latest"}),i.jsxs("p",{className:`text-base tabular-nums ${ne.latest>=0?"text-emerald-400":"text-red-400"}`,children:[ne.latest.toFixed(2),"%"]})]}),i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5",children:[i.jsx("p",{className:"text-gray-400 text-[9px] uppercase tracking-widest mb-1",children:"Maximum"}),i.jsxs("p",{className:"text-base tabular-nums text-emerald-400",children:[ne.max.toFixed(2),"%"]})]}),i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5",children:[i.jsx("p",{className:"text-gray-400 text-[9px] uppercase tracking-widest mb-1",children:"Minimum"}),i.jsxs("p",{className:"text-base tabular-nums text-red-400",children:[ne.min.toFixed(2),"%"]})]}),i.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-neutral-900 px-3 py-2.5",children:[i.jsx("p",{className:"text-gray-400 text-[9px] uppercase tracking-widest mb-1",children:"Profitable"}),i.jsxs("p",{className:"text-base tabular-nums text-white",children:[(ne.positive/ne.total*100).toFixed(0),"%"]})]})]}),!s&&!o&&n.length>0&&i.jsx("div",{className:"mt-4 text-center",children:i.jsxs("p",{className:"text-gray-500 text-[10px] tabular-nums",children:[n.length," data points"]})})]})}),i.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[i.jsx("div",{className:"flex items-center justify-between px-5 py-3 border-b border-neutral-800",children:i.jsx("p",{className:"text-gray-400 text-xs tracking-wide",children:"Historical APR"})}),i.jsx("div",{className:"flex-1 bg-[#0f0f0f] min-h-0 pb-6",children:L&&(L.longSide==="variational"||L.longSide==="paradex"||L.shortSide==="variational"||L.shortSide==="paradex")?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-white text-sm",children:"Funding history is not yet available for Paradex & Variational."})}):s?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("div",{className:"w-5 h-5 border border-neutral-700 border-t-white rounded-full animate-spin"})}):o?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-gray-400 text-xs",children:o})}):n.length===0?i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx("p",{className:"text-gray-400 text-xs",children:"No historical data available"})}):i.jsx("div",{ref:x,className:"w-full h-full",style:{minHeight:"300px"}})})]})]})]})]})},y6n=()=>{const{setSignModalOpen:t,setTelegramChatId:e,setSubscriberRole:n,setSubsExpireDay:r,setMushboomerETH:s,setMushboomerSOL:a,setIsReferralCode:o,setIsReferralCodeName:l,setIsWhitelist:c,setHyperToken:u,setHyperAddress:d}=m.useContext(Qr),{address:f}=ns(),[x,g]=m.useState(1),[y,v]=m.useState(""),[C,N]=m.useState(!1),[P,T]=m.useState(!1),[M,F]=m.useState(""),[$,L]=m.useState(0),[z,X]=m.useState(0),[ne,J]=m.useState(!1),[K,te]=m.useState(!1),fe=Ce=>/^\d*$/.test(Ce),q=Ce=>{["e","E","+","-"].includes(Ce.key)&&Ce.preventDefault()},se=m.useMemo(()=>{if(x==="")return!1;const Ce=Number(x);return Number.isInteger(Ce)&&Ce>=1},[x]),ae=m.useRef($);m.useEffect(()=>{ae.current=$},[$]);const W=m.useRef(0);m.useEffect(()=>{W.current=z},[z]);const V=async()=>{var we,xe;const Ce=window.localStorage.getItem("hyperToken"),me=window.localStorage.getItem("hyperAddress");if(!(!Ce||!me))try{te(!0);const be=await ki(me.toLowerCase(),Ce);be!=null&&be.success?(e(be==null?void 0:be.telegram_chat_id),n(be==null?void 0:be.subscriber_role),r(be==null?void 0:be.subs_expire_day),s((we=be==null?void 0:be.mushboomer_counts)==null?void 0:we.eth),a((xe=be==null?void 0:be.mushboomer_counts)==null?void 0:xe.sol),o(be==null?void 0:be.referral_code),l(be==null?void 0:be.refcode),c(be==null?void 0:be.whitelist),u(Ce),d(me),L(Number((be==null?void 0:be.subs_expire_day)||0)),te(!1)):(window.localStorage.removeItem("hyperToken"),window.localStorage.removeItem("hyperAddress"),u(""),d(""),te(!1))}catch(be){console.error("Token verification error:",be),console.error(be.message||"An unknown error occurred."),te(!1)}};m.useEffect(()=>{ne&&V()},[ne]),m.useEffect(()=>{const Ce=localStorage.getItem("hyperToken"),me=localStorage.getItem("hyperAddress");J(!!(Ce&&me));const we=setInterval(()=>{const xe=localStorage.getItem("hyperToken"),be=localStorage.getItem("hyperAddress");J(!!(xe&&be))},800);return()=>clearInterval(we)},[]);const ee=async()=>new _l(window.ethereum).eth.getAccounts(me=>me),oe=async(Ce="subscribe",me=24,we=5e3)=>{me<=0||(await new Promise(xe=>setTimeout(xe,we)),await V(),Ce==="subscribe"&&ae.current===W.current?oe(Ce,me-1,we):V())},de=async Ce=>{const me=window.localStorage.getItem("hyperToken"),we=window.localStorage.getItem("hyperAddress");if(!me||!f){t(!0);return}v(""),X(ae.current),W.current=ae.current,T(!0),N(!0);try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x1"}]})}catch(je){console.error("Failed to switch network",je),N(!1);return}const xe=new _l(window.ethereum);var be=await ee();if(be.length>0?be=be[0]:be=void 0,be){const Ie=Ce*.09,Re=xe.utils.toWei(Ie.toString(),"ether"),Qe={from:be,to:"0xdEAe8586eD227A5096EBae47342fFc1ED99f13F9",value:Re};await xe.eth.sendTransaction(Qe).then(Ke=>{console.log("txHash :>> ",Ke),N(!1),F(Ke.transactionHash),fetch("https://dextrabothypev2.nftinit.io/api/hyper/payment/save/",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({address:f?f.toLowerCase():we,token:me,payment_tx:Ke.transactionHash,payment_role:"farming_tools",tx_qty:Number(x)})}),V(),oe("subscribe")}).catch(Ke=>{console.log(Ke),Ke.code===-32003||Ke.message.includes("insufficient funds")?v("Insufficient funds."):Ke.message==="MetaMask Tx Signature: User denied transaction signature."&&T(!1)})}else await xe.eth.requestAccounts()};return i.jsxs(i.Fragment,{children:[P&&Aa.createPortal(i.jsx(jd,{open:P,setOpen:T,transactionHash:M,transactionLoading:C,paymentPresaleRole:!($<=z),errorFunds:y,activeMethod:2}),document.body),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx("button",{onClick:()=>g(Ce=>{const me=Number(Ce||0);return me>1?String(me-1):"1"}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"–"}),i.jsx("input",{value:x,onChange:Ce=>{const me=Ce.target.value.trim();if(me==="")return g("");fe(me)&&g(me)},onKeyDown:q,inputMode:"numeric",autoComplete:"off",placeholder:"e.g. 10",className:"w-full h-8 text-center rounded-md bg-[#242424] border border-[#353535] text-white text-[13px] font-semibold outline-none placeholder:text-[#7F7F7F]"}),i.jsx("button",{onClick:()=>g(Ce=>{const me=Number(Ce||0);return String(me+1)}),className:"w-8 h-8 flex items-center justify-center rounded-md bg-[#242424] border border-[#353535] text-[#bbb] hover:text-white hover:border-[#555] transition-all",children:"+"})]}),x!==""&&!se&&i.jsx("div",{className:"text-[#FF797C] text-[12px]",children:"Enter an integer that is at least 1."})]}),se&&i.jsxs("div",{className:"text-[12px] font-semibold text-green-400",children:[" ",x," months will be added to your subscription."]}),i.jsxs("div",{className:"relative flex items-center justify-center gap-3 px-4 py-2 rounded-xl shadow-[0_0_25px_rgba(255,140,0,0.15)] backdrop-blur-md bg-white/5 border border-white/10",children:[i.jsxs("span",{className:"line-through text-gray-400/70 text-xl",children:[(x*.12).toFixed(2)," ETH"]}),i.jsxs("span",{className:"text-2xl font-bold bg-gradient-to-r from-orange-400 to-pink-500 bg-clip-text text-transparent",children:[(x*.09).toFixed(2)," ETH"]})]}),i.jsx("div",{onClick:Ce=>{Ce.preventDefault(),se&&de(x)},className:`text-[10px] sm:text-xs xl:text-[13px] font-semibold text-gray-200 select-none border rounded-md px-4 py-2 ${se?"border-[#8861FF] bg-[#7446FF] cursor-pointer":"bg-[#2a2a2a] border-[#3a3a3a] opacity-60 cursor-not-allowed"}`,children:"Buy Now"})]})},v6n=({open:t,setOpen:e})=>{const{subsExpireDay:n}=m.useContext(Qr),r=()=>{const s=Date.now(),a=localStorage.getItem("hyperAddress");localStorage.setItem(`lighterCopyTradeDismissedAt_${a}`,s.toString()),e(!1)};return i.jsxs(_a,{open:t,onClose:()=>{},className:"relative z-50 font-manrope",children:[i.jsx(Ea,{transition:!0,style:{backgroundColor:"rgba(0, 0, 0, 0.48)"},className:"fixed inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),i.jsx("div",{className:"fixed inset-0 z-50 w-screen overflow-y-auto",children:i.jsx("div",{className:"flex min-h-full items-center justify-center p-4 text-center sm:p-0",children:i.jsx(ya,{transition:!0,className:"relative transform overflow-hidden bg-[#161616] text-left shadow-xl transition-all data-[closed]:translate-y-4 data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in data-[closed]:sm:translate-y-0 data-[closed]:sm:scale-95 rounded-3xl",children:i.jsxs("div",{className:"relative flex flex-col justify-start items-center gap-6 w-full min-h-[420px] p-4 sm:p-12 rounded-3xl max-w-[600px]",children:[i.jsx("button",{onClick:r,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{className:"p-1",src:Ua,alt:"close"})}),i.jsx("div",{className:"pt-4",children:i.jsx("img",{src:Yi,alt:"",className:"w-[86px h-[86px]"})}),i.jsx("div",{className:"flex justify-center items-center w-full",children:i.jsxs("div",{className:"flex flex-col items-center w-full gap-3 sm:gap-5",children:[i.jsxs("div",{className:"text-white font-manrope text-[20px] sm:text-[22px] font-extrabold leading-none",children:["Your subscription is ending in"," ",n||0," days"]}),i.jsxs("div",{className:"text-[13px] sm:text-[14px] text-center text-white/90 font-manrope font-semibold leading-[18px] max-w-[70ch]",children:["Renew now to keep access to Copy Trading, bots, and all premium features.",i.jsx("br",{}),i.jsx("br",{}),i.jsx("span",{className:"text-[#67FFBD] font-bold",children:"Renew now and get 25% off your subscription."})]}),i.jsx(y6n,{})]})})]})})})})]})},w6n=({open:t,setOpen:e})=>{const n=()=>{localStorage.setItem("strategySelectorModalDismissedAt",Date.now().toString()),e(!1)},r=()=>{localStorage.setItem("strategySelectorModalDismissedAt",Date.now().toString())},s=[{key:"hyperGrid",title:"Hyperliquid Grid Bot",desc:"Automated grid trading on Hyperliquid futures.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/terminal/hyperliquid/BTC#gridbot"},{key:"hlMaker",title:"Hyperliquid Market Maker Bot",desc:"Liquidity-providing market making with dynamic spreads.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/market-maker"},{key:"lighterMaker",title:"Lighter DCA Bot",desc:"Automate your DCA entries on Lighter. Coming soon.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),comingSoon:!0},{key:"extendedMaker",title:"Extended DCA Bot",desc:"Advanced market making strategies.",icon:"https://app.extended.exchange/assets/logo/extended.svg",badge:"New",highlighted:!0,url:"/dca-bot"},{key:"lighterGrid",title:"Lighter Grid Bot",desc:"Automated grid trading on Lighter futures.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/terminal/lighter/BTC#gridbot"},{key:"extendedGrid",title:"Extended Grid Bot",desc:"Advanced grid logic with dynamic rebalancing.",icon:"https://app.extended.exchange/assets/logo/extended.svg",url:"/terminal/extended/BTC#gridbot",badge:"New",highlighted:!0},{key:"hlCopyTrade",title:"Hyperliquid Copy Trade",desc:"Automatically copy trade best Hyperliquid wallets.",icon:"https://app.hyperliquid.xyz/coins/HYPE.svg",url:"/discover-wallets"},{key:"lgCopyTrade",title:"Lighter Copy Trade",desc:"Automatically copy trade best Hyperliquid wallets on Lighter.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/discover-wallets"},{key:"lgDelta",title:"Lighter Delta Neutral",desc:"Delta-neutral farming on Lighter.",icon:i.jsx(M0,{className:"w-4 h-4 text-white"}),url:"/discover-wallets#lighter-farming"},{key:"asterBot",title:"Aster Farming Bot",desc:"Farm points on Aster exchange.",icon:i.jsx($A,{className:"w-4 h-4"}),url:"/discover-wallets#aster-farming"},{key:"extendedBot",title:"Extended Delta Neutral",desc:"Delta-neutral farming on Extended.",icon:"https://app.extended.exchange/assets/logo/extended.svg",url:"/discover-wallets#extended-farming",badge:"New",highlighted:!0},{key:"variationalBot",title:"Variational Farming Bot",desc:"Farm points on Variational exchange.",icon:lT,url:"/discover-wallets#variational-farming"},{key:"paradexBot",title:"Paradex Farming Bot",desc:"Farm points on Paradex exchange.",icon:cT,url:"/discover-wallets#paradex-farming"},{key:"pacificaBot",title:"Pacifica Farming Bot",desc:"Farm points on Pacifica exchange.",icon:"https://app.pacifica.fi/imgs/icon.svg",url:"/discover-wallets#pacifica-farming"},{key:"apexBot",title:"Apex Farming Bot",desc:"Farm points on Apex exchange.",icon:xae,url:"/discover-wallets#apex-farming"}],a=o=>{if(!o)return null;if(Ne.isValidElement(o))return o;if(typeof o=="function"){const l=o;return i.jsx(l,{className:"w-6 h-6"})}return typeof o=="string"&&(o.startsWith("/")||o.startsWith("http"))?i.jsx("img",{src:o,alt:"",className:"w-6 h-6 object-contain",draggable:!1}):i.jsx("span",{className:"text-2xl leading-none",children:o})};return i.jsxs(_a,{open:t,onClose:n,className:"relative z-50",children:[i.jsx(Ea,{className:"fixed inset-0 bg-black/50 backdrop-blur-sm"}),i.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-3 pb-4 pt-10 sm:p-0",children:i.jsxs(ya,{className:"relative w-full max-w-[780px] max-h-[76vh] sm:max-h-[96vh] rounded-t-[28px] sm:rounded-[28px] border border-white/5 bg-gradient-to-b from-[#191919] via-[#141414] to-[#111111] p-4 sm:py-3 sm:px-6 shadow-[0_22px_60px_rgba(0,0,0,0.9)] overflow-y-auto",children:[i.jsx("button",{onClick:n,className:"cursor-pointer flex w-9 h-9 absolute right-3 top-3 rounded-full p-1 justify-center items-center hover:bg-[#7535FE]/70",children:i.jsx("img",{src:Ua,alt:"close",className:"w-4 h-4"})}),i.jsx("h2",{className:"text-white text-[20px] sm:text-[26px] font-extrabold text-center mb-3 sm:mb-4 tracking-tight",children:"What brings you here?"}),i.jsx("div",{className:"space-y-4",children:i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5",children:s==null?void 0:s.map(o=>i.jsxs("div",{onClick:()=>{o.url&&(o.url.startsWith("/"),window.open(o.url,"_blank"),r())},className:`relative rounded-2xl p-2.5 transition ${o.highlighted&&!o.comingSoon?"bg-[#111827] border border-[#1c2741] hover:bg-[#202020]":o.highlighted&&o.comingSoon?"bg-[#6B5CFF14] border border-[#6B5CFF59]":"bg-[#181818] border border-[#2a2a2a] hover:bg-[#202020]"} ${o.comingSoon?"cursor-not-allowed":"cursor-pointer"}`,children:[o.badge&&!o.comingSoon&&i.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 z-10",children:i.jsx("div",{className:"px-1 sm:px-2.5 py-0.5 rounded-md text-[9px] sm:text-[10px] font-bold bg-[#3b82f6] text-white shadow-md min-w-max",children:o.badge})}),o.badge&&o.comingSoon&&i.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 z-10",children:i.jsx("div",{className:"px-1.5 sm:px-2.5 py-0.5 rounded-md text-[9px] sm:text-[10px] font-bold bg-[#6B5CFF] text-white shadow-md min-w-max",children:o.badge})}),i.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[i.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-black/20 text-2xl",children:a(o.icon)}),i.jsx("div",{className:"text-white font-semibold text-sm",children:o.title}),o.desc&&i.jsx("div",{className:"text-[#9b9b9b] text-[11px] leading-tight",children:o.desc})]})]},o.key))})})]})})]})},C6n=({open:t,setOpen:e})=>null,dO="#basedapp-farming",fO="#aster-farming",hO="#lighter-farming",pO="#apex-farming",mO="#variational-farming",xO="#extended-farming",gO="#paradex-farming",bO="#pacifica-farming";function S6n(){const t=[{from:"/feed",to:"/tracker"},{from:"/wallet-activities",to:"/tracker"},{from:"/favorite-wallets",to:"/tracked-wallets"},{from:"/high-volume-trades",to:"/hyperliquid-whale-trades"}],{hyperToken:e,subsExpireDay:n}=m.useContext(Qr),r=Kl(),s=jo(),[a,o]=m.useState(!1),[l,c]=m.useState(!1),[u,d]=m.useState(!1),[f,x]=m.useState(!1),g=r.hash===dO,y=r.hash===fO,v=r.hash===hO,C=r.hash===pO,N=r.hash===mO,P=r.hash===xO,T=r.hash===gO,M=r.hash===bO,F=Ne.useCallback(te=>{te?r.hash!==dO&&s(r.pathname+r.search+dO,{replace:!0}):r.hash===dO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),$=Ne.useCallback(te=>{te?r.hash!==fO&&s(r.pathname+r.search+fO,{replace:!0}):r.hash===fO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),L=Ne.useCallback(te=>{te?r.hash!==hO&&s(r.pathname+r.search+hO,{replace:!0}):r.hash===hO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),z=Ne.useCallback(te=>{te?r.hash!==pO&&s(r.pathname+r.search+pO,{replace:!0}):r.hash===pO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),X=Ne.useCallback(te=>{te?r.hash!==mO&&s(r.pathname+r.search+mO,{replace:!0}):r.hash===mO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),ne=Ne.useCallback(te=>{te?r.hash!==xO&&s(r.pathname+r.search+xO,{replace:!0}):r.hash===xO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),J=Ne.useCallback(te=>{te?r.hash!==gO&&s(r.pathname+r.search+gO,{replace:!0}):r.hash===gO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]),K=Ne.useCallback(te=>{te?r.hash!==bO&&s(r.pathname+r.search+bO,{replace:!0}):r.hash===bO&&s(r.pathname+r.search,{replace:!0})},[r.pathname,r.search,r.hash,s]);return m.useEffect(()=>{const te=localStorage.getItem("dailyPicksDismissedAt"),fe=localStorage.getItem("dailyPicksBlockedUntil"),q=Date.now();if(fe&&q<parseInt(fe)){o(!1);return}if(te){const se=new Date(parseInt(te)).toDateString(),ae=new Date().toDateString();if(se===ae){o(!1);return}}o(!0)},[r.pathname,e]),m.useEffect(()=>{const te=window.localStorage.getItem("hyperToken"),fe=localStorage.getItem("hyperAddress");if(!te||!fe)return;if(n===null||n===0||Number(n)>7){c(!1);return}const q=localStorage.getItem(`lighterCopyTradeDismissedAt_${fe}`);if(q){const se=new Date(parseInt(q)).toDateString(),ae=new Date().toDateString();if(se===ae){window.location.pathname==="/my-profile"?c(!0):c(!1);return}}c(!0)},[r.pathname,e,n]),m.useEffect(()=>{const te=localStorage.getItem("strategySelectorModalDismissedAt");if(te){const fe=new Date(parseInt(te)).toDateString(),q=new Date().toDateString();if(fe===q){d(!1);return}}d(!0)},[r.pathname,e]),m.useEffect(()=>{if(localStorage.getItem("lighterReportModalDismissed")==="true"){x(!1);return}x(!0)},[r.pathname]),i.jsxs(i.Fragment,{children:[i.jsx("div",{children:i.jsx(ZZe,{})}),i.jsxs("div",{children:[i.jsx($ln,{}),i.jsxs(YQe,{children:[i.jsx(pa,{path:"/",element:i.jsx(aun,{})}),i.jsx(pa,{path:"/sitemap",element:i.jsx(dun,{})}),i.jsx(pa,{path:"/videos",element:i.jsx(fun,{})}),t.map(({from:te,to:fe})=>i.jsx(pa,{path:te,element:i.jsx(che,{to:fe,replace:!0})},te)),i.jsxs(pa,{element:i.jsx(gan,{}),children:[i.jsx(pa,{path:"/mobile-auth",element:i.jsx(uun,{})}),i.jsx(pa,{path:"discover-wallets",element:i.jsx(Yon,{})}),i.jsx(pa,{path:"/hyperliquid-vaults",element:i.jsx(hun,{})}),i.jsx(pa,{path:"/back-testing",element:i.jsx(Yvn,{})}),i.jsx(pa,{path:"/hyperliquid-whale-trades",element:i.jsx(Lvn,{})}),i.jsx(pa,{path:"wallet-details/:walletAddress",element:i.jsx(Dln,{})}),i.jsx(pa,{path:"tracked-wallets",element:i.jsx(zln,{})}),i.jsx(pa,{path:"tracker",element:i.jsx(acn,{})}),i.jsx(pa,{path:"referral/:code?",element:i.jsx(fcn,{})}),i.jsx(pa,{path:"wallet-management",element:i.jsx(jcn,{})}),i.jsx(pa,{path:"copy-trade",element:i.jsx(kcn,{})}),i.jsx(pa,{path:"leaderboard",element:i.jsx(Mcn,{})}),i.jsx(pa,{path:"ticker",element:i.jsx(gun,{})}),i.jsx(pa,{path:"terminal",element:i.jsx(che,{to:"/terminal/hyperliquid/BTC",replace:!0})}),i.jsx(pa,{path:"terminal/:coin",element:i.jsx(N6n,{})}),i.jsx(pa,{path:"terminal/:exchange/:coin",element:i.jsx(M1n,{})}),i.jsx(pa,{path:"telegram-verify",element:i.jsx(Bvn,{})}),i.jsx(pa,{path:"telegram-api-wallet",element:i.jsx(Qvn,{})}),i.jsx(pa,{path:"subscribe",element:i.jsx(Dwn,{})}),i.jsx(pa,{path:"my-profile",element:i.jsx(Xwn,{})}),i.jsx(pa,{path:"hyperliquid-fee-calculator",element:i.jsx(XAe,{})}),i.jsx(pa,{path:"hyperliquid-fee-calculator/:walletAddress",element:i.jsx(XAe,{})}),i.jsx(pa,{path:"market-maker",element:i.jsx(Gwn,{})}),i.jsx(pa,{path:"dca-bot",element:i.jsx(Rwn,{})}),i.jsx(pa,{path:"funding",element:i.jsx(Zwn,{})}),i.jsx(pa,{path:"funding-history/:pair",element:i.jsx(b6n,{})})]}),i.jsx(pa,{path:"*",element:i.jsx(A6n,{url:"https://dextrabot.com/"})})]}),i.jsx(gce,{open:g,setOpen:F}),i.jsx(v6n,{open:l,setOpen:c}),i.jsx(w6n,{open:u,setOpen:d}),i.jsx(C6n,{open:f,setOpen:x}),i.jsx(bce,{open:y,setOpen:$}),i.jsx(yce,{open:v,setOpen:L}),i.jsx(vce,{open:C,setOpen:z}),i.jsx(wce,{open:N,setOpen:X}),i.jsx(wU,{open:P,setOpen:ne}),i.jsx(Cce,{open:T,setOpen:J}),i.jsx(Sce,{open:M,setOpen:K})]})]})}function N6n(){const{coin:t}=g2(),e=jo();return m.useEffect(()=>{const n=t||"BTC",r=typeof window<"u"&&window.location.hash||"";e(`/terminal/hyperliquid/${n}${r}`,{replace:!0})},[t,e]),null}function A6n({url:t}){return Ne.useEffect(()=>{window.location.replace(t)},[t]),i.jsx(to,{children:i.jsxs(xo,{children:[i.jsx("meta",{name:"prerender-status-code",content:"301"}),i.jsx("meta",{name:"prerender-header",content:`Location: ${t}`})]})})}const j6n="4953aed406a7fd4457496250b7e4efbc",E6n=PBt({appName:"Dextrabot",projectId:j6n,chains:[M_,zbe,Ube,$be],transports:{[M_.id]:U7(),[zbe.id]:U7(),[Ube.id]:U7(),[$be.id]:U7()},ssr:!1}),_6n=new Syt,k6n=document.getElementById("root"),T6n=y8e.createRoot(k6n);T6n.render(i.jsx(sZe,{children:i.jsx(Qbt,{config:E6n,children:i.jsx(Wyt,{client:_6n,children:i.jsx(ZLt,{modalSize:"compact",theme:YLe({borderRadius:"large",fontStack:"rounded",overlayBlur:"large"}),children:i.jsx(Uwt,{children:i.jsx(S6n,{})})})})})}));const s8e=Object.freeze(Object.defineProperty({__proto__:null,default:fne},Symbol.toStringTag,{value:"Module"}));export{Br as B,boe as E,w9 as H,os as _,SCn as a,m1 as b,c$ as c,l0t as d,C2 as e,ix as f,Mae as g,Ii as h,Jae as i,I6n as j,Ru as k,Eke as l,Lbt as m,sRt as r,Mc as s,qCn as t};